9 # We implement a slightly non-standard %S in that it always takes a
10 # CHAR16 that's common in UEFI-land instead of a wchar_t. This only
11 # seems to matter on arm64 where wchar_t defaults to an int instead
12 # of a short. There's no good cast to use here so just ignore the
14 CWARNFLAGS.boot1.c+= -Wno-format
16 # Disable warnings that are currently incompatible with the zfs boot code
17 CWARNFLAGS.zfs_module.c += -Wno-array-bounds
18 CWARNFLAGS.zfs_module.c += -Wno-cast-align
19 CWARNFLAGS.zfs_module.c += -Wno-cast-qual
20 CWARNFLAGS.zfs_module.c += -Wno-missing-prototypes
21 CWARNFLAGS.zfs_module.c += -Wno-sign-compare
22 CWARNFLAGS.zfs_module.c += -Wno-unused-parameter
23 CWARNFLAGS.zfs_module.c += -Wno-unused-function
25 # architecture-specific loader code
26 SRCS= boot1.c self_reloc.c start.S ufs_module.c
29 CFLAGS.zfs_module.c+= -I${ZFSSRC}
30 CFLAGS.zfs_module.c+= -I${SYSDIR}/cddl/boot/zfs
31 CFLAGS.zfs_module.c+= -I${SYSDIR}/crypto/skein
32 CFLAGS+= -DEFI_ZFS_BOOT
35 .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201
36 CWARNFLAGS.self_reloc.c+= -Wno-error=maybe-uninitialized
40 CFLAGS+= -I${EFIINCMD}
41 CFLAGS+= -I${SYSDIR}/contrib/dev/acpica/include
42 CFLAGS+= -DEFI_UFS_BOOT
47 # Always add MI sources and REGULAR efi loader bits
48 .PATH: ${EFISRC}/loader/arch/${MACHINE}
49 .PATH: ${EFISRC}/loader
53 FILES= boot1.efi boot1.efifat
54 FILESMODE_boot1.efi= ${BINMODE}
56 LDSCRIPT= ${EFISRC}/loader/arch/${MACHINE}/ldscript.${MACHINE}
57 LDFLAGS+= -Wl,-T${LDSCRIPT},-Bsymbolic,-znotext -shared
59 .if ${MACHINE_CPUARCH} == "aarch64"
60 CFLAGS+= -mgeneral-regs-only
62 .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
64 LDFLAGS+= -Wl,-znocombreloc
67 LIBEFI= ${BOOTOBJ}/efi/libefi/libefi.a
70 # Add libstand for the runtime functions used by the compiler - for example
71 # __aeabi_* (arm) or __divdi3 (i386).
72 # as well as required string and memory functions for all platforms.
74 DPADD+= ${LIBEFI} ${LIBSA}
75 LDADD+= ${LIBEFI} ${LIBSA}
80 if ${NM} ${.ALLSRC} | grep ' U '; then \
81 echo "Undefined symbols in ${.ALLSRC}"; \
84 SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \
85 ${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \
86 -j .dynamic -j .dynsym -j .rel.dyn \
87 -j .rela.dyn -j .reloc -j .eh_frame \
88 --output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET}
90 # The following inserts our objects into a template FAT file system
91 # created by generate-fat.sh
93 .include "Makefile.fat"
95 boot1.efifat: boot1.efi
96 @set -- `ls -l ${.ALLSRC}`; \
97 x=$$(($$5-${BOOT1_MAXSIZE})); \
98 if [ $$x -ge 0 ]; then \
99 echo "boot1 $$x bytes too large; regenerate FAT templates?" >&2 ;\
103 xz -d -c ${BOOTSRC}/efi/boot1/fat-${MACHINE}.tmpl.xz > ${.TARGET}
104 ${DD} if=${.ALLSRC} of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc
106 CLEANFILES+= boot1.efi boot1.efifat
108 .include <bsd.prog.mk>