From 23e353906c2e22a02af9c8a02393b596455b2a96 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Wed, 14 May 1997 20:44:38 +0000 Subject: shareable ramdisk creation; in part by grr --- distrib/ramdisk/Makefile | 99 ++++++++++++++++++++++++++++++++++++++++++++ distrib/ramdisk/list | 69 +++++++++++++++++++++++++++++++ distrib/ramdisk/mtree.conf | 101 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 269 insertions(+) create mode 100644 distrib/ramdisk/Makefile create mode 100644 distrib/ramdisk/list create mode 100644 distrib/ramdisk/mtree.conf (limited to 'distrib/ramdisk') diff --git a/distrib/ramdisk/Makefile b/distrib/ramdisk/Makefile new file mode 100644 index 00000000000..aaa74bc7923 --- /dev/null +++ b/distrib/ramdisk/Makefile @@ -0,0 +1,99 @@ +# $OpenBSD: Makefile,v 1.1 1997/05/14 20:44:34 deraadt Exp $ +# $OpenBSD: Makefile,v 1.1 1997/05/14 20:44:34 deraadt Exp $ +# $NetBSD: Makefile,v 1.2.4.3 1996/07/04 07:05:32 leo Exp $ + +# Revision is 2.1 +REV= 21 + +CBIN= instbin +ARCHDIR= ${.CURDIR}/../${MACHINE}/ramdisk + +.if exists(${ARCHDIR}/Makefile.inc) +.include "${ARCHDIR}/Makefile.inc" +.endif + +MOUNT_POINT?= /mnt +VND?= svnd0 +VND_DEV= /dev/${VND}a +VND_RDEV= /dev/r${VND}a +DISKTYPE= rdroot +PID!= echo $$$$ +REALIMAGE!= echo /tmp/image.${PID} +IMAGE?= ramdisk${REV}.fs +IMAGESIZE?= 4096 +NEWFSOPTS?= -m 0 -c 64 -i 8192 +CRUNCHGENOPTS?= +KERNEL?= RAMDISK +UTILS?= ${.CURDIR}/../miniroot +STRIP?= strip + +LISTS= ${.CURDIR}/list ${ARCHDIR}/list +MTREE= ${.CURDIR}/mtree.conf + +.ifndef DESTDIR +all: + @echo setenv DESTDIR before makeing a miniroot! + @false +.else + +all: bsd.rd + +bsd: + cd ${.CURDIR}/../../sys/arch/${MACHINE}/conf && config ${KERNEL} + cd ${.CURDIR}/../../sys/arch/${MACHINE}/compile/${KERNEL} && \ + make clean && make depend && make + cp ${.CURDIR}/../../sys/arch/${MACHINE}/compile/${KERNEL}/bsd bsd + + +bsd.rd: bsd ${IMAGE} ${.OBJDIR}/rdsetroot + cp bsd bsd.rd + ${.OBJDIR}/rdsetroot bsd.rd < ${IMAGE} + ${STRIP} bsd.rd + +${.OBJDIR}/rdsetroot: ${.CURDIR}/../common/rdsetroot.c + ${HOSTCC} ${HOSTCCFLAGS} -o rdsetroot ${.CURDIR}/../common/rdsetroot.c + + +${IMAGE}: ${CBIN} + dd if=/dev/zero of=${REALIMAGE} count=${IMAGESIZE} + vnconfig -v -c ${VND} ${REALIMAGE} + disklabel -w -r ${VND} ${DISKTYPE} + newfs -o space ${NEWFSOPTS} ${VND_RDEV} ${DISKTYPE} + mount ${VND_DEV} ${MOUNT_POINT} + mtree -def ${MTREE} -p ${MOUNT_POINT}/ -u + REV=${REV} CURDIR=${.CURDIR} OBJDIR=${.OBJDIR} ARCHDIR=${ARCHDIR} \ + TARGDIR=${MOUNT_POINT} UTILS=${UTILS} sh ${UTILS}/runlist.sh ${LISTS} + @echo "" + @df -i ${MOUNT_POINT} + @echo "" + umount ${MOUNT_POINT} + vnconfig -u ${VND_DEV} + cat /*bin/* > /dev/null + cp ${REALIMAGE} ${IMAGE} + rm ${REALIMAGE} + +unconfig: + -umount -f ${MOUNT_POINT} + -vnconfig -u ${VND} + -/bin/rm -f ${IMAGE} + +${CBIN}.conf: ${LISTS} + awk -f ${UTILS}/makeconf.awk CBIN=${CBIN} ${LISTS} > ${CBIN}.conf + +${CBIN}.mk ${CBIN}.cache ${CBIN}.c: ${CBIN}.conf + crunchgen ${CRUNCHGENOPTS} -D ${.CURDIR}/../.. -L ${DESTDIR}/usr/lib \ + ${CBIN}.conf + +${CBIN}: ${CBIN}.mk ${CBIN}.cache ${CBIN}.c + make -f ${CBIN}.mk all + +clean cleandir: + /bin/rm -f *.core ${IMAGE} ${CBIN} ${CBIN}.mk ${CBIN}.cache \ + ${CBIN}.conf *.o *.lo *.c bsd bsd.* + +beforeinstall: + cp bsd.rd ${DESTDIR}/snapshot + +.endif # DESTDIR check +.include +.include diff --git a/distrib/ramdisk/list b/distrib/ramdisk/list new file mode 100644 index 00000000000..a798f5dafa6 --- /dev/null +++ b/distrib/ramdisk/list @@ -0,0 +1,69 @@ +# $OpenBSD: list,v 1.1 1997/05/14 20:44:35 deraadt Exp $ +# $NetBSD: list,v 1.4.4.1 1996/06/20 20:30:26 pk Exp $ + +SRCDIRS usr.bin bin sbin usr.sbin gnu/usr.bin + +# copy the crunched binary, link to it, and kill it +COPY ${OBJDIR}/instbin instbin +LINK instbin bin/cat +LINK instbin bin/chmod +LINK instbin bin/cp +LINK instbin bin/dd +LINK instbin bin/df +LINK instbin bin/ed +LINK instbin bin/expr +LINK instbin bin/hostname +LINK instbin bin/ln +LINK instbin bin/ls +LINK instbin bin/kill +LINK instbin bin/mkdir +LINK instbin bin/mt +LINK instbin bin/mv +LINK instbin bin/pax bin/tar bin/cpio +LINK instbin bin/rm +LINK instbin bin/pdksh bin/sh +LINK instbin bin/stty +LINK instbin bin/sleep +LINK instbin bin/sync +LINK instbin bin/test bin/[ +LINK instbin sbin/fsck_ffs sbin/fsck +LINK instbin sbin/reboot sbin/halt +LINK instbin sbin/ifconfig +LINK instbin sbin/init +LINK instbin sbin/mknod +LINK instbin sbin/mount +LINK instbin sbin/mount_cd9660 +LINK instbin sbin/mount_ffs +LINK instbin sbin/mount_nfs +LINK instbin sbin/mount_kernfs +LINK instbin sbin/newfs sbin/mount_mfs +LINK instbin sbin/ping +LINK instbin sbin/route +LINK instbin sbin/slattach +LINK instbin sbin/umount +SYMLINK ../../instbin usr/bin/chflags +SYMLINK ../../instbin usr/sbin/chown usr/bin/chgrp +SYMLINK ../../instbin usr/sbin/chroot +SYMLINK ../../instbin usr/bin/ftp +SYMLINK ../../instbin usr/bin/gzip usr/bin/gunzip usr/bin/gzcat +SYMLINK ../../instbin usr/bin/sed + +# `internal' crunchgen links +ARGVLINK mount_ffs ffs +ARGVLINK mount_nfs nfs +ARGVLINK mount_cd9660 cd9660 +ARGVLINK pdksh -sh + +# various files that we need in /etc for the install +COPY ${DESTDIR}/etc/group etc/group +COPY ${DESTDIR}/etc/protocols etc/protocols +COPY ${DESTDIR}/etc/services etc/services +COPY ${DESTDIR}/etc/spwd.db etc/spwd.db +### COPY ${DESTDIR}/etc/virc etc/virc + +# and the installation scripts +COPY ${CURDIR}/../miniroot/install.sub install.sub +COPY ${CURDIR}/../miniroot/install.sh install +COPY ${CURDIR}/../miniroot/upgrade.sh upgrade +SPECIAL sed "/^VERSION=/s/=.*/=${REV}/" < ${CURDIR}/../miniroot/install.sub > install.sub +SPECIAL chmod 755 install upgrade diff --git a/distrib/ramdisk/mtree.conf b/distrib/ramdisk/mtree.conf new file mode 100644 index 00000000000..a6df07efa8f --- /dev/null +++ b/distrib/ramdisk/mtree.conf @@ -0,0 +1,101 @@ +# $OpenBSD: mtree.conf,v 1.1 1997/05/14 20:44:35 deraadt Exp $ +# $NetBSD: mtree.conf,v 1.1.4.2 1996/07/15 06:29:38 leo Exp $ + +/set type=dir uname=root gname=wheel mode=0755 +# . +. + +# ./bin +bin +# ./bin +.. + +# ./dev +dev +# ./dev +.. + +# ./etc +etc +# ./etc +.. + +# ./kern +kern +# ./kern +.. + +# ./mnt +mnt +# ./mnt +.. + +# ./mnt2 +mnt2 +# ./mnt2 +.. + +# ./sbin +sbin +# ./sbin +.. + +# ./tmp +tmp mode=01777 +# ./tmp +.. + +# ./usr +usr + +# ./usr/bin +bin +# ./usr/bin +.. + +# ./usr/mdec +mdec +# ./usr/mdec +.. + +# ./usr/sbin +sbin +# ./usr/sbin +.. + +# ./usr/share +share + +# ./usr/share/misc +misc +# ./usr/share/misc +.. + +# ./usr/share/zoneinfo +zoneinfo +# ./usr/share/zoneinfo +.. + +# ./usr/share/keymaps +keymaps +# ./usr/share/keymaps + +# ./usr/share/keymaps/atari +atari +# ./usr/share/keymaps/atari +.. + +# ./usr/share/keymaps +.. + +# ./usr/share +.. + +# ./usr +.. + +# ./var +var + +# ./ +.. -- cgit v1.2.3