Tuesday 6 April 2010

GRUB2 on Joggler

We have been having some issues with ELILO and large initrds in the #mer channel on irc.freenode.net, so we started investigating GRUB2.

The problem with GRUB2 was that it did not initialize video correctly and hence did now show the framebuffer console when booting. Another problem was that it did not have a TextModeHack.

For the technical side of these problems: GRUB2 did not pass correct video information in the linux kernel parameters due to it only supporting UGA video. Thanks to 'bean''s patch, I was able to construct a working GRUB2. UPDATE: now with adq's updated patch, we no longer need to use screen.efi as it contains a TextModeHack now - thanks to him for the great hack!

To compile GRUB2:

  • Grab the source and untar it
  • Patch it with this patch (grub-gop-video-v1.patch, patch -p1 it)
  • ./configure --with-platform=efi
  • Run 'make'
  • Make a .efi file: ./grub-mkimage -d . -o grub.efi part_msdos hfsplus fat ext2 normal sh chain boot configfile linux
  • If you're too lazy or incapable of building, use this grub.efi

To use it in practice:
  • Make a efi\grub directory and put grub.efi in there
  • Put in the root of the FAT partition, file boot.nsh:

    fs1:
    cd \efi\grub
    grub

    And file startup.nsh:

    fs1:boot2
    fs0:boot
  • Put in a grub.cfg file in \efi\tools (sample one linked, not working, you need to edit it). See elilo config in the other post for inspiration.
  • If you do not need interactivity with the menu (letting it time out to the default item), you do not have to press ESC at bootup.

Enjoy - if you're a Joggler hacker, come to #mer on irc.freenode.net, a good bunch of us there by now. Webchat here.

2 comments:

  1. Top lazy tip:

    put grub.efi in root of usb stick as boot.efi
    and put grub.cfg in root of usb stick as grub.cfg

    I got bitten when my usb hub i used to connect my memorystick and keyboard had additional cardreaders on it which pushed my usb stick up to (hd2,1)

    ReplyDelete
  2. Try: ./grub-mkimage -d . -o ../meego-grub.efi part_msdos hfsplus fat ext2 normal sh chain boot configfile linux search hello help reboot acpi pci

    The args are modules that are included in the grub efi.
    When you look at the mapping under the efi shell you see acpi/pci and grub needs this to see the fs on the partitions.

    Also you can put this in the root as, say, boot.efi and just do fs1:boot

    Finally just replacing the boot.efi in the internal mmc works fine too.

    ReplyDelete