summaryrefslogtreecommitdiff
path: root/include/tree.sh
AgeCommit message (Collapse)Author
2025-07-10tree.sh: delete individual target builds if neededLeah Rowe
Detect when a config changes. This is done even if the entire tree doesn't change. This is already done per-tree if files change, but individual project files don't change. For example, if a grub.cfg changes, the given cached build for that GRUB tree isn't deleted. Same thing if a given U-Boot config doesn't change. This patch fixes a longstanding design flaw of lbmk, making auto-re-builds more reliable. This complements another recent change, that deletes all target builds of a given tree when the tree changes. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-07-10tree.sh: Remove redundant deletionLeah Rowe
Target builds go inside a common directory for the given tree now, which gets deleted, thus deleting all target builds of that given tree. Therefore, the deletion being removed is redundant. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-07-08tree.sh: Place target builds under tree/target/Leah Rowe
as opposed to target/ for example: image the command: ./mk -b u-boot amd64coreboot This would put the U-Boot binaries here: elf/u-boot/amd64coreboot/default/ With this change, they now go here: elf/u-boot/x86_64/amd64coreboot/default/ This solves a problem that existed previously, where you could modify a given tree in a multi-tree project, but cached builds for targets branching separately off of each tree would not be deleted, and thus not re-built. This accomplishes such a result, without needing to further check hashes of individual targets. The latter will still be done, in a future change, because this change doesn't fix another problem: If you change a given config, e.g. targetname "foo" which uses tree "bar", elf/foo/ would not be removed automatically for re-build. So this change only deletes individual target builds when their master tree changes. Where the target and tree are the same, this also means elf/tree/target/ for example: seabios/default would create binaries in: elf/seabios/default/default/ not: elf/seabios/default/ Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-06-05tree.sh: add sha512 error for check_project_hashesLeah Rowe
handle errors on sha512sum - also handle awk errors inside the mini subshell, and provide overall error handling. we know that the project.hash file should always exist, and always be read no matter what; technically, the find command that proceeds it might not yield any results, but an empty file would then be produced. the edge case of an empty file would have lead to an error beforehand, when configuring the project in function, configure_project(), so we've already got that covered. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-06-05tree.sh: add error check in check_project_hashes()Leah Rowe
when reading old_pjhash, we need to error out where a read error occurs. such an error is unlikely, but could occur under certain edge cases. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-06-05tree.sh: more reliable clean in run_make_commandLeah Rowe
Don't do no-op if it fails; fall back to "clean" instead, and fail if that fails. The no-op was there was not all projects have distclean, but we do intend for them all to be cleaned. We mitigate further error by only running make-clean if a makefile exists. 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-25tree.sh: Don't auto-run make-oldconfigLeah Rowe
This code was introduced to provide fault tolerance, so that if I forgot to manually update the configs myself, builds would still succeed, e.g. coreboot builds. However, there have been cases in the past where this introduces settings we don't want, and in general we do want to know when there is an error in the configs. The policy should always be: fail early, fail hard. This also mitigates bugs in U-Boot's build system; for example, when I last attempted to update the U-Boot tree for x86, make-oldconfig introduced a lot of junk settings unrelated, which then introduced code that would brick the board if you tried it on one, e.g. it broke booting most Linux kernels via bootflow. With this change, U-Boot will be easier to handle, which normally requires manual configuration; the automated make-oldconfig reconfiguration feature breaks U-Boot. This will no longer occur, since we no longer run it manually. On the other hand, this feature has also prevented other disastrous bugs in the past, such as when I forgot to properly set the SPD size on T480; it was set to 256 bytes, not 512 as is correct. Therefore, this new design change means I must also be more vigilant about config changes in project trees. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-22tree.sh: Don't run make-clean on dry runsLeah Rowe
Otherwise, ./mk -d (without arguments) fails for GRUB, which first requires running autoconf to get a Makefile. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-19tree.sh: fix up copy_elf(), bad for loopLeah Rowe
Because of how sh works, having just the [] line causes sh to exit, annoyingly without an error message, but it does cause a non-zero exit. This bug will have already been triggering, before I added the recent error handling on files for this for loop. also do it to the other loop in lib.sh Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-19xbmk: stricter handling of files on while loopsLeah Rowe
i overlooked these! Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-15properly exit 1 when calling fx_Leah Rowe
in a few places, we use the presence of a file found by fx_ to cause an exit, but the command that runs looks something like: exit 1 "string" this yields an error, and a non-zero exit, because of too many arguments to "exit", but we wanted a non-zero exit anyway. nevertheless, this is incorrect. to fix it, eval is used instead. if the never-going-to-exist condition one day exists where exit 1 actually returns, not, you know, exits, we will use err instead, with the string as argument. this should be fine. it's a bit hacky, but so is fx_, and it works. fx_ is used in several places to keep the sloccount down, providing a common way to perform while loops on the output of a command; that is its only purpose.. 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-10tree.sh: only create elfdir in copy_elf()Leah Rowe
otherwise, we create empty directories where build.list doesn't exist, like on coreboot. we already create a directory when needed, when actually copying elf files, so let's just leave it at that. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-10tree.sh: simplified srcdir check on make-cleanLeah Rowe
this is the check that ksips a given target if the tree directory does not exist, on the clean command. 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-08mk: re-split tree logic to include/tree.shLeah Rowe
I really think mk should just be a small stub. Better to keep everything separate. Signed-off-by: Leah Rowe <leah@libreboot.org>