1#!/bin/sh 2set -e 3 4exec >/dev/log 5exec 2>/dev/log 6exec </dev/null 7 8FSCK=/bin/fsck_mfs 9ACPI=/service/acpi 10 11if [ X`/bin/sysenv arch` = Xi386 ] 12then if [ -e $ACPI -a -n "`sysenv acpi`" ] 13 then 14 /bin/service -c up $ACPI 15 fi 16 /bin/service -c up /service/pci -dev /dev/pci 17 18 /bin/service -c up /service/input -dev /dev/kbdmux 19 /bin/service -c up /service/pckbd || : 20 21 # Start procfs so we can access /proc/pci 22 mount -t procfs none /proc >/dev/null 23 24 # Do we want to use the virtio block device? 25 # If not specified, default to yes if the device is found. 26 if /bin/sysenv virtio_blk >/dev/null 27 then virtio_blk="`/bin/sysenv virtio_blk`" 28 elif grep '^[^ ]* [^ ]* 1AF4:1001[^ ]* ' /proc/pci >/dev/null 29 then echo "virtio_blk not set, defaulting to using found virtio device." 30 virtio_blk=yes 31 fi 32 33 /bin/service -cn up /service/floppy -dev /dev/fd0 34 if [ X`/bin/sysenv ahci` = Xyes ] 35 then 36 # this is here temporarily, for testing purposes 37 /bin/service -c up /service/ahci -dev /dev/c0d0 -label ahci_0 -args instance=0 38 elif [ X"$virtio_blk" = Xyes ] 39 then 40 /bin/service -c up /service/virtio_blk -dev /dev/c0d0 -label virtio_blk_0 -args instance=0 41 else 42 /bin/service -c up /service/at_wini -dev /dev/c0d0 -label at_wini_0 43 /bin/service -cr up /service/at_wini -dev /dev/c1d0 -label at_wini_1 -args instance=1 2>/dev/null || : 44 fi 45 /bin/umount /proc >/dev/null 46fi 47 48if [ X`/bin/sysenv arch` = Xearm ] 49then echo Starting the mmc driver 50 /bin/service -c up /service/mmc -dev /dev/c0d0 51fi 52 53/bin/service up /service/procfs || echo "WARNING: couldn't start procfs" 54 55if /bin/sysenv rootdevname >/dev/null 56then rootdevname=/dev/`/bin/sysenv rootdevname` 57else 58 if (! sysenv cdproberoot) && (! sysenv bootramdisk) >/dev/null 59 then echo "rootdevname not set" 60 exit 1 61 fi 62fi 63 64if [ "`sysenv bin_img`" = 1 ] 65then 66 bin_img="-i " 67fi 68 69if sysenv cdproberoot >/dev/null 70then 71 echo 72 echo 'Looking for boot CD. This may take a minute.' 73 echo 'Please ignore any error messages.' 74 echo 75 rootdevname=$(cdprobe) || { echo 'No CD found'; exit 1; } 76 export rootdevname 77elif [ "$rootdevname" = "/dev/ram" ] 78then 79 ramimagename=/dev/`/bin/sysenv ramimagename` 80 echo "Loading ramdisk from $ramimagename" 81 loadramdisk "$ramimagename" || echo "WARNING: loadramdisk failed" 82fi 83 84if sysenv bootramdisk >/dev/null 85then 86 rootdevname=imgrd 87fi 88 89echo "Root device name is $rootdevname" 90 91if ! sysenv cdproberoot >/dev/null 92then 93 if [ -e $FSCK ] 94 then $FSCK -p $rootdevname 95 fi 96fi 97 98# Change root from temporary boot ramdisk to the configure 99# root device 100if ! sysenv bootramdisk >/dev/null 101then 102 /bin/mount -n $bin_img"$rootdevname" / 103fi 104 105/bin/mount -e -n -t procfs none /proc || echo "WARNING: couldn't mount procfs" 106 107if ! sysenv bootramdisk >/dev/null 108then 109 exec /bin/sh /etc/rc `sysenv bootopts` "$@" 110fi 111