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