1 1.3.4.3 martin # $NetBSD: Makefile.bootprogs,v 1.3.4.3 2017/08/31 08:18:08 martin Exp $ 2 1.3.4.3 martin 3 1.3.4.3 martin NOSSP=yes 4 1.3.4.3 martin NOPIE=yes 5 1.3.4.2 martin 6 1.3.4.2 martin .include <bsd.own.mk> 7 1.3.4.2 martin .include <bsd.klinks.mk> 8 1.3.4.2 martin 9 1.3.4.3 martin S= ${.CURDIR}/../../../../.. 10 1.3.4.3 martin COMMON= ${.CURDIR}/../common 11 1.3.4.2 martin 12 1.3.4.3 martin .PATH: ${COMMON} 13 1.3.4.2 martin 14 1.3.4.2 martin STRIPFLAG= 15 1.3.4.2 martin BINMODE= 444 16 1.3.4.2 martin 17 1.3.4.2 martin # XXX SHOULD NOT NEED TO DEFINE THESE! 18 1.3.4.2 martin LIBCRT0= 19 1.3.4.2 martin LIBCRTI= 20 1.3.4.2 martin LIBC= 21 1.3.4.2 martin LIBCRTBEGIN= 22 1.3.4.2 martin LIBCRTEND= 23 1.3.4.2 martin 24 1.3.4.2 martin STRIP?= strip 25 1.3.4.2 martin 26 1.3.4.3 martin CHECKSIZE_CMD= SIZE=${SIZE} ${HOST_SH} ${COMMON}/checksize.sh 27 1.3.4.2 martin 28 1.3.4.2 martin AFLAGS+= -DASSEMBLER -D_LOCORE -mno-abicalls -mips64 29 1.3.4.2 martin # -I${.CURDIR}/../.. done by Makefile.inc 30 1.3.4.2 martin CPPFLAGS+= -nostdinc -I${.OBJDIR} -D_STANDALONE -I${S} 31 1.3.4.2 martin CFLAGS= -Os -g -ffreestanding -mno-abicalls -msoft-float -G 0 32 1.3.4.2 martin CFLAGS+= -mips64 33 1.3.4.2 martin CFLAGS+= -Werror ${CWARNFLAGS} 34 1.3.4.2 martin 35 1.3.4.3 martin NETBSD_VERS!=${HOST_SH} ${S}/conf/osrelease.sh 36 1.3.4.2 martin CPPFLAGS+= -DNETBSD_VERS='"${NETBSD_VERS}"' 37 1.3.4.2 martin 38 1.3.4.2 martin CWARNFLAGS+= -Wno-main 39 1.3.4.2 martin CWARNFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith 40 1.3.4.2 martin CWARNFLAGS+= -Wno-pointer-sign 41 1.3.4.2 martin 42 1.3.4.2 martin VERSIONFLAGS+=-n 43 1.3.4.2 martin .include "${S}/conf/newvers_stand.mk" 44 1.3.4.2 martin 45 1.3.4.2 martin # 46 1.3.4.2 martin # Refer to CFE documentation for a description of these regions. 47 1.3.4.2 martin # 48 1.3.4.2 martin 49 1.3.4.2 martin REGION1_START= 0x20000000 # "Region 1 start" 50 1.3.4.2 martin REGION1_SIZE!= expr 256 \* 1024 # 256k 51 1.3.4.2 martin 52 1.3.4.3 martin LDSCRIPT= ${COMMON}/boot.ldscript 53 1.3.4.2 martin 54 1.3.4.2 martin # our memory lauout: 55 1.3.4.2 martin 56 1.3.4.2 martin # 'unified' boot loaders (e.g. netboot) can consume all of region 57 1.3.4.2 martin # 1 for their text+data, or text+data+bss. 58 1.3.4.2 martin 59 1.3.4.2 martin UNIFIED_LOAD_ADDRESS= ${REGION1_START} 60 1.3.4.2 martin UNIFIED_MAX_LOAD!= expr ${REGION1_SIZE} 61 1.3.4.2 martin UNIFIED_MAX_TOTAL!= expr ${REGION1_SIZE} 62 1.3.4.2 martin 63 1.3.4.2 martin #UNIFIED_HEAP_START= right after secondary bss 64 1.3.4.2 martin UNIFIED_HEAP_LIMIT= (${REGION1_START} + ${REGION1_SIZE}) 65 1.3.4.2 martin 66 1.3.4.2 martin # two-stage boot loaders must share region 1. The first stage 67 1.3.4.2 martin # loads into the lowest portion, and uses the higest portion 68 1.3.4.2 martin # for its heap. The second stage loads in between the primary image 69 1.3.4.2 martin # and the heap, and can reuse the memory after it (i.e. the primary's 70 1.3.4.2 martin # heap) for its own heap. 71 1.3.4.2 martin 72 1.3.4.2 martin PRIMARY_LOAD_ADDRESS= ${REGION1_START} 73 1.3.4.2 martin #PRIMARY_MAX_LOAD= booter dependent, no more than ${PRIMARY_MAX_TOTAL} 74 1.3.4.2 martin PRIMARY_MAX_TOTAL!= expr 16 \* 1024 75 1.3.4.2 martin 76 1.3.4.2 martin # XXX SECONDARY_LOAD_ADDRESS should be 77 1.3.4.2 martin # XXX (${PRIMARY_LOAD_ADDRESS} + ${PRIMARY_MAX_TOTAL}) bt there's no easy 78 1.3.4.2 martin # XXX way to do that calculation and 'ld' wants a single number. 79 1.3.4.2 martin SECONDARY_LOAD_ADDRESS= 0x20004000 # XXX 80 1.3.4.2 martin SECONDARY_MAX_LOAD!= expr 112 \* 1024 81 1.3.4.2 martin SECONDARY_MAX_TOTAL!= expr ${REGION1_SIZE} - ${PRIMARY_MAX_TOTAL} 82 1.3.4.2 martin 83 1.3.4.2 martin PRIMARY_HEAP_START= (${SECONDARY_LOAD_ADDRESS} + ${SECONDARY_MAX_LOAD}) 84 1.3.4.2 martin PRIMARY_HEAP_LIMIT= (${REGION1_START} + ${REGION1_SIZE}) 85 1.3.4.2 martin 86 1.3.4.2 martin #SECONDARY_HEAP_START= right after secondary bss 87 1.3.4.2 martin SECONDARY_HEAP_LIMIT= (${REGION1_START} + ${REGION1_SIZE}) 88 1.3.4.2 martin 89 1.3.4.2 martin # standalone programs are like kernels. They load at 90 1.3.4.2 martin # 0xfffffc0000300000 and can use the rest of memory. 91 1.3.4.2 martin 92 1.3.4.2 martin STANDPROG_LOAD_ADDRESS= 0xfffffc0000300000 93 1.3.4.2 martin 94 1.3.4.2 martin 95 1.3.4.2 martin FILE_FORMAT_CPPFLAGS= -DBOOT_ELF 96 1.3.4.2 martin 97 1.3.4.2 martin UNIFIED_CPPFLAGS= -DUNIFIED_BOOTBLOCK \ 98 1.3.4.2 martin -DHEAP_LIMIT="${UNIFIED_HEAP_LIMIT}" \ 99 1.3.4.2 martin ${FILE_FORMAT_CPPFLAGS} 100 1.3.4.2 martin 101 1.3.4.2 martin PRIMARY_CPPFLAGS= -DPRIMARY_BOOTBLOCK \ 102 1.3.4.2 martin -DSECONDARY_LOAD_ADDRESS="${SECONDARY_LOAD_ADDRESS}" \ 103 1.3.4.2 martin -DSECONDARY_MAX_LOAD="${SECONDARY_MAX_LOAD}" \ 104 1.3.4.2 martin -DHEAP_LIMIT="${PRIMARY_HEAP_LIMIT}" \ 105 1.3.4.2 martin -DHEAP_START="${PRIMARY_HEAP_START}" 106 1.3.4.2 martin 107 1.3.4.2 martin SECONDARY_CPPFLAGS= -DSECONDARY_BOOTBLOCK \ 108 1.3.4.2 martin -DHEAP_LIMIT="${SECONDARY_HEAP_LIMIT}" \ 109 1.3.4.2 martin ${FILE_FORMAT_CPPFLAGS} 110 1.3.4.2 martin 111 1.3.4.2 martin STANDPROG_CPPFLAGS= -DSTANDALONE_PROGRAM 112 1.3.4.2 martin 113 1.3.4.2 martin .include <bsd.prog.mk> 114 1.3.4.2 martin 115 1.3.4.2 martin ### find out what to use for libkern 116 1.3.4.2 martin KERN_AS= library 117 1.3.4.2 martin .include "${S}/lib/libkern/Makefile.inc" 118 1.3.4.2 martin LIBKERN= ${KERNLIB} 119 1.3.4.2 martin 120 1.3.4.2 martin ### find out what to use for libz 121 1.3.4.2 martin Z_AS= library 122 1.3.4.2 martin .include "${S}/lib/libz/Makefile.inc" 123 1.3.4.2 martin LIBZ= ${ZLIB} 124 1.3.4.2 martin 125 1.3.4.2 martin ### find out what to use for libsa 126 1.3.4.2 martin SA_AS= library 127 1.3.4.2 martin SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes" 128 1.3.4.2 martin .include "${S}/lib/libsa/Makefile.inc" 129 1.3.4.2 martin LIBSA= ${SALIB} 130 1.3.4.2 martin 131 1.3.4.2 martin /usr/lib/crt0.o: 132 1.3.4.2 martin true 133 1.3.4.2 martin 134 1.3.4.2 martin /usr/lib/crtbegin.o: 135 1.3.4.2 martin true 136 1.3.4.2 martin 137 1.3.4.2 martin /usr/lib/crtend.o: 138 1.3.4.2 martin true 139 1.3.4.2 martin 140 1.3.4.2 martin cleandir: .WAIT cleandirlocal 141 1.3.4.2 martin cleandirlocal: 142 1.3.4.2 martin -rm -rf lib 143