3 .PATH: ${.CURDIR}/../boot2 ${.CURDIR}/../common ${.CURDIR}/../../common
10 BOOT_COMCONSOLE_PORT?= 0x3f8
11 BOOT_COMCONSOLE_SPEED?= 9600
18 # Decide level of UFS support.
19 GPTBOOT_UFS?= UFS1_AND_UFS2
20 #GPTBOOT_UFS?= UFS2_ONLY
21 #GPTBOOT_UFS?= UFS1_ONLY
23 CFLAGS= -DBOOTPROG=\"gptboot\" \
27 -DSIOPRT=${BOOT_COMCONSOLE_PORT} \
28 -DSIOFMT=${B2SIOFMT} \
29 -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
30 -I${.CURDIR}/../../common \
31 -I${.CURDIR}/../common \
32 -I${.CURDIR}/../btx/lib -I. \
33 -I${.CURDIR}/../boot2 \
34 -I${.CURDIR}/../../.. \
35 -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \
36 -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
37 -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
38 -Winline --param max-inline-insns-single=100
40 LDFLAGS=-static -N --gc-sections
42 # Pick up ../Makefile.inc early.
43 .include <bsd.init.mk>
47 gptboot: gptldr.bin gptboot.bin ${BTXKERN}
48 btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l gptldr.bin \
49 -o ${.TARGET} gptboot.bin
51 CLEANFILES+= gptldr.bin gptldr.out gptldr.o
53 gptldr.bin: gptldr.out
54 objcopy -S -O binary gptldr.out ${.TARGET}
57 ${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o
59 CLEANFILES+= gptboot.bin gptboot.out gptboot.o sio.o gpt.o crc32.o drv.o \
62 gptboot.bin: gptboot.out
63 objcopy -S -O binary gptboot.out ${.TARGET}
65 gptboot.out: ${BTXCRT} gptboot.o sio.o gpt.o crc32.o drv.o cons.o util.o
66 ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSTAND}
68 gptboot.o: ${.CURDIR}/../../common/ufsread.c
70 .if ${MACHINE_CPUARCH} == "amd64"
71 beforedepend gptboot.o: machine
74 ln -sf ${.CURDIR}/../../../i386/include machine
77 .include <bsd.prog.mk>
79 # XXX: clang integrated-as doesn't grok .codeNN directives yet
80 CFLAGS.gptldr.S= ${CLANG_NO_IAS}
81 CFLAGS+= ${CFLAGS.${.IMPSRC:T}}