Index: head/sys/boot/i386/Makefile.inc =================================================================== --- head/sys/boot/i386/Makefile.inc (revision 325170) +++ head/sys/boot/i386/Makefile.inc (revision 325171) @@ -1,36 +1,35 @@ # Common defines for all of /sys/boot/i386/ # # $FreeBSD$ LOADER_ADDRESS?=0x200000 CFLAGS+= -march=i386 -ffreestanding CFLAGS.gcc+= -mpreferred-stack-boundary=2 CFLAGS+= ${CFLAGS_NO_SIMD} -msoft-float LDFLAGS+= -nostdlib -.if ${MACHINE_CPUARCH} == "amd64" -CFLAGS+= -m32 -ACFLAGS+= -m32 -# LD_FLAGS is passed directly to ${LD}, not via ${CC}: -LD_FLAGS+= -m elf_i386_fbsd -AFLAGS+= --32 -.endif - # BTX components -.if exists(${.OBJDIR}/../btx) -BTXDIR= ${.OBJDIR}/../btx -.else -BTXDIR= ${.CURDIR}/../btx -.endif +BTXDIR= ${BOOTOBJ}/i386/btx BTXLDR= ${BTXDIR}/btxldr/btxldr BTXKERN= ${BTXDIR}/btx/btx BTXCRT= ${BTXDIR}/lib/crt0.o +BTXSRC= ${BOOTSRC}/i386/btx +BTXLIB= ${BTXSRC}/lib + # compact binary with no padding between text, data, bss LDSCRIPT= ${BOOTSRC}/i386/boot.ldscript # LDFLAGS_BIN=-e start -Ttext ${ORG} -Wl,-T,${LDSCRIPT},-S,--oformat,binary # LD_FLAGS_BIN=-static -T ${LDSCRIPT} --gc-sections LDFLAGS_BIN=-e start -Ttext ${ORG} -Wl,-N,-S,--oformat,binary LD_FLAGS_BIN=-static -N --gc-sections + +.if ${MACHINE_CPUARCH} == "amd64" +CFLAGS+= -m32 +ACFLAGS+= -m32 +# LD_FLAGS is passed directly to ${LD}, not via ${CC}: +LD_FLAGS+= -m elf_i386_fbsd +AFLAGS+= --32 +.endif .include "../Makefile.inc" Index: head/sys/boot/i386/boot0/Makefile =================================================================== --- head/sys/boot/i386/boot0/Makefile (revision 325170) +++ head/sys/boot/i386/boot0/Makefile (revision 325171) @@ -1,80 +1,80 @@ # $FreeBSD$ PROG?= boot0 STRIP= BINMODE=${NOBINMODE} MAN= SRCS= ${PROG}.S # Additional options that you can specify with make OPTS="..." # (these only apply to boot0.S) # # -DVOLUME_SERIAL support volume serial number (NT, XP, Vista) # -DSIO do I/O using COM1: # -DPXE fallback to INT18/PXE with F6 # -DCHECK_DRIVE enable checking drive number # -DONLY_F_KEYS accept only Fx keys in console # -DTEST print drive number on entry # OPTS ?= -DVOLUME_SERIAL -DPXE CFLAGS += ${OPTS} # Flags used in the boot0.S code: # 0x0f all valid partitions enabled. # 0x80 'packet', use BIOS EDD (LBA) extensions instead of CHS # to read from disk. boot0.S does not check that the extensions # are supported, but all modern BIOSes should have them. # 0x40 'noupdate', disable writing boot0 back to disk so that # the current selection is not preserved across reboots. # 0x20 'setdrv', override the drive number supplied by the bios # with the one in the boot sector. # Default boot flags: BOOT_BOOT0_FLAGS?= 0x8f # The number of timer ticks to wait for a keypress before assuming the default # selection. Since there are 18.2 ticks per second, the default value of # 0xb6 (182d) corresponds to 10 seconds. BOOT_BOOT0_TICKS?= 0xb6 # The base address that we the boot0 code to to run it. Don't change this # unless you are glutton for punishment. BOOT_BOOT0_ORG?= 0x600 ORG=${BOOT_BOOT0_ORG} # Comm settings for boot0sio. # Bit(s) Description # 7-5 data rate (110,150,300,600,1200,2400,4800,9600 bps) # 4-3 parity (00 or 10 = none, 01 = odd, 11 = even) # 2 stop bits (set = 2, clear = 1) # 1-0 data bits (00 = 5, 01 = 6, 10 = 7, 11 = 8) .if !defined(BOOT_BOOT0_COMCONSOLE_SPEED) BOOT_COMCONSOLE_SPEED?= 9600 .if ${BOOT_COMCONSOLE_SPEED} == 9600 BOOT_BOOT0_COMCONSOLE_SPEED= "7 << 5 + 3" .elif ${BOOT_COMCONSOLE_SPEED} == 4800 BOOT_BOOT0_COMCONSOLE_SPEED= "6 << 5 + 3" .elif ${BOOT_COMCONSOLE_SPEED} == 2400 BOOT_BOOT0_COMCONSOLE_SPEED= "5 << 5 + 3" .elif ${BOOT_COMCONSOLE_SPEED} == 1200 BOOT_BOOT0_COMCONSOLE_SPEED= "4 << 5 + 3" .elif ${BOOT_COMCONSOLE_SPEED} == 600 BOOT_BOOT0_COMCONSOLE_SPEED= "3 << 5 + 3" .elif ${BOOT_COMCONSOLE_SPEED} == 300 BOOT_BOOT0_COMCONSOLE_SPEED= "2 << 5 + 3" .elif ${BOOT_COMCONSOLE_SPEED} == 150 BOOT_BOOT0_COMCONSOLE_SPEED= "1 << 5 + 3" .elif ${BOOT_COMCONSOLE_SPEED} == 110 BOOT_BOOT0_COMCONSOLE_SPEED= "0 << 5 + 3" .else BOOT_BOOT0_COMCONSOLE_SPEED= "7 << 5 + 3" .endif .endif CFLAGS+=-DFLAGS=${BOOT_BOOT0_FLAGS} \ -DTICKS=${BOOT_BOOT0_TICKS} \ -DCOMSPEED=${BOOT_BOOT0_COMCONSOLE_SPEED} -LDFLAGS=${LDFLAGS_BIN} +LDFLAGS+=${LDFLAGS_BIN} .include Index: head/sys/boot/i386/boot2/Makefile =================================================================== --- head/sys/boot/i386/boot2/Makefile (revision 325170) +++ head/sys/boot/i386/boot2/Makefile (revision 325171) @@ -1,109 +1,106 @@ # $FreeBSD$ -.include +.include FILES= boot boot1 boot2 NM?= nm # A value of 0x80 enables LBA support. BOOT_BOOT1_FLAGS?= 0x80 BOOT_COMCONSOLE_PORT?= 0x3f8 BOOT_COMCONSOLE_SPEED?= 9600 B2SIOFMT?= 0x3 REL1= 0x700 ORG1= 0x7c00 ORG2= 0x2000 # Decide level of UFS support. BOOT2_UFS?= UFS1_AND_UFS2 #BOOT2_UFS?= UFS2_ONLY #BOOT2_UFS?= UFS1_ONLY -CFLAGS= -fomit-frame-pointer \ +CFLAGS+=-fomit-frame-pointer \ -mrtd \ -mregparm=3 \ -D${BOOT2_UFS} \ -DFLAGS=${BOOT_BOOT1_FLAGS} \ -DSIOPRT=${BOOT_COMCONSOLE_PORT} \ -DSIOFMT=${B2SIOFMT} \ -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \ - -I${.CURDIR}/../../common \ - -I${.CURDIR}/../btx/lib -I. \ + -I${LDRSRC} \ + -I${BTXLIB} -I. \ -Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align \ -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ -Winline CFLAGS.gcc+= -Os \ -fno-asynchronous-unwind-tables \ --param max-inline-insns-single=100 .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} <= 40201 CFLAGS.gcc+= -mno-align-long-strings .endif CFLAGS.clang+= -Oz ${CLANG_OPT_SMALL} -LD_FLAGS=${LD_FLAGS_BIN} +LD_FLAGS+=${LD_FLAGS_BIN} -# Pick up ../Makefile.inc early. -.include - CLEANFILES= boot boot: boot1 boot2 cat boot1 boot2 > boot CLEANFILES+= boot1 boot1.out boot1.o boot1: boot1.out ${OBJCOPY} -S -O binary boot1.out ${.TARGET} boot1.out: boot1.o ${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o CLEANFILES+= boot2 boot2.ld boot2.ldr boot2.bin boot2.out boot2.o \ boot2.h sio.o BOOT2SIZE= 7680 boot2: boot2.ld @set -- `ls -l ${.ALLSRC}`; x=$$((${BOOT2SIZE}-$$5)); \ echo "$$x bytes available"; test $$x -ge 0 ${DD} if=${.ALLSRC} of=${.TARGET} obs=${BOOT2SIZE} conv=osync boot2.ld: boot2.ldr boot2.bin ${BTXKERN} btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l boot2.ldr \ -o ${.TARGET} -P 1 boot2.bin boot2.ldr: ${DD} if=/dev/zero of=${.TARGET} bs=512 count=1 boot2.bin: boot2.out ${OBJCOPY} -S -O binary boot2.out ${.TARGET} boot2.out: ${BTXCRT} boot2.o sio.o ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} SRCS= boot2.c boot2.h boot2.h: boot1.out ${NM} -t d ${.ALLSRC} | awk '/([0-9])+ T xread/ \ { x = $$1 - ORG1; \ printf("#define XREADORG %#x\n", REL1 + x) }' \ ORG1=`printf "%d" ${ORG1}` \ REL1=`printf "%d" ${REL1}` > ${.TARGET} .if ${MACHINE_CPUARCH} == "amd64" beforedepend boot2.s: machine CLEANFILES+= machine -machine: ${.CURDIR}/../../../i386/include .NOMETA +machine: ${SYSDIR}/i386/include .NOMETA ln -sf ${.ALLSRC} ${.TARGET} .endif .include # XXX: clang integrated-as doesn't grok .codeNN directives yet CFLAGS.boot1.S= ${CLANG_NO_IAS} Index: head/sys/boot/i386/btx/btx/Makefile =================================================================== --- head/sys/boot/i386/btx/btx/Makefile (revision 325170) +++ head/sys/boot/i386/btx/btx/Makefile (revision 325171) @@ -1,33 +1,35 @@ # $FreeBSD$ +.include + PROG= btx INTERNALPROG= MAN= SRCS= btx.S .if defined(BOOT_BTX_NOHANG) BOOT_BTX_FLAGS=0x1 .else BOOT_BTX_FLAGS=0x0 .endif CFLAGS+=-DBTX_FLAGS=${BOOT_BTX_FLAGS} -CFLAGS+=-I${.CURDIR}/../../common +CFLAGS+=-I${BOOTSRC}/i386/common .if defined(BTX_SERIAL) BOOT_COMCONSOLE_PORT?= 0x3f8 BOOT_COMCONSOLE_SPEED?= 9600 B2SIOFMT?= 0x3 CFLAGS+=-DBTX_SERIAL -DSIOPRT=${BOOT_COMCONSOLE_PORT} \ -DSIOFMT=${B2SIOFMT} -DSIOSPD=${BOOT_COMCONSOLE_SPEED} .endif ORG= 0x9000 -LDFLAGS=${LDFLAGS_BIN} +LDFLAGS+=${LDFLAGS_BIN} .include # XXX: clang integrated-as doesn't grok .codeNN directives yet CFLAGS.btx.S= ${CLANG_NO_IAS} Index: head/sys/boot/i386/btx/btxldr/Makefile =================================================================== --- head/sys/boot/i386/btx/btxldr/Makefile (revision 325170) +++ head/sys/boot/i386/btx/btxldr/Makefile (revision 325171) @@ -1,21 +1,23 @@ # $FreeBSD$ +.include + PROG= btxldr INTERNALPROG= MAN= SRCS= btxldr.S CFLAGS+=-DLOADER_ADDRESS=${LOADER_ADDRESS} -CFLAGS+=-I${.CURDIR}/../../common +CFLAGS+=-I${BOOTSRC}/i386/common .if defined(BTXLDR_VERBOSE) CFLAGS+=-DBTXLDR_VERBOSE .endif ORG=${LOADER_ADDRESS} -LDFLAGS=${LDFLAGS_BIN} +LDFLAGS+=${LDFLAGS_BIN} .include # XXX: clang integrated-as doesn't grok .codeNN directives yet CFLAGS.btxldr.S= ${CLANG_NO_IAS} Index: head/sys/boot/i386/btx/lib/Makefile =================================================================== --- head/sys/boot/i386/btx/lib/Makefile (revision 325170) +++ head/sys/boot/i386/btx/lib/Makefile (revision 325171) @@ -1,10 +1,12 @@ # $FreeBSD$ +.include + PROG= crt0.o INTERNALPROG= MAN= SRCS= btxcsu.S btxsys.s btxv86.s -CFLAGS+=-I${.CURDIR}/../../common -LDFLAGS=-Wl,-r +CFLAGS+=-I${BOOTSRC}/i386/common +LDFLAGS+=-Wl,-r .include Index: head/sys/boot/i386/cdboot/Makefile =================================================================== --- head/sys/boot/i386/cdboot/Makefile (revision 325170) +++ head/sys/boot/i386/cdboot/Makefile (revision 325171) @@ -1,18 +1,20 @@ # $FreeBSD$ +.include + PROG= cdboot STRIP= BINMODE=${NOBINMODE} MAN= SRCS= ${PROG}.S -CFLAGS+=-I${.CURDIR}/../common +CFLAGS+=-I${BOOTSRC}/i386/common ORG= 0x7c00 -LDFLAGS=${LDFLAGS_BIN} +LDFLAGS+=${LDFLAGS_BIN} .include # XXX: clang integrated-as doesn't grok .codeNN directives yet CFLAGS.cdboot.S= ${CLANG_NO_IAS} Index: head/sys/boot/i386/gptboot/Makefile =================================================================== --- head/sys/boot/i386/gptboot/Makefile (revision 325170) +++ head/sys/boot/i386/gptboot/Makefile (revision 325171) @@ -1,93 +1,89 @@ # $FreeBSD$ -.include "../Makefile.inc" +.include -.PATH: ${.CURDIR}/../boot2 ${.CURDIR}/../common ${SASRC} +.PATH: ${BOOTSRC}/i386/boot2 ${BOOTSRC}/i386/common ${SASRC} FILES= gptboot MAN= gptboot.8 NM?= nm BOOT_COMCONSOLE_PORT?= 0x3f8 BOOT_COMCONSOLE_SPEED?= 9600 B2SIOFMT?= 0x3 REL1= 0x700 ORG1= 0x7c00 ORG2= 0x0 # Decide level of UFS support. GPTBOOT_UFS?= UFS1_AND_UFS2 #GPTBOOT_UFS?= UFS2_ONLY #GPTBOOT_UFS?= UFS1_ONLY CFLAGS+=-DBOOTPROG=\"gptboot\" \ -O1 \ -DGPT \ -D${GPTBOOT_UFS} \ -DSIOPRT=${BOOT_COMCONSOLE_PORT} \ -DSIOFMT=${B2SIOFMT} \ -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \ - -I${.CURDIR}/../../common \ - -I${.CURDIR}/../common \ - -I${.CURDIR}/../btx/lib -I. \ - -I${.CURDIR}/../boot2 \ - -I${.CURDIR}/../../.. \ + -I${LDRSRC} \ + -I${BOOTSRC}/i386/common \ + -I${BTXLIB} -I. \ + -I${BOOTSRC}/i386/boot2 \ + -I${SYSDIR} \ -Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align \ -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ -Winline -Wno-pointer-sign CFLAGS.gcc+= --param max-inline-insns-single=100 .if ${LOADER_GELI_SUPPORT:Uyes} == "yes" CFLAGS+= -DLOADER_GELI_SUPPORT CFLAGS+= -I${BOOTSRC}/geli -CFLAGS+= -I${.CURDIR}/../../.. LIBGELIBOOT= ${BOOTOBJ}/geli/libgeliboot.a -.PATH: ${.CURDIR}/../../../opencrypto +.PATH: ${SYSDIR}/opencrypto OPENCRYPTO_XTS= xform_aes_xts.o .endif -LD_FLAGS=${LD_FLAGS_BIN} +LD_FLAGS+=${LD_FLAGS_BIN} -# Pick up ../Makefile.inc early. -.include - CLEANFILES= gptboot gptboot: gptldr.bin gptboot.bin ${BTXKERN} btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l gptldr.bin \ -o ${.TARGET} gptboot.bin CLEANFILES+= gptldr.bin gptldr.out gptldr.o gptldr.bin: gptldr.out ${OBJCOPY} -S -O binary gptldr.out ${.TARGET} gptldr.out: gptldr.o ${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o CLEANFILES+= gptboot.bin gptboot.out gptboot.o sio.o crc32.o drv.o \ cons.o util.o ${OPENCRYPTO_XTS} gptboot.bin: gptboot.out ${OBJCOPY} -S -O binary gptboot.out ${.TARGET} gptboot.out: ${BTXCRT} gptboot.o sio.o crc32.o drv.o cons.o util.o ${OPENCRYPTO_XTS} ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBGELIBOOT} ${LIBSA32} gptboot.o: ${SASRC}/ufsread.c .if ${MACHINE_CPUARCH} == "amd64" beforedepend gptboot.o: machine CLEANFILES+= machine machine: .NOMETA - ln -sf ${.CURDIR}/../../../i386/include machine + ln -sf ${SYSDIR}/i386/include machine .endif .include # XXX: clang integrated-as doesn't grok .codeNN directives yet CFLAGS.gptldr.S= ${CLANG_NO_IAS} Index: head/sys/boot/i386/gptzfsboot/Makefile =================================================================== --- head/sys/boot/i386/gptzfsboot/Makefile (revision 325170) +++ head/sys/boot/i386/gptzfsboot/Makefile (revision 325171) @@ -1,102 +1,99 @@ # $FreeBSD$ -.include "../Makefile.inc" +.include -.PATH: ${.CURDIR}/../boot2 ${.CURDIR}/../gptboot \ - ${.CURDIR}/../zfsboot ${.CURDIR}/../common \ - ${.CURDIR}/../../../crypto/skein ${SASRC} +.PATH: ${BOOTSRC}/i386/boot2 ${BOOTSRC}/i386/gptboot \ + ${BOOTSRC}/i386/zfsboot ${BOOTSRC}/i386/common \ + ${SYSDIR}/crypto/skein ${SASRC} FILES= gptzfsboot MAN= gptzfsboot.8 NM?= nm BOOT_COMCONSOLE_PORT?= 0x3f8 BOOT_COMCONSOLE_SPEED?= 9600 B2SIOFMT?= 0x3 REL1= 0x700 ORG1= 0x7c00 ORG2= 0x0 CFLAGS+=-DBOOTPROG=\"gptzfsboot\" \ -O1 \ -DGPT -DZFS -DBOOT2 \ -DSIOPRT=${BOOT_COMCONSOLE_PORT} \ -DSIOFMT=${B2SIOFMT} \ -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \ - -I${.CURDIR}/../../common \ - -I${.CURDIR}/../common \ - -I${.CURDIR}/../../zfs \ - -I${.CURDIR}/../../../cddl/boot/zfs \ - -I${.CURDIR}/../../../crypto/skein \ - -I${.CURDIR}/../btx/lib -I. \ - -I${.CURDIR}/../boot2 \ - -I${.CURDIR}/../../.. \ + -I${LDRSRC} \ + -I${BOOTSRC}/i386/common \ + -I${BOOTSRC}/zfs \ + -I${SYSDIR}/cddl/boot/zfs \ + -I${SYSDIR}/crypto/skein \ + -I${BOOTSRC}/i386/btx/lib -I. \ + -I${BOOTSRC}/i386/boot2 \ + -I${SYSDIR} \ -Wall -Waggregate-return -Wbad-function-cast \ -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ -Winline -Wno-pointer-sign NO_WCAST_ALIGN= .if ${COMPILER_TYPE} == "clang" || \ (${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201) CFLAGS+= -Wno-tentative-definition-incomplete-type .endif # Do not unroll skein loops, reduce code size CFLAGS+= -DSKEIN_LOOP=111 .if ${LOADER_GELI_SUPPORT:Uyes} == "yes" CFLAGS+= -DLOADER_GELI_SUPPORT CFLAGS+= -I${BOOTSRC}/geli LIBGELIBOOT= ${BOOTOBJ}/geli/libgeliboot.a -.PATH: ${.CURDIR}/../../../opencrypto +.PATH: ${SYSDIR}/opencrypto OPENCRYPTO_XTS= xform_aes_xts.o .endif CFLAGS.gcc+= --param max-inline-insns-single=100 -LD_FLAGS=${LD_FLAGS_BIN} +LD_FLAGS+=${LD_FLAGS_BIN} -# Pick up ../Makefile.inc early. -.include - CLEANFILES= gptzfsboot gptzfsboot: gptldr.bin gptzfsboot.bin ${BTXKERN} btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l gptldr.bin \ -o ${.TARGET} gptzfsboot.bin CLEANFILES+= gptldr.bin gptldr.out gptldr.o gptldr.bin: gptldr.out ${OBJCOPY} -S -O binary gptldr.out ${.TARGET} gptldr.out: gptldr.o ${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o CLEANFILES+= gptzfsboot.bin gptzfsboot.out zfsboot.o sio.o cons.o \ drv.o gpt.o util.o skein.o skein_block.o ${OPENCRYPTO_XTS} gptzfsboot.bin: gptzfsboot.out ${OBJCOPY} -S -O binary gptzfsboot.out ${.TARGET} gptzfsboot.out: ${BTXCRT} zfsboot.o sio.o gpt.o drv.o cons.o util.o \ skein.o skein_block.o ${OPENCRYPTO_XTS} ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBGELIBOOT} ${LIBSA32} -zfsboot.o: ${.CURDIR}/../../zfs/zfsimpl.c +zfsboot.o: ${BOOTSRC}/zfs/zfsimpl.c .if ${MACHINE_CPUARCH} == "amd64" beforedepend zfsboot.o: machine CLEANFILES+= machine machine: .NOMETA - ln -sf ${.CURDIR}/../../../i386/include machine + ln -sf ${SYSDIR}/i386/include machine .endif .include # XXX: clang integrated-as doesn't grok .codeNN directives yet CFLAGS.gptldr.S= ${CLANG_NO_IAS} Index: head/sys/boot/i386/kgzldr/Makefile =================================================================== --- head/sys/boot/i386/kgzldr/Makefile (revision 325170) +++ head/sys/boot/i386/kgzldr/Makefile (revision 325171) @@ -1,19 +1,21 @@ # $FreeBSD$ +.include + PROG= kgzldr.o STRIP= BINMODE=${LIBMODE} BINDIR= ${LIBDIR} MAN= SRCS= start.s boot.c inflate.c lib.c crt.s sio.s CFLAGS= -Os CFLAGS+=-DKZIP NO_SHARED= -LDFLAGS=-Wl,-r -.PATH: ${.CURDIR}/../../../kern +LDFLAGS+=-Wl,-r +.PATH: ${SYSDIR}/kern BOOT_COMCONSOLE_PORT?= 0x3f8 AFLAGS+=--defsym SIO_PRT=${BOOT_COMCONSOLE_PORT} .include Index: head/sys/boot/i386/libfirewire/Makefile =================================================================== --- head/sys/boot/i386/libfirewire/Makefile (revision 325170) +++ head/sys/boot/i386/libfirewire/Makefile (revision 325171) @@ -1,29 +1,31 @@ # $FreeBSD$ +.include + LIB= firewire INTERNALLIB= -.PATH: ${.CURDIR}/../../../dev/dcons ${.CURDIR}/../../../dev/firewire +.PATH: ${SYSDIR}/dev/dcons ${SYSDIR}/dev/firewire SRCS+= firewire.c fwohci.c dconsole.c SRCS+= dcons.c fwcrom.c CFLAGS+= -D_BOOT -CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../../.. -I. -CFLAGS+= -I${.CURDIR}/../btx/lib -CFLAGS+= -I${.CURDIR}/../libi386 +CFLAGS+= -I${LDRSRC} -I${SYSDIR} -I. +CFLAGS+= -I${BTXLIB} +CFLAGS+= -I${BOOTSRC}/i386/libi386 CFLAGS+= -Wformat -Wall .if ${MACHINE_CPUARCH} == "amd64" CLEANFILES+= machine machine: .NOMETA - ln -sf ${.CURDIR}/../../../i386/include machine + ln -sf ${SYSDIR}/i386/include machine .endif .include .if ${MACHINE_CPUARCH} == "amd64" beforedepend ${OBJS}: machine .endif Index: head/sys/boot/i386/libi386/Makefile =================================================================== --- head/sys/boot/i386/libi386/Makefile (revision 325170) +++ head/sys/boot/i386/libi386/Makefile (revision 325171) @@ -1,75 +1,75 @@ # $FreeBSD$ -# -.include "../../defs.mk" +.include + LIB= i386 INTERNALLIB= SRCS= biosacpi.c bioscd.c biosdisk.c biosmem.c biospnp.c \ biospci.c biossmap.c bootinfo.c bootinfo32.c bootinfo64.c \ comconsole.c devicename.c elf32_freebsd.c \ elf64_freebsd.c multiboot.c multiboot_tramp.S relocater_tramp.S \ i386_copy.c i386_module.c nullconsole.c pxe.c pxetramp.s \ smbios.c time.c vidconsole.c amd64_tramp.S spinconsole.c -.PATH: ${.CURDIR}/../../zfs +.PATH: ${BOOTSRC}/zfs SRCS+= devicename_stubs.c BOOT_COMCONSOLE_PORT?= 0x3f8 CFLAGS+= -DCOMPORT=${BOOT_COMCONSOLE_PORT} BOOT_COMCONSOLE_SPEED?= 9600 CFLAGS+= -DCOMSPEED=${BOOT_COMCONSOLE_SPEED} .ifdef(BOOT_BIOSDISK_DEBUG) # Make the disk code more talkative CFLAGS+= -DDISK_DEBUG .endif .if ${LOADER_GELI_SUPPORT:Uyes} == "yes" # Decrypt encrypted drives CFLAGS+= -DLOADER_GELI_SUPPORT CFLAGS+= -I${BOOTSRC}/geli .endif .if !defined(BOOT_HIDE_SERIAL_NUMBERS) # Export serial numbers, UUID, and asset tag from loader. CFLAGS+= -DSMBIOS_SERIAL_NUMBERS .if defined(BOOT_LITTLE_ENDIAN_UUID) # Use little-endian UUID format as defined in SMBIOS 2.6. CFLAGS+= -DSMBIOS_LITTLE_ENDIAN_UUID .elif defined(BOOT_NETWORK_ENDIAN_UUID) # Use network-endian UUID format for backward compatibility. CFLAGS+= -DSMBIOS_NETWORK_ENDIAN_UUID .endif .endif # Include simple terminal emulation (cons25-compatible) CFLAGS+= -DTERM_EMU # XXX: make alloca() useable CFLAGS+= -Dalloca=__builtin_alloca -CFLAGS+= -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/i386 \ - -I${.CURDIR}/../../common -I${.CURDIR}/../common \ - -I${.CURDIR}/../btx/lib \ - -I${.CURDIR}/../../../contrib/dev/acpica/include \ - -I${.CURDIR}/../../.. -I. +CFLAGS+= -I${BOOTSRC}/ficl -I${BOOTSRC}/ficl/i386 \ + -I${LDRSRC} -I${BOOTSRC}/i386/common \ + -I${BTXLIB} \ + -I${SYSDIR}/contrib/dev/acpica/include \ + -I${SYSDIR} -I. # Handle FreeBSD specific %b and %D printf format specifiers CFLAGS+= ${FORMAT_EXTENSIONS} .if ${MACHINE_CPUARCH} == "amd64" CLEANFILES+= machine machine: .NOMETA - ln -sf ${.CURDIR}/../../../i386/include machine + ln -sf ${SYSDIR}/i386/include machine .endif .include # XXX: clang integrated-as doesn't grok .codeNN directives yet CFLAGS.amd64_tramp.S= ${CLANG_NO_IAS} CFLAGS.multiboot_tramp.S= ${CLANG_NO_IAS} .if ${MACHINE_CPUARCH} == "amd64" beforedepend ${OBJS}: machine .endif Index: head/sys/boot/i386/loader/Makefile =================================================================== --- head/sys/boot/i386/loader/Makefile (revision 325170) +++ head/sys/boot/i386/loader/Makefile (revision 325171) @@ -1,118 +1,116 @@ # $FreeBSD$ -.include +.include + MK_SSP= no LOADER?= loader PROG= ${LOADER}.sym MAN= INTERNALPROG= NEWVERSWHAT?= "bootstrap loader" x86 VERSION_FILE= ${.CURDIR}/../loader/version LOADER_NET_SUPPORT?= yes LOADER_NFS_SUPPORT?= yes LOADER_TFTP_SUPPORT?= yes LOADER_CD9660_SUPPORT?= no LOADER_EXT2FS_SUPPORT?= no LOADER_MSDOS_SUPPORT?= no LOADER_UFS_SUPPORT?= yes # architecture-specific loader code SRCS= main.c conf.c vers.c chain.c # Put LOADER_FIREWIRE_SUPPORT=yes in /etc/make.conf for FireWire/dcons support .if defined(LOADER_FIREWIRE_SUPPORT) CFLAGS+= -DLOADER_FIREWIRE_SUPPORT -LIBFIREWIRE= ${.OBJDIR}/../libfirewire/libfirewire.a +LIBFIREWIRE= ${BOOTSRC}/i386/libfirewire/libfirewire.a .endif # Set by zfsloader Makefile .if defined(LOADER_ZFS_SUPPORT) CFLAGS+= -DLOADER_ZFS_SUPPORT -LIBZFSBOOT= ${.OBJDIR}/../../zfs/libzfsboot.a +LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a .endif # Include bcache code. HAVE_BCACHE= yes # Enable PnP and ISA-PnP code. HAVE_PNP= yes HAVE_ISABUS= yes .if ${LOADER_GELI_SUPPORT:Uyes} == "yes" CFLAGS+= -DLOADER_GELI_SUPPORT CFLAGS+= -I${BOOTSRC}/geli LIBGELIBOOT= ${BOOTOBJ}/geli/libgeliboot.a -.PATH: ${.CURDIR}/../../../opencrypto +.PATH: ${SYSDIR}/opencrypto SRCS+= xform_aes_xts.c -CFLAGS+= -I${.CURDIR}/../../.. -D_STAND +CFLAGS+= -I${SYSDIR} -D_STAND .endif # Always add MI sources -.include "../../loader.mk" +.include "${BOOTSRC}/loader.mk" CFLAGS+= -I. CLEANFILES= ${LOADER} ${LOADER}.bin loader.help CFLAGS+= -Wall -LDFLAGS= -static -Ttext 0x0 +LDFLAGS+= -static -Ttext 0x0 # i386 standalone support library -LIBI386= ${.OBJDIR}/../libi386/libi386.a -CFLAGS+= -I${.CURDIR}/.. +LIBI386= ${BOOTOBJ}/i386/libi386/libi386.a +CFLAGS+= -I${BOOTSRC}/i386 # BTX components -CFLAGS+= -I${.CURDIR}/../btx/lib +CFLAGS+= -I${BTXLIB} # Debug me! #CFLAGS+= -g #LDFLAGS+= -g -# Pick up ../Makefile.inc early. -.include - ${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTXKERN} btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \ -b ${BTXKERN} ${LOADER}.bin ${LOADER}.bin: ${LOADER}.sym strip -R .comment -R .note -o ${.TARGET} ${.ALLSRC} loader.help: help.common help.i386 cat ${.ALLSRC} | awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} FILES= ${LOADER} # XXX INSTALLFLAGS_loader= -b FILESMODE_${LOADER}= ${BINMODE} -b .if !defined(LOADER_ONLY) -.PATH: ${.CURDIR}/../../forth -.include "${.CURDIR}/../../forth/Makefile.inc" +.PATH: ${BOOTSRC}/forth +.include "${BOOTSRC}/forth/Makefile.inc" FILES+= pcibios.4th FILES+= loader.rc menu.rc .endif # XXX crt0.o needs to be first for pxeboot(8) to work OBJS= ${BTXCRT} # XXX not happy with this construct, revisit .if ${MACHINE_CPUARCH} == "amd64" FICL= ${LIBFICL32} .else FICL= ${LIBFICL} .endif DPADD= ${FICL} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSA32} LDADD= ${FICL} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSA32} .include .if ${MACHINE_CPUARCH} == "amd64" beforedepend ${OBJS}: machine CLEANFILES+= machine CFLAGS+= -DLOADER_PREFER_AMD64 machine: .NOMETA - ln -sf ${.CURDIR}/../../../i386/include machine + ln -sf ${SYSDIR}/i386/include machine .endif Index: head/sys/boot/i386/mbr/Makefile =================================================================== --- head/sys/boot/i386/mbr/Makefile (revision 325170) +++ head/sys/boot/i386/mbr/Makefile (revision 325171) @@ -1,17 +1,17 @@ # $FreeBSD$ PROG= mbr STRIP= BINMODE=${NOBINMODE} MAN= SRCS= ${PROG}.s # MBR flags: 0x80 -- try packet interface (also known as EDD or LBA) BOOT_MBR_FLAGS?= 0x80 ORG= 0x600 AFLAGS+=--defsym FLAGS=${BOOT_MBR_FLAGS} -LDFLAGS=${LDFLAGS_BIN} +LDFLAGS+=${LDFLAGS_BIN} .include Index: head/sys/boot/i386/pmbr/Makefile =================================================================== --- head/sys/boot/i386/pmbr/Makefile (revision 325170) +++ head/sys/boot/i386/pmbr/Makefile (revision 325171) @@ -1,14 +1,14 @@ # $FreeBSD$ PROG= pmbr STRIP= BINMODE=${NOBINMODE} MAN= SRCS= ${PROG}.s ORG= 0x600 AFLAGS+=--defsym FLAGS=${BOOT_MBR_FLAGS} -LDFLAGS=${LDFLAGS_BIN} +LDFLAGS+=${LDFLAGS_BIN} .include Index: head/sys/boot/i386/pxeldr/Makefile =================================================================== --- head/sys/boot/i386/pxeldr/Makefile (revision 325170) +++ head/sys/boot/i386/pxeldr/Makefile (revision 325171) @@ -1,48 +1,47 @@ # $FreeBSD$ -# Pick up ../Makefile.inc early. .include PROG= ${LDR} INTERNALPROG= FILES= ${BOOT} MAN= ${BOOT}.8 SRCS= ${LDR}.S CLEANFILES= ${BOOT} BOOT= pxeboot LDR= pxeldr ORG= 0x7c00 LOADER= loader .if defined(BOOT_PXELDR_PROBE_KEYBOARD) CFLAGS+=-DPROBE_KEYBOARD .endif .if defined(BOOT_PXELDR_ALWAYS_SERIAL) CFLAGS+=-DALWAYS_SERIAL .endif -CFLAGS+=-I${.CURDIR}/../common +CFLAGS+=-I${BOOTSRC}/i386/common -LOADERBIN= ${.OBJDIR}/../loader/loader.bin +LOADERBIN= ${BOOTOBJ}/i386/loader/loader.bin CLEANFILES+= ${BOOT}.tmp ${BOOT}: ${LDR} ${LOADER} cat ${LDR} ${LOADER} > ${.TARGET}.tmp ${DD} if=${.TARGET}.tmp of=${.TARGET} obs=2k conv=osync rm ${.TARGET}.tmp LDFLAGS+=${LDFLAGS_BIN} CLEANFILES+= ${LOADER} ${LOADER}: ${LOADERBIN} ${BTXLDR} ${BTXKERN} btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \ -b ${BTXKERN} ${LOADERBIN} .include # XXX: clang integrated-as doesn't grok .codeNN directives yet CFLAGS.pxeldr.S= ${CLANG_NO_IAS} Index: head/sys/boot/i386/zfsboot/Makefile =================================================================== --- head/sys/boot/i386/zfsboot/Makefile (revision 325170) +++ head/sys/boot/i386/zfsboot/Makefile (revision 325171) @@ -1,102 +1,100 @@ # $FreeBSD$ LOADER_GELI_SUPPORT=no -.include "../Makefile.inc" +.include -.PATH: ${.CURDIR}/../boot2 ${.CURDIR}/../common \ - ${.CURDIR}/../../../crypto/skein ${SASRC} +.PATH: ${BOOTSRC}/i386/boot2 ${BOOTSRC}/i386/common \ + ${SYSDIR}/crypto/skein ${SASRC} FILES= zfsboot MAN= zfsboot.8 NM?= nm BOOT_COMCONSOLE_PORT?= 0x3f8 BOOT_COMCONSOLE_SPEED?= 9600 B2SIOFMT?= 0x3 REL1= 0x700 ORG1= 0x7c00 ORG2= 0x2000 CFLAGS+=-DBOOTPROG=\"zfsboot\" \ -O1 \ -DZFS -DBOOT2 \ -DSIOPRT=${BOOT_COMCONSOLE_PORT} \ -DSIOFMT=${B2SIOFMT} \ -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \ - -I${.CURDIR}/../../common \ - -I${.CURDIR}/../common \ - -I${.CURDIR}/../../zfs \ - -I${.CURDIR}/../../../cddl/boot/zfs \ - -I${.CURDIR}/../../../crypto/skein \ - -I${.CURDIR}/../btx/lib -I. \ - -I${.CURDIR}/../boot2 \ + -I${LDRSRC} \ + -I${BOOTSRC}/i386/common \ + -I${BOOTSRC}/i386 \ + -I${BOOTSRC}/zfs \ + -I${SYSDIR}/cddl/boot/zfs \ + -I${SYSDIR}/crypto/skein \ + -I${BTXLIB} -I. \ + -I${BOOTSRC}/i386/boot2 \ -Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align \ -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ -Winline CFLAGS.gcc+= --param max-inline-insns-single=100 # Do not unroll skein loops, reduce code size CFLAGS+= -DSKEIN_LOOP=111 -LD_FLAGS=${LD_FLAGS_BIN} +LD_FLAGS+=${LD_FLAGS_BIN} -# Pick up ../Makefile.inc early. -.include - CLEANFILES= zfsboot zfsboot: zfsboot1 zfsboot2 cat zfsboot1 zfsboot2 > zfsboot CLEANFILES+= zfsboot1 zfsldr.out zfsldr.o zfsboot1: zfsldr.out ${OBJCOPY} -S -O binary zfsldr.out ${.TARGET} zfsldr.out: zfsldr.o ${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} zfsldr.o CLEANFILES+= zfsboot2 zfsboot.ld zfsboot.ldr zfsboot.bin zfsboot.out \ zfsboot.o zfsboot.s zfsboot.s.tmp sio.o cons.o drv.o util.o \ skein.o skein_block.o # We currently allow 128k bytes for zfsboot - in practice it could be # any size up to 3.5Mb but keeping it fixed size simplifies zfsldr. # BOOT2SIZE= 131072 zfsboot2: zfsboot.ld @set -- `ls -l ${.ALLSRC}`; x=$$((${BOOT2SIZE}-$$5)); \ echo "$$x bytes available"; test $$x -ge 0 ${DD} if=${.ALLSRC} of=${.TARGET} obs=${BOOT2SIZE} conv=osync zfsboot.ld: zfsboot.ldr zfsboot.bin ${BTXKERN} btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l zfsboot.ldr \ -o ${.TARGET} -P 1 zfsboot.bin zfsboot.ldr: cp /dev/null ${.TARGET} zfsboot.bin: zfsboot.out ${OBJCOPY} -S -O binary zfsboot.out ${.TARGET} zfsboot.out: ${BTXCRT} zfsboot.o sio.o drv.o cons.o util.o skein.o skein_block.o ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSA32} SRCS= zfsboot.c .if ${MACHINE_CPUARCH} == "amd64" beforedepend zfsboot.o: machine CLEANFILES+= machine machine: .NOMETA - ln -sf ${.CURDIR}/../../../i386/include machine + ln -sf ${SYSDIR}/i386/include machine .endif .include # XXX: clang integrated-as doesn't grok .codeNN directives yet CFLAGS.zfsldr.S= ${CLANG_NO_IAS} Index: head/sys/boot/i386/zfsloader/Makefile =================================================================== --- head/sys/boot/i386/zfsloader/Makefile (revision 325170) +++ head/sys/boot/i386/zfsloader/Makefile (revision 325171) @@ -1,12 +1,14 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../loader +.include +.PATH: ${BOOTSRC}/i386/loader + LOADER= zfsloader NEWVERSWHAT= "ZFS enabled bootstrap loader" x86 LOADER_ZFS_SUPPORT=yes LOADER_ONLY= yes MAN= -.include "${.CURDIR}/../loader/Makefile" +.include "${BOOTSRC}/i386/loader/Makefile" Index: head/sys/boot/libsa32/Makefile =================================================================== --- head/sys/boot/libsa32/Makefile (revision 325170) +++ head/sys/boot/libsa32/Makefile (revision 325171) @@ -1,26 +1,24 @@ # $FreeBSD$ -.include +.include -.include "../Makefile.inc" - LIB=sa32 .if ${MACHINE_CPUARCH} == "amd64" LIBSTAND_CPUARCH=i386 .else LIBSTAND_CPUARCH=${MACHINE_CPUARCH} .endif .if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "powerpc64" CFLAGS+= -m32 -I. .endif .PATH: ${SASRC} .include "${SASRC}/Makefile" .if ${MACHINE_CPUARCH} == "amd64" CLEANFILES+= machine beforedepend ${OBJS}: machine machine: .NOMETA - ln -fs ${.CURDIR}/../../i386/include machine + ln -fs ${SYSDIR}/i386/include machine .endif