Module Name: src
Committed By: tsutsui
Date: Mon Jan 13 17:33:10 UTC 2025
Modified Files:
src/sys/arch/macppc/stand/ofwboot: boot.c version
Log Message:
Tweak bootpath strings in ofwboot for OpenBIOS used on qemu-system-ppc.
Bump version to denote the visible change.
This makes qemu-system-ppc -M mac99 booting from a harddisk image
using ofwboot installed by installboot(8) with /usr/mdec/bootxx:
---
% qemu-system-ppc --version
QEMU emulator version 9.1.2
Copyright (c) 2003-2024 Fabrice Bellard and the QEMU Project developers
% qemu-system-ppc -M mac99 -drive
file=NetBSD-10.1-macppc.img,media=disk,format=raw -nographic
>> =============================================================
>> OpenBIOS 1.1 [Mar 7 2023 22:21]
>> Configuration device id QEMU version 1 machine id 1
>> CPUs: 1
>> Memory: 128M
>> UUID: 00000000-0000-0000-0000-000000000000
>> CPU type PowerPC,G4
milliseconds isn't unique.
Welcome to OpenBIOS v1.1 built on Mar 7 2023 22:21
Trying hd:,\\:tbxi...
Trying hd:,\ppc\bootinfo.txt...
Trying hd:,%BOOT...
>> Not a bootable ELF image
>> switching to new context:
OF_open bootpath=/pci@f2000000/mac-io@c/ata-3@20000/disk@0
read stage 2 blocks: 01234. done!
starting stage 2...
>> NetBSD/macppc OpenFirmware Boot, Revision 1.14 (Mon Jan 13 14:50:50 UTC 2025)
>> Open Firmware version 3.x
>> Open Firmware running in virtual-mode.
prom2boot: bootpath from OF: "/pci@f2000000/mac-io@c/ata-3@20000/disk@0:,%BOOT"
prom2boot: bootpath patched: "/pci@f2000000/mac-io@c/ata-3@20000/disk@0:"
bootline=
Trying /netbsd
11860332+167196 [463456+447084]=0xc570ec
start=0x100000
[ 1.0000000] Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
[ 1.0000000] 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013,
[ 1.0000000] 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023,
[ 1.0000000] 2024
[ 1.0000000] The NetBSD Foundation, Inc. All rights reserved.
[ 1.0000000] Copyright (c) 1982, 1986, 1989, 1991, 1993
[ 1.0000000] The Regents of the University of California. All rights
reserved.
[ 1.0000000] NetBSD 10.1 (GENERIC) #0: Mon Dec 16 13:08:11 UTC 2024
[ 1.0000000]
[email protected]:/usr/src/sys/arch/macppc/compile/GENERIC
---
To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/macppc/stand/ofwboot/boot.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/macppc/stand/ofwboot/version
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/macppc/stand/ofwboot/boot.c
diff -u src/sys/arch/macppc/stand/ofwboot/boot.c:1.31 src/sys/arch/macppc/stand/ofwboot/boot.c:1.32
--- src/sys/arch/macppc/stand/ofwboot/boot.c:1.31 Sun Feb 28 20:27:40 2021
+++ src/sys/arch/macppc/stand/ofwboot/boot.c Mon Jan 13 17:33:10 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: boot.c,v 1.31 2021/02/28 20:27:40 thorpej Exp $ */
+/* $NetBSD: boot.c,v 1.32 2025/01/13 17:33:10 tsutsui Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -105,6 +105,7 @@ prom2boot(char *dev)
{
char *cp;
+ DPRINTF("%s: bootpath from OF: \"%s\"\n", __func__, dev);
cp = dev + strlen(dev) - 1;
for (; *cp; cp--) {
if (*cp == ':') {
@@ -113,12 +114,31 @@ prom2boot(char *dev)
*cp = 0;
break;
} else {
- /* disk@0:5,boot -> disk@0:0 */
- strcpy(cp, ":0");
+ /*
+ * OpenBIOS v1.1 on qemu-system-ppc emulates
+ * Open Firmware 3.x but it also recognizes
+ * pmBootEntry info in the Apple Partition Map
+ * like old Open Firmware 1.x/2.x machines.
+ * In such case, the OpenBIOS passes
+ * "/[boot device]/disk@0:,%BOOT"
+ * for bootpath strings, but it looks
+ * the OpenBIOS doesn't recognize
+ * partition info in "disk@0:0" format.
+ * So just remove file arg strings without
+ * adding partition info in such case.
+ */
+ if (cp[1] == ',') {
+ /* just drop extra ",[bootfile]" */
+ cp[1] = '\0';
+ } else {
+ /* disk@0:5,boot -> disk@0:0 */
+ strcpy(cp, ":0");
+ }
break;
}
}
}
+ DPRINTF("%s: bootpath patched: \"%s\"\n", __func__, dev);
}
static void
Index: src/sys/arch/macppc/stand/ofwboot/version
diff -u src/sys/arch/macppc/stand/ofwboot/version:1.15 src/sys/arch/macppc/stand/ofwboot/version:1.16
--- src/sys/arch/macppc/stand/ofwboot/version:1.15 Sun Feb 28 20:27:40 2021
+++ src/sys/arch/macppc/stand/ofwboot/version Mon Jan 13 17:33:10 2025
@@ -1,4 +1,4 @@
-$NetBSD: version,v 1.15 2021/02/28 20:27:40 thorpej Exp $
+$NetBSD: version,v 1.16 2025/01/13 17:33:10 tsutsui Exp $
1.1: Initial revision from NetBSD/powerpc.
1.2: Use MI loadfile().
@@ -16,3 +16,4 @@ $NetBSD: version,v 1.15 2021/02/28 20:27
no OF path was specified.
1.13: Fix boot failure of installation floppies
1.14: Properly inform OFW of the kernel's location using claim + map.
+1.15: Tweak bootpath strings for OpenBIOS v1.1 used on QEMU.