Skip to contentSkip to conversation

grub on ppc -- a CHRP script

DISCUSSION Maurizio Boriani 3 participants 8 messages May 25, 2005 – Jun 21, 2005

lore
Share & tools
lore
#0 lore raw

Hi,
I'm back after a period of hard work :)

I tried grub2 on my ppc (apple iBook g3) but I don't like to change openfw boot-device var every time (I use the same laptop for my daily stuff) as suggested in grub wiki.

So written a CHRP script which permit to choose
yaboot or GRUB2, here it is:

-- cut

<CHRP-BOOT>
<COMPATIBLE>
MacRISC MacRISC3 MacRISC4
</COMPATIBLE>
<BOOT-SCRIPT>
: bx-boot-opts 2 ;
: bx-boot-wait d# 100 ; \ unit = 100 ms
: bx-boot-defopt 1 ;
: bx-display-menu ( -- )
." Boot Loaders menu" cr
." 1: yaboot" cr
." 2: GRUB2" cr
;
: bx-boot-choose ( num -- )
case

    1 of " /pci@f2000000/mac-io@17/ata-4@1f000/disk@0:2,\\yaboot"		endof
    2 of " /pci@f2000000/mac-io@17/ata-4@1f000/disk@0:2,\\grubof.modules"	endof

endcase
['] $boot catch drop
user-abort
;
: bx-read-num ( wait-period max-boot-num def-opt -- boot-num )
1 \ loop-inc = 1
3 pick 0 do
0d emit
." press 1-"
( wait-period max-boot-num def-opt loop-inc )
2 pick ascii 0 + emit
dup 1 = if
." within "
3 pick i - d# 10 / .d
." seconds"
then
." (default: "
over ascii 0 + emit
." ) : "
d# 100 ms
key? if
key
( wait-period max-boot-num def-opt loop-inc key ) dup 0d = if \ return pressed
drop leave
then

ascii 0 -
( wait-period max-boot-num def-opt loop-inc num )
dup 0 5 pick
( wait-period max-boot-num def-opt loop-inc num num 0 max-boot-num ) between if
rot drop swap leave
then

( wait-period max-boot-num def-opt loop-inc num ) 2drop 0 \ loop-inc = 0
then
dup +loop
drop
( wait-period max-boot-num boot-num )
nip nip
;

load-base release-load-area
stdout @ 0 = if
false to _normal-boot install-console
then
true to use-console? false to ignore-output?
dev /multiboot
flash-dev-icon-off
device-end
erase-screen

bx-display-menu
bx-boot-wait bx-boot-opts bx-boot-defopt bx-read-num bx-boot-choose
</BOOT-SCRIPT>
</CHRP-BOOT>

-- cut

using hfs tools, overwrite this (after fix it with your disk real path) on ofboot.b installed by yaboot (use 'hcopy -r' and 'hattrib' to fix attributes), reboot and a boot loader chooser will be displayed.

An example :

hmount /dev/<hfs partition"
hrcopy -r myofboot.b :ofboot.b
hrcopy -r grubof.modules :grubof.modules
hrcopy -r grub.cfg :grub.cfg

hattrib -t tbxi -c UNIX :ofboot.b
hattrib -t boot -c UNIX :grubof.modules
hattrib -t conf -c UNIX :grub.cfg

hattrib -b :
humount

This works for me, let me know if something wrong on your hosts.

If someone isn't already doing, I'm going to write a reiserfs module (let me know).

Also what about multiboot specification support in grub2? Is available (on ppc and ia32)? If not why ? :)

thanks,

Signature · 3 lines
Maurizio Boriani 
GPG key: 0xCC0FBF8F
 => E429 A37C 5259 763C 9DEE  FC8B 5D61 C796 CC0F BF8F <=
#1 lore raw

Hi!

Quoted 8 lines · Maurizio Boriani

I tried grub2 on my ppc (apple iBook g3) but I don't like to change openfw boot-device var every time (I use the same laptop for my daily stuff) as suggested in grub wiki.

So written a CHRP script which permit to choose
yaboot or GRUB2, here it is:

<snip>

Nice... I just wish such scripts could be simpler. :)

Personally I don't mind booting to OF and typing "boot hd:6,yaboot" as needed, but that's just me. Perhaps you could add your script to the wiki, maybe on its own page?

Quoted 2 lines

If someone isn't already doing, I'm going to write a reiserfs module (let me know).

There has been at least one request for that already, so I think it would be welcome. Marco has done most of the filesystem stuff so far, but I think is unavailable for further work until July.

