Makefile revision 1.34
1#	$NetBSD: Makefile,v 1.34 2002/05/02 18:02:53 lukem Exp $
2#
3# boot.fs is the image for disk 1 of the two-set floppy based installation
4# method.
5#
6# It is constructed by injecting the microroot filesystem `ramdisk.fs'
7# into the md based kernel built from the INSTALL kernel configuration file.
8#
9
10.include <bsd.own.mk>
11.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
12
13.include <bsd.kernobj.mk>
14
15TOP=		${.CURDIR}/..
16MINIROOT=	${.CURDIR}/../../miniroot
17
18
19KERN?=		${KERNOBJDIR}/INSTALL/netbsd
20
21MOUNT_POINT?=	/mnt
22VND?=		vnd0
23VND_DEV=	/dev/${VND}a
24VND_RDEV=	/dev/r${VND}a
25VND_CDEV=	/dev/${VND}c
26VND_CRDEV=	/dev/r${VND}c
27FD?=		fd0
28FD_RDEV=	/dev/r${FD}a
29IMAGE?=		boot.fs
30MDEC=		${DESTDIR}/usr/mdec
31MDSETIMAGE?=	mdsetimage
32OBJCOPY?=	objcopy
33
34LISTS=		${.CURDIR}/list
35
36RAMDISKDIR!=	cd ${TOP}/ramdisk && ${PRINTOBJDIR}
37RAMDISK=	${RAMDISKDIR}/ramdisk.fs
38
39# Some reasonable values for the -i parameter to newfs are:
40#
41#   6144	1147k, 189 inodes free
42#  16384	1159k,  93 inodes free
43# 204800	1167k,  29 inodes free
44INO_BYTES=	204800
45
46BLOCKSIZE=512
47FSSIZE!= expr ${BLOCKSIZE} \* 18 \* 2 \* 80
48
49GEOM=${BLOCKSIZE}/18/2/80
50
51CLEANFILES+=	netbsd.ram netbsd.ram.aout netbsd.tmp
52
53.MAIN: all
54
55all:	netbsd.ram netbsd.ram.aout
56	dd if=/dev/zero of=${IMAGE} bs=${FSSIZE} count=1
57	vnconfig -v -c ${VND} ${IMAGE} ${GEOM}
58	newfs -B be -m 0 -o space -i ${INO_BYTES} -c 80 ${VND_RDEV}
59	mount ${VND_DEV} ${MOUNT_POINT}
60	gzip -9 < netbsd.ram > ${MOUNT_POINT}/netbsd
61	@echo ""
62	@df -i ${MOUNT_POINT}
63	@echo ""
64	@echo "installing new bootblocks"
65	-rm -f ${MOUNT_POINT}/boot
66	${MDEC}/binstall -m ${MDEC} -f ${IMAGE} -v ffs ${MOUNT_POINT}
67	umount ${MOUNT_POINT}
68	vnconfig -u ${VND}
69
70unconfig:
71	-umount -f ${MOUNT_POINT}
72	-vnconfig -u ${VND}
73
74netbsd.ram: ${KERN} ${RAMDISK}
75	cp ${KERN} netbsd.tmp
76	${MDSETIMAGE} -v netbsd.tmp ${RAMDISK}
77	strip netbsd.tmp
78	mv netbsd.tmp ${.TARGET}
79
80
81# conjure up a magic header that is accepted by all Sun PROMS;
82# see sys/arch/sparc/stand/installboot/installboot.c for details.
83SUN_MAGIC_HEADER='\01\03\01\07\060\200\0\07\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0'
84
85netbsd.ram.aout: netbsd.ram
86	${OBJCOPY} -O binary ${.ALLSRC} netbsd.ram.raw
87	(printf ${SUN_MAGIC_HEADER}; cat netbsd.ram.raw)  > ${.TARGET}
88	rm -f netbsd.ram.raw
89
90clean cleandir distclean:
91	/bin/rm -f *.core ${IMAGE} ${CLEANFILES}
92
93depend install:
94
95real-floppy:
96	dd if=${IMAGE} of=${FD_RDEV} bs=32k
97
98release: check_RELEASEDIR .WAIT boot.fs netbsd.ram.aout
99	gzip -c -9 boot.fs > $(RELEASEDIR)/installation/bootfs/boot.fs.gz
100	gzip -c -9 netbsd.ram.aout > \
101	    $(RELEASEDIR)/installation/bootfs/netbsd.ram.aout.gz
102
103.include <bsd.prog.mk>
104