11.42Stsutsui#	$NetBSD: Makefile.buildboot,v 1.42 2025/05/26 17:57:16 tsutsui Exp $
21.13Ssimonb
31.13Ssimonb# RELOC=FFF00000 allows for boot prog up to FF000 (1044480) bytes long
41.13SsimonbRELOC=	FFF00000
51.1Sthorpej
61.1SthorpejS=		${.CURDIR}/../../../..
71.1Sthorpej
81.1Sthorpej.PATH: ${.CURDIR}/../common
91.1Sthorpej
101.39StsutsuiPROG=		${PROGELF}.lif
111.24StsutsuiWARNS?=		1
121.1Sthorpej
131.1SthorpejSRCS=		${COMMONSOURCE} ${DRIVERSOURCE} ${PROGSOURCE}
141.18StvNOMAN=		# defined
151.3SthorpejSTRIPFLAG=
161.1SthorpejBINMODE=	444
171.1Sthorpej
181.39StsutsuiCLEANFILES+=	${PROGELF}
191.1Sthorpej
201.10SfrueaufCPPFLAGS+=	-I${.CURDIR}/../../.. -I${.CURDIR}/../../../..  -I${.OBJDIR}
211.13SsimonbCPPFLAGS+=	-Wno-main
221.23StsutsuiCPPFLAGS+=	-D__daddr_t=int32_t
231.37StsutsuiCFLAGS=		-Os -fno-unwind-tables -msoft-float -ffreestanding
241.1Sthorpej
251.21Ssimonb# XXX SHOULD NOT NEED TO DEFINE THESE!
261.21SsimonbLIBCRT0=
271.33StsutsuiLIBCRTI=
281.21SsimonbLIBC=
291.21SsimonbLIBCRTBEGIN=
301.21SsimonbLIBCRTEND=
311.12Ssimonb
321.38Schristos.if ${MKREPRO_TIMESTAMP:Uno} != "no"
331.38SchristosHP300MKBOOT_TIMESTAMP=-t "${MKREPRO_TIMESTAMP}"
341.38Schristos.endif
351.38Schristos
361.39Stsutsui${PROG}: ${PROGELF}
371.39Stsutsui	${OBJCOPY} --output-target=binary ${PROGELF} ${PROGELF}.bin
381.39Stsutsui	${TOOL_HP300MKBOOT} -l 0x${RELOC} ${HP300MKBOOT_TIMESTAMP} ${PROGELF}.bin ${PROG}
391.39Stsutsui	rm -f ${PROGELF}.bin
401.13Ssimonb
411.36Schristos.include "${S}/conf/newvers_stand.mk"
421.36Schristos
431.13SsimonbCPPFLAGS+=		-DDCACONSOLE -DAPCICONSOLE -DITECONSOLE -DDCMCONSOLE
441.13SsimonbCPPFLAGS+=		-DHIL_KEYBOARD -DUK_KEYBOARD
451.13SsimonbCPPFLAGS+=		-DDOMAIN_KEYBOARD
461.42StsutsuiCPPFLAGS+=		-D_STANDALONE -Dhp300
471.13SsimonbCPPFLAGS+=		-DCOMPAT_UFS -DNO_LSEEK
481.35StsutsuiCPPFLAGS+=		-DLIBSA_CREAD_NOCRC
491.40StsutsuiCPPFLAGS+=		-DBBC_SLOW_GETSECS
501.17Sgmcgarry
511.17Sgmcgarry# if sun bootparams is desired
521.17Sgmcgarry#CPPFLAGS+=     -DSUN_BOOTPARAMS
531.13Ssimonb
541.13Ssimonb# Limit the alloc() heap to below the msgbuf and ROM scratch pages.
551.13SsimonbCPPFLAGS+=		-DHEAP_LIMIT="0xffffdfff"
561.13Ssimonb
571.13SsimonbCOMMONSOURCE=		srt0.S autoconf.c clock.c conf.c cons.c devopen.c \
581.19Sgmcgarry			exec.c machdep.c prf.c rawfs.c netio.c
591.13SsimonbDRIVERSOURCE=		apci.c ct.c dca.c dcm.c dnkbd.c fhpib.c hil.c \
601.41Stsutsui			hpib.c if_le.c ite.c ite_dv.c ite_gb.c \
611.32Stsutsui			ite_hy.c ite_rb.c ite_subr.c ite_tc.c ite_tvrx.c \
621.34Stsutsui			ite_sti.c \
631.31Stsutsui			kbd.c kbdconf.c nhpib.c rd.c scsi.c sd.c
641.13Ssimonb
651.16Stv.include <bsd.own.mk>
661.28Stsutsui.include <bsd.klinks.mk>
671.1Sthorpej.include <bsd.prog.mk>
681.1Sthorpej
691.7Sthorpej### find out what to use for libkern
701.7SthorpejKERN_AS=	library
711.7Sthorpej.include "${S}/lib/libkern/Makefile.inc"
721.7SthorpejLIBKERN=	${KERNLIB}
731.7Sthorpej
741.2Sthorpej### find out what to use for libz
751.2SthorpejZ_AS=		library
761.2Sthorpej.include "${S}/lib/libz/Makefile.inc"
771.2SthorpejLIBZ=		${ZLIB}
781.2Sthorpej
791.1Sthorpej### find out what to use for libsa
801.1SthorpejSA_AS=		library
811.8SthorpejSAMISCMAKEFLAGS+="SA_USE_CREAD=yes"
821.8SthorpejSAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes"
831.1Sthorpej.include "${S}/lib/libsa/Makefile.inc"
841.1SthorpejLIBSA=		${SALIB}
851.1Sthorpej
861.39Stsutsui${PROGELF}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
871.39Stsutsui	${LD} -N -Ttext ${RELOC} -e begin -o ${PROGELF} \
881.12Ssimonb	    ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
891.39Stsutsui	@${SIZE} ${PROGELF}
901.39Stsutsui	@echo ${PROGELF} total size should not exceed 1044480 bytes
91