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