summaryrefslogtreecommitdiff
path: root/mk
AgeCommit message (Collapse)Author
2025-04-29mk: Don't run mkhelpers if mode is setLeah Rowe
If the mode string is empty, then it's a build command. See commit: commit b1ea4165754f04660d3c7282274c4b12355f88a0 Author: Leah Rowe <leah@libreboot.org> Date: Wed Apr 23 03:54:08 2025 +0100 mk: remove mkhelp() and use x_() instead This commit removed the following check: If mode isn't set, run an mkhelper, otherwise don't. Because this simplification removed that behaviour, running e.g. "./mk -m coreboot x200_8mb" would result in the mkcorebootbin function being executed, which is normally putting the coreboot rom together. Since it wasn't built in this case, an error is thrown. This change therefore restores the previous behaviour, fixing the bug. First reported in this error report: https://codeberg.org/libreboot/lbmk/issues/306 This commit fixes the issue. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-26mk: condense main() againLeah Rowe
i prefer it this way. this reverses the change that i made a few revisions ago Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-26mk: make main() more readableLeah Rowe
now that main is so small, some of the condensed lines can be loosened up. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-26mk: move git check to init.sh xbmk_set_versionLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-26mk: move git_init to init.shLeah Rowe
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-26re-split include/init.sh to lib.shLeah Rowe
move non-init functions to lib.sh Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-26rename include/lib.sh to init.shLeah Rowe
this is in prep for the next change, where non-init functions will be moved to another file, again named include/lib.sh Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-26mk/git.sh: remove tree_depend variableLeah Rowe
this was used alongside the xgcc linking, so that coreboot trees could specify that another tree was to be downloaded. since this variable will no longer be used, it should be removed, to avoid dead code bloat. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-26mk: remove unused variables (ser/xp)Leah Rowe
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-23mk: remove mkhelp() and use x_() insteadLeah Rowe
x_ and mkhelp pretty much do the same thing in fact, there is no functional difference Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-23mk: simplify handling of trees()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-22mk: don't print confirmation of git pkg.cfgLeah Rowe
otherwise, the "list" commands include such text, where they should not. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-18mk: tidy up check_gnu_path()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-18mk: simplify check_project_hashes()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-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-13mk check_project_hashes: handle error on sha512sumLeah Rowe
We can't do set -o pipefail in POSIX sh, which we're using, but the build system has x_ which wraps around a command and executes it, exiting with non-zero status if it does. This fact enables lbmk to have functionality that is actually superior to pipefail, since you can more easily control specifically which parts error. For example: foo | bar | foo2 | bar2 | $err "error" ERROR exits with non-zero status, but foo2, bar and foo would not exit on error, only bar2 would. In *bash*, which we avoid, set -o pipefail would make all of them exit on error, but what if you wanted "bar" to not exit? With lbmk, you could do, in the above example, and with the above question asked ("what if you wanted bar not to exit"): x_ foo | bar | x_ foo2 | bar2 > file | $err "error" of course, you could also do, if not outputting to "file": x_ foo | bar | x_ foo2 | x_ bar2 NOTE: in lbmk, $err is a variable containing the name of a function that does something (whatever you want) and then exits with non-zero status. This entire explanation is beyond the scope of simply providing (and explaining) this fix, but I also wanted to use this commit as an example of the power of lbmk with regards to POSIX shell scripting. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-13mk: use eval to run mkhelp commandsLeah Rowe
directly quoting it and running it quoted means that the shell way try to execute it as a file. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-12mk: tidy up the switch/case block in main()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-12mk: tidier error handlingLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-12mk: Remove unnecessary argument checks on trees()Leah Rowe
These checks are no longer necessary, because these checks are already properly handled in main(). 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>
2025-04-12mk: minor cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-12script/trees: merge with mk and delete script/Leah Rowe
script/ no longer exists. this means that the only executable script in lbmk is now mk. script/trees was never called directly; instead, we used ./update trees in the past, then just ./mk. this is part of a larger audit to simplify lbmk, in preparation for the next Libreboot release. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-12mk: remove the legacy "roms" commandLeah Rowe
we don't need it. the documentation only tells you now to run ./mk -b coreboot target1 target2 etc Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-12move build to mkLeah Rowe
i'm removing all the backward-compatibility in the build system, so that only the ./mk command is available Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-07-22support ./mk in place of ./update treesLeah Rowe
it's a shortcut command. a new symlink. ./update trees -b flashprog can instead do: ./mk -b flashprog Signed-off-by: Leah Rowe <leah@libreboot.org>