1#	$NetBSD: Makefile.inc,v 1.4 2023/05/07 12:41:46 skrll Exp $
2#
3#	etc.riscv/Makefile.inc -- riscv-specific etc Makefile targets
4#
5
6.if ${MACHINE_ARCH} == "riscv64"
7KERNEL_SETS=		GENERIC64
8.else
9KERNEL_SETS=		GENERIC
10.endif
11
12# Support for mkimage
13MKIMAGE= 	${NETBSDSRCDIR}/distrib/utils/embedded/mkimage
14IMAGE.rel=      ${RELEASEDIR}/${RELEASEMACHINEDIR}
15IMAGE.dir=      ${IMAGE.rel}/binary/gzimg
16IMAGE.kern=     ${IMAGE.rel}/binary/kernel
17
18#	TOOL_MKUBOOTIMAGE=${TOOL_MKUBOOTIMAGE} \
19
20__mkimage: .USE
21	TOOL_MAKE=${MAKE} \
22	TOOL_MAKEFS=${TOOL_MAKEFS} \
23	TOOL_DISKLABEL=${TOOL_DISKLABEL} \
24	TOOL_FDISK=${TOOL_FDISK} \
25	TOOL_GPT=${TOOL_GPT} \
26	TOOL_GZIP=${TOOL_GZIP} \
27	TOOL_MKNOD=${TOOL_MKNOD} \
28	TOOL_PAX=${TOOL_PAX} \
29	TOOL_MTREE=${TOOL_MTREE} \
30	HOST_SH=${HOST_SH} \
31	KERNOBJDIR=${KERNOBJDIR} \
32	MACHINE=${MACHINE} \
33	MKDTB=${MKDTB} \
34	${HOST_SH} ${MKIMAGE} -h ${.TARGET:S/smp_//} -D ${DESTDIR} \
35            -S ${NETBSDSRCDIR} ${MKI_OPTS.${.TARGET}} \
36            ${IMAGE.dir}/${.TARGET:S/smp_//}.img.gz
37
38
39.if ${MACHINE_ARCH} == "riscv64"
40.if ${HAVE_UEFI} == "yes"
41smp_efibootriscv64:
42	cd ${KERNSRCDIR}/stand/efiboot/bootriscv64 && ${MAKE} release
43	${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/misc '*.efi'
44SNAP_MD_POST_DEPS+=	smp_efibootriscv64
45INSTALLATION_DIRS+=	installation/misc
46.endif
47
48smp_riscv64: __mkimage
49MKI_OPTS.smp_riscv64=	-K ${IMAGE.kern}
50SNAP_MD_POST_DEPS+=	smp_riscv64
51.endif
52
53
54.if ${MACHINE_ARCH} == "riscv32"
55smp_riscv32: __mkimage
56MKI_OPTS.smp_riscv32=	-K ${IMAGE.kern}
57SNAP_MD_POST_DEPS+=	smp_riscv32
58.endif
59
60snap_md_post: check_DESTDIR check_RELEASEDIR snap_post .WAIT ${SNAP_MD_POST_DEPS}
61
62INSTALLATION_DIRS+=	binary/gzimg		\
63			installation/instkernel
64