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