Define new EFI variables

Define EFISRC, EFIINC and EFIINCMD. Use them, as well as using other
symbols defined in defs.mk. Prefer <bsd.init.mk> to ../../Makefile.inc
or <src.opts.mk>.

Sponsored by: Netflix
This commit is contained in:
Warner Losh 2017-10-29 05:26:59 +00:00
parent ff744dbd85
commit f08693930b
8 changed files with 62 additions and 59 deletions

View File

@ -6,6 +6,9 @@
__BOOT_DEFS_MK__=${MFILE}
BOOTSRC= ${SRCTOP}/sys/boot
EFISRC= ${BOOTSRC}/efi
EFIINC= ${EFISRC}/include
EFIINCMD= ${EFIINC}/${MACHINE}
FDTSRC= ${BOOTSRC}/fdt
FICLSRC= ${BOOTSRC}/ficl
LDRSRC= ${BOOTSRC}/common

View File

@ -2,7 +2,7 @@
MAN=
.include "../Makefile.inc"
.include <bsd.init.mk>
MK_SSP= no
MK_FORTH= no
@ -40,7 +40,7 @@ SRCS+= zfs_module.c
SRCS+= skein.c skein_block.c
# Do not unroll skein loops, reduce code size
CFLAGS+= -DSKEIN_LOOP=111
.PATH: ${.CURDIR}/../../../crypto/skein
.PATH: ${SYSDIR}/crypto/skein
.endif
.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201
@ -48,32 +48,32 @@ CWARNFLAGS.self_reloc.c+= -Wno-error=maybe-uninitialized
.endif
CFLAGS+= -I.
CFLAGS+= -I${.CURDIR}/../include
CFLAGS+= -I${.CURDIR}/../include/${MACHINE}
CFLAGS+= -I${.CURDIR}/../../../contrib/dev/acpica/include
CFLAGS+= -I${.CURDIR}/../../..
CFLAGS+= -I${EFIINC}
CFLAGS+= -I${EFIINCMD}
CFLAGS+= -I${SYSDIR}/contrib/dev/acpica/include
CFLAGS+= -I${SYSDIR}
CFLAGS+= -DEFI_UFS_BOOT
.ifdef(EFI_DEBUG)
CFLAGS+= -DEFI_DEBUG
.endif
.if ${MK_ZFS} != "no"
CFLAGS+= -I${.CURDIR}/../../zfs/
CFLAGS+= -I${.CURDIR}/../../../cddl/boot/zfs/
CFLAGS+= -I${.CURDIR}/../../../crypto/skein
CFLAGS+= -I${BOOTSRC}/zfs/
CFLAGS+= -I${SYSDIR}/cddl/boot/zfs/
CFLAGS+= -I${SYSDIR}/crypto/skein
CFLAGS+= -DEFI_ZFS_BOOT
.endif
# Always add MI sources and REGULAR efi loader bits
.PATH: ${.CURDIR}/../loader/arch/${MACHINE}
.PATH: ${.CURDIR}/../loader
.PATH: ${.CURDIR}/../../common
CFLAGS+= -I${.CURDIR}/../../common
.PATH: ${EFISRC}/loader/arch/${MACHINE}
.PATH: ${EFISRC}/loader
.PATH: ${LDRSRC}
CFLAGS+= -I${LDRSRC}
FILES= boot1.efi boot1.efifat
FILESMODE_boot1.efi= ${BINMODE}
LDSCRIPT= ${.CURDIR}/../loader/arch/${MACHINE}/ldscript.${MACHINE}
LDSCRIPT= ${EFISRC}/loader/arch/${MACHINE}/ldscript.${MACHINE}
LDFLAGS+= -Wl,-T${LDSCRIPT},-Bsymbolic,-znotext -shared
.if ${MACHINE_CPUARCH} == "aarch64"
@ -84,7 +84,7 @@ CFLAGS+= -fPIC
LDFLAGS+= -Wl,-znocombreloc
.endif
LIBEFI= ${.OBJDIR}/../libefi/libefi.a
LIBEFI= ${BOOTOBJ}/efi/libefi/libefi.a
#
# Add libstand for the runtime functions used by the compiler - for example
@ -148,12 +148,12 @@ beforedepend ${OBJS}: machine
CLEANFILES+= machine
machine: .NOMETA
ln -sf ${.CURDIR}/../../../${MACHINE}/include machine
ln -sf ${SYSDIR}/${MACHINE}/include machine
.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
beforedepend ${OBJS}: x86
CLEANFILES+= x86
x86: .NOMETA
ln -sf ${.CURDIR}/../../../x86/include x86
ln -sf ${SYSDIR}/x86/include x86
.endif

