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