Building a small GRUB payload for 512k targets and above - librecore-org/librecore GitHub Wiki
This page describes how you can make a GRUB payload small enough to fit 512kB targets.
First, get the latest GRUB from GNU Savannah and compile it
git clone git://git.savannah.gnu.org/grub.git
cd grub
make clean
./autogen.sh
./configure --with-platform=coreboot
make
Once it's compiled, make a payload containing the useful modules
pkgdatadir=. ./grub-mkstandalone --grub-mkimage=./grub-mkimage -O i386-coreboot -o default_payload.elf --modules='ahci at_keyboard cbfs ehci ext2 fat ohci part_gpt part_msdos pata uhci usb_keyboard usbms usbserial_usbdebug' --install-modules='affs afs all_video bfs btrfs cbls cbmemc cbtime chain cmosdump cmostest configfile cpio cpio_be cryptodisk date datetime disk diskfilter echo eval exfat gfxterm_background gzio halt hdparm help hexdump hfs hfsplus iorw iso9660 jfs jpeg keystatus linux linux16 ls lsacpi lsmmap lspci memrw minicmd minix minix2 minix2_be minix3 minix3_be minix_be multiboot nativedisk newc nilfs2 normal ntfs odc ohci pcidump play png probe reboot regexp reiserfs romfs search serial setpci sfs squash4 syslinuxcfg test testload testspeed time udf ufs1 ufs1_be ufs2 uhci usbserial_ftdi usbserial_pl2303 usbtest videoinfo videotest xfs zfs' --fonts= --themes= --locales= -d grub-core/ /boot/grub/grub.cfg=./coreboot.cfg
Optionally, add keymaps
Simply append this at the end of the previous command:
/boot/grub/layouts/usdvorak.gkb=./usdvorak.gkb /boot/grub/layouts/usqwerty.gkb=./usqwerty.gkb
Make sure the keymaps are present in the pkgdatadir, which is the root of the git directory in this example.
Optionally, add fonts
Simply append this at the end of the previous command:
/dejavusansmono.pf2=./dejavusansmono.pf2
Make sure the fonts are present in the pkgdatadir, which is the root of the git directory in this example.
Add the payload to your coreboot.rom
Move the default_payload.elf to your coreboot working directory. Rename it to payload.elf and run make menuconfig. Navigate to Payload ---> Add a payload and select An ELF executable payload. The Payload path and filename would simply be payload.elf then.
Add a grub.cfg
This payload expects an /etc/grub.cfg file in the coreboot filesystem. Add this with cbfstool:
cbfstool coreboot.rom add -n etc/grub.cfg -f etc/grub.cfg -t raw
You can find an example grub.cfg for ich7 targets here.