Makefile.bootprogs revision 1.23
11.23Ssimonb# $NetBSD: Makefile.bootprogs,v 1.23 2003/10/08 01:40:22 simonb Exp $
21.1Sthorpej
31.1SthorpejS=	${.CURDIR}/../../../..
41.1Sthorpej
51.1Sthorpej.PATH:	${.CURDIR}/../common
61.1Sthorpej
71.1SthorpejSTRIPFLAG=
81.1SthorpejBINMODE= 444
91.1Sthorpej
101.17StsutsuiSTRIP?=	strip
111.23Ssimonb
121.23Ssimonb# XXX SHOULD NOT NEED TO DEFINE THESE!
131.23SsimonbLIBCRT0=
141.23SsimonbLIBC=
151.23SsimonbLIBCRTBEGIN=
161.23SsimonbLIBCRTEND=
171.1Sthorpej
181.8ScgdCHECKSIZE_CMD=	SIZE=${SIZE} sh ${.CURDIR}/../common/checksize.sh
191.8Scgd
201.1Sthorpej.PHONY: machine-links
211.1Sthorpejbeforedepend: machine-links
221.1Sthorpej# ${MACHINE} then ${MACHINE_ARCH}
231.1Sthorpejmachine-links:
241.1Sthorpej	-rm -f machine && \
251.1Sthorpej	    ln -s $S/arch/alpha/include machine
261.1Sthorpej	-rm -f alpha && \
271.1Sthorpej	    ln -s $S/arch/alpha/include alpha
281.1SthorpejCLEANFILES+=machine alpha
291.1Sthorpej
301.16Smycroftrealall: machine-links ${PROG}
311.1Sthorpej
321.10ScgdAFLAGS+=	-DASSEMBLER
331.10Scgd# -I${.CURDIR}/../.. done by Makefile.inc
341.10ScgdCPPFLAGS+=	-nostdinc -I${.OBJDIR} -D_STANDALONE -I${S}
351.21SthorpejCFLAGS=		-ffreestanding -mno-fp-regs -g
361.12Scgd
371.12ScgdNETBSD_VERS!=sh ${.CURDIR}/../../../../conf/osrelease.sh
381.12ScgdCPPFLAGS+= -DNETBSD_VERS='"${NETBSD_VERS}"'
391.10Scgd
401.10ScgdCWARNFLAGS+=	-Wno-main
411.18Sjdolecek
421.18Sjdolecek# if there is a 'version' file, add rule for vers.c and add it to SRCS
431.18Sjdolecek# and CLEANFILES
441.18Sjdolecek.if exists(version)
451.18Sjdolecek.PHONY: vers.c
461.18Sjdolecekvers.c: version
471.18Sjdolecek	sh ${S}/conf/newvers_stand.sh -N ${.CURDIR}/version "alpha"
481.18Sjdolecek
491.18SjdolecekSRCS+=	vers.c
501.18SjdolecekCLEANFILES+= vers.c
511.10Scgd.endif
521.1Sthorpej
531.1Sthorpej# For descriptions of regions available to bootstrap programs, see
541.1Sthorpej# section 3.4.1.2 (pp. III 3-14 - III 3-18) of the second edition of
551.1Sthorpej# the Alpha AXP Architecture Reference Manual.
561.1Sthorpej
571.8ScgdREGION1_START=		0x20000000		# "Region 1 start"
581.8ScgdREGION1_SIZE!=		expr 256 \* 1024	# 256k
591.8Scgd
601.8Scgd# our memory lauout:
611.8Scgd
621.8Scgd#	'unified' boot loaders (e.g. netboot) can consume all of region
631.8Scgd#	1 for their text+data, or text+data+bss.
641.8Scgd
651.8ScgdUNIFIED_LOAD_ADDRESS=	${REGION1_START}
661.8ScgdUNIFIED_MAX_LOAD!=	expr ${REGION1_SIZE}
671.8ScgdUNIFIED_MAX_TOTAL!=	expr ${REGION1_SIZE}
681.8Scgd
691.8Scgd#UNIFIED_HEAP_START=	right after secondary bss
701.8ScgdUNIFIED_HEAP_LIMIT=	(${REGION1_START} + ${REGION1_SIZE})
711.8Scgd
721.8Scgd#	two-stage boot loaders must share region 1.  The first stage
731.8Scgd#	loads into the lowest portion, and uses the higest portion
741.8Scgd#	for its heap.  The second stage loads in between the primary image
751.8Scgd#	and the heap, and can reuse the memory after it (i.e. the primary's
761.8Scgd#	heap) for its own heap.
771.8Scgd
781.8ScgdPRIMARY_LOAD_ADDRESS=	${REGION1_START}
791.8Scgd#PRIMARY_MAX_LOAD=	booter dependent, no more than ${PRIMARY_MAX_TOTAL}
801.8ScgdPRIMARY_MAX_TOTAL!=	expr 16 \* 1024
811.8Scgd
821.8Scgd# XXX SECONDARY_LOAD_ADDRESS should be
831.8Scgd# XXX (${PRIMARY_LOAD_ADDRESS} + ${PRIMARY_MAX_TOTAL}) bt there's no easy
841.8Scgd# XXX way to do that calculation and 'ld' wants a single number.
851.8ScgdSECONDARY_LOAD_ADDRESS=	0x20004000	# XXX
861.8ScgdSECONDARY_MAX_LOAD!=	expr 112 \* 1024
871.8ScgdSECONDARY_MAX_TOTAL!=	expr ${REGION1_SIZE} - ${PRIMARY_MAX_TOTAL}
881.8Scgd
891.8ScgdPRIMARY_HEAP_START=	(${SECONDARY_LOAD_ADDRESS} + ${SECONDARY_MAX_LOAD})
901.8ScgdPRIMARY_HEAP_LIMIT=	(${REGION1_START} + ${REGION1_SIZE})
911.8Scgd
921.8Scgd#SECONDARY_HEAP_START=	right after secondary bss
931.8ScgdSECONDARY_HEAP_LIMIT=	(${REGION1_START} + ${REGION1_SIZE})
941.1Sthorpej
951.13Scgd#	standalone programs are like kernels.  They load at
961.13Scgd#	0xfffffc0000300000 and can use the rest of memory.
971.13Scgd
981.13ScgdSTANDPROG_LOAD_ADDRESS=	0xfffffc0000300000
991.13Scgd
1001.13Scgd
1011.19SthorpejFILE_FORMAT_CPPFLAGS=	-DBOOT_ECOFF -DBOOT_ELF64
1021.1Sthorpej
1031.8ScgdUNIFIED_CPPFLAGS=	-DUNIFIED_BOOTBLOCK \
1041.8Scgd			-DHEAP_LIMIT="${UNIFIED_HEAP_LIMIT}" \
1051.9Sross			${FILE_FORMAT_CPPFLAGS}
1061.8Scgd
1071.8ScgdPRIMARY_CPPFLAGS=	-DPRIMARY_BOOTBLOCK \
1081.8Scgd			-DSECONDARY_LOAD_ADDRESS="${SECONDARY_LOAD_ADDRESS}" \
1091.8Scgd			-DSECONDARY_MAX_LOAD="${SECONDARY_MAX_LOAD}" \
1101.8Scgd			-DHEAP_LIMIT="${PRIMARY_HEAP_LIMIT}" \
1111.8Scgd			-DHEAP_START="${PRIMARY_HEAP_START}"
1121.8Scgd
1131.8ScgdSECONDARY_CPPFLAGS=	-DSECONDARY_BOOTBLOCK \
1141.8Scgd			-DHEAP_LIMIT="${SECONDARY_HEAP_LIMIT}" \
1151.9Sross			${FILE_FORMAT_CPPFLAGS}
1161.13Scgd
1171.13ScgdSTANDPROG_CPPFLAGS=	-DSTANDALONE_PROGRAM
1181.8Scgd
1191.1Sthorpej.include <bsd.prog.mk>
1201.20Slukem
1211.20SlukemCOPTS+=-Os	# override -O supplied by user
1221.1Sthorpej
1231.1Sthorpej### find out what to use for libkern
1241.1SthorpejKERN_AS=	library
1251.1Sthorpej.include "${S}/lib/libkern/Makefile.inc"
1261.1SthorpejLIBKERN=	${KERNLIB}
1271.1Sthorpej
1281.1Sthorpej### find out what to use for libz
1291.1SthorpejZ_AS=		library
1301.1Sthorpej.include "${S}/lib/libz/Makefile.inc"
1311.1SthorpejLIBZ=		${ZLIB}
1321.1Sthorpej
1331.1Sthorpej### find out what to use for libsa
1341.1SthorpejSA_AS=		library
1351.14SrossSAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes"
1361.1Sthorpej.include "${S}/lib/libsa/Makefile.inc"
1371.1SthorpejLIBSA=		${SALIB}
138