1 # $NetBSD: Makefile,v 1.7.2.2 2000/03/01 00:28:02 he Exp $ 2 3 TOP= ${.CURDIR}/.. 4 5 # This include just sets REV=XX 6 .include "${TOP}/Makefile.inc" 7 8 IMAGE= ramdisk 9 CBIN= rd_bin 10 11 TREE= ${TOP}/common/${IMAGE}.tree 12 13 LISTS= ${TOP}/common/${CBIN}.list \ 14 ${TOP}/common/${IMAGE}.list 15 16 KERNEL3 = ${KERNOBJDIR}/RAMDISK/netbsd 17 KERNEL3X = ${KERNOBJDIR}/RAMDISK3X/netbsd 18 19 MOUNT_POINT?= /mnt 20 # DEV/RDEV file system device, CDEV/CRDEV vnconfig device 21 VND?= vnd0 22 VND_DEV= /dev/${VND}a 23 VND_RDEV= /dev/r${VND}a 24 VND_CDEV= /dev/${VND}c 25 VND_CRDEV= /dev/r${VND}c 26 27 CYLS= 20 28 SECS= 16 29 TRKS= 2 30 TOTALSECT != expr ${CYLS} '*' ${SECS} '*' ${TRKS} 31 DISKTYPE= rdroot 32 DISKTAB= ./${DISKTYPE}.disktab 33 GEOM= 512/${SECS}/${TRKS}/${CYLS} 34 INO_BYTES= 2048 35 36 KERNELS= netbsd-RAMDISK netbsd-RAMDISK3X 37 CLEANFILES= $(KERNELS) rdsetroot ${IMAGE}.fs ${DISKTAB} 38 39 all: $(KERNELS) 40 41 netbsd-RAMDISK : rdsetroot ${IMAGE}.fs 42 cp ${KERNEL3} netbsd-tmp 43 ./rdsetroot netbsd-tmp < ${IMAGE}.fs 44 -mv -f netbsd-tmp $@ 45 46 netbsd-RAMDISK3X : rdsetroot ${IMAGE}.fs 47 cp ${KERNEL3X} netbsd-tmp 48 ./rdsetroot netbsd-tmp < ${IMAGE}.fs 49 -mv -f netbsd-tmp $@ 50 51 rdsetroot: ${TOP}/common/rdsetroot.c 52 $(CC) -o $@ -DDEBUG ${TOP}/common/rdsetroot.c 53 54 ${DISKTAB}: 55 echo "${DISKTYPE}:ty=simulated:se#512:nt#${TRKS}:ns#${SECS}:nc#${CYLS}:pa#${TOTALSECT}:oa#0:ba#4096:fa#512:ta=4.2BSD:pc#${TOTALSECT}:oc#0:" > $@ 56 57 ${IMAGE}.fs: ${TREE} ${LISTS} ${CBIN} ${DISKTAB} 58 dd if=/dev/zero of=$@ bs=512 count=${TOTALSECT} 59 vnconfig -v -c ${VND_CDEV} $@ ${GEOM} 60 disklabel -rw -f ${DISKTAB} ${VND_CDEV} ${DISKTYPE} 61 disklabel -W ${VND_CDEV} 62 # bigendian, old format, minfree, opt, b/i, cpg, device 63 newfs -B be -O -m 0 -o space -i ${INO_BYTES} -c ${CYLS} ${VND_RDEV} 64 mount ${VND_DEV} ${MOUNT_POINT} 65 mtree -def ${TREE} -p ${MOUNT_POINT}/ -u 66 TOPDIR=${TOP} CURDIR=${.CURDIR} \ 67 OBJDIR=${.OBJDIR} TARGDIR=${MOUNT_POINT} \ 68 sh ${TOP}/common/RunList.sh ${LISTS} 69 sync 70 @echo "" 71 @df -i ${MOUNT_POINT} 72 @echo "" 73 umount ${MOUNT_POINT} 74 vnconfig -u ${VND_CDEV} 75 76 # Do not delete this if I change my mind and kill make... 77 # Yes delete the durn thing, in case the make fails because vnd is busy!! 78 #.PRECIOUS: ${IMAGE}.fs 79 80 # Rules for making ${CBIN} ... 81 .include "${TOP}/common/Make.crunch" 82 83 # This is listed in rd_bin.conf but is built here. 84 ${CBIN} : libhack.o 85 86 # Use stubs to eliminate some large stuff from libc 87 HACKSRC=${TOP}/../utils/libhack 88 .include "${HACKSRC}/Makefile.inc" 89 90 clean cleandir distclean: 91 -rm -f a.out core *.core *.o *.cro 92 -rm -f ${CLEANFILES} 93 94 # XXX -- prevent 'make depend' from bombing out 95 depend: 96 97 # Standard rules needed by the above... 98 .include <bsd.obj.mk> 99 100 .if !defined(RELEASEDIR) 101 release: 102 @echo setenv RELEASEDIR before doing that! 103 @false 104 .else # RELEASEDIR 105 release: $(KERNELS) 106 .for x in ${KERNELS} 107 gzip -c -9 < ${x} > \ 108 ${RELEASEDIR}/binary/kernel/${x}.gz 109 .endfor # KERNELS 110 .endif # RELEASEDIR 111