Makefile.efiboot revision 1.19
11.19Sjmcneill# $NetBSD: Makefile.efiboot,v 1.19 2020/10/11 14:03:33 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.16Sthorpej module.c overlay.c panic.c prompt.c 261.17SjmcneillSOURCES+= efiboot.c efichar.c efidev.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.19SjmcneillCPPFLAGS+= -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.18SmrgCWARNFLAGS.gcc+= ${GCC_NO_ADDR_OF_PACKED_MEMBER} 981.11Stnn 991.1SjmcneillSAMISCCPPFLAGS+= -DLIBSA_PRINTF_LONGLONG_SUPPORT 1001.1SjmcneillSAMISCCPPFLAGS+= -DLIBSA_PRINTF_WIDTH_SUPPORT 1011.1SjmcneillSAMISCCPPFLAGS+= -D"cdb2devb(bno)=(bno)" 1021.1Sjmcneill 1031.1Sjmcneill### find out what to use for libsa 1041.1SjmcneillSA_AS= library 1051.1SjmcneillSAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes" 1061.1SjmcneillSAMISCMAKEFLAGS+="SA_USE_CREAD=yes" 1071.3SjmcneillSAMISCMAKEFLAGS+="SA_INCLUDE_NET=yes" 1081.2SjmcneillSAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes" 1091.8SrinSAMISCMAKEFLAGS+="SA_ENABLE_BIENDIAN=yes" 1101.1Sjmcneill.include "${S}/lib/libsa/Makefile.inc" 1111.1SjmcneillLIBSA= ${SALIB} 1121.1Sjmcneill 1131.1Sjmcneill### find out what to use for libkern 1141.1SjmcneillKERN_AS= library 1151.1SjmcneillLIBKERN_ARCH?= ${MACHINE_ARCH} 1161.1SjmcneillKERNMISCMAKEFLAGS+="LIBKERN_ARCH=${LIBKERN_ARCH}" 1171.1Sjmcneill.include "${S}/lib/libkern/Makefile.inc" 1181.1SjmcneillLIBKERN= ${KERNLIB} 1191.1Sjmcneill 1201.1Sjmcneill### find out what to use for libz 1211.1SjmcneillZ_AS= library 1221.1Sjmcneill.include "${S}/lib/libz/Makefile.inc" 1231.1SjmcneillLIBZ= ${ZLIB} 1241.1Sjmcneill 1251.1Sjmcneill### find out what to use for libgnuefi 1261.1SjmcneillGNUEFI_AS= library 1271.1SjmcneillLIBGNUEFI_ARCH?= ${MACHINE_ARCH} 1281.1SjmcneillGNUEFIMISCMAKEFLAGS+="LIBGNUEFI_ARCH=${LIBGNUEFI_ARCH}" 1291.1SjmcneillGNUEFIMISCCPPFLAGS+= -I${EFIDIR}/lib 1301.1Sjmcneill.include "${S}/lib/libgnuefi/Makefile.inc" 1311.1SjmcneillLIBGNUEFI= ${GNUEFILIB} 1321.1Sjmcneill 1331.1Sjmcneillcleandir distclean: .WAIT cleanlibdir 1341.1Sjmcneill 1351.1Sjmcneillcleanlibdir: 1361.1Sjmcneill -rm -rf lib 1371.1Sjmcneill 1381.1SjmcneillLIBLIST= ${LIBGNUEFI} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBSA} 1391.1Sjmcneill 1401.1SjmcneillVERSIONMACHINE=evbarm 1411.1Sjmcneill.include "${S}/conf/newvers_stand.mk" 1421.1Sjmcneill 1431.1SjmcneillCLEANFILES+= ${PROG}.so ${PROG}.tmp 1441.1Sjmcneill 1451.1Sjmcneill${PROG}: ${PROG}.so 1461.1Sjmcneill ${OBJCOPY} -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \ 1471.1Sjmcneill -j .rela -j .rel.* -j .rela.* -j .rel* -j .rela* \ 1481.1Sjmcneill -j .reloc -O binary ${PROG}.so ${.TARGET} 1491.1Sjmcneill 1501.1Sjmcneill.include <bsd.prog.mk> 1511.1Sjmcneill 1521.1Sjmcneill${PROG}.so: ${OBJS} ${LIBLIST} ${LDSCRIPT} ${.CURDIR}/../Makefile.efiboot 1531.1Sjmcneill ${LD} ${LDFLAGS} -o ${.TARGET}.tmp ${OBJS} ${LIBLIST} 1541.1Sjmcneill @if ${OBJDUMP} -t ${.TARGET}.tmp | grep 'UND'; then \ 1551.1Sjmcneill (echo Undefined symbols; false); \ 1561.1Sjmcneill fi 1571.1Sjmcneill rm -f ${.TARGET} 1581.1Sjmcneill mv ${.TARGET}.tmp ${.TARGET} 1591.1Sjmcneill 1601.1SjmcneillKLINK_MACHINE?= ${MACHINE} 1611.1Sjmcneill.include <bsd.klinks.mk> 162