14 # Disable warnings that are currently incompatible with the zfs boot code
15 CWARNFLAGS.zfs_module.c += -Wno-array-bounds
16 CWARNFLAGS.zfs_module.c += -Wno-cast-align
17 CWARNFLAGS.zfs_module.c += -Wno-cast-qual
18 CWARNFLAGS.zfs_module.c += -Wno-missing-prototypes
19 CWARNFLAGS.zfs_module.c += -Wno-sign-compare
20 CWARNFLAGS.zfs_module.c += -Wno-unused-parameter
21 CWARNFLAGS.zfs_module.c += -Wno-unused-function
22 CWARNFLAGS.skein.c += -Wno-cast-align
23 CWARNFLAGS.skein.c += -Wno-missing-variable-declarations
26 # architecture-specific loader code
27 SRCS= boot1.c self_reloc.c start.S ufs_module.c
30 SRCS+= skein.c skein_block.c
31 .PATH: ${.CURDIR}/../../../crypto/skein
35 CFLAGS+= -I${.CURDIR}/../include
36 CFLAGS+= -I${.CURDIR}/../include/${MACHINE}
37 CFLAGS+= -I${.CURDIR}/../../../contrib/dev/acpica/include
38 CFLAGS+= -I${.CURDIR}/../../..
39 CFLAGS+= -DEFI_UFS_BOOT
45 CFLAGS+= -I${.CURDIR}/../../zfs/
46 CFLAGS+= -I${.CURDIR}/../../../cddl/boot/zfs/
47 CFLAGS+= -I${.CURDIR}/../../../crypto/skein
48 CFLAGS+= -DEFI_ZFS_BOOT
51 # Always add MI sources and REGULAR efi loader bits
52 .PATH: ${.CURDIR}/../loader/arch/${MACHINE}
53 .PATH: ${.CURDIR}/../loader
54 .PATH: ${.CURDIR}/../../common
55 CFLAGS+= -I${.CURDIR}/../../common
57 FILES= boot1.efi boot1.efifat
58 FILESMODE_boot1.efi= ${BINMODE}
60 LDSCRIPT= ${.CURDIR}/../loader/arch/${MACHINE}/ldscript.${MACHINE}
61 LDFLAGS+= -Wl,-T${LDSCRIPT} -Wl,-Bsymbolic -shared
63 .if ${MACHINE_CPUARCH} == "aarch64"
64 CFLAGS+= -msoft-float -mgeneral-regs-only
66 .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
68 LDFLAGS+= -Wl,-znocombreloc
72 # Add libstand for the runtime functions used by the compiler - for example
73 # __aeabi_* (arm) or __divdi3 (i386).
74 # as well as required string and memory functions for all platforms.
84 .if ${MACHINE_CPUARCH} == "amd64"
85 EFI_TARGET= efi-app-x86_64
86 .elif ${MACHINE_CPUARCH} == "i386"
87 EFI_TARGET= efi-app-ia32
92 # Arbitrarily set the PE/COFF header timestamps to 1 Jan 2016 00:00:00
93 # for build reproducibility.
94 SOURCE_DATE_EPOCH?=1451606400
96 if ${NM} ${.ALLSRC} | grep ' U '; then \
97 echo "Undefined symbols in ${.ALLSRC}"; \
100 SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \
101 ${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \
102 -j .dynamic -j .dynsym -j .rel.dyn \
103 -j .rela.dyn -j .reloc -j .eh_frame \
104 --output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET}
106 boot1.o: ${.CURDIR}/../../common/ufsread.c
108 # The following inserts our objects into a template FAT file system
109 # created by generate-fat.sh
111 .include "${.CURDIR}/Makefile.fat"
112 BOOT1_MAXSIZE?= 131072
114 boot1.efifat: boot1.efi
115 @set -- `ls -l boot1.efi`; \
116 x=$$(($$5-${BOOT1_MAXSIZE})); \
117 if [ $$x -ge 0 ]; then \
118 echo "boot1 $$x bytes too large; regenerate FAT templates?" >&2 ;\
122 uudecode ${.CURDIR}/fat-${MACHINE}.tmpl.bz2.uu
123 mv fat-${MACHINE}.tmpl.bz2 ${.TARGET}.bz2
124 bzip2 -f -d ${.TARGET}.bz2
125 dd if=boot1.efi of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc \
128 CLEANFILES= boot1.efi boot1.efifat
130 .include <bsd.prog.mk>
132 beforedepend ${OBJS}: machine
137 ln -sf ${.CURDIR}/../../../${MACHINE}/include machine
139 .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
140 beforedepend ${OBJS}: x86
144 ln -sf ${.CURDIR}/../../../x86/include x86