2014-04-13 01:14:25 +00:00
|
|
|
# $FreeBSD$
|
|
|
|
|
2017-10-29 05:26:59 +00:00
|
|
|
.include <bsd.init.mk>
|
2014-04-13 01:14:25 +00:00
|
|
|
|
2019-05-03 21:13:04 +00:00
|
|
|
BOOT1?= boot1
|
|
|
|
PROG= ${BOOT1}.sym
|
2014-04-13 01:14:25 +00:00
|
|
|
INTERNALPROG=
|
2019-06-08 18:59:50 +00:00
|
|
|
WARNS= 6
|
2014-04-13 01:14:25 +00:00
|
|
|
|
2018-08-27 11:14:49 +00:00
|
|
|
CFLAGS+= -DEFI_BOOT1
|
2017-09-07 07:30:24 +00:00
|
|
|
# We implement a slightly non-standard %S in that it always takes a
|
|
|
|
# CHAR16 that's common in UEFI-land instead of a wchar_t. This only
|
|
|
|
# seems to matter on arm64 where wchar_t defaults to an int instead
|
|
|
|
# of a short. There's no good cast to use here so just ignore the
|
|
|
|
# warnings for now.
|
2019-06-08 19:58:58 +00:00
|
|
|
CWARNFLAGS.proto.c+= -Wno-format
|
2017-09-07 07:30:24 +00:00
|
|
|
CWARNFLAGS.boot1.c+= -Wno-format
|
|
|
|
|
2019-06-05 00:08:30 +00:00
|
|
|
# Disable bogus alignment issues
|
2019-06-08 19:58:58 +00:00
|
|
|
CWARNFLAGS.ufs_module.c += -Wno-format
|
2019-06-05 00:08:30 +00:00
|
|
|
CWARNFLAGS.ufs_module.c += -Wno-cast-align
|
|
|
|
|
2016-01-15 02:33:47 +00:00
|
|
|
# Disable warnings that are currently incompatible with the zfs boot code
|
2017-10-17 23:38:27 +00:00
|
|
|
CWARNFLAGS.zfs_module.c += -Wno-array-bounds
|
|
|
|
CWARNFLAGS.zfs_module.c += -Wno-cast-align
|
|
|
|
CWARNFLAGS.zfs_module.c += -Wno-cast-qual
|
|
|
|
CWARNFLAGS.zfs_module.c += -Wno-missing-prototypes
|
|
|
|
CWARNFLAGS.zfs_module.c += -Wno-sign-compare
|
|
|
|
CWARNFLAGS.zfs_module.c += -Wno-unused-parameter
|
|
|
|
CWARNFLAGS.zfs_module.c += -Wno-unused-function
|
2016-01-15 02:33:47 +00:00
|
|
|
|
2014-04-13 01:14:25 +00:00
|
|
|
# architecture-specific loader code
|
2019-06-08 18:59:50 +00:00
|
|
|
SRCS+= boot1.c proto.c self_reloc.c start.S ufs_module.c devpath.c
|
2019-01-05 22:45:20 +00:00
|
|
|
.if ${MK_LOADER_ZFS} != "no"
|
2017-10-17 23:38:27 +00:00
|
|
|
SRCS+= zfs_module.c
|
2017-12-05 21:37:59 +00:00
|
|
|
CFLAGS.zfs_module.c+= -I${ZFSSRC}
|
|
|
|
CFLAGS.zfs_module.c+= -I${SYSDIR}/cddl/boot/zfs
|
|
|
|
CFLAGS.zfs_module.c+= -I${SYSDIR}/crypto/skein
|
2019-08-08 18:08:13 +00:00
|
|
|
CFLAGS.zfs_module.c+= -I${SYSDIR}/cddl/contrib/opensolaris/uts/common
|
2019-11-02 12:28:04 +00:00
|
|
|
CFLAGS.zfs_module.c+= -I${SYSDIR}/cddl/contrib/opensolaris/common/lz4
|
2019-08-08 18:08:13 +00:00
|
|
|
|
2017-12-08 19:57:26 +00:00
|
|
|
CFLAGS+= -DEFI_ZFS_BOOT
|
2016-01-15 02:33:47 +00:00
|
|
|
.endif
|
2014-04-13 01:14:25 +00:00
|
|
|
|
2017-10-29 05:26:59 +00:00
|
|
|
CFLAGS+= -I${EFIINC}
|
|
|
|
CFLAGS+= -I${EFIINCMD}
|
|
|
|
CFLAGS+= -I${SYSDIR}/contrib/dev/acpica/include
|
2016-01-15 01:22:36 +00:00
|
|
|
CFLAGS+= -DEFI_UFS_BOOT
|
2016-01-18 12:02:05 +00:00
|
|
|
.ifdef(EFI_DEBUG)
|
|
|
|
CFLAGS+= -DEFI_DEBUG
|
|
|
|
.endif
|
2014-04-13 01:14:25 +00:00
|
|
|
|
2014-04-13 06:24:01 +00:00
|
|
|
# Always add MI sources and REGULAR efi loader bits
|
2017-10-29 05:26:59 +00:00
|
|
|
.PATH: ${EFISRC}/loader/arch/${MACHINE}
|
|
|
|
.PATH: ${EFISRC}/loader
|
|
|
|
.PATH: ${LDRSRC}
|
2019-05-06 18:38:46 +00:00
|
|
|
.PATH: ${EFISRC}/libefi
|
2017-10-29 05:26:59 +00:00
|
|
|
CFLAGS+= -I${LDRSRC}
|
2014-04-13 01:14:25 +00:00
|
|
|
|
2019-06-06 22:56:55 +00:00
|
|
|
FILES= ${BOOT1}.efi
|
2019-05-03 21:13:04 +00:00
|
|
|
FILESMODE_${BOOT1}.efi= ${BINMODE}
|
2014-04-13 01:14:25 +00:00
|
|
|
|
2017-10-29 05:26:59 +00:00
|
|
|
LDSCRIPT= ${EFISRC}/loader/arch/${MACHINE}/ldscript.${MACHINE}
|
2017-07-01 18:48:15 +00:00
|
|
|
LDFLAGS+= -Wl,-T${LDSCRIPT},-Bsymbolic,-znotext -shared
|
2015-04-03 15:25:59 +00:00
|
|
|
|
2015-05-05 11:00:50 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "aarch64"
|
2017-04-07 22:58:25 +00:00
|
|
|
CFLAGS+= -mgeneral-regs-only
|
2015-05-05 11:00:50 +00:00
|
|
|
.endif
|
2015-04-03 15:25:59 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
|
2015-04-09 10:08:10 +00:00
|
|
|
CFLAGS+= -fPIC
|
2015-04-03 15:25:59 +00:00
|
|
|
LDFLAGS+= -Wl,-znocombreloc
|
|
|
|
.endif
|
2014-04-13 01:14:25 +00:00
|
|
|
|
2017-10-29 05:26:59 +00:00
|
|
|
LIBEFI= ${BOOTOBJ}/efi/libefi/libefi.a
|
2017-08-26 18:30:14 +00:00
|
|
|
|
2015-04-06 15:50:20 +00:00
|
|
|
#
|
2015-04-07 21:41:26 +00:00
|
|
|
# Add libstand for the runtime functions used by the compiler - for example
|
|
|
|
# __aeabi_* (arm) or __divdi3 (i386).
|
2016-01-09 03:20:01 +00:00
|
|
|
# as well as required string and memory functions for all platforms.
|
2015-04-06 15:50:20 +00:00
|
|
|
#
|
2018-07-08 07:42:49 +00:00
|
|
|
DPADD+= ${LIBEFI} ${LIBSA}
|
|
|
|
LDADD+= ${LIBEFI} ${LIBSA}
|
2015-04-06 15:50:20 +00:00
|
|
|
|
2015-09-17 18:32:51 +00:00
|
|
|
DPADD+= ${LDSCRIPT}
|
2014-04-13 01:14:25 +00:00
|
|
|
|
2019-05-03 21:13:04 +00:00
|
|
|
${BOOT1}.efi: ${PROG}
|
2016-03-12 21:44:33 +00:00
|
|
|
if ${NM} ${.ALLSRC} | grep ' U '; then \
|
|
|
|
echo "Undefined symbols in ${.ALLSRC}"; \
|
2014-04-13 01:14:25 +00:00
|
|
|
exit 1; \
|
|
|
|
fi
|
2016-08-31 21:35:38 +00:00
|
|
|
SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \
|
2015-04-06 15:50:20 +00:00
|
|
|
${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \
|
2014-04-13 01:14:25 +00:00
|
|
|
-j .dynamic -j .dynsym -j .rel.dyn \
|
2017-10-17 23:38:27 +00:00
|
|
|
-j .rela.dyn -j .reloc -j .eh_frame \
|
2014-12-23 15:58:45 +00:00
|
|
|
--output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET}
|
2014-04-13 01:14:25 +00:00
|
|
|
|
|
|
|
.include <bsd.prog.mk>
|