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