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