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