[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 5/30/23 10:42 AM, Linux User #330250 wrote:
> On 05/30 2023 17:13 Stan Johnson wrote:
>> On 5/30/23 7:16 AM, Ben Westover wrote:
>>> The GRUB Manual [1] says that the PPC port of GRUB only supports
>>> booting Linux at the moment. AFAIK booting macOS with GRUB on x86
>>> machines works by just chainloading macOS' UEFI bootloader. I assume
>>> this is what yaboot does as well, telling Open Firmware to load OS
>>> X's blessed binary instead of the second stage of yaboot and Linux
>>> from there. All we need to do is find a way to support Open Firmware
>>> chainloading from within GRUB.
> 
> Yes, I had it working on an Intel Mac.

If anyone has a current GRUB configured to boot Mac OS X on an Intel
Mac, please post the relevant grub.cfg entries. I know the entries
determined by os-prober don't work (32-bit or 64-bit), or at least they
didn't several months ago.

> ...
> 
> You can always put in some "static" configuration under
> /etc/grub.d/99something.
> 
> I have some scripts of my own there, with my static configuration preset
> before the automatic grub-install generated stuff. This way, my primary
> options on x86/amd64 are at the top, a) Windows and b) Linux.
> ...

Thanks for the details; you've done a lot of work customizing GRUB.

> ...
> LABEL="[W]indows 11"
> HOTKEY="w"
> cat << EOF
> menuentry '$LABEL' --hotkey=$HOTKEY --class windows --class os
> \$menuentry_id_option 'gentoo-static-efibootmgr-$GENTOO_STATIC_EFI_UUID' {
>         insmod part_gpt
>         insmod fat
>         search --no-floppy --fs-uuid --set=root $GENTOO_STATIC_EFI_UUID
>         chainloader /efi/Microsoft/Boot/bootmgfw.efi
>         savedefault
> }
> EOF

yes, I have similar entries for Windows and NetBSD (though the NetBSD
entry is only a single line as I recall. I haven't used HOTKEY; it looks
like a useful option.

> ...
> This may seem like a lot of work, but in your case all you needed to do
> would be to make your OS X GRUB entries static into a file similar to
> mine (05_static, likely with less configuration variables; e.g.
> 04_macos) and you'd be all set. No longer any need to copy a
> grub.cfg.save...
The OX X GRUB entries as determined by os-prober are static, they just
don't work. As I recall, there's one labeled "Mac OS X (32-bit)" and one
labeled "Mac OS X (64-bit)", and they both result in an error (which I
don't remember but I can easily reproduce if it would be helpful). The
error is similar on 32-bit PowerMacs, 64-bit PowerMacs and 64-bit Intel
Macs.
> ...
> AFAIR yaboot does its magic within the CHRP boot script. It would be
> relatively easy to add an option to load GRUB, I guess. The "chain"
> would then start by choosing Mac OS (Classic), Mac OS X, or GRUB, via
> the yaboot CHRP script. But then, GRUB would be only managing Linux.
> 
> So, that's probably not what you were suggesting...
> 
That would be fine if it worked. On Intel Macs, I use "rEFIt", which I
realize is old and no longer maintained. rEFIt lets me select any Mac OS
X volume or GRUB, and GRUB handles Linux. I can configure the defaults
in rEFIt and GRUB to end up at any OS that I want by default.

>> I'll test a new installation of the latest Debian SID (with GRUB) on a
>> PowerBook Pismo with an unformatted disk and send an update in a
>> different thread (I specifically want to test whether the partition that
>> holds the real grub.cfg is normally hidden).
> 
> I hope I finally find the time to do the same on my Clamshell. Only, my
> disk isn't empty, I already installed Mac OS X on it, which I want to keep.
> ...

I have a similar setup on Lombard and Pismo PowerBooks, which are
similar to the Clamshells. After backing up the Mac volumes and
re-partitioning to make room for the Bootstrap partition, Linux rootfs
partition(s), and swap, I installed Debian, Gentoo, etc. For new or
unfamiliar distributions, I'll usually install to an external disk first
then use dump/restore to move the rootfs to the internal disk once it is
stable. I've not yet moved to GRUB on any "production" PowerMac system;
for a first-time yaboot installation I used Debian 7 (then dd to copy
the Bootstrap partition between systems), and I keep a copy of Debian 7
on an external disk in case I need to change anything in yaboot other
than yaboot.conf on the Bootstrap partition.

FYI here are the partitions on my Pismo system:

/dev/sda
        #                 type name         length   base    ( size )
/dev/sda1  Apple_partition_map Apple            63 @ 1       ( 31.5k)
/dev/sda2       Apple_Driver43 Macintosh        56 @ 64      ( 28.0k)
/dev/sda3       Apple_Driver43 Macintosh        56 @ 120     ( 28.0k)
/dev/sda4     Apple_Driver_ATA Macintosh        56 @ 176     ( 28.0k)
/dev/sda5     Apple_Driver_ATA Macintosh        56 @ 232     ( 28.0k)
/dev/sda6       Apple_FWDriver Macintosh       512 @ 288     (256.0k)
/dev/sda7   Apple_Driver_IOKit Macintosh       512 @ 800     (256.0k)
/dev/sda8        Apple_Patches Patch Partition 512 @ 1312    (256.0k)
/dev/sda9    Apple_Bootstrap  Apple_Bootstrap 131072 @ 1824  ( 64.0M)
/dev/sda10           Apple_HFS MacOS       2097152 @ 132896   ( 1.0G)
/dev/sda11           Apple_HFS MacOSX     14547169 @ 2230048  ( 6.9G)
/dev/sda12     Apple_UNIX_SVR2 Debian_sid 33554432 @ 16777217 (16.0G)
/dev/sda13     Apple_UNIX_SVR2 Gentoo     33554432 @ 50331649 (16.0G)
/dev/sda14     Apple_UNIX_SVR2 Void       33554432 @ 83886081 (16.0G)
/dev/sda15     Apple_UNIX_SVR2 swap       4194304 @ 117440513 ( 2.0G)
/dev/sda16     Apple_UNIX_SVR2 data     128450559 @ 121634817 (61.2G)

I keep a copy of yaboot.conf in the local /etc directory on Debian,
Gentoo and Void; each Linux partition functions as a recovery partition
for the others. The "real" yaboot.conf is on /dev/sda9, which is only
mounted when yaboot.conf needs to be updated (e.g. if I want to append
or change a kernel command line option for a particular distribution).
After a Debian dist-upgrade, I ensure that vmlinux and initrd.img point
to the kernel and initrd that I want to use (and I've deleted GRUB so it
won't try to install or update anything).

-Stan


Reply to: