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