Makefile.efiboot revision 1.16
1# $NetBSD: Makefile.efiboot,v 1.16 2020/06/26 03:23:04 thorpej Exp $ 2 3S= ${.CURDIR}/../../.. 4 5NOMAN= # defined 6NOPIE= # defined 7NOLIBCSANITIZER=# defined 8NOSANITIZER= # defined 9NORELRO= # defined 10PROG?= boot.efi 11NEWVERSWHAT?= "efiboot" 12 13EFIDIR= ${S}/external/bsd/gnu-efi/dist 14GNUEFIARCH?= ${MACHINE_CPU} 15CPPFLAGS+= -I${EFIDIR}/inc -I${EFIDIR}/inc/${GNUEFIARCH} 16CPPFLAGS+= -I${EFIDIR}/inc/protocol 17 18LDSCRIPT?= ${EFIDIR}/gnuefi/elf_${GNUEFIARCH}_efi.lds 19 20AFLAGS.start.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:} 21 22.PATH: ${EFIDIR}/gnuefi 23SOURCES= crt0-efi-${GNUEFIARCH}.S reloc_${GNUEFIARCH}.c 24SOURCES+= boot.c bootmenu.c conf.c console.c dev_net.c devopen.c exec.c \ 25 module.c overlay.c panic.c prompt.c 26SOURCES+= efiboot.c efichar.c efidev.c efienv.c efigetsecs.c efifdt.c \ 27 efifile.c efiblock.c efinet.c efipxe.c efiacpi.c efirng.c smbios.c 28 29.PATH: ${S}/external/bsd/libfdt/dist 30CPPFLAGS+= -I${S}/external/bsd/libfdt/dist 31SOURCES+= fdt.c fdt_addresses.c fdt_empty_tree.c fdt_overlay.c 32SOURCES+= fdt_ro.c fdt_rw.c fdt_strerror.c fdt_sw.c fdt_wip.c 33 34SRCS= ${SOURCES} ${EXTRA_SOURCES} 35 36.include <bsd.init.mk> 37 38STRIPFLAG= # nothing 39 40LIBCRT0= # nothing 41LIBCRTI= # nothing 42LIBCRTBEGIN= # nothing 43LIBCRTEND= # nothing 44LIBC= # nothing 45 46BINDIR=/usr/mdec 47BINMODE=444 48 49.PATH: ${.CURDIR} ${.CURDIR}/.. 50.PATH: ${.CURDIR}/../../lib 51 52LDFLAGS+= --no-dynamic-linker --noinhibit-exec 53LDFLAGS+= -nostdlib -T${LDSCRIPT} -Bsymbolic -shared 54CPPFLAGS+= -I$S -I${.CURDIR} -I${.CURDIR}/../common -I$S/lib/libsa 55CPPFLAGS+= -I${.OBJDIR} 56CPPFLAGS+= -I${.CURDIR}/../../lib 57CPPFLAGS+= -I${S}/../common/include 58 59COPTS+= -fpic -g -O2 60COPTS+= -fshort-wchar -fno-strict-aliasing 61COPTS+= -ffreestanding -fno-stack-protector 62LDFLAGS+= --defsym=EFI_SUBSYSTEM=0xa 63 64 65COPTS+= ${${ACTIVE_CC} == "gcc":? -Wno-error=unused-but-set-variable :} 66CPPFLAGS+= -nostdinc -D_STANDALONE 67CPPFLAGS+= -DEFIBOOT 68CPPFLAGS+= -DPROGRESS_FN=efi_progress 69 70CPPFLAGS+= -Wall -Wmissing-prototypes 71CPPFLAGS+= -Wno-pointer-sign 72 73CPPFLAGS+= -DHEAP_VARIABLE 74#CPPFLAGS+= -DSUPPORT_CD9660 75CPPFLAGS+= -D"devb2cdb(bno)=(bno)" 76CPPFLAGS+= -DSUPPORT_DOSFS 77#CPPFLAGS+= -DSUPPORT_EXT2FS 78CPPFLAGS+= -DSUPPORT_BOOTP 79CPPFLAGS+= -DSUPPORT_DHCP 80#CPPFLAGS+= -DSUPPORT_NFS 81CPPFLAGS+= -DSUPPORT_TFTP 82CPPFLAGS+= -DLIBSA_ENABLE_LS_OP 83 84#CPPFLAGS+= -DEFIBOOT_DEBUG 85#CPPFLAGS+= -DARP_DEBUG 86#CPPFLAGS+= -DBOOTP_DEBUG 87#CPPFLAGS+= -DNET_DEBUG 88#CPPFLAGS+= -DNETIF_DEBUG 89#CPPFLAGS+= -DNFS_DEBUG 90#CPPFLAGS+= -DRARP_DEBUG 91#CPPFLAGS+= -DRPC_DEBUG 92 93# Follow the suit of Makefile.kern.inc; needed for the lfs64 union 94# accessors -- they don't actually dereference the resulting pointer, 95# just use it for type-checking. 96CWARNFLAGS.clang+= -Wno-error=address-of-packed-member 97 98SAMISCCPPFLAGS+= -DLIBSA_PRINTF_LONGLONG_SUPPORT 99SAMISCCPPFLAGS+= -DLIBSA_PRINTF_WIDTH_SUPPORT 100SAMISCCPPFLAGS+= -D"cdb2devb(bno)=(bno)" 101 102### find out what to use for libsa 103SA_AS= library 104SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes" 105SAMISCMAKEFLAGS+="SA_USE_CREAD=yes" 106SAMISCMAKEFLAGS+="SA_INCLUDE_NET=yes" 107SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes" 108SAMISCMAKEFLAGS+="SA_ENABLE_BIENDIAN=yes" 109.include "${S}/lib/libsa/Makefile.inc" 110LIBSA= ${SALIB} 111 112### find out what to use for libkern 113KERN_AS= library 114LIBKERN_ARCH?= ${MACHINE_ARCH} 115KERNMISCMAKEFLAGS+="LIBKERN_ARCH=${LIBKERN_ARCH}" 116.include "${S}/lib/libkern/Makefile.inc" 117LIBKERN= ${KERNLIB} 118 119### find out what to use for libz 120Z_AS= library 121.include "${S}/lib/libz/Makefile.inc" 122LIBZ= ${ZLIB} 123 124### find out what to use for libgnuefi 125GNUEFI_AS= library 126LIBGNUEFI_ARCH?= ${MACHINE_ARCH} 127GNUEFIMISCMAKEFLAGS+="LIBGNUEFI_ARCH=${LIBGNUEFI_ARCH}" 128GNUEFIMISCCPPFLAGS+= -I${EFIDIR}/lib 129.include "${S}/lib/libgnuefi/Makefile.inc" 130LIBGNUEFI= ${GNUEFILIB} 131 132cleandir distclean: .WAIT cleanlibdir 133 134cleanlibdir: 135 -rm -rf lib 136 137LIBLIST= ${LIBGNUEFI} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBSA} 138 139VERSIONMACHINE=evbarm 140.include "${S}/conf/newvers_stand.mk" 141 142CLEANFILES+= ${PROG}.so ${PROG}.tmp 143 144${PROG}: ${PROG}.so 145 ${OBJCOPY} -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \ 146 -j .rela -j .rel.* -j .rela.* -j .rel* -j .rela* \ 147 -j .reloc -O binary ${PROG}.so ${.TARGET} 148 149.include <bsd.prog.mk> 150 151${PROG}.so: ${OBJS} ${LIBLIST} ${LDSCRIPT} ${.CURDIR}/../Makefile.efiboot 152 ${LD} ${LDFLAGS} -o ${.TARGET}.tmp ${OBJS} ${LIBLIST} 153 @if ${OBJDUMP} -t ${.TARGET}.tmp | grep 'UND'; then \ 154 (echo Undefined symbols; false); \ 155 fi 156 rm -f ${.TARGET} 157 mv ${.TARGET}.tmp ${.TARGET} 158 159KLINK_MACHINE?= ${MACHINE} 160.include <bsd.klinks.mk> 161