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