Commit Graph

536 Commits (25.06_branch)

Author SHA1 Message Date
Leah Rowe a7752f9d0b Revert "inject.sh: simplify remktar()"
This reverts commit d61ad878ab.

The commit that this reverts, broke building release roms.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-27 21:48:10 +01:00
Leah Rowe dd0f3d846f tree.sh: simplify configure_project()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-27 21:46:50 +01:00
Leah Rowe 7db36d9038 tree.sh: simplify check_autoconf()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-27 21:46:18 +01:00
Leah Rowe 0af33b50ae tree.sh: more reliable clean in run_make_command
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-27 13:36:51 +01:00
Leah Rowe 8367f33171 tree.sh: condense build_targets()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-27 13:36:44 +01:00
Leah Rowe 230ed9911f tree.sh: condense configure_project()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-27 13:36:38 +01:00
Leah Rowe cd6d1e28ff tree.sh: simplify build_targets()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-27 13:36:34 +01:00
Leah Rowe b6a48b8af6 tree.sh: simplify handle_defconfig()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-27 12:20:24 +01:00
Leah Rowe 0a7c6990c5 tree.sh: simplify build_project()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-27 12:17:49 +01:00
Leah Rowe 4ab0d56b79 xbmk: simplify a few err calls
many of the messages are redundant, because errors caused
by the commands they handle would produce similar messages.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-27 12:01:33 +01:00
Leah Rowe 7731e8b759 rom.sh: simplify check_coreboot_util
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-27 12:00:27 +01:00
Leah Rowe d61ad878ab inject.sh: simplify remktar()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-27 11:43:38 +01:00
Leah Rowe 8f76cc98a5 inject.sh: simplify. and remove unnecessary check
checking whether archivename is empty isn't needed, because
the case/switch afterward would catch this condition.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-27 11:42:27 +01:00
Leah Rowe d991034c96 inject.sh: add missing semicolons
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-27 11:42:22 +01:00
Leah Rowe 803f680fd0 inject.sh: condense check_release
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-27 11:42:17 +01:00
Leah Rowe ba4fc5e63a inject.sh: remove unnecessary check
we don't handle single images anymore, so we don't
need to check for it at all.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-27 11:42:12 +01:00
Leah Rowe 3567d95860 put coreboot utils in elf/coreboot/TREE
not elf/UTIL/TREE

This way, they are automatically deleted when a tree
has to be re-built.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-27 11:21:24 +01:00
Leah Rowe 885016c0c2 release.sh: use printf to create version files
Don't copy the files directly, because we might be doing
this from a work directory that has no files; in this case,
generic "unknown" variables are used, without generating
any files, so the current logic would produce an error.

However, we do need to create those dot files, because
we then rely on them for building release binaries.

The new logic maintains current behaviour, while fixing
this technical edge-case scenario via mitigation.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-27 11:21:07 +01:00
Leah Rowe eeb9954179 lib.sh: simplify setvars()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-26 13:52:16 +01:00
Leah Rowe bc0a2a9b75 lib.sh: simplify chkvars()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-26 13:52:12 +01:00
Leah Rowe ee92a228c3 get.sh: simplify fetch_project()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-26 13:51:27 +01:00
Leah Rowe bbc35fe6e6 get.sh: simplify try_copy()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-26 13:51:22 +01:00
Leah Rowe b9f78f2aff get.sh: tidy up bad_checksum()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-26 13:51:17 +01:00
Leah Rowe ff77de4a9d get.sh: simplify fetch_targets()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-26 13:51:12 +01:00
Leah Rowe 405215bc34 general cleanup in get.sh
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-26 01:34:08 +01:00
Leah Rowe 21352b990e xbmk: rename xbmklocal/xbmktmp variables
shorten them

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-26 01:33:45 +01:00
Leah Rowe fcfc43aced get.sh: consolidate printf statements
stick it in git_prep, which both single- and multi-tree
projects will use, when downloading git repositories.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-26 01:32:55 +01:00
Leah Rowe 46c0eb5ff4 get.sh: remove redundant printf in fetch_project
The following execution will result in another printf
that says exactly what is being downloaded.

There is no need to inform the user twice about
what is being downloaded.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-26 01:32:50 +01:00
Leah Rowe 77b79d3581 get.sh: remove superfluous command in try_git()
A git-pull is performed immediately after git-fetch.
Git-pull already performs git-fetch as a prerequisite.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-26 01:32:45 +01:00
Leah Rowe 7b8185f460 init.sh: error out if .git/ is a symlink
the current behaviour is a relic from the older lbmk
design, before recent auditing.

the current logic would cause xbmk to continue execution,
going into a child process with .git/ being a symlink.

The .git/ directory should never be a symlink, because
it is extremely error-prone.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-25 20:57:14 +01:00
Leah Rowe 2b8ccfbe5b get.sh: Properly error out if tmpclone fails
We rely on a non-zero exit on other try_ commands, which
works fine there because we then check the file afterward
and error out accordingly.

For git repositories, we assume that both mirrors are
identical and therefore once we get to the first clone
attempt, we assume that it must succeed.

