summaryrefslogtreecommitdiff
path: root/include
AgeCommit message (Collapse)Author
2024-05-06err.sh: correct copyright infoLeah Rowe
i replaced 2022, 2023 with 2022, 2024 when updating the years, as per modifications, but the 2023 copyright doesn't become invalidated change it to 2022-2024 instead, which is correct Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-03err.sh: update copyright infoLeah Rowe
i added a few changes during this year so far, 2024 update the copyright years Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-04-28build/roms: simplified status handlingLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-04-28option.sh: don't use nproc (not portable)Leah Rowe
export LBMK_THREADS=x where x is an integer. this is already supported for setting the number of build threads, but if not set it uses nproc. openbsd doesn't have nproc. default to 1 thread. now you MUST set threads. e.g. in linux do: export LBMK_THREADS=$(nproc) preliminary work is being done to make lbmk run on openbsd! Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-04-27allow disabling status checks during buildsLeah Rowe
export LBMK_STATUS=n if not set, the status checks and confirmation dialogs persist. if set to y they persist. if you set it to n, all checks are disabled, so e.g.: ./build roms all this would once again build all targets, regardless of status. this is if you want the old behaviour. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-04-26build/roms: report status when building imagesLeah Rowe
export LBMK_VERSION_TYPE=x x can be: stable, unstable in target.cfg files, specify: status=x x can be: stable, unstable, broken, untested if unset, lbmk defaults to "unknown" if LBMK_VERSION_TYPE is set, no confirmation is asked if the given target matches what's set (but what's set in that environmental variable can only be stable or unstable) if LBMK_RELEASE="y", no confirmation is asked, unless the target is something other than stable/unstable "unstable" means it works, but has a few non-breaking bugs, e.g. broken s3 on dell e6400 whereas, if raminit regularly fails or it is so absolutely unreliable as to be unusable, then the board should be declared "broken" untested means: it has not been tested With this change, it should now be easier to track whether a given board is tested, in preparation for releases. When working on trees/boards, status can be set for targets. Also: in the board directory, you can add a "warn.txt" file which will display a message. For example, if a board has a particular quirk to watch out for, write that there. The message will be printed during the build process, to stdout. If status is anything *other* than stable, or it is unstable but LBMK_VERSION_TYPE is not set to "unstable", and not building a release, a confirmation is passed. If the board is not specified as stable or unstable, during a release build, the build is skipped and the ROM is not provided in that release; this is in *addition* to release="n" or release="y" that can be set in target.cfg, which will skip the release build for that target if "n" Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-04-26exports variables from err.sh, not buildLeah Rowe
LC_COLLATE and LBMK_RELEASE are important variables. we want to make sure that these are seen by everything. since err.sh is included from all scripts, doing it there will accomplish just that. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-04-25lbmk: export TMPDIR from err.sh, not buildLeah Rowe
lbmk sets TMPDIR to /tmp, and then creates a tmpdir, then exports *that* as the value of TMPDIR. this unified TMPDIR location then contains all subsequent files and directories, when any script or program makes use of /tmp, via mktemp. at least, that's the theory! in practise, because it was only being properly exported from the main build scripts, subscripts that are then called were not exporting it, at least that is my assumption because in some cases, i found that the coreboot build system was leaving errant files behind outside of our own TMPDIR, and that build system did not seem to be setting TMPDIR itself; more debugging is needed. anyway: use the exact same logic, but do it from err.sh. since err.sh is included from every lbmk script, that means it will always be exported when running every single part of lbmk. this should reduce the chance that mktemp creates files and directories outside of our custom TMPDIR location. this is because in lbmk, we mitigate unhandled tmpdirs/files by unifying it in the manner described, then deleting the entire TMPDIR on exit from the main lbmk parent process (the main script that the user called from, which is always the "build" file). in lbmk, effort is made to clean up temporary files properly, without relying on this catch-all, but we can't rely on that. the catch-all should also be as robust as possible. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-04-24haswell: only provide NRI-based ROMs in releasesLeah Rowe
release="n" is set in target.cfg on haswell build targets that use mrc.bin script/update/release exports LBMK_RELEASE="y" script/build/roms skips building a given target if release="n" in target.cfg *and* LBMK_RELEASE="y" you could also do the export yourself before running ./build roms, for example: export LBMK_RELEASE="y" ./build roms all This would skip these ROM images. The native haswell raminit is now stable enough in my testing, that I wish to delete the MRC-based targets. This is in line with Libreboot's Binary Blob Reduction Policy, which states: if a blob can be avoided, it should be avoided. The problem is that users often run the inject script in *lbmk* from Git, instead of from the src release archive. I forsee some users running this on modern lbmk with older release images. If the mrc-based target isn't there, the user may use an NRI-based target name, and think it works; they will insert without MRC. I foresaw this ages ago, which is why Caleb and I ensured that the script checks hashes, and hashes are included in releases. Therefore: for the time being, keep the MRC-based configs in lbmk but do not include images for them in releases. This can be done indefinitely, but I'll probably remove those configs entirely at some point. On the following boards, Libreboot now will *only* provide NRI-based ROM images for the following machines: * Dell OptiPlex 9020 SFF * Dell OptiPlex 9020 MT * Lenovo ThinkPad T440p * Lenovo ThinkPad W541/W540 I now recommend exclusive use of NRI-based images, on Haswell hardware. It's stable enough in my testing, and now supports S3. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-03-27allow users to specify number of build threadsLeah Rowe
lbmk otherwise uses nproc to set the number of build threads, in these places: * generic make commands in script/update/trees * crossgcc make command in script/update/trees the -T0 option is also used in script/update/release, when running tar. with this change, you can do: export LBMK_THREADS=x where x is the number of threads. when you then run lbmk, your chosen number of threads will override the default. this may be useful on a host that does not have a lot of memory. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-03-27safer, simpler error handling in lbmkLeah Rowe
in shell scripts, a function named the same as a program included in the $PATH will override that program. for example, you could make a function called ls() and this would override the standand "ls". in lbmk, a part of it was first trying to run the "fail" command, deferring to "err", because some scripts call fail() which does some minor cleanup before calling err. in most cases, fail() is not defined, and it's possible that the user could have a program called "fail" in their $PATH, the behaviour of which we could not determine, and it could have disastrous effects. lbmk error handling has been re-engineered in such a way that the err function is defined in a variable, which defaults to err_ which calls err_, so defined under include/err.sh. in functions that require cleanup prior to error handling, a fail() function is still defined, and err is overridden, thus: err="fail" this change has made xx_() obsolete, so now only x_ is used. the x_ function is a wrapper that can be used to run a command and exit with non-zero status (from lbmk) if the command fails. the xx_ command did the same thing, but called fail() which would have called err(); now everything is $err example: rm -f "$filename" || err "could not delete file" this would now be: rm -f "$filename" || $err "could not delete file" overriding of err= must be done *after* including err.sh. for example: err="fail" . "include/err.sh" ^ this is wrong. instead, one must do: . "include/err.sh" err="fail" this is because err is set as a global variable under err.sh the new error handling is much cleaner, and safer. it also reduces the chance of mistakes such as: calling err when you meant to call fail. this is because the standard way is now to call $err, so you set err="fail" at the top of the script and all is well. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-26git.sh: also reset xtree/tree_depend hereLeah Rowe
it's still necessary here, to prevent the same bug identified in the previous patch. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-21git.sh: fix bad call to ./updateLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-21git.sh: support downloading dependency treesLeah Rowe
a tree can specify: tree_depend="treename" this will make the other tree be downloaded. this is used for coreboot trees, to ensure that dependency trees are downloaded, because trees can now re-use crossgcc from other trees. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-21re-use crossgcc builds on the coreboot treesLeah Rowe
don't build crossgcc twice, especially if two coreboot trees use the same revision! Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-10NEW MAINBOARD: HP EliteBook 820 G2Leah Rowe
This is of Broadwell platform, one generation above Haswell. Of note: this uses HP Sure Start. Although the flash is 16MB, our CBFS section (and IFD configuration) assumes 12MB flash, so the final 4MB will be left unflashed on installation, after blanking the private flash. The coreboot documents have more information about this. Some minor design changes in lbmk were made, to accomodate this port: Support for extracting refcode binaries added (pulled from Google recovery images). The refcode file is an ELF that initialises the MRC and the PCH. It is also responsible for enabling or disabling the Intel GbE device, where Google does not enable it, but lbmk modifies it per the instructions on the coreboot documentation, so as to enable Intel GbE. Google's recovery image stores the refcode as a stage file, but coreboot changed the format (for CBFS files) after 4.13 so coreboot 4.13's cbfstool is used to extract refcode. This realisation made me also change the script logic to use a cbfstool and ifdtool version matching the coreboot tree, for all parts of lbmk, whereas lbmk previously used only the default tree for cbfstool/ifdtool, on insertion and deletion of vendor files - it was 81dc20e744 that broke extraction of refcode on google's recovery images, where google used an older version of cbfstool to insert the files in their coreboot ROMs. A further backported patch has been added, copying coreboot revision f22f408956 which is a build fix from Nico Huber. Iru Cai submitted an ACPI bugfix after the revision lbmk currently uses, for coreboot/default, and this fix is needed for rebooting to work on Linux 6.1 or higher. This patch has been backported to lbmk, while it still uses the same October 2023 revision of coreboot. Broadwell MRC is inserted at the same offset as Haswell, so I didn't need to tweak that. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01git.cfg: simplified revision checkingLeah Rowe
it only needs to be checked before git reset Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01add copyright 2024 leah rowe to edited filesLeah Rowe
i forgot to add 2024 on the copyright years, for my copyright files that i edited on 1 january 2024 Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01git.sh: simplify submodule handling in git_prepLeah Rowe
u-boot doesn't use submodules, so there's no point in checking for it. now we can do with just one call to the git submodule command, for simplicity also, general code cleanup in this file (minor code formatting improvements) Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01git.sh: further simplify git_prepLeah Rowe
the directory is checked for deletion, but it's already checked before download, to see whether it already exists. lbmk already exits with zero status if the directory exists, so the check is pointless (in this function) also, general code style/formatting cleanup Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01git.sh: unify am/submodule and tree copyingLeah Rowe
do it all in a single function! Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01git.sh cleanup: git am handling (remove patchfail)Leah Rowe
the patchfail variable was only needed in the old design, where git am was being handled inside a subshell, and also when we did it directly in the target directory without using a temporary directory. with the current design, we can just call err() and ditch the tmp repo Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01git.sh: clean up handling of tmp_git_dirLeah Rowe
delete it once once, and delete it much sooner, right at the start of script/update/trees main() Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01git.sh: fix regression: patches before submodulseLeah Rowe
there isn't really a problem right now, but a desired and implemented behavioural change was that patches are to be applied *before* updating submodules. well, the previous commit reversed this change, under certain conditions, such that submodules were applied first. this patch fixes it, so that patches are done first. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01git.sh: clean up git submodule/am handlingLeah Rowe
unify all of the logic, where git am and submodule is handled Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-30git.sh multi-tree: grab submodules *after* patchesLeah Rowe
right now, if we want to patch a project such that certain submodules are no tdownloaded, or diffreent submodules are downloaded, or current ones are downloaded from other locations, we cannot do this, because we apply submodule updates *before* applying patches. therefore, we should change it so that they are applied *after* installing patches. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-30unify script/update/trees and script/build/grubLeah Rowe
the script can now also handle autoconf build systems, whereas this could previously only be done for grub. with this change, the overall sloccount is also lower Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-28lbmk scripts: general code cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-27lbmk scripts: general code cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-24lbmk scripts: shorter code linesLeah Rowe
while seemingly pedantic, this does actually make code easier to read. mostly just switching to shorthand for variable names, where no expansions or patterns are used Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-24lbmk scripts: general code cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-23lbmk scripts: general code cleanup/optimisationLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-23set version/projectname properlyLeah Rowe
lbmk used to set version/versiondate directly in err.sh, but now it's handled there by a function, which is called by the main script. script/update/release hadn't yet been adapted. the only change necessary is to call check_project() script/update/trees also makes use of it script/build/roms is using "projectname" Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-23lbmk scripts: general code cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-22general code cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-22mrc.sh: run debugfs from extract_partitionLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-22mrc.sh: general code cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-21mrc.sh: remove redundant extraction logicLeah Rowe
the extract_archive function already provides use of unzip, and works just fine (for mrc.bin extraction) Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-21mrc.sh: don't run the shellball. use unzip.Leah Rowe
the shellball (for extracting the coreboot rom, to get at mrc.bin) contains lines that are not posix-friendly. specifically, the "local" command is used, and this is not defined for posix sh. the shellball is essentially just a bunch of shell functions that compress/decompress the zip file, containing the firmware update. you can modify the files and re-run the shellball to recompress, though lbmk just uses the decompress function. as pointed out by Nicholas Chin, it is possible to just run "unzip" directly on the update, to get at bios.bin. we don't really need all the extra checks performed by the shellball, so let's just bypass it altogether. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-19git.sh: simplify submodule handlingLeah Rowe
do not use a subshell. use git -C instead. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-19option.sh scan_config: clean up if/else blockLeah Rowe
the code wasn't very clear. make it clearer. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-19option.sh: print error on stderr, not stdoutLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-19option.sh: don't rely on zero status on printfLeah Rowe
this part of the code *must* return. the for loop afterwards must not be permitted to execute. it's unlikely that this would ever occur, unless perhaps the user is using a very buggy sh. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-19git.sh git_am_patches: reduce indentationLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-19git.sh fetch_config: simplify tree name checkLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-16fix several shellcheck warningsLeah Rowe
lbmk didn't quote certain arguments in commands, or used ! -z instead of -n, things like that. simple fixes. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-11handle errors on exits from subshellsLeah Rowe
most of these are probably redundant, and will never be called, but lbmk needs to be as safe as possible under fault conditions. fail early, fail hard. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-11improved safety/error handling on multitree git-amLeah Rowe
update/trees wasn't correctly returning non-zero status, even though it was printing an error message, when git-am failed. this is due to the way subshells work, and it was overlooked in previous auditing. additionally: don't directly copy trees to the destination, instead patch/reset first, then copy only under normal condition, just as with single-tree projects. when running build/roms, the script would continue after a bad git-am, without exit. this patch fixes it in the most paranoid way possible. i'm now fairly confident that lbmk will fail gracefully and efficiently, under error conditions. this should prevent bad image builds. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-11-08build: don't generate version/versiondate as rootLeah Rowe
don't run it directly at the bottom of err.sh, because otherwise the version and versiondate files will be generated when running "./build dependencies distroname" which would then create these files, but as root because the user runs that specific command as root. the rest of lbmk, for any other command, prevents use of the root account, so running check_project during "./build dependencies distroname" will cause the build system to fail (because as non-root user, the user will run lbmk and it will try to update those files, and fail because it can't, due to lack of permissions) this patch fixes the issue, by only generating those files if the user is *not* root Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-11-01Libreboot 2023110120231101Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>