From cee90ae0fce6d6aee8d78969b60c952c8890abd6 Mon Sep 17 00:00:00 2001 From: Francis Rowe Date: Fri, 11 Jul 2014 04:53:00 -0400 Subject: Libreboot release 6 beta 1. --- (limited to 'docs/howtos/grub_cbfs.html') diff --git a/docs/howtos/grub_cbfs.html b/docs/howtos/grub_cbfs.html new file mode 100644 index 0000000..8446686 --- /dev/null +++ b/docs/howtos/grub_cbfs.html @@ -0,0 +1,131 @@ + + + + + + + + + Libreboot documentation: GRUB menu + + + +
+

How to change your default GRUB menu

+ +
+ +

+ Libreboot on X60/T60/macbook21 uses the GRUB2 payload, which means that the grub.cfg (which is where your GRUB menu comes from) is inside the ROM along with + GRUB itself, executed by libreboot directly in the SPI flash chip. In context, this means that installing distributions and managing them is handled slightly differently + compared to traditional BIOS systems. +

+ +

+ A coreboot or libreboot ROM is not simply "flat"; there is an actual filesystem inside called CBFS (coreboot filesystem). A utility called 'cbfstool' + allows you to change the contents of the ROM. In this case, libreboot is configured such that the grub.cfg exists directly inside CBFS instead of + inside the grub.elf payload's 'memdisk' (which is itself stored in CBFS). +

+ +

+ Here is an excellent writeup about CBFS (coreboot filesystem): http://lennartb.home.xs4all.nl/coreboot/col5.html. +

+ +
+ +

+ Download libreboot_src.tar.gz or libreboot_bin.tar.gz from http://libreboot.org/ +
If you downloaded libreboot_meta.tar.gz, refer to ../index.html#build_meta before continuing. +

+ +

+ On apt-get distributions such as Trisquel you can install the build dependency (GCC) by running:
+ $ sudo apt-get install build-essential +

+ +

+ If you are working with libreboot_src, then you can run make command in libreboot_src/coreboot/util/cbfstool to build the cbfstool and rmodtool + executable. +

+

+ Alternatively if you are working with libreboot_bin, then you can run ./builddeps-cbfstool command inside libreboot_bin/; a cbfstool and rmodtool + executable will appear under libreboot_bin/ +

+ +

+ You can work directly with one of the ROM's already included in libreboot_bin.tar.gz. For the purpose of this tutorial it is assumed + that your ROM is named 'coreboot.rom' so please make sure to adapt. +

+ +

+ If you want to re-use the ROM that you currently have flashed (and running) then see ../index.html#build_flashrom + and then run:
+ $ sudo ./flashrom -p internal -r coreboot.rom
+ Notice that this is using "-r" (read) instead of "-w" (write). This will create a dump (copy) of your current firmware and name it coreboot.rom. You need to take ownership of the file. For example:
+ $ sudo chown yourusername:yourusername coreboot.rom
+ # chown yourusername:yourusername coreboot.rom +

+ +

+ Display contents of ROM:
+ $ ./cbfstool coreboot.rom print +

+ +

+ The coreboot.rom file contains your grub.cfg. +

+ +

+ Extract grub.cfg from the ROM:
+ $ ./cbfstool coreboot.rom extract -n grub.cfg -f grub.cfg +

+ +

+ Now you have a grub.cfg in cbfstool directory. Edit it however you wish. +

+ +

+ Delete the grub.cfg that remained inside the ROM:
+ $ ./cbfstool coreboot.rom remove -n grub.cfg +

+ +

+ Display ROM contents and now you see grub.cfg no longer exists there:
+ $ ./cbfstool coreboot.rom print +

+ +

+ Add the modified version that you just made:
+ $ ./cbfstool coreboot.rom add -n grub.cfg -f grub.cfg -t raw +

+ +

+ Now display ROM contents again and see that it exists again:
+ $ ./cbfstool coreboot.rom print +

+ +

+ Now you have a modified ROM. Refer back to ../index.html#flashrom for information + on how to flash it. +

+ +

+ Anecdotally, a user reported that segmentation faults occur with cbfstool when using this procedure depending on the size of the grub.cfg being re-insterted. In his case, a minimum size of 857 bytes was required. This could (at the time of this release) be a bug in cbfstool that should be investigated with the coreboot community. If cbfstool segfaults, then keep this in mind. 'strace' (or gdb? clang?) could be used for debugging. This was in libreboot 5th release (based on coreboot from late 2013). Not sure if the issue perists in the 6th release (based on coreboot from June 1st, 2014 at the time of writing); I have never personally encountered the bug. strace (from that user) is here: cbfstool_libreboot5_strace. The issue has been reported by a few users, so does not happen all the time: this bug (if it still exists) could (should) be reproduced. +

+ +
+ +

+ Copyright © 2014 Francis Rowe, All Rights Reserved.
+ See ../license.html for license conditions. +

+ + + -- cgit v0.9.1