View File

@ -1,8 +1,8 @@
# $FreeBSD$
.include <src.opts.mk>
.include <bsd.init.mk>
.PATH: ${.CURDIR}/../../common
.PATH: ${LDRSRC}
LIB= efi_fdt
INTERNALLIB=
@ -18,17 +18,17 @@ CFLAGS+= -msoft-float
.endif
# EFI library headers
CFLAGS+= -I${.CURDIR}/../include
CFLAGS+= -I${.CURDIR}/../include/${MACHINE}
CFLAGS+= -I${EFISRC}/include
CFLAGS+= -I${EFISRC}/include/${MACHINE}
# libfdt headers
CFLAGS+= -I${.CURDIR}/../../fdt
CFLAGS+= -I${FDTSRC}
# Pick up the bootstrap header for some interface items
CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../../.. -I.
CFLAGS+= -I${LDRSRC} -I${SYSDIR} -I.
machine: .NOMETA
ln -sf ${.CURDIR}/../../../${MACHINE}/include machine
ln -sf ${SYSDIR}/${MACHINE}/include machine
CLEANFILES+= machine

View File

@ -1,9 +1,9 @@
# $FreeBSD$
.include <src.opts.mk>
.include <bsd.init.mk>
.if ${MK_FORTH} != "no"
.include "../../ficl.mk"
.include "${BOOTSRC}/ficl.mk"
.endif
LIB= efi
@ -35,17 +35,17 @@ CFLAGS+= -mgeneral-regs-only
CFLAGS+= -fPIC -mno-red-zone
.endif
CFLAGS+= -I${SYSDIR}
CFLAGS+= -I${.CURDIR}/../include
CFLAGS+= -I${.CURDIR}/../include/${MACHINE}
CFLAGS+= -I${EFIINC}
CFLAGS+= -I${EFIINCMD}
.if ${MK_ZFS} != "no"
CFLAGS+= -I${.CURDIR}/../../zfs
CFLAGS+= -I${.CURDIR}/../../../cddl/boot/zfs
CFLAGS+= -I${.CURDIR}/../../../crypto/skein
CFLAGS+= -I${BOOTSRC}/zfs
CFLAGS+= -I${SYSDIR}/cddl/boot/zfs
CFLAGS+= -I${SYSDIR}/crypto/skein
CFLAGS+= -DEFI_ZFS_BOOT
.endif
# Pick up the bootstrap header for some interface items
CFLAGS+= -I${.CURDIR}/../../common
CFLAGS+= -I${LDRSRC}
# Handle FreeBSD specific %b and %D printf format specifiers
CFLAGS+= ${FORMAT_EXTENSIONS}

View File

