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