Makefile.bootprogs revision 1.3
1# $NetBSD: Makefile.bootprogs,v 1.3 2003/10/08 01:40:23 simonb Exp $ 2 3S= ${.CURDIR}/../../../.. 4 5.PATH: ${.CURDIR}/../common 6 7STRIPFLAG= 8BINMODE= 444 9 10# XXX SHOULD NOT NEED TO DEFINE THESE! 11LIBCRT0= 12LIBC= 13LIBCRTBEGIN= 14LIBCRTEND= 15 16STRIP?= strip 17 18CHECKSIZE_CMD= SIZE=${SIZE} sh ${.CURDIR}/../common/checksize.sh 19 20.PHONY: machine-links 21beforedepend: machine-links 22# ${MACHINE} then ${MACHINE_ARCH} 23machine-links: 24 -rm -f machine && \ 25 ln -s $S/arch/sbmips/include machine 26 -rm -f mips && \ 27 ln -s $S/arch/mips/include mips 28CLEANFILES+=machine mips 29 30realall: machine-links ${PROG} 31 32AFLAGS+= -DASSEMBLER -D_LOCORE -mno-abicalls 33# -I${.CURDIR}/../.. done by Makefile.inc 34CPPFLAGS+= -nostdinc -I${.OBJDIR} -D_STANDALONE -I${S} 35CFLAGS= -Os -g -ffreestanding -mno-abicalls -msoft-float -G 0 36 37NETBSD_VERS!=sh ${.CURDIR}/../../../../conf/osrelease.sh 38CPPFLAGS+= -DNETBSD_VERS='"${NETBSD_VERS}"' 39 40CWARNFLAGS+= -Wno-main 41 42# if there is a 'version' file, add rule for vers.c and add it to SRCS 43# and CLEANFILES 44.if exists(version) 45.PHONY: vers.c 46vers.c: version 47 sh ${S}/conf/newvers_stand.sh -N ${.CURDIR}/version "sbmips" 48 49SRCS+= vers.c 50CLEANFILES+= vers.c 51.endif 52 53# 54# Refer to CFE documentation for a description of these regions. 55# 56 57REGION1_START= 0x20000000 # "Region 1 start" 58REGION1_SIZE!= expr 256 \* 1024 # 256k 59 60# our memory lauout: 61 62# 'unified' boot loaders (e.g. netboot) can consume all of region 63# 1 for their text+data, or text+data+bss. 64 65UNIFIED_LOAD_ADDRESS= ${REGION1_START} 66UNIFIED_MAX_LOAD!= expr ${REGION1_SIZE} 67UNIFIED_MAX_TOTAL!= expr ${REGION1_SIZE} 68 69#UNIFIED_HEAP_START= right after secondary bss 70UNIFIED_HEAP_LIMIT= (${REGION1_START} + ${REGION1_SIZE}) 71 72# two-stage boot loaders must share region 1. The first stage 73# loads into the lowest portion, and uses the higest portion 74# for its heap. The second stage loads in between the primary image 75# and the heap, and can reuse the memory after it (i.e. the primary's 76# heap) for its own heap. 77 78PRIMARY_LOAD_ADDRESS= ${REGION1_START} 79#PRIMARY_MAX_LOAD= booter dependent, no more than ${PRIMARY_MAX_TOTAL} 80PRIMARY_MAX_TOTAL!= expr 16 \* 1024 81 82# XXX SECONDARY_LOAD_ADDRESS should be 83# XXX (${PRIMARY_LOAD_ADDRESS} + ${PRIMARY_MAX_TOTAL}) bt there's no easy 84# XXX way to do that calculation and 'ld' wants a single number. 85SECONDARY_LOAD_ADDRESS= 0x20004000 # XXX 86SECONDARY_MAX_LOAD!= expr 112 \* 1024 87SECONDARY_MAX_TOTAL!= expr ${REGION1_SIZE} - ${PRIMARY_MAX_TOTAL} 88 89PRIMARY_HEAP_START= (${SECONDARY_LOAD_ADDRESS} + ${SECONDARY_MAX_LOAD}) 90PRIMARY_HEAP_LIMIT= (${REGION1_START} + ${REGION1_SIZE}) 91 92#SECONDARY_HEAP_START= right after secondary bss 93SECONDARY_HEAP_LIMIT= (${REGION1_START} + ${REGION1_SIZE}) 94 95# standalone programs are like kernels. They load at 96# 0xfffffc0000300000 and can use the rest of memory. 97 98STANDPROG_LOAD_ADDRESS= 0xfffffc0000300000 99 100 101FILE_FORMAT_CPPFLAGS= -DBOOT_ECOFF -DBOOT_ELF 102 103UNIFIED_CPPFLAGS= -DUNIFIED_BOOTBLOCK \ 104 -DHEAP_LIMIT="${UNIFIED_HEAP_LIMIT}" \ 105 ${FILE_FORMAT_CPPFLAGS} 106 107PRIMARY_CPPFLAGS= -DPRIMARY_BOOTBLOCK \ 108 -DSECONDARY_LOAD_ADDRESS="${SECONDARY_LOAD_ADDRESS}" \ 109 -DSECONDARY_MAX_LOAD="${SECONDARY_MAX_LOAD}" \ 110 -DHEAP_LIMIT="${PRIMARY_HEAP_LIMIT}" \ 111 -DHEAP_START="${PRIMARY_HEAP_START}" 112 113SECONDARY_CPPFLAGS= -DSECONDARY_BOOTBLOCK \ 114 -DHEAP_LIMIT="${SECONDARY_HEAP_LIMIT}" \ 115 ${FILE_FORMAT_CPPFLAGS} 116 117STANDPROG_CPPFLAGS= -DSTANDALONE_PROGRAM 118 119.include <bsd.prog.mk> 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 137 138/usr/lib/crt0.o: 139 true 140 141/usr/lib/crtbegin.o: 142 true 143 144/usr/lib/crtend.o: 145 true 146 147cleandir: cleandirlocal 148cleandirlocal: 149 rm -rf lib 150