1# $FreeBSD: head/sys/boot/i386/gptboot/Makefile 169732 2007-05-19 05:07:47Z kan $
| 1# $FreeBSD: head/sys/boot/i386/gptboot/Makefile 172940 2007-10-24 21:33:00Z jhb $
|
2
| 2
|
3FILES= boot boot1 boot2
| 3.PATH: ${.CURDIR}/../boot2
|
4
| 4
|
| 5FILES= gptboot 6
|
5NM?= nm 6
| 7NM?= nm 8
|
7# A value of 0x80 enables LBA support. 8BOOT_BOOT1_FLAGS?= 0x80 9
| |
10BOOT_COMCONSOLE_PORT?= 0x3f8 11BOOT_COMCONSOLE_SPEED?= 9600 12B2SIOFMT?= 0x3 13 14REL1= 0x700 15ORG1= 0x7c00
| 9BOOT_COMCONSOLE_PORT?= 0x3f8 10BOOT_COMCONSOLE_SPEED?= 9600 11B2SIOFMT?= 0x3 12 13REL1= 0x700 14ORG1= 0x7c00
|
16ORG2= 0x2000
| 15ORG2= 0x0
|
17 18# Decide level of UFS support.
| 16 17# Decide level of UFS support.
|
19BOOT2_UFS?= UFS1_AND_UFS2 20#BOOT2_UFS?= UFS2_ONLY 21#BOOT2_UFS?= UFS1_ONLY
| 18GPTBOOT_UFS?= UFS1_AND_UFS2 19#GPTBOOT_UFS?= UFS2_ONLY 20#GPTBOOT_UFS?= UFS1_ONLY
|
22 23CFLAGS= -Os \ 24 -fno-guess-branch-probability \ 25 -fomit-frame-pointer \ 26 -fno-unit-at-a-time \ 27 -mno-align-long-strings \ 28 -mrtd \ 29 -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 \
| 21 22CFLAGS= -Os \ 23 -fno-guess-branch-probability \ 24 -fomit-frame-pointer \ 25 -fno-unit-at-a-time \ 26 -mno-align-long-strings \ 27 -mrtd \ 28 -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 \
|
30 -D${BOOT2_UFS} \ 31 -DFLAGS=${BOOT_BOOT1_FLAGS} \
| 29 -D${GPTBOOT_UFS} \
|
32 -DSIOPRT=${BOOT_COMCONSOLE_PORT} \ 33 -DSIOFMT=${B2SIOFMT} \ 34 -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \ 35 -I${.CURDIR}/../../common \
| 30 -DSIOPRT=${BOOT_COMCONSOLE_PORT} \ 31 -DSIOFMT=${B2SIOFMT} \ 32 -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \ 33 -I${.CURDIR}/../../common \
|
36 -I${.CURDIR}/../btx/lib -I. \
| 34 -I${.CURDIR}/../btx/lib \ 35 -I${.CURDIR}/../boot2 \
|
37 -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \ 38 -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ 39 -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ 40 -Winline --param max-inline-insns-single=100 41 42LDFLAGS=-static -N --gc-sections 43 44# Pick up ../Makefile.inc early. 45.include <bsd.init.mk> 46
| 36 -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \ 37 -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ 38 -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ 39 -Winline --param max-inline-insns-single=100 40 41LDFLAGS=-static -N --gc-sections 42 43# Pick up ../Makefile.inc early. 44.include <bsd.init.mk> 45
|
47CLEANFILES= boot
| 46CLEANFILES= gptboot
|
48
| 47
|
49boot: boot1 boot2 50 cat boot1 boot2 > boot
| 48gptboot: gptldr.bin gptboot.bin ${BTXKERN} 49 btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l gptldr.bin \ 50 -o ${.TARGET} gptboot.bin
|
51
| 51
|
52CLEANFILES+= boot1 boot1.out boot1.o
| 52CLEANFILES+= gptldr.bin gptldr.out gptldr.o
|
53
| 53
|
54boot1: boot1.out 55 objcopy -S -O binary boot1.out ${.TARGET}
| 54gptldr.bin: gptldr.out 55 objcopy -S -O binary gptldr.out ${.TARGET}
|
56
| 56
|
57boot1.out: boot1.o 58 ${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o
| 57gptldr.out: gptldr.o 58 ${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o
|
59
| 59
|
60CLEANFILES+= boot2 boot2.ld boot2.ldr boot2.bin boot2.out boot2.o \ 61 boot2.s boot2.s.tmp boot2.h sio.o
| 60CLEANFILES+= gptboot.bin gptboot.out gptboot.o sio.o
|
62
| 61
|
63boot2: boot2.ld 64 @set -- `ls -l boot2.ld`; x=$$((7680-$$5)); \ 65 echo "$$x bytes available"; test $$x -ge 0 66 dd if=boot2.ld of=${.TARGET} obs=7680 conv=osync
| 62gptboot.bin: gptboot.out 63 objcopy -S -O binary gptboot.out ${.TARGET}
|
67
| 64
|
68boot2.ld: boot2.ldr boot2.bin ${BTXKERN} 69 btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l boot2.ldr \ 70 -o ${.TARGET} -P 1 boot2.bin 71 72boot2.ldr: 73 dd if=/dev/zero of=${.TARGET} bs=276 count=1 74 75boot2.bin: boot2.out 76 objcopy -S -O binary boot2.out ${.TARGET} 77 78boot2.out: ${BTXCRT} boot2.o sio.o
| 65gptboot.out: ${BTXCRT} gptboot.o sio.o
|
79 ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} 80
| 66 ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} 67
|
81boot2.o: boot2.s
| 68gptboot.o: ${.CURDIR}/../../common/ufsread.c
|
82
| 69
|
83SRCS= boot2.c boot2.h 84 85boot2.s: boot2.c boot2.h ${.CURDIR}/../../common/ufsread.c 86 ${CC} ${CFLAGS} -S -o boot2.s.tmp ${.CURDIR}/boot2.c 87 sed -e '/align/d' -e '/nop/d' < boot2.s.tmp > boot2.s 88 rm -f boot2.s.tmp 89 90boot2.h: boot1.out 91 ${NM} -t d ${.ALLSRC} | awk '/([0-9])+ T xread/ \ 92 { x = $$1 - ORG1; \ 93 printf("#define XREADORG %#x\n", REL1 + x) }' \ 94 ORG1=`printf "%d" ${ORG1}` \ 95 REL1=`printf "%d" ${REL1}` > ${.TARGET} 96
| |
97.if ${MACHINE_ARCH} == "amd64"
| 70.if ${MACHINE_ARCH} == "amd64"
|
98beforedepend boot2.s: machine
| 71beforedepend gptboot.o: machine
|
99CLEANFILES+= machine 100machine: 101 ln -sf ${.CURDIR}/../../../i386/include machine 102.endif 103 104.include <bsd.prog.mk>
| 72CLEANFILES+= machine 73machine: 74 ln -sf ${.CURDIR}/../../../i386/include machine 75.endif 76 77.include <bsd.prog.mk>
|