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