5 FILES= boot boot1 boot2
7 # A value of 0x80 enables LBA support.
8 BOOT_BOOT1_FLAGS?= 0x80
10 BOOT_COMCONSOLE_PORT?= 0x3f8
11 BOOT_COMCONSOLE_SPEED?= 9600
18 # Decide level of UFS support.
19 BOOT2_UFS?= UFS1_AND_UFS2
20 #BOOT2_UFS?= UFS2_ONLY
21 #BOOT2_UFS?= UFS1_ONLY
23 CFLAGS+=-fomit-frame-pointer \
27 -DFLAGS=${BOOT_BOOT1_FLAGS} \
28 -DSIOPRT=${BOOT_COMCONSOLE_PORT} \
29 -DSIOFMT=${B2SIOFMT} \
30 -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
32 -Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align \
33 -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
34 -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
38 -fno-asynchronous-unwind-tables \
39 --param max-inline-insns-single=100
40 .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} <= 40201
41 CFLAGS.gcc+= -mno-align-long-strings
44 CFLAGS.clang+= -Oz ${CLANG_OPT_SMALL}
46 LD_FLAGS+=${LD_FLAGS_BIN}
51 cat boot1 boot2 > boot
53 CLEANFILES+= boot1 boot1.out boot1.o
56 ${OBJCOPY} -S -O binary boot1.out ${.TARGET}
59 ${LD} ${LD_FLAGS} -e start --defsym ORG=${ORG1} -T ${LDSCRIPT} -o ${.TARGET} boot1.o
61 CLEANFILES+= boot2 boot2.ld boot2.ldr boot2.bin boot2.out boot2.o \
67 @set -- `ls -l ${.ALLSRC}`; x=$$((${BOOT2SIZE}-$$5)); \
68 echo "$$x bytes available"; test $$x -ge 0
69 ${DD} if=${.ALLSRC} of=${.TARGET} obs=${BOOT2SIZE} conv=osync
71 boot2.ld: boot2.ldr boot2.bin ${BTXKERN}
72 btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l boot2.ldr \
73 -o ${.TARGET} -P 1 boot2.bin
76 ${DD} if=/dev/zero of=${.TARGET} bs=512 count=1
79 ${OBJCOPY} -S -O binary boot2.out ${.TARGET}
82 .PATH: ${SRCTOP}/contrib/llvm-project/compiler-rt/lib/builtins
83 CFLAGS.ashldi3.c= -Wno-missing-prototypes -Wno-missing-declarations
84 CLEANFILES+= ashldi3.o
86 boot2.out: ${BTXCRT} boot2.o sio.o ashldi3.o
87 ${LD} ${LD_FLAGS} --defsym ORG=${ORG2} -T ${LDSCRIPT} -o ${.TARGET} ${.ALLSRC}
92 ${NM} -t d ${.ALLSRC} | awk '/([0-9])+ T xread/ \
94 printf("#define XREADORG %#x\n", REL1 + x) }' \
95 ORG1=`printf "%d" ${ORG1}` \
96 REL1=`printf "%d" ${REL1}` > ${.TARGET}
98 .include <bsd.prog.mk>