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