head	1.10;
access;
symbols
	netbsd-9-5-RELEASE:1.1
	netbsd-11-0-RELEASE:1.7
	netbsd-11-0-RC7:1.7
	netbsd-11-0-RC6:1.7
	netbsd-11-0-RC5:1.7
	netbsd-11-0-RC4:1.7
	netbsd-11-0-RC3:1.7
	netbsd-11-0-RC2:1.7
	netbsd-11-0-RC1:1.7
	perseant-exfatfs-base-20250801:1.7
	netbsd-11:1.7.0.2
	netbsd-11-base:1.7
	netbsd-10-1-RELEASE:1.3
	perseant-exfatfs-base-20240630:1.4
	perseant-exfatfs:1.4.0.2
	perseant-exfatfs-base:1.4
	netbsd-8-3-RELEASE:1.1
	netbsd-9-4-RELEASE:1.1
	netbsd-10-0-RELEASE:1.3
	netbsd-10-0-RC6:1.3
	netbsd-10-0-RC5:1.3
	netbsd-10-0-RC4:1.3
	netbsd-10-0-RC3:1.3
	netbsd-10-0-RC2:1.3
	netbsd-10-0-RC1:1.3
	netbsd-10:1.3.0.2
	netbsd-10-base:1.3
	netbsd-9-3-RELEASE:1.1
	cjep_sun2x-base1:1.1
	cjep_sun2x:1.1.0.24
	cjep_sun2x-base:1.1
	cjep_staticlib_x-base1:1.1
	netbsd-9-2-RELEASE:1.1
	cjep_staticlib_x:1.1.0.22
	cjep_staticlib_x-base:1.1
	netbsd-9-1-RELEASE:1.1
	phil-wifi-20200421:1.1
	phil-wifi-20200411:1.1
	is-mlppp:1.1.0.20
	is-mlppp-base:1.1
	phil-wifi-20200406:1.1
	netbsd-8-2-RELEASE:1.1
	netbsd-9-0-RELEASE:1.1
	netbsd-9-0-RC2:1.1
	netbsd-9-0-RC1:1.1
	phil-wifi-20191119:1.1
	netbsd-9:1.1.0.18
	netbsd-9-base:1.1
	phil-wifi-20190609:1.1
	netbsd-8-1-RELEASE:1.1
	netbsd-8-1-RC1:1.1
	pgoyette-compat-merge-20190127:1.1
	pgoyette-compat-20190127:1.1
	pgoyette-compat-20190118:1.1
	pgoyette-compat-1226:1.1
	pgoyette-compat-1126:1.1
	pgoyette-compat-1020:1.1
	pgoyette-compat-0930:1.1
	pgoyette-compat-0906:1.1
	pgoyette-compat-0728:1.1
	netbsd-8-0-RELEASE:1.1
	phil-wifi:1.1.0.16
	phil-wifi-base:1.1
	pgoyette-compat-0625:1.1
	netbsd-8-0-RC2:1.1
	pgoyette-compat-0521:1.1
	pgoyette-compat-0502:1.1
	pgoyette-compat-0422:1.1
	netbsd-8-0-RC1:1.1
	pgoyette-compat-0415:1.1
	pgoyette-compat-0407:1.1
	pgoyette-compat-0330:1.1
	pgoyette-compat-0322:1.1
	pgoyette-compat-0315:1.1
	pgoyette-compat:1.1.0.14
	pgoyette-compat-base:1.1
	matt-nb8-mediatek:1.1.0.12
	matt-nb8-mediatek-base:1.1
	perseant-stdc-iso10646:1.1.0.10
	perseant-stdc-iso10646-base:1.1
	netbsd-8:1.1.0.8
	netbsd-8-base:1.1
	prg-localcount2-base3:1.1
	prg-localcount2-base2:1.1
	prg-localcount2-base1:1.1
	prg-localcount2:1.1.0.6
	prg-localcount2-base:1.1
	pgoyette-localcount-20170426:1.1
	bouyer-socketcan-base1:1.1
	pgoyette-localcount-20170320:1.1
	bouyer-socketcan:1.1.0.4
	bouyer-socketcan-base:1.1
	pgoyette-localcount-20170107:1.1
	pgoyette-localcount-20161104:1.1
	localcount-20160914:1.1
	pgoyette-localcount-20160806:1.1
	pgoyette-localcount-20160726:1.1
	pgoyette-localcount:1.1.0.2
	pgoyette-localcount-base:1.1;
locks; strict;
comment	@# @;


1.10
date	2026.09.08.04.49.53;	author rxg;	state Exp;
branches;
next	1.9;
commitid	m51Yhq5B5vOh5MUG;

1.9
date	2026.09.08.02.48.06;	author rxg;	state Exp;
branches;
next	1.8;
commitid	8jFBhatArEGPpLUG;

1.8
date	2026.08.02.02.59.14;	author brook;	state Exp;
branches;
next	1.7;
commitid	qPHqZG1U82LmF0QG;

