Changeset 720 for branches


Ignore:
Timestamp:
Jan 25, 2016, 2:45:54 AM (5 years ago)
Author:
ehem
Message:

Propogate kernel's devtmpfs onto flash area if present and mounted at
boot. This is REQUIRED by utilities in latest Debian release.
Fixes to scripting of search for root device. A bashism had snuck in,
which doesn't work for dash. Move handling of nvram variable, allows
for better reportting of search for root value.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/contrib/openwrt/files/package/base-files/files/etc/preinit

    r606 r720  
    1010# Configuration:
    1111#
    12 # - The root device can be changed by modifying the `nvram` variable.  Setting
    13 #   it to a value of "LABEL=DEBWRT_ROOT" will emulate the effect of this script,
    14 #   any format acceptable to blkid(8) should be accepted by this script
    15 #   (UUID=<some_uuid> is the other notable option).
     12# - The root device can be changed by modifying the `nvram` variable
     13#   "debwrt_root".  Setting it to a value of "LABEL=DEBWRT_ROOT" will emulate
     14#   the default behavior of this script, any format acceptable to blkid(8)
     15#   should be accepted by this script (UUID=<some_uuid> is the other notable
     16#   format).
    1617# - Setting the variable "vmlinux=<somefile>" in /boot/kexec.conf can be used to
    1718#   override where this script looks for the kernel, it defaults to
     
    3839   local dev=""
    3940
    40    root=$(nvram get debwrt_root)
    41    true ${root:=${DEFAULT_ROOT}}
    42 
    4341   while [ $n -lt $WAIT ]; do
    44       dev=$(blkid -t ${root})
    45       if [ "" != "$dev" ]; then
    46          dev=${dev/:*/}
    47          break;
    48       fi
     42      dev=$(blkid -o device -t "$1")
     43      [ "" != "$dev" ] && break
    4944      sleep 1
    5045      n=$((n+1))
     46      echo -n .
    5147   done
    5248
    53    dev=${dev:-$DEFAULT_DEV}
    5449   echo $dev
    5550}
     
    5853do_debwrt_boot() {
    5954
     55   root=$(nvram get debwrt_root)
     56   true ${root:=${DEFAULT_ROOT}}
     57
    6058   echo "[ ---------- ] DebWrt boot"
    61    echo -n "[ ---------- ] Waiting for device ${DEFAULT_ROOT}..."
    62    dev=$(wait_for_root_device)
     59   echo -n "[ ---------- ] Waiting for device ${root}..."
     60   dev=$(wait_for_root_device "${root}")
     61
     62   if [ -b "$dev" ]
     63   then  echo "found.  Booting from ${dev}."
     64   else
     65      dev=${DEFAULT_DEV}
     66      echo "failed.  Defaulting to boot from ${dev}."
     67   fi
    6368
    6469   if [ -b "$dev" ]; then
    65       echo "found. Booting from $dev."
    66       # root device found
    67       # pivot_root to it and run /sbin/init
     70      # pivot_root to root device and run /sbin/init
    6871      # or kexec if /boot/vmlinux is found on the new root
    6972
     
    102105         kexec -e
    103106      else
     107         # propogate kernel's devtmpfs (if present) onto debian area
     108         mountpoint -q /dev && mount --bind /dev /mnt/dev
    104109         # pivot_root and run /sbin/init
    105110         umount /sys  2>&-
Note: See TracChangeset for help on using the changeset viewer.