Makefile.bootfloppy revision 1.3
11.3Slukem#	$NetBSD: Makefile.bootfloppy,v 1.3 2002/02/26 22:52:10 lukem Exp $
21.1Slukem
31.1Slukem# TOP is assumed to be defined by Makefile including this one.
41.1Slukem
51.1SlukemIMAGE?=		boot-xxx.fs
61.1SlukemFSTMP=		ustar.tmp
71.1SlukemMDEC=		${DESTDIR}/usr/mdec
81.1SlukemBOOTCODE?=	${MDEC}/biosboot.sym
91.1Slukem#BOOTCODE=	${MDEC}/biosboot_com0.sym	# Serial output
101.1Slukem
111.1SlukemDISKSIZE?=	2880
121.1Slukem
131.1SlukemCLEANFILES+=	netbsd boot ustar.tmp ${METAFILE}
141.1Slukem
151.1Slukemrealall:	netbsd boot
161.1Slukem	if test "${METAFILE}" != ""; then \
171.1Slukem		touch ${METAFILE}; \
181.1Slukem	fi
191.1Slukem	${PAX} -wvf ${FSTMP} boot ${METAFILE} netbsd
201.1Slukem	@echo
211.1Slukem	@echo Making disk number one
221.1Slukem	rm -rf empty
231.1Slukem	mkdir -m 755 empty
241.1Slukem	${MAKEFS} -s ${DISKSIZE}b ${IMAGE}.tmp empty
251.1Slukem	dd bs=8k seek=1 count=$$((${DISKSIZE} / 16 - 1)) \
261.1Slukem	    if=${FSTMP} of=${IMAGE}.tmp
271.1Slukem	@echo "installing new bootblocks"
281.1Slukem	${MDEC}/installboot -b 17 -v -f ${BOOTCODE} ${IMAGE}.tmp
291.1Slukem	@ls -l ${FSTMP} | (read mode links uid gid size junk; \
301.1Slukem		dksize=$$((${DISKSIZE} * 512 - 8 * 1024)); \
311.1Slukem		disks=$$(($$size / $$dksize + 1)); \
321.1Slukem		if test $$size -gt $$dksize; then \
331.1Slukem                	bytes=$$(($$size - $$dksize));    \
341.1Slukem			echo "Image is $$bytes ($$(($$bytes / 1024))K) too big\
351.1Slukem				to fit on one disk."; \
361.1Slukem			exit 1; \
371.1Slukem		else \
381.1Slukem			dd seek=$$(($${size} / 512 + 15)) count=1 \
391.1Slukem				if=/dev/zero of=${IMAGE}.tmp; \
401.1Slukem		fi; \
411.1Slukem		echo; \
421.1Slukem                bytes=$$(($$dksize * $$disks - $$size));    \
431.1Slukem		if test "${PAD}" = "yes"; then \
441.1Slukem			size=$$(($$size + 8 * 1024)); \
451.1Slukem			echo "Padding image with $$bytes bytes from $$size"; \
461.1Slukem			sectors=$$(($$bytes / 512)); \
471.1Slukem			ssize=$$(($$size / 512)); \
481.1Slukem			dd if=/dev/zero bs=512 seek=$${ssize} of=${IMAGE}.tmp \
491.1Slukem				count=$${sectors}; \
501.1Slukem                else \
511.1Slukem			echo "There are $$bytes ($$(($$bytes / 1024))K) bytes\
521.1Slukem				free on disk $$disks."; \
531.1Slukem		fi; \
541.1Slukem	)
551.1Slukem	mv -f ${IMAGE}.tmp ${IMAGE}
561.1Slukem
571.1Slukem# Let the kernel on the diskette be called "netbsd" although
581.1Slukem# it is compressed.  This is because the boot code will search
591.3Slukem# for "netbsd" first, and calling it "netbsd" instead of "netbsd.gz"
601.1Slukem# we avoid scanning all the diskettes before reading the file.
611.1Slukem
621.1Slukemnetbsd: ${KERN}
631.1Slukem	rm -f netbsd
641.1Slukem	cp ${KERN} netbsd
651.1Slukem
661.1Slukem# This is "cheating", just so that we have the available
671.1Slukem# space at the start of the tar file.  Installboot will overwrite
681.3Slukem# the start of the bootcode with the tail end of the "real", aligned
691.1Slukem# second-stage boot loader when it is run (which is quite a bit shorter
701.1Slukem# than the entire ${BOOTCODE} file, even when symbols are removed.
711.1Slukem# (the first 15*512 bytes are put into the first 8K filesystem block,
721.1Slukem# around the disklabel)
731.1Slukem
741.1Slukemboot: ${BOOTCODE}
751.1Slukem	rm -f boot
761.1Slukem	cp ${BOOTCODE} boot
771.1Slukem	${STRIP} boot
781.1Slukem
791.2Slukemrelease: check_RELEASEDIR
801.1Slukem	-mkdir -p ${RELEASEDIR}/installation/floppy
811.1Slukem	cp -p ${IMAGE} ${RELEASEDIR}/installation/floppy
821.3Slukem
831.1Slukemclean cleandir distclean:
841.1Slukem	rm -f *.core ${CLEANFILES} ${IMAGE} ${IMAGE}.tmp
851.1Slukem	rm -rf empty
861.1Slukem
871.1Slukem.include <bsd.own.mk>
881.1Slukem.include <bsd.obj.mk>
891.1Slukem.include <bsd.subdir.mk>
90