From 9f1c46026440e9954a88ee8843362d9cffd8ad87 Mon Sep 17 00:00:00 2001 From: nbd Date: Wed, 7 Jun 2006 23:59:04 +0000 Subject: make ramdisk support generic, some cleanups git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@3911 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/generic-2.6/files/init | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 target/linux/generic-2.6/files/init (limited to 'target/linux/generic-2.6/files/init') diff --git a/target/linux/generic-2.6/files/init b/target/linux/generic-2.6/files/init new file mode 100755 index 000000000..8ca48a04c --- /dev/null +++ b/target/linux/generic-2.6/files/init @@ -0,0 +1,3 @@ +#!/bin/ash +mount none /dev -t devfs +exec /bin/busybox init -- cgit v1.2.3 From b694d99910a6c9a713d246e0791e98a843c35c42 Mon Sep 17 00:00:00 2001 From: groz Date: Fri, 18 Aug 2006 12:40:47 +0000 Subject: Flesh out early userspace for initramfs to allow booting from media git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@4592 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/generic-2.6/files/init | 81 ++++++++++++++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 2 deletions(-) (limited to 'target/linux/generic-2.6/files/init') diff --git a/target/linux/generic-2.6/files/init b/target/linux/generic-2.6/files/init index 8ca48a04c..eda776c87 100755 --- a/target/linux/generic-2.6/files/init +++ b/target/linux/generic-2.6/files/init @@ -1,3 +1,80 @@ -#!/bin/ash +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org + +export PATH=/bin:/sbin:/usr/bin:/usr/sbin +mount none /proc -t proc mount none /dev -t devfs -exec /bin/busybox init + +# the root mount point can come from the kernel command line +# or it can be overridden in the preinit.arch file +[ -f /etc/preinit.arch ] && . /etc/preinit.arch + +# if we have no root parameter, just go to running from ramfs +[ -z $rootfs ] && { + export NOMOUNT="No Root" + exec /sbin/init +} + +#if we have a failsafe boot selected, dont bother +#trying to find or wait for a root mount point +[ -z "$FAILSAFE" ] || { + exec /bin/busybox init +} + +# Load the modules we have in initramfs, this should +# make the media accessible, but, it may take some time +. /etc/functions.sh +load_modules /etc/modules /etc/modules.d/* + +#wait 10 seconds for the disc to show up +#usb stick typically takes 4 to 6 seconds +#till it's readable +#it's quite possible the disc never shows up +#if we netbooted this kernel +COUNTER=0 +while [ $COUNTER -lt 10 ]; do + sleep 1 + [ -e $rootfs ] && let COUNTER=10; + let COUNTER=COUNTER+1 +done +[ -e $rootfs ] || { + export FAILSAFE="NoDisc" + exec /bin/busybox init +} + +# now we'll try mount it, again with a timeout +# This will fail if the inserted stick is formatted +# in a manner we dont understand +COUNTER=0 +while [ $COUNTER -lt 10 ]; do + sleep 1 + mount $rootfs /mnt + [ $? -eq "0" ] && let COUNTER=100; + let COUNTER=COUNTER+1 +done +[ $? -ne "0" ] && { + export FAILSAFE="MountFail" + exec /bin/busybox init +} + +#It mounted, lets look for a postinit file, again, give it time +#I've seen this take 6 seconds to actually complete +COUNTER=0 +while [ $COUNTER -lt 10 ]; do + sleep 1 + [ -e /mnt/postinit ] && let COUNTER=10; + let COUNTER=COUNTER+1 +done +[ -e /mnt/postinit ] || { + export FAILSAFE="No postinit" + exec /bin/busybox init +} + +unset rootfs + +mount -o move /proc /mnt/proc +mount -o move /dev /mnt/dev +mount -o move /tmp /mnt/tmp +mount -o move /sys /mnt/sys + +exec switch_root -c /dev/console /mnt /postinit -- cgit v1.2.3 From b2afe216181eee6e6261fb4eedc75ee583c5f370 Mon Sep 17 00:00:00 2001 From: groz Date: Fri, 18 Aug 2006 22:37:40 +0000 Subject: Update init to use /etc/banner for presence test, remove postinit git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@4604 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/generic-2.6/files/init | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'target/linux/generic-2.6/files/init') diff --git a/target/linux/generic-2.6/files/init b/target/linux/generic-2.6/files/init index eda776c87..0c60acd63 100755 --- a/target/linux/generic-2.6/files/init +++ b/target/linux/generic-2.6/files/init @@ -62,11 +62,11 @@ done COUNTER=0 while [ $COUNTER -lt 10 ]; do sleep 1 - [ -e /mnt/postinit ] && let COUNTER=10; + [ -e /mnt/etc/banner ] && let COUNTER=10; let COUNTER=COUNTER+1 done -[ -e /mnt/postinit ] || { - export FAILSAFE="No postinit" +[ -e /mnt/etc/banner ] || { + export FAILSAFE="No Openwrt FS" exec /bin/busybox init } @@ -76,5 +76,5 @@ mount -o move /proc /mnt/proc mount -o move /dev /mnt/dev mount -o move /tmp /mnt/tmp mount -o move /sys /mnt/sys - -exec switch_root -c /dev/console /mnt /postinit +mount none /tmp -t tmpfs +exec switch_root -c /dev/console /mnt /sbin/init -- cgit v1.2.3 From 86c3fa5f0111d9fffcf52263e62c3a0ef3fc5757 Mon Sep 17 00:00:00 2001 From: groz Date: Sun, 20 Aug 2006 05:32:43 +0000 Subject: Add devpts mounts git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@4612 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/generic-2.6/files/init | 2 ++ 1 file changed, 2 insertions(+) (limited to 'target/linux/generic-2.6/files/init') diff --git a/target/linux/generic-2.6/files/init b/target/linux/generic-2.6/files/init index 0c60acd63..1fa6a7f1f 100755 --- a/target/linux/generic-2.6/files/init +++ b/target/linux/generic-2.6/files/init @@ -4,6 +4,7 @@ export PATH=/bin:/sbin:/usr/bin:/usr/sbin mount none /proc -t proc mount none /dev -t devfs +mount non /dev/pts -t devpts # the root mount point can come from the kernel command line # or it can be overridden in the preinit.arch file @@ -74,6 +75,7 @@ unset rootfs mount -o move /proc /mnt/proc mount -o move /dev /mnt/dev +mount -o move /dev/pts /mnt/dev/pts mount -o move /tmp /mnt/tmp mount -o move /sys /mnt/sys mount none /tmp -t tmpfs -- cgit v1.2.3