1.7
date	2025.03.22.09.25.14;	author hgutch;	state Exp;
branches;
next	1.6;
commitid	c4Cs3lkS38emJ2OF;

1.6
date	2025.01.11.14.33.31;	author jmmv;	state Exp;
branches;
next	1.5;
commitid	JNXUfYPidtyOL4FF;

1.5
date	2024.12.29.09.46.44;	author jmmv;	state Exp;
branches;
next	1.4;
commitid	SMRsHmmHTKgOBnDF;

1.4
date	2023.05.07.12.41.46;	author skrll;	state Exp;
branches
	1.4.2.1;
next	1.3;
commitid	W1X4g8g57obtV1oE;

1.3
date	2021.10.04.06.50.35;	author skrll;	state Exp;
branches;
next	1.2;
commitid	G8O6Fv5DOuxUCsbD;

1.2
date	2021.10.01.10.38.03;	author jmcneill;	state Exp;
branches;
next	1.1;
commitid	y8dGb9Ujmw4KY5bD;

1.1
date	2014.09.19.17.36.24;	author matt;	state Exp;
branches;
next	;
commitid	JJ0aTqraqNg8SYQx;

1.4.2.1
date	2025.08.02.05.20.44;	author perseant;	state Exp;
branches;
next	;
commitid	23j6GFaDws3O875G;


desc
@@


1.10
log
@
s/SNAP_MD_POST_DEPS/SNAP_MD_POST_DEPS_IMGZ/ for smp_riscv64mbr
@
text
@#	$NetBSD: Makefile.inc,v 1.9 2026/09/08 02:48:06 rxg Exp $
#
#	etc.riscv/Makefile.inc -- riscv-specific etc Makefile targets
#

.if ${MACHINE_ARCH} == "riscv64"
KERNEL_SETS=		GENERIC64
.else
KERNEL_SETS=		GENERIC
.endif

# Support for mkimage
MKIMAGE= 	${NETBSDSRCDIR}/distrib/utils/embedded/mkimage
IMAGE.rel=      ${RELEASEDIR}/${RELEASEMACHINEDIR}
IMAGE.dir=      ${IMAGE.rel}/binary/gzimg
IMAGE.kern=     ${IMAGE.rel}/binary/kernel

