1# $NetBSD: Makefile.bootprogs,v 1.37 2022/05/28 22:16:43 andvar Exp $ 2 3NOMAN= # defined 4 5.include <bsd.own.mk> 6 7S= ${.CURDIR}/../../../.. 8 9.PATH: ${.CURDIR}/../common 10 11BINMODE= 444 12 13STRIP?= strip 14 15# XXX SHOULD NOT NEED TO DEFINE THESE! 16LIBCRT0= 17LIBCRTI= 18LIBC= 19LIBCRTBEGIN= 20LIBCRTEND= 21 22CHECKSIZE_CMD= SIZE=${SIZE} ${HOST_SH} ${.CURDIR}/../common/checksize.sh 23 24realall: ${PROG} 25 26AFLAGS+= -DASSEMBLER 27# -I${.CURDIR}/../.. done by Makefile.inc 28CPPFLAGS+= -nostdinc -I${.OBJDIR} -D_STANDALONE -I${S} 29CFLAGS= -ffreestanding -mno-fp-regs -g 30 31NETBSD_VERS!=${HOST_SH} ${.CURDIR}/../../../../conf/osrelease.sh 32CPPFLAGS+= -DNETBSD_VERS='"${NETBSD_VERS}"' 33 34CWARNFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith 35CFLAGS+= -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 44REGION1_START= 0x20000000 # "Region 1 start" 45REGION1_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 52UNIFIED_LOAD_ADDRESS= ${REGION1_START} 53UNIFIED_MAX_LOAD!= expr ${REGION1_SIZE} 54UNIFIED_MAX_TOTAL!= expr ${REGION1_SIZE} 55 56#UNIFIED_HEAP_START= right after secondary bss 57UNIFIED_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 65PRIMARY_LOAD_ADDRESS= ${REGION1_START} 66#PRIMARY_MAX_LOAD= booter dependent, no more than ${PRIMARY_MAX_TOTAL} 67PRIMARY_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. 72SECONDARY_LOAD_ADDRESS= 0x20004000 # XXX 73SECONDARY_MAX_LOAD!= expr 112 \* 1024 74SECONDARY_MAX_TOTAL!= expr ${REGION1_SIZE} - ${PRIMARY_MAX_TOTAL} 75 76PRIMARY_HEAP_START= (${SECONDARY_LOAD_ADDRESS} + ${SECONDARY_MAX_LOAD}) 77PRIMARY_HEAP_LIMIT= (${REGION1_START} + ${REGION1_SIZE}) 78 79#SECONDARY_HEAP_START= right after secondary bss 80SECONDARY_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 85STANDPROG_LOAD_ADDRESS= 0xfffffc0000800000 86 87 88FILE_FORMAT_CPPFLAGS= -DBOOT_ECOFF -DBOOT_ELF64 89 90UNIFIED_CPPFLAGS= -DUNIFIED_BOOTBLOCK \ 91 -DHEAP_LIMIT="${UNIFIED_HEAP_LIMIT}" \ 92 ${FILE_FORMAT_CPPFLAGS} 93 94PRIMARY_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 100SECONDARY_CPPFLAGS= -DSECONDARY_BOOTBLOCK \ 101 -DHEAP_LIMIT="${SECONDARY_HEAP_LIMIT}" \ 102 ${FILE_FORMAT_CPPFLAGS} 103 104STANDPROG_CPPFLAGS= -DSTANDALONE_PROGRAM 105 106.include <bsd.prog.mk> 107.include <bsd.klinks.mk> 108 109STRIPFLAG= # override values in ${MAKECONF} 110COPTS+=-Os # override -O supplied by user 111 112### find out what to use for libkern 113KERN_AS= library 114.include "${S}/lib/libkern/Makefile.inc" 115LIBKERN= ${KERNLIB} 116 117### find out what to use for libz 118Z_AS= library 119.include "${S}/lib/libz/Makefile.inc" 120LIBZ= ${ZLIB} 121 122### find out what to use for libsa 123SA_AS= library 124SAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes 125.include "${S}/lib/libsa/Makefile.inc" 126LIBSA= ${SALIB} 127