[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: NVRAM emulation issues in QEMU



Hi Mark!

On 3/24/22 16:39, John Paul Adrian Glaubitz wrote:
> On 3/24/22 15:40, John Paul Adrian Glaubitz wrote:
>> Are there any plans to improve the NVRAM emulation in QEMU or is there any alternative
>> command that we should run on QEMU-based systems?
> 
> OK, the solution is actually as simple as skipping the "nvram" command when running inside
> a QEMU guest. However, I have no clue how to detect whether it's running on a QEMU-emulated
> PowerMac or a real one.

I think the solution is much simpler. We just remove the "nvram" command on Power Macintosh,
it's actually not needed. According to Apple's documentation, OpenFirmware will automatically
search for an operating system on any of the disks in the system, so there is no need to set
the boot-device in NVRAM expliclity [1].

In order to verify that, I just set the "boot-device" on my iBook G4 to NULL and can confirm
that it still boots fine.

root@ibook-g4:~# nvram --print-config=boot-device
/pci@f4000000/ata-6@d/@0:2,\\:txbi
root@ibook-g4:~# nvram --update-config boot-device=""
root@ibook-g4:~# nvram --print-config=boot-device
root@ibook-g4:~# reboot 
root@ibook-g4:~# Connection to 192.168.178.175 closed by remote host.
Connection to 192.168.178.175 closed.
glaubitz@suse-laptop:~> ssh root@192.168.178.175
Linux ibook-g4 5.16.0-5-powerpc #1 Debian 5.16.14-1 (2022-03-15) ppc

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Fri Mar 25 08:29:21 2022 from 192.168.178.81
root@ibook-g4:~#

So, I think it should be safe to just remove these two lines required for setting
the boot-device in NVRAM from the grub-installer script [2][3].

Adrian

> [1] https://opensource.apple.com/source/bless/bless-37/README.BOOTING
> [2] https://salsa.debian.org/installer-team/grub-installer/-/blob/master/grub-installer#L961
> [3] https://salsa.debian.org/installer-team/grub-installer/-/blob/master/grub-installer#L968

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913


Reply to: