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