3 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
24 -fno-guess-branch-probability \
25 -fomit-frame-pointer \
27 -mno-align-long-strings \
29 -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 \
32 -DFLAGS=${BOOT_BOOT1_FLAGS} \
33 -DSIOPRT=${BOOT_COMCONSOLE_PORT} \
34 -DSIOFMT=${B2SIOFMT} \
35 -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
36 -I${.CURDIR}/../../common \
37 -I${.CURDIR}/../btx/lib -I. \
38 -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \
39 -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
40 -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
41 -Winline --param max-inline-insns-single=100
43 LDFLAGS=-static -N --gc-sections
45 # Pick up ../Makefile.inc early.
46 .include <bsd.init.mk>
51 cat boot1 boot2 > boot
53 CLEANFILES+= boot1 boot1.out boot1.o
56 objcopy -S -O binary boot1.out ${.TARGET}
59 ${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o
61 CLEANFILES+= boot2 boot2.ld boot2.ldr boot2.bin boot2.out boot2.o \
62 boot2.s boot2.s.tmp boot2.h sio.o
65 @set -- `ls -l boot2.ld`; x=$$((7680-$$5)); \
66 echo "$$x bytes available"; test $$x -ge 0
67 dd if=boot2.ld of=${.TARGET} obs=7680 conv=osync
69 boot2.ld: boot2.ldr boot2.bin ${BTXKERN}
70 btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l boot2.ldr \
71 -o ${.TARGET} -P 1 boot2.bin
74 dd if=/dev/zero of=${.TARGET} bs=512 count=1
77 objcopy -S -O binary boot2.out ${.TARGET}
79 boot2.out: ${BTXCRT} boot2.o sio.o
80 ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC}
86 boot2.s: boot2.c boot2.h ${.CURDIR}/../../common/ufsread.c
87 ${CC} ${CFLAGS} -S -o boot2.s.tmp ${.CURDIR}/boot2.c
88 sed -e '/align/d' -e '/nop/d' < boot2.s.tmp > boot2.s
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 .if ${MACHINE_ARCH} == "amd64"
99 beforedepend boot2.s: machine
102 ln -sf ${.CURDIR}/../../../i386/include machine
105 .include <bsd.prog.mk>