From: jsg Date: Sun, 27 Jun 2021 04:52:01 +0000 (+0000) Subject: reuse armv7 installboot for riscv64 X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=0eec72d367db8b1992ecb68815714eab2c15c9e5;p=openbsd reuse armv7 installboot for riscv64 ok deraadt@ --- diff --git a/usr.sbin/installboot/Makefile b/usr.sbin/installboot/Makefile index 2e81ae586ff..327f424f419 100644 --- a/usr.sbin/installboot/Makefile +++ b/usr.sbin/installboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.22 2020/07/17 08:03:56 kettenis Exp $ +# $OpenBSD: Makefile,v 1.23 2021/06/27 04:52:01 jsg Exp $ PROG= installboot SRCS= installboot.c util.c @@ -15,7 +15,7 @@ CFLAGS += -DSOFTRAID SRCS += i386_installboot.c SRCS += i386_nlist.c SRCS += i386_softraid.c -.elif ${MACHINE} == "armv7" || ${MACHINE} == "arm64" +.elif ${MACHINE} == "armv7" || ${MACHINE} == "arm64" || ${MACHINE} == "riscv64" SRCS += armv7_installboot.c .elif ${MACHINE} == "hppa" CFLAGS += -DBOOTSTRAP diff --git a/usr.sbin/installboot/armv7_installboot.c b/usr.sbin/installboot/armv7_installboot.c index 0f328846f63..0c589f1cd0b 100644 --- a/usr.sbin/installboot/armv7_installboot.c +++ b/usr.sbin/installboot/armv7_installboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: armv7_installboot.c,v 1.9 2021/06/03 13:14:03 deraadt Exp $ */ +/* $OpenBSD: armv7_installboot.c,v 1.10 2021/06/27 04:52:01 jsg Exp $ */ /* $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */ /* @@ -207,7 +207,7 @@ write_filesystem(struct disklabel *dl, char part) rslt = -1; goto umount; } -#else +#elif defined(__arm__) /* * Copy BOOTARM.EFI to /efi/boot/bootarm.efi. */ @@ -222,6 +222,21 @@ write_filesystem(struct disklabel *dl, char part) rslt = -1; goto umount; } +#elif defined(__riscv) + /* + * Copy BOOTRISCV64.EFI to /efi/boot/bootriscv64.efi. + */ + pathlen = strlen(dst); + if (strlcat(dst, "/bootriscv64.efi", sizeof(dst)) >= sizeof(dst)) { + rslt = -1; + warn("unable to build /bootriscv64.efi path"); + goto umount; + } + src = fileprefix(root, "/usr/mdec/BOOTRISCV64.EFI"); + if (src == NULL) { + rslt = -1; + goto umount; + } #endif srclen = strlen(src); if (verbose)