build/boot/roms: Support removing microcode

From now on, the following rules are available for all
mainboards, in resources/coreboot/boardname/board.cfg:

* blobs_required="n" or "y"
* microcode_required="n" or "y"

The blobs setting, if set to "n", simply renames filename.rom to
filename_noblobs.rom.

The microcode setting, if set to "n", copies the ROM (with or
without _noblobs) to filename_nomicrocode.rom (if blobs="n",
it would be filename_noblobs_nomicrocode.rom).

Where "nomicrocode" is set, ROMs with microcode will still be
provided by lbmk and in relesase, but ROMs will also be provided
alongside it that lacks any microcode updates.

If the *original* ROM already lacks microcode updates, then the
original ROM will be *renamed* to include "nomicrocode" in the name.
This is done on images for ARM platforms, for instance, where
microcode is never used whatsoever.

Example filenames now generated:
seabios_e6400_4mb_libgfxinit_corebootfb_noblobs_nomicrocode.rom
seabios_e6400_4mb_libgfxinit_corebootfb_noblobs.rom
seabios_withgrub_hp8300usdt_16mb_libgfxinit_corebootfb_colemak_nomicrocode.rom
seabios_withgrub_hp8300usdt_16mb_libgfxinit_corebootfb_colemak.rom
uboot_payload_gru_kevin_libgfxinit_corebootfb_noblobs_nomicrocode.rom

A vocal minority of people were not happy with some of the changes
made in Libreboot last year, including on existing supported
hardware from before those changes were made. I did this before the
last release, out of respect:
https://libreboot.org/news/gm45microcode.html
(re-add mitigations for no-microcode setup on GM45)

This new change is done as an further, extended courtesy. Tested
and works fine. (testing using cbfstool-print)

Actual Libreboot policy about binary blobs is nuanced. See:
https://libreboot.org/news/policy.html (reduction policy) and:
https://libreboot.org/freedom-status.html (implementation)

Well, the status page talks about descriptor vs non-descriptor
on Intel platforms, and where me_cleaner is used (on platforms
that need Intel ME firmware), it regards the descriptored setups
to be blob-free if coreboot does not require binary blobs.

In this paradigm, microcode updates are not considered to be
binary blobs, because they aren't technically software, they're
more like config files that just turn certain features on or off
within the CPU.

However, for lbmk purposes, "noblobs" means that, after the ROM
is fully ready to flash on the chip, there will be no blobs in
it (except microcode). So for example, an X200 that does not
require ME firmware is considered blob-free under this paradigm,
even though Libreboot policy regards X230 as equally libre when
me_cleaner is used; in this setup, ROMs will not contain "blobfree"
in the filename, for X230 (as one example).

Signed-off-by: Leah Rowe <leah@libreboot.org>
fsdg20230625
Leah Rowe 2023-06-18 14:12:31 +01:00
parent 25474414cf
commit f338697b96
61 changed files with 129 additions and 1 deletions

View File

@ -4,3 +4,5 @@ arch="x86_64"
payload_grub="n"
payload_grub_withseabios="n"
payload_seabios="y"
microcode_required="n"
blobs_required="n"

View File

@ -5,3 +5,5 @@ payload_grub="y"
payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
microcode_required="n"
blobs_required="n"

View File

@ -6,3 +6,5 @@ payload_grub_withseabios="n"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"
blobs_required="n"

View File

@ -4,3 +4,5 @@ arch="x86_64"
payload_grub="n"
payload_grub_withseabios="n"
payload_seabios="y"
microcode_required="n"
blobs_required="n"

View File

@ -5,3 +5,5 @@ payload_grub="n"
payload_grub_withseabios="n"
payload_seabios="y"
payload_memtest="n"
microcode_required="n"
blobs_required="n"

View File

@ -2,3 +2,5 @@ cbtree="cros"
romtype="normal"
arch="AArch64"
payload_uboot="y"
blobs_required="n"
microcode_required="n"

View File

@ -2,3 +2,5 @@ cbtree="cros"
romtype="normal"
arch="AArch64"
payload_uboot="y"
blobs_required="n"
microcode_required="n"

View File

@ -6,3 +6,4 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"

View File

@ -6,3 +6,4 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"

View File

@ -6,3 +6,4 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"

View File

@ -6,3 +6,4 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"

View File

@ -6,3 +6,4 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"

View File

@ -6,3 +6,4 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"

View File

@ -6,3 +6,5 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"
blobs_required="n"

View File

@ -6,3 +6,5 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"
blobs_required="n"

View File

@ -6,3 +6,5 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"
blobs_required="n"

View File

@ -6,3 +6,5 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"
blobs_required="n"

View File

@ -2,3 +2,5 @@ cbtree="cros"
romtype="normal"
arch="ARMv7"
payload_uboot="y"
blobs_required="n"
microcode_required="n"

View File

@ -2,3 +2,5 @@ cbtree="cros"
romtype="normal"
arch="ARMv7"
payload_uboot="y"
blobs_required="n"
microcode_required="n"

