Add ext2 ramdisk, intended for cross compilation

This commit is contained in:
Dirk Vogt 2012-05-01 16:46:53 +02:00 committed by Thomas Veerman
parent a8f6f3ebc9
commit bfacef76c5
4 changed files with 156 additions and 0 deletions

View file

@ -0,0 +1,68 @@
# Makefile for ramdisk image
.include <bsd.own.mk>
BINFILES = dev2name mount sh service \
sysenv
SBINFILES = ahci at_wini bios_wini ext2 floppy mfs procfs \
fsck.mfs
ETCFILES = system.conf mtab passwd pwd.db spwd.db master.passwd \
rs.single
USRBINFILES = newroot 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 ${MINIXSRCDIR}/commands install
${MAKE} -C ${MINIXSRCDIR}/usr.bin install
${MAKE} -C ${MINIXSRCDIR}/usr.sbin install
${MAKE} -C ${MINIXSRCDIR}/usr.bin install
${MAKE} -C ${MINIXSRCDIR}/sbin install
${MAKE} -C ${MINIXSRCDIR}/bin install
${MAKE} -C ${MINIXSRCDIR}/servers install
${MAKE} -C ${MINIXSRCDIR}/drivers/acpi install
${MAKE} -C ${MINIXSRCDIR}/drivers/ahci install
${MAKE} -C ${MINIXSRCDIR}/drivers/at_wini install
${MAKE} -C ${MINIXSRCDIR}/drivers/bios_wini install
${MAKE} -C ${MINIXSRCDIR}/drivers/floppy install
${MAKE} -C ${MINIXSRCDIR}/drivers/pci install
image.d: install_files
@echo -n "preparing image... "
rm -rf image.d
@mkdir image.d
@for f in $(IMAGE_DIRS); do mkdir -p 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 $(DESTDIR)/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>

View file

@ -0,0 +1,10 @@
/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/ttyp c 666 0 0 4 128 128 1 16

View file

@ -0,0 +1 @@
/dev/imgrd / 3 rw

77
drivers/ext2_ramdisk/rc Normal file
View file

@ -0,0 +1,77 @@
#!/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 bios_wini` = Xyes ]
then
echo Using bios_wini.
/bin/service -c up /sbin/bios_wini -dev /dev/c0d0
elif [ 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 -c edit /sbin/mfs -label fs_imgrd
/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=`/usr/bin/cdprobe` || { echo 'No CD found'; exit 1; }
export cddev
echo "Loading ramdisk from ${cddev}p1"
/usr/bin/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"
/usr/bin/loadramdisk "$ramimagename" || echo "WARNING: loadramdisk failed"
fi
echo "Root device name is $rootdevname"
if [ -e $FSCK ]
then $FSCK -p $rootdevname
fi
/usr/bin/newroot $bin_img"$rootdevname"
/bin/mount -e -n -t procfs none /proc || echo "WARNING: couldn't mount procfs"
exec /bin/sh /etc/rc "$@"