summaryrefslogtreecommitdiff
path: root/mk
AgeCommit message (Collapse)Author
2025-05-26mk: simplify main()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-13git.sh: rename to get.shLeah Rowe
it now handles more than just git, and i forsee it handling even more in the future, e.g. rsync, ftp, bittorrent. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-12lib.sh: move xbmkget() to git.shLeah Rowe
in cbmk, it's only used from there. in lbmk, it's also used from vendor.sh. however, i plan to further expand git.sh at some point, tidying it up so that git cloning is also done from xbmkget, with dlop=git and git.sh would then be renamed to get.sh 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-08mk: use zero exit instead, to run treesLeah Rowe
that way, with set -u -e, we aren't risking some buggy sh implementations from causing an error exit where it shouldn't. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-08remove useless commentLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-08mk: remove unnecessary line breakLeah Rowe
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>
2025-05-08mk: move release functions to idnclude/release.shLeah Rowe
The idea with mk is that it's meant to basically be a stub for running everything else, while mainly having the trees logic within it (what was once script/trees). Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-08mk: add missing error handli for mk -fLeah Rowe
on the release command, that is 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-07mk: Create serprog tarballs here insteadLeah Rowe
i simplified rom.sh to use mkhelper for actual image building. 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-05singletree/elfcheck: use fx_, not fe_Leah Rowe
fe_ returns an error on the find command, but we rely on the only error ever being our intentional exit, upon discovering files. in singletree, the directory being checked was already checked first, so we know it's safe not to err on find; and find not reporting an error if no files are found is ok. on elfcheck, it's very much the same thing. In fact, we very much want it to return 0 if the directory doesn't exist, or if files don't exist within it. Therefore, use fx_ which is designed for this use-case. Quick re-cap: fx and fe execute a given function name with each line outputting by find as an argument, each time. It is somewhat similar in scope to find's -exec command. We use fe_ as shorthand in several places all over lbmk. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-05mk: simplify elfcheck()Leah Rowe
fe_() called inside subshell, ftw Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-05mk: Fix bad error handling for gnu_setverLeah Rowe
I mixed logical OR and AND by mistake. Oops! Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04lbmk: MUCH safer err functionLeah Rowe
Don't directly call a variable. Call a function that checks the variable instead. The new err function also checks whether an exit was actually done, and exits 1 if not. If an exit was done by the given function, but the exit was zero, this is also corrected to perform an exit 1. This fixes a longstanding design flaw of lbmk. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04mk: tidy up xgccargs handlingLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04mk: remove useless codeLeah Rowe
this was added a few commits ago, but the previous commit made me realise it's not needed at all. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04mk: re-make gnupath/ after handling crossgccLeah Rowe
instead of deleting every file within Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04mk: tidy up check_cross_compilerLeah Rowe
only initialise variables at the point they're needed. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04mk: re-make gnupath/ for each cross compilerLeah Rowe
it could be that some were left over before, for some reason. that isn't currently the case, but this will avoid the possibility in future. therefore, this is a preemptive bug fix. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04mk: reduce indentation in check_cross_compiler()Leah Rowe
we only call it in one place. the resulting code is still quite clear. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-03mk: Allow use of x_ on prefix functionsLeah Rowe
Use this for the sha512sum command, on the main mk script at the function check_project_hashes(). Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-03mk: tidy up check_project_hashes() sha512sum checkLeah Rowe
the extra function isn't needed at all. awk can just handle every line all at once. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-03mk: simplify check_gnu_path()Leah Rowe
the initial checks are unnecessary, since i always know what arguments are being provided. the -f check in the for loop is now an -x instead, more efficient and complete. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-03lbmk: Unified local ./tmp handlingLeah Rowe
Make it an absolute directory, relative to xbmktmp. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-03lbmk: unified execution on find commandsLeah Rowe
We have a lot of places in lbmk where the output of find is used, and then some function is executed on the result. This is messy, and bloats several of these functions. Now this is unified, into a new function: fx_ What fx_ does is execute a given function, for each result found, with the arguments for a find command appended. For example: find -name ".git" If you wanted to do: foo "$arg" Where "arg" is a search result from find, and you wanted to execute "foo" on each one, you would do: fx_ foo -name ".git" The find utility does have an -exec feature, but I've found that it only works for executables, not functions. fx_ does not return errors, so "foo" in this example would have to do its own error handling. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-02mk: include rom.sh directlyLeah Rowe
remove it from mkhelper files, because rom.sh doesn't initialise any variables globally, except one that never changes. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-02mk: Download vendorfiles before building releaseLeah Rowe
Do it just after creating the src archive. This way, everything is downloaded all at once. Otherwise, a momentary lapse of internet uptime will cause a release build to fail later on, and one of lbmk's flaws is that this would then mean you must re-build from scratch. If we assume that the internet is working within a short period of time, then this change would mitigate that possibility. If something did happen during tar archive creation, that's a much shorter amount of time that is "wasted". Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-02init.sh: move setvars/err_ to lib.shLeah Rowe
these functions make more sense in lib.sh i made mk link lib.sh first, so that the functions on init.sh can still use them. Signed-off-by: Leah Rowe <leah@libreboot.org>
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>