Makefile revision 1.25
1#	$NetBSD: Makefile,v 1.25 2001/01/23 01:36:24 jmc 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
27MTREE=		mtree.conf
28
29CRUNCHGEN?=	crunchgen
30
31# image size in 512-byte blocks
32SIZE=		1360
33#DISKTYPE=	instfs
34GEOM=		512/1/${SIZE}/1
35INO_BYTES=	2400
36
37all: ${CBIN}
38	dd if=/dev/zero of=${IMAGE} bs=${SIZE}b count=1
39	#vnconfig -t ${DISKTYPE} -v -c ${VND_CDEV} ${IMAGE}
40	vnconfig -v -c ${VND_CDEV} ${IMAGE} ${GEOM}
41	#disklabel -rw ${VND_CDEV} ${DISKTYPE}
42	#disklabel -W ${VND_CDEV}
43	newfs -B be -m 0 -o space -i ${INO_BYTES} ${VND_RDEV}
44	mount ${VND_DEV} ${MOUNT_POINT}
45	mtree -def ${.CURDIR}/${MTREE} -p ${MOUNT_POINT}/ -u
46	TOPDIR=${TOP} CURDIR=${MINIROOT} REALCURDIR=${.CURDIR} OBJDIR=${.OBJDIR} \
47	    KERNOBJDIR=${KERNOBJDIR} \
48	    TARGDIR=${MOUNT_POINT} sh ${MINIROOT}/runlist.sh ${.CURDIR}/${LISTS}
49	@echo ""
50	@df -i ${MOUNT_POINT}
51	@echo ""
52	umount ${MOUNT_POINT}
53	vnconfig -u ${VND_CDEV}
54
55unconfig:
56	-umount -f ${MOUNT_POINT}
57	-vnconfig -u ${VND_DEV}
58	-/bin/rm -f ${IMAGE}
59
60${CBIN}.mk ${CBIN}.cache ${CBIN}.c: ${CBIN}.conf
61	${CRUNCHGEN} -D ${TOP}/../.. -L ${DESTDIR}/usr/lib ${.ALLSRC}
62
63${CBIN}.conf: ${LISTS}
64	awk -f ${MINIROOT}/makeconf.awk CBIN=${CBIN} ${.CURDIR}/${LISTS} > ${CBIN}.conf
65
66${CBIN}: ${CBIN}.mk ${CBIN}.cache ${CBIN}.c
67	${MAKE} -f ${CBIN}.mk all
68
69# This is listed in ramdiskbin.conf but is built here.
70${CBIN}: libhack.o
71
72# Use stubs to eliminate some large stuff from libc
73NOLIBHACKOPENDIR=1
74HACKSRC=${TOP}/../utils/libhack
75.include "${HACKSRC}/Makefile.inc"
76
77clean cleandir distclean:
78	/bin/rm -f *.core ${IMAGE} ${CBIN} ${CBIN}.mk ${CBIN}.cache \
79	${CBIN}.conf *.o *.cro *.c
80
81.include <bsd.obj.mk>
82.include <bsd.subdir.mk>
83