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