Changeset 498


Ignore:
Timestamp:
Nov 20, 2012, 6:05:46 AM (8 years ago)
Author:
ehem
Message:

Creating an alternative mode to boot via OpenWRT. This keeps more of OpenWRT
intact and so might be used for emergency recovery. The preinit is still
intact, but can be removed and this will takeover.

Location:
branches/contrib/openwrt/files/package/base-files/files/lib
Files:
2 added
1 copied

Legend:

Unmodified
Added
Removed
  • branches/contrib/openwrt/files/package/base-files/files/lib/preinit/35_debwrt_boot

    r497 r498  
    88# - mount root device, pivot_root to it and run /sbin/init
    99
    10 #set -x
    1110
    1211WAIT=30
    13 ROOT_LABEL=DEBWRT_ROOT
     12ROOT_TARGET=LABEL=DEBWRT_ROOT
    1413DEFAULT_DEV=/dev/sda1
    1514
    16 mount -t sysfs sysfs /sys
    17 mount -t proc  none  /proc
    18 mount -t tmpfs tmpfs /dev -o mode=0755,size=512K
    19 mount -t tmpfs tmpfs /tmp -o size=3m,nosuid,nodev,mode=1777
    20 [ -c /dev/console ] || mknod /dev/console c 5 1
    21 /sbin/hotplug2 --set-worker /lib/hotplug2/worker_fork.so --set-rules-file /etc/hotplug2-init.rules --no-persistent --set-coldplug-cmd /sbin/udevtrigger
    22 /sbin/hotplug2 --set-worker /lib/hotplug2/worker_fork.so --set-rules-file /etc/hotplug2-init.rules --persistent &
    2315
    2416wait_for_root_device() { # return: (default) root device
     
    2719
    2820   while [ $n -lt $WAIT ]; do
    29       dev=$(blkid -t LABEL=$ROOT_LABEL)
     21      dev=$(blkid -t ${ROOT_TARGET})
    3022      if [ "" != "$dev" ]; then
    3123         dev=${dev/:*/}
     
    4032}
    4133
     34
     35do_debwrt_boot() {
     36
    4237echo "[ ---------- ] DebWrt boot"
    43 echo -n "[ ---------- ] Waiting for device with LABEL=$ROOT_LABEL..."
     38echo -n "[ ---------- ] Waiting for device with ${ROOT_TARGET}..."
    4439dev=$(wait_for_root_device)
    4540
     
    7469  fi
    7570
    76 else                         
    77    # no root device available
    78    # spwan normal shell
    79    echo "not found. Starting shell."
    80    exec /bin/sh
     71# this is nonsensical, best to let OpenWRT boot to act as recovery shell
     72#else
     73#   # no root device available
     74#   # spwan normal shell
     75#   echo "not found. Starting shell."
     76#   exec /bin/sh
    8177fi
    8278
     79}
     80
     81boot_hook_add preinit_essential do_debwrt_boot
     82
Note: See TracChangeset for help on using the changeset viewer.