Hello!

On 11th of August 2024 23:27 Lennart Sorensen wrote:
I am not sure why that is an hfs volume.  Is that normal for grub on
a powermac?  I am affraid I have only used other powerpc linux systems
myself.  Looking it up a bit it does appear that it is normal to use
hfs for /boot/grub since the firmware has to read grub from there.

You could try doing: mount -o remount,rw /boot/grub

Maybe that will make it read write and hence able to allow grub to update.

HFS is normal on a PowerMac. OpenFirmware by Apple is searching for a
boot volume in HFS file format.

There are various ways to boot. Mac OS X also had advanced from HFS to
HFS Plus, but OpenFirmware was still using the older HFS, so there is
merely a bootstrap loader on the HFS boot volume that then loads the
actual bootloader from the real boot volume, in the case of Mac OS X
almost always the HFS+ root volume.

Linux can skip this and keep the kernel and the config files on the HFS
volume, but there is also a way to keep them on a separate e.g. ext2 volume.

To understand this, there are various good reads, including this from
Gentoo Linux:
https://wiki.gentoo.org/wiki/GRUB_on_Open_Firmware_(PowerPC)

To modify the HFS volume, Linux never really supported it fully, and
thus there are external tools to safely access the volume, like
hfsutils. From this package you can use hmount and hcopy and so on.

GRUB features a configfile option, which will load an external
(additional) configuration file from any supported volume. The best way
to boot Linux on a PowerMac would be:

1. OpenFirmware looks for a bootable volume in HFS format (types include
"Apple_Boot" and "Apple_Bootstrap") with EXACTLY ONE blessed file on it.
2. On this HFS volume (specifically for Linux) you would install GRUB
with a generic grub.cfg, that uses only the configfile option, which
points to the real /boot partition from Linux.

Example:
/dev/sda1 = HFS bootstrap for Linux, UUID does not matter, grub.cfg
/dev/sda2 = /boot, ext2 (or ext4), note UUID
/dev/sda3 = / for Linux


On /dev/sda1 you'd have:
1. grub.img
2. grub.cfg, as follows:

search --no-floppy --fs-uuid --set=root <UUID from /dev/sda2>
set prefix=($root)/grub
configfile /grub/grub.cfg

3. a CHRP boot script with logo that is blessed (see e.g. Gentoo Wiki)


On /dev/sda2 you'd have your real grub.cfg and your kernels and so forth.

On /dev/sda3 you'd have your Linux.


The PowerMac OpenFirmware has a boot menu which will be displayed when
you hold the Option key (on a PC keyboard it's the Alt key) at the
chime. It will show the logos from the CHRP boot scripts of every HFS
volume it can find of the type Apple_Boot/Apple_Bootstrap with ONE
blessed file on it. ("blessed" is like a file attribute, like in DOS
system or hidden).


OpenFirmware can boot anything of the right format that you specify, but
only on supported volumes (HFS, and I think also FAT16) and only when
you specify the path in the OpenFirmware specific format, either in the
OpenFirmware shell, or in an NVRAM variable "boot-device" that specifies
the default boot loader. There can only be one default boot loader, and
when the NVRAM/PRAM battery is weak or dies, it looses it. It may also
loose it when you boot something else that alters it, like maybe Mac OS.

Therefore the HFS + CHRP script is the best method.


I hope that helps to understand the PowerMac boot process a bit better...

Just my 2ยข,
Linux User #330250

Reply via email to