summaryrefslogtreecommitdiff
path: root/include/vendor.sh
AgeCommit message (Collapse)Author
2025-05-27Revert "inject.sh: simplify remktar()"Leah Rowe
This reverts commit 28f03d39cb1a7cfa8db46b3875557a530aebdd46. The commit that this reverts, broke building release roms. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-27vendor.sh: simplify getfiles()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-27inject.sh: simplify remktar()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-27vendor.sh: fix bad cbfstool pathLeah Rowe
i overlooked this one in the previous commit there is always one. 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-26general cleanup in get.sh and vendor.shLeah Rowe
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-26vendor.sh: simplify fetch()Leah Rowe
the checks at the end of the function are mostly superfluous, because bad_checksum() is immediately called just beforehand, and performs the same checks. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-22vendor.sh: add colon at the end of a for loopLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-20Revert "vendor.sh: optimise find_me()"Leah Rowe
This reverts commit fb7aaa78bb080a473bdf0edf449bf08045e8366c. it caused a few issues. will re-do later the old code isn't really broken, just inefficient, because several files are scanned twice, but in practise the overhead isn't that great The error occurs sometimes, when bruteforcing me.bin: ERROR ./mk: Unhandled error for: mv /home/user/lbmk/tmp/me.bin /home/user/lbmk/cache/tmpdl/check This revert should fix the issue, for now.
2025-05-20vendor.sh: optimise find_me()Leah Rowe
i'm adding characters to 7ztest, which isn't being passed on through because everything runs in subshells; the next pass would default back to the original string, so a given file may be checked multiple times. fix this by mitigation; use the random string from mktemp as a suffix instead. in practice, this has not affected performance much, but it will nevertheless avoid unnecessary work by xbmk. 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-18vendor.sh: simplify mksha512sum()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-18vendor.sh: Remove _dest if it's badLeah Rowe
Also, provide more ample warning to the user Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-16vendor.sh: Fix broken KBC1126 insertionLeah Rowe
On release archives, I overlooked the previous change to downloads, during the recent implementation of extra safety checks. I previously checked there whether the variable named CONFIG_KBC1126_FIRMWARE was defined, and grabbed both; now I check CONFIG_KBC1126_FW1 and CONFIG_KBC1126_FW2 separately, grabbing each file separately. This patch replicates that change for insertions. Otherwise, hash verification on ROM images will fail, when running the inject script on release images. Downloading was being done, reliably, and the extracted files were correct, so there was no danger if the user was building from source and flashing that way. However, checksum verification on full images failed when inserting into archives. This is not because the files were wrong; they were *correct*. However, the EC firmware was not being inserted *at all* on HP EliteBooks, because of this oversight. The check is now based on whether the paths to the files themselves are defined, not whether EC firmware is enabled in the coreboot config; the latter is implied. With this patch, vendor file insertion once again works perfectly, without error, on every board. There was no real danger for users, just a minor inconvenience. Sorry! Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-16vendor.sh: additional safety checkLeah Rowe
the exit from mkdst can also be non-zero if mv or cp failed, but there's no way to handle that reliably. therefore, the checksum verification should be done one final time, to compensate. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-16vendor.sh: Properly verify SHA512SUM on extractionLeah Rowe
I currently check the downloaded files e.g. .exe file, but then I don't check - or even define - sha512sums for the files extracted from them e.g. me.bin This patch fixes that. It also caches the hashed files, so that extraction is faster on a re-run - this makes release builds go faster, when running ./mk release If a checksum is not defined, i.e. blank, then a warning is given, telling you to check a specific directory. This way, when adding new vendor files, you can add it first without specifying the checksum, e.g. me.bin checksum. Then you can manually inspect the files that were extracted, and define it, then test again. In a given pkg.cfg for config/vendor, the following variables are now available for use: FSPM_bin_hash for fsp m module FSPS_bin_hash for fsp s module EC_FW1_hash for KBC1126 EC firmware (1st file) EC_FW2_hash for KBC1126 EC firmware (2nd file) ME_bin_hash for me.bin MRC_bin_hash for mrc.bin (broadwell boards) REF_bin_hash for refcode (broadwell boards) SCH5545EC_bin_hash for sch5545 firmware (Dell Precision T1650) TBFW_bin_hash for Lenovo ThunderBolt firmware (e.g. T480/T480s) E6400_VGA_bin_hash for Dell E6400 Nvidia VGA ROM In practise, most people use release archives, and the inject script, so I knew those were reliable, because the ROM images were hashed prior to removing files. This patch benefits people using lbmk.git directly, without using release files, because now they know they have a valid file e.g. me.bin Previously, only the download was checked, not the extracted files, which meant that the only thing preventing a brick was the code not being buggy. Any number of bugs could pop up in the future, so this new level of integrity will protect against such a scenario, and provide early warning prompting bug fixes. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14get.sh: fix caching of crossgcc tarballsLeah Rowe
they were always re-downloading every time. i've basically re-written most of xbmkget. there was some erroneous conditions under which it wrongly deleted the cached file, resulting in it being downloaded again. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-12lib.sh: remove mk()Leah Rowe
i don't need it. i can use fx_ instead, on functions that previously called mk(). Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-12lib.sh: move mksha512sum() to vendor.shLeah Rowe
this is unused in cbmk. it's only used from vendor.sh. therefore, lbmk shall have it in vendor.sh. 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-12vendor.sh: remove check_vcfg()Leah Rowe
We don't need it. The vfile variable is only used in one place, and only once, for use with setcfg. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-12vendor.sh: simplify getvfile()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-12vendor.sh: simplify setvfile()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-11vendor.sh: tidy up variablesLeah 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-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-04-26rename include/vendor.sh to inject.shLeah Rowe
this matches cbmk, where inject.sh is the file name this will make future cherry-picks of lbmk->cbmk easier Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-26move variables out of init.sh to othersLeah Rowe
move them where they are used, or if they are used in many places, move them to lib.sh Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-26mk: simplify main()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-18vendor.sh: tidy up vendor_download()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-17lbmk: don't handle TMPDIR directlyLeah Rowe
lbmk creates TMPDIR as /tmp/xbmk_*, but it's theoretically possible that something could re-export it by mistake. this change retains the same initialisation, but further use is now via a new variable "xbmktmp", that stores the value of TMPDIR upon lbmk's initialisation of it. this reduces the chance of such a bug in the future, as described above, so it is a preemptive/preventative fix. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-17vendor.sh: yet even more code cleanupLeah Rowe
code equals bugs. code that doesn't exist can't have bugs, so it is superior by definition. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-17vendor.sh: even more cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-17vendor.sh: more cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-17vendor.sh: minor cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-17vendor.sh: simplify process_release_romsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-17vendor.sh: remove unnecessary checkLeah Rowe
the next part checks whether the file is below 512k, so there's no point checking if it's below 2, because the lowest a file size can be is zero, and expr will produce a result of -1 if decrementing from zero. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-17simplify a few file checksLeah Rowe
the combination of x_ with the "e" function enables for much simpler file-check error handling, which is a unique innovation of lbmk as it pertains to sh. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-17lbmk: minor cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-13vendor.sh: don't err on bruteforce me extractLeah Rowe
it wouldn't exit with error status anyway, since i'm setting +e here, but if that accidentally changed in the future, i still wouldn't want this to exit. the bruteforce me extraction naturally throws a lot of errors, hence +e, because of how the extraction works, but the result is checked at the end of the process, to compensate. hence +e, because otherwise this brute force extraction would never work. therefore, this is an extremely theoretical bug fix, the most quintessential of preemptive bug fixes, to the point that it is actually rather pedantic. The ":" in "|| :" will likely *never* be executed, but it handles the theoretical case where the subshell exits with non-zero status and +e is set; subshells aren't meant to behave this way anyway, but who knows what cursed sh implementation the user is on? Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-13vendor.sh: remove unnecessary xchanged="y"Leah Rowe
in these if clauses, what follows afterward is exactly the same: set xchanged and return. Therefore, these lines are redundant and they can be removed. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-13vendor.sh: set need_files="n" if skipping patchLeah Rowe
This change finally ensures that no insertions will be attempted, on the basis that readkconfig failed; this covers the instance whereby vcfg was set, but no scanned items were indicated e.g. Intel ME files not specified. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-13vendor.sh: Don't handle vendor files if not neededLeah Rowe
This should speed up automated tests. Otherwise, it goes through all the extra checks that aren't needed, for each individual type of vendor file, and also errors out when handling pico serprog images; during automated testing, on the bin directory, you might try on every tarball, one of which is the pico tarball and this patch makes lbmk skip that one too. In general, we must not perform unnecessary tasks. Doing so may even cause other bugs that we couldn't easily detect. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-13lib.sh: fix bad eval writing resized fileLeah Rowe
x_ cannot be used, where output is redirectod to a file; only the conventional piping can be used. same as the last change. this and the other fix were caught during testing. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-12vendor.sh: tidy up error handlingLeah Rowe
x_ can be used nowadays on any function, because it properly handles globbing. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-12vendor.sh: tidy up decat_fspfd()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-12vendor.sh: properly call err_ in fail_injectLeah Rowe
i can't call $err (variable), because it's set to fail_inject. fix this infinite loop, which was an oversight in the previous commit. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-12remove xbmk_parent, handle forking in lib.shLeah Rowe
I was using a complicated method of knowing whether the current instance was parent or a child, to know whether the lock file and TMPDIR needed to be purged. It was quite error-prone too. Instead, I'm now handling it directly from within the if statement that previously initialised xbmk_parent=y, forking ./mk from there. The forked instance would not trigger that if clause again, since then TMPDIR is created, thus avoiding recursion. This is an improvement because it doesn't rely on how the parent handles exit statuses, and it ensures that the lock/tmp files are never accidentally deleted. Even if a given program/script that lbmk runs would export TMPDIR, it doesn't matter because lbmk doesn't, so it would be unaffected. Signed-off-by: Leah Rowe <leah@libreboot.org>