Makefile.efiboot revision 1.7
1# $NetBSD: Makefile.efiboot,v 1.7 2019/04/21 22:30:41 thorpej Exp $ 2 3S= ${.CURDIR}/../../.. 4 5NOMAN= # defined 6NOPIE= # defined 7NOLIBCSANITIZER=# defined 8NOSANITIZER= # defined 9NORELRO= # defined 10PROG?= boot.efi 11NEWVERSWHAT?= "EFI Boot" 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 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 90SAMISCCPPFLAGS+= -DLIBSA_PRINTF_LONGLONG_SUPPORT 91SAMISCCPPFLAGS+= -DLIBSA_PRINTF_WIDTH_SUPPORT 92SAMISCCPPFLAGS+= -D"cdb2devb(bno)=(bno)" 93 94### find out what to use for libsa 95SA_AS= library 96SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes" 97SAMISCMAKEFLAGS+="SA_USE_CREAD=yes" 98SAMISCMAKEFLAGS+="SA_INCLUDE_NET=yes" 99SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes" 100.include "${S}/lib/libsa/Makefile.inc" 101LIBSA= ${SALIB} 102 103### find out what to use for libkern 104KERN_AS= library 105LIBKERN_ARCH?= ${MACHINE_ARCH} 106KERNMISCMAKEFLAGS+="LIBKERN_ARCH=${LIBKERN_ARCH}" 107.include "${S}/lib/libkern/Makefile.inc" 108LIBKERN= ${KERNLIB} 109 110### find out what to use for libz 111Z_AS= library 112.include "${S}/lib/libz/Makefile.inc" 113LIBZ= ${ZLIB} 114 115### find out what to use for libgnuefi 116GNUEFI_AS= library 117LIBGNUEFI_ARCH?= ${MACHINE_ARCH} 118GNUEFIMISCMAKEFLAGS+="LIBGNUEFI_ARCH=${LIBGNUEFI_ARCH}" 119GNUEFIMISCCPPFLAGS+= -I${EFIDIR}/lib 120.include "${S}/lib/libgnuefi/Makefile.inc" 121LIBGNUEFI= ${GNUEFILIB} 122 123cleandir distclean: .WAIT cleanlibdir 124 125cleanlibdir: 126 -rm -rf lib 127 128LIBLIST= ${LIBGNUEFI} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBSA} 129 130VERSIONMACHINE=evbarm 131.include "${S}/conf/newvers_stand.mk" 132 133CLEANFILES+= ${PROG}.so ${PROG}.tmp 134 135${PROG}: ${PROG}.so 136 ${OBJCOPY} -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \ 137 -j .rela -j .rel.* -j .rela.* -j .rel* -j .rela* \ 138 -j .reloc -O binary ${PROG}.so ${.TARGET} 139 140.include <bsd.prog.mk> 141 142${PROG}.so: ${OBJS} ${LIBLIST} ${LDSCRIPT} ${.CURDIR}/../Makefile.efiboot 143 ${LD} ${LDFLAGS} -o ${.TARGET}.tmp ${OBJS} ${LIBLIST} 144 @if ${OBJDUMP} -t ${.TARGET}.tmp | grep 'UND'; then \ 145 (echo Undefined symbols; false); \ 146 fi 147 rm -f ${.TARGET} 148 mv ${.TARGET}.tmp ${.TARGET} 149 150KLINK_MACHINE?= ${MACHINE} 151.include <bsd.klinks.mk> 152