From c9ba39388d068dea20cdc0d045f1204cd4bb2947 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Wed, 13 Apr 2016 18:37:24 -0700 Subject: [PATCH] Updates for new partition layout and mount management. --- .../all/initrds/loader-initrd-files/PKG.yml | 2 -- .../loader-initrd-files/src/bin/banner | 4 +-- .../initrds/loader-initrd-files/src/bin/boot | 10 +++--- .../loader-initrd-files/src/bin/sysinit | 34 +++---------------- .../loader-initrd-files/src/bootmodes/swi | 8 ++--- .../loader-initrd-files/src/etc/rootperms | 5 --- 6 files changed, 16 insertions(+), 47 deletions(-) diff --git a/packages/base/all/initrds/loader-initrd-files/PKG.yml b/packages/base/all/initrds/loader-initrd-files/PKG.yml index cdb7a5ac..2fc41557 100644 --- a/packages/base/all/initrds/loader-initrd-files/PKG.yml +++ b/packages/base/all/initrds/loader-initrd-files/PKG.yml @@ -26,8 +26,6 @@ packages: summary: Open Network Linux System Loader Common Initscripts files: - src/bin/initblockdev : /sbin/ - src/bin/initmounts : /sbin/ src/bin/initnetdev : /sbin/ changelog: Change changes changes., diff --git a/packages/base/all/initrds/loader-initrd-files/src/bin/banner b/packages/base/all/initrds/loader-initrd-files/src/bin/banner index 54165d40..bcd344c0 100755 --- a/packages/base/all/initrds/loader-initrd-files/src/bin/banner +++ b/packages/base/all/initrds/loader-initrd-files/src/bin/banner @@ -23,9 +23,9 @@ field "$ONL_PLATFORM" " Platform: $ONL_PLATFORM" field "MA1_ADDR" " ma1: $MA1_ADDR" echo "*" echo "************************************************************" -if [ -f /mnt/flash/boot-config ]; then +if [ -f /etc/onl/boot-config ]; then msg_info "boot-config" - cat /mnt/flash/boot-config + cat /etc/onl/boot-config else if [ -f /bin/boot-config.py ]; then diff --git a/packages/base/all/initrds/loader-initrd-files/src/bin/boot b/packages/base/all/initrds/loader-initrd-files/src/bin/boot index 1791ed36..63ca5ec7 100755 --- a/packages/base/all/initrds/loader-initrd-files/src/bin/boot +++ b/packages/base/all/initrds/loader-initrd-files/src/bin/boot @@ -49,7 +49,7 @@ Usage: $0 [-h|--help] [-t|--testonly] [--rootfs ROOTFS] --cache LOCATION [SWI] format of the SWI argument: DEV:PATH - /mnt/DEV/PATH + /mnt/onl/DEV/PATH Loads a SWI file from local storage device DEV (e.g. flash). http://[USER:PASSWORD@]SERVER[:PORT]/PATH ftp://[USER:PASSWORD@]SERVER[:PORT]/PATH @@ -111,18 +111,18 @@ case "${SWI}" in fi ;; *) - # Parse dev:file or dev:/file or /mnt/dev/file - parselocal='s#\(\([^:/]*\):/\?\|/mnt/\([^/]*\)/\)\?\(.*\)#dev="\2\3" file="\4"#p' + # Parse dev:file or dev:/file or /mnt/onl/dev/file + parselocal='s#\(\([^:/]*\):/\?\|/mnt/onl/\([^/]*\)/\)\?\(.*\)#dev="\2\3" file="\4"#p' eval $(echo "${SWI}" | sed -n "${parselocal}") if [ "${dev}" ] ; then # Wait for /mnt/dev to show up - waitforblockdev "/mnt/${dev}" + : else # Assume file is relative, parse absolutified file eval $(realpath "${file}" | sed -n "${parselocal}") SWI="${dev}:${file}" fi - swipath="/mnt/${dev}/${file}" + swipath="/mnt/onl/${dev}/${file}" [ -f "${swipath}" ] || { echo "${SWI} not found or not a file"; exit 1; } ;; esac diff --git a/packages/base/all/initrds/loader-initrd-files/src/bin/sysinit b/packages/base/all/initrds/loader-initrd-files/src/bin/sysinit index 216ad7e0..6c255b85 100755 --- a/packages/base/all/initrds/loader-initrd-files/src/bin/sysinit +++ b/packages/base/all/initrds/loader-initrd-files/src/bin/sysinit @@ -53,7 +53,6 @@ while read -r l; do esac done - # Populate platform-specific settings . /lib/platform-detect @@ -62,46 +61,23 @@ if [ ! -f /etc/onl/abort ]; then # Tell kernel to invoke mdev when devices are added or removed echo /sbin/mdev >/proc/sys/kernel/hotplug - - # Initialize any block and net devices already present - ( cd /sys/class/block; for d in *; do initblockdev $d add; done ) - if [ -d /sys/class/ubi ]; then - ( cd /sys/class/ubi; for d in *; do initblockdev $d add; done ) - fi + # Initialize net devices ( cd /sys/class/net; for d in *; do initnetdev $d add; done ) # Initialize platform mounts - initmounts - - # Perform recovery if necessary; reboot automatically - if /bin/recover; then - initmounts - else - restoreconsole - echo "Recovery failed." - echo "Press CR now to exit sysinit and access the loader shell." - echo "Otherwise, the system will reboot in 3s." - if read -t 3 prompt; then - trap - EXIT - exit - fi - reboot -f - fi - + initmounts -q if [ -f /etc/issue ]; then cat /etc/issue fi - waitforblockdev /mnt/flash - sleep 1 # wait for external block devices to be mounted - [ ! -f /mnt/flash/boot-config ] || cat /mnt/flash/boot-config >>/etc/onl/boot-config + [ ! -f /mnt/onl/boot/boot-config ] || cat /mnt/onl/boot/boot-config >>/etc/onl/boot-config # # Initialize the /mnt/flash/boot area. # - mkdir -p /mnt/flash/boot - rm -rf /mnt/flash/boot/* + #mkdir -p /mnt/data/boot + #rm -rf /mnt/flash/boot/* fi diff --git a/packages/base/all/initrds/loader-initrd-files/src/bootmodes/swi b/packages/base/all/initrds/loader-initrd-files/src/bootmodes/swi index d1fa5d96..7d6a3fd7 100755 --- a/packages/base/all/initrds/loader-initrd-files/src/bootmodes/swi +++ b/packages/base/all/initrds/loader-initrd-files/src/bootmodes/swi @@ -14,11 +14,11 @@ if [ ! "${SWI}" ]; then exit 200 fi -if [ "${SWI}" = "flash2::latest" ]; then - # Boot the latest (by mtime) SWI in the flash2 partition. - SWI=`ls /mnt/flash2/*.swi -t | head -n1` +if [ "${SWI}" = "images::latest" ]; then + # Boot the latest (by mtime) SWI in the images partition. + SWI=`ls /mnt/onl/images/*.swi -t | head -n1` if [ -z "${SWI}" ]; then - msg_error "No SWI available in /mnt/flash2. SWI booting cannot continue." + msg_error "No SWI available in /mnt/onl/images. SWI booting cannot continue." exit 200 fi fi diff --git a/packages/base/all/initrds/loader-initrd-files/src/etc/rootperms b/packages/base/all/initrds/loader-initrd-files/src/etc/rootperms index 8d76e780..bf95a0a5 100644 --- a/packages/base/all/initrds/loader-initrd-files/src/etc/rootperms +++ b/packages/base/all/initrds/loader-initrd-files/src/etc/rootperms @@ -13,21 +13,16 @@ /etc/passwd f 644 0 0 - - - - - /bin/autoboot f 755 0 0 - - - - - /bin/boot f 755 0 0 - - - - - -/bin/discoverbootconf f 755 0 0 - - - - - /bin/help f 755 0 0 - - - - - /bin/ifget f 755 0 0 - - - - - /bin/ifup f 755 0 0 - - - - - -/bin/initblockdev f 755 0 0 - - - - - /bin/initnetdev f 755 0 0 - - - - - /bin/login f 755 0 0 - - - - - /bin/netconf f 755 0 0 - - - - - -/bin/recover f 755 0 0 - - - - - /bin/swiinfo f 755 0 0 - - - - - /bin/switchroot f 755 0 0 - - - - - /bin/sysinit f 755 0 0 - - - - - /bin/udhcpc f 755 0 0 - - - - - -/bin/waitforblockdev f 755 0 0 - - - - - -/bin/wipe f 755 0 0 - - - - - /bin/zcip f 755 0 0 - - - - - /lib/udhcpc-script f 755 0 0 - - - - - /lib/zcip-script f 755 0 0 - - - - -