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