Makefile.bootprogs revision 1.9 1 # $NetBSD: Makefile.bootprogs,v 1.9 1999/04/02 07:55:06 ross Exp $
2
3 S= ${.CURDIR}/../../../..
4
5 .PATH: ${.CURDIR}/../common
6
7 MKMAN= no
8 STRIPFLAG=
9 BINMODE= 444
10
11 STRIP?= strip
12
13 CHECKSIZE_CMD= SIZE=${SIZE} sh ${.CURDIR}/../common/checksize.sh
14
15 .PHONY: machine-links
16 beforedepend: machine-links
17 # ${MACHINE} then ${MACHINE_ARCH}
18 machine-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
23 CLEANFILES+=machine alpha
24
25 all: machine-links ${PROG}
26
27 AFLAGS += -DASSEMBLER
28 #CPPFLAGS+= -nostdinc -I${.OBJDIR}
29 CPPFLAGS+= -I${.OBJDIR}
30 CPPFLAGS += -D_STANDALONE -I${.CURDIR}/../.. -I${S}
31 CFLAGS = ${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
37 REGION1_START= 0x20000000 # "Region 1 start"
38 REGION1_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
45 UNIFIED_LOAD_ADDRESS= ${REGION1_START}
46 UNIFIED_MAX_LOAD!= expr ${REGION1_SIZE}
47 UNIFIED_MAX_TOTAL!= expr ${REGION1_SIZE}
48
49 #UNIFIED_HEAP_START= right after secondary bss
50 UNIFIED_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
58 PRIMARY_LOAD_ADDRESS= ${REGION1_START}
59 #PRIMARY_MAX_LOAD= booter dependent, no more than ${PRIMARY_MAX_TOTAL}
60 PRIMARY_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.
65 SECONDARY_LOAD_ADDRESS= 0x20004000 # XXX
66 SECONDARY_MAX_LOAD!= expr 112 \* 1024
67 SECONDARY_MAX_TOTAL!= expr ${REGION1_SIZE} - ${PRIMARY_MAX_TOTAL}
68
69 PRIMARY_HEAP_START= (${SECONDARY_LOAD_ADDRESS} + ${SECONDARY_MAX_LOAD})
70 PRIMARY_HEAP_LIMIT= (${REGION1_START} + ${REGION1_SIZE})
71
72 #SECONDARY_HEAP_START= right after secondary bss
73 SECONDARY_HEAP_LIMIT= (${REGION1_START} + ${REGION1_SIZE})
74
75 FILE_FORMAT_CPPFLAGS= -DALPHA_BOOT_ECOFF -DALPHA_BOOT_ELF
76
77 UNIFIED_CPPFLAGS= -DUNIFIED_BOOTBLOCK \
78 -DHEAP_LIMIT="${UNIFIED_HEAP_LIMIT}" \
79 ${FILE_FORMAT_CPPFLAGS}
80
81 PRIMARY_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
87 SECONDARY_CPPFLAGS= -DSECONDARY_BOOTBLOCK \
88 -DHEAP_LIMIT="${SECONDARY_HEAP_LIMIT}" \
89 ${FILE_FORMAT_CPPFLAGS}
90
91 .include <bsd.prog.mk>
92
93 ### find out what to use for libkern
94 KERN_AS= library
95 .include "${S}/lib/libkern/Makefile.inc"
96 LIBKERN= ${KERNLIB}
97
98 ### find out what to use for libz
99 Z_AS= library
100 .include "${S}/lib/libz/Makefile.inc"
101 LIBZ= ${ZLIB}
102
103 ### find out what to use for libsa
104 SA_AS= library
105 .include "${S}/lib/libsa/Makefile.inc"
106 LIBSA= ${SALIB}
107