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