Grub2

From Joggler
Jump to navigation Jump to search

Overview

GRUB2 needs patches to allow it to initialize video correctly and 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!

Compile

To compile GRUB2:

cd grub-1.98/loader/i386/efi/
patch -p1 linux.c < grub-gop-video-v1.patch
  • ./configure --with-platform=efi
  • Run 'make'

Once you have grub built you need to create a custom executable with all the modules you want

./grub-mkimage -d . -o ../grub.efi part_msdos part_gpt fat ext2 hfsplus normal sh chain boot configfile linux help reboot acpi pci search
  • part_msdos : reads msdos partition tables
  • part_gpt : gpt partition tables
  • fat : reads FAT filesystem
  • ext2 : reads ext2/3 filesystems
  • hfsplus : apple filesytems
  • normal : basic grub
  • sh : uses
  • chain : may be useful to run the original O2 boot.efi
  • boot : allow it to boot
  • configfile : reads the menu from a config
  • linux : understand the linux kernel
  • help : online help
  • reboot : !
  • acpi : May be needed to access internal acpi devices
  • cpi : May be needed to access internal pci devices
  • search : Enables searching for devices by label

Install

To use it on the device from an external stick:

  • put grub.efi in the root of a usb fat partition on a stick
  • go through the <esc> tapping and type: "fs1:grub" blind

To make this automatic:

  • you can go to shell and edit the fs0:boot.nsh
  • Put in the root of the FAT partition, file boot.nsh:
fs1:
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.

Based on http://jogglerhacks.blogspot.com/2010/04/grub2-on-joggler.html