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>
it was too complicated. most of the logic has been moved
to a new function, try_file()
the for loop is handled by xbmkget(), whereas each try
is now handled in try_file()
Signed-off-by: Leah Rowe <leah@libreboot.org>
this is based on lbmk commit e5af201060e
this removes more code that is not needed in cbmk's version
of inject.sh
lbmk and cbmk inject.sh are now much more in sync, in that
they are much more similar to each other than before.
the cbmk version only handles MAC addresses, and does not
do vendor file downloading or patching.
Signed-off-by: Leah Rowe <leah@libreboot.org>
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>
see lbmk commit:
0f931b508a8eb34e70b2ed3628ac4fe74f22b8e8
from 10 May 2025
The lbmk version of inject.sh also contained logic to
download vendor files, which cbmk doesn't and won't support.
This made merging patches between the two projects harder, so
lbmk's version has been modified to mostly only include the MAC
address related code on inject.sh, just like the Canoeboot one.
On lbmk, extra functionality for vendor files is now provided
on include/vendor.sh, which cbmk lacks (and will never have).
With a few minor alterations, this script is now very much in
sync with the lbmk version.
In fact, just to provide the point, here is the diff between
lbmk's version of inject.sh, compared to the version in cbmk
introduced by this commit. Observe:
(< is a subtracted line, and > is an added line. So the < shows
what was removed from lbmk's version when adding to cbmk, and
the > lines show what cbmk added to its version).
yes me cbmk$ colordiff ../lbmk/include/inject.sh include/inject.sh
89,90d88
< [ -n "$vcfg" ] && check_vcfg
<
94,95d91
< mecleaner="$xbmkpwd/$cbdir/util/me_cleaner/me_cleaner.py"
< kbc1126_ec_dump="$xbmkpwd/$cbdir/util/kbc1126/kbc1126_ec_dump"
103,104d98
< [ "$nukemode" = "nuke" ] || x_ ./mk download "$board"
<
112,113c106,107
< e "$tmpromdir/$_hashes" f && \
< has_hashes="y" && hashfile="$_hashes" && break; :
---
> e "$tmpromdir/$_hashes" f && err \
> "'$archive': vendorfile insertion unsupported"
118,120d111
< fx_ prep x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom"
< ( check_vendor_hashes ) || err "Can't verify hashes for '$archive'"; :
<
129d119
< setvfile && return 1; :
Signed-off-by: Leah Rowe <leah@libreboot.org>
many places in cbmk 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>
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>
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>
similar to the last patch, we must ensure that the
inability to patch will cause a hard exit, regardless
of any redundancy we have for cloning.
Signed-off-by: Leah Rowe <leah@libreboot.org>
We allow a re-try when cloning fails, to account
for redundancy, but resetfail currently doesn't
cause any error exit at all.
This patch mitigates that bug.
Signed-off-by: Leah Rowe <leah@libreboot.org>
Otherwise, if it doesn't exist, the current check will
wrongly exit with error status, preventing you from
running the build system at all!
Signed-off-by: Leah Rowe <leah@libreboot.org>
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>
Generated by find, this is a wrapper in place of using
for loops everywhere. This simplification temporarily
increases the amount of code, because we don't do this
a lot, but this will reduce the growth of the build
system code size in future changes.
Signed-off-by: Leah Rowe <leah@libreboot.org>