Home | History | Annotate | Line # | Download | only in ramdisk
Makefile revision 1.1
      1 #	$NetBSD: Makefile,v 1.1 2001/05/18 00:16:40 fredette 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 KERNEL  = ${KERNOBJDIR}/RAMDISK/netbsd
     17 
     18 MOUNT_POINT?=	/mnt
     19 VND?=		vnd1
     20 VND_DEV?=	/dev/${VND}a
     21 VND_RDEV?=	/dev/r${VND}a
     22 
     23 # These are all the parameters for the root fs:
     24 DISKTYPE=	rdroot
     25 SIZE=		400k
     26 # bigendian, minfree, opt, b/i , cpg
     27 NEWFSARGS= -B be -m 0 -o space -i 4096 -c 20
     28 
     29 KERNELS= netbsd.RAMDISK 
     30 CLEANFILES= $(KERNELS) ${IMAGE}.fs netbsd-tmp
     31 
     32 all: $(KERNELS)
     33 
     34 netbsd.RAMDISK : ${IMAGE}.fs
     35 	cp ${KERNEL} netbsd-tmp
     36 	mdsetimage -v netbsd-tmp ${IMAGE}.fs
     37 	-mv -f netbsd-tmp $@
     38 
     39 ${IMAGE}.fs: ${TREE} ${LISTS} ${CBIN}
     40 	dd if=/dev/zero of=${IMAGE}.fs bs=${SIZE} count=1
     41 	vnconfig -t ${DISKTYPE} -v -c ${VND} ${IMAGE}.fs
     42 	disklabel -rw ${VND} ${DISKTYPE}
     43 	newfs ${NEWFSARGS} ${VND_RDEV}
     44 	mount ${VND_DEV} ${MOUNT_POINT}
     45 	mtree -def ${TREE} -p ${MOUNT_POINT}/ -u
     46 	TOPDIR=${TOP} CURDIR=${.CURDIR} DESTDIR=${DESTDIR} \
     47 	  OBJDIR=${.OBJDIR} TARGDIR=${MOUNT_POINT} \
     48 	  sh ${TOP}/common/RunList.sh ${LISTS}
     49 	sync
     50 	@echo ""
     51 	@df -i ${MOUNT_POINT}
     52 	@echo ""
     53 	umount ${MOUNT_POINT}
     54 	vnconfig -u ${VND}
     55 
     56 unconfig:
     57 	-umount -f ${MOUNT_POINT}
     58 	-vnconfig -u ${VND_DEV}
     59 	-/bin/rm -f ${IMAGE}.fs
     60 
     61 # Do not delete this if I change my mind and kill make...
     62 .PRECIOUS: ${IMAGE}.fs
     63 
     64 # Rules for making ${CBIN} ...
     65 .include "${TOP}/common/Make.crunch"
     66 
     67 # This is listed in rd_bin.conf but is built here.
     68 ${CBIN} : libhack.o
     69 
     70 # Use stubs to eliminate some large stuff from libc
     71 HACKSRC=${TOP}/../utils/libhack
     72 .include "${HACKSRC}/Makefile.inc"
     73 
     74 clean cleandir distclean:
     75 	-rm -f a.out core *.core *.o *.cro *.c
     76 	-rm -f ${CLEANFILES}
     77 
     78 .if !defined(RELEASEDIR)
     79 release:
     80 	@echo setenv RELEASEDIR before doing that!
     81 	@false
     82 .else	# RELEASEDIR
     83 release: $(KERNELS)
     84 .for x in ${KERNELS}
     85 	gzip -c -9 < ${x} > \
     86 	 ${RELEASEDIR}/binary/kernel/${x}.gz
     87 .endfor # KERNELS
     88 .endif	# RELEASEDIR
     89 
     90 # Standard rules needed by the above...
     91 .include <bsd.obj.mk>
     92 .include <bsd.subdir.mk>
     93