Commit Graph

1244 Commits (2e6073f2a7a84a527e32bcd7540d4bee7c758860)

Author SHA1 Message Date
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
Leah Rowe 8ea62a1661 remove unused variables in blob scripts
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-29 18:44:27 +01:00
Leah Rowe 32da4e319b merge include/fetch.sh, blobutil.sh, defconfig.sh
They are only ever used by script/update/blobs/*, so
put them all in blobutil.sh. This cuts down on the
number of scripts in lbmk.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-29 17:23:47 +01:00
Leah Rowe 710171f92b update/blobs/*: simplify mrc.bin handling
mrc.bin is now handled by include/mrc.sh, adapted
from now-deleted script/update/blobs/mrc

much of the logic has been re-written or adapted for
inside script/update/blobs/download

mrc links/hashes now defined in config/blobs/sources

the new code is simpler (and smaller). in addition,
lbmk can now easily handle mrc.bin files for other
platforms such as broadwell. watch this space.

the full .zip download is now cached, like with other
vendor downloads. this means it won't be re-downloaded
if it was already downloaded before.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-29 16:40:49 +01:00
Leah Rowe 0bb3c59620 update/blobs/*: unified download/checksum logic
Use the same logic between blobs/download and blobs/mrc.

The logic is taken from blobs/download.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-29 04:03:18 +01:00
Leah Rowe 5d934be7b0 blobs/download: remove unnecessary linebreaks
generally condense the code, but not in a way that
makes the code unreadable.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-28 03:37:05 +01:00
Leah Rowe 3256ef3e24 blobs/download: remove unnecessary messages
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-28 02:54:46 +01:00
Leah Rowe 178b888aa0 include/blobutil: properly set global variables
I was setting certain global variables inside for loops,
but some sh implementations won't like this.

Instead, don't run eval inside the for loops. Set a string
for eval inside the for loops, then execute eval outside of
the loops. This should work on every shell.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-28 02:28:51 +01:00
Leah Rowe e9e1a3b4ae blobs/download: simplify downloading of files
individual functions for downloading each archive have
been removed. instead, eval is used in fetch_update(),
which is now renamed to fetch().

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-28 01:21:58 +01:00
Leah Rowe 781d0a8091 blobs/download: remove unnecessary error pipes
the called functions directly call err() under fault condition,
so this additional handling is redundant.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-28 00:46:04 +01:00
Leah Rowe 9aef57dfb7 blobs/download: unified archive extraction
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-28 00:29:54 +01:00
Leah Rowe 74c48a881d move build/command/options to include/option.sh
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-27 22:31:24 +01:00
Leah Rowe a00b43375a build/release/roms: simplify strip_rom_image()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-27 21:33:19 +01:00
Leah Rowe 3b9442f7b2 blobs/download: unified blobdir handling
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-27 20:59:07 +01:00
Leah Rowe 373c84e472 blobs/download: unified archive extraction
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-27 20:41:21 +01:00
Leah Rowe 1e92abb177 blobs/download: remove errant debug line
i added that echo command when working on the function
in question, but it's not needed now.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-27 19:15:52 +01:00
Leah Rowe e73306ba8b remove script/update/blobs/extract
This script is incomplete, buggy and its use is ill advised.

This script can be re-added later, when more work is done.

The download and/or inject script is recommended.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-27 17:01:41 +01:00
Leah Rowe 16235cb6f7 blobs/download: simplify fetch_update()
Do not specifically name types of firmware. Instead,
pass the URLs and checksum as direct arguments.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-27 16:51:00 +01:00
Leah Rowe d023327f98 blobs/download: greatly simplify sources handling
remove the giant case/esac list, and set variables directly.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-27 16:10:48 +01:00
Leah Rowe 65a3269835 include/blobutil: simplify setting empty strings
use a for loop and eval to set them.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-27 15:26:17 +01:00
Leah Rowe 6b17cda137 blobs/download: simplify defconfig handling
use the variable names directly, as defined in defconfig.

do not hardcode the if/else chain in detect_firmware, use
eval instead.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-27 15:01:49 +01:00
Leah Rowe b5628131ba handle/make/config: check project in main()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-26 02:01:43 +01:00
Leah Rowe f052f61fb7 handle/make/config: split up main()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-26 01:59:21 +01:00
Leah Rowe 67f4919ffe simplify getopts loops in shell scripts
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-26 01:35:15 +01:00
Leah Rowe 36b7f01a8a only update git submodules in project/trees
do not update them in project/repos - despite what
the previous commit message says, this behaviour is
error prone and should be avoided.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-25 12:46:54 +01:00
Leah Rowe 81d073d5a1 update/project/*: unified git reset handling
With this change, lbmk now also updates submodules on
simple git clones, not just multi-tree clones.

This is OK, because git does not return non-zero status
when git submodule update is ran, where git submodules
are not actually defined.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-25 12:21:23 +01:00
Leah Rowe eae173ec13 split up grub patches into subdirectories
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-25 12:03:07 +01:00