Quoted 2 lines

Also what about multiboot specification support in grub2? Is available (on ppc and ia32)? If not why ? :)

The multiboot spec is still x86-specific. There is multiboot loader for x86 in GRUB2, but I don't know how much testing it's seen. I am working on a project which will eventually require multiboot for PPC, but as far as I know there have been no other requests for it...

If you are looking for things to work on, the PPC section of the TODO list (http://www.autistici.org/grub/moin.cgi/TodoList) is up-to-date. I have been working on the devalias filtering. Actually, I think the devalias filtering was misprioritized (my fault), but there are a lot of critical items on that list, some large, some small...

-Hollis

#2 lore raw
Quoted 7 lines · Hollis Blanchard
Quoted 2 lines

Also what about multiboot specification support in grub2? Is available (on ppc and ia32)? If not why ? :)

The multiboot spec is still x86-specific. There is multiboot loader for x86 in GRUB2, but I don't know how much testing it's seen. I am working on a project which will eventually require multiboot for PPC, but as far as I know there have been no other requests for it...

Multiboot for the PC works for me. I can boot GNU/Hurd with it.

There have been quite a lot requests for it, but I am not sure if that was on the list or on IRC. People want/need multiboot for the PPC.

Thanks,
Marco

#3 lore raw
In reply to Maurizio Boriani
Quoted 2 lines · Maurizio Boriani

If someone isn't already doing, I'm going to write a reiserfs module (let me know).

It was on my todo, but I won't have the time for it anytime soon. So, feel free to work on this.

Quoted 2 lines

Also what about multiboot specification support in grub2? Is available (on ppc and ia32)? If not why ? :)

Not yet on the PPC. This is something I'd like to work on during my summer holidays.

Thanks,
Marco

#4 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Marco" == Marco Gerards <[email protected]> writes:

Marco> Maurizio Boriani <[email protected]> writes:
>> If someone isn't already doing, I'm going to write a reiserfs >> module (let me know).

Marco> It was on my todo, but I won't have the time for it anytime Marco> soon. So, feel free to work on this.

ok, apply for this :)

Quoted 2 lines
Quoted 2 lines

Also what about multiboot specification support in grub2? Is available (on ppc and ia32)? If not why ? :)

Marco> Not yet on the PPC. This is something I'd like to work on Marco> during my summer holidays.

ok :)

Marco> Thanks, Marco

Thanks,

Signature · 3 lines
Maurizio Boriani 
GPG key: 0xCC0FBF8F
 => E429 A37C 5259 763C 9DEE  FC8B 5D61 C796 CC0F BF8F <=
#5 lore raw
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line

"Maurizio" == Maurizio Boriani <[email protected]> writes:

If someone isn't already doing, I'm going to write a reiserfs module (let me know).

Marco> It was on my todo, but I won't have the time for it anytime Marco> soon. So, feel free to work on this.

Maurizio> ok, apply for this :)

due to an heavy real life work activity, I will not be able to hack on this until September. So, feel free to work on reiserfs grub module.

bye

Signature · 3 lines
Maurizio Boriani 
GPG key: 0xCC0FBF8F
 => E429 A37C 5259 763C 9DEE  FC8B 5D61 C796 CC0F BF8F <=
#6 lore raw

Re: PPC multiboot

In reply to Maurizio Boriani
Quoted 8 lines · Maurizio Boriani
Quoted 3 lines
Quoted 3 lines

Also what about multiboot specification support in grub2? Is available (on ppc and ia32)? If not why ? :)

Marco> Not yet on the PPC. This is something I'd like to work on Marco> during my summer holidays.

ok :)

Has anybody looked at multiboot for PPC yet? I think I'm getting close to needing it for work, so if not I may just temporarily hack something, using the existing x86-centric data structures.

-Hollis

#7 lore raw

Re: PPC multiboot

Quoted 5 lines · Hollis Blanchard
Quoted 4 lines · Maurizio Boriani
Quoted 3 lines
Quoted 3 lines

Also what about multiboot specification support in grub2? Is available (on ppc and ia32)? If not why ? :)

Quoted 8 lines
Quoted 4 lines

Marco> Not yet on the PPC. This is something I'd like to work on Marco> during my summer holidays.

ok :)

Has anybody looked at multiboot for PPC yet? I think I'm getting close to needing it for work, so if not I may just temporarily hack something, using the existing x86-centric data structures.

Not yet.

--
Marco