Home | History | Annotate | Line # | Download | only in stand
Makefile.bootprogs revision 1.33
      1  1.33   tsutsui # $NetBSD: Makefile.bootprogs,v 1.33 2014/01/12 15:26:28 tsutsui Exp $
      2  1.32     joerg 
      3  1.32     joerg NOMAN=			# defined
      4  1.24     lukem 
      5  1.31     joerg .include <bsd.own.mk>
      6  1.24     lukem .include <bsd.sys.mk>		# for HOST_SH
      7   1.1   thorpej 
      8   1.1   thorpej S=	${.CURDIR}/../../../..
      9   1.1   thorpej 
     10   1.1   thorpej .PATH:	${.CURDIR}/../common
     11   1.1   thorpej 
     12   1.1   thorpej BINMODE= 444
     13   1.1   thorpej 
     14  1.17   tsutsui STRIP?=	strip
     15  1.23    simonb 
     16  1.23    simonb # XXX SHOULD NOT NEED TO DEFINE THESE!
     17  1.23    simonb LIBCRT0=
     18  1.33   tsutsui LIBCRTI=
     19  1.23    simonb LIBC=
     20  1.23    simonb LIBCRTBEGIN=
     21  1.23    simonb LIBCRTEND=
     22   1.1   thorpej 
     23  1.24     lukem CHECKSIZE_CMD=	SIZE=${SIZE} ${HOST_SH} ${.CURDIR}/../common/checksize.sh
     24   1.8       cgd 
     25  1.29   tsutsui realall: ${PROG}
     26   1.1   thorpej 
     27  1.10       cgd AFLAGS+=	-DASSEMBLER
     28  1.10       cgd # -I${.CURDIR}/../.. done by Makefile.inc
     29  1.10       cgd CPPFLAGS+=	-nostdinc -I${.OBJDIR} -D_STANDALONE -I${S}
     30  1.21   thorpej CFLAGS=		-ffreestanding -mno-fp-regs -g
     31  1.12       cgd 
     32  1.24     lukem NETBSD_VERS!=${HOST_SH} ${.CURDIR}/../../../../conf/osrelease.sh
     33  1.12       cgd CPPFLAGS+= -DNETBSD_VERS='"${NETBSD_VERS}"'
     34  1.10       cgd 
     35  1.28   tsutsui CWARNFLAGS+=	-Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
     36  1.28   tsutsui CFLAGS+=	-Werror ${CWARNFLAGS}
     37  1.18  jdolecek 
     38  1.18  jdolecek # if there is a 'version' file, add rule for vers.c and add it to SRCS
     39  1.18  jdolecek # and CLEANFILES
     40  1.18  jdolecek .if exists(version)
     41  1.18  jdolecek .PHONY: vers.c
     42  1.18  jdolecek vers.c: version
     43  1.31     joerg 	${HOST_SH} ${S}/conf/newvers_stand.sh ${${MKREPRO} == "yes" :?:-D} \
     44  1.31     joerg 	    -N ${.CURDIR}/version "alpha"
     45  1.18  jdolecek 
     46  1.18  jdolecek SRCS+=	vers.c
     47  1.18  jdolecek CLEANFILES+= vers.c
     48  1.10       cgd .endif
     49   1.1   thorpej 
     50   1.1   thorpej # For descriptions of regions available to bootstrap programs, see
     51   1.1   thorpej # section 3.4.1.2 (pp. III 3-14 - III 3-18) of the second edition of
     52   1.1   thorpej # the Alpha AXP Architecture Reference Manual.
     53   1.1   thorpej 
     54   1.8       cgd REGION1_START=		0x20000000		# "Region 1 start"
     55   1.8       cgd REGION1_SIZE!=		expr 256 \* 1024	# 256k
     56   1.8       cgd 
     57   1.8       cgd # our memory lauout:
     58   1.8       cgd 
     59   1.8       cgd #	'unified' boot loaders (e.g. netboot) can consume all of region
     60   1.8       cgd #	1 for their text+data, or text+data+bss.
     61   1.8       cgd 
     62   1.8       cgd UNIFIED_LOAD_ADDRESS=	${REGION1_START}
     63   1.8       cgd UNIFIED_MAX_LOAD!=	expr ${REGION1_SIZE}
     64   1.8       cgd UNIFIED_MAX_TOTAL!=	expr ${REGION1_SIZE}
     65   1.8       cgd 
     66   1.8       cgd #UNIFIED_HEAP_START=	right after secondary bss
     67   1.8       cgd UNIFIED_HEAP_LIMIT=	(${REGION1_START} + ${REGION1_SIZE})
     68   1.8       cgd 
     69   1.8       cgd #	two-stage boot loaders must share region 1.  The first stage
     70   1.8       cgd #	loads into the lowest portion, and uses the higest portion
     71   1.8       cgd #	for its heap.  The second stage loads in between the primary image
     72   1.8       cgd #	and the heap, and can reuse the memory after it (i.e. the primary's
     73   1.8       cgd #	heap) for its own heap.
     74   1.8       cgd 
     75   1.8       cgd PRIMARY_LOAD_ADDRESS=	${REGION1_START}
     76   1.8       cgd #PRIMARY_MAX_LOAD=	booter dependent, no more than ${PRIMARY_MAX_TOTAL}
     77   1.8       cgd PRIMARY_MAX_TOTAL!=	expr 16 \* 1024
     78   1.8       cgd 
     79   1.8       cgd # XXX SECONDARY_LOAD_ADDRESS should be
     80   1.8       cgd # XXX (${PRIMARY_LOAD_ADDRESS} + ${PRIMARY_MAX_TOTAL}) bt there's no easy
     81   1.8       cgd # XXX way to do that calculation and 'ld' wants a single number.
     82   1.8       cgd SECONDARY_LOAD_ADDRESS=	0x20004000	# XXX
     83   1.8       cgd SECONDARY_MAX_LOAD!=	expr 112 \* 1024
     84   1.8       cgd SECONDARY_MAX_TOTAL!=	expr ${REGION1_SIZE} - ${PRIMARY_MAX_TOTAL}
     85   1.8       cgd 
     86   1.8       cgd PRIMARY_HEAP_START=	(${SECONDARY_LOAD_ADDRESS} + ${SECONDARY_MAX_LOAD})
     87   1.8       cgd PRIMARY_HEAP_LIMIT=	(${REGION1_START} + ${REGION1_SIZE})
     88   1.8       cgd 
     89   1.8       cgd #SECONDARY_HEAP_START=	right after secondary bss
     90   1.8       cgd SECONDARY_HEAP_LIMIT=	(${REGION1_START} + ${REGION1_SIZE})
     91   1.1   thorpej 
     92  1.13       cgd #	standalone programs are like kernels.  They load at
     93  1.13       cgd #	0xfffffc0000300000 and can use the rest of memory.
     94  1.13       cgd 
     95  1.13       cgd STANDPROG_LOAD_ADDRESS=	0xfffffc0000300000
     96  1.13       cgd 
     97  1.13       cgd 
     98  1.19   thorpej FILE_FORMAT_CPPFLAGS=	-DBOOT_ECOFF -DBOOT_ELF64
     99   1.1   thorpej 
    100   1.8       cgd UNIFIED_CPPFLAGS=	-DUNIFIED_BOOTBLOCK \
    101   1.8       cgd 			-DHEAP_LIMIT="${UNIFIED_HEAP_LIMIT}" \
    102   1.9      ross 			${FILE_FORMAT_CPPFLAGS}
    103   1.8       cgd 
    104   1.8       cgd PRIMARY_CPPFLAGS=	-DPRIMARY_BOOTBLOCK \
    105   1.8       cgd 			-DSECONDARY_LOAD_ADDRESS="${SECONDARY_LOAD_ADDRESS}" \
    106   1.8       cgd 			-DSECONDARY_MAX_LOAD="${SECONDARY_MAX_LOAD}" \
    107   1.8       cgd 			-DHEAP_LIMIT="${PRIMARY_HEAP_LIMIT}" \
    108   1.8       cgd 			-DHEAP_START="${PRIMARY_HEAP_START}"
    109   1.8       cgd 
    110   1.8       cgd SECONDARY_CPPFLAGS=	-DSECONDARY_BOOTBLOCK \
    111   1.8       cgd 			-DHEAP_LIMIT="${SECONDARY_HEAP_LIMIT}" \
    112   1.9      ross 			${FILE_FORMAT_CPPFLAGS}
    113  1.13       cgd 
    114  1.13       cgd STANDPROG_CPPFLAGS=	-DSTANDALONE_PROGRAM
    115   1.8       cgd 
    116   1.1   thorpej .include <bsd.prog.mk>
    117  1.29   tsutsui .include <bsd.klinks.mk>
    118  1.20     lukem 
    119  1.30   tsutsui STRIPFLAG=	# override values in ${MAKECONF}
    120  1.20     lukem COPTS+=-Os	# override -O supplied by user
    121   1.1   thorpej 
    122   1.1   thorpej ### find out what to use for libkern
    123   1.1   thorpej KERN_AS=	library
    124   1.1   thorpej .include "${S}/lib/libkern/Makefile.inc"
    125   1.1   thorpej LIBKERN=	${KERNLIB}
    126   1.1   thorpej 
    127   1.1   thorpej ### find out what to use for libz
    128   1.1   thorpej Z_AS=		library
    129   1.1   thorpej .include "${S}/lib/libz/Makefile.inc"
    130   1.1   thorpej LIBZ=		${ZLIB}
    131   1.1   thorpej 
    132   1.1   thorpej ### find out what to use for libsa
    133   1.1   thorpej SA_AS=		library
    134  1.26    simonb SAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes
    135   1.1   thorpej .include "${S}/lib/libsa/Makefile.inc"
    136   1.1   thorpej LIBSA=		${SALIB}
    137