memory: use sys_safememset() for /dev/zero
[minix.git] / drivers / ramdisk / rc
blob67d177159c1f7d23091a230b725b618c4b8cbcc7
1 #!/bin/sh
2 set -e
4 exec >/dev/log
5 exec 2>/dev/log
6 exec </dev/null
8 FSCK=/bin/fsck.mfs
9 ACPI=/usr/sbin/acpi
10 if [ -e $ACPI -a -n "`sysenv acpi`" ]
11 then
12 /bin/service -c up $ACPI
14 /bin/service -c up /usr/sbin/pci
15 /bin/service -cn up /sbin/floppy -dev /dev/fd0
16 if [ X`/bin/sysenv ahci` = Xyes ]
17 then
18 # this is here temporarily, for testing purposes
19 /bin/service -c up /sbin/ahci -dev /dev/c0d0 -label ahci_0 -args instance=0
20 else
21 /bin/service -c up /sbin/at_wini -dev /dev/c0d0 -label at_wini_0
22 /bin/service -cr up /sbin/at_wini -dev /dev/c1d0 -label at_wini_1 -args instance=1
24 /bin/service up /sbin/procfs || echo "WARNING: couldn't start procfs"
26 if /bin/sysenv rootdevname >/dev/null
27 then
28 rootdevname=/dev/`/bin/sysenv rootdevname`
29 else
30 rootdev=`/bin/sysenv rootdev` || echo 'No rootdev?'
31 rootdevname=`/bin/dev2name "$rootdev"` ||
32 { echo 'No device name for root device'; exit 1; }
35 if [ "`sysenv bin_img`" = 1 ]
36 then
37 bin_img="-i "
40 if sysenv cdproberoot >/dev/null
41 then
42 echo
43 echo 'Looking for boot CD. This may take a minute.'
44 echo 'Please ignore any error messages.'
45 echo
46 cddev=`cdprobe` || { echo 'No CD found'; exit 1; }
47 export cddev
48 echo "Loading ramdisk from ${cddev}p1"
49 loadramdisk "$cddev"p1
50 elif [ "$rootdevname" = "/dev/ram" ]
51 then
52 if /bin/sysenv rootdevname >/dev/null
53 then
54 ramimagename=/dev/`/bin/sysenv ramimagename`
55 else
56 ramimagedev=`/bin/sysenv ramimagedev` ||
57 { echo 'ramimagedev not found'; exit 1; }
58 ramimagename=`/bin/dev2name "$ramimagedev"` ||
59 { echo 'No device name for ramimagedev'; exit 1; }
62 echo "Loading ramdisk from $ramimagename"
63 loadramdisk "$ramimagename" || echo "WARNING: loadramdisk failed"
65 echo "Root device name is $rootdevname"
66 if [ -e $FSCK ]
67 then $FSCK -p $rootdevname
70 # Change root from temporary boot ramdisk to the configure
71 # root device
72 /bin/mount -n $bin_img"$rootdevname" /
74 /bin/mount -e -n -t procfs none /proc || echo "WARNING: couldn't mount procfs"
76 exec /bin/sh /etc/rc "$@"