1# $FreeBSD$ 2 3LOADER_NET_SUPPORT?= yes 4LOADER_MSDOS_SUPPORT?= yes 5LOADER_UFS_SUPPORT?= yes 6LOADER_CD9660_SUPPORT?= no 7LOADER_EXT2FS_SUPPORT?= no 8 9.include <bsd.init.mk> 10 11LOADER?= loader_${LOADER_INTERP} 12PROG= ${LOADER}.sym 13INTERNALPROG= 14WARNS?= 3 15 16# architecture-specific loader code 17SRCS= autoload.c \ 18 bootinfo.c \ 19 conf.c \ 20 copy.c \ 21 efi_main.c \ 22 framebuffer.c \ 23 main.c \ 24 self_reloc.c \ 25 vers.c \ 26 gfx_fb.c \ 27 8x16.c 28 29CFLAGS+= -I${.CURDIR}/../loader 30.if ${MK_LOADER_ZFS} != "no" 31CFLAGS+= -I${ZFSSRC} 32CFLAGS+= -I${SYSDIR}/contrib/openzfs/include 33CFLAGS+= -I${SYSDIR}/contrib/openzfs/include/os/freebsd/zfs 34CFLAGS+= -DEFI_ZFS_BOOT 35HAVE_ZFS= yes 36.endif 37 38CFLAGS.gfx_fb.c += -I$(SRCTOP)/sys/teken 39CFLAGS.gfx_fb.c += -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/lz4 40CFLAGS.gfx_fb.c += -I${SRCTOP}/contrib/pnglite 41CFLAGS.gfx_fb.c += -DHAVE_MEMCPY -I${SRCTOP}/sys/contrib/zlib 42 43# We implement a slightly non-standard %S in that it always takes a 44# CHAR16 that's common in UEFI-land instead of a wchar_t. This only 45# seems to matter on arm64 where wchar_t defaults to an int instead 46# of a short. There's no good cast to use here so just ignore the 47# warnings for now. 48CWARNFLAGS.main.c+= -Wno-format 49 50.PATH: ${.CURDIR}/../loader 51.PATH: ${.CURDIR}/../loader/arch/${MACHINE} 52.include "${.CURDIR}/../loader/arch/${MACHINE}/Makefile.inc" 53 54CFLAGS+= -I${.CURDIR} 55CFLAGS+= -I${.CURDIR}/arch/${MACHINE} 56CFLAGS+= -I${EFISRC}/include 57CFLAGS+= -I${EFISRC}/include/${MACHINE} 58CFLAGS+= -I${SYSDIR}/contrib/dev/acpica/include 59CFLAGS+= -I${BOOTSRC}/i386/libi386 60CFLAGS+= -DEFI 61 62.if defined(HAVE_FDT) && ${MK_FDT} != "no" 63.include "${BOOTSRC}/fdt.mk" 64LIBEFI_FDT= ${BOOTOBJ}/efi/fdt/libefi_fdt.a 65.endif 66 67# Include bcache code. 68HAVE_BCACHE= yes 69 70.if defined(EFI_STAGING_SIZE) 71CFLAGS+= -DEFI_STAGING_SIZE=${EFI_STAGING_SIZE} 72.endif 73 74.if ${MK_LOADER_EFI_SECUREBOOT} != "no" 75CFLAGS+= -DEFI_SECUREBOOT 76.endif 77 78NEWVERSWHAT= "EFI loader" ${MACHINE} 79VERSION_FILE= ${.CURDIR}/../loader/version 80 81# Always add MI sources 82.include "${BOOTSRC}/loader.mk" 83 84CLEANFILES+= 8x16.c 85 868x16.c: ${SRCTOP}/contrib/terminus/ter-u16v.bdf 87 vtfontcvt -f compressed-source -o ${.TARGET} ${.ALLSRC} 88 89FILES+= ${LOADER}.efi 90FILESMODE_${LOADER}.efi= ${BINMODE} 91 92.if ${LOADER_INTERP} == ${LOADER_DEFAULT_INTERP} 93LINKS+= ${BINDIR}/${LOADER}.efi ${BINDIR}/loader.efi 94.endif 95 96LDSCRIPT= ${.CURDIR}/../loader/arch/${MACHINE}/ldscript.${MACHINE} 97LDFLAGS+= -Wl,-T${LDSCRIPT},-Bsymbolic,-znotext -pie 98 99CLEANFILES+= loader.efi 100 101${LOADER}.efi: ${PROG} 102 if ${NM} ${.ALLSRC} | grep ' U '; then \ 103 echo "Undefined symbols in ${.ALLSRC}"; \ 104 exit 1; \ 105 fi 106 SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \ 107 ${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \ 108 -j .dynamic -j .dynsym -j .rel.dyn \ 109 -j .rela.dyn -j .reloc -j .eh_frame -j set_Xcommand_set \ 110 -j set_Xficl_compile_set \ 111 --output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET} 112 113LIBEFI= ${BOOTOBJ}/efi/libefi/libefi.a 114 115DPADD= ${LDR_INTERP} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSA} ${LDSCRIPT} 116LDADD= ${LDR_INTERP} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSA} 117 118.include <bsd.prog.mk> 119