Age | Commit message (Collapse) | Author |
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
use of ./mk -F behaves the same as -f before the
previous commit.
this can be useful, during development when we want
to update revisions.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
this whole check could probably be removed, honestly.
it was only put in place during the debian trixie testing
release cycle, before they finally updated gnat just before
the stable release of trixie came out.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
this is an extension of the previous work to unroll
most of the condensed code lines.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
add line breaks, so that the license and author are
visually separated. this makes it easier to read.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
be a bit less pedantic about if else clauses. leave the
big ones still with then on separate lines, where else
is specified.
also unroll a few condensed code lines where i missed
a few.
sloccount 2303 in lbmk. that's still only slightly bigger
than libreboot 20260907 which was 2180, and still much
smaller than libreboot 20230625 which was 3322.
this is *without* the condensed codelines, so now the only
thing that's reduced is the overall amount of logic present
in the build system.
and i should clarify that lbmk is presently much more powerful
than both of those two versions (20160907/20230625).
the 2016 one is useful for comparison historically, since that
was the last major version of libreboot prior to the great
second coming of leah in 2021; and the 2023 june release was
basically the last one before the great audits of 2023 to
2025 began.
not to brag (not much anyway), but all of this means that lbmk
is an insanely efficient build system, considering all the
features it has and what it does.
i unrolled the condensed code style in lbmk, making the scripts
a lot easier to read, because i received complainst about the
condensed style previously used; nicholas chin and alper nebi
yasak both told me that it sucked, and riku viitanen had hinted
at that same fact several months prior.
so hopefully now, lbmk is a bit nicer. those and other people
often find it challenging to challenge me because for reason
they assume i'll get upset and fly off the handle, but it's the
opposite. i want constant criticism, so that i know to improve!
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
i went further than in the previosu commit. in this
commit, i also provide indentation inside subshells,
to make it clearer that soomething is being done
inside a subshell.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
This reverts commit 4999a49de39667b3239fc2010d0e99c958b29417.
|
|
we didn't want to say a variable name here.
we only wanted to say "trees".
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
use the new functionality in err(), whereby a given
function name and arguments can be provided, for
debugging purposes.
something similar was already done in a few places,
and replaced with this unified functionality.
this patch will make xbmk much easier to debug, under
fault conditions.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
the newer way handles escaped characters better, and it
can be nested more easily. it's also more readable.
personally, i prefer the old way, because it's more
minimalist, but it occurs to me that a lot of people
nowadays don't know about backticks, but they do know
of the modern way.
to make the code more readable, i have modernised it.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
it's stupid. separate them, to make the code readable.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
e.g. gnupath, xbmkpath
these currently go in XBMK_CACHE/, which is bad
because they're meant to be temporary.
XBMK_CACHE is for permanent files.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
This reverts commit 01a779d4ebcdfc7df406263aeb1dffb800eb0220.
This commit broke ./mk -d coreboot for vendor files in lbmk.
|
|
This reverts commit 568887cd5efd5df519c7f4f593300eb3ae2beaae.
This commit broke ./mk -d coreboot for vendor files in lbmk.
|
|
this is because when using chained commands at the end
of functions, sometimes you have to explicitly terminate
the line.
the way i do it in this patch is common across the
build system, to mitigate this sh quirk.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
and generate them, don't hardcode them - this reduces
the chance of race conditions, which we have seen in
the past and which current execution flow in xbmk even
mitigates in a few places, by doing things in a certain
order.
this change makes the code more robust and easier to
maintain.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
group related operations together, without whitespace.
declare all variables at the start of the function.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
instead, create a file indicating that a given xgcc
target had already been built successfully, within a
given coreboot tree.
this will considerably speed up the building of release
archives, especially when there are a lot of boards.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
if e.g. elf/coreboot/default/w500_16mb contains readied
images from before, crossgcc is still being checked.
if you already built all the coreboot images, and wanted
to just modify all the payloads for example, this would
result in a much slower re-build process, because it is
needlessly re-checking crossgcc every time.
by doing it this way, we need up the testing of payloads
quite considerably, during xbmk development.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
The current logic deletes old project files e.g. sources,
but *after* updating the project hash.
This means that if a deletion fails, and the directory
is still there (e.g. src/coreboot/default/) afterward, it's
now a tainted archive, yet the hash has been updated, so
subsequent runs of the build system will cause unknown
errors.
This patch fixes that, by first copying the new hash to
a temporary file. *Then*, deletions are handled, and the
final hash file is updated afterward.
The code is now a bit more bloated as a result, but this will
reduce the risk of tainted sources being handled under fault
conditions.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
since it's the name, e.g. "default", referring to a
project tree (in this example, coreboot/default).
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
since it's only ever used as a directory name
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
now the code that uses it makes a bit more sense
to the casual reader.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
the new function names make the comments redundant. the
code is now self-explanatory.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
in that case, the previous tree-wide check will cover
it, so the current logic wastes computational time.
this patch therefore somewhat optimises the code.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
the target/project hash checks are basically identical,
so let's unify them under a single function.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Detect when a config changes. This is done even if the
entire tree doesn't change.
This is already done per-tree if files change, but
individual project files don't change.
For example, if a grub.cfg changes, the given cached
build for that GRUB tree isn't deleted. Same thing if
a given U-Boot config doesn't change.
This patch fixes a longstanding design flaw of lbmk,
making auto-re-builds more reliable. This complements
another recent change, that deletes all target builds
of a given tree when the tree changes.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
Target builds go inside a common directory for
the given tree now, which gets deleted, thus
deleting all target builds of that given tree.
Therefore, the deletion being removed is redundant.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
as opposed to target/
for example:
image the command:
./mk -b u-boot amd64coreboot
This would put the U-Boot binaries here:
elf/u-boot/amd64coreboot/default/
With this change, they now go here:
elf/u-boot/x86_64/amd64coreboot/default/
This solves a problem that existed previously, where
you could modify a given tree in a multi-tree project,
but cached builds for targets branching separately off
of each tree would not be deleted, and thus not re-built.
This accomplishes such a result, without needing to
further check hashes of individual targets.
The latter will still be done, in a future change, because
this change doesn't fix another problem:
If you change a given config, e.g. targetname "foo" which
uses tree "bar", elf/foo/ would not be removed automatically
for re-build.
So this change only deletes individual target builds when
their master tree changes.
Where the target and tree are the same, this also means
elf/tree/target/
for example: seabios/default would create binaries in:
elf/seabios/default/default/
not:
elf/seabios/default/
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
handle errors on sha512sum - also handle awk errors inside
the mini subshell, and provide overall error handling.
we know that the project.hash file should always exist, and
always be read no matter what; technically, the find command
that proceeds it might not yield any results, but an empty
file would then be produced.
the edge case of an empty file would have lead to an error
beforehand, when configuring the project in function,
configure_project(), so we've already got that covered.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
when reading old_pjhash, we need to error out where a read
error occurs. such an error is unlikely, but could occur under
certain edge cases.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
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>
|
|
shorten them
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
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>
|
|
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>
|
|
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>
|
|
i overlooked these!
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
in a few places, we use the presence of a file found
by fx_ to cause an exit, but the command that runs
looks something like:
exit 1 "string"
this yields an error, and a non-zero exit, because of
too many arguments to "exit", but we wanted a non-zero
exit anyway.
nevertheless, this is incorrect.
to fix it, eval is used instead. if the never-going-to-exist
condition one day exists where exit 1 actually returns, not,
you know, exits, we will use err instead, with the string
as argument.
this should be fine. it's a bit hacky, but so is fx_, and
it works. fx_ is used in several places to keep the sloccount
down, providing a common way to perform while loops on the
output of a command; that is its only purpose..
Signed-off-by: Leah Rowe <leah@libreboot.org>
|
|
i don't need it. i can use fx_ instead, on functions
that previously called mk().
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>
|
|
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>
|
|
many places in lbmk 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>
|
|
I really think mk should just be a small stub.
Better to keep everything separate.
Signed-off-by: Leah Rowe <leah@libreboot.org>
|