minix/drivers/memory/ramdisk/rc
Thomas Veerman b47483433c Added a hack to start binaries from the boot image only. In particular, setting
bin_img=1 in the boot monitor will make sure that during the boot procedure the
mfs binary that is part of the boot image is the only binary that is used to
mount partitions. This is useful when for some reason the mfs binary on disk 
malfunctions, rendering Minix unable to boot. By setting bin_img=1, the binary
on disk is ignored and the binary in the boot image is used instead.

- 'service' now accepts an additional flag -r. -r implies -c. -r instructs RS
  to first look in memory if the binary has already been copied to memory and
  execute that version, instead of loading the binary from disk. For example,
  the first time a MFS is being started it is copied (-c) to memory and
  executed from there. The second time MFS is being started this way, RS will
  look in memory for a previously copied MFS binary and reuse it if it exists.
- The mount and newroot commands now accept an additional flag -i, which
  instructs them to set the MS_REUSE flag in the mount flags.
- The mount system call now supports the MS_REUSE flag and invokes 'service'
  with the -r flag when MS_REUSE is set.
- /etc/rc and the rc script that's included in the boot image check for the
  existence of the bin_img flag in the boot monitor, and invoke mount and 
  newroot with the -i flag accordingly.
2009-08-18 11:36:01 +00:00

50 lines
1.4 KiB
Bash

#!/bin/sh
set -e
exec >/dev/log
exec 2>/dev/log
exec </dev/null
/bin/service up /bin/pci -config /etc/drivers.conf
/bin/service -c up /bin/floppy -config /etc/drivers.conf -dev /dev/fd0
if [ X`/bin/sysenv bios_wini` = Xyes ]
then
echo Using bios_wini.
/bin/service -c up /bin/bios_wini -dev /dev/c0d0
else
/bin/service -c up /bin/at_wini -dev /dev/c0d0 -config /etc/drivers.conf -label at_wini_0
/bin/service -c up /bin/at_wini -dev /dev/c1d0 -config /etc/drivers.conf -label at_wini_1 -args ata_instance=1
fi
rootdev=`sysenv rootdev` || echo 'No rootdev?'
rootdevname=`/bin/dev2name "$rootdev"` ||
{ echo 'No device name for root device'; exit 1; }
if [ "`sysenv bin_img`" = 1 ]
then
bin_img="-i "
fi
if sysenv cdproberoot >/dev/null
then
echo
echo 'Looking for boot CD. This may take a minute.'
echo 'Please ignore any error messages.'
echo
cddev=`cdprobe` || { echo 'No CD found'; exit 1; }
export cddev
echo "Loading ramdisk from ${cddev}p1"
loadramdisk "$cddev"p1
elif [ "$rootdevname" = "/dev/ram" ]
then
ramimagedev=`sysenv ramimagedev` ||
{ echo 'ramimagedev not found'; exit 1; }
ramimagename=`/bin/dev2name "$ramimagedev"` ||
{ echo 'No device name for ramimagedev'; exit 1; }
echo "Loading ramdisk from $ramimagename"
loadramdisk "$ramimagename"
fi
echo "Root device name is $rootdevname"
/bin/newroot $bin_img"$rootdevname"
exec /bin/sh /etc/rc "$@"