Milton D. Miller II | d89d5e0 | 2016-01-20 14:57:54 -0600 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
Milton Miller | 54d882e | 2016-02-05 12:07:53 -0600 | [diff] [blame] | 3 | fslist="proc sys dev run" |
Milton D. Miller II | d89d5e0 | 2016-01-20 14:57:54 -0600 | [diff] [blame] | 4 | rodir=run/initramfs/ro |
| 5 | rwdir=run/initramfs/rw |
| 6 | upper=$rwdir/cow |
| 7 | work=$rwdir/work |
| 8 | |
| 9 | cd / |
Milton Miller | 54d882e | 2016-02-05 12:07:53 -0600 | [diff] [blame] | 10 | mkdir -p $fslist |
Milton D. Miller II | d89d5e0 | 2016-01-20 14:57:54 -0600 | [diff] [blame] | 11 | mount dev dev -tdevtmpfs |
| 12 | mount sys sys -tsysfs |
| 13 | mount proc proc -tproc |
| 14 | if ! grep run proc/mounts |
| 15 | then |
| 16 | mount tmpfs run -t tmpfs -o mode=755,nodev |
| 17 | fi |
| 18 | |
| 19 | mkdir -p $rodir $rwdir |
| 20 | |
| 21 | cp -rp init shutdown update whitelist bin sbin usr lib etc var run/initramfs |
| 22 | |
| 23 | # To start a interactive shell with job control at this point, run |
| 24 | # getty 38400 ttyS4 |
| 25 | |
| 26 | findmtd() { |
| 27 | m=$(grep -xl "$1" /sys/class/mtd/*/name) |
| 28 | m=${m%/name} |
| 29 | m=${m##*/} |
| 30 | echo $m |
| 31 | } |
| 32 | |
Andrew Jeffery | acc2c85 | 2016-02-23 23:47:23 +1030 | [diff] [blame] | 33 | blkid_fs_type() { |
| 34 | # Emulate util-linux's `blkid -s TYPE -o value $1` |
| 35 | # Example busybox blkid output: |
| 36 | # # blkid /dev/mtdblock5 |
| 37 | # /dev/mtdblock5: TYPE="squashfs" |
| 38 | # Process output to extract TYPE value "squashfs". |
| 39 | blkid $1 | sed -e 's/^.*TYPE="//' -e 's/".*$//' |
| 40 | } |
| 41 | |
| 42 | probe_fs_type() { |
| 43 | fst=$(blkid_fs_type $1) |
| 44 | echo ${fst:=jffs2} |
| 45 | } |
| 46 | |
Milton D. Miller II | ee30a91 | 2016-03-07 17:46:28 -0600 | [diff] [blame] | 47 | # This fw_get_env_var is a possibly broken version of fw_printenv that |
| 48 | # does not check the crc or flag byte. |
Milton D. Miller II | 04d2aff | 2016-03-02 15:23:22 -0600 | [diff] [blame] | 49 | # The u-boot environemnt starts with a crc32, followed by a flag byte |
| 50 | # when a redundannt environment is configured, followed by var=value\0 sets. |
| 51 | # The flag byte for nand is a 1 byte counter; for nor it is a 1 or 0 byte. |
Milton D. Miller II | 04d2aff | 2016-03-02 15:23:22 -0600 | [diff] [blame] | 52 | |
| 53 | get_fw_env_var() { |
Milton D. Miller II | ee30a91 | 2016-03-07 17:46:28 -0600 | [diff] [blame] | 54 | # do we have 1 or 2 copies of the environment? |
| 55 | # count non-blank non-comment lines |
| 56 | # copies=$(grep -v ^# /etc/fw_env.config | grep -c [::alnum::]) |
| 57 | # ... we could if we had the fw_env.config in the initramfs |
| 58 | copies=1 |
| 59 | |
| 60 | # * Change \n to \r and \0 to \n |
| 61 | # * Skip to the 5th byte to skip over crc |
| 62 | # * then skip to the first or 2nd byte to skip over flag if it exists |
| 63 | # * stop parsing at first empty line corresponding to the |
| 64 | # double \0 at the end of the environment. |
| 65 | # * print the value of the variable name passed as argument |
| 66 | |
| 67 | cat /run/fw_env | |
| 68 | tr '\n\000' '\r\n' | |
| 69 | tail -c +5 | tail -c +${copies-1} | |
| 70 | sed -ne '/^$/,$d' -e "s/^$1=//p" |
Milton D. Miller II | 04d2aff | 2016-03-02 15:23:22 -0600 | [diff] [blame] | 71 | } |
| 72 | |
Milton D. Miller II | 9be688c | 2016-03-02 18:28:54 -0600 | [diff] [blame] | 73 | setup_resolv() { |
| 74 | runresolv=/run/systemd/resolve/resolv.conf |
| 75 | etcresolv=/etc/resolv.conf |
| 76 | |
| 77 | if test ! -e $etcresolv -a ! -L $etcresolv |
| 78 | then |
| 79 | mkdir -p ${runresolv%/*} |
| 80 | ln -s $runresolv $etcresolv |
| 81 | fi |
| 82 | if test ! -f $runresolv |
| 83 | then |
| 84 | cat /proc/net/pnp > $runresolv |
| 85 | fi |
| 86 | |
| 87 | return 0 |
| 88 | } |
| 89 | |
| 90 | try_tftp() { |
| 91 | # split into tftp:// host:port/ path/on/remote |
| 92 | # then spilt off / and then :port from the end of host:port/ |
| 93 | # and : from the beginning of port |
| 94 | |
| 95 | rest="${1#tftp://}" |
| 96 | path=${rest#*/} |
| 97 | host=${rest%$path} |
| 98 | host="${host%/}" |
| 99 | port="${host#${host%:*}}" |
| 100 | host="${host%$port}" |
| 101 | port="${port#:}" |
| 102 | |
| 103 | setup_resolv |
| 104 | |
| 105 | if test -z "$host" -o -z "$path" |
| 106 | then |
| 107 | debug_takeover "Invalid tftp download url '$url'." |
| 108 | elif echo "Downloading '$url' from $host ..." && |
| 109 | ! tftp -g -r "$path" -l /run/image-rofs "$host" ${port+"$port"} |
| 110 | then |
| 111 | debug_takeover "Download of '$url' failed." |
| 112 | fi |
| 113 | } |
| 114 | |
| 115 | try_wget() { |
| 116 | setup_resolv |
| 117 | |
| 118 | echo "Downloading '$1' ..." |
| 119 | if ! wget -O /run/image-rofs "$1" |
| 120 | then |
| 121 | debug_takeover "Download of '$url' failed." |
| 122 | fi |
| 123 | } |
| 124 | |
Milton Miller | 06ccb1a | 2016-02-05 13:04:29 -0600 | [diff] [blame] | 125 | debug_takeover() { |
| 126 | echo "$@" |
| 127 | test -n "$@" && echo Enter password to try to manually fix. |
| 128 | cat << HERE |
| 129 | After fixing run exit to continue this script, or reboot -f to retry, or |
| 130 | touch /takeover and exit to become PID 1 allowing editing of this script. |
| 131 | HERE |
| 132 | |
| 133 | while ! sulogin && ! test -f /takeover |
| 134 | do |
| 135 | echo getty failed, retrying |
| 136 | done |
| 137 | |
| 138 | # Touch /takeover in the above getty to become pid 1 |
| 139 | if test -e /takeover |
| 140 | then |
| 141 | cat << HERE |
| 142 | |
| 143 | Takeover of init requested. Executing /bin/sh as PID 1. |
| 144 | When finished exec new init or cleanup and run reboot -f. |
| 145 | |
| 146 | Warning: No job control! Shell exit will panic the system! |
| 147 | HERE |
| 148 | export PS1=init#\ |
| 149 | exec /bin/sh |
| 150 | fi |
| 151 | } |
| 152 | |
Milton D. Miller II | bf7bfd4 | 2016-01-27 20:18:16 -0600 | [diff] [blame] | 153 | env=$(findmtd u-boot-env) |
| 154 | if test -n $env |
| 155 | then |
| 156 | ln -s /dev/$env /run/mtd:u-boot-env |
| 157 | cp /run/mtd:u-boot-env /run/fw_env |
| 158 | fi |
| 159 | |
Milton D. Miller II | d89d5e0 | 2016-01-20 14:57:54 -0600 | [diff] [blame] | 160 | rofs=$(findmtd rofs) |
| 161 | rwfs=$(findmtd rwfs) |
| 162 | |
Milton Miller | 54d882e | 2016-02-05 12:07:53 -0600 | [diff] [blame] | 163 | rodev=/dev/mtdblock${rofs#mtd} |
| 164 | rwdev=/dev/mtdblock${rwfs#mtd} |
| 165 | |
Milton Miller | 0b0d5fe | 2016-02-23 21:48:48 -0600 | [diff] [blame] | 166 | # Set to y for yes, anything else for no. |
| 167 | force_rwfst_jffs2=y |
| 168 | flash_images_before_init=n |
Milton D. Miller II | 9be688c | 2016-03-02 18:28:54 -0600 | [diff] [blame] | 169 | consider_download_files=y |
| 170 | consider_download_tftp=y |
| 171 | consider_download_http=y |
| 172 | consider_download_ftp=y |
Milton Miller | 0b0d5fe | 2016-02-23 21:48:48 -0600 | [diff] [blame] | 173 | |
Milton D. Miller II | d89d5e0 | 2016-01-20 14:57:54 -0600 | [diff] [blame] | 174 | rofst=squashfs |
Andrew Jeffery | acc2c85 | 2016-02-23 23:47:23 +1030 | [diff] [blame] | 175 | rwfst=$(probe_fs_type $rwdev) |
Milton Miller | 54d882e | 2016-02-05 12:07:53 -0600 | [diff] [blame] | 176 | roopts=ro |
| 177 | rwopts=rw |
| 178 | |
Milton Miller | 0b0d5fe | 2016-02-23 21:48:48 -0600 | [diff] [blame] | 179 | image=/run/initramfs/image- |
| 180 | trigger=${image}rwfs |
| 181 | |
Milton Miller | 54d882e | 2016-02-05 12:07:53 -0600 | [diff] [blame] | 182 | init=/sbin/init |
Milton Miller | 0b0d5fe | 2016-02-23 21:48:48 -0600 | [diff] [blame] | 183 | fsckbase=/sbin/fsck. |
| 184 | fsck=$fsckbase$rwfst |
Milton Miller | b72114c | 2016-02-06 16:05:06 -0600 | [diff] [blame] | 185 | fsckopts=-a |
Milton D. Miller II | 1650db5 | 2016-02-27 15:48:52 -0600 | [diff] [blame] | 186 | optfile=/run/initramfs/init-options |
Milton Miller | ad025a8 | 2016-05-25 18:52:04 -0500 | [diff] [blame] | 187 | optbase=/run/initramfs/init-options-base |
Milton D. Miller II | 9be688c | 2016-03-02 18:28:54 -0600 | [diff] [blame] | 188 | urlfile=/run/initramfs/init-download-url |
Milton D. Miller II | dbc1137 | 2016-02-29 11:35:14 -0600 | [diff] [blame] | 189 | update=/run/initramfs/update |
Milton D. Miller II | 1650db5 | 2016-02-27 15:48:52 -0600 | [diff] [blame] | 190 | |
Milton D. Miller II | d297720 | 2016-03-07 07:59:09 -0600 | [diff] [blame] | 191 | if test -e /${optfile##*/} |
| 192 | then |
| 193 | cp /${optfile##*/} $optfile |
| 194 | fi |
| 195 | |
Milton Miller | ad025a8 | 2016-05-25 18:52:04 -0500 | [diff] [blame] | 196 | if test -e /${optbase##*/} |
| 197 | then |
| 198 | cp /${optbase##*/} $optbase |
| 199 | else |
| 200 | touch $optbase |
| 201 | fi |
| 202 | |
Milton D. Miller II | 1650db5 | 2016-02-27 15:48:52 -0600 | [diff] [blame] | 203 | if test ! -f $optfile |
| 204 | then |
Milton Miller | ad025a8 | 2016-05-25 18:52:04 -0500 | [diff] [blame] | 205 | cat /proc/cmdline $optbase > $optfile |
Milton D. Miller II | 04d2aff | 2016-03-02 15:23:22 -0600 | [diff] [blame] | 206 | get_fw_env_var openbmcinit >> $optfile |
| 207 | get_fw_env_var openbmconce >> $optfile |
Milton D. Miller II | 1650db5 | 2016-02-27 15:48:52 -0600 | [diff] [blame] | 208 | fi |
Milton D. Miller II | d89d5e0 | 2016-01-20 14:57:54 -0600 | [diff] [blame] | 209 | |
| 210 | echo rofs = $rofs $rofst rwfs = $rwfs $rwfst |
| 211 | |
Milton D. Miller II | 1650db5 | 2016-02-27 15:48:52 -0600 | [diff] [blame] | 212 | if grep -w debug-init-sh $optfile |
Milton D. Miller II | d89d5e0 | 2016-01-20 14:57:54 -0600 | [diff] [blame] | 213 | then |
Milton Miller | 06ccb1a | 2016-02-05 13:04:29 -0600 | [diff] [blame] | 214 | debug_takeover "Debug initial shell requested by command line." |
Milton D. Miller II | d89d5e0 | 2016-01-20 14:57:54 -0600 | [diff] [blame] | 215 | fi |
| 216 | |
Milton D. Miller II | 9be688c | 2016-03-02 18:28:54 -0600 | [diff] [blame] | 217 | if test "x$consider_download_files" = xy && |
| 218 | grep -w openbmc-init-download-files $optfile |
| 219 | then |
| 220 | if test -f ${urlfile##*/} |
| 221 | then |
| 222 | cp ${urlfile##*/} $urlfile |
| 223 | fi |
| 224 | if test ! -f $urlfile |
| 225 | then |
| 226 | get_fw_env_var openbmcinitdownloadurl > $urlfile |
| 227 | fi |
| 228 | url="$(cat $urlfile)" |
| 229 | rest="${url#*://}" |
| 230 | proto="${url%$rest}" |
| 231 | |
| 232 | if test -z "$url" |
| 233 | then |
| 234 | echo "Download url empty. Ignoring download request." |
| 235 | elif test -z "$proto" |
| 236 | then |
| 237 | echo "Download failed." |
| 238 | elif test "$proto" = tftp:// |
| 239 | then |
| 240 | if test "x$consider_download_tftp" = xy |
| 241 | then |
| 242 | try_tftp "$url" |
| 243 | else |
| 244 | echo "Download failed." |
| 245 | fi |
| 246 | elif test "$proto" = http:// |
| 247 | then |
| 248 | if test "x$consider_download_http" = xy |
| 249 | then |
| 250 | try_wget "$url" |
| 251 | else |
| 252 | echo "Download failed." |
| 253 | fi |
| 254 | elif test "$proto" = ftp:// |
| 255 | then |
| 256 | if test "x$consider_download_ftp" = xy |
| 257 | then |
| 258 | try_wget "$url" |
| 259 | else |
| 260 | echo "Download failed." |
| 261 | fi |
| 262 | else |
| 263 | echo "Download failed." |
| 264 | fi |
| 265 | fi |
| 266 | |
Milton D. Miller II | 1aaffe8 | 2016-02-27 17:01:13 -0600 | [diff] [blame] | 267 | # If there are images in root move them to /run/initramfs/ or /run/ now. |
Milton Miller | 0b0d5fe | 2016-02-23 21:48:48 -0600 | [diff] [blame] | 268 | imagebasename=${image##*/} |
Milton D. Miller II | 1aaffe8 | 2016-02-27 17:01:13 -0600 | [diff] [blame] | 269 | if test -n "${imagebasename}" && ls /${imagebasename}* > /dev/null 2>&1 |
Milton Miller | 0b0d5fe | 2016-02-23 21:48:48 -0600 | [diff] [blame] | 270 | then |
Milton D. Miller II | 1aaffe8 | 2016-02-27 17:01:13 -0600 | [diff] [blame] | 271 | if test "x$flash_images_before_init" = xy |
| 272 | then |
| 273 | echo "Flash images found, will update before starting init." |
| 274 | mv /${imagebasename}* ${image%$imagebasename} |
| 275 | else |
| 276 | echo "Flash images found, will use but deferring flash update." |
| 277 | mv /${imagebasename}* /run/ |
| 278 | fi |
Milton Miller | 0b0d5fe | 2016-02-23 21:48:48 -0600 | [diff] [blame] | 279 | fi |
| 280 | |
Milton D. Miller II | 1650db5 | 2016-02-27 15:48:52 -0600 | [diff] [blame] | 281 | if grep -w clean-rwfs-filesystem $optfile |
Milton Miller | 0b0d5fe | 2016-02-23 21:48:48 -0600 | [diff] [blame] | 282 | then |
| 283 | echo "Cleaning of read-write overlay filesystem requested." |
| 284 | touch $trigger |
| 285 | fi |
| 286 | |
| 287 | if test "x$force_rwfst_jffs2" = xy -a $rwfst != jffs2 -a ! -f $trigger |
| 288 | then |
| 289 | echo "Converting read-write overlay filesystem to jffs2 forced." |
| 290 | touch $trigger |
| 291 | fi |
| 292 | |
| 293 | if ls $image* > /dev/null 2>&1 |
| 294 | then |
Milton D. Miller II | dbc1137 | 2016-02-29 11:35:14 -0600 | [diff] [blame] | 295 | if ! test -x $update |
Milton Miller | 0b0d5fe | 2016-02-23 21:48:48 -0600 | [diff] [blame] | 296 | then |
Milton D. Miller II | dbc1137 | 2016-02-29 11:35:14 -0600 | [diff] [blame] | 297 | debug_takeover "Flash update requested but $update missing!" |
Milton Miller | 0b0d5fe | 2016-02-23 21:48:48 -0600 | [diff] [blame] | 298 | elif test -f $trigger -a ! -s $trigger |
| 299 | then |
| 300 | echo "Saving selected files from read-write overlay filesystem." |
Milton D. Miller II | dbc1137 | 2016-02-29 11:35:14 -0600 | [diff] [blame] | 301 | $update --no-restore-files |
Milton Miller | 0b0d5fe | 2016-02-23 21:48:48 -0600 | [diff] [blame] | 302 | echo "Clearing read-write overlay filesystem." |
| 303 | flash_eraseall /dev/$rwfs |
| 304 | echo "Restoring saved files to read-write overlay filesystem." |
| 305 | touch $trigger |
Milton D. Miller II | dbc1137 | 2016-02-29 11:35:14 -0600 | [diff] [blame] | 306 | $update --no-save-files --clean-saved-files |
Milton Miller | 0b0d5fe | 2016-02-23 21:48:48 -0600 | [diff] [blame] | 307 | else |
Milton D. Miller II | dbc1137 | 2016-02-29 11:35:14 -0600 | [diff] [blame] | 308 | $update --clean-saved-files |
Milton Miller | 0b0d5fe | 2016-02-23 21:48:48 -0600 | [diff] [blame] | 309 | fi |
| 310 | |
| 311 | rwfst=$(probe_fs_type $rwdev) |
| 312 | fsck=$fsckbase$rwfst |
| 313 | fi |
| 314 | |
Milton D. Miller II | edfd12c | 2016-02-27 17:31:39 -0600 | [diff] [blame] | 315 | if grep -w overlay-filesystem-in-ram $optfile |
| 316 | then |
| 317 | rwfst=none |
| 318 | fi |
| 319 | |
Milton D. Miller II | 2728b73 | 2016-02-29 12:10:34 -0600 | [diff] [blame] | 320 | copyfiles= |
| 321 | if grep -w copy-files-to-ram $optfile |
| 322 | then |
| 323 | rwfst=none |
| 324 | copyfiles=y |
| 325 | fi |
| 326 | |
| 327 | # It would be nice to do this after fsck but that mean rofs is mounted |
| 328 | # which triggers the mtd is mounted check |
| 329 | if test "$rwfst$copyfiles" = noney |
| 330 | then |
| 331 | touch $trigger |
| 332 | $update --copy-files --clean-saved-files --no-restore-files |
| 333 | fi |
| 334 | |
Milton D. Miller II | c201b04 | 2016-02-27 17:31:39 -0600 | [diff] [blame] | 335 | if grep -w copy-base-filesystem-to-ram $optfile && |
| 336 | test ! -e /run/image-rofs && ! cp $rodev /run/image-rofs |
| 337 | then |
| 338 | # Remove any partial copy to avoid attempted usage later |
| 339 | if test -e /run/image-rofs |
| 340 | then |
| 341 | ls -l /run/image-rofs |
| 342 | rm -f /run/image-rofs |
| 343 | fi |
| 344 | debug_takeover "Copying $rodev to /run/image-rofs failed." |
| 345 | fi |
| 346 | |
Milton D. Miller II | a36e99c | 2016-02-27 16:04:32 -0600 | [diff] [blame] | 347 | if test -s /run/image-rofs |
| 348 | then |
| 349 | rodev=/run/image-rofs |
| 350 | roopts=$roopts,loop |
| 351 | fi |
| 352 | |
Milton Miller | b72114c | 2016-02-06 16:05:06 -0600 | [diff] [blame] | 353 | mount $rodev $rodir -t $rofst -o $roopts |
| 354 | |
| 355 | if test -x $rodir$fsck |
| 356 | then |
| 357 | for fs in $fslist |
| 358 | do |
| 359 | mount --bind $fs $rodir/$fs |
| 360 | done |
| 361 | chroot $rodir $fsck $fsckopts $rwdev |
| 362 | rc=$? |
| 363 | for fs in $fslist |
| 364 | do |
| 365 | umount $rodir/$fs |
| 366 | done |
| 367 | if test $rc -gt 1 |
| 368 | then |
| 369 | debug_takeover "fsck of read-write fs on $rwdev failed (rc=$rc)" |
| 370 | fi |
Milton D. Miller II | 6dba31f | 2016-02-27 16:38:16 -0600 | [diff] [blame] | 371 | elif test "$rwfst" != jffs2 -a "$rwfst" != none |
Milton Miller | f81c108 | 2016-02-23 21:00:06 -0600 | [diff] [blame] | 372 | then |
Milton Miller | b72114c | 2016-02-06 16:05:06 -0600 | [diff] [blame] | 373 | echo "No '$fsck' in read only fs, skipping fsck." |
| 374 | fi |
| 375 | |
Milton D. Miller II | 6dba31f | 2016-02-27 16:38:16 -0600 | [diff] [blame] | 376 | if test "$rwfst" = none |
| 377 | then |
| 378 | echo "Running with read-write overlay in RAM for this boot." |
| 379 | echo "No state will be preserved unless flash update performed." |
| 380 | elif ! mount $rwdev $rwdir -t $rwfst -o $rwopts |
Milton D. Miller II | d89d5e0 | 2016-01-20 14:57:54 -0600 | [diff] [blame] | 381 | then |
Milton Miller | 06ccb1a | 2016-02-05 13:04:29 -0600 | [diff] [blame] | 382 | msg="$(cat)" << HERE |
| 383 | |
| 384 | Mounting read-write $rwdev filesystem failed. Please fix and run |
Andrew Jeffery | ed5fb27 | 2016-02-17 17:19:58 +1030 | [diff] [blame] | 385 | mount $rwdev $rwdir -t $rwfst -o $rwopts |
Milton Miller | 06ccb1a | 2016-02-05 13:04:29 -0600 | [diff] [blame] | 386 | to to continue, or do change nothing to run from RAM for this boot. |
| 387 | HERE |
| 388 | debug_takeover "$msg" |
Milton D. Miller II | d89d5e0 | 2016-01-20 14:57:54 -0600 | [diff] [blame] | 389 | fi |
| 390 | |
Milton D. Miller II | d89d5e0 | 2016-01-20 14:57:54 -0600 | [diff] [blame] | 391 | rm -rf $work |
Milton Miller | b72114c | 2016-02-06 16:05:06 -0600 | [diff] [blame] | 392 | mkdir -p $upper $work |
Milton D. Miller II | d89d5e0 | 2016-01-20 14:57:54 -0600 | [diff] [blame] | 393 | |
| 394 | mount -t overlay -o lowerdir=$rodir,upperdir=$upper,workdir=$work cow /root |
| 395 | |
Milton Miller | 06ccb1a | 2016-02-05 13:04:29 -0600 | [diff] [blame] | 396 | while ! chroot /root /bin/sh -c "test -x '$init' -a -s '$init'" |
| 397 | do |
| 398 | msg="$(cat)" << HERE |
| 399 | |
| 400 | Unable to confirm /sbin/init is an executable non-empty file |
| 401 | in merged file system mounted at /root. |
| 402 | |
| 403 | Change Root test failed! Invoking emergency shell. |
| 404 | HERE |
| 405 | debug_takeover "$msg" |
| 406 | done |
Milton D. Miller II | d89d5e0 | 2016-01-20 14:57:54 -0600 | [diff] [blame] | 407 | |
Milton Miller | 54d882e | 2016-02-05 12:07:53 -0600 | [diff] [blame] | 408 | for f in $fslist |
Milton D. Miller II | d89d5e0 | 2016-01-20 14:57:54 -0600 | [diff] [blame] | 409 | do |
| 410 | mount --move $f root/$f |
| 411 | done |
| 412 | |
Milton Miller | 54d882e | 2016-02-05 12:07:53 -0600 | [diff] [blame] | 413 | # switch_root /root $init |
| 414 | exec chroot /root $init |
Milton D. Miller II | d89d5e0 | 2016-01-20 14:57:54 -0600 | [diff] [blame] | 415 | |