etc/services - sync with NetBSD-8
[minix.git] / minix / drivers / storage / ramdisk / rc
blobfad33a8a6b4811f56820120c0138c18106057d7c
1 #!/bin/sh
2 set -e
4 PATH=/sbin:/usr/sbin:/bin:/usr/bin
6 FSCK=/bin/fsck_mfs
7 ACPI=/service/acpi
9 if [ X`sysenv arch` = Xi386 ]
10 then if [ -e $ACPI -a -n "`sysenv acpi`" ]
11 then
12 minix-service -c up $ACPI
14 minix-service -c up /service/pci -dev /dev/pci
16 minix-service -c up /service/input -dev /dev/kbdmux
17 minix-service -c up /service/pckbd || :
19 # Start procfs so we can access /proc/pci
20 mount -t procfs none /proc >/dev/null
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
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 || :
43 umount /proc >/dev/null
46 if [ X`sysenv arch` = Xearm ]
47 then echo Starting the mmc driver
48 minix-service -c up /service/mmc -dev /dev/c0d0
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.
54 minix-service up /service/procfs || echo "WARNING: couldn't start procfs"
56 if sysenv rootdevname >/dev/null
57 then rootdevname=/dev/`sysenv rootdevname`
58 else
59 if ! sysenv cdproberoot >/dev/null && ! sysenv bootramdisk >/dev/null
60 then echo "rootdevname not set"
61 exit 1
65 if [ "`sysenv bin_img`" = 1 ]
66 then
67 bin_img="-i "
70 if sysenv cdproberoot >/dev/null
71 then
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
78 elif [ "$rootdevname" = "/dev/ram" ]
79 then
80 ramimagename=/dev/`sysenv ramimagename`
81 echo "Loading ramdisk from $ramimagename"
82 loadramdisk "$ramimagename" || echo "WARNING: loadramdisk failed"
85 if sysenv bootramdisk >/dev/null
86 then
87 rootdevname=imgrd
90 echo "Root device name is $rootdevname"
92 if ! sysenv cdproberoot >/dev/null
93 then
94 if [ -e $FSCK ]
95 then $FSCK -p $rootdevname
99 # Change root from temporary boot ramdisk to the configure root device
100 if ! sysenv bootramdisk >/dev/null; then
101 mount -n $bin_img"$rootdevname" /
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
110 # Mount the ProcFS instance that was loaded from the ramdisk, on the root FS.
111 mount -e -n -t procfs none /proc || echo "WARNING: couldn't mount procfs"
113 # Start the NetBSD rc infrastructure
114 if ! sysenv bootramdisk >/dev/null; then
115 exec sh /etc/rc "$@"