Commit Graph

274 Commits (465077bc4aa0cb0b5806494d67d635a0f7619899)

Author SHA1 Message Date
Leah Rowe e0feda639b update/release: fix/simplify mtime handling
i wasn't getting the very first line of tar --version,
so it wasn't doing the check properly.

further sort the files by name within the tar archive.
for reliability, don't bother using versiondate anymore:
set a *fixed* date, and fixed timezone, to ensure
that it works reliably for reproducible tarball creation.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-14 05:04:28 +01:00
Leah Rowe ec0b38afb3 update/release: nuke roms using the inject script
This way, the handling of configs is unified into one
script, which reduces the possibility of bugs later,
and it reduces the repetition of code.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-14 03:31:45 +01:00
Leah Rowe 2ebadb7ffd build/release: don't include tmp/ in src tarball
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-14 02:34:29 +01:00
Leah Rowe 27aaae5992 update/release: also set timestamp on srcdir
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-14 02:22:48 +01:00
Leah Rowe ca78fc6762 update/release: be more thorough updating times
use find and touch, to force all files, directories and
links to the desired timestamp (versiondate file)

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-14 01:40:23 +01:00
Leah Rowe 7cd84aec28 update/release: use getops OPTARG correctly
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-14 00:35:02 +01:00
Leah Rowe b5db048089 update/release: delete multi-tree upstream repos
e.g. src/coreboot/coreboot must not appear in a release,
because we instead have directories like
src/coreboot/default or src/coreboot/cros

lbmk resets src/coreboot/coreboot to HEAD, but then resets
revisions properly in copies of it

therefore, for reproducibility, we must not include
src/coreboot/coreboot, src/u-boot/u-boot or
src/seabios/seabios into libreboot releases

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-13 23:53:24 +01:00
Leah Rowe 6846c9f735 update/release: if *GNU* tar, use --mtime
with --mtime, files added to the archive can be set
to a static date (in this case, the unix epoch)

the one used here is derived from git commit dates,
and it is static; if not being handled in lbmk.git,
the versiondate file never changes

this is the first patch in a series of patches designed
to bring about reproducible builds in libreboot

a solution will need to be found, for non-GNU tar
implementations, because they did not have an
equivalent option according to their manpages.
for example, BSD tar implementations.

perhaps i could systematically go around changing
file dates, on each file, as a fallback behaviour?

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-13 23:29:22 +01:00
Leah Rowe c401efdd03 build/release: support skipping rom builds
pass this argument: -m src

by doing this, only the src tarball will be made

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-13 23:16:19 +01:00
Leah Rowe 268fd6ce71 update/release: make src tarball first, then roms
this way, the src tarball is guaranteed to be clean.

the downside is that lbmk itself does not currently
handle crossgcc downloads, and there may be some
stragglers such as third party modules automatically
downloaded by certain codebases that libreboot uses.

this will have to be audited later (and it will be).

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-13 23:11:40 +01:00
Leah Rowe 653a8571f4 put space in the warning message about elf/
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-13 03:50:56 +01:00
Leah Rowe c44a38aefc only build cbutils if required
it's sometimes done unconditionally. this change
ensures that it is not repeated needlessly.

i observed otherwise that cbfstool would be
re-built from time to time, even if it was built.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-13 03:22:37 +01:00
Leah Rowe 42068f7ce1 coreboot/default bump: rev d862695f5f, 12 Oct 2023
Riku's mSATA patch for HP8300USDT was merged upstream, so the
patch has been dropped from lbmk because it is contained within
this new coreboot revision.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-12 23:31:06 +01:00
Leah Rowe 09881212c3 use me_cleaner from coreboot instead of upstream
coreboot closely matches upstream, whose current release
is version 1.2 from 2018, and coreboot has not changed it
in any meaningful way.

the upstream did add patches since, but they are documentation
patches only.

this means: we do not need to use the upstream version

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-12 22:21:02 +01:00
Leah Rowe 5b8b55f2ae build/fw/coreboot: fix bad commands in help text
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-10 23:48:03 +01:00
Leah Rowe 067a358d4d fix warning about coreboot elf/ vs bin/
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-10 06:31:26 +01:00
Leah Rowe 67ffb5134c build/fw/coreboot: warning about bin/ versus elf/
also rename elf/coreboot to something scary

some users were flashing roms built under elf/, which
lack payloads. lbmk builds no-payload roms (and payloads)
under elf/ then inserts them, creating full (flashable)
images under bin/

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-10 06:21:34 +01:00
Leah Rowe 21db72b695 disable 32-bit memtest86plus, only build 64-bit
some users reported build errors. technically, there's
nothing wrong with lbmk but it relies on hostcc, and
hostcc is hit or miss when it comes to cross compiling
32-bit, depending on the build system of whatever project.

