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