@ -2,7 +2,7 @@
MAN=
.include <src.opts.mk>
.include <bsd.init.mk>
MK_SSP= no
@ -30,11 +30,11 @@ SRCS= autoload.c \
.if ${MK_ZFS} != "no"
SRCS+= zfs.c
.PATH: ${.CURDIR}/../../zfs
.PATH: ${BOOTSRC}/zfs
SRCS+= skein.c skein_block.c
# Do not unroll skein loops, reduce code size
CFLAGS+= -DSKEIN_LOOP=111
.PATH: ${.CURDIR}/../../../crypto/skein
.PATH: ${SYSDIR}/crypto/skein
# Disable warnings that are currently incompatible with the zfs boot code
CWARNFLAGS.zfs.c+= -Wno-sign-compare
@ -55,20 +55,20 @@ CWARNFLAGS.main.c+= -Wno-format
.PATH: ${.CURDIR}/arch/${MACHINE}
# For smbios.c
.PATH: ${.CURDIR}/../../i386/libi386
.PATH: ${BOOTSRC}/i386/libi386
.include "${.CURDIR}/arch/${MACHINE}/Makefile.inc"
CFLAGS+= -I${.CURDIR}
CFLAGS+= -I${.CURDIR}/arch/${MACHINE}
CFLAGS+= -I${.CURDIR}/../include
CFLAGS+= -I${.CURDIR}/../include/${MACHINE}
CFLAGS+= -I${.CURDIR}/../../../contrib/dev/acpica/include
CFLAGS+= -I${.CURDIR}/../../..
CFLAGS+= -I${.CURDIR}/../../i386/libi386
CFLAGS+= -I${EFISRC}/include
CFLAGS+= -I${EFISRC}/include/${MACHINE}
CFLAGS+= -I${SYSDIR}/contrib/dev/acpica/include
CFLAGS+= -I${SYSDIR}
CFLAGS+= -I${BOOTSRC}/i386/libi386
.if ${MK_ZFS} != "no"
CFLAGS+= -I${.CURDIR}/../../zfs
CFLAGS+= -I${.CURDIR}/../../../cddl/boot/zfs
CFLAGS+= -I${.CURDIR}/../../../crypto/skein
CFLAGS+= -I${BOOTSRC}/zfs
CFLAGS+= -I${SYSDIR}/cddl/boot/zfs
CFLAGS+= -I${SYSDIR}/crypto/skein
CFLAGS+= -DEFI_ZFS_BOOT
.endif
CFLAGS+= -DNO_PCI -DEFI
@ -87,11 +87,11 @@ CFLAGS+= -DSMBIOS_NETWORK_ENDIAN_UUID
LOADER_FDT_SUPPORT?= no
.if ${MK_FDT} != "no" && ${LOADER_FDT_SUPPORT} != "no"
CFLAGS+= -I${.CURDIR}/../../fdt
CFLAGS+= -I${.OBJDIR}/../../fdt
CFLAGS+= -I${BOOTSRC}/fdt
CFLAGS+= -I${BOOTSRC}/fdt
CFLAGS+= -DLOADER_FDT_SUPPORT
LIBEFI_FDT= ${.OBJDIR}/../../efi/fdt/libefi_fdt.a
LIBFDT= ${.OBJDIR}/../../fdt/libfdt.a
LIBEFI_FDT= ${BOOTOBJ}/efi/fdt/libefi_fdt.a
LIBFDT= ${BOOTOBJ}/fdt/libfdt.a
.endif
# Include bcache code.
@ -102,7 +102,7 @@ CFLAGS+= -DEFI_STAGING_SIZE=${EFI_STAGING_SIZE}
.endif
# Always add MI sources
.include "../../loader.mk"
.include "${BOOTSRC}/loader.mk"
FILES+= loader.efi
FILESMODE_loader.efi= ${BINMODE}
@ -140,7 +140,7 @@ loader.efi: ${PROG}
-j set_Xficl_compile_set \
--output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET}
LIBEFI= ${.OBJDIR}/../libefi/libefi.a
LIBEFI= ${BOOTOBJ}/efi/libefi/libefi.a
DPADD= ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSA} \
${LDSCRIPT}
@ -153,12 +153,12 @@ beforedepend ${OBJS}: machine
CLEANFILES+= machine
machine: .NOMETA
ln -sf ${.CURDIR}/../../../${MACHINE}/include machine
ln -sf ${SYSDIR}/${MACHINE}/include machine
.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
beforedepend ${OBJS}: x86
CLEANFILES+= x86
x86: .NOMETA
ln -sf ${.CURDIR}/../../../x86/include x86
ln -sf ${SYSDIR}/x86/include x86
.endif

View File

@ -6,7 +6,7 @@ SRCS+= amd64_tramp.S \
trap.c \
exc.S
.PATH: ${.CURDIR}/../../i386/libi386
.PATH: ${BOOTSRC}/i386/libi386
SRCS+= nullconsole.c \
comconsole.c \
spinconsole.c

View File

@ -4,8 +4,8 @@ LOADER_FDT_SUPPORT=yes
SRCS+= exec.c \
start.S
.PATH: ${.CURDIR}/../../arm64/libarm64
CFLAGS+=-I${.CURDIR}/../../arm64/libarm64
.PATH: ${BOOTSRC}/arm64/libarm64
CFLAGS+=-I${BOOTSRC}/arm64/libarm64
SRCS+= cache.c
CFLAGS+= -mgeneral-regs-only
@ -14,11 +14,11 @@ CLEANFILES+= loader.help
loader.help: help.common
cat ${.ALLSRC} | \
awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
awk -f ${LDRSRC}/merge_help.awk > ${.TARGET}
.if !defined(LOADER_ONLY)
.PATH: ${.CURDIR}/../../forth
.include "${.CURDIR}/../../forth/Makefile.inc"
.PATH: ${BOOTSRC}/forth
.include "${BOOTSRC}/forth/Makefile.inc"
FILES+= loader.rc
.endif

View File

@ -5,7 +5,7 @@ SRCS+= start.S \
elf32_freebsd.c \
exec.c
.PATH: ${.CURDIR}/../../i386/libi386
.PATH: ${BOOTSRC}/i386/libi386
SRCS+= nullconsole.c \
comconsole.c \
spinconsole.c