buildrom. only set up for olpc right now.
[buildrom.git] / buildrom-devel / buildrom / skeleton / linuxrc
blobc085bd78bf5ad44fd41745c8c84c26721ebe9b2b
1 #!/bin/sh
3 CMDLINE="root=/dev/sda1 console=ttyS0,115200 console=tty0 rootdelay=10 rw"
4 KERNEL="/bzImage"
5 INITRD=""
7 # Any of the above can be surplanted by /boot.conf
9 if [ -f /boot.conf ]; then
10 . /boot.conf
13 # This will load a bzImage from the USB key
15 load_usb() {
16 mkdir /key
18 mount /dev/sda1 /key || {
19 echo "ERROR: Couldn't mount the USB key."
20 return
23 if [ ! -f /key$KERNEL ]; then
24 echo "ERROR: /key$KERNEL doesn't exist."
25 return
28 /sbin/kbl-kexec /key$KERNEL "$CMDLINE" $INITRD
29 echo "ERROR: can't run kbl-kexec /key$KERNEL $CMDLINE $INITRD"
32 mkdir /proc
33 mount -t proc proc /proc
35 # Makedevs returns seemingly nasty error messages, even though the
36 # files are still created (we're missing something in the minimal kernel
37 # that causes chown to return ENOSYS).
38 # End result - we ignore the error messages
40 /sbin/makedevs /dev < device.txt > /dev/null 2>&1
42 # FIXME - bad!
44 cd /bin
45 ./bootmenu
46 RET=$?
47 cd /
48 clear
50 # Handle the return values. Modes 0 - 2 shouldn't return
51 # If they are successful. If they aren't successful, then
52 # we drop into a shell at the end. Mode 3 puts us into the
53 # shell regardless.
55 if [ $RET -eq 0 ]; then
56 echo "ERROR: Wired mode isn't supported right now."
57 elif [ $RET -eq 1 ]; then
58 echo "ERROR: Wireless mode isn't supported right now."
59 elif [ $RET -eq 2 ]; then
60 load_usb
61 elif [ $RET -eq -1 ]; then
62 echo "ERROR: The bootmenu was not successful."
65 echo "NOTICE: Starting the shell..."
66 exec /bin/ash