2011-01-23 16:18:57 +03:00
|
|
|
# $NetBSD: Makefile.bootprogs,v 1.32 2011/01/23 13:24:05 joerg Exp $
|
|
|
|
|
|
|
|
NOMAN= # defined
|
2003-10-26 10:25:33 +03:00
|
|
|
|
2011-01-22 22:19:14 +03:00
|
|
|
.include <bsd.own.mk>
|
2003-10-26 10:25:33 +03:00
|
|
|
.include <bsd.sys.mk> # for HOST_SH
|
1998-03-28 03:21:35 +03:00
|
|
|
|
|
|
|
S= ${.CURDIR}/../../../..
|
|
|
|
|
|
|
|
.PATH: ${.CURDIR}/../common
|
|
|
|
|
|
|
|
BINMODE= 444
|
|
|
|
|
2000-02-01 08:25:24 +03:00
|
|
|
STRIP?= strip
|
1998-03-28 03:21:35 +03:00
|
|
|
|
2003-10-08 05:40:22 +04:00
|
|
|
# XXX SHOULD NOT NEED TO DEFINE THESE!
|
|
|
|
LIBCRT0=
|
|
|
|
LIBC=
|
|
|
|
LIBCRTBEGIN=
|
|
|
|
LIBCRTEND=
|
|
|
|
|
2003-10-26 10:25:33 +03:00
|
|
|
CHECKSIZE_CMD= SIZE=${SIZE} ${HOST_SH} ${.CURDIR}/../common/checksize.sh
|
1999-04-02 07:11:57 +04:00
|
|
|
|
2009-04-13 16:18:56 +04:00
|
|
|
realall: ${PROG}
|
1998-03-28 03:21:35 +03:00
|
|
|
|
1999-04-05 07:35:24 +04:00
|
|
|
AFLAGS+= -DASSEMBLER
|
|
|
|
# -I${.CURDIR}/../.. done by Makefile.inc
|
|
|
|
CPPFLAGS+= -nostdinc -I${.OBJDIR} -D_STANDALONE -I${S}
|
2002-01-05 04:22:21 +03:00
|
|
|
CFLAGS= -ffreestanding -mno-fp-regs -g
|
1999-04-05 07:35:24 +04:00
|
|
|
|
2003-10-26 10:25:33 +03:00
|
|
|
NETBSD_VERS!=${HOST_SH} ${.CURDIR}/../../../../conf/osrelease.sh
|
1999-04-06 02:03:48 +04:00
|
|
|
CPPFLAGS+= -DNETBSD_VERS='"${NETBSD_VERS}"'
|
|
|
|
|
2009-01-12 10:10:13 +03:00
|
|
|
CWARNFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
|
|
|
|
CFLAGS+= -Werror ${CWARNFLAGS}
|
1998-03-28 03:21:35 +03:00
|
|
|
|
2000-07-22 01:25:18 +04:00
|
|
|
# if there is a 'version' file, add rule for vers.c and add it to SRCS
|
|
|
|
# and CLEANFILES
|
|
|
|
.if exists(version)
|
|
|
|
.PHONY: vers.c
|
|
|
|
vers.c: version
|
2011-01-22 22:19:14 +03:00
|
|
|
${HOST_SH} ${S}/conf/newvers_stand.sh ${${MKREPRO} == "yes" :?:-D} \
|
|
|
|
-N ${.CURDIR}/version "alpha"
|
2000-07-22 01:25:18 +04:00
|
|
|
|
|
|
|
SRCS+= vers.c
|
|
|
|
CLEANFILES+= vers.c
|
|
|
|
.endif
|
|
|
|
|
1998-03-28 03:21:35 +03:00
|
|
|
# For descriptions of regions available to bootstrap programs, see
|
|
|
|
# section 3.4.1.2 (pp. III 3-14 - III 3-18) of the second edition of
|
|
|
|
# the Alpha AXP Architecture Reference Manual.
|
|
|
|
|
1999-04-02 07:11:57 +04:00
|
|
|
REGION1_START= 0x20000000 # "Region 1 start"
|
|
|
|
REGION1_SIZE!= expr 256 \* 1024 # 256k
|
|
|
|
|
|
|
|
# our memory lauout:
|
|
|
|
|
|
|
|
# 'unified' boot loaders (e.g. netboot) can consume all of region
|
|
|
|
# 1 for their text+data, or text+data+bss.
|
|
|
|
|
|
|
|
UNIFIED_LOAD_ADDRESS= ${REGION1_START}
|
|
|
|
UNIFIED_MAX_LOAD!= expr ${REGION1_SIZE}
|
|
|
|
UNIFIED_MAX_TOTAL!= expr ${REGION1_SIZE}
|
|
|
|
|
|
|
|
#UNIFIED_HEAP_START= right after secondary bss
|
|
|
|
UNIFIED_HEAP_LIMIT= (${REGION1_START} + ${REGION1_SIZE})
|
|
|
|
|
|
|
|
# two-stage boot loaders must share region 1. The first stage
|
|
|
|
# loads into the lowest portion, and uses the higest portion
|
|
|
|
# for its heap. The second stage loads in between the primary image
|
|
|
|
# and the heap, and can reuse the memory after it (i.e. the primary's
|
|
|
|
# heap) for its own heap.
|
1998-03-28 03:21:35 +03:00
|
|
|
|
1999-04-02 07:11:57 +04:00
|
|
|
PRIMARY_LOAD_ADDRESS= ${REGION1_START}
|
|
|
|
#PRIMARY_MAX_LOAD= booter dependent, no more than ${PRIMARY_MAX_TOTAL}
|
|
|
|
PRIMARY_MAX_TOTAL!= expr 16 \* 1024
|
|
|
|
|
|
|
|
# XXX SECONDARY_LOAD_ADDRESS should be
|
|
|
|
# XXX (${PRIMARY_LOAD_ADDRESS} + ${PRIMARY_MAX_TOTAL}) bt there's no easy
|
|
|
|
# XXX way to do that calculation and 'ld' wants a single number.
|
|
|
|
SECONDARY_LOAD_ADDRESS= 0x20004000 # XXX
|
|
|
|
SECONDARY_MAX_LOAD!= expr 112 \* 1024
|
|
|
|
SECONDARY_MAX_TOTAL!= expr ${REGION1_SIZE} - ${PRIMARY_MAX_TOTAL}
|
|
|
|
|
|
|
|
PRIMARY_HEAP_START= (${SECONDARY_LOAD_ADDRESS} + ${SECONDARY_MAX_LOAD})
|
|
|
|
PRIMARY_HEAP_LIMIT= (${REGION1_START} + ${REGION1_SIZE})
|
|
|
|
|
|
|
|
#SECONDARY_HEAP_START= right after secondary bss
|
|
|
|
SECONDARY_HEAP_LIMIT= (${REGION1_START} + ${REGION1_SIZE})
|
1998-03-28 03:21:35 +03:00
|
|
|
|
1999-04-11 07:36:21 +04:00
|
|
|
# standalone programs are like kernels. They load at
|
|
|
|
# 0xfffffc0000300000 and can use the rest of memory.
|
|
|
|
|
|
|
|
STANDPROG_LOAD_ADDRESS= 0xfffffc0000300000
|
|
|
|
|
|
|
|
|
2001-10-31 20:20:45 +03:00
|
|
|
FILE_FORMAT_CPPFLAGS= -DBOOT_ECOFF -DBOOT_ELF64
|
1998-03-28 03:21:35 +03:00
|
|
|
|
1999-04-02 07:11:57 +04:00
|
|
|
UNIFIED_CPPFLAGS= -DUNIFIED_BOOTBLOCK \
|
|
|
|
-DHEAP_LIMIT="${UNIFIED_HEAP_LIMIT}" \
|
1999-04-02 11:55:06 +04:00
|
|
|
${FILE_FORMAT_CPPFLAGS}
|
1999-04-02 07:11:57 +04:00
|
|
|
|
|
|
|
PRIMARY_CPPFLAGS= -DPRIMARY_BOOTBLOCK \
|
|
|
|
-DSECONDARY_LOAD_ADDRESS="${SECONDARY_LOAD_ADDRESS}" \
|
|
|
|
-DSECONDARY_MAX_LOAD="${SECONDARY_MAX_LOAD}" \
|
|
|
|
-DHEAP_LIMIT="${PRIMARY_HEAP_LIMIT}" \
|
|
|
|
-DHEAP_START="${PRIMARY_HEAP_START}"
|
|
|
|
|
|
|
|
SECONDARY_CPPFLAGS= -DSECONDARY_BOOTBLOCK \
|
|
|
|
-DHEAP_LIMIT="${SECONDARY_HEAP_LIMIT}" \
|
1999-04-02 11:55:06 +04:00
|
|
|
${FILE_FORMAT_CPPFLAGS}
|
1999-04-02 07:11:57 +04:00
|
|
|
|
1999-04-11 07:36:21 +04:00
|
|
|
STANDPROG_CPPFLAGS= -DSTANDALONE_PROGRAM
|
|
|
|
|
1998-03-28 03:21:35 +03:00
|
|
|
.include <bsd.prog.mk>
|
2009-04-13 16:18:56 +04:00
|
|
|
.include <bsd.klinks.mk>
|
1998-03-28 03:21:35 +03:00
|
|
|
|
2009-04-20 17:15:12 +04:00
|
|
|
STRIPFLAG= # override values in ${MAKECONF}
|
2001-12-30 19:32:29 +03:00
|
|
|
COPTS+=-Os # override -O supplied by user
|
|
|
|
|
1998-03-28 03:21:35 +03:00
|
|
|
### find out what to use for libkern
|
|
|
|
KERN_AS= library
|
|
|
|
.include "${S}/lib/libkern/Makefile.inc"
|
|
|
|
LIBKERN= ${KERNLIB}
|
|
|
|
|
|
|
|
### find out what to use for libz
|
|
|
|
Z_AS= library
|
|
|
|
.include "${S}/lib/libz/Makefile.inc"
|
|
|
|
LIBZ= ${ZLIB}
|
|
|
|
|
|
|
|
### find out what to use for libsa
|
|
|
|
SA_AS= library
|
2005-01-05 15:18:18 +03:00
|
|
|
SAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes
|
1998-03-28 03:21:35 +03:00
|
|
|
.include "${S}/lib/libsa/Makefile.inc"
|
|
|
|
LIBSA= ${SALIB}
|