5 FILES= boot boot1 boot2
9 # A value of 0x80 enables LBA support.
10 BOOT_BOOT1_FLAGS?= 0x80
12 BOOT_COMCONSOLE_PORT?= 0x3f8
13 BOOT_COMCONSOLE_SPEED?= 9600
20 # Decide level of UFS support.
21 BOOT2_UFS?= UFS1_AND_UFS2
22 #BOOT2_UFS?= UFS2_ONLY
23 #BOOT2_UFS?= UFS1_ONLY
25 CFLAGS+=-fomit-frame-pointer \
29 -DFLAGS=${BOOT_BOOT1_FLAGS} \
30 -DSIOPRT=${BOOT_COMCONSOLE_PORT} \
31 -DSIOFMT=${B2SIOFMT} \
32 -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
35 -Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align \
36 -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
37 -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
41 -fno-asynchronous-unwind-tables \
42 --param max-inline-insns-single=100
43 .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} <= 40201
44 CFLAGS.gcc+= -mno-align-long-strings
47 CFLAGS.clang+= -Oz ${CLANG_OPT_SMALL}
49 LD_FLAGS+=${LD_FLAGS_BIN}
54 cat boot1 boot2 > boot
56 CLEANFILES+= boot1 boot1.out boot1.o
59 ${OBJCOPY} -S -O binary boot1.out ${.TARGET}
62 ${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o
64 CLEANFILES+= boot2 boot2.ld boot2.ldr boot2.bin boot2.out boot2.o \
70 @set -- `ls -l ${.ALLSRC}`; x=$$((${BOOT2SIZE}-$$5)); \
71 echo "$$x bytes available"; test $$x -ge 0
72 ${DD} if=${.ALLSRC} of=${.TARGET} obs=${BOOT2SIZE} conv=osync
74 boot2.ld: boot2.ldr boot2.bin ${BTXKERN}
75 btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l boot2.ldr \
76 -o ${.TARGET} -P 1 boot2.bin
79 ${DD} if=/dev/zero of=${.TARGET} bs=512 count=1
82 ${OBJCOPY} -S -O binary boot2.out ${.TARGET}
84 boot2.out: ${BTXCRT} boot2.o sio.o
85 ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC}
90 ${NM} -t d ${.ALLSRC} | awk '/([0-9])+ T xread/ \
92 printf("#define XREADORG %#x\n", REL1 + x) }' \
93 ORG1=`printf "%d" ${ORG1}` \
94 REL1=`printf "%d" ${REL1}` > ${.TARGET}
96 .include <bsd.prog.mk>
98 # XXX: clang integrated-as doesn't grok .codeNN directives yet
99 CFLAGS.boot1.S= ${CLANG_NO_IAS}