5 FILES= boot boot1 boot2
9 BOOT_COMCONSOLE_PORT?= 0x238
10 BOOT_COMCONSOLE_SPEED?= 9600
17 # Decide level of UFS support.
18 BOOT2_UFS?= UFS1_AND_UFS2
19 #BOOT2_UFS?= UFS2_ONLY
20 #BOOT2_UFS?= UFS1_ONLY
23 -fomit-frame-pointer \
27 -DFLAGS=${BOOT_BOOT1_FLAGS} \
28 -DSIOPRT=${BOOT_COMCONSOLE_PORT} \
29 -DSIOFMT=${B2SIOFMT} \
30 -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
31 -I${.CURDIR}/../../.. \
32 -I${.CURDIR}/../../i386/boot2 \
33 -I${.CURDIR}/../../common \
34 -I${.CURDIR}/../btx/lib -I. \
35 -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \
36 -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
37 -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
41 CFLAGS.gcc+= -fno-guess-branch-probability \
43 --param max-inline-insns-single=100
44 .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} <= 40201
45 CFLAGS.gcc+= -mno-align-long-strings
48 # Set machine type to PC98_SYSTEM_PARAMETER
49 #CFLAGS+= -DSET_MACHINE_TYPE
51 # Initialize the bi_bios_geom using the BIOS geometry
52 #CFLAGS+= -DGET_BIOSGEOM
54 LD_FLAGS=-static -N --gc-sections
56 # Pick up ../Makefile.inc early.
57 .include <bsd.init.mk>
59 .PATH: ${.CURDIR}/../../i386/boot2
64 cat boot1 boot2 > boot
66 CLEANFILES+= boot1 boot1.out boot1.o
69 ${OBJCOPY} -S -O binary boot1.out ${.TARGET}
72 ${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o
74 CLEANFILES+= boot2 boot2.ld boot2.ldr boot2.bin boot2.out boot2.o \
75 boot2.s boot2.s.tmp boot2.h sio.o
78 @set -- `ls -l boot2.ld`; x=$$((7680-$$5)); \
79 echo "$$x bytes available"; test $$x -ge 0
80 dd if=boot2.ld of=${.TARGET} obs=7680 conv=osync
82 boot2.ld: boot2.ldr boot2.bin ${BTXKERN}
83 btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l boot2.ldr \
84 -o ${.TARGET} -P 1 boot2.bin
87 dd if=/dev/zero of=${.TARGET} bs=276 count=1
90 ${OBJCOPY} -S -O binary boot2.out ${.TARGET}
92 boot2.out: ${BTXCRT} boot2.o sio.o
93 ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC}
99 boot2.s: boot2.c boot2.h ${.CURDIR}/../../common/ufsread.c
100 ${CC} ${CFLAGS} -S -o boot2.s.tmp ${.CURDIR}/boot2.c
101 sed -e '/align/d' -e '/nop/d' < boot2.s.tmp > boot2.s
105 ${NM} -t d ${.ALLSRC} | awk '/([0-9])+ T (read|putc)/ \
107 printf("#define %sORG %#x\n", toupper($$3), REL1 + x) }' \
108 ORG1=`printf "%d" ${ORG1}` \
109 REL1=`printf "%d" ${REL1}` > ${.TARGET}
111 .include <bsd.prog.mk>
113 # XXX: clang integrated-as doesn't grok .codeNN directives yet
114 CFLAGS.boot1.S= ${CLANG_NO_IAS}
115 CFLAGS+= ${CFLAGS.${.IMPSRC:T}}