summaryrefslogtreecommitdiff
path: root/include/inject.sh
AgeCommit message (Collapse)Author
3 daysinject: remove superfluous use of evalLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
9 daysinject.sh: don't exit from patch_releaseLeah Rowe
return instead. xbmk's coding style specifically prohibits anything other than x_ or err from running "exit". Signed-off-by: Leah Rowe <leah@libreboot.org>
9 daysxbmk: tidy up some if statementsLeah Rowe
this is an extension of the previous work to unroll most of the condensed code lines. Signed-off-by: Leah Rowe <leah@libreboot.org>
10 daysmake notices a bit more readableLeah Rowe
add line breaks, so that the license and author are visually separated. this makes it easier to read. Signed-off-by: Leah Rowe <leah@libreboot.org>
11 daysinject.sh: unroll condensed code linesLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-09-18Revert "xbmk: don't use backticks for command substitution"Leah Rowe
This reverts commit 4999a49de39667b3239fc2010d0e99c958b29417.
2025-09-13xbmk: much more verbose error messagesLeah Rowe
use the new functionality in err(), whereby a given function name and arguments can be provided, for debugging purposes. something similar was already done in a few places, and replaced with this unified functionality. this patch will make xbmk much easier to debug, under fault conditions. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-09-11inject.sh: add missing semicolon in caseLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-09-11xbmk: don't use backticks for command substitutionLeah Rowe
the newer way handles escaped characters better, and it can be nested more easily. it's also more readable. personally, i prefer the old way, because it's more minimalist, but it occurs to me that a lot of people nowadays don't know about backticks, but they do know of the modern way. to make the code more readable, i have modernised it. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-09-09Revert "inject.sh: put tmpromdel in xbtmp, not cache/"Leah Rowe
This reverts commit a444910bf2f2cd39039116f38439012031b11963.
2025-09-07inject.sh: put tmpromdel in xbtmp, not cache/Leah Rowe
cache/ is meant for permanent cached files, not for temporary files. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-09-02xbmk: remove xbloc, re-use xbtmp insteadLeah Rowe
we no longer separate them. xbloc was the on-disk tmp directory, whereas xbtmp used to be in /tmp which we assumed to be tmpfs (it may not be, but often is on many workstation setups - and our documentation recommended doing this). as mentioned in the previous commit, benchmarking shows little speed difference using tmpfs /tmp versus on-disk /tmp, for our purposes at least. therefore, the handling of tmp files is being greatly simplified. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-09-01inject/vendor.sh: stricter set + usageLeah Rowe
set - as soon as possible, for example in the extract_me function. we only turn off error handling when certain error-prone tasks are performed, and mitigations are in place after these commands run to make sure that the result was valid. this is because in some cases, we want certain buggy behaviours to be permitted, with errors handled in a more fine-tuned way, because sh can sometimes be much stricter depending on the implementation; otherwise, we almost always rely on -e -u in most of the build system. this mainly affects the vendorfile insertion logic. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-08-29inject.sh: redirect stderer to /dev/null FIRSTLeah Rowe
for the grep command, we must ensure that errors are suppressed *BEFORE* outputting to a file. depending on the sh implementation, the previous code might have begun outputting to a file before suppressing errors. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-06-05inject.sh: add missing semicolonsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-27put coreboot utils in elf/coreboot/TREELeah Rowe
not elf/UTIL/TREE This way, they are automatically deleted when a tree has to be re-built. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-26xbmk: rename xbmklocal/xbmktmp variablesLeah Rowe
shorten them Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-18inject.sh: shorten the nukemode variable nameLeah Rowe
just call it "nuke". this is what tells whether to remove vendor files from an archive. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-12inject.sh: remove the hashfiles variableLeah Rowe
we only use it once, and it's a trivial string Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-12inject.sh: define xchanged here insteadLeah Rowe
this is used here, and also needed in cbmk. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-11inject.sh: only compile nvmutil if neededLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-11inject.sh: simplified serprog checkLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-11vendor.sh: split up setvfile()Leah Rowe
split the actual bootstrapping to getvfile() setvfile only sets the config, but then it will call getvfile() to act on that config. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-10remove another confusing messageLeah Rowe
the current message says the file name, and implies that the given file has already been updated. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-10inject.sh: Remove confusing path on tar creationLeah Rowe
The path is wrong. The correct path is printed afterward. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-10inject.sh: re-add mac address confirmationLeah Rowe
it just makes the script more user-friendly Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-10inject.sh: further cleanup for vendor.shLeah Rowe
i moved out more code to vendor.sh, to reduce the amount of lbmk-only code on inject.sh this should reduce the number of merge conflicts even further, when cherry picking from lbmk to cbmk. in particular, vendor file insertion is now handled entirely through the "setvfile" function, instead of from inject.sh, which seems counterintuitive, but remember that inject.sh also does MAC addresses. therefore, the inject.sh script is now primarily for inserting MAC addresses, and handles vendor downloads in a slightly more convoluted way, but still easy enough to understand if you read it a bit. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-10inject.sh: split to vendor.sh the download partsLeah Rowe
to the extent feasible, keep lbmk-specific parts on inject.sh to a minimum. this will later be used to re-sync cbmk's inject.sh with lbmk's, because cbmk's one doesn't handle vendor files. the way this is designed now, with this patch, will make cherry-picking lbmk to cbmk easier in the future, when keeping this part of cbmk in sync with lbmk. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-10inject.sh: split up the inject functionsLeah Rowe
generally go for a more linear function order, and split up any functions. the objective is to have functions only suitable to libreboot be separate. more splitting will be done, and eventually the vendor-download functions will be split into a new file, as will several other functions. this is being done as part of an effort to bring the libreboot and canoeboot versions of inject.sh in sync, so that from now on, cherry picking between the two projects will produce fewer merge conflicts and require a lesser amount of post-merge maintenance. some other minor cleanup has also been done; for example, the "need_files" variable is redundant and was removed. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-09lbmk: use x_ instead of err, where appropriateLeah Rowe
many places in lbmk used err, because older versions of x_ did not handle globbing properly. however, use of x_ is preferable on trivial commands. the only time err() should be called is what it has to be, when x_ can't work, or when a more useful error message is needed, for context. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-09inject.sh: use direct comparison for metmpLeah Rowe
use of the e function would slow down execution, and it's mostly unnecessary in this case. the e function is only needed if we want to confirm via user message that a file exists. that is not needed here. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-09inject.sh: use subshell to speed up find_me()Leah Rowe
the current test allows a further extraction after running mecleaner, even if me.bin was found. further, any recursive calls that exit non-ze don't lot the loop acthually stop, unless we subshell that too, otherwise fx_ is returned to return 0 when a given command it runs returns 1, or more specifically: the for loop in x_ breaks. this is by design, and there's not much that can be done, but this patch should pseed up extraction a little bit, when dealing with intel me files. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-07inject.sh: simplify extract_kbc1126ec()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-07inject.sh: simplified MAC address handlingLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-07inject.sh: Simplify patch_release_roms()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-07inject.sh: rename copytb and preprom functionsLeah Rowe
make them shorter so they go on one line again Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-07lib.sh: Simplified fx_() and removed fe_()Leah Rowe
Instead of calling fe_, prefix x_ as indicated. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-07lib.sh: support any command on find_exec()Leah Rowe
right now, we assume "find", but it adds any number of arguments next to that. change it instead to support any command, where the assumption is that it would generate a list of files and directories. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-07inject.sh: Simplify extract_intel_me_bruteforce()Leah Rowe
This is probably about as small as it's going to get. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-06inject.sh: clean up tmp me file before extractLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-06inject.sh: tidy up extract_intel_me_bruteforceLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-06inject.sh: fix oversight in me bruteforceLeah Rowe
i used i instead of 1, in the variable when running the extract_archive function. this didn't trigger since +u was set, and +e was set. in practise, then, it seems that because of this, and because my ME extract/insert test was a success, that none of the archives we use actually have a ME inside of a file inside of a given downloaded archive. still, this is technically incorrect, so fix it! Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-06inject.sh: remove unnecessary checkLeah Rowe
the call stack already falls through with a bunch of return 1s after a successful run of me_cleaner, so it's really not necessary. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-06inject.sh: don't use subshell for me bruteforceLeah Rowe
i needed it on the old version, which used cd this one stays in the same directory at all times Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-06inject.sh: insanely optimise the me bruteforceLeah Rowe
use fe_ fe_ ftw Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-06inject.sh: remove unused functionLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-05inject.sh: Further simplified FSP extractionLeah Rowe
We don't need the copy command at all, since the files it copies are the only ones that the Python script does anyway, so now we just make that script output to the directory, directly, where these files must go. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-05inject.sh: simplify kconfig scanningLeah Rowe
Use fe_ with a new function, scankconfig, to do the same thing. Not only is this simpler, it now also operates on all coreboot configs for a given target, whereas it previously only operated on the first one. This is useful for cases where one config might use a file that the other one does not; in practise, we don't do this yet, but it's a theoretical possibility Also: don't use the function check_defconfig, which is now redundant and has been removed. That function also conflicted with another function by the same name in mk, but fortunately didn't cause an issue in practise, due to how sh works; when vendor.sh was used, it was without running the tree commands, except under a separate lbmk instance. So this is a simplification, a feature enhancement and even a bug fix, all wrapped into one! Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-05lbmk: Replace err with much simpler implementationLeah Rowe
The current implementation is insanely over-engineered, and completely unnecessary. 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>