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