Dynamically determine which ramdisk to use

.Also, rename ext2_ramdisk to ramdisk_ext2.
This commit is contained in:
Thomas Veerman
2012-06-18 10:53:36 +00:00
parent f09c2e014f
commit 03ea1c1676
7 changed files with 27 additions and 16 deletions
+67
View File
@@ -0,0 +1,67 @@
# Makefile for ramdisk image
.include <bsd.own.mk>
BINFILES = dev2name mount sh service \
sysenv
SBINFILES = ahci at_wini ext2 floppy procfs \
fsck.mfs
ETCFILES = system.conf mtab passwd pwd.db spwd.db master.passwd \
rs.single
USRBINFILES = loadramdisk cdprobe
USRSBINFILES = acpi pci
IMAGE_DIRS= bin sbin etc usr/bin usr/sbin
install:
all:
# as we are taking the binaries directly out of the destree
# we have to make sure they are already installed
# (that's a little bit to coarse grain though...)
install_files:
${MAKE} -C ${NETBSDSRCDIR}/commands install
${MAKE} -C ${NETBSDSRCDIR}/usr.bin install
${MAKE} -C ${NETBSDSRCDIR}/usr.sbin install
${MAKE} -C ${NETBSDSRCDIR}/usr.bin install
${MAKE} -C ${NETBSDSRCDIR}/sbin install
${MAKE} -C ${NETBSDSRCDIR}/bin install
${MAKE} -C ${NETBSDSRCDIR}/servers install
${MAKE} -C ${NETBSDSRCDIR}/drivers/acpi install
${MAKE} -C ${NETBSDSRCDIR}/drivers/ahci install
${MAKE} -C ${NETBSDSRCDIR}/drivers/at_wini install
${MAKE} -C ${NETBSDSRCDIR}/drivers/floppy install
${MAKE} -C ${NETBSDSRCDIR}/drivers/pci install
image.d: install_files
@echo -n "preparing image... "
rm -rf image.d
${INSTALL_DIR} image.d
@for f in $(IMAGE_DIRS); do ${INSTALL_DIR} image.d/$$f; done
@for f in $(BINFILES); do cp $(DESTDIR)/bin/$$f image.d/bin; done
@for f in $(SBINFILES); do cp $(DESTDIR)/sbin/$$f image.d/sbin; done
@for f in $(ETCFILES); do cp $(DESTDIR)/etc/$$f image.d/etc; done
@for f in $(USRBINFILES); do cp $(DESTDIR)/usr/bin/$$f image.d/usr/bin; done
@for f in $(USRSBINFILES); do cp $(DESTDIR)/usr/sbin/$$f image.d/usr/sbin; done
@cp rc image.d/etc;
if [ ! -z ${EXT2_EXTRA_TREE} ] ; \
then \
echo "Copying additional files";\
cp -a ${EXT2_EXTRA_TREE}/* image.d/; \
fi
@echo "done"
image:: image.d
@echo -n "generating image... "
genext2fs -q -N 1000 -D device_table.txt -b 21000 -U -d image.d $@
rm -rf image.d
@echo "done."
clean:
rm -rf image.d image
.PHONY: image
.include <minix.service.mk>
+18
View File
@@ -0,0 +1,18 @@
/dev d 755 0 0 - - - - -
/dev/null c 666 0 0 1 3 0 0 -
/dev/log c 666 0 0 4 0 0 0 -
/dev/console c 666 0 0 4 0 0 0 -
/dev/ttyc c 666 0 0 4 1 1 1 4
/dev/tty c 666 0 0 5 0 0 0 -
/dev/tty0 c 666 0 0 4 0 0 1 4
/dev/imgrd b 666 0 0 1 6 0 0 -
/dev/c0d0 b 600 0 0 3 0 0 0 -
/dev/c0d0p0s0 b 600 0 0 3 128 0 0 -
/dev/c0d0p0s1 b 600 0 0 3 129 0 0 -
/dev/c0d0p0s2 b 600 0 0 3 130 0 0 -
/dev/c0d0p0s3 b 600 0 0 3 131 0 0 -
/dev/c0d1 b 600 0 0 3 5 0 0 -
/dev/c1d0 b 600 0 0 8 0 0 0 -
/dev/fd0 b 666 0 0 2 0 0 0 -
#/dev/ttyp c 666 0 0 4 128 128 1 16
+1
View File
@@ -0,0 +1 @@
/dev/imgrd / 3 rw
+76
View File
@@ -0,0 +1,76 @@
#!/bin/sh
set -e
exec >/dev/log
exec 2>/dev/log
exec </dev/null
FSCK=/bin/fsck.mfs
ACPI=/usr/sbin/acpi
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
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
/bin/service up /sbin/procfs || echo "WARNING: couldn't start procfs"
if /bin/sysenv rootdevname >/dev/null
then
rootdevname=/dev/`/bin/sysenv rootdevname`
else
rootdev=`/bin/sysenv rootdev` || echo 'No rootdev?'
rootdevname=`/bin/dev2name "$rootdev"` ||
{ echo 'No device name for root device'; 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
if /bin/sysenv rootdevname >/dev/null
then
ramimagename=/dev/`/bin/sysenv ramimagename`
else
ramimagedev=`/bin/sysenv ramimagedev` ||
{ echo 'ramimagedev not found'; exit 1; }
ramimagename=`/bin/dev2name "$ramimagedev"` ||
{ echo 'No device name for ramimagedev'; exit 1; }
fi
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 "$@"