Makefile.efiboot revision 1.9
1# $NetBSD: Makefile.efiboot,v 1.9 2019/11/30 13:02:18 jmcneill 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 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 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" 100SAMISCMAKEFLAGS+="SA_ENABLE_BIENDIAN=yes" 101.include "${S}/lib/libsa/Makefile.inc" 102LIBSA= ${SALIB} 103 104### find out what to use for libkern 105KERN_AS= library 106LIBKERN_ARCH?= ${MACHINE_ARCH} 107KERNMISCMAKEFLAGS+="LIBKERN_ARCH=${LIBKERN_ARCH}" 108.include "${S}/lib/libkern/Makefile.inc" 109LIBKERN= ${KERNLIB} 110 111### find out what to use for libz 112Z_AS= library 113.include "${S}/lib/libz/Makefile.inc" 114LIBZ= ${ZLIB} 115 116### find out what to use for libgnuefi 117GNUEFI_AS= library 118LIBGNUEFI_ARCH?= ${MACHINE_ARCH} 119GNUEFIMISCMAKEFLAGS+="LIBGNUEFI_ARCH=${LIBGNUEFI_ARCH}" 120GNUEFIMISCCPPFLAGS+= -I${EFIDIR}/lib 121.include "${S}/lib/libgnuefi/Makefile.inc" 122LIBGNUEFI= ${GNUEFILIB} 123 124cleandir distclean: .WAIT cleanlibdir 125 126cleanlibdir: 127 -rm -rf lib 128 129LIBLIST= ${LIBGNUEFI} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBSA} 130 131VERSIONMACHINE=evbarm 132.include "${S}/conf/newvers_stand.mk" 133 134CLEANFILES+= ${PROG}.so ${PROG}.tmp 135 136${PROG}: ${PROG}.so 137 ${OBJCOPY} -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \ 138 -j .rela -j .rel.* -j .rela.* -j .rel* -j .rela* \ 139 -j .reloc -O binary ${PROG}.so ${.TARGET} 140 141.include <bsd.prog.mk> 142 143${PROG}.so: ${OBJS} ${LIBLIST} ${LDSCRIPT} ${.CURDIR}/../Makefile.efiboot 144 ${LD} ${LDFLAGS} -o ${.TARGET}.tmp ${OBJS} ${LIBLIST} 145 @if ${OBJDUMP} -t ${.TARGET}.tmp | grep 'UND'; then \ 146 (echo Undefined symbols; false); \ 147 fi 148 rm -f ${.TARGET} 149 mv ${.TARGET}.tmp ${.TARGET} 150 151KLINK_MACHINE?= ${MACHINE} 152.include <bsd.klinks.mk> 153