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