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