Therefore, if it does not succeed, we must fail. This fixes
a regression I found in testing, where sometimes a failed
patching attempt would not result in an error exit, and
would therefore result in broken sources being present.

In practise, I always very closely watch the terminal when
testing xbmk, especially when updating project patches, so
we probably didn't introduce any broken sources in practice.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-25 20:56:59 +01:00
Leah Rowe ff06b30ca5 tree.sh: Don't auto-run make-oldconfig
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-25 20:56:45 +01:00
Leah Rowe 173f304fd7 rom.sh: simplify mkcoreboottar()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-25 20:55:53 +01:00
Leah Rowe 0854e99cfe rom.sh: rename mkvendorfiles
it mainly does general tasks, like handling utils
and enabling ccache. the vfiles are a small part.

rename the function accordingly. it is called by
premake, so let's call it corebootpremake.

this change will also make sense when cherry-picked
into cbmk, which does not handle vfiles at all.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-25 20:53:52 +01:00
Leah Rowe 00ab60e762 rom.sh: simplify ccache handling for coreboot
we simply do not need to run the make-oldconfig command
at all, and after removing it, the "cook" function seemed
quite redundant so i merged it with mkvendorfiles()

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-25 20:53:47 +01:00
Leah Rowe 82bb342a63 rom.sh: simplify u-boot payload handling
define it with a single variable, rather than several.

this allows several checks to be greatly simplified.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-25 20:53:34 +01:00
Leah Rowe a70d8afc30 get.sh: Always update git remotes
Right now, if cache/clone/PROJECT/ already exists,
the logic for pulling new changes doesn't execute,
and neither does the logic for updating remotes.

This is bad when updating revisions, because then
manual updating is required, defeating the purpose
of xbmk's own automation in this regard.

Fix it by only checking the cached download on files,
not Git repositories; the try_git function itself will
already perform this check, before updating remotes
and pulling in new commits from upstream.

The updating only happens when a given target directory
doesn't exist, e.g. src/flashprog/ or src/grub/default/,
so this won't slow down release builds for example.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-23 06:01:23 +01:00
Leah Rowe 77ad7a0ca3 get.sh: re-generate remotes every time
that way, when a remote changes in config/, it
will be updated automatically, without user
intervention.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-23 06:01:16 +01:00
Leah Rowe e209646018 release.sh: copy version files to rsrc
Otherwise, an "unknown" version number is created.

This regression was caused by the recent optimisation
that reduces the amount of extra work done by init.sh
on child instances of xbmk.

As a result of those changes, now release.sh has to
do some minor initialisation of its own, such as this.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-23 06:01:09 +01:00
Leah Rowe 069aa21567 rom.sh: skip copyps1bios on dry builds
otherwise, ./mk -d (without arguments) will fail.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-23 06:00:50 +01:00
Leah Rowe bcdcfa045a tree.sh: Don't run make-clean on dry runs
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-23 06:00:39 +01:00
Leah Rowe be598c497b get.sh: add missing check in fetch_project()
we check the main url, but not backup urls.

this patch fixes that oversight.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-23 05:59:40 +01:00
Leah Rowe 378a73ce42 get.sh: stricter URL check in xbmkget()
don't skip if the URL is empty. throw an error instead.

i decree that all links must be properly initialised, because
that is the design of lbmk. where only one link is provided,
such as in a local copy operation, the second would succeed no
better than the first so two identical paths are given.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-23 05:59:35 +01:00
Leah Rowe b9886740ba get.sh: make xbmkget() easier to understand
the intent once again is that this for loop shall
return, with zero status, if success is observed.

otherwise, the loop breaks and an error is thrown.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-23 05:59:30 +01:00
Leah Rowe c130682fdf get.sh: Make xbmkget err on exiting the loop check
The idea in this function is that if a file or repo is
successfully handled, a return will be performed from the
loop.

If the loop exits for any reason, an error is thrown. The
current code is probably fine, but I can forsee future
modifications possibly causing bugs here.

Make it unambiguous, by always throwing an error if execution
reaches the end of the function.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-23 05:59:24 +01:00
Leah Rowe 1342d74cc6 tree.sh: fix up copy_elf(), bad for loop
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-23 05:58:18 +01:00
Leah Rowe b4a547caac lib.sh: Use while, not for, to process arguments
This is more reliable against globbing, in context of for.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-23 05:58:11 +01:00
Leah Rowe 41ffbb640d xbmk: stricter handling of files on while loops
i overlooked these!

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-23 05:58:05 +01:00
Leah Rowe b516a29482 init.sh: looser XBMK_THREADS validation
on child processes, we can simply correct it.

we currently provide an error message, but this is silly.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-23 05:57:56 +01:00
Leah Rowe fa59f9da76 init.sh: Hardcode XBMK_CACHE for integrity
I never really intended for this to be configurable,
but the cache directory is also used during release
builds.

There's too much that can go wrong, letting the user
decide where their cache is. Simplify it by hardcoding.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-23 05:57:49 +01:00