Makefile.bootprogs revision 1.14 1 # $NetBSD: Makefile.bootprogs,v 1.14 2017/04/08 19:53:22 christos Exp $
2
3 .include <bsd.own.mk>
4 .include <bsd.klinks.mk>
5
6 S= ${.CURDIR}/../../../..
7
8 .PATH: ${.CURDIR}/../common
9
10 STRIPFLAG=
11 BINMODE= 444
12
13 # XXX SHOULD NOT NEED TO DEFINE THESE!
14 LIBCRT0=
15 LIBCRTI=
16 LIBC=
17 LIBCRTBEGIN=
18 LIBCRTEND=
19
20 STRIP?= strip
21
22 CHECKSIZE_CMD= SIZE=${SIZE} ${HOST_SH} ${.CURDIR}/../common/checksize.sh
23
24 AFLAGS+= -DASSEMBLER -D_LOCORE -mno-abicalls -mips64
25 # -I${.CURDIR}/../.. done by Makefile.inc
26 CPPFLAGS+= -nostdinc -I${.OBJDIR} -D_STANDALONE -I${S}
27 CFLAGS= -Os -g -ffreestanding -mno-abicalls -msoft-float -G 0
28 CFLAGS+= -mips64
29 CFLAGS+= -Werror ${CWARNFLAGS}
30
31 NETBSD_VERS!=${HOST_SH} ${.CURDIR}/../../../../conf/osrelease.sh
32 CPPFLAGS+= -DNETBSD_VERS='"${NETBSD_VERS}"'
33
34 CWARNFLAGS+= -Wno-main
35 CWARNFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
36 CWARNFLAGS+= -Wno-pointer-sign
37
38 VERSIONFLAGS+=-n
39 .include "${S}/conf/newvers_stand.mk"
40
41 #
42 # Refer to CFE documentation for a description of these regions.
43 #
44
45 REGION1_START= 0x20000000 # "Region 1 start"
46 REGION1_SIZE!= expr 256 \* 1024 # 256k
47
48 LDSCRIPT= ${.CURDIR}/../common/boot.ldscript
49
50 # our memory lauout:
51
52 # 'unified' boot loaders (e.g. netboot) can consume all of region
53 # 1 for their text+data, or text+data+bss.
54
55 UNIFIED_LOAD_ADDRESS= ${REGION1_START}
56 UNIFIED_MAX_LOAD!= expr ${REGION1_SIZE}
57 UNIFIED_MAX_TOTAL!= expr ${REGION1_SIZE}
58
59 #UNIFIED_HEAP_START= right after secondary bss
60 UNIFIED_HEAP_LIMIT= (${REGION1_START} + ${REGION1_SIZE})
61
62 # two-stage boot loaders must share region 1. The first stage
63 # loads into the lowest portion, and uses the higest portion
64 # for its heap. The second stage loads in between the primary image
65 # and the heap, and can reuse the memory after it (i.e. the primary's
66 # heap) for its own heap.
67
68 PRIMARY_LOAD_ADDRESS= ${REGION1_START}
69 #PRIMARY_MAX_LOAD= booter dependent, no more than ${PRIMARY_MAX_TOTAL}
70 PRIMARY_MAX_TOTAL!= expr 16 \* 1024
71
72 # XXX SECONDARY_LOAD_ADDRESS should be
73 # XXX (${PRIMARY_LOAD_ADDRESS} + ${PRIMARY_MAX_TOTAL}) bt there's no easy
74 # XXX way to do that calculation and 'ld' wants a single number.
75 SECONDARY_LOAD_ADDRESS= 0x20004000 # XXX
76 SECONDARY_MAX_LOAD!= expr 112 \* 1024
77 SECONDARY_MAX_TOTAL!= expr ${REGION1_SIZE} - ${PRIMARY_MAX_TOTAL}
78
79 PRIMARY_HEAP_START= (${SECONDARY_LOAD_ADDRESS} + ${SECONDARY_MAX_LOAD})
80 PRIMARY_HEAP_LIMIT= (${REGION1_START} + ${REGION1_SIZE})
81
82 #SECONDARY_HEAP_START= right after secondary bss
83 SECONDARY_HEAP_LIMIT= (${REGION1_START} + ${REGION1_SIZE})
84
85 # standalone programs are like kernels. They load at
86 # 0xfffffc0000300000 and can use the rest of memory.
87
88 STANDPROG_LOAD_ADDRESS= 0xfffffc0000300000
89
90
91 FILE_FORMAT_CPPFLAGS= -DBOOT_ELF
92
93 UNIFIED_CPPFLAGS= -DUNIFIED_BOOTBLOCK \
94 -DHEAP_LIMIT="${UNIFIED_HEAP_LIMIT}" \
95 ${FILE_FORMAT_CPPFLAGS}
96
97 PRIMARY_CPPFLAGS= -DPRIMARY_BOOTBLOCK \
98 -DSECONDARY_LOAD_ADDRESS="${SECONDARY_LOAD_ADDRESS}" \
99 -DSECONDARY_MAX_LOAD="${SECONDARY_MAX_LOAD}" \
100 -DHEAP_LIMIT="${PRIMARY_HEAP_LIMIT}" \
101 -DHEAP_START="${PRIMARY_HEAP_START}"
102
103 SECONDARY_CPPFLAGS= -DSECONDARY_BOOTBLOCK \
104 -DHEAP_LIMIT="${SECONDARY_HEAP_LIMIT}" \
105 ${FILE_FORMAT_CPPFLAGS}
106
107 STANDPROG_CPPFLAGS= -DSTANDALONE_PROGRAM
108
109 .include <bsd.prog.mk>
110
111 ### find out what to use for libkern
112 KERN_AS= library
113 .include "${S}/lib/libkern/Makefile.inc"
114 LIBKERN= ${KERNLIB}
115
116 ### find out what to use for libz
117 Z_AS= library
118 .include "${S}/lib/libz/Makefile.inc"
119 LIBZ= ${ZLIB}
120
121 ### find out what to use for libsa
122 SA_AS= library
123 SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes"
124 .include "${S}/lib/libsa/Makefile.inc"
125 LIBSA= ${SALIB}
126
127 /usr/lib/crt0.o:
128 true
129
130 /usr/lib/crtbegin.o:
131 true
132
133 /usr/lib/crtend.o:
134 true
135
136 cleandir: .WAIT cleandirlocal
137 cleandirlocal:
138 -rm -rf lib
139