Makefile revision 1.17
11.17Stsutsui#	$NetBSD: Makefile,v 1.17 2002/03/31 02:15:42 tsutsui Exp $
21.16Stsutsui
31.16Stsutsui.include <bsd.own.mk>
41.16Stsutsui.include <bsd.kernobj.mk>
51.1Stsubai
61.17Stsutsui.include "${.CURDIR}/../../../Makefile.inc"
71.1Stsubai
81.1StsubaiIMAGE=		boot.fs
91.16StsutsuiDISKSIZE=	2880
101.16StsutsuiFSTMP=		ustar.tmp
111.1StsubaiMDEC=		${DESTDIR}/usr/mdec
121.16StsutsuiBOOT=		ofwboot
131.1Stsubai
141.14StvKERNDIR!=	cd ${.CURDIR}/../md-kernel && ${PRINTOBJDIR}
151.16StsutsuiKERN=		${KERNDIR}/netbsd.INSTALL.gz
161.16Stsutsui
171.16StsutsuiCLEANFILES+=	netbsd ${BOOT} ${FSTMP}
181.16Stsutsui
191.1Stsubai
201.1StsubaiDISKTYPE=	floppy
211.1Stsubai
221.16Stsutsuirealall: netbsd ${BOOT}
231.16Stsutsui	${PAX} -wvf ${FSTMP} ${BOOT} netbsd
241.16Stsutsui	@echo
251.16Stsutsui	@echo Making disk number one
261.16Stsutsui	rm -rf empty
271.16Stsutsui	mkdir -m 755 empty
281.16Stsutsui	${MAKEFS} -s ${DISKSIZE}b ${IMAGE}.tmp empty
291.16Stsutsui	dd bs=8k seek=1 count=$$((${DISKSIZE} / 16 - 1)) \
301.16Stsutsui	    if=${FSTMP} of=${IMAGE}.tmp
311.1Stsubai	@echo "installing new bootblocks"
321.16Stsutsui	${MDEC}/installboot -v -b 17 ${BOOT} ${MDEC}/bootxx ${IMAGE}.tmp
331.16Stsutsui	@ls -l ${FSTMP} | (read mode links uid gid size junk; \
341.16Stsutsui		dksize=$$((${DISKSIZE} * 512 - 8 * 1024)); \
351.16Stsutsui		disks=$$(($$size / $$dksize + 1)); \
361.16Stsutsui		if test $$size -gt $$dksize; then \
371.16Stsutsui			bytes=$$(($$size - $$dksize)); \
381.16Stsutsui			echo "Image is $$bytes ($$(($$bytes / 1024))K) too big\
391.16Stsutsui				to fit on one disk."; \
401.16Stsutsui			exit 1; \
411.16Stsutsui		else \
421.16Stsutsui			dd seek=$$(($${size} / 512 + 15)) count=1 \
431.16Stsutsui				if=/dev/zero of=${IMAGE}.tmp; \
441.16Stsutsui		fi; \
451.16Stsutsui		echo; \
461.16Stsutsui		bytes=$$(($$dksize * $$disks - $$size)); \
471.16Stsutsui		if test "${PAD}" = "yes"; then \
481.16Stsutsui			size=$$(($$size + 8 * 1024)); \
491.16Stsutsui			echo "Padding image with $$bytes bytes from $$size"; \
501.16Stsutsui			sectors=$$(($$bytes / 512)); \
511.16Stsutsui			ssize=$$(($$size / 512)); \
521.16Stsutsui			dd if=/dev/zero bs=512 seek=$${ssize} of=${IMAGE}.tmp \
531.16Stsutsui				count=$${sectors}; \
541.16Stsutsui		else \
551.16Stsutsui			echo "There are $$bytes ($$(($$bytes / 1024))K) bytes\
561.16Stsutsui				free on disk $$disks."; \
571.16Stsutsui		fi; \
581.16Stsutsui	)
591.16Stsutsui	mv -f ${IMAGE}.tmp ${IMAGE}
601.16Stsutsui
611.16Stsutsui# Let the kernel on the diskette be called "netbsd" although
621.16Stsutsui# it is compressed.  This is because the boot code will search
631.16Stsutsui# for "netbsd" first, and calling it "netbsd" instead of "netbsd.gz"
641.16Stsutsui# we avoid scanning all the diskettes before reading the file.
651.16Stsutsui
661.16Stsutsuinetbsd: ${KERN}
671.16Stsutsui	rm -f netbsd
681.16Stsutsui	cp ${KERN} netbsd
691.16Stsutsui
701.16Stsutsui# This is "cheating", just so that we have the available
711.16Stsutsui# space at the start of the tar file.  Installboot will overwrite
721.16Stsutsui# the start of the bootcode with the tail end of the "real", aligned
731.16Stsutsui# second-stage boot loader when it is run (which is quite a bit shorter
741.16Stsutsui# than the entire ${BOOTCODE} file, even when symbols are removed.
751.16Stsutsui# (the first 15*512 bytes are put into the first 8K filesystem block,
761.16Stsutsui# around the disklabel)
771.16Stsutsui
781.16Stsutsui${BOOT}: ${MDEC}/${BOOT}
791.16Stsutsui	rm -f ${BOOT}
801.16Stsutsui	cp ${MDEC}/${BOOT} ${BOOT}
811.16Stsutsui
821.16Stsutsuirelease: check_RELEASEDIR
831.16Stsutsui	-mkdir -p ${RELEASEDIR}/installation/floppy
841.16Stsutsui	cp -p ${IMAGE} ${RELEASEDIR}/installation/floppy
851.1Stsubai
861.2Slukemclean cleandir distclean:
871.16Stsutsui	rm -f *.core ${CLEANFILES} ${IMAGE} ${IMAGE}.tmp
881.16Stsutsui	rm -rf empty
891.1Stsubai
901.1Stsubai.include <bsd.obj.mk>
911.16Stsutsui.include <bsd.subdir.mk>
92