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
24 # architecture-specific loader code
25 SRCS= boot1.c self_reloc.c start.S ufs_module.c
31 CFLAGS+= -I${.CURDIR}/../include
32 CFLAGS+= -I${.CURDIR}/../include/${MACHINE}
33 CFLAGS+= -I${.CURDIR}/../../../contrib/dev/acpica/include
34 CFLAGS+= -I${.CURDIR}/../../..
35 CFLAGS+= -DEFI_UFS_BOOT
41 CFLAGS+= -I${.CURDIR}/../../zfs/
42 CFLAGS+= -I${.CURDIR}/../../../cddl/boot/zfs/
43 CFLAGS+= -DEFI_ZFS_BOOT
46 # Always add MI sources and REGULAR efi loader bits
47 .PATH: ${.CURDIR}/../loader/arch/${MACHINE}
48 .PATH: ${.CURDIR}/../loader
49 .PATH: ${.CURDIR}/../../common
50 CFLAGS+= -I${.CURDIR}/../../common
52 FILES= boot1.efi boot1.efifat
53 FILESMODE_boot1.efi= ${BINMODE}
55 LDSCRIPT= ${.CURDIR}/../loader/arch/${MACHINE}/ldscript.${MACHINE}
56 LDFLAGS+= -Wl,-T${LDSCRIPT} -Wl,-Bsymbolic -shared
58 .if ${MACHINE_CPUARCH} == "aarch64"
59 CFLAGS+= -msoft-float -mgeneral-regs-only
61 .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
63 LDFLAGS+= -Wl,-znocombreloc
67 # Add libstand for the runtime functions used by the compiler - for example
68 # __aeabi_* (arm) or __divdi3 (i386).
69 # as well as required string and memory functions for all platforms.
79 .if ${MACHINE_CPUARCH} == "amd64"
80 EFI_TARGET= efi-app-x86_64
81 .elif ${MACHINE_CPUARCH} == "i386"
82 EFI_TARGET= efi-app-ia32
88 if [ `${OBJDUMP} -t ${.ALLSRC} | fgrep '*UND*' | wc -l` != 0 ]; then \
89 ${OBJDUMP} -t ${.ALLSRC} | fgrep '*UND*'; \
92 ${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \
93 -j .dynamic -j .dynsym -j .rel.dyn \
94 -j .rela.dyn -j .reloc -j .eh_frame \
95 --output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET}
97 boot1.o: ${.CURDIR}/../../common/ufsread.c
99 # The following inserts our objects into a template FAT file system
100 # created by generate-fat.sh
102 .include "${.CURDIR}/Makefile.fat"
103 BOOT1_MAXSIZE?= 131072
105 boot1.efifat: boot1.efi
106 @set -- `ls -l boot1.efi`; \
107 x=$$(($$5-${BOOT1_MAXSIZE})); \
108 if [ $$x -ge 0 ]; then \
109 echo "boot1 $$x bytes too large; regenerate FAT templates?" >&2 ;\
113 uudecode ${.CURDIR}/fat-${MACHINE}.tmpl.bz2.uu
114 mv fat-${MACHINE}.tmpl.bz2 ${.TARGET}.bz2
115 bzip2 -f -d ${.TARGET}.bz2
116 dd if=boot1.efi of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc \
119 CLEANFILES= boot1.efi boot1.efifat
121 .include <bsd.prog.mk>
123 beforedepend ${OBJS}: machine
128 ln -sf ${.CURDIR}/../../../${MACHINE}/include machine
130 .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
131 beforedepend ${OBJS}: x86
135 ln -sf ${.CURDIR}/../../../x86/include x86