grub-devel
[Top][All Lists]
Advanced

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

grub on ppc -- a CHRP script


From: Maurizio Boriani
Subject: grub on ppc -- a CHRP script
Date: Wed, 25 May 2005 18:49:46 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux)

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 " 
/address@hidden/address@hidden/address@hidden/address@hidden:2,\\yaboot"        
     endof
    2 of " 
/address@hidden/address@hidden/address@hidden/address@hidden: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,


-- 
Maurizio Boriani 
GPG key: 0xCC0FBF8F
 => E429 A37C 5259 763C 9DEE  FC8B 5D61 C796 CC0F BF8F <=





reply via email to

[Prev in Thread] Current Thread [Next in Thread]