lbmk needs to handle cross compilation. for now, i'm just
disabling memtest86plus on non-64-bit hosts.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-09 06:06:20 +01:00
Leah Rowe d1ba94ea08 update/release/*: merge to update/project/release
The logic has been re-written, where source archives are
concerned. This clones the current repository, and starts
a new build from scratch. A custom release directory is
possible, by passing -d

This eliminates a step during build-testing, saving hours
of time, because it builds the release archive *inside* the
release archive, with git files removed, thus replicating
the same setup that the user would have.

This also makes everything a bit more consistent, because
it's guaranteed that a release archive will always have
the same files; previously, the release build script would
only copy what was already built, without building anything.

Now, this script builds everything itself.
The script also builds serprog images, not just coreboot.

Usage:

./update project release

If -d is not passed, release/ is used inside lbmk.

Otherwise, you could do:

./update project release -d /path/to/directory

If the directory exists, this script will exit (error).

Other minor fixes: build/fw/coreboot: make version in
coreboot-version (file) not contain hyphens, to work
around a quirk in coreboot's build system when not building
on regular libreboot releases. this quirk only appears
when lbmk is not being compiled under git.

The other main benefit of this change is that the new
script will probably require a lot less maintenance.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-08 08:08:39 +01:00
Leah Rowe e7a77b50e8 build/fw/coreboot: reset grub background each time
the script used to be called once per target, now it
handles every target. the grub background image wasn't
being set, so if it changed at build time, it would
stay changed.

keep the default in place for each run, while still
allowing target.cfg files to change it per target.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-07 21:04:45 +01:00
Leah Rowe 92abbb25fe update/release/roms: copy license files to archive
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-07 11:10:39 +01:00
Leah Rowe 1e89264ce3 update/project/*: merge to update/project/trees
Just one script.

Just one!

Well, two, but the 2nd one already existed:
logic in update/project/trees and
update/project/repo was merged into
include/git.sh and update/project/build
was renamed to update/project/trees; an -f
option was added, which calls the functions
under git.sh

so git clones are now handled by the main build
script (for handling makefiles and defconfigs)
but the logic there is a stub, where git.sh
does all the actual heavy lifting

this cuts the file count down by two, and reduces
sloccount a reasonable amount because much of
the logic already exists in the build script, when
it comes to handling targets. git.sh was adjusted
to integrate with this, rather than act standalone

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-07 10:26:11 +01:00
Leah Rowe a413c01a3e update/project/trees: handle seen in fetch_config
I'm planning to re-use this function later, in other
files, to unify handling of target.cfg files.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-07 06:23:22 +01:00
Leah Rowe c8bace0d84 build/fw/grub: re-add end confirmation message
otherwise, if src/grub/ was already compiled, this
would not print anything on the screen. however, the
files will have been created under elf/grub

this message just makes lbmk a bit more user friendly

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-07 06:08:03 +01:00
Leah Rowe ba324d8c07 build/coreboot/grub: move to build/fw/grub
This eliminates an additional subdirectory.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-07 06:04:45 +01:00
Leah Rowe 4708da2ca9 use quotes when checking empty strings in scripts
this is far less error-prone

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-07 05:37:11 +01:00
Leah Rowe 0fad3497b8 build/fw/coreboot: fix error "unexpected operator"
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-07 05:30:17 +01:00
Leah Rowe ea27c92842 update/project/build: move helpers to option.sh
certain functions are better placed there, rather than
in the main script

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-07 05:16:46 +01:00
Leah Rowe 0ed2ec294b build/coreboot/util: merge to update/project/build
The benefit now is that it can be cleaned. E.g.

./update project build -b coreboot utils
./update project build -b coreboot utils default
./update project build -c coreboot utils
./update project build -c coreboot utils default

the update/project/build script checks when arguments
are provided after the project name. if the first one
is "utils", then it acts in the same way as the old
build/coreboot/util script

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-07 05:04:55 +01:00
Leah Rowe b6d9e6c18d build/fw/coreboot: don't support no-all all arg
it's buggy. "./build fw coreboot" was made to work,
but it caused lots of unknown issues when mixing other
args

the old way wasn't broken. now, once again, you must
pass the "all" argument. e.g.:

./build fw coreboot all

Also, the confirmation messages at the end are a bit
clearer, when listing which ROM images were compiled.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-07 03:06:20 +01:00
Leah Rowe 0962600c84 build/fw/coreboot: correctly check built targets
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-07 02:55:17 +01:00
Leah Rowe fa8e204f14 unified projectname/version/versiondate handling
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-07 02:46:47 +01:00
Leah Rowe 62cc895c3c rename blob/ to vendor/
in the future, we may start downloading files that aren't
blobs, such as mxm port configs (on mainboards that use
MXM graphics)

this directory will contain all of those files

generally change the language used, across lbmk, to make
use of "vendorfile" instead of "blob"

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-07 01:23:11 +01:00
Leah Rowe 3c7e37b15d update/blobs: correct utils paths check
some utils were being needlessly re-downloaded.
fix that!

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-07 00:47:42 +01:00
Leah Rowe 5e81024e97 update/blobs: don't hardcode kbc1126 util check
use the variable that is set up in blobutil.sh

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-07 00:46:38 +01:00
Leah Rowe 9f8f230b61 update/blobs: don't needlessly re-build uefitool
during the switch to src/ for all downloads, i
overlooked that the path check was hardcoded.

now the check for this binary is corrected.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-07 00:45:34 +01:00
Leah Rowe 4e39d5a5a8 put all src downloads under src/
build/release/src was partly re-written to accomodate this

memtest86plus was patched to have a central Makefile, and
lbmk modified to use that, rather than mess with build32
and build64. the central Makefile just builds both targets
or cleans both targets

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-07 00:11:21 +01:00
Leah Rowe 965b6a7ed7 rename build/firmware/ to build/fw/
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-06 03:32:38 +01:00
Leah Rowe 5494ffb3d1 build/firmware/coreboot: confirm compiled roms
return with error status if no images were compiled

if a rom image fails to compile, then it will also
exit with error status, but sometimes you can pass
argument "cros" or "default", and it would not give
you rom images due to no target.cfg files, but these
are also ignored because of that.

this restores the same behaviour that existed before,
for this final error check.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-06 03:03:31 +01:00
Leah Rowe ce10c1b38c build/firmware/coreboot: support "all" without all
with no argument specified, it is now possible to build
every rom image.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-06 02:53:37 +01:00
Leah Rowe 2d483d2f5c move build/release/* to update/release
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-06 02:33:53 +01:00
Leah Rowe 315d0c4572 mv build/fw/serprog,build/boot/roms build/firmware
./build boot roms is now: ./build firmware coreboot

./build fw serprog is now: ./build firmware serprog

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-06 02:26:18 +01:00
Leah Rowe 2d16e1ee47 rename build/project/trees to update/project/build
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-06 01:59:13 +01:00
Leah Rowe 1c2de7f962 unify build/grub/* to build/coreboot/grub
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-06 01:34:14 +01:00
Leah Rowe 176722a841 unify handle/make/* into build/project/trees
Just one script.

Just one.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-06 01:16:39 +01:00
Leah Rowe 9d419e77a0 handle/make/*: unified main() function
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-05 22:51:05 +01:00
Leah Rowe 106841024a general code cleanup in shell scripts
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-05 22:16:07 +01:00
Leah Rowe cad7648a26 build/boot/*: merge all logic into one script
for the first time ever, this is a single script.
with recent simplifications in how variables are
handled, and techniques i've developed during
auditing, it's now feasible design-wise for this
to be a single script, without a helper script.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-05 03:48:05 +01:00
Leah Rowe fbd464b4f7 include/err.sh: checkgit,checkversion
call these as functions, instead of executing scripts

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-04 08:06:10 +01:00
Leah Rowe e638c3e411 update/project/trees: remove errant assignments
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-03 13:36:48 +01:00
Leah Rowe 68e1787cec update/project/trees: split up main()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-03 13:21:30 +01:00
Leah Rowe 5de8eda21c general code cleanup in shell scripts
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-03 12:59:49 +01:00
Leah Rowe 334aa1f7c9 handle/make/config: fix formatting on variables
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-03 03:10:40 +01:00
Leah Rowe 8097baa0bd handle/make/file: check for all default makefiles
Previously, this script only checked for "Makefile",
but "makefile" is another valid name; additionally, if
GNU Make is used, "GNUmakefile" is an accepted default.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02 23:46:20 +01:00
Leah Rowe 0db6c0a4a8 update/blobs/download: remove errant comment
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02 22:39:25 +01:00
Leah Rowe 3af63fb8b7 handle/make/file: exit 0 if no makefile
There is no reason to err if no Makefile exists.

Just exit with zero status. This makes the following
command work:

./handle make file -c util/*

Within util/, there is me7 update parser which does
not have a makefile (it's a python script).

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02 22:37:09 +01:00
Leah Rowe ad74b4c281 handle/make/file: run extra arg before, not after
The previous patch to the file was correct, except for
off by one at the end, resulting in no argument being
passed for project names.

Now the extra commands are run *before* handle_dependencies,
instead of running at the end of main. This prevents error.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02 22:21:42 +01:00
Leah Rowe d9719cae49 handle/make/file: do multiple project arguments
At the end of the function, this script will now
run itself again if there are more arguments. This
enables the following:

./handle make file -c project1 project2 project3

Whereas previously, it could only do this:

./handle make file -c project1

Substitude -b and it's the same.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02 22:00:59 +01:00
Leah Rowe 9dce8236ef update/project/trees: fix error handling on mkdir
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02 05:56:14 +01:00
Leah Rowe 0f86a393ac update/project/trees: optimise error handling
some x_ calls are made that aren't needed. this is now
corrected. additionally, some x_ calls were being made
that are quite error-prone, like ones that use $PWD.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02 05:47:49 +01:00
Leah Rowe 67ac799d49 update/project/trees: simplified error handling
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02 05:21:20 +01:00
Leah Rowe cd2caecb73 update/project/trees: general code cleanup
reduced sloccount, without reducing functionality

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02 04:53:22 +01:00
Leah Rowe bcbd3734b3 update/project/trees: rm yet another rm line
good lord, redundancy is indeed redundant.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02 04:43:18 +01:00
Leah Rowe 0a63dce35e update/project/trees: remove one more rm line
the one at the end of main is unnecessary, because
it's handled inside the for loop.

this file isn't used anywhere else, so it's OK.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02 04:41:48 +01:00
Leah Rowe 91c0f942f3 update/project/trees: remove redundant rm command
as it turns out, i delete "seen" inside the for loop,
which is a more thorough way to do it.

thus, the first rm command is unnecessary.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02 04:40:11 +01:00
Leah Rowe 7bead4f55a update/project/trees: remove unnecessary linebreak
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02 04:38:55 +01:00
Leah Rowe 1dd97470e7 update/project/trees: rm "seen" in the right place
it must be done *after* setting cfgsdir

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02 04:37:29 +01:00
Leah Rowe a3b3196d6c build/grub/payload: remove unnecessary linebreaks
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02 04:32:50 +01:00
Leah Rowe 3fcad603b2 build/coreboot/utils: remove unnecessary check
the file check is sufficient (target.cfg)

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02 04:17:50 +01:00
Leah Rowe 0a711ebc66 build/coreboot/utils: simplify argument handling
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02 04:16:43 +01:00
Leah Rowe 7ce3f93e44 build/boot/*: unify more logic in main()
slight sloccount reduction. light renaming of
functions between the two scripts, placing more
logic in main() under include/boot.sh

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02 03:54:39 +01:00
Leah Rowe 7b02bb9aa6 do not handle errors on mktemp in shell scripts
errors are not defined for mktemp, and the /tmp file
system should be assumed reliable.

if /tmp is *unreliable*, then this is not something that
lbmk either can or should fix; the user clearly has
bigger problems.

manpages for mktemp do not define errors. it is assumed
to be completely reliable.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02 03:39:10 +01:00
Leah Rowe 8c03b886c4 Greatly simplify error handling in shell scripts
Instead of having detailed error messages, run most
commands through a function that calls err() under
fault conditions.

Where detail is still required, err() is still called
manually. Where it isn't, the error message is simply
whatever command was executed to cause the error.

This results in a massive sloccount reduction for lbmk;
specifically, 178 sloc reduction, or a 8.1% reduction.
The total sloccount is now 2022, for shell scripts.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-01 22:47:02 +01:00
Leah Rowe 5f914a4d00 build/boot/roms: optimise main() for code size
handle everything in the getopts loop

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-01 04:30:02 +01:00
Leah Rowe 92c6da7b21 build/boot/roms_helper: shorten variable names
also: further reduce the number of arguments passed,
to certain functions as and when feasible, in cases
where those are global variables that never change.

the cbfstool argument in mkUbootRom wasn't even used.
that function was only using the global variable, which
again is only set once.

i also shortened a few messages, removed a few errant
line breaks and reduced sloccount by exactly 1 in main()
by re-arranging how the shift command is used.

it's mainly about shortening variable names, to then
reduce the number of line breaks, but it's a surgical
code size reduction in build/boot/roms.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-01 04:08:30 +01:00
Leah Rowe 2a6fcf7022 build/boot/roms: dont do init/displaymode argument
These are only ever initialised globally, and set once.
Other instances where they are set are only in cases
where they are passed as argument, at the start of
a function, so they are being *needlessly* re-set.

Set them only once and use them globally.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-01 01:18:20 +01:00
Leah Rowe 9bc9dddf64 build/boot/roms_helper: simplify rom file handling
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30 23:23:09 +01:00
Leah Rowe c477599c78 build/boot/roms_helper: general code cleanup
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30 22:27:39 +01:00
Leah Rowe 26fc3f1325 general code formatting cleanup in shell scripts
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30 20:06:29 +01:00
Leah Rowe 0a0defd325 simplify initialising variables in shell scripts
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30 19:09:25 +01:00
Leah Rowe 49b266eb42 build/boot/roms: only do 1 custom kbd/payload/mode
-k, -p and -d let you set keymap, payload and displaymode
respectively, but the handling for this is buggy when
passing multiple arguments.

Support only one argument, for simplicity. This is how
people use them anyway, and it makes lbmk less buggy.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30 16:14:27 +01:00
Leah Rowe d268f5eb28 build/boot/roms: move usage() to include/boot.sh
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30 15:36:53 +01:00
Leah Rowe 7922b6e0e5 build/boot/*: unified main() function
The *same* main() function is now used on both scripts.

However, merging both scripts together would be less efficient
on sloccount, and would be error-prone. The purpose of having
roms_helper is that the variables get re-initialised the same
way each time, for each board, automatically.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30 15:28:52 +01:00
Leah Rowe f3c4f208d0 build/boot/roms: split up handle_targets()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30 14:13:11 +01:00
Leah Rowe 4afa0aaa3c build/boot/roms: check all targets before building
If one of them doesn't exist, error out.

Previously, a build would start but then it would
error out later on. This implements the mentality:

fail early, fail hard

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30 13:22:19 +01:00
Leah Rowe 6125d3418f build/boot/roms: merge handle_targets/build_target
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30 13:18:11 +01:00
Leah Rowe 13f5a4322b build/boot/roms: only run confirm_targets once
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30 13:11:48 +01:00
Leah Rowe 5462bf1ca0 build/boot/roms: rename buildrom to build_target
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30 13:06:56 +01:00
Leah Rowe fc097b3e0f build/boot/roms: split up main()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30 13:05:57 +01:00
Leah Rowe 895073d765 build/boot/roms: simplify buildrom() handling
Only one for loop is required.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30 12:59:20 +01:00
Leah Rowe df7305a5d9 build/boot/roms: support "all" if argument passed
e.g. -k ukqwerty

previously, this would not work:
./build boot roms -k ukqwerty all

only this would work:
./build boot roms all

this patch fixes the bug.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30 12:51:40 +01:00
Leah Rowe b3e69cd9ac build/boot/roms: move help() to bottom of file
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30 12:41:41 +01:00
Leah Rowe 385eb90c8c update/*/*: unified scanning of revisions/sources
update/blobs/download and update/project/repo both use
the same logic, for setting variables with awk and a
specially formatted configuration file.

