754 |
|
|
755 |
add_initrd 'mount -t proc proc /proc' |
add_initrd 'mount -t proc proc /proc' |
756 |
add_initrd 'mount -t sysfs sysfs /sys' |
add_initrd 'mount -t sysfs sysfs /sys' |
757 |
add_initrd 'mount -t tmpfs tmpfs /dev -o rw,mode=0644,size=1024' |
add_initrd "if [[ -z \$(grep '[[:space:]]/dev[[:space:]]' /proc/mounts | cut -d ' ' -f2) ]]" |
758 |
|
add_initrd 'then' |
759 |
|
add_initrd ' # many video drivers needed exec access' |
760 |
|
add_initrd ' fstype=ramfs' |
761 |
|
add_initrd ' # tmpfs was suggested by Greg Kroah-Hartman' |
762 |
|
add_initrd " [[ \$(grep '[[:space:]]tmpfs' /proc/filesystems | cut -d \$'\\t' -f2) = tmpfs ]] && fstype=tmpfs" |
763 |
|
add_initrd ' # mount devtmpfs if supported' |
764 |
|
add_initrd " [[ \$(grep '[[:space:]]devtmpfs' /proc/filesystems | cut -d \$'\\t' -f2) = devtmpfs ]] && fstype=devtmpfs" |
765 |
|
add_initrd ' mount -t ${fstype} dev /dev -o exec,nosuid,mode=0755,size=10M' |
766 |
|
add_initrd 'fi' |
767 |
|
|
768 |
[[ ${IMAGE_TYPE} = loopback ]] && add_initrd 'mount -t ramfs -o remount,rw /dev/ram /' |
[[ ${IMAGE_TYPE} = loopback ]] && add_initrd 'mount -t ramfs -o remount,rw /dev/ram /' |
769 |
|
|
863 |
# get the right initexec |
# get the right initexec |
864 |
add_initrd "INITEXEC=\"${INITEXEC}\"" |
add_initrd "INITEXEC=\"${INITEXEC}\"" |
865 |
# support init=* from cmdline |
# support init=* from cmdline |
866 |
add_initrd 'for i in $(cat /proc/cmdline); do if [[ ${i} = init=* ]]; then INITEXEC=${i/init=}; fi; done' |
add_initrd 'for i in $(cat /proc/cmdline); do case ${i} in init=*) INITEXEC="${i#*=}";; esac; done' |
867 |
|
|
868 |
add_initrd 'echo "-- Mounting sysroot ..."' |
add_initrd 'echo "-- Mounting sysroot ..."' |
869 |
add_initrd '. /etc/rootdev' |
add_initrd '. /etc/rootdev' |
877 |
add_initrd 'echo 3 > /proc/sys/kernel/printk' |
add_initrd 'echo 3 > /proc/sys/kernel/printk' |
878 |
|
|
879 |
add_initrd 'BREAK_ENABLED=no' |
add_initrd 'BREAK_ENABLED=no' |
880 |
add_initrd 'for i in $(cat /proc/cmdline); do if [[ ${i} = break ]]; then BREAK_ENABLED=yes; fi; done' |
add_initrd 'for i in $(cat /proc/cmdline); do case ${i} in break) BREAK_ENABLED=yes;; esac; done' |
881 |
add_initrd 'if [[ ${BREAK_ENABLED} = yes ]]; then echo "-- Break requested, type 'exit' to resume operation ..."; ash; fi' |
add_initrd 'if [ "${BREAK_ENABLED}" = "yes" ]; then echo "-- Break requested, type 'exit' to resume operation ..."; ash; fi' |
882 |
|
|
883 |
add_initrd 'echo "-- Switching to real sysroot ..."' |
add_initrd 'echo "-- Switching to real sysroot ..."' |
884 |
add_initrd 'umount /dev' |
add_initrd 'mount --move /dev /sysroot/dev' |
885 |
add_initrd 'umount /sys' |
add_initrd 'mount --move /sys /sysroot/sys' |
886 |
add_initrd 'umount /proc' |
add_initrd 'mount --move /proc /sysroot/proc' |
887 |
|
|
888 |
[[ ${IMAGE_TYPE} = initramfs ]] && add_initrd 'exec run-init /sysroot ${INITEXEC} $@ </sysroot/dev/console >/sysroot/dev/console' |
[[ ${IMAGE_TYPE} = initramfs ]] && add_initrd 'exec run-init /sysroot ${INITEXEC} $@ </sysroot/dev/console >/sysroot/dev/console' |
889 |
if [[ ${IMAGE_TYPE} = loopback ]] |
if [[ ${IMAGE_TYPE} = loopback ]] |