summaryrefslogtreecommitdiffstats
path: root/recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh')
-rw-r--r--recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh b/recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh
index 66f0cdc..b990344 100644
--- a/recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh
+++ b/recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh
@@ -77,6 +77,18 @@ log() {
77 echo "rorootfs-overlay: $1" >$CONSOLE 77 echo "rorootfs-overlay: $1" >$CONSOLE
78} 78}
79 79
80wait_for_device() {
81 counter=0
82 while [ ! -b $1 ]; do
83 sleep .100
84 counter=$((counter + 1))
85 if [ $counter -ge 50 ]; then
86 fatal "$1 is not availble"
87 exit
88 fi
89 done
90}
91
80early_setup 92early_setup
81 93
82[ -z "${CONSOLE+x}" ] && CONSOLE="/dev/console" 94[ -z "${CONSOLE+x}" ] && CONSOLE="/dev/console"
@@ -89,6 +101,7 @@ mount_and_boot() {
89 # Build mount options for read only root file system. 101 # Build mount options for read only root file system.
90 # If no read-only device was specified via kernel command line, use 102 # If no read-only device was specified via kernel command line, use
91 # current root file system via bind mount. 103 # current root file system via bind mount.
104 wait_for_device ${ROOT_RODEVICE}
92 ROOT_ROMOUNTPARAMS_BIND="-o ${ROOT_ROMOUNTOPTIONS} /" 105 ROOT_ROMOUNTPARAMS_BIND="-o ${ROOT_ROMOUNTOPTIONS} /"
93 if [ -n "${ROOT_RODEVICE}" ]; then 106 if [ -n "${ROOT_RODEVICE}" ]; then
94 ROOT_ROMOUNTPARAMS="-o ${ROOT_ROMOUNTOPTIONS_DEVICE} $ROOT_RODEVICE" 107 ROOT_ROMOUNTPARAMS="-o ${ROOT_ROMOUNTOPTIONS_DEVICE} $ROOT_RODEVICE"
@@ -123,6 +136,7 @@ mount_and_boot() {
123 # Build mount options for read write root file system. 136 # Build mount options for read write root file system.
124 # If a read-write device was specified via kernel command line, use 137 # If a read-write device was specified via kernel command line, use
125 # it, otherwise default to tmpfs. 138 # it, otherwise default to tmpfs.
139 wait_for_device ${ROOT_RWDEVICE}
126 if [ -n "${ROOT_RWDEVICE}" ]; then 140 if [ -n "${ROOT_RWDEVICE}" ]; then
127 141
128 ROOT_RWMOUNTPARAMS="-o $ROOT_RWMOUNTOPTIONS_DEVICE $ROOT_RWDEVICE" 142 ROOT_RWMOUNTPARAMS="-o $ROOT_RWMOUNTOPTIONS_DEVICE $ROOT_RWDEVICE"