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