View File

@ -2,3 +2,5 @@ cbtree="default"
romtype="normal"
arch="AArch64"
payload_uboot="y"
blobs_required="n"
microcode_required="n"

View File

@ -7,3 +7,5 @@ payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
payload_uboot="y"
blobs_required="n"
microcode_required="n"

View File

@ -6,3 +6,5 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"
blobs_required="n"

View File

@ -6,3 +6,5 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"
blobs_required="n"

View File

@ -6,3 +6,5 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"
blobs_required="n"

View File

@ -6,3 +6,5 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"
blobs_required="n"

View File

@ -6,3 +6,5 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"
blobs_required="n"

View File

@ -6,3 +6,5 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"
blobs_required="n"

View File

@ -6,3 +6,5 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"
blobs_required="n"

View File

@ -6,3 +6,4 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"

View File

@ -6,3 +6,4 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"

View File

@ -6,3 +6,4 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"

View File

@ -5,3 +5,4 @@ payload_grub="n"
payload_grub_withseabios="n"
payload_seabios="y"
payload_memtest="y"
microcode_required="n"

View File

@ -6,3 +6,4 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"

View File

@ -6,3 +6,5 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"
blobs_required="n"

View File

@ -6,3 +6,5 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"
blobs_required="n"

View File

@ -6,3 +6,5 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"
blobs_required="n"

View File

@ -6,3 +6,4 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"

View File

@ -6,3 +6,4 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"

View File

@ -6,3 +6,5 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"
blobs_required="n"

View File

@ -6,3 +6,5 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"
blobs_required="n"

View File

@ -6,3 +6,5 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"
blobs_required="n"

View File

@ -6,3 +6,5 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"
blobs_required="n"

View File

@ -6,3 +6,5 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"
blobs_required="n"

View File

@ -6,3 +6,4 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"

View File

@ -5,3 +5,4 @@ payload_grub="n"
payload_grub_withseabios="n"
payload_seabios="y"
payload_memtest="y"
microcode_required="n"

View File

@ -6,3 +6,4 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"

View File

@ -6,3 +6,5 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"
blobs_required="n"

View File

@ -6,3 +6,5 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"
blobs_required="n"

View File

@ -6,3 +6,5 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"
blobs_required="n"

View File

@ -6,3 +6,4 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"

View File

@ -6,3 +6,4 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"

View File

@ -6,3 +6,4 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"

View File

@ -6,3 +6,4 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"

View File

@ -6,3 +6,4 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"

View File

@ -6,3 +6,4 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"

View File

@ -6,3 +6,5 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"
blobs_required="n"

View File

@ -6,3 +6,5 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"
blobs_required="n"

View File

@ -6,3 +6,5 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"
blobs_required="n"

View File

@ -6,3 +6,5 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"
blobs_required="n"

View File

@ -6,3 +6,5 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
microcode_required="n"
blobs_required="n"

View File

@ -60,6 +60,10 @@ cbfstool=""
corebootrom=""
seavgabiosrom=""
# almost all boards will set at least one of these to "n"
blobs_required=""
microcode_required=""
CROSS_COMPILE=""
main()
@ -172,6 +176,14 @@ load_config()
[ "${uboot_config}" = "undefined" ]; then
uboot_config="default"
fi
if [ "${microcode_required}" != "n" ] \
&& [ "${microcode_required}" != "y" ]; then
microcode_required="y"
fi
if [ "${blobs_required}" != "n" ] \
&& [ "${blobs_required}" != "y" ]; then
blobs_required="y"
fi
load_config_overrides
die_if_cbconfig_and_nopayload
@ -689,6 +701,10 @@ moverom()
_newrom="$2"
cuttype="$3"
if [ "${blobs_required}" = "n" ]; then
_newrom="${_newrom%.rom}_noblobs.rom"
fi
printf "\nCreating new ROM image: %s\n" "${_newrom}"
cp ${rompath} ${_newrom}
@ -701,7 +717,6 @@ moverom()
seek=$(($(stat -c %s ${_newrom}) - 0x20000)) \
count=64k conv=notrunc
rm -f top64k.bin
return 0
fi
for romsize in 4 8 16; do
@ -723,6 +738,21 @@ moverom()
conv=notrunc
done
done
if [ "${microcode_required}" = "n" ]; then
_newrom_b="${_newrom%.rom}_nomicrocode.rom"
cp "${_newrom}" "${_newrom_b}" || exit 1
microcode_present="y"
"${cbfstool}" "${_newrom_b}" remove -n \
cpu_microcode_blob.bin || microcode_present="n"
if [ "${microcode_present}" = "n" ]; then
rm -f "${_newrom_b}" || exit 1
printf "REMARK: '%s' already lacks microcode\n" \
${_newrom}
printf "Renaming default ROM file instead.\n"
mv "${_newrom}" "${_newrom_b}" || exit 1
fi
fi
}
main $@