summaryrefslogtreecommitdiff
path: root/script/roms
AgeCommit message (Collapse)Author
2024-06-24roms main(): confirm what serprog images are builtLeah Rowe
just like we do for coreboot images, do it for serprog. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-24roms: remove unused variable nameLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-24roms: remove redundant printfLeah Rowe
we don't need this message here, because the final confirmation at the end of main() says which targets were built. saying what individual rom images were built is just needless bloat, especially with the new simplified lbmk design; we no longer provide lots of rom images with different keymaps, because we now expect the user to insert a gkb file themselves with cbfstool. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-24roms: optimise u-boot elf checkLeah Rowe
because we use crossgcc here, blindly running trees -f means needlessly re-running buildgcc, which then checks for gcc binaries, even though we already know that the u-boot binary exists. skip this check if u-boot exists. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-24roms: simplify build_roms()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-24roms: make the bin/elf message more politeLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-24roms: re-add final confirmation of targetsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-24roms: rename functions for extra clarityLeah Rowe
the names of these functions do not match their true intent. fix that by renaming them appropriately. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-24roms: build coreboot early to avoid duplicate workLeah Rowe
we're building it per coreboot configuration file, rather than per-target; the latter is more appropriate, and saves on compilation time. do it per-target.cfg, not per coreboot configuration. this works because the trees script compiles all images per target, for each given coreboot configuration within that target, e.g. libgfxinit _corebootfb and _txtmode. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-23roms: general code cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-22roms: only support SeaBIOS/SeaGRUB on x86Leah Rowe
Never, ever build images where GRUB is the primary payload. These options have been removed from target.cfg handling: * seabios_withgrub * grub_withseabios The "payload_grub" variable now does the same thing as the old "seabios_withgrub" variable, if set. The "grubonly" configuration is retained, and enabled by default when SeaGRUB is enabled (non-grubonly also available). Due to lbmk issue #216, it is no longer Libreboot policy to make GRUB the primary payload on any board. GRUB's sheer size and complexity, plus the large number of memory corruption issues similar to it that *have* been fixed over the years, tells me that GRUB is a liability when it is the primary payload. SeaBIOS is a much safer payload to run as primary, on x86, due to its smaller size and much more conservative development; it is simply far less likely to break. If GRUB breaks in the future, the user's machine is not bricked. This is because SeaBIOS is the default payload. Since I no longer wish to ever provide GRUB as a primary payload, supporting it in lbmk adds needless bloat that will later probably break anyway due to lack of testing, so let's just assume SeaGRUB in all cases where the user wants to use a GRUB payload. You can mitigate potential security issues with SeaBIOS by disabling option ROM execution, which can be done at runtime by inserting integers into CBFS. The SeaBIOS documentation says how to do this. Libreboot's GRUB hardening guide still says how to add a bootorder file in CBFS, making SeaBIOS only load GRUB from CBFS, and nothing else. This, combined with the disablement of option ROM execution (if using Intel graphics), pretty much provides the same security benefits as GRUB-as-primary, for example when setting a GRUB password and GPG checks, with encrypted /boot as in the hardening guide. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-22roms: remove support for "grubonly" seabiosLeah Rowe
due to lbmk issue #216, it is now unwise to use grub as the primary payload on any machine; the sheer complexity of grub and the number of memory corruption bugs that have been fixed due to auditing over the years, means more such bugs exist. we now provide seabios as the primary payload on all x86 ports, but provide a "grubfirst" configuration where a bootorder file in seabios can be added via cbfs, which tells seabios to load grub from cbfs first, while still allowing use of the boot select menu by pressing esc in seabios. well, the "grubonly" option also disables the seabios esc menu, so that *only* grub runs. there is no point in using this unless you want to harden your setup, for example if you want to set up encrypted /boot and boot that from grub, and have a grub password disallowing unauthorised bootup of your machine. see grub hardening guide; https://libreboot.org/docs/linux/grub_hardening.html at least as of today, 22 June 2024, that page already says how to manually disable the seabios menu in the same way, if that is the setup you want. alternatively, a user may be wily enough to edit target.cfg for their board and compile a rom that only has the grub payload in it, if that is what the user wishes to do. regardless, the default configurations provided by lbmk must never be unsafe, norc should the build system support such unsafe settings; yes, grub as primary payload is technically still supported in lbmk. actually, at the time of this revision, i have half a mind to remove that functionality altogether, so that only seabios is allowed as primary payload, when compiling a rom image that also has grub, chainloading grub from the seabios menu instead. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-22use backticks on eval commands, not subshellsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-22lib.sh: remove badcmd()Leah Rowe
it's bloat. telling the user to rtfm is something that we already do on irc; they will still ask how to do everything, and ignore the message from badcmd(), or they will automatically know to rtfm. i'm on a massive purge, removing bloat from lbmk as part of Libreboot Build System Audit 6. all bloat must go. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-22lib.sh: more unified config handlingLeah Rowe
replace it with logic that simply uses "." to load files directly. for this, "vcfg" is added as a variable in coreboot target.cfg files, referring to a directory in config/vendor/ containing a file named pkg.cfg, and this file then contains the same variables as the erstwhile config/vendor/sources config/git files are now directories, also containing pkg.cfg files each with the same variables as before, such as repository link and commit hash this change results in a noticeable reduction in code complexity within the build system. unified reading of config files: new function setcfg() added to lib.sh setcfg checks if a config exists. if a 2nd argument is passed, it is used as a return value for eval, otherwise a string calling err is passed. setcfg output is passed through eval, to set strings based on config; eval must be used, so that the variables are set within the same scope, otherwise they'd be set within setcfg which could lead to some whacky results. there's still a bit more more to do, but this single change results in a substantial reduction in code complexity. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-20roms: fix lack of backslash on multi-line commandLeah Rowe
Signed-off-by: Leah Rowe <info@minifree.org>
2024-06-20Revert "roms: remove build_payloads() and split it up"Leah Rowe
This reverts commit 3610667e3db08ff1db4f7784ff5a879d8aebce9d. The output of some functions in the roms script are used as an argument in cp and mv commands, also cbfstool. I overlooked this fact in a previous code optimisation. Revert it. The change only reduced sloccount by a few lines anyway.
2024-06-20minor code cleanup in the build systemLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-20roms: merge mkserprog() into main()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-19roms: don't insert timeout.cfgLeah Rowe
this is bloat, because it's something the user can already do at runtime configuration anyway. set it to a reasonable default of 8 seconds instead of 5, and don't honour the timeout variable in target.cfg. this will be documented in the next release. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-19correctionLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-19roms: reduce indentation in build_grub_roms()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-19roms: re-introduce accidentally disabled checkLeah Rowe
i disabled a check in the script, while testing a prior modification. re-introoduce the check, which is put there to yield an error condition if no targets were compiled. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-19roms: remove build_payloads() and split it upLeah Rowe
payloads are compiled before coreboot, but it doesn't matter to the build speed whether this is done first. reduce the lines of code by checking payload builds *while* adding them to the coreboot images. this means that coreboot is now compiled first, before the payloads. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-19roms: group some commands that are similarLeah Rowe
this makes the build_payloads() function nicer to read Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-19roms: remove mt86bin variableLeah Rowe
it's only meaningfully used once, so just hardcode the string, which is not set dynamically anyway. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-18roms: merge build_uboot_payload to build_payloadsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-18roms: simplify payload_uboot y/n checkLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-18roms: simplify the check for serprog srcdirLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-18roms: simplify the loop for building serprog romsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-18roms: shorten variable serprog_boards_dirLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-18roms: simplified serprog image copyLeah Rowe
use eval to avoid having two mv commands Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-18roms: rename picosrc variable to rp2040srcLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-18roms: remove useless confirmation in mkserprogfwLeah Rowe
the user knows where to look. replace it with a single declaration. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-18roms: merge serprog build into one functionLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-17roms: remind the user about gkb filesLeah Rowe
nowadays, we don't insert GRUB keymaps automatically, for sake of efficiency; without one, the default is US QWERTY. a user will only want one keymap in particular, so this is more efficient. in practise, they're either building from source anyway, or using the inject scripts which compile cbfstool anyway, so the user will already have cbfstool. also output this message from the inject script. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-17roms: rename x variable to it in for loopaudit6-merge1Leah Rowe
there are two for loops that use x as a variable anme, and an idiosyncrasy of certain sh implementations is that these become global; the result in this case was that when you finish building every target in "./build roms", it would print "libgfxinit" repeatedly, comma separated, instead of a comma-separated list of the targets that were built. work around it by renaming the variable in one of the loops. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-16roms: don't use x_ to call cproms()Leah Rowe
cproms() never returns non-zero, so it doesn't make sense to use x_ here Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-16roms build_uboot_roms(): move rom, don't copyLeah Rowe
that way, we don't have to delete the temporary file. just move it entirely. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-16roms cproms(): allow other commands besides cpLeah Rowe
e.g. the operator might specify mv instead Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-16unify coreboot elfdir (DO_NOT_FLASH)Leah Rowe
use a common string when setting this path Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-16roms: merge mkUbootRom() into build_uboot_roms()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-16roms: simplify mkSeabiosRom()Leah Rowe
remove variables that are not meaningfully used Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-16roms: simplify mkUbootRom()Leah Rowe
remove variables that are not meaningfully used Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-16roms: simplify build_roms()Leah Rowe
cbcfg is already a global variable, so there's no reason to set it again at the start of this function. remove the check for whether the given coreboot config exists, to the calling function instead of build_roms(). Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-16roms: remove unnecessary checkLeah Rowe
uboot_config is later only used if payload_uboot is set Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-16roms: further clean up build_grub_roms()Leah Rowe
the tmpcfg variable will be useful elsewhere, for the same kind of change as before. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-16roms: simplify timeout/scandisk insertionLeah Rowe
we don't need to call mktemp everytime. just use a staticly named file in tmpdir and keep overwriting it. these files are only small, and they get deleted when the build system exits later on. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-16roms: simplify seagrub check in build_grub_romsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-16roms: simplify mkserprog()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>