Makefile.bootprogs revision 1.1
11.1Scgd# $NetBSD: Makefile.bootprogs,v 1.1 2002/11/09 06:20:37 cgd Exp $
21.1Scgd
31.1ScgdS=	${.CURDIR}/../../../..
41.1Scgd
51.1Scgd.PATH:	${.CURDIR}/../common
61.1Scgd
71.1ScgdSTRIPFLAG=
81.1ScgdBINMODE= 444
91.1Scgd
101.1ScgdSTRIP?=	strip
111.1Scgd
121.1ScgdCHECKSIZE_CMD=	SIZE=${SIZE} sh ${.CURDIR}/../common/checksize.sh
131.1Scgd
141.1Scgd.PHONY: machine-links
151.1Scgdbeforedepend: machine-links
161.1Scgd# ${MACHINE} then ${MACHINE_ARCH}
171.1Scgdmachine-links:
181.1Scgd	-rm -f machine && \
191.1Scgd	    ln -s $S/arch/sbmips/include machine
201.1Scgd	-rm -f mips && \
211.1Scgd	    ln -s $S/arch/mips/include mips
221.1ScgdCLEANFILES+=machine mips
231.1Scgd
241.1Scgdrealall: machine-links ${PROG}
251.1Scgd
261.1ScgdAFLAGS+=	-DASSEMBLER -D_LOCORE
271.1Scgd# -I${.CURDIR}/../.. done by Makefile.inc
281.1ScgdCPPFLAGS+=	-nostdinc -I${.OBJDIR} -D_STANDALONE -I${S}
291.1ScgdCFLAGS=		-Os -g -ffreestanding -mno-abicalls -mno-half-pic -G 0
301.1Scgd
311.1ScgdNETBSD_VERS!=sh ${.CURDIR}/../../../../conf/osrelease.sh
321.1ScgdCPPFLAGS+= -DNETBSD_VERS='"${NETBSD_VERS}"'
331.1Scgd
341.1ScgdCWARNFLAGS+=	-Wno-main 
351.1Scgd
361.1Scgd# if there is a 'version' file, add rule for vers.c and add it to SRCS
371.1Scgd# and CLEANFILES
381.1Scgd.if exists(version)
391.1Scgd.PHONY: vers.c
401.1Scgdvers.c: version
411.1Scgd	sh ${S}/conf/newvers_stand.sh -N ${.CURDIR}/version "sbmips"
421.1Scgd
431.1ScgdSRCS+=	vers.c
441.1ScgdCLEANFILES+= vers.c
451.1Scgd.endif
461.1Scgd
471.1Scgd# 
481.1Scgd# Refer to CFE documentation for a description of these regions.
491.1Scgd# 
501.1Scgd
511.1ScgdREGION1_START=		0x20000000		# "Region 1 start"
521.1ScgdREGION1_SIZE!=		expr 256 \* 1024	# 256k
531.1Scgd
541.1Scgd# our memory lauout:
551.1Scgd
561.1Scgd#	'unified' boot loaders (e.g. netboot) can consume all of region
571.1Scgd#	1 for their text+data, or text+data+bss.
581.1Scgd
591.1ScgdUNIFIED_LOAD_ADDRESS=	${REGION1_START}
601.1ScgdUNIFIED_MAX_LOAD!=	expr ${REGION1_SIZE}
611.1ScgdUNIFIED_MAX_TOTAL!=	expr ${REGION1_SIZE}
621.1Scgd
631.1Scgd#UNIFIED_HEAP_START=	right after secondary bss
641.1ScgdUNIFIED_HEAP_LIMIT=	(${REGION1_START} + ${REGION1_SIZE})
651.1Scgd
661.1Scgd#	two-stage boot loaders must share region 1.  The first stage
671.1Scgd#	loads into the lowest portion, and uses the higest portion
681.1Scgd#	for its heap.  The second stage loads in between the primary image
691.1Scgd#	and the heap, and can reuse the memory after it (i.e. the primary's
701.1Scgd#	heap) for its own heap.
711.1Scgd
721.1ScgdPRIMARY_LOAD_ADDRESS=	${REGION1_START}
731.1Scgd#PRIMARY_MAX_LOAD=	booter dependent, no more than ${PRIMARY_MAX_TOTAL}
741.1ScgdPRIMARY_MAX_TOTAL!=	expr 16 \* 1024
751.1Scgd
761.1Scgd# XXX SECONDARY_LOAD_ADDRESS should be
771.1Scgd# XXX (${PRIMARY_LOAD_ADDRESS} + ${PRIMARY_MAX_TOTAL}) bt there's no easy
781.1Scgd# XXX way to do that calculation and 'ld' wants a single number.
791.1ScgdSECONDARY_LOAD_ADDRESS=	0x20004000	# XXX
801.1ScgdSECONDARY_MAX_LOAD!=	expr 112 \* 1024
811.1ScgdSECONDARY_MAX_TOTAL!=	expr ${REGION1_SIZE} - ${PRIMARY_MAX_TOTAL}
821.1Scgd
831.1ScgdPRIMARY_HEAP_START=	(${SECONDARY_LOAD_ADDRESS} + ${SECONDARY_MAX_LOAD})
841.1ScgdPRIMARY_HEAP_LIMIT=	(${REGION1_START} + ${REGION1_SIZE})
851.1Scgd
861.1Scgd#SECONDARY_HEAP_START=	right after secondary bss
871.1ScgdSECONDARY_HEAP_LIMIT=	(${REGION1_START} + ${REGION1_SIZE})
881.1Scgd
891.1Scgd#	standalone programs are like kernels.  They load at
901.1Scgd#	0xfffffc0000300000 and can use the rest of memory.
911.1Scgd
921.1ScgdSTANDPROG_LOAD_ADDRESS=	0xfffffc0000300000
931.1Scgd
941.1Scgd
951.1ScgdFILE_FORMAT_CPPFLAGS=	-DBOOT_ECOFF -DBOOT_ELF
961.1Scgd
971.1ScgdUNIFIED_CPPFLAGS=	-DUNIFIED_BOOTBLOCK \
981.1Scgd			-DHEAP_LIMIT="${UNIFIED_HEAP_LIMIT}" \
991.1Scgd			${FILE_FORMAT_CPPFLAGS}
1001.1Scgd
1011.1ScgdPRIMARY_CPPFLAGS=	-DPRIMARY_BOOTBLOCK \
1021.1Scgd			-DSECONDARY_LOAD_ADDRESS="${SECONDARY_LOAD_ADDRESS}" \
1031.1Scgd			-DSECONDARY_MAX_LOAD="${SECONDARY_MAX_LOAD}" \
1041.1Scgd			-DHEAP_LIMIT="${PRIMARY_HEAP_LIMIT}" \
1051.1Scgd			-DHEAP_START="${PRIMARY_HEAP_START}"
1061.1Scgd
1071.1ScgdSECONDARY_CPPFLAGS=	-DSECONDARY_BOOTBLOCK \
1081.1Scgd			-DHEAP_LIMIT="${SECONDARY_HEAP_LIMIT}" \
1091.1Scgd			${FILE_FORMAT_CPPFLAGS}
1101.1Scgd
1111.1ScgdSTANDPROG_CPPFLAGS=	-DSTANDALONE_PROGRAM
1121.1Scgd
1131.1Scgd.include <bsd.prog.mk>
1141.1Scgd
1151.1Scgd### find out what to use for libkern
1161.1ScgdKERN_AS=	library
1171.1Scgd.include "${S}/lib/libkern/Makefile.inc"
1181.1ScgdLIBKERN=	${KERNLIB}
1191.1Scgd
1201.1Scgd### find out what to use for libz
1211.1ScgdZ_AS=		library
1221.1Scgd.include "${S}/lib/libz/Makefile.inc"
1231.1ScgdLIBZ=		${ZLIB}
1241.1Scgd
1251.1Scgd### find out what to use for libsa
1261.1ScgdSA_AS=		library
1271.1ScgdSAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes"
1281.1Scgd.include "${S}/lib/libsa/Makefile.inc"
1291.1ScgdLIBSA=		${SALIB}
1301.1Scgd
1311.1Scgd
1321.1Scgd/usr/lib/crt0.o:
1331.1Scgd	true
1341.1Scgd
1351.1Scgd/usr/lib/crtbegin.o:
1361.1Scgd	true
1371.1Scgd
1381.1Scgd/usr/lib/crtend.o:
1391.1Scgd	true
1401.1Scgd
1411.1Scgdcleandir: cleandirlocal
1421.1Scgdcleandirlocal:
1431.1Scgd	rm -rf lib
144