Re: Can qemu load Netbsd/macppc kernel directly?

Andrew Randrianasulu <[email protected]> Tue, 4 Mar 2025 08:53:17 +0300
Newsgroups gmane.os.netbsd.ports.macppc
Message-ID <CA+rFky7BQJv9d=tAp4Crz_ySR0XwnS9i1YeBpPjx8gauJJf_CQ@mail.gmail.com>
On Tue, Mar 4, 2025 at 5:28=E2=80=AFAM Andrew Randrianasulu
<[email protected]> wrote:
>
> I found this post on reddit for x86_64
>
> https://www.reddit.com/r/BSD/comments/197vfmq/a_netbsdamd64_guest_can_now=
_boot_in_40ms_details/
>
> it uses this command line:
>
> qemu-system-x86_64 -M microvm,x-option-roms=3Doff,rtc=3Don,acpi=3Doff,pic=
=3Doff -enable-kvm -m 128 -cpu host,+invtsc -kernel ${KERNEL} -append "root=
=3Dld0a console=3Dcom rw -z" -display none -device virtio-blk-device,drive=
=3Dhd0 -drive file=3D${IMG},format=3Draw,id=3Dhd0 -global virtio-mmio.force=
-legacy=3Dfalse -serial stdio
>
>
> But when I tried same trick with generic.MP kernel for ppc
>
> it just sits here not printing anything apart from two lines
>
> prefixed with [ppc]
>
>
> We again trying to debug SMP (2 cpu)
>
>  support in qemu-system-ppc with new patch,
>
>  so it was interesting to try netbsd, but default
>
> install kernel does not have MP support compiled in.
>
>
> https://lists.gnu.org/archive/html/qemu-ppc/2025-03/msg00067.html
>
>

I tried to cross-commpile recent NetBSD by using build.sh from git
copy of NetBSD/src

$ ./build.sh -U -j8 -O ~/obj -m macppc -a powerpc kernel=3DINSTALL iso-imag=
e

But sadly it fails like this:

netbsd10$ ./qemu-system-ppc -M mac99,via=3Dpmu -cpu g4 -cdrom
~/obj/releasedir/images/NetBSD-10.99.12-macppc.iso   -boot d -g
1024x768x8 -smp 2  -bios ~/K38_sdcard1/Documents/openbios-qemu-smp.elf
-display sdl -accel tcg,thread=3Dmulti -m 256  -prom-env
'boot-device=3Dcd:,ofwboot.xcf /netbsd.macppc' -nographic
qemu-system-ppc: -accel tcg,thread=3Dmulti: warning: Guest not yet
converted to MTTCG - you may get unexpected results
cpus[0] =3D 0x797f104792c0 0x797f1047be40
cpus[1] =3D 0x797f101cae80 0x797f101cda00
s>> et_property: NULL phandle

>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>> OpenBIOS 1.1 [Mar 1 2025 05:50]
>> Configuration device id QEMU version 1 machine id 1
>> CPUs: 2
>> Memory: 256M
>> UUID: 00000000-0000-0000-0000-000000000000
>> CPU type PowerPC,G4
>> CPU type PowerPC,G4
milliseconds isn't unique.
Welcome to OpenBIOS v1.1 built on Mar 1 2025 05:50
Trying cd:,ofwboot.xcf...
>> switching to new context:

>> NetBSD/macppc OpenFirmware Boot, Revision 1.15 (Tue Mar  4 04:00:38 UTC =
2025)
>> Open Firmware version 3.x
>> Open Firmware running in virtual-mode.
6898796+117860=3D0x6b14d4
 start=3D0x100000
[   1.0000000] Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003=
,
[   1.0000000]     2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 20=
13,
[   1.0000000]     2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 20=
23,
[   1.0000000]     2024, 2025
[   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.99.12 (INSTALL) #0: Tue Mar  4 07:48:47 MSK 2025
[   1.0000000]  guest@netbsd10:/home/guest/obj/sys/arch/macppc/compile/INST=
ALL
[   1.0000000] total memory =3D 256 MB
[   1.0000000] avail memory =3D 231 MB
[   1.0000000] found openpic PIC at 80040000
[   1.0000000] OpenPIC Version 1.2: Supports 2 CPUs and 64 interrupt source=
s.
[   1.0000000] trap: kernel read DSI trap @ 0x4bfff609 by 0xfff10568
(DSISR 0x40000000, err=3D14), lr 0xfff104c8
[   1.0000000] panic: trap
[   1.0000240] rebooting

git commit:

commit 83adb4e9fbc386943d553805ac8403e5b682449d (HEAD -> trunk,
origin/trunk, origin/HEAD)
Author: andvar <[email protected]>
Date:   Mon Mar 3 22:31:37 2025 +0000

    regen.

Release 10.1 iso boots fine just with one CPU



>