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