| 1 | #!/bin/sh |
|---|
| 2 | |
|---|
| 3 | # $Id: linuxrc,v 1.3 2005/03/07 20:38:31 thomasez Exp $ |
|---|
| 4 | |
|---|
| 5 | # |
|---|
| 6 | # floppyfw initfile |
|---|
| 7 | # |
|---|
| 8 | VERSION=FLOPPYFW_VERSION |
|---|
| 9 | # |
|---|
| 10 | /bin/busybox echo "Booting floppyfw" |
|---|
| 11 | |
|---|
| 12 | PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" |
|---|
| 13 | TERM=linux |
|---|
| 14 | export PATH TERM |
|---|
| 15 | umask 022 |
|---|
| 16 | |
|---|
| 17 | /bin/busybox mount -n -t tmpfs tmpfs /nyroot |
|---|
| 18 | cd /nyroot |
|---|
| 19 | |
|---|
| 20 | # Blatantly borrowed from Rob Fowler |
|---|
| 21 | # (from a mail on the busybox mailing list) |
|---|
| 22 | # copy over most of the filesystem |
|---|
| 23 | |
|---|
| 24 | # /lost+found|/nyroot|/proc|/dev) |
|---|
| 25 | |
|---|
| 26 | /bin/busybox echo "Copying to new filesystem." |
|---|
| 27 | for ii in /* |
|---|
| 28 | do |
|---|
| 29 | case $ii in |
|---|
| 30 | /lost+found|/nyroot|/proc|/dev) |
|---|
| 31 | ;; |
|---|
| 32 | *) |
|---|
| 33 | /bin/busybox cp -dpR $ii /nyroot/. |
|---|
| 34 | /bin/busybox echo -n $ii" " |
|---|
| 35 | esac |
|---|
| 36 | done |
|---|
| 37 | /bin/busybox echo "Done." |
|---|
| 38 | |
|---|
| 39 | # /bin/busybox mount -n -t proc /proc /nyroot/proc |
|---|
| 40 | /bin/busybox mkdir initrd |
|---|
| 41 | |
|---|
| 42 | # /bin/busybox mount -n -t devfs devfs dev |
|---|
| 43 | /bin/busybox mkdir dev |
|---|
| 44 | /bin/busybox mount -t devfs none dev |
|---|
| 45 | |
|---|
| 46 | /bin/busybox echo -n "Pivoting.. " |
|---|
| 47 | /bin/busybox pivot_root . initrd |
|---|
| 48 | |
|---|
| 49 | /bin/busybox echo "Done," |
|---|
| 50 | |
|---|
| 51 | cd / |
|---|
| 52 | |
|---|
| 53 | # /bin/busybox umount /initrd |
|---|
| 54 | |
|---|
| 55 | /bin/busybox echo "Mounting: proc" |
|---|
| 56 | /bin/busybox mkdir proc |
|---|
| 57 | /bin/busybox mount -t proc /proc /proc |
|---|
| 58 | |
|---|
| 59 | /bin/busybox --install -s |
|---|
| 60 | |
|---|
| 61 | # |
|---|
| 62 | # Testing wether we are using a serial console. |
|---|
| 63 | # It'd better use the serial= option but I'm not sure how to grab |
|---|
| 64 | # that info (yet) and |
|---|
| 65 | |
|---|
| 66 | COMMAND_LINE=`cat /proc/cmdline` |
|---|
| 67 | |
|---|
| 68 | ( echo $COMMAND_LINE | grep console ) && { |
|---|
| 69 | CONSOLE=`echo $COMMAND_LINE | sed -e 's/$/ /' -e 's/.*console=\([^ ]*\) .*/\1/' -e 's/,/ /g'` |
|---|
| 70 | } |
|---|
| 71 | |
|---|
| 72 | if [ "$CONSOLE" != "" ] |
|---|
| 73 | then |
|---|
| 74 | set -- $CONSOLE |
|---|
| 75 | |
|---|
| 76 | # Need a speed. |
|---|
| 77 | if [ $# -eq 1 ] |
|---|
| 78 | then |
|---|
| 79 | set -- $1 9600 |
|---|
| 80 | fi |
|---|
| 81 | |
|---|
| 82 | mv /etc/inittab.serial /etc/inittab |
|---|
| 83 | |
|---|
| 84 | # DEV=`echo $1 | sed -e 's/\/dev\///'` |
|---|
| 85 | DEV=`echo $1 | sed -e 's/ttyS/tts\//'` |
|---|
| 86 | |
|---|
| 87 | echo "$DEV::respawn:/sbin/getty -L $DEV $2 vt100" >> /etc/inittab |
|---|
| 88 | else |
|---|
| 89 | if [ "$CONNECT_TYPE" != "PPP" ] |
|---|
| 90 | then |
|---|
| 91 | echo "tts/0::respawn:/sbin/getty -L /dev/tts/0 19200 vt100" >> /etc/inittab |
|---|
| 92 | fi |
|---|
| 93 | rm /etc/inittab.serial |
|---|
| 94 | fi |
|---|
| 95 | |
|---|
| 96 | /bin/busybox echo "Running init," |
|---|
| 97 | exec chroot . /sbin/init <dev/console >dev/console 2>&1 |
|---|
| 98 | |
|---|
| 99 | echo "Pokker, dette skal ingen kunne lese" |
|---|