7.5 KiB
title | x-toc-enable |
---|---|
Modifying grub.cfg in CBFS | true |
Releases or or after Canoeboot 20231026 contain grub.cfg
inside GRUB memdisk,
inaccessible directly from CBFS, but the memdisk is inside grub.elf
which
gets put inside CBFS.
An override is possible, on new Canoeboot revisions. If grub.cfg
is present
in CBFS, Canoeboot's GRUB will use that and not the memdisk one; it will not
auto-switch to grubtest.cfg
, but the test config will be available in the
menu to switch to, if present. This contrasts older behaviour in
Libreboot 20230625.
You can find grub.cfg
under lbmk (for this purpose, it's best to use the
lbmk one, not the release one - unless you're using a release image).
Find it at path (in current lbmk): config/grub/config/grub.cfg
.
So, you can add grubtest.cfg
as normal, test that, and
then add grub.cfg
once you're happy, and it will override the default.
In Libreboot 20230625 and older, GRUB memdisk always loaded the config from
CBFS, which you would have to replace; this meant it was possible to brick
your GRUB installation if you accidentally flashed without grub.cfg
. In
Canoeboot 20231026 and higher, such error is impossible; this behaviour is
also present in Libreboot 20231021, upon which Canoeboot 20231026 is based.
This new behaviour is therefore much safer, under user error. However, it's
still possible to flash a bad grub.cfg
by misconfiguring it, which is why
you should add grubtest.cfg
first; when present, it will be available in
the default menu, for testing, but the GRUB memdisk config will always be used
first if no grub.cfg
(as opposed to grubtest.cfg
) exists in CBFS.
Insert new grub.cfg
You can find the default config under config/grub/config/grub.cfg
in the
Canoeboot build system,
Remove the old grub.cfg
(substitute with grubtest.cfg
as desired):
cbfstool dump.bin remove -n grub.cfg
Add your modified grub.cfg
(substitute with grubtest.cfg
as desired):
cbfstool dump.bin add -f grub.cfg -n grub.cfg -t raw
Flash the modified ROM image
Your modified dump.bin
or other modified Canoeboot ROM can then be re-flashed
using:
sudo ./flashprog -p internal -w dump.bin
If a -c
option is required, use it and specify a flash chip name. This is
only useful when flashprog
complains about multiple flash chips being
detected.
If flashprog complains about wrong chip/board, make sure that your ROM is for the correct system. If you're sure, you can disable the safety checks by running this instead:
sudo ./flashprog -p internal:laptop=force_I_want_a_brick,boardmismatch=force -w dump.bin
If you need to use external flashing equipment, see the link above to the Raspberry Pi page.