[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/31/23 10:20 AM, Ben Westover wrote:
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.

That makes a lot more sense now. The "first stage" of yaboot where you
select Linux, OS X, or CD Boot is actually a script run by Open Firmware, > and that's how it can so easily chainload, since it's just a script
selecting which binary for Open Firmware to load.

In that case, instead of trying to integrate chainloading functionality
into GRUB itself, we could just set a similar script to run before GRUB
that allows you to make that selection.

I have just tested this concept. I wiped my iMac G3, installed OS X and Debian, and put a modified version of yaboot's stage 1 script in the bootstrap partition and blessed it. Now I am greeted with a screen that asks me if I'd like to boot into Linux, OS X, or whatever's in the CD drive, and all of the options work, the Linux one loading right into GRUB. If I don't select an option after a bit it defaults to GRUB.

This combines the convenience of yaboot with the versatility of GRUB, and only requires a single (relatively) human readable and editable file. The script is attached; the only change you should have to make is of the partition numbers, as it currently assumes /boot/grub is on partition 2 and OS X is on partition 3.

--
Ben Westover
<CHRP-BOOT>
<COMPATIBLE>
MacRISC MacRISC3 MacRISC4
</COMPATIBLE>
<DESCRIPTION>
PowerPC GNU/Linux First Stage Bootstrap
</DESCRIPTION>
<BOOT-SCRIPT>
: .printf fb8-write drop ;
: bootgrub " Loading GRUB..." .printf 100 ms load-base release-load-area " hd:2,\grub" $boot ;
: bootmacosx " Booting Mac OS X..." .printf 100 ms load-base release-load-area " hd:3,\\:tbxi" $boot ;
: bootcd " Booting CDROM..." .printf 100 ms load-base release-load-area " cd:,\\:tbxi" $boot ;
" screen" output
variable interactive
1 interactive !

0 interactive @ = if
  bootgrub
then

dev screen
" "(0000000000aa00aa0000aaaaaa0000aa00aaaa5500aaaaaa)" drop 0 7 set-colors
" "(5555555555ff55ff5555ffffff5555ff55ffffff55ffffff)" drop 8 15 set-colors
device-end
f to foreground-color
0 to background-color
" "(0C)" .printf

" First Stage Debian GNU/Linux Bootstrap"(0d 0a)" .printf
"  "(0d 0a)" .printf
" Press l for GNU/Linux,"(0d 0a)" .printf
"       x for Mac OS X,"(0d 0a)" .printf
"       c for CDROM."(0d 0a)" .printf
"  "(0d 0a)" .printf
" Stage 1 Boot: " .printf
get-msecs d# 10 3E8 * +
begin
  key? if
    key case
      ascii l of " l "(0d 0a)" .printf bootgrub endof
      ascii x of " x "(0d 0a)" .printf bootmacosx endof
      ascii c of " c "(0d 0a)" .printf bootcd endof
    endcase
  then
  dup get-msecs &lt;
until
drop
"  "(0d 0a)" .printf bootgrub
</BOOT-SCRIPT>
<OS-BADGE-ICONS>
1010
000000000000F8FEACF6000000000000
0000000000F5FFFFFEFEF50000000000
00000000002BFAFEFAFCF70000000000
0000000000F65D5857812B0000000000
0000000000F5350B2F88560000000000
0000000000F6335708F8FE0000000000
00000000005600F600F5FD8100000000
00000000F9F8000000F5FAFFF8000000
000000008100F5F50000F6FEFE000000
000000F8F700F500F50000FCFFF70000
00000088F70000F50000F5FCFF2B0000
0000002F582A00F5000008ADE02C0000
00090B0A35A62B0000002D3B350A0000
000A0A0B0B3BF60000505E0B0A0B0A00
002E350B0B2F87FAFCF45F0B2E090000
00000007335FF82BF72B575907000000
000000000000ACFFFF81000000000000
000000000081FFFFFFFF810000000000
0000000000FBFFFFFFFFAC0000000000
000000000081DFDFDFFFFB0000000000
000000000081DD5F83FFFD0000000000
000000000081DDDF5EACFF0000000000
0000000000FDF981F981FFFF00000000
00000000FFACF9F9F981FFFFAC000000
00000000FFF98181F9F981FFFF000000
000000ACACF981F981F9F9FFFFAC0000
000000FFACF9F981F9F981FFFFFB0000
00000083DFFBF981F9F95EFFFFFC0000
005F5F5FDDFFFBF9F9F983DDDD5F0000
005F5F5F5FDD81F9F9E7DF5F5F5F5F00
0083DD5F5F83FFFFFFFFDF5F835F0000
000000FBDDDFACFBACFBDFDFFB000000
000000000000FFFFFFFF000000000000
0000000000FFFFFFFFFFFF0000000000
0000000000FFFFFFFFFFFF0000000000
0000000000FFFFFFFFFFFF0000000000
0000000000FFFFFFFFFFFF0000000000
0000000000FFFFFFFFFFFF0000000000
0000000000FFFFFFFFFFFFFF00000000
00000000FFFFFFFFFFFFFFFFFF000000
00000000FFFFFFFFFFFFFFFFFF000000
000000FFFFFFFFFFFFFFFFFFFFFF0000
000000FFFFFFFFFFFFFFFFFFFFFF0000
000000FFFFFFFFFFFFFFFFFFFFFF0000
00FFFFFFFFFFFFFFFFFFFFFFFFFF0000
00FFFFFFFFFFFFFFFFFFFFFFFFFFFF00
00FFFFFFFFFFFFFFFFFFFFFFFFFF0000
000000FFFFFFFFFFFFFFFFFFFF000000
</OS-BADGE-ICONS>
</CHRP-BOOT>

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


Reply to: