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