minix/drivers/ramdisk/rc
Ben Gras 5acaa0814f kernel, ramdisk: some boot unification
To use the new SD building script, Linux has to be configured with
loop.max_part=15 on the command line (or set at module load time)
to make the loopback device see the partitions.

This commit removes a lot of differences between the ARM and x86
boot ramdisk and rc scripts. It changes the ARM build from running
from ramdisk to requiring a full filesystem on the SD image and
booting into it.

	. ramdisk: remove some arm-only utilities only used for running
	  from the shell
	. remove ARM-only rc.arm, proto.arm.small, ttys and mylogin.sh
	  boot-time ramdisk files
	. change kernel to add "arch" variable so userland knows what
	  we're running on from sysenv
	. make ARM use the regular ramdisk rc file, changed to distinguish
	  i386-only and ARM-only drivers; requires rootdevname to be set
	. change /etc/rc and /usr/etc/rc to start i386-only drivers only on
	  i386 systems
	. change the kernel/arm to have a special case for the memory
	  driver to load it higher so it can be bigger
	. add uEnv.txt, cmdline.txt and a for now highly linux-dependent
	  SD preparation script arm_sdimage.sh to the git repository in
	  releasetools/

Change-Id: I68910ba4e96ee80f7a12b65e48b5d39b43ca6397
2013-03-07 14:29:27 +00:00

77 lines
1.9 KiB
Bash
Executable file

#!/bin/sh
set -e
exec >/dev/log
exec 2>/dev/log
exec </dev/null
FSCK=/bin/fsck.mfs
ACPI=/usr/sbin/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 /usr/sbin/pci
/bin/service -cn up /sbin/floppy -dev /dev/fd0
if [ X`/bin/sysenv ahci` = Xyes ]
then
# this is here temporarily, for testing purposes
/bin/service -c up /sbin/ahci -dev /dev/c0d0 -label ahci_0 -args instance=0
elif [ X`/bin/sysenv virtio_blk` = Xyes ]
then
/bin/service -c up /sbin/virtio_blk -dev /dev/c0d0 -label virtio_blk_0 -args instance=0
else
/bin/service -c up /sbin/at_wini -dev /dev/c0d0 -label at_wini_0
/bin/service -cr up /sbin/at_wini -dev /dev/c1d0 -label at_wini_1 -args instance=1
fi
fi
if [ X`/bin/sysenv arch` = Xearm ]
then echo starting mmc driver
/bin/service -c up /sbin/mmc -dev /dev/c0d0
fi
/bin/service up /sbin/procfs || echo "WARNING: couldn't start procfs"
if /bin/sysenv rootdevname >/dev/null
then rootdevname=/dev/`/bin/sysenv rootdevname`
else echo "rootdevname not set"
exit 1
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
cddev=`cdprobe` || { echo 'No CD found'; exit 1; }
export cddev
echo "Loading ramdisk from ${cddev}p1"
loadramdisk "$cddev"p1
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 [ -e $FSCK ]
then $FSCK -p $rootdevname
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 "$@"