Makefile revision 1.19
1#	$NetBSD: Makefile,v 1.19 2002/04/12 02:19:31 lukem Exp $
2
3.include <bsd.own.mk>
4.include "${_SRC_TOP_}/distrib/Makefile.inc"
5
6.include <bsd.kernobj.mk>
7
8BASENAME=	boot
9IMAGE1=		${BASENAME}1.fs
10DISKSIZE=	2880
11FSTMP=		ustar.tmp
12MDEC=		${DESTDIR}/usr/mdec
13BOOT=		ofwboot
14
15KERNDIR!=	cd ${.CURDIR}/../md-kernel && ${PRINTOBJDIR}
16KERN=		${KERNDIR}/netbsd.INSTALL.gz
17
18CLEANFILES+=	netbsd ${BOOT} ${FSTMP}
19
20
21DISKTYPE=	floppy
22
23realall: netbsd ${BOOT}
24	${PAX} -wvf ${FSTMP} ${BOOT} netbsd
25	@echo
26	@echo Making disk number one
27	rm -rf empty
28	mkdir -m 755 empty
29	${MAKEFS} -s ${DISKSIZE}b ${IMAGE1}.tmp empty
30	dd bs=8k seek=1 count=$$((${DISKSIZE} / 16 - 1)) \
31	    if=${FSTMP} of=${IMAGE1}.tmp
32	@echo "installing new bootblocks"
33	${MDEC}/installboot -v -b 17 ${BOOT} ${MDEC}/bootxx ${IMAGE1}.tmp
34		# XXXDISTRIB
35	@ls -l ${FSTMP} | (read mode links uid gid size junk; \
36		dksize=$$((${DISKSIZE} * 512 - 8 * 1024)); \
37		disks=$$(($$size / $$dksize + 1)); \
38		if test $$size -gt $$dksize; then \
39			d=2; \
40			while test $$d -le $$disks; do \
41				echo; \
42				echo Making disk number $$d.; \
43				IMAGE=${BASENAME}$${d}.fs; \
44				echo USTARFS $$d > $${IMAGE}; \
45				skip=$$((($$d - 1) * (${DISKSIZE} / 16 - 1))); \
46				if test $$d -eq $$disks; then \
47					dd bs=8k seek=1 skip=$${skip} \
48						conv=sync \
49						if=${FSTMP} of=$${IMAGE}; \
50				else \
51					dd bs=8k seek=1 skip=$${skip} \
52					    conv=sync \
53					    count=$$((${DISKSIZE} / 16 - 1)) \
54						if=${FSTMP} of=$${IMAGE}; \
55				fi; \
56				d=$$(($$d + 1)); \
57			done; \
58		else \
59			dd seek=$$(($${size} / 512 + 15)) count=1 \
60				if=/dev/zero of=${IMAGE1}.tmp; \
61		fi; \
62		echo; \
63		bytes=$$(($$dksize * $$disks - $$size)); \
64		echo "There are $$bytes ($$(($$bytes / 1024))K) bytes free\
65			on disk $$disks."; \
66	)
67	mv -f ${IMAGE1}.tmp ${IMAGE1}
68
69# Let the kernel on the diskette be called "netbsd" although
70# it is compressed.  This is because the boot code will search
71# for "netbsd" first, and calling it "netbsd" instead of "netbsd.gz"
72# we avoid scanning all the diskettes before reading the file.
73
74netbsd: ${KERN}
75	rm -f netbsd
76	cp ${KERN} netbsd
77
78# This is "cheating", just so that we have the available
79# space at the start of the tar file.  Installboot will overwrite
80# the start of the bootcode with the tail end of the "real", aligned
81# second-stage boot loader when it is run (which is quite a bit shorter
82# than the entire ${BOOTCODE} file, even when symbols are removed.
83# (the first 15*512 bytes are put into the first 8K filesystem block,
84# around the disklabel)
85
86${BOOT}: ${MDEC}/${BOOT}
87	rm -f ${BOOT}
88	cp ${MDEC}/${BOOT} ${BOOT}
89
90release: check_RELEASEDIR
91	-mkdir -p ${RELEASEDIR}/installation/floppy
92	${RELINSTALL} ${BASENAME}?.fs ${RELEASEDIR}/installation/floppy
93
94clean cleandir distclean:
95	rm -f *.core ${CLEANFILES} ${BASENAME}?.fs ${IMAGE1}.tmp
96	rm -rf empty
97
98.include <bsd.obj.mk>
99.include <bsd.subdir.mk>
100