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