Commit Graph

381 Commits (e7fcfac14ecc34dc6c0fc30eb12eecdc3b7c99f7)

Author SHA1 Message Date
Leah Rowe e7fcfac14e lib.sh: remove badcmd()
it's bloat. telling the user to rtfm is something that
we already do on irc; they will still ask how to do
everything, and ignore the message from badcmd(), or
they will automatically know to rtfm.

i'm on a massive purge, removing bloat from lbmk as
part of Libreboot Build System Audit 6.

all bloat must go.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-22 13:51:01 +01:00
Leah Rowe dec9ae9b43 lib.sh: more unified config handling
replace it with logic that simply uses "." to load
files directly.

config/git files are now directories, also containing
pkg.cfg files each with the same variables as before,
such as repository link and commit hash

this change results in a noticeable reduction in code
complexity within the build system.

unified reading of config files: new function setcfg()
added to lib.sh

setcfg checks if a config exists. if a 2nd argument is
passed, it is used as a return value for eval, otherwise
a string calling err is passed. setcfg output is passed
through eval, to set strings based on config; eval must
be used, so that the variables are set within the same
scope, otherwise they'd be set within setcfg which could
lead to some whacky results.

there's still a bit more more to do, but this single change
results in a substantial reduction in code complexity.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-22 13:50:43 +01:00
Leah Rowe c72904b6d1 trees: more robust check to avoid "make fetch"
do not use shorthand here. the test was failing to
produce the desired result under some circumstances,
for example when i did "./update release" i got this:

make: Entering directory '/home/lbdev/lbmk/release/20240612-62-ga6b1a6bd/libreboot-20240612-62-ga6b1a6bd_src/src/stm32-vserprog'
make: *** No rule to make target 'fetch'.  Stop.
make: Leaving directory '/home/lbdev/lbmk/release/20240612-62-ga6b1a6bd/libreboot-20240612-62-ga6b1a6bd_src/src/stm32-vserprog'
ERROR script/trees: !mk src/stm32-vserprog fetch
ERROR ./update: excmd: script/trees -f
ERROR script/roms: Unhandled non-zero exit: ./update
ERROR ./build: excmd: script/roms serprog
ERROR ./update: build_release release/20240612-62-ga6b1a6bd: stm32
ERROR ./update: can't build rom images

in the above circumstance, run_make_command was executed,
which is not the desired behaviour; rather, fetch_project_trees
or fetch_project_repo should be called, and then the script
should immediately exit. it should also exit, without downloading
anything, if a changelog file exists as in release archives.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-21 03:13:13 +01:00
Leah Rowe a59ebb1b7c roms: fix lack of backslash on multi-line command
Signed-off-by: Leah Rowe <info@minifree.org>
2024-06-20 22:38:23 +01:00
Leah Rowe 253015f6a9 Revert "roms: remove build_payloads() and split it up"
This reverts commit 3610667e3db08ff1db4f7784ff5a879d8aebce9d.

The output of some functions in the roms script are used as
an argument in cp and mv commands, also cbfstool. I overlooked
this fact in a previous code optimisation.

Revert it. The change only reduced sloccount by a few lines
anyway.
2024-06-20 03:00:48 +01:00
Leah Rowe 448d02babb git.sh: revert modification to for loop
i tried to be clever with this one, but it just made
the script exit with an error.

revert back to the old check (check whether one of
either repo or repo backup is set)

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-20 01:43:23 +01:00
Leah Rowe 381ed442d9 minor code cleanup in the build system
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-20 01:15:54 +01:00
Leah Rowe 295471644a git.sh: general code cleanup in fetch_submodule()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-20 00:58:31 +01:00
Leah Rowe 3ba876932d git.sh: reduced indentation on repo/file check
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-20 00:58:27 +01:00
Leah Rowe 109db65932 git.sh: simplified repo/backup check
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-20 00:58:21 +01:00
Leah Rowe acbefc558e roms: merge mkserprog() into main()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-20 00:58:16 +01:00
Leah Rowe c2ca92a169 roms: don't insert timeout.cfg
this is bloat, because it's something the user can already
do at runtime configuration anyway.

set it to a reasonable default of 8 seconds instead of 5,
and don't honour the timeout variable in target.cfg.

this will be documented in the next release.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-19 14:34:19 +01:00
Leah Rowe 98fc84b0ed correction
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-19 14:20:42 +01:00
Leah Rowe 3ef9925b56 roms: reduce indentation in build_grub_roms()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-19 14:13:45 +01:00
Leah Rowe faddd02ef5 roms: re-introduce accidentally disabled check
i disabled a check in the script, while testing a prior
modification. re-introoduce the check, which is put there
to yield an error condition if no targets were compiled.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-19 01:30:33 +01:00
Leah Rowe 14a05f72fb roms: remove build_payloads() and split it up
payloads are compiled before coreboot, but it doesn't matter
to the build speed whether this is done first.

