summaryrefslogtreecommitdiff
path: root/include
AgeCommit message (Collapse)Author
2025-05-05singletree/elfcheck: use fx_, not fe_Leah Rowe
fe_ returns an error on the find command, but we rely on the only error ever being our intentional exit, upon discovering files. in singletree, the directory being checked was already checked first, so we know it's safe not to err on find; and find not reporting an error if no files are found is ok. on elfcheck, it's very much the same thing. In fact, we very much want it to return 0 if the directory doesn't exist, or if files don't exist within it. Therefore, use fx_ which is designed for this use-case. Quick re-cap: fx and fe execute a given function name with each line outputting by find as an argument, each time. It is somewhat similar in scope to find's -exec command. We use fe_ as shorthand in several places all over lbmk. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-05rom.sh: Print the rom image path being generatedLeah Rowe
This message used to exist, and it's a nice feedback for the user, to confirm that the build went OK. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-05rom.sh: Safer cprom()Leah Rowe
Don't insert special files like GRUB keymaps after copying to the final destination. Instead, copy the tmprom to /tmp and operate on that, in these instances. This is less efficient, depending on the user's configuration; if /tmp is on the same file system as the user's xbmkpwd, it should be fine. However, the actual performance hit isn't that bad in practise, on most setups. If the user's /tmp is a tmpfs, then that means using tmpfs, but it's one image at a time. It should be OK. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-05rom.sh: specifically check keymaps in cprom()Leah Rowe
"not seauboot" is a valid check at present, but if i start supporting other arguments in the future, this code would have to change. therefore, i change it in advance, on that theory. this new check is more technically correct. these lines are triggered when inserting grub keymaps. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-05rom.sh: simplify mkseagrub()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-05lib.sh: simplify singletree()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-05git.sh: move singletree() to lib.shLeah Rowe
it's also used by mk, to determine which build function to use (build_project or build_targets). Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-05inject.sh: simplify extract_intel_me_bruteforce()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-05inject.sh: Remove unnecessary checkLeah Rowe
_dest is already checked in the calling function fetch(), after extract_tbfw() has been called. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-05inject.sh extract_intel_me(): reduce indentationLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-05inject.sh: Move FSP extraction only to extract_fspLeah Rowe
Don't do FSP-specific extraction in extract_archive, as that is not what the latter is for. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-05inject.sh: tidy up intel me handlingLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-05inject.sh: tidy up the deguard commandLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-05lib.sh: set -u -e in err()Leah Rowe
Some parts of lbmk set +u +e, to be reset later on under normal conditions upon exit. We must ensure such level of integrity in err() as well. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04lib.sh: Provide error message where none is givenLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04init.sh: Silence the output of git config --globalLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04init.sh: Run git name/email check before initLeah Rowe
Otherwise, it returns if init is already done, which later leads to build errors in coreboot. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04lib.sh: stricter xbmk_err check in err()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04lib.sh: simplify err-not-set handlingLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04lib.sh: Add warning if x_ is called without argsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04lib.sh: simplify err()Leah Rowe
Rely once again on err_, but still explicitly add an exit just below, in case I made a mistake one day. err() is essentially a trap that triggers in case I mess up an error function, so that it doesn't reliably exit. So, the idea is that everything calls err(), and err() is almost never modified, or modified very carefully. If error exits were ever broken, the result could be quite unpredictable, so lbmk has very strict error handling, and great care is taken to ensure that it does reliably exit. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04init.sh: single-quote xbmklock in xbmk_lock()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04init.sh: define lock file in a variable insteadLeah Rowe
don't hardcode it. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04init.sh: tidy up xbmk_child_exec()Leah Rowe
make the command style more consistent, for example relying on x_ inside a subshell to print the command and arguments if a command failed. this is a good style, and i'll probably use it in other places on lbmk. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04lib.sh err: add missing redirect to stderrLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04lbmk: MUCH safer err functionLeah Rowe
Don't directly call a variable. Call a function that checks the variable instead. The new err function also checks whether an exit was actually done, and exits 1 if not. If an exit was done by the given function, but the exit was zero, this is also corrected to perform an exit 1. This fixes a longstanding design flaw of lbmk. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04lib.sh: rename errx to xmsgLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04lib.sh: Make x_ err if first arg is emptyLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04lib.sh: Make err_ always exit no matter whatLeah Rowe
Always certainly redundant, since if -u -e isn't set, it'll continue to exit anyway. However, we want to be pedantic about this, since the safety of lbmk relies entirely on this function NOT misbehaving. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04inject.sh: tidy up TBFW handlingLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04inject.sh: remove useless comment blockLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04init.sh: tidy up the python version checkLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04init.sh: move non-init functions to lib.shLeah Rowe
these were missed in a previous cleanup Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04init.sh: simplify dependencies handlingLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04rom.sh: tidy up copyps1bios()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04init.sh: tidy up pathdir creationLeah Rowe
we can use remkdir here. it does the same thing. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-03mk: Allow use of x_ on prefix functionsLeah Rowe
Use this for the sha512sum command, on the main mk script at the function check_project_hashes(). Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-03inject.sh: minor code cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-03inject.sh: simplify extract_archive()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-03inject.sh: simplified fsp extractionLeah Rowe
we know that _dest is always what's set in the coreboot config, without the ../../../ in it, so just copy both files in a single function, and call the function twice. if both files are done on the first call, the second call will be skipped. if only the first file was done on the first call, running the download script again will skip the first one, and grab the second one. this also avoids having to run the decat function twice, in most cases, so it's a tiny optimisation. this optimisation only works if both fsp files (s and m) are to be extracted into the same directory, which is the case anyway, and this will always be the case. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-03inject.sh: Remove redundant code in copy_tbfwLeah Rowe
We don't use the tbtmp variable anymore, in this function. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-03inject.sh: Stricter TBFW handlingLeah Rowe
Don't copy it until it has been padded properly. Otherwise, erroneous padding would result in an error, and who knows what would be left in vendorfiles/ ? Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-03init.sh: *Re-create* tmpdirs on parent instanceLeah Rowe
To make sure any old files are removed, always re-create. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-03init.sh: Always create xbmklocalLeah Rowe
If we're in a release work directory, TMPDIR is already set, so the local ./tmp won't be created, which would lead to an error. Fix it by creating xbmklocal before checking TMPDIR. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-03lbmk: Unified local ./tmp handlingLeah Rowe
Make it an absolute directory, relative to xbmktmp. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-03lib.sh: redirect find errors to /dev/nullLeah Rowe
this silences confusing error messages that the user sees on the screen, that are actually benign, and it will thus reduce the number of people who ask questions on #libreboot irc Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-03lib.sh: Fix bad touch commandLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-03inject.sh: Only build nvmutil onceLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-03inject.sh: always re-build nvmutilLeah Rowe
it's not a lot of code, and takes less than a second. the previous change uses x instead of ?, but this would cause an error if the nvmutil was already built, because the makefile might cause a build to be skipped. therefore, force a re-build to mitigate the error. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-03util/nvmutil: use x, not ?, for random charactersLeah Rowe
A user reported that '?' causes an error on zsh. See: https://codeberg.org/libreboot/lbmk/issues/261 For example: ./mk inject libreboot-XXXXXX.tar.xz setmac ??:??:??:??:??:?? The user got: zsh: no matches found: ??:??:??:??:??:?? The mitigation here is to double-quote, e.g.: ./mk inject libreboot-XXXXXX.tar.xz setmac "??:??:??:??:??:??" However, a lot of people won't do that. Therefore, I will retain the current behaviour but support x/X for randomness. Now lbmk uses x by default, instead. I will now update the documentation, accordingly. Signed-off-by: Leah Rowe <leah@libreboot.org>