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