Makefile revision 1.30
1#	$NetBSD: Makefile,v 1.30 2001/11/08 16:52:21 tron Exp $
2#
3# ramdisk.fs is the microroot filesystem intended for use with
4# the INSTALL kernel. It provides just enough tools to extract the
5# miniroot-based `instfs' filesystem into an MFS mount point
6# and start the installation scripts from there (see dot.profile).
7#
8
9TOP=		${.CURDIR}/..
10MINIROOT=	${.CURDIR}/../../miniroot
11
12.include "${TOP}/Makefile.inc"
13
14CBIN=		ramdiskbin
15
16MOUNT_POINT?=	/mnt
17# DEV/RDEV file system device, CDEV/RDEV vnconfig device
18VND?=		vnd0
19VND_DEV=	/dev/${VND}a
20VND_RDEV=	/dev/r${VND}a
21VND_CDEV=	/dev/${VND}c
22VND_CRDEV=	/dev/r${VND}c
23MDEC=		${DESTDIR}/usr/mdec
24IMAGE?=		ramdisk.fs
25
26LISTS=		list
27MTREECONF=	mtree.conf
28
29CRUNCHGEN?=	crunchgen
30MTREE?=		mtree
31
32# image size in 512-byte blocks
33SIZE=		1360
34#DISKTYPE=	instfs
35GEOM=		512/1/${SIZE}/1
36INO_BYTES=	2752
37
38all: ${CBIN}
39	dd if=/dev/zero of=${IMAGE} bs=${SIZE}b count=1
40	#vnconfig -t ${DISKTYPE} -v -c ${VND} ${IMAGE}
41	vnconfig -v -c ${VND} ${IMAGE} ${GEOM}
42	#disklabel -rw ${VND_CDEV} ${DISKTYPE}
43	#disklabel -W ${VND_CDEV}
44	newfs -B be -m 0 -o space -i ${INO_BYTES} ${VND_RDEV}
45	mount ${VND_DEV} ${MOUNT_POINT}
46	${MTREE} -def ${.CURDIR}/${MTREECONF} -p ${MOUNT_POINT}/ -u
47	TOPDIR=${TOP} CURDIR=${MINIROOT} REALCURDIR=${.CURDIR} OBJDIR=${.OBJDIR} \
48	    KERNOBJDIR=${KERNOBJDIR} \
49	    TARGDIR=${MOUNT_POINT} sh ${MINIROOT}/runlist.sh ${.CURDIR}/${LISTS}
50	@echo ""
51	@df -i ${MOUNT_POINT}
52	@echo ""
53	umount ${MOUNT_POINT}
54	vnconfig -u ${VND}
55
56unconfig:
57	-umount -f ${MOUNT_POINT}
58	-vnconfig -u ${VND}
59	-/bin/rm -f ${IMAGE}
60
61${CBIN}.mk ${CBIN}.cache ${CBIN}.c: ${CBIN}.conf
62	${CRUNCHGEN} -D ${TOP}/../.. -L ${DESTDIR}/usr/lib ${.ALLSRC}
63
64${CBIN}.conf: ${LISTS}
65	awk -f ${MINIROOT}/makeconf.awk CBIN=${CBIN} ${.CURDIR}/${LISTS} > ${CBIN}.conf
66
67${CBIN}: ${CBIN}.mk ${CBIN}.cache ${CBIN}.c
68	${MAKE} -f ${CBIN}.mk all
69
70# This is listed in ramdiskbin.conf but is built here.
71${CBIN}: libhack.o
72
73# Use stubs to eliminate some large stuff from libc
74NOLIBHACKOPENDIR=1
75HACKSRC=${TOP}/../utils/libhack
76.include "${HACKSRC}/Makefile.inc"
77
78clean cleandir distclean:
79	/bin/rm -f *.core ${IMAGE} ${CBIN} ${CBIN}.mk ${CBIN}.cache \
80	${CBIN}.conf *.o *.cro *.c
81
82.include <bsd.obj.mk>
83.include <bsd.sys.mk>
84.include <bsd.subdir.mk>
85