1# $FreeBSD$ 2 3MAN= 4 5LOADER_NET_SUPPORT?= yes 6LOADER_MSDOS_SUPPORT?= yes 7LOADER_UFS_SUPPORT?= yes 8LOADER_CD9660_SUPPORT?= no 9LOADER_EXT2FS_SUPPORT?= no 10 11.include <bsd.init.mk> 12 13MK_SSP= no 14 15PROG= loader.sym 16INTERNALPROG= 17WARNS?= 3 18 19# architecture-specific loader code 20SRCS= autoload.c \ 21 bootinfo.c \ 22 conf.c \ 23 copy.c \ 24 efi_main.c \ 25 framebuffer.c \ 26 main.c \ 27 self_reloc.c \ 28 smbios.c \ 29 vers.c 30 31.if ${MK_ZFS} != "no" 32LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a 33CFLAGS+= -I${ZFSSRC} 34CFLAGS+= -DEFI_ZFS_BOOT 35.endif 36 37.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201 38CWARNFLAGS.self_reloc.c+= -Wno-error=maybe-uninitialized 39.endif 40 41# We implement a slightly non-standard %S in that it always takes a 42# CHAR16 that's common in UEFI-land instead of a wchar_t. This only 43# seems to matter on arm64 where wchar_t defaults to an int instead 44# of a short. There's no good cast to use here so just ignore the 45# warnings for now. 46CWARNFLAGS.main.c+= -Wno-format 47 48.PATH: ${.CURDIR}/arch/${MACHINE} 49# For smbios.c 50.PATH: ${BOOTSRC}/i386/libi386 51.include "${.CURDIR}/arch/${MACHINE}/Makefile.inc" 52 53CFLAGS+= -I${.CURDIR} 54CFLAGS+= -I${.CURDIR}/arch/${MACHINE} 55CFLAGS+= -I${EFISRC}/include 56CFLAGS+= -I${EFISRC}/include/${MACHINE} 57CFLAGS+= -I${SYSDIR}/contrib/dev/acpica/include 58CFLAGS+= -I${BOOTSRC}/i386/libi386 59CFLAGS+= -DNO_PCI -DEFI 60 61.if !defined(BOOT_HIDE_SERIAL_NUMBERS) 62# Export serial numbers, UUID, and asset tag from loader. 63CFLAGS+= -DSMBIOS_SERIAL_NUMBERS 64.if defined(BOOT_LITTLE_ENDIAN_UUID) 65# Use little-endian UUID format as defined in SMBIOS 2.6. 66CFLAGS+= -DSMBIOS_LITTLE_ENDIAN_UUID 67.elif defined(BOOT_NETWORK_ENDIAN_UUID) 68# Use network-endian UUID format for backward compatibility. 69CFLAGS+= -DSMBIOS_NETWORK_ENDIAN_UUID 70.endif 71.endif 72 73.if defined(HAVE_FDT) && ${MK_FDT} != "no" 74.include "${BOOTSRC}/fdt.mk" 75LIBEFI_FDT= ${BOOTOBJ}/efi/fdt/libefi_fdt.a 76.endif 77 78# Include bcache code. 79HAVE_BCACHE= yes 80 81.if defined(EFI_STAGING_SIZE) 82CFLAGS+= -DEFI_STAGING_SIZE=${EFI_STAGING_SIZE} 83.endif 84 85# Always add MI sources 86HELP_FILES= 87.include "${BOOTSRC}/loader.mk" 88 89FILES+= loader.efi 90FILESMODE_loader.efi= ${BINMODE} 91 92LDSCRIPT= ${.CURDIR}/arch/${MACHINE}/ldscript.${MACHINE} 93LDFLAGS+= -Wl,-T${LDSCRIPT},-Bsymbolic,-znotext -shared 94 95CLEANFILES+= loader.efi 96 97NEWVERSWHAT= "EFI loader" ${MACHINE} 98 99NM?= nm 100OBJCOPY?= objcopy 101 102.if ${MACHINE_CPUARCH} == "amd64" 103EFI_TARGET= efi-app-x86_64 104.elif ${MACHINE_CPUARCH} == "i386" 105EFI_TARGET= efi-app-ia32 106.else 107EFI_TARGET= binary 108.endif 109 110# Arbitrarily set the PE/COFF header timestamps to 1 Jan 2016 00:00:00 111# for build reproducibility. 112SOURCE_DATE_EPOCH?=1451606400 113loader.efi: ${PROG} 114 if ${NM} ${.ALLSRC} | grep ' U '; then \ 115 echo "Undefined symbols in ${.ALLSRC}"; \ 116 exit 1; \ 117 fi 118 SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \ 119 ${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \ 120 -j .dynamic -j .dynsym -j .rel.dyn \ 121 -j .rela.dyn -j .reloc -j .eh_frame -j set_Xcommand_set \ 122 -j set_Xficl_compile_set \ 123 --output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET} 124 125LIBEFI= ${BOOTOBJ}/efi/libefi/libefi.a 126 127DPADD= ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBZFSBOOT} ${LIBSA} \ 128 ${LDSCRIPT} 129LDADD= ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBZFSBOOT} ${LIBSA} 130 131.include <bsd.prog.mk> 132