1# $NetBSD: Makefile.bootprogs,v 1.32 2011/01/23 13:24:05 joerg Exp $ 2 3NOMAN= # defined 4 5.include <bsd.own.mk> 6.include <bsd.sys.mk> # for HOST_SH 7 8S= ${.CURDIR}/../../../.. 9 10.PATH: ${.CURDIR}/../common 11 12BINMODE= 444 13 14STRIP?= strip 15 16# XXX SHOULD NOT NEED TO DEFINE THESE! 17LIBCRT0= 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# if there is a 'version' file, add rule for vers.c and add it to SRCS 38# and CLEANFILES 39.if exists(version) 40.PHONY: vers.c 41vers.c: version 42 ${HOST_SH} ${S}/conf/newvers_stand.sh ${${MKREPRO} == "yes" :?:-D} \ 43 -N ${.CURDIR}/version "alpha" 44 45SRCS+= vers.c 46CLEANFILES+= vers.c 47.endif 48 49# For descriptions of regions available to bootstrap programs, see 50# section 3.4.1.2 (pp. III 3-14 - III 3-18) of the second edition of 51# the Alpha AXP Architecture Reference Manual. 52 53REGION1_START= 0x20000000 # "Region 1 start" 54REGION1_SIZE!= expr 256 \* 1024 # 256k 55 56# our memory lauout: 57 58# 'unified' boot loaders (e.g. netboot) can consume all of region 59# 1 for their text+data, or text+data+bss. 60 61UNIFIED_LOAD_ADDRESS= ${REGION1_START} 62UNIFIED_MAX_LOAD!= expr ${REGION1_SIZE} 63UNIFIED_MAX_TOTAL!= expr ${REGION1_SIZE} 64 65#UNIFIED_HEAP_START= right after secondary bss 66UNIFIED_HEAP_LIMIT= (${REGION1_START} + ${REGION1_SIZE}) 67 68# two-stage boot loaders must share region 1. The first stage 69# loads into the lowest portion, and uses the higest portion 70# for its heap. The second stage loads in between the primary image 71# and the heap, and can reuse the memory after it (i.e. the primary's 72# heap) for its own heap. 73 74PRIMARY_LOAD_ADDRESS= ${REGION1_START} 75#PRIMARY_MAX_LOAD= booter dependent, no more than ${PRIMARY_MAX_TOTAL} 76PRIMARY_MAX_TOTAL!= expr 16 \* 1024 77 78# XXX SECONDARY_LOAD_ADDRESS should be 79# XXX (${PRIMARY_LOAD_ADDRESS} + ${PRIMARY_MAX_TOTAL}) bt there's no easy 80# XXX way to do that calculation and 'ld' wants a single number. 81SECONDARY_LOAD_ADDRESS= 0x20004000 # XXX 82SECONDARY_MAX_LOAD!= expr 112 \* 1024 83SECONDARY_MAX_TOTAL!= expr ${REGION1_SIZE} - ${PRIMARY_MAX_TOTAL} 84 85PRIMARY_HEAP_START= (${SECONDARY_LOAD_ADDRESS} + ${SECONDARY_MAX_LOAD}) 86PRIMARY_HEAP_LIMIT= (${REGION1_START} + ${REGION1_SIZE}) 87 88#SECONDARY_HEAP_START= right after secondary bss 89SECONDARY_HEAP_LIMIT= (${REGION1_START} + ${REGION1_SIZE}) 90 91# standalone programs are like kernels. They load at 92# 0xfffffc0000300000 and can use the rest of memory. 93 94STANDPROG_LOAD_ADDRESS= 0xfffffc0000300000 95 96 97FILE_FORMAT_CPPFLAGS= -DBOOT_ECOFF -DBOOT_ELF64 98 99UNIFIED_CPPFLAGS= -DUNIFIED_BOOTBLOCK \ 100 -DHEAP_LIMIT="${UNIFIED_HEAP_LIMIT}" \ 101 ${FILE_FORMAT_CPPFLAGS} 102 103PRIMARY_CPPFLAGS= -DPRIMARY_BOOTBLOCK \ 104 -DSECONDARY_LOAD_ADDRESS="${SECONDARY_LOAD_ADDRESS}" \ 105 -DSECONDARY_MAX_LOAD="${SECONDARY_MAX_LOAD}" \ 106 -DHEAP_LIMIT="${PRIMARY_HEAP_LIMIT}" \ 107 -DHEAP_START="${PRIMARY_HEAP_START}" 108 109SECONDARY_CPPFLAGS= -DSECONDARY_BOOTBLOCK \ 110 -DHEAP_LIMIT="${SECONDARY_HEAP_LIMIT}" \ 111 ${FILE_FORMAT_CPPFLAGS} 112 113STANDPROG_CPPFLAGS= -DSTANDALONE_PROGRAM 114 115.include <bsd.prog.mk> 116.include <bsd.klinks.mk> 117 118STRIPFLAG= # override values in ${MAKECONF} 119COPTS+=-Os # override -O supplied by user 120 121### find out what to use for libkern 122KERN_AS= library 123.include "${S}/lib/libkern/Makefile.inc" 124LIBKERN= ${KERNLIB} 125 126### find out what to use for libz 127Z_AS= library 128.include "${S}/lib/libz/Makefile.inc" 129LIBZ= ${ZLIB} 130 131### find out what to use for libsa 132SA_AS= library 133SAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes 134.include "${S}/lib/libsa/Makefile.inc" 135LIBSA= ${SALIB} 136