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