From 980ba4d5a527d0e011ad9410d3873dd28292a8c6 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 22 Jun 2012 13:51:42 -0400 Subject: [PATCH] stage-1: mount /proc, /sys, /dev in the target root The switch_root in BusyBox doesn't do this (while the one in util-linux does). So we have to do this ourselves. --- modules/system/boot/stage-1-init.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/system/boot/stage-1-init.sh b/modules/system/boot/stage-1-init.sh index 83300b0d2b8b..33eaee826aa8 100644 --- a/modules/system/boot/stage-1-init.sh +++ b/modules/system/boot/stage-1-init.sh @@ -336,8 +336,7 @@ echo /sbin/modprobe > /proc/sys/kernel/modprobe # Start stage 2. `switch_root' deletes all files in the ramfs on the -# current root. It also moves the /proc, /sys and /dev mounts over to -# the new root. Note that $stage2Init might be an absolute symlink, +# current root. Note that $stage2Init might be an absolute symlink, # in which case "-e" won't work because we're not in the chroot yet. if ! test -e "$targetRoot/$stage2Init" -o -L "$targetRoot/$stage2Init"; then echo "stage 2 init script ($targetRoot/$stage2Init) not found" @@ -346,7 +345,9 @@ fi mkdir -m 0755 -p $targetRoot/proc $targetRoot/sys $targetRoot/dev $targetRoot/run -# `switch_root' doesn't move /run yet, so we have to do it ourselves. +mount --bind /proc $targetRoot/proc +mount --bind /sys $targetRoot/sys +mount --bind /dev $targetRoot/dev mount --bind /run $targetRoot/run exec switch_root "$targetRoot" "$stage2Init"