__mkimage: .USE
	TOOL_MAKE=${MAKE} \
	TOOL_MAKEFS=${TOOL_MAKEFS} \
	TOOL_DISKLABEL=${TOOL_DISKLABEL} \
	TOOL_FDISK=${TOOL_FDISK} \
	TOOL_GPT=${TOOL_GPT} \
	TOOL_GZIP=${TOOL_GZIP} \
	TOOL_MKNOD=${TOOL_MKNOD} \
	TOOL_PAX=${TOOL_PAX} \
	TOOL_MTREE=${TOOL_MTREE} \
	TOOL_SED=${TOOL_SED} \
	TOOL_PWD_MKDB=${TOOL_PWD_MKDB} \
	HOST_SH=${HOST_SH} \
	KERNOBJDIR=${KERNOBJDIR} \
	MACHINE=${MACHINE} \
	MKDTB=${MKDTB} \
	MKPOSTFIX=${MKPOSTFIX} \
	${HOST_SH} ${MKIMAGE} -h ${.TARGET:S/smp_//} -D ${DESTDIR} \
            -S ${NETBSDSRCDIR} ${MKI_OPTS.${.TARGET}} \
            ${IMAGE.dir}/${.TARGET:S/smp_//}.img.gz
	for hash in ${HASHES}; do \
		(cd ${IMAGE.dir} && ${TOOL_CKSUM} -a $${hash} ${.TARGET:S/smp_//}.img.gz > ${.TARGET:S/smp_//}.img.gz.$${hash}) \
	done


.if ${MACHINE_ARCH} == "riscv64"
.if ${HAVE_UEFI} == "yes"
smp_efibootriscv64:
	cd ${KERNSRCDIR}/stand/efiboot/bootriscv64 && ${MAKE} release
	${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/misc '*.efi'
SNAP_MD_POST_DEPS+=	smp_efibootriscv64
INSTALLATION_DIRS+=	installation/misc
.endif

smp_riscv64: __mkimage
MKI_OPTS.smp_riscv64=		-K ${IMAGE.kern}
SNAP_MD_POST_DEPS_IMGZ+=	smp_riscv64
smp_riscv64mbr: __mkimage
MKI_OPTS.smp_riscv64mbr=	-K ${IMAGE.kern}
SNAP_MD_POST_DEPS_IMGZ+=	smp_riscv64mbr
.endif


.if ${MACHINE_ARCH} == "riscv32"
smp_riscv32: __mkimage
MKI_OPTS.smp_riscv32=		-K ${IMAGE.kern}
SNAP_MD_POST_DEPS_IMGZ+=	smp_riscv32
.endif


smp_hashes:
	@@echo "===> Making hash files: ${HASHES}"
.for hash in ${HASHES}
	cat ${IMAGE.dir}/*.${hash} > ${IMAGE.dir}/${hash} \
	&& rm -f ${IMAGE.dir}/*.${hash}
.endfor
SNAP_MD_POST_DEPS_HASHES+=	smp_hashes

snap_md_post_images: ${SNAP_MD_POST_DEPS_IMGZ} .WAIT ${SNAP_MD_POST_DEPS_HASHES}

snap_md_post: check_DESTDIR check_RELEASEDIR snap_post .WAIT ${SNAP_MD_POST_DEPS} snap_md_post_images

INSTALLATION_DIRS+=	binary/gzimg		\
			installation/instkernel
@


1.9
log
@
Add RISCV64 MBR image, OK'd by skrll@@.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.inc,v 1.8 2026/08/02 02:59:14 brook Exp $
d57 1
a57 1
SNAP_MD_POST_DEPS+=		smp_riscv64mbr
@


1.8
log
@PR install/59195 and PR port-evbmips/60302: fix hashes in gzimg directories

Hashes in gzimg directories for some ports either correspond to the
wrong (i.e., uncompressed) files or do not cover all files.  These
problems are described in PR install/59195 and PR port-evbmips/60302,
respectively.  The potential solution offered for PR 59195 does not
work if multiple image files exist in a single gzimg directory.

The correct solution involves three aspects: (i) make checksums
independently of mkimage, which allows a common list of hashes in
etc/Makefile, (ii) for directories producing more than one compressed
image, make checksums in individual temporary files, one per
compressed image, to combine at the end, and (iii) add make targets to
allow parallelism across multiple images within each directory.

This patch implements those steps for the evbarm, evbmips, evbppc, and
riscv ports, which were the only ones previously using mkimage for
checksums.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.inc,v 1.7 2025/03/22 09:25:14 hgutch Exp $
d55 3
@


1.7
log
@Also generate hashes for files in gzimg directories.

At one point this should probably be unified at least a bit with the hash
generation of regular sets, so that there is a single place that defines
the types of hashes generated for sets and gzimg.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.inc,v 1.6 2025/01/11 14:33:31 jmmv Exp $
a17 2
#	TOOL_MKUBOOTIMAGE=${TOOL_MKUBOOTIMAGE} \

a34 2
	CKSUM=${CKSUM} \
	IMAGEDIR=${IMAGE.dir} \
d38 3
d53 2
a54 2
MKI_OPTS.smp_riscv64=	-K ${IMAGE.kern}
SNAP_MD_POST_DEPS+=	smp_riscv64
d60 2
a61 2
MKI_OPTS.smp_riscv32=	-K ${IMAGE.kern}
SNAP_MD_POST_DEPS+=	smp_riscv32
d64 12
a75 1
snap_md_post: check_DESTDIR check_RELEASEDIR snap_post .WAIT ${SNAP_MD_POST_DEPS}
@


1.6
log
@Inject TOOL_SED and TOOL_PWD_MKDB into mkimage

The configuration files used for mkimage might want to customize the passwd
database of the generated image (as is the case for an out-of-tree config
file I have) and passing in these tools helps to execute those modifications.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.inc,v 1.5 2024/12/29 09:46:44 jmmv Exp $
d37 2
@


1.5
log
@Recognize MKPOSTFIX=no in mkimage
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.inc,v 1.4 2023/05/07 12:41:46 skrll Exp $
d30 2
@


1.4
log
@RISC-V support that works on QEMU with a single hart.

Thanks for Simon Burge for plic(4).
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.inc,v 1.3 2021/10/04 06:50:35 skrll Exp $
d34 1
@


1.4.2.1
log
@Sync with HEAD
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.inc,v 1.7 2025/03/22 09:25:14 hgutch Exp $
a29 2
	TOOL_SED=${TOOL_SED} \
	TOOL_PWD_MKDB=${TOOL_PWD_MKDB} \
a33 3
	MKPOSTFIX=${MKPOSTFIX} \
	CKSUM=${CKSUM} \
	IMAGEDIR=${IMAGE.dir} \
@


1.3
log
@Don't include bsd.own.mk here - none of the other etc.<foo>/Makefile.inc
files do.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.inc,v 1.2 2021/10/01 10:38:03 jmcneill Exp $
d6 3
d10 27
a36 1
EXTRA_KERNELS=		INSTALL
d38 7
a44 1
.if ${MACHINE_ARCH} == "riscv64" && ${HAVE_UEFI} == "yes"
d48 10
a57 4
snap_md_post:
.if ${MACHINE_ARCH} == "riscv64" && ${HAVE_UEFI} == "yes"
	cd ${KERNSRCDIR}/stand/efiboot/bootriscv64 && ${MAKE} release
	${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/misc '*.efi'
d59 5
@


1.2
log
@riscv: Include kernel and bootloader in releasedir.

This change adds a kern-GENERIC set and distributes an INSTALL kernel
along with bootriscv64.efi as part of a standard release build.
@
text
@d1 1
a1 1
#	$NetBSD$
a17 2

.include <bsd.own.mk>
@


1.1
log
@New files for Userland support of UCB RISC-V (both 32-bit and 64-bit)
@
text
@d1 19
@

