Makefile.efiboot revision 1.21
1# $NetBSD: Makefile.efiboot,v 1.21 2021/05/27 06:54:45 mrg 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 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 74CPPFLAGS+= -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 83CPPFLAGS+= -DLIBSA_FFS_EI 84CPPFLAGS+= -DLIBSA_DISKLABEL_EI 85 86#CPPFLAGS+= -DEFIBOOT_DEBUG 87#CPPFLAGS+= -DARP_DEBUG 88#CPPFLAGS+= -DBOOTP_DEBUG 89#CPPFLAGS+= -DNET_DEBUG 90#CPPFLAGS+= -DNETIF_DEBUG 91#CPPFLAGS+= -DNFS_DEBUG 92#CPPFLAGS+= -DRARP_DEBUG 93#CPPFLAGS+= -DRPC_DEBUG 94 95# Follow the suit of Makefile.kern.inc; needed for the lfs64 union 96# accessors -- they don't actually dereference the resulting pointer, 97# just use it for type-checking. 98CWARNFLAGS.clang+= -Wno-error=address-of-packed-member 99CWARNFLAGS.gcc+= ${GCC_NO_ADDR_OF_PACKED_MEMBER} 100 101SAMISCCPPFLAGS+= -DLIBSA_PRINTF_LONGLONG_SUPPORT 102SAMISCCPPFLAGS+= -DLIBSA_PRINTF_WIDTH_SUPPORT 103SAMISCCPPFLAGS+= -D"cdb2devb(bno)=(bno)" 104 105### find out what to use for libsa 106SA_AS= library 107SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes" 108SAMISCMAKEFLAGS+="SA_USE_CREAD=yes" 109SAMISCMAKEFLAGS+="SA_INCLUDE_NET=yes" 110SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes" 111SAMISCMAKEFLAGS+="SA_ENABLE_BIENDIAN=yes" 112.include "${S}/lib/libsa/Makefile.inc" 113LIBSA= ${SALIB} 114 115### find out what to use for libkern 116KERN_AS= library 117LIBKERN_ARCH?= ${MACHINE_ARCH} 118KERNMISCMAKEFLAGS+="LIBKERN_ARCH=${LIBKERN_ARCH}" 119.include "${S}/lib/libkern/Makefile.inc" 120LIBKERN= ${KERNLIB} 121 122### find out what to use for libz 123Z_AS= library 124.include "${S}/lib/libz/Makefile.inc" 125LIBZ= ${ZLIB} 126 127### find out what to use for libgnuefi 128GNUEFI_AS= library 129LIBGNUEFI_ARCH?= ${MACHINE_ARCH} 130GNUEFIMISCMAKEFLAGS+="LIBGNUEFI_ARCH=${LIBGNUEFI_ARCH}" 131GNUEFIMISCCPPFLAGS+= -I${EFIDIR}/lib 132.include "${S}/lib/libgnuefi/Makefile.inc" 133LIBGNUEFI= ${GNUEFILIB} 134 135cleandir distclean: .WAIT cleanlibdir 136 137cleanlibdir: 138 -rm -rf lib 139 140LIBLIST= ${LIBGNUEFI} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBSA} 141 142VERSIONMACHINE=${MACHINE} 143.include "${S}/conf/newvers_stand.mk" 144 145CLEANFILES+= ${PROG}.so ${PROG}.tmp 146 147${PROG}: ${PROG}.so 148 ${OBJCOPY} -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \ 149 -j .rela -j .rel.* -j .rela.* -j .rel* -j .rela* \ 150 -j .reloc -O binary ${PROG}.so ${.TARGET} 151 152.include <bsd.prog.mk> 153 154${PROG}.so: ${OBJS} ${LIBLIST} ${LDSCRIPT} ${.CURDIR}/../Makefile.efiboot 155 ${LD} ${LDFLAGS} -o ${.TARGET}.tmp ${OBJS} ${LIBLIST} 156 @if ${OBJDUMP} -t ${.TARGET}.tmp | grep 'UND'; then \ 157 (echo Undefined symbols; false); \ 158 fi 159 rm -f ${.TARGET} 160 mv ${.TARGET}.tmp ${.TARGET} 161 162KLINK_MACHINE?= ${MACHINE} 163.include <bsd.klinks.mk> 164