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

Re: Does someone use grub?



Hi,

Jörg Sommer <joerg@alea.gnuu.de> wrote:
> does someone of you use grub on PowerPC? I thought about replacing yaboot
> by grub, but a deeper look showed I have to do stuff by hand, i.e. it
> misses a default configuration. Is it worth to do it? Is grub better than
> yaboot?

Yes, it has ext4 support. :)

> Can grub boot OS X and from CD, i.e. that
> what enablecdboot in yaboot offers?

Maybe, but I found a better way.

Installing grub isn't as difficult as I thought, if you know what to do.
So I want to give a short explanation what I did.

1. install the package grub-ieee1275

2. if you don't get the file /boot/grub/grub, you have to build it with

  % grub-mkelfimage -o /boot/grub/grub -v \
    $(cd /usr/lib/grub/powerpc-ieee1275/; echo *.mod |sed s/.mod//g)

  You can create a smaller grub image if necessary by only using the
  modules you really needed for accessing /boot/grub, i.e. not the
  modules for foreign filesystems.

3. install grub on the boot partition by

  % hmount /dev/hda2
  % hcopy /boot/grub/grub :
  % humount

  or if your kernel supports hfs mount the filesystem directly and copy
  the file there.

4.
  a) If you only want to use grub, nothing else, you can try to boot
    grub from OpenFirmware. Reboot the machine and press Option +
    Command + o + f. At the OpenFirmware prompt enter

    0> boot hd:2,grub prefix=(hd,4)/boot/grub

    while 2 is the partition number of the filesystem where you placed
    grub on and 4 is the partition number of your root filesystem resp.
    the filesystem that contains /boot/grub/grub.cfg.

    If grub starts and you can boot Linux, you can make this the
    default setting.

    # nvsetenv boot-device "hd:2,grub prefix=(hd,4)/boot/grub"

  b) If you want to boot OS X or have a nice menu where you can select to
    boot from cd, you can use the OpenFirmware boot file below and boot
    hd:2,\:tbxi. It's the boot file of yaboot a little bit modified. With
    this you can still use yaboot, if you want. Place the file on the
    boot partition. It assumes OS X is installed on hda3.

    % hmount /dev/hda2
    % hcopy ofboot.b :
    % humount

    If you used yaboot until now, you have nothing to do, otherwise
    you should set the boot device to

    # nvsetenv boot-device 'hd:2,\:tbxi'

The grub version 1.96+20090603-2 has a bug which causes grub doesn't find
the root filesystem. #533898 I've worked around this bug with this patch
for /etc/grub.d/10_linux. It removes the (re‐)setting of the variable
root.

diff --git a/grub.d/10_linux b/grub.d/10_linux
index c642b77..a4098b0 100755
--- a/grub.d/10_linux
+++ b/grub.d/10_linux
@@ -93,7 +93,7 @@ linux_entry ()
   cat << EOF
 menuentry "$1" {
 EOF
-  prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
+#  prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
   cat << EOF
        linux   ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro $2
 EOF

This way I've got grub running on my iBook G4 (PowerBook6,3).

Bye, Jörg.

The file ofboot.b:
<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 " /pci@f4000000/ata-6@d/disk@0:2,\\grub prefix=(hd,4)/boot/grub" $boot ;
: bootyaboot " Loading yaboot..." .printf 100 ms load-base release-load-area " /pci@f4000000/ata-6@d/disk@0:2,\\yaboot" $boot ;
: bootmacosx " Booting MacOSX..." .printf 100 ms load-base release-load-area " /pci@f4000000/ata-6@d/disk@0:3,\\:tbxi" $boot ;
: bootcd " Booting CDROM..." .printf 100 ms load-base release-load-area " cd:,\\:tbxi" $boot ;
: bootof " Booting OpenFirmware..." .printf 100 ms quit ;
" 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 GNU/Linux Bootstrap"(0d 0a)" .printf
"  "(0d 0a)" .printf
" Press l for GNU/Linux with grub,"(0d 0a)" .printf
"       y for GNU/Linux with yaboot,"(0d 0a)" .printf
"       x for MacOSX,"(0d 0a)" .printf
"       c for CDROM,"(0d 0a)" .printf
"       o for OpenFirmware."(0d 0a)" .printf
"  "(0d 0a)" .printf
" Stage 1 Boot: " .printf
get-msecs d# 3 3E8 * +
begin
  key? if
    key case
      ascii l of " l "(0d 0a)" .printf bootgrub endof
      ascii y of " y "(0d 0a)" .printf bootyaboot endof
      ascii x of " x "(0d 0a)" .printf bootmacosx endof
      ascii c of " c "(0d 0a)" .printf bootcd endof
      ascii o of " o "(0d 0a)" .printf bootof 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>
-- 
Diskusion „Pascal vs. Rest der Welt“:
30 Aug 2000 00:13:11 GMT, Adrian Knoth <adi@drcomp.erfurt.thur.de>
Und selbst wenn eure 100000 Zeilen‐Programme noch so oft unter Windows
verwendet werden: mit einem Handwagen fährt man nicht Formel‐1.


Reply to: