Commit Graph

1009 Commits (1f2c8e47d473b8dcf852fbd814cd6b7cb4f2f87c)

Author SHA1 Message Date
Leah Rowe 1f2c8e47d4 lib.sh: remove mk()
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-14 21:37:22 +01:00
Leah Rowe 19888e2cb8 lib.sh: move xbmkget() to git.sh
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-14 21:36:31 +01:00
Leah Rowe 9c5f59cc42 lib.sh: remove mksha512sum()
this is unused in cbmk.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:35:54 +01:00
Leah Rowe 279b7f20be lib.sh: split up try_file()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:35:31 +01:00
Leah Rowe 3347e3d314 lib.sh: move _ua to try_file()
it's only used there

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:35:25 +01:00
Leah Rowe 57f68535a2 inject.sh: remove the hashfiles variable
we only use it once, and it's a trivial string

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:34:51 +01:00
Leah Rowe d07bd53b07 inject.sh: define xchanged here instead
this is used here, and also needed in cbmk.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:33:39 +01:00
Leah Rowe 47b9a261d7 lib.sh: use fx_ in rmgit()
with fx_, i have more much granular control over
how errors are handled.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:32:53 +01:00
Leah Rowe ed9f6338af lib.sh: split up xbmkget()
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>
2025-05-14 21:32:39 +01:00
Leah Rowe 753af0a7a2 inject.sh: only compile nvmutil if needed
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:32:33 +01:00
Leah Rowe 387f4b785b inject.sh: simplified serprog check
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:32:26 +01:00
Leah Rowe 31bab5c10c remove another confusing message
the current message says the file name, and implies that
the given file has already been updated.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:31:47 +01:00
Leah Rowe 6c3ea129a4 inject.sh: Remove confusing path on tar creation
The path is wrong. The correct path is printed afterward.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-10 20:49:19 +01:00
Leah Rowe 3062f04c45 inject.sh: re-add mac address confirmation
it just makes the script more user-friendly

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-10 20:24:30 +01:00
Leah Rowe cf8ca4cdd6 inject.sh: further cleanup
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>
2025-05-10 20:16:23 +01:00
Leah Rowe a82ca2da5f tree.sh: only create elfdir in copy_elf()
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-10 18:22:30 +01:00
Leah Rowe 33debfcf1c tree.sh: simplified srcdir check on make-clean
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-10 18:22:25 +01:00
Leah Rowe 2acdfefdf9 inject.sh: bring in sync with lbmk 0f931b508a8
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>
2025-05-10 18:20:44 +01:00
Leah Rowe a170ab4118 cbmk: use x_ instead of err, where appropriate
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>
2025-05-10 18:09:43 +01:00
Leah Rowe 5cdd377547 mk: use zero exit instead, to run trees
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-10 18:06:27 +01:00
Leah Rowe c022a14c9e remove useless comment
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-10 18:05:47 +01:00
Leah Rowe c9325f234e mk: remove unnecessary line break
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-10 18:05:37 +01:00
Leah Rowe e22593f037 mk: re-split tree logic to include/tree.sh
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-10 18:03:45 +01:00
Leah Rowe c463e8a52d mk: move release functions to idnclude/release.sh
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-10 18:03:32 +01:00
Leah Rowe 966a6377a0 mk: add missing error handli for mk -f
on the release command, that is

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-08 22:19:29 +01:00
Leah Rowe 718697c0e6 git.sh: re-write tmpclone without caching
remove caching for now. it's buggy as hell.

will re-write the caching feature next.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-08 22:19:22 +01:00
Leah Rowe a5c5089eda git.sh: use setvars for fail variables
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-08 22:19:17 +01:00
Leah Rowe 7b2671ea26 git.sh: hard fail if git am fails
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>
2025-05-08 22:19:12 +01:00
Leah Rowe 45b6d3b3ba git.sh: Hard fail if reset fails
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>
2025-05-08 22:19:06 +01:00
Leah Rowe e320ce60a7 init.sh: Only check XBMK_CACHE if it exists
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>
2025-05-08 22:19:01 +01:00
Leah Rowe d99bc55f4a also fix the other grub trees
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-08 16:09:59 +01:00
cqst c15ee8fc32 fix trying to boot all logical volumes after unlocking an encrypted volume 2025-05-08 16:09:47 +01:00
Leah Rowe 63cef86bdb init.sh: remove useless export
we already reset to n if not y, afterward

just rely on that

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-08 16:09:41 +01:00
Leah Rowe 0a3793ad4e init.sh: also allow XBMK_RELEASE=Y or N
as opposed to =n or =y

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-08 16:09:34 +01:00
Leah Rowe 433b5de916 init.sh: Resolve XBMK_CACHE via readlink
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-08 16:09:26 +01:00
Leah Rowe 5d2c94a8bd init.sh: check XBMK_CACHE is a directory instead
it doesn't matter if it's not a file. that's the wrong check.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-08 16:09:20 +01:00
Leah Rowe f0a0f678bf init.sh: export LOCALVERSION in set_env
Don't do it in set_version

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-08 16:09:14 +01:00
Leah Rowe 542d72192d init.sh: run set_version before set_env
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-08 16:09:08 +01:00
Leah Rowe 9ccfee43e7 init.sh: Use readlink in pybin()
Use realpath only as a fallback.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-08 16:09:03 +01:00
Leah Rowe 2f17c5be3b inject.sh: simplified MAC address handling
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-08 16:08:35 +01:00
Leah Rowe 3900122957 lib.sh: Remove useless command in err()
We don't need this, since we're exiting anyway.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-08 16:05:37 +01:00
Leah Rowe afcd0cfde6 lib.sh: Simplified fx_() and removed fe_()
Instead of calling fe_, prefix x_ as indicated.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-08 16:05:06 +01:00
Leah Rowe 386f3c3346 mk: Create serprog tarballs here instead
i simplified rom.sh to use mkhelper for actual image
building.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-08 16:01:56 +01:00
Leah Rowe 326f0459d9 build serprog using fe_ *defined inside mkhelper*
sh macros ftw

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-08 16:01:51 +01:00
Leah Rowe 418fcce9ba rom.sh: build serprog images with fe_
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-08 16:01:44 +01:00
Leah Rowe add92cd405 lib.sh: support any command on find_exec()
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-08 16:01:25 +01:00
Leah Rowe bd5d85569f lib.sh: re-add missing break in fe/fx_
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-08 15:57:59 +01:00
Leah Rowe eac3b96ddd git.sh: Simplify git am handling
fx_ and fe_ really are the best shell functions ever.

really. they're the best.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-06 14:47:15 +01:00
Leah Rowe 6e4172b1ba inject: remove unused function
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-06 04:50:44 +01:00
Leah Rowe 92374e6071 init.sh: New function dx_ to execute path files
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>
2025-05-06 04:49:17 +01:00