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