3 FILES= boot boot1 boot2
7 BOOT_COMCONSOLE_PORT?= 0x238
8 BOOT_COMCONSOLE_SPEED?= 9600
15 # Decide level of UFS support.
16 BOOT2_UFS?= UFS1_AND_UFS2
17 #BOOT2_UFS?= UFS2_ONLY
18 #BOOT2_UFS?= UFS1_ONLY
21 -fno-guess-branch-probability \
22 -fomit-frame-pointer \
24 -mno-align-long-strings \
26 -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 \
28 -DFLAGS=${BOOT_BOOT1_FLAGS} \
29 -DSIOPRT=${BOOT_COMCONSOLE_PORT} \
30 -DSIOFMT=${B2SIOFMT} \
31 -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
32 -I${.CURDIR}/../../.. \
33 -I${.CURDIR}/../../i386/boot2 \
34 -I${.CURDIR}/../../common \
35 -I${.CURDIR}/../btx/lib -I. \
36 -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \
37 -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
38 -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
39 -Winline --param max-inline-insns-single=100
41 # Set machine type to PC98_SYSTEM_PARAMETER
42 #CFLAGS+= -DSET_MACHINE_TYPE
44 # Initialize the bi_bios_geom using the BIOS geometry
45 #CFLAGS+= -DGET_BIOSGEOM
47 LDFLAGS=-static -N --gc-sections
49 # Pick up ../Makefile.inc early.
50 .include <bsd.init.mk>
52 .PATH: ${.CURDIR}/../../i386/boot2
57 cat boot1 boot2 > boot
59 CLEANFILES+= boot1 boot1.out boot1.o
62 objcopy -S -O binary boot1.out ${.TARGET}
65 ${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o
67 CLEANFILES+= boot2 boot2.ld boot2.ldr boot2.bin boot2.out boot2.o \
68 boot2.s boot2.s.tmp boot2.h sio.o
71 @set -- `ls -l boot2.ld`; x=$$((7680-$$5)); \
72 echo "$$x bytes available"; test $$x -ge 0
73 dd if=boot2.ld of=${.TARGET} obs=7680 conv=osync
75 boot2.ld: boot2.ldr boot2.bin ${BTXKERN}
76 btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l boot2.ldr \
77 -o ${.TARGET} -P 1 boot2.bin
80 dd if=/dev/zero of=${.TARGET} bs=276 count=1
83 objcopy -S -O binary boot2.out ${.TARGET}
85 boot2.out: ${BTXCRT} boot2.o sio.o
86 ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC}
92 boot2.s: boot2.c boot2.h ${.CURDIR}/../../common/ufsread.c
93 ${CC} ${CFLAGS} -S -o boot2.s.tmp ${.CURDIR}/boot2.c
94 sed -e '/align/d' -e '/nop/d' < boot2.s.tmp > boot2.s
98 ${NM} -t d ${.ALLSRC} | awk '/([0-9])+ T (read|putc)/ \
100 printf("#define %sORG %#x\n", toupper($$3), REL1 + x) }' \
101 ORG1=`printf "%d" ${ORG1}` \
102 REL1=`printf "%d" ${REL1}` > ${.TARGET}
104 .include <bsd.prog.mk>