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