Makefile.bootprogs revision 1.5
1# $NetBSD: Makefile.bootprogs,v 1.5 1999/03/31 02:52:11 cgd Exp $
2
3S=	${.CURDIR}/../../../..
4
5.PATH:	${.CURDIR}/../common
6
7MKMAN=	no
8STRIPFLAG=
9BINMODE= 444
10
11STRIP?=	strip
12
13CHECKSIZE_CMD=	SIZE=${SIZE} sh ${.CURDIR}/../common/checksize.sh
14
15.PHONY: machine-links
16beforedepend: machine-links
17# ${MACHINE} then ${MACHINE_ARCH}
18machine-links:
19	-rm -f machine && \
20	    ln -s $S/arch/alpha/include machine
21	-rm -f alpha && \
22	    ln -s $S/arch/alpha/include alpha
23CLEANFILES+=machine alpha
24
25all: machine-links ${PROG}
26
27AFLAGS += -DASSEMBLER
28#CPPFLAGS+= -nostdinc -I${.OBJDIR}
29CPPFLAGS+= -I${.OBJDIR}
30CPPFLAGS += -D_STANDALONE -I${.CURDIR}/../.. -I${S}
31CFLAGS = ${CWARNFLAGS} -Os -mno-fp-regs -g
32
33# For descriptions of regions available to bootstrap programs, see
34# section 3.4.1.2 (pp. III 3-14 - III 3-18) of the second edition of
35# the Alpha AXP Architecture Reference Manual.
36
37REGION1_START=		0x20000000		# "Region 1 start"
38REGION1_SIZE!=		expr 256 \* 1024	# 256k
39
40# our memory lauout:
41
42#	'unified' boot loaders (e.g. netboot) can consume all of region
43#	1 for their text+data, or text+data+bss.
44
45UNIFIED_LOAD_ADDRESS=	${REGION1_START}
46UNIFIED_MAX_LOAD!=	expr ${REGION1_SIZE}
47UNIFIED_MAX_TOTAL!=	expr ${REGION1_SIZE}
48
49#UNIFIED_HEAP_START=	right after secondary bss
50UNIFIED_HEAP_LIMIT=	(${REGION1_START} + ${REGION1_SIZE})
51
52#	two-stage boot loaders must share region 1.  The first stage
53#	loads into the lowest portion, and uses the higest portion
54#	for its heap.  The second stage loads in between the primary image
55#	and the heap, and can reuse the memory after it (i.e. the primary's
56#	heap) for its own heap.
57
58PRIMARY_LOAD_ADDRESS=	${REGION1_START}
59#PRIMARY_MAX_LOAD=	booter dependent, no more than ${PRIMARY_MAX_TOTAL}
60PRIMARY_MAX_TOTAL!=	expr 16 \* 1024
61
62# XXX SECONDARY_LOAD_ADDRESS should be
63# XXX (${PRIMARY_LOAD_ADDRESS} + ${PRIMARY_MAX_TOTAL}) bt there's no easy
64# XXX way to do that calculation and 'ld' wants a single number.
65SECONDARY_LOAD_ADDRESS=	0x20004000	# XXX
66SECONDARY_MAX_LOAD!=	expr 112 \* 1024
67SECONDARY_MAX_TOTAL!=	expr ${REGION1_SIZE} - ${PRIMARY_MAX_TOTAL}
68
69PRIMARY_HEAP_START=	(${SECONDARY_LOAD_ADDRESS} + ${SECONDARY_MAX_LOAD})
70PRIMARY_HEAP_LIMIT=	(${REGION1_START} + ${REGION1_SIZE})
71
72#SECONDARY_HEAP_START=	right after secondary bss
73SECONDARY_HEAP_LIMIT=	(${REGION1_START} + ${REGION1_SIZE})
74
75FILE_FORMAT_CPPFLAGS=	-DALPHA_BOOT_ECOFF -DALPHA_BOOT_ELF
76
77UNIFIED_CPPFLAGS=	-DPRIMARY_BOOTBLOCK \
78			-DHEAP_LIMIT="${UNIFIED_HEAP_LIMIT}" \
79			${FILE_FORMAT_CPP_FLAGS}
80
81PRIMARY_CPPFLAGS=	-DPRIMARY_BOOTBLOCK \
82			-DSECONDARY_LOAD_ADDRESS="${SECONDARY_LOAD_ADDRESS}" \
83			-DSECONDARY_MAX_LOAD="${SECONDARY_MAX_LOAD}" \
84			-DHEAP_LIMIT="${PRIMARY_HEAP_LIMIT}" \
85			-DHEAP_START="${PRIMARY_HEAP_START}"
86
87SECONDARY_CPPFLAGS=	-DHEAP_LIMIT="${SECONDARY_HEAP_LIMIT}" \
88			${FILE_FORMAT_CPP_FLAGS}
89
90.include <bsd.prog.mk>
91
92### find out what to use for libkern
93KERN_AS=	library
94.include "${S}/lib/libkern/Makefile.inc"
95LIBKERN=	${KERNLIB}
96
97### find out what to use for libz
98Z_AS=		library
99.include "${S}/lib/libz/Makefile.inc"
100LIBZ=		${ZLIB}
101
102### find out what to use for libsa
103SA_AS=		library
104.include "${S}/lib/libsa/Makefile.inc"
105LIBSA=		${SALIB}
106