From 6a7d72ef2602f5fecb6889b379d0842f75b6dbec Mon Sep 17 00:00:00 2001 From: kn Date: Wed, 27 Jul 2022 12:32:03 +0000 Subject: [PATCH] Fix reconstructed softraid bootline With softraid, OBP's boot-file variable aka. bootline may contain the sofraid volume name and kernel file name delimited by a double colon, e.g. "sr0", "sr0a", "sr0:", "sr0a:", "sr0:/bsd" or "sr0a:/bsd". ofwboot parses this string, may fill in optional partition number ("a") and/or optional kernel file name ("/bsd") and always prints the fully qualified string reconstructed from parts as "Booting ": {0} ok boot my-devalias sr0 [...] Boot device: /virtual-devices@100/channel-devices@200/disk@0 File and args: sr0 [...] Booting sr0:a/bsd [...] {0} ok boot my-devalias sr0a:/bsd [...] Boot device: /virtual-devices@100/channel-devices@200/disk@0 File and args: sr0a:/bsd [...] Booting sr0:a/bsd [...] Swap partition and delimiter to fix the reconstructed string, making it suitable for copy/paste: Booting sr0a:/bsd This has not been an issue since the reconstructed string is only printed and not (re)used anywhere. OK kettenis --- sys/arch/sparc64/stand/ofwboot/ofdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/arch/sparc64/stand/ofwboot/ofdev.c b/sys/arch/sparc64/stand/ofwboot/ofdev.c index 2a4a37e2f78..9cd20af1b9a 100644 --- a/sys/arch/sparc64/stand/ofwboot/ofdev.c +++ b/sys/arch/sparc64/stand/ofwboot/ofdev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ofdev.c,v 1.32 2021/12/01 17:25:35 kettenis Exp $ */ +/* $OpenBSD: ofdev.c,v 1.33 2022/07/27 12:32:03 kn Exp $ */ /* $NetBSD: ofdev.c,v 1.1 2000/08/20 14:58:41 mrg Exp $ */ /* @@ -553,7 +553,7 @@ devopen(struct open_file *of, const char *name, char **file) partition = 'a'; cp = &fname[0]; } - snprintf(buf, sizeof buf, "sr%c:%c", volno, partition); + snprintf(buf, sizeof buf, "sr%c%c:", volno, partition); if (strlcpy(opened_name, buf, sizeof opened_name) >= sizeof opened_name) return ENAMETOOLONG; -- 2.20.1