69eead77ff
The CD now boots directly from the ISO 9660 filesystem instead of using MBR partitioning with Minix file systems. This saves some space on the CD and reduces memory requirements by some unknown amount as the root ramdisk is completely eliminated. The x86 hard drive image creation is also rewritten in the same fashion. The setup is modified to be more NetBSD-like (unpacking sets tarballs instead of blindly copying the CD contents). Splitting MINIX into sets is done in another commit due to it being a nightmare to rebase. Since MINIX lacks union mounts for now, a bunch of ramdisks are generated at run-time to make parts of the filesystem writeable for the CD. This solution isn't ideal, but it's enough for an installation CD. Change-Id: Icbd9cca4dafebf7b42c345b107a17679a622d5cd
100 lines
2.5 KiB
Bash
100 lines
2.5 KiB
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
exec >/dev/log
|
|
exec 2>/dev/log
|
|
exec </dev/null
|
|
|
|
FSCK=/bin/fsck_mfs
|
|
ACPI=/service/acpi
|
|
|
|
if [ X`/bin/sysenv arch` = Xi386 ]
|
|
then if [ -e $ACPI -a -n "`sysenv acpi`" ]
|
|
then
|
|
/bin/service -c up $ACPI
|
|
fi
|
|
/bin/service -c up /service/pci -dev /dev/pci
|
|
|
|
/bin/service -c up /service/input -dev /dev/kbdmux
|
|
/bin/service -c up /service/pckbd || :
|
|
|
|
# Start procfs so we can access /proc/pci
|
|
mount -t procfs none /proc >/dev/null
|
|
|
|
# Do we want to use the virtio block device?
|
|
# If not specified, default to yes if the device is found.
|
|
if /bin/sysenv virtio_blk >/dev/null
|
|
then virtio_blk="`/bin/sysenv virtio_blk`"
|
|
elif grep '^[^ ]* [^ ]* 1AF4:1001[^ ]* ' /proc/pci >/dev/null
|
|
then echo "virtio_blk not set, defaulting to using found virtio device."
|
|
virtio_blk=yes
|
|
fi
|
|
|
|
/bin/service -cn up /service/floppy -dev /dev/fd0
|
|
if [ X`/bin/sysenv ahci` = Xyes ]
|
|
then
|
|
# this is here temporarily, for testing purposes
|
|
/bin/service -c up /service/ahci -dev /dev/c0d0 -label ahci_0 -args instance=0
|
|
elif [ X"$virtio_blk" = Xyes ]
|
|
then
|
|
/bin/service -c up /service/virtio_blk -dev /dev/c0d0 -label virtio_blk_0 -args instance=0
|
|
else
|
|
/bin/service -c up /service/at_wini -dev /dev/c0d0 -label at_wini_0
|
|
/bin/service -cr up /service/at_wini -dev /dev/c1d0 -label at_wini_1 -args instance=1 2>/dev/null || :
|
|
fi
|
|
/bin/umount /proc >/dev/null
|
|
fi
|
|
|
|
if [ X`/bin/sysenv arch` = Xearm ]
|
|
then echo Starting the mmc driver
|
|
/bin/service -c up /service/mmc -dev /dev/c0d0
|
|
fi
|
|
|
|
/bin/service up /service/procfs || echo "WARNING: couldn't start procfs"
|
|
|
|
if /bin/sysenv rootdevname >/dev/null
|
|
then rootdevname=/dev/`/bin/sysenv rootdevname`
|
|
else
|
|
if ! sysenv cdproberoot >/dev/null
|
|
then echo "rootdevname not set"
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
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
|
|
rootdevname=$(cdprobe) || { echo 'No CD found'; exit 1; }
|
|
export rootdevname
|
|
elif [ "$rootdevname" = "/dev/ram" ]
|
|
then
|
|
ramimagename=/dev/`/bin/sysenv ramimagename`
|
|
echo "Loading ramdisk from $ramimagename"
|
|
loadramdisk "$ramimagename" || echo "WARNING: loadramdisk failed"
|
|
fi
|
|
|
|
echo "Root device name is $rootdevname"
|
|
|
|
if ! sysenv cdproberoot >/dev/null
|
|
then
|
|
if [ -e $FSCK ]
|
|
then $FSCK -p $rootdevname
|
|
fi
|
|
fi
|
|
|
|
# Change root from temporary boot ramdisk to the configure
|
|
# root device
|
|
/bin/mount -n $bin_img"$rootdevname" /
|
|
|
|
/bin/mount -e -n -t procfs none /proc || echo "WARNING: couldn't mount procfs"
|
|
|
|
exec /bin/sh /etc/rc `sysenv bootopts` "$@"
|