Makefile.efiboot revision 1.15
11.15Sjmcneill# $NetBSD: Makefile.efiboot,v 1.15 2020/06/21 23:53:26 jmcneill Exp $ 21.1Sjmcneill 31.1SjmcneillS= ${.CURDIR}/../../.. 41.1Sjmcneill 51.1SjmcneillNOMAN= # defined 61.1SjmcneillNOPIE= # defined 71.1SjmcneillNOLIBCSANITIZER=# defined 81.1SjmcneillNOSANITIZER= # defined 91.1SjmcneillNORELRO= # defined 101.1SjmcneillPROG?= boot.efi 111.10SjmcneillNEWVERSWHAT?= "efiboot" 121.1Sjmcneill 131.1SjmcneillEFIDIR= ${S}/external/bsd/gnu-efi/dist 141.1SjmcneillGNUEFIARCH?= ${MACHINE_CPU} 151.1SjmcneillCPPFLAGS+= -I${EFIDIR}/inc -I${EFIDIR}/inc/${GNUEFIARCH} 161.1SjmcneillCPPFLAGS+= -I${EFIDIR}/inc/protocol 171.1Sjmcneill 181.1SjmcneillLDSCRIPT?= ${EFIDIR}/gnuefi/elf_${GNUEFIARCH}_efi.lds 191.1Sjmcneill 201.1SjmcneillAFLAGS.start.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:} 211.1Sjmcneill 221.1Sjmcneill.PATH: ${EFIDIR}/gnuefi 231.1SjmcneillSOURCES= crt0-efi-${GNUEFIARCH}.S reloc_${GNUEFIARCH}.c 241.15SjmcneillSOURCES+= boot.c bootmenu.c conf.c console.c dev_net.c devopen.c exec.c \ 251.15Sjmcneill module.c panic.c prompt.c 261.14SjmcneillSOURCES+= efiboot.c efichar.c efidev.c efienv.c efigetsecs.c efifdt.c \ 271.14Sjmcneill efifile.c efiblock.c efinet.c efipxe.c efiacpi.c efirng.c smbios.c 281.1Sjmcneill 291.1Sjmcneill.PATH: ${S}/external/bsd/libfdt/dist 301.1SjmcneillCPPFLAGS+= -I${S}/external/bsd/libfdt/dist 311.7SthorpejSOURCES+= fdt.c fdt_addresses.c fdt_empty_tree.c fdt_overlay.c 321.1SjmcneillSOURCES+= fdt_ro.c fdt_rw.c fdt_strerror.c fdt_sw.c fdt_wip.c 331.1Sjmcneill 341.1SjmcneillSRCS= ${SOURCES} ${EXTRA_SOURCES} 351.1Sjmcneill 361.1Sjmcneill.include <bsd.init.mk> 371.1Sjmcneill 381.1SjmcneillSTRIPFLAG= # nothing 391.1Sjmcneill 401.1SjmcneillLIBCRT0= # nothing 411.1SjmcneillLIBCRTI= # nothing 421.1SjmcneillLIBCRTBEGIN= # nothing 431.1SjmcneillLIBCRTEND= # nothing 441.1SjmcneillLIBC= # nothing 451.1Sjmcneill 461.1SjmcneillBINDIR=/usr/mdec 471.1SjmcneillBINMODE=444 481.1Sjmcneill 491.1Sjmcneill.PATH: ${.CURDIR} ${.CURDIR}/.. 501.1Sjmcneill.PATH: ${.CURDIR}/../../lib 511.1Sjmcneill 521.12SrinLDFLAGS+= --no-dynamic-linker --noinhibit-exec 531.1SjmcneillLDFLAGS+= -nostdlib -T${LDSCRIPT} -Bsymbolic -shared 541.1SjmcneillCPPFLAGS+= -I$S -I${.CURDIR} -I${.CURDIR}/../common -I$S/lib/libsa 551.1SjmcneillCPPFLAGS+= -I${.OBJDIR} 561.1SjmcneillCPPFLAGS+= -I${.CURDIR}/../../lib 571.7SthorpejCPPFLAGS+= -I${S}/../common/include 581.1Sjmcneill 591.1SjmcneillCOPTS+= -fpic -g -O2 601.1SjmcneillCOPTS+= -fshort-wchar -fno-strict-aliasing 611.1SjmcneillCOPTS+= -ffreestanding -fno-stack-protector 621.1SjmcneillLDFLAGS+= --defsym=EFI_SUBSYSTEM=0xa 631.1Sjmcneill 641.1Sjmcneill 651.1SjmcneillCOPTS+= ${${ACTIVE_CC} == "gcc":? -Wno-error=unused-but-set-variable :} 661.1SjmcneillCPPFLAGS+= -nostdinc -D_STANDALONE 671.1SjmcneillCPPFLAGS+= -DEFIBOOT 681.5SjmcneillCPPFLAGS+= -DPROGRESS_FN=efi_progress 691.1Sjmcneill 701.1SjmcneillCPPFLAGS+= -Wall -Wmissing-prototypes 711.1SjmcneillCPPFLAGS+= -Wno-pointer-sign 721.1Sjmcneill 731.1SjmcneillCPPFLAGS+= -DHEAP_VARIABLE 741.1Sjmcneill#CPPFLAGS+= -DSUPPORT_CD9660 751.1SjmcneillCPPFLAGS+= -D"devb2cdb(bno)=(bno)" 761.3SjmcneillCPPFLAGS+= -DSUPPORT_DOSFS 771.1Sjmcneill#CPPFLAGS+= -DSUPPORT_EXT2FS 781.3SjmcneillCPPFLAGS+= -DSUPPORT_BOOTP 791.3SjmcneillCPPFLAGS+= -DSUPPORT_DHCP 801.1Sjmcneill#CPPFLAGS+= -DSUPPORT_NFS 811.3SjmcneillCPPFLAGS+= -DSUPPORT_TFTP 821.2SjmcneillCPPFLAGS+= -DLIBSA_ENABLE_LS_OP 831.1Sjmcneill 841.7Sthorpej#CPPFLAGS+= -DEFIBOOT_DEBUG 851.1Sjmcneill#CPPFLAGS+= -DARP_DEBUG 861.1Sjmcneill#CPPFLAGS+= -DBOOTP_DEBUG 871.1Sjmcneill#CPPFLAGS+= -DNET_DEBUG 881.1Sjmcneill#CPPFLAGS+= -DNETIF_DEBUG 891.1Sjmcneill#CPPFLAGS+= -DNFS_DEBUG 901.1Sjmcneill#CPPFLAGS+= -DRARP_DEBUG 911.1Sjmcneill#CPPFLAGS+= -DRPC_DEBUG 921.1Sjmcneill 931.11Stnn# Follow the suit of Makefile.kern.inc; needed for the lfs64 union 941.11Stnn# accessors -- they don't actually dereference the resulting pointer, 951.11Stnn# just use it for type-checking. 961.11StnnCWARNFLAGS.clang+= -Wno-error=address-of-packed-member 971.11Stnn 981.1SjmcneillSAMISCCPPFLAGS+= -DLIBSA_PRINTF_LONGLONG_SUPPORT 991.1SjmcneillSAMISCCPPFLAGS+= -DLIBSA_PRINTF_WIDTH_SUPPORT 1001.1SjmcneillSAMISCCPPFLAGS+= -D"cdb2devb(bno)=(bno)" 1011.1Sjmcneill 1021.1Sjmcneill### find out what to use for libsa 1031.1SjmcneillSA_AS= library 1041.1SjmcneillSAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes" 1051.1SjmcneillSAMISCMAKEFLAGS+="SA_USE_CREAD=yes" 1061.3SjmcneillSAMISCMAKEFLAGS+="SA_INCLUDE_NET=yes" 1071.2SjmcneillSAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes" 1081.8SrinSAMISCMAKEFLAGS+="SA_ENABLE_BIENDIAN=yes" 1091.1Sjmcneill.include "${S}/lib/libsa/Makefile.inc" 1101.1SjmcneillLIBSA= ${SALIB} 1111.1Sjmcneill 1121.1Sjmcneill### find out what to use for libkern 1131.1SjmcneillKERN_AS= library 1141.1SjmcneillLIBKERN_ARCH?= ${MACHINE_ARCH} 1151.1SjmcneillKERNMISCMAKEFLAGS+="LIBKERN_ARCH=${LIBKERN_ARCH}" 1161.1Sjmcneill.include "${S}/lib/libkern/Makefile.inc" 1171.1SjmcneillLIBKERN= ${KERNLIB} 1181.1Sjmcneill 1191.1Sjmcneill### find out what to use for libz 1201.1SjmcneillZ_AS= library 1211.1Sjmcneill.include "${S}/lib/libz/Makefile.inc" 1221.1SjmcneillLIBZ= ${ZLIB} 1231.1Sjmcneill 1241.1Sjmcneill### find out what to use for libgnuefi 1251.1SjmcneillGNUEFI_AS= library 1261.1SjmcneillLIBGNUEFI_ARCH?= ${MACHINE_ARCH} 1271.1SjmcneillGNUEFIMISCMAKEFLAGS+="LIBGNUEFI_ARCH=${LIBGNUEFI_ARCH}" 1281.1SjmcneillGNUEFIMISCCPPFLAGS+= -I${EFIDIR}/lib 1291.1Sjmcneill.include "${S}/lib/libgnuefi/Makefile.inc" 1301.1SjmcneillLIBGNUEFI= ${GNUEFILIB} 1311.1Sjmcneill 1321.1Sjmcneillcleandir distclean: .WAIT cleanlibdir 1331.1Sjmcneill 1341.1Sjmcneillcleanlibdir: 1351.1Sjmcneill -rm -rf lib 1361.1Sjmcneill 1371.1SjmcneillLIBLIST= ${LIBGNUEFI} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBSA} 1381.1Sjmcneill 1391.1SjmcneillVERSIONMACHINE=evbarm 1401.1Sjmcneill.include "${S}/conf/newvers_stand.mk" 1411.1Sjmcneill 1421.1SjmcneillCLEANFILES+= ${PROG}.so ${PROG}.tmp 1431.1Sjmcneill 1441.1Sjmcneill${PROG}: ${PROG}.so 1451.1Sjmcneill ${OBJCOPY} -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \ 1461.1Sjmcneill -j .rela -j .rel.* -j .rela.* -j .rel* -j .rela* \ 1471.1Sjmcneill -j .reloc -O binary ${PROG}.so ${.TARGET} 1481.1Sjmcneill 1491.1Sjmcneill.include <bsd.prog.mk> 1501.1Sjmcneill 1511.1Sjmcneill${PROG}.so: ${OBJS} ${LIBLIST} ${LDSCRIPT} ${.CURDIR}/../Makefile.efiboot 1521.1Sjmcneill ${LD} ${LDFLAGS} -o ${.TARGET}.tmp ${OBJS} ${LIBLIST} 1531.1Sjmcneill @if ${OBJDUMP} -t ${.TARGET}.tmp | grep 'UND'; then \ 1541.1Sjmcneill (echo Undefined symbols; false); \ 1551.1Sjmcneill fi 1561.1Sjmcneill rm -f ${.TARGET} 1571.1Sjmcneill mv ${.TARGET}.tmp ${.TARGET} 1581.1Sjmcneill 1591.1SjmcneillKLINK_MACHINE?= ${MACHINE} 1601.1Sjmcneill.include <bsd.klinks.mk> 161