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