reduce the lines of code by checking payload builds *while*
adding them to the coreboot images. this means that coreboot
is now compiled first, before the payloads.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-19 00:44:56 +01:00
Leah Rowe da3d7c7101 roms: group some commands that are similar
this makes the build_payloads() function nicer to read

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-19 00:09:39 +01:00
Leah Rowe 99a13a32d9 roms: remove mt86bin variable
it's only meaningfully used once, so just hardcode
the string, which is not set dynamically anyway.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-19 00:09:34 +01:00
Leah Rowe 3097a9e97a roms: merge build_uboot_payload to build_payloads
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-19 00:09:29 +01:00
Leah Rowe ccb330ec09 roms: simplify payload_uboot y/n check
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-19 00:09:23 +01:00
Leah Rowe 49c41411bd roms: simplify the check for serprog srcdir
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-18 02:34:08 +01:00
Leah Rowe 8136b640b9 roms: simplify the loop for building serprog roms
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-18 02:34:03 +01:00
Leah Rowe 6976a4edb2 roms: shorten variable serprog_boards_dir
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-18 02:33:57 +01:00
Leah Rowe 4a3ab3ad1c roms: simplified serprog image copy
use eval to avoid having two mv commands

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-18 01:52:25 +01:00
Leah Rowe 64ce81d2b6 roms: rename picosrc variable to rp2040src
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-18 01:52:18 +01:00
Leah Rowe e3471b22e7 roms: remove useless confirmation in mkserprogfw
the user knows where to look. replace it with a single
declaration.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-18 01:52:12 +01:00
Leah Rowe a8fb99a750 roms: merge serprog build into one function
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-18 01:52:06 +01:00
Leah Rowe b1ec5ad719 roms: remind the user about gkb files
nowadays, we don't insert GRUB keymaps automatically, for
sake of efficiency; without one, the default is US QWERTY.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-17 15:52:18 +01:00
Leah Rowe a93f519799 roms: rename x variable to it in for loop
there are two for loops that use x as a variable anme,
and an idiosyncrasy of certain sh implementations is
that these become global;

the result in this case was that when you finish building
every target in "./build roms", it would print "libgfxinit"
repeatedly, comma separated, instead of a comma-separated
list of the targets that were built.

work around it by renaming the variable in one of the loops.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-17 15:07:56 +01:00
Leah Rowe faff6f0348 roms: don't use x_ to call cproms()
cproms() never returns non-zero, so it doesn't make
sense to use x_ here

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-16 18:00:05 +01:00
Leah Rowe f43525d14f roms build_uboot_roms(): move rom, don't copy
that way, we don't have to delete the temporary file.
just move it entirely.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-16 17:59:59 +01:00
Leah Rowe dd2854b3e8 roms cproms(): allow other commands besides cp
e.g. the operator might specify mv instead

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-16 17:59:49 +01:00
Leah Rowe a8f44ab80a unify coreboot elfdir (DO_NOT_FLASH)
use a common string when setting this path

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-16 17:58:50 +01:00
Leah Rowe be04f59602 roms: merge mkUbootRom() into build_uboot_roms()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-16 17:58:44 +01:00
Leah Rowe a9819d7385 roms: simplify mkSeabiosRom()
remove variables that are not meaningfully used

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-16 13:26:47 +01:00
Leah Rowe 19baf8d1a7 roms: simplify mkUbootRom()
remove variables that are not meaningfully used

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-16 13:26:42 +01:00
Leah Rowe 935958e6a4 roms: simplify build_roms()
cbcfg is already a global variable, so there's no reason
to set it again at the start of this function.

remove the check for whether the given coreboot config
exists, to the calling function instead of build_roms().

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-16 13:26:37 +01:00
Leah Rowe acd5d16961 roms: remove unnecessary check
uboot_config is later only used if payload_uboot is set

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-16 13:26:30 +01:00
Leah Rowe 6094542663 build: remove unused variables
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-16 12:39:30 +01:00
Leah Rowe 94b9bd44e4 roms: further clean up build_grub_roms()
the tmpcfg variable will be useful elsewhere, for
the same kind of change as before.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-16 01:20:00 +01:00
Leah Rowe 167f81a993 roms: simplify timeout/scandisk insertion
we don't need to call mktemp everytime.
just use a staticly named file in tmpdir
and keep overwriting it.

these files are only small, and they get deleted
when the build system exits later on.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-16 01:19:55 +01:00
Leah Rowe d958b16369 roms: simplify seagrub check in build_grub_roms
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-16 01:19:49 +01:00
Leah Rowe 726b56b2f1 roms: simplify mkserprog()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-16 00:54:24 +01:00
Leah Rowe dd59f2daba roms: simplify the serprog build functions
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-16 00:54:18 +01:00
Leah Rowe 9897bc748d script/roms: fix serprog build commands
forgot to shift

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-16 00:54:13 +01:00
Leah Rowe 3269e0c097 roms: simplified ubootelf check
we check it twice, which we don't need to do.

we only need to check it once!

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-15 23:59:59 +01:00
Leah Rowe 7265b9f112 roms: simplify grubonly check in configure_target
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-15 23:59:54 +01:00
Leah Rowe c29b3ec3fc roms: simplify seagrub check in configure_target
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-15 23:59:50 +01:00
Leah Rowe f07aa84d49 roms: don't use x_ to call build_grub_roms
build_grub_roms never returns a non-zero value

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-15 23:59:45 +01:00
Leah Rowe ed921d7890 trees: simplify copy_elf()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-15 23:19:02 +01:00