unify this logic under include/option.sh, and use that.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30 12:31:30 +01:00
Leah Rowe 9f5a5450af blobs/download: move helpers to include/blobutil
mkdirs() should be in include/blobutil.sh, as should
extract_archive(), because that is primarily where
they are used.

script/update/blobs/download calls these functions
aswell, but it sources include/blobutil.sh so it's OK.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-29 23:40:57 +01:00
Leah Rowe 416704fb4e include/blobutil: try curl first, then wget
Don't use only wget. Some systems may only have curl.

The user can always install wget anyway, but why not
support both? I've added the right user agent string.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-29 23:04:30 +01:00
Leah Rowe 6519cea9cf include/blobutil: simplify check_defconfig()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-29 22:34:34 +01:00
Leah Rowe ac05e5ff17 blobs/download: do IntelME extract in one function
Just one function.

Just one.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-29 22:12:55 +01:00
Leah Rowe 9b94df5dbb blobs/download: do final check of _dest in fetch()
This way, the file is checked regardless of what type of
blob is handled, not just Intel ME.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-29 21:44:51 +01:00
Leah Rowe 9a7bf4af0f blobs/download: don't pass dl_path as argument
Because fetch() is only called now from blobs/download,
we can reliably know what dl_path should be.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-29 20:43:24 +01:00
Leah Rowe 2b7ae8e204 blob scripts: unified handling of blob destination
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-29 20:29:13 +01:00