diff options
author | unslung@(none) <unslung@(none)> | 2005-02-19 07:16:39 +0000 |
---|---|---|
committer | unslung@(none) <unslung@(none)> | 2005-02-19 07:16:39 +0000 |
commit | 29ca0553376206992553b32d52a714a6148d193e (patch) | |
tree | 0c00bc6c730b73b66c22035670f9e5a7c2f83300 /packages/busybox | |
parent | ff195aa19eba9bb78912626c3f1f782c53868c24 (diff) |
Merge bk://nslu2-linux@nslu2-linux.bkbits.net/openembedded
into builds.(none):/home/unslung/firmware/unslung-4.x
2005/02/18 22:02:37+10:30 (none)!rwhitby
Fixed cpio (missing $(DESTDIR) terms).
2005/02/18 02:09:43+10:30 (none)!rwhitby
Merge bk://nslu2-linux@nslu2-linux.bkbits.net/openembedded
into home.(none):/home/slug/unslung-4.x
2005/02/18 01:30:45+10:30 (none)!rwhitby
Merge bk://nslu2-linux@nslu2-linux.bkbits.net/unslung-4.x
into home.(none):/home/slug/unslung-4.x
2005/02/18 01:30:13+10:30 (none)!rwhitby
Added the rw flag to the unslung kernel commandline.
2005/02/17 01:38:30-10:00 (none)!dyoung
Added the stuff to support rw ramdisk and properly pivoting rootfs
2005/02/16 21:08:31-10:00 (none)!dyoung
switchbox.conf:
fix target_os
linuxrc:
commented out all panic and real-root-dev bits
2005/02/16 21:06:08-10:00 (none)!dyoung
Merge bk://nslu2-linux@nslu2-linux.bkbits.net/openembedded
into builder.(none):/home/dereky/bbroot/unslung-4.x
2005/02/17 00:07:25+10:30 (none)!rwhitby
Merge bk://nslu2-linux@nslu2-linux.bkbits.net/openembedded
into home.(none):/home/slug/unslung-4.x
2005/02/16 22:51:44+10:30 (none)!rwhitby
Merge
2005/02/16 22:49:40+10:30 (none)!rwhitby
Updated Unslung to 4.1, and converted over to quilt
2005/02/16 01:50:28-10:00 (none)!dyoung
Changed the kernel cmdline
2005/02/05 22:59:14-10:00 (none)!dyoung
Merge
2005/01/24 18:09:34-10:00 (none)!dyoung
Merge bk://nslu2-linux@nslu2-linux.bkbits.net/openembedded
into builder.(none):/home/dereky/bbroot/unslung-4.x
2005/01/22 17:04:46+10:30 (none)!rwhitby
Merge
2005/01/16 19:07:31+10:30 (none)!rwhitby
Changed SwitchBox sanity test from -x to -e to allow for OpenSlug's symlinked /sbin/init
2005/01/07 02:03:52-10:00 (none)!dyoung
Switchbox 4.5 now with proper external disk detection
2005/01/06 01:58:38-10:00 (none)!dyoung
Merge bk://nslu2-linux@nslu2-linux.bkbits.net/openembedded
into builder.(none):/home/dereky/bbroot/unslung-4.x
2005/01/05 21:08:01-10:00 (none)!dyoung
switchbox 4.4
2005/01/05 20:07:16-10:00 (none)!dyoung
Fixed external disk fallback when disk not present
2005/01/05 19:53:50-10:00 (none)!dyoung
preserve initrd for development
2005/01/05 18:45:15-10:00 (none)!dereky
switchbox typofix
2005/01/05 02:16:30-10:00 (none)!dyoung
Switchbox 4.3 . Dotted .nfsroot per glc suggestion
2005/01/05 02:02:10-10:00 (none)!dyoung
fixed linuxrc... linuxrc != initrd
2005/01/05 00:57:29-10:00 (none)!dyoung
Unslung 4.0
2005/01/04 03:15:25-10:00 (none)!dyoung
change to use switchbox 4.2
2005/01/04 03:01:30-10:00 (none)!dyoung
Merge bk://nslu2-linux@nslu2-linux.bkbits.net/openembedded
into builder.(none):/home/dereky/bbroot/unslung-4.x
2005/01/01 15:41:14-10:00 (none)!dyoung
Merge bk://nslu2-linux@nslu2-linux.bkbits.net/openembedded
into builder.(none):/home/dereky/bbroot/unslung-4.x
2005/01/01 15:20:27-10:00 (none)!dereky
Merge bk://nslu2-linux@nslu2-linux.bkbits.net/openembedded
into builder.(none):/home/dereky/bbroot/unslung-4.x
2004/12/31 19:28:51-10:00 (none)!dyoung
Switchbox 4.2 with fewer typos
2004/12/31 19:10:13-10:00 (none)!dyoung
Switchbox 4.2
2004/12/31 11:36:01-10:00 (none)!dyoung
4.x prelim, internal use only
2004/12/30 18:08:15-10:00 (none)!dereky
Working preliminary version
2004/12/29 02:41:47-10:00 (none)!dyoung
First run NFS stuff
2004/12/28 23:37:18-10:00 (none)!dyoung
change to switchbox 4.1
2004/12/28 23:21:37-10:00 (none)!dereky
Added cut to switchbox
2004/12/28 17:35:28-10:00 (none)!dyoung
adjusted switchbox source version
2004/12/28 16:11:33-10:00 (none)!dyoung
Added creation of /oldroot for pivoting so we dont clobber tmpmnt
2004/12/29 12:48:15+10:30 (none)!rwhitby
Removed initscript stuff from portmap-unslung
2004/12/28 03:13:46-10:00 (none)!dereky
Merge bk://nslu2-linux@nslu2-linux.bkbits.net/unslung-4.x
into builder.(none):/home/dereky/bbroot/openembedded
2004/12/27 02:27:05-10:00 (none)!dyoung
preparation for nfs root
2004/12/26 22:13:13-10:00 (none)!dyoung
Merge bk://nslu2-linux@nslu2-linux.bkbits.net/openembedded
into builder.(none):/home/dereky/bbroot/openembedded
2004/12/26 20:28:50-10:00 (none)!dereky
Changed some linuxrc bits around
BKrev: 4216e7d7pD0VC3yM31eK5gK4rKEIlw
Diffstat (limited to 'packages/busybox')
-rw-r--r-- | packages/busybox/switchbox-1.00/defconfig | 2 | ||||
-rw-r--r-- | packages/busybox/switchbox-1.00/linuxrc | 199 | ||||
-rw-r--r-- | packages/busybox/switchbox_1.00.bb | 2 |
3 files changed, 156 insertions, 47 deletions
diff --git a/packages/busybox/switchbox-1.00/defconfig b/packages/busybox/switchbox-1.00/defconfig index d2587d30ce..40f6b415e5 100644 --- a/packages/busybox/switchbox-1.00/defconfig +++ b/packages/busybox/switchbox-1.00/defconfig @@ -63,7 +63,7 @@ CONFIG_CAT=y CONFIG_CHROOT=y # CONFIG_CMP is not set CONFIG_CP=y -# CONFIG_CUT is not set +CONFIG_CUT=y # CONFIG_DATE is not set CONFIG_DD=y CONFIG_DF=y diff --git a/packages/busybox/switchbox-1.00/linuxrc b/packages/busybox/switchbox-1.00/linuxrc index cd49b16ccf..ef97ba11f6 100644 --- a/packages/busybox/switchbox-1.00/linuxrc +++ b/packages/busybox/switchbox-1.00/linuxrc @@ -1,73 +1,182 @@ #!/bin/sh mounted= +runboot= +prefroot= /bin/mount -t proc proc /proc -/bin/echo "0x0100" > /proc/sys/kernel/real-root-dev +# /bin/echo "5" > /proc/sys/kernel/panic +# /bin/echo "0x0100" > /proc/sys/kernel/real-root-dev -if [ -z "$mounted" ] && /bin/mount -rt jffs2 /dev/mtdblock4 /mnt/tmpmnt ; then +sysconflen=`/bin/dd if=/dev/mtd1 bs=4 count=1 | hexdump -n 6 -e '"%02d"'` +ipaddr=`/bin/dd if=/dev/mtd1 bs=1 count=$sysconflen skip=4 | grep ip_addr | sed -e s/ip_addr=//` +netmask=`/bin/dd if=/dev/mtd1 bs=1 count=$sysconflen skip=4 | grep netmask | sed -e s/netmask=//` +gateway=`/bin/dd if=/dev/mtd1 bs=1 count=$sysconflen skip=4 | grep gateway | sed -e s/gateway=//` +nfsrootloc=`/bin/dd if=/dev/mtd1 bs=1 count=$sysconflen skip=4 | grep nfsroot | sed -e s/nfsroot=// | cut -d, -f 1` +nfsrootopts=`/bin/dd if=/dev/mtd1 bs=1 count=$sysconflen skip=4 | grep nfsroot | sed -e s/nfsroot=// | cut -d, -f 2- | sed -e s/\"//g` +device=/dev/`/bin/sed -n -e 's/^\(mtd[0-9]*\): .* "FIS directory"/\1/p' /proc/mtd` +length=`/bin/dd if=$device bs=2 skip=2048 | /bin/hexdump -n 4 -e '4/1 "%02X"' $device` - if [ -x /mnt/tmpmnt/sbin/init -o -L /mnt/tmpmnt/sbin/init -o -x /mnt/tmpmnt/bin/init -o -L /mnt/tmpmnt/bin/init ] ; then - if [ -f /mnt/tmpmnt/.recovery ] ; then +# Determine desired rootfs +if [ -z "$mounted" ] && /bin/mount -rt jffs2 /dev/mtdblock4 /mnt/jffs2 ; then + if [ -f /mnt/jffs2/.recovery ] ; then + /bin/echo "Preferred root device is /dev/ram0 (recovery)" + mounted= + runboot= + prefroot= + elif [ -f /mnt/jffs2/.sda2root ] ; then + /bin/echo "Preferred root device is /dev/sda2 (disk 1)" + mounted=/mnt/newroot + runboot=/bin/init + prefroot=sda2 + elif [ -f /mnt/jffs2/.sdb2root ] ; then + /bin/echo "Preferred root device is /dev/sdb2 (disk 2)" + mounted=/mnt/newroot + runboot=/bin/init + prefroot=sdb2 + elif [ -f /mnt/jffs2/.ramdisk ] ; then + /bin/echo "Preferred root device is /dev/ram1 (maintenence)" + mounted=/mnt/newroot + runboot=/bin/init + prefroot=maintenence + elif [ -f /mnt/jffs2/.nfsroot ] ; then + /bin/echo "Preferred root device is through NFS" + mounted=/mnt/newroot + runboot=/linuxrc + prefroot=nfsroot + else + /bin/echo "Preferred root device is jffs2" + mounted=/mnt/jffs2 + runboot=/linuxrc + prefroot=jffs2 + fi +fi + +# perform prepatory tasks +if [ -n "$prefroot" ] ; then + + if [ $prefroot = "sda2" -o $prefroot = "sdb2" ] ; then + /bin/echo "Sleeping 10sec while waiting for disk..." + sleep 10 + /bin/mount -rt ext3 /dev/$prefroot /mnt/newroot + if [ -x /mnt/newroot/bin/init ] && [ -r /mnt/newroot/.unslung ] ; then + /bin/echo "Root filesystem will be mounted from /dev/$prefroot ..." + else + /bin/echo "Cant find valid rootfs on /dev/$prefroot, using recovery ..." + mounted= + runboot= + fi + + elif [ $prefroot = "maintenence" ] ; then + /bin/dd if=/dev/zero of=/dev/ram1 bs=1k count=12k + /bin/mkdir /lib + /bin/ln -s /mnt/jffs2/lib/* /lib + /bin/mkdir /usr/bin + /bin/ln -s /mnt/jffs2/usr/bin/mke2fs /usr/bin + /bin/ln -s /mnt/jffs2/usr/bin/find /usr/bin + /bin/ln -s /mnt/jffs2/usr/bin/cpio /usr/bin + /usr/bin/mke2fs -m 0 /dev/ram1 12288 + /bin/mount -t ext2 /dev/ram1 /mnt/newroot + ( cd /mnt/jffs2 ; /usr/bin/find . -print0 -mount | /usr/bin/cpio -p -0 -d -m -u /mnt/newroot ) + if [ -x /mnt/newroot/bin/init ] && [ -r /mnt/newroot/.unslung ] ; then + /bin/cp /mnt/newroot/home/httpd/html/Management/upgrade.cgi /mnt/newroot/home/httpd/html/Management/upgrade-real.cgi + /bin/echo "#!/bin/sh" > /mnt/newroot/home/httpd/html/Management/upgrade.cgi + /bin/echo >> /mnt/newroot/home/httpd/html/Management/upgrade.cgi + /bin/echo "/bin/mount -t ramfs none /upload -o size=8196 2>/dev/null" \ + >> /mnt/newroot/home/httpd/html/Management/upgrade.cgi + /bin/echo "/bin/dd if=/dev/zero of=/upload/free-ram bs=1k count=8k 2>/dev/null" \ + >> /mnt/newroot/home/httpd/html/Management/upgrade.cgi + /bin/echo "/bin/umount /upload 2>/dev/null" \ + >> /mnt/newroot/home/httpd/html/Management/upgrade.cgi + /bin/echo "exec /home/httpd/html/Management/upgrade-real.cgi" \ + >> /mnt/newroot/home/httpd/html/Management/upgrade.cgi + /bin/echo "Root filesystem will be mounted from /dev/ram1 (a copy of /dev/mtdblock4) ..." + else + /bin/echo "Cant find valid rootfs on ram1, using recovery ..." mounted= - elif [ -f /mnt/tmpmnt/.ramdisk ] ; then - /bin/dd if=/dev/zero of=/dev/ram1 bs=1k count=12k - /bin/mkdir /lib - /bin/ln -s /mnt/tmpmnt/lib/* /lib - /bin/mkdir /usr/bin - /bin/ln -s /mnt/tmpmnt/usr/bin/mke2fs /usr/bin - /bin/ln -s /mnt/tmpmnt/usr/bin/find /usr/bin - /bin/ln -s /mnt/tmpmnt/usr/bin/cpio /usr/bin - /usr/bin/mke2fs -m 0 /dev/ram1 12288 - /bin/mount -t ext2 /dev/ram1 /mnt/repair - ( cd /mnt/tmpmnt ; /usr/bin/find . -print0 -mount | /usr/bin/cpio -p -0 -d -m -u /mnt/repair ) - /bin/cp /mnt/repair/home/httpd/html/Management/upgrade.cgi /mnt/repair/home/httpd/html/Management/upgrade-real.cgi - /bin/echo "#!/bin/sh" > /mnt/repair/home/httpd/html/Management/upgrade.cgi - /bin/echo >> /mnt/repair/home/httpd/html/Management/upgrade.cgi - /bin/echo "/bin/mount -t ramfs none /upload -o size=8196 2>/dev/null" \ - >> /mnt/repair/home/httpd/html/Management/upgrade.cgi - /bin/echo "/bin/dd if=/dev/zero of=/upload/free-ram bs=1k count=8k 2>/dev/null" \ - >> /mnt/repair/home/httpd/html/Management/upgrade.cgi - /bin/echo "/bin/umount /upload 2>/dev/null" \ - >> /mnt/repair/home/httpd/html/Management/upgrade.cgi - /bin/echo "exec /home/httpd/html/Management/upgrade-real.cgi" \ - >> /mnt/repair/home/httpd/html/Management/upgrade.cgi - /bin/umount /mnt/repair - /bin/echo "Root filesystem will be mounted from /dev/ram1 (a copy of /dev/mtdblock4) ..." - /bin/echo "0x0101" > /proc/sys/kernel/real-root-dev - mounted=/mnt/tmpmnt + runboot= + fi + + elif [ $prefroot = "nfsroot" ] ; then + + # Should the network drivers come from payload or the jffs2? + if ( [ "$length" != "FFFFFFFF" ] ); then + /bin/dd if=$device bs=2 skip=2056 | /bin/tar zxvf - + /sbin/insmod ixp400 + /sbin/insmod ixp425_eth + /sbin/ifconfig ixp0 up $ipaddr netmask $netmask + /sbin/route add default gw $gateway + fi + + /bin/mkdir -p /lib + /bin/ln -s /mnt/jffs2/lib/* /lib + /bin/mkdir -p /sbin + /bin/ln -s /mnt/jffs2/sbin/portmap /sbin + + /sbin/ifconfig lo up 127.0.0.1 + /sbin/portmap + + . /mnt/jffs2/.nfsroot + + mount -o $nfsrootopts $nfsrootloc /mnt/newroot + + if [ -e /mnt/newroot/sbin/init -o -e /mnt/newroot/bin/init ] ; then + /bin/echo "Root filesystem will be mounted from a NFS root ..." + mounted=/mnt/newroot + runboot=/linuxrc else + /bin/echo "Cant find valid NFS rootfs, using recovery ..." + mounted= + runboot= + fi + + else + if [ -e /mnt/jffs2/sbin/init -o -e /mnt/jffs2/bin/init ] ; then /bin/echo "Root filesystem will be mounted from /dev/mtdblock4 ..." - /bin/echo "0x1f04" > /proc/sys/kernel/real-root-dev - mounted=/mnt/tmpmnt + mounted=/mnt/jffs2 + runboot=/linuxrc + else + /bin/echo "Cant find valid rootfs on jffs2, using recovery ..." + mounted= + runboot= fi fi - - /bin/umount /mnt/tmpmnt fi -if [ -z "$mounted" ] ; then - - if [ -e /mnt/tmpmnt/sbin/init -o -e /mnt/tmpmnt/bin/init ] ; then - /bin/echo "Root filesystem will be mounted from /dev/ram0 ..." - mounted=/mnt/tmpmnt - /bin/echo "0x0100" > /proc/sys/kernel/real-root-dev +# Pivot +if [ -n "$mounted" ] ; then + /bin/killall portmap + if [ $mounted != "/mnt/jffs2" ] ; then + sleep 1 + /bin/umount /mnt/jffs2 fi +# /bin/echo "5" > /proc/sys/kernel/panic + umount /proc + cd $mounted + /sbin/pivot_root . initrd + exec chroot . $runboot < dev/console > dev/console 2>&1 fi +#if [ -z "$mounted" ] ; then +# +# /bin/umount /mnt/jffs2 +# if [ -e /mnt/jffs2/sbin/init -o -e /mnt/jffs2/bin/init ] ; then +# /bin/echo "5" > /proc/sys/kernel/panic +# /bin/echo "Root filesystem will be mounted from /dev/ram0 ..." +# /bin/echo "0x0100" > /proc/sys/kernel/real-root-dev +# fi +#fi + if [ -z "$mounted" ] ; then /bin/echo "Root filesystem cannot be found - dropping into shell ..." - /bin/echo "5" > /proc/sys/kernel/panic - - device=/dev/`/bin/sed -n -e 's/^\(mtd[0-9]*\): .* "FIS directory"/\1/p' /proc/mtd` - length=`/bin/dd if=$device bs=2 skip=2048 | /bin/hexdump -n 4 -e '4/1 "%02X"' $device` +# /bin/echo "5" > /proc/sys/kernel/panic if ( [ "$length" != "FFFFFFFF" ] ); then /bin/dd if=$device bs=2 skip=2056 | /bin/tar zxvf - /sbin/insmod ixp400 /sbin/insmod ixp425_eth - /sbin/ifconfig ixp0 up 192.168.1.77 netmask 255.255.0.0 + /sbin/ifconfig ixp0 up $ipaddr netmask $netmask /sbin/telnetd fi diff --git a/packages/busybox/switchbox_1.00.bb b/packages/busybox/switchbox_1.00.bb index 3e86966411..cc6247ed25 100644 --- a/packages/busybox/switchbox_1.00.bb +++ b/packages/busybox/switchbox_1.00.bb @@ -46,5 +46,5 @@ do_compile () { do_install () { oe_runmake 'PREFIX=${D}' install install -m 0755 ${WORKDIR}/linuxrc ${D}/ - mkdir -p ${D}/proc ${D}/mnt/tmpmnt ${D}/mnt/repair + mkdir -p ${D}/proc ${D}/mnt/jffs2 ${D}/mnt/repair ${D}/mnt/newroot } |