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

Re: Why it's so difficult to fix PowerMac booting for good



On 06/02 2023 06:25 Ben Westover wrote:
It turns out that adding &device; alone is not enough since it refers to
only the drive and not the partition along with it. &device;:&partition;
is what was actually needed. Fixed script is attached.


Wow. Thanks. On my Power Mac G5, &device; alone always worked. Strange.

One thing that concerns me a bit is putting Linux's CHRP boot script
into /System/Library/CoreServices/BootX, which is specific to Mac OS X.
Why is this necessary?

On my Macs, with my personal installations, I tend to install more than
one Mac OS (X). Each OS version has its own partition (including
"Classic"), and its own blessed files/folders. Mac OS X uses
/System/Library/CoreServices/BootX while Mac OS (up to 9.2.2) uses
"System Folder".

To me it makes sense to not copy what other OSes do. So, for Linux I use
more than one partition as it has always been the way, even on x86.
That's why, for my installations, I create an Apple_Boot (or
Apple_Bootstrap) partition just for Linux. It has my "stage1", my CHRP
boot script (along with a shiny icon) and my GRUB along with my initial
1st stage GRUB configuration. Why do I prefer this? Because now, the
CHRP script will be able to rely on &device; (and &partition;) to
identify itself, while I use GRUB on this partition to find my actual
Linux boot partition (which may or may not be the same as the root
partition). This is possible because GRUB supports finding partitions
and (Linux) filesystems based on their UUIDs rather than specifying
fixed disk/partition numbers. AFAIK GRUB supports a wide range of
filesystems, including ext2/3/4, HFS, HFS+, VFAT, exFAT, btrfs, ZFS, and
XFS. So my Linux root / and my Linux boot /boot can be on a partition of
any of those filesystems and GRUB will find it based on the UUID I have
it look for.

Now I can change the partition table without causing any damage to the
boot process, because a) my Linux HFS Apple_Boot partition contains a
blessed CHRP boot script, making it visible to the OS Picker, and b) the
included GRUB will look for the boot partition (and its 2nd-stage i.e.
real grub.cfg) UUID-based.

Apple_Boot --> CHRP boot script --> GRUB --> initial grub.cfg -->
/boot (found based on UUID) --> loads /grub/grub.cfg from it

So my real grub.cfg is on my /boot partition, which isn't the HFS
Apple_Boot partition, and which has a filesystem that suits Linux much
more than HFS, in my case ext4. My /boot contains grub.cfg, all the
different Linux kernels and the initramfs files. Naturally, this
grub.cfg now also supports booting anything else, should that work on
PowerPC, like booting *BSD (NetBSD?) and XNU (Mac OS X, but as stated
here before, PowerPC XNU booting isn't really working).

The desired result: whatever I do, I can always rely on the OS Picker to
get me a working installation of either Mac OS (both X and Classic) as
well as Linux (more than one distribution/installation, if need be),
even after removing a (i.e. Mac OS X) partition in front of the
Apple_Boot and /boot partitions...

The real reason for requiring the separate Apple_Boot(strap) HFS
partition for Linux is that OF doesn't support the filesystem Linux uses
for /boot, as well as the other way around: the filesystem wouldn't
support blessing.

So, yes, we could also use /System/Library/CoreServices/BootX as the
CHRP boot script path + filename, but why should we? For Open Firmware
this doesn't do anything at all, because OF only cares if a folder/file
is blessed or not...

Anyway, thanks for your work!


Reply to: