Commit Graph

1048 Commits (62cc895c3c293011c256bb8c45cc4c07797cbf36)

Author SHA1 Message Date
Leah Rowe 0543350d44 handle/make/file: run make-clean first
flashrom distclean resulted in zero status upon exit,
but did not remove the actual flashrom binary.

our logic was to run distclean and defer to clean;
now, we run clean and *then* run distclean, but we
do not throw an error if distclean fails. (we do
throw one if clean fails)

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-10 17:17:33 +01:00
Leah Rowe 12f9afe622 build/release/src: remove cbutils/ in srcdir
the builds were being created within that srcdir,
because build/release/src runs lbmk commands within
it, and one of them is building (re-building) it.

there's no point addressing this, other than rm -Rf

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-10 17:08:08 +01:00
Leah Rowe fe00ab4e91 build/release/src: remove errant code
the main lbmk script already creates these files,
and these files are then copied by build/release/src
so we don't need to re-create them here

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-10 17:04:59 +01:00
Leah Rowe be4ed54023 handle/make/config: distclean once per tree
previously, it was possible that the distclean or
crossgcc-clean modes were being executed on the same
project tree, needlessly. this patch fixes that.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-10 16:55:36 +01:00
Leah Rowe f227cc081e handle/make/config: fix distclean/crossgcc-clean
these commands weren't being run at all, leading
to binaries (such as xgcc) not being removed, and
thus they were present in tested release archives.

this bug did not affect libreboot 20230625. it
appeared during my audit, post-20230625.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-10 15:55:02 +01:00
Leah Rowe 669c9770cd handle/make/config: fix whitespace and 80-line bug
fit in 80 lines, and remove whitespace

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-10 15:45:56 +01:00
Leah Rowe d28ad6aa78 build/release/roms: use -T0 on serprog tarballs
xz supports using multiple threads

so use multiple threads

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-10 15:12:38 +01:00
Leah Rowe 308c21dd43 build/boot/roms stragglers: properly handle errors
there were a few missing err calls

i actually went through all of lbmk and found no
instances where err calls were missing except in
build/boot/roms_helper

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-10 15:05:19 +01:00
Leah Rowe c16b28efad build/release/src: re-create symlinks, don't copy
if you copy a symlink, you create a whole new file with the
contents of what that symlink points to.

what we need to do instead is re-create the symlinks. this
is relevant for all symlinks to the main lbmk script, from
the main directory of lbmk.git.

this avoids there being multiple copies of the main lbmk
script, in release archives.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-10 01:21:12 +01:00
Leah Rowe 32dcf9e51e coreboot/qemu_x86_12mb: re-add this mainboard
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-09 23:49:39 +01:00
Leah Rowe 5aef8156b5 scripts: use printf, not echo, where appropriate
printf has more universal behaviour, across various
implementations of sh, so it's better to use this.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-09 23:31:20 +01:00
Leah Rowe 76e12cd4a9 update/blobs printf statements: use double quotes
single quotes are not valid

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-09 23:27:44 +01:00
Leah Rowe 84bf47b5b9 scripts: better handling of printf: stdout/stderr
in some cases, messages that should be considered errors
or warnings, were being written to the standard output,
rather than written as error messages.

also: one or two printf statements should specifically
avoid printing errors (to any file); in these cases,
stdout has been redirected to /dev/null

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-09 23:15:17 +01:00
Leah Rowe b78009e28a checkgit: properly print output to stderr
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-09 22:46:13 +01:00
Leah Rowe f45f5e625d update/project/*: remove redundant checks
these scripts used to be in the main directory of
lbmk, and thus needed to check for root user, and
also git credentials. now they are called by the main
lbmk script, which also runs the same checks.

avoid waste of resources by not running the same
check twice.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-09 22:30:22 +01:00
Leah Rowe 3e76e70d83 blobs/download: don't use the -B option in make
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-09 22:14:02 +01:00
Leah Rowe 877c691ef5 build/release/roms: remove errant line break
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-09 22:11:28 +01:00
Leah Rowe f03efbc27f blobs/inject: add error condition on rm command
this was overlooked, earlier on in lbmk audit 2

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-09 20:15:50 +01:00
Leah Rowe 20be007f5b blobs/inject: fix checksum validation if no-ucode
on e6400_4mb, the release build scripts remove nvidia's vga
rom which is used on dgpu models. however, microcode is also
removed in separately copied rom images

the inject script was inserting vgaroms directly into these
no-microcode roms, but the microcode blob is bigger than the
vga rom, and cbfstool inserts into the first available free
spot within cbfs, so it was inserting into the spot where
cpu microcode went. this caused the rom checksum to not match
what was generated during build/release/roms being executed

the only real fix is to guarantee offsets within cbfs for all
files, by recording what offsets were used and then calculating
that during insertion

so this patch is a workaround, but fixes the issue. the workaround
is: don't insert blobs directly on no-microcode roms, instead
insert only on microcode-based roms, then re-copy those roms
and remove microcode in aptly named copies

it's a bit more convoluted, but works perfectly fine.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-09 20:11:11 +01:00
Leah Rowe f989d5b434 blobs/sources: fix backup links on some files
some files did not have backup links defined (the ones
defined were the same as main links)

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-09 18:40:40 +01:00
Leah Rowe 878550d519 use sha512sum to check downloads, not sha1sum
sha-1 has known collision issues, which may not be readily
exploitable yet (in our context), but we should ideally use
a more secure method for checking file integrity.

therefore, use sha-2 (sha512sum) for checking files. this is
slower than sha-1, but checksum verification is only a minor
part of what lbmk does, so the overall effect on build times
is quite negligible.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-09 16:39:26 +01:00
Leah Rowe 022e0200df Merge pull request 'Add stm32-vserprog' (#129) from Riku_V/lbmk:stm32 into master
Reviewed-on: https://codeberg.org/libreboot/lbmk/pulls/129
2023-09-09 14:13:05 +00:00
Riku Viitanen bed444ff90 Add stm32-vserprog
Tested on a Nucleo-F042K6.

That has an onboard stlink:
`st-flash --format ihex write bin/serprog_stm32/serprog_nucleo-f042k6.hex`

The usb port used for flashing is separate, its is exposed on
the pin header instead. Check boards/nucleo-f042k6.h for usb pinout.

Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
2023-09-09 16:55:06 +03:00
Leah Rowe e9e4ada55f build/boot/rom: only insert scan.cfg if needed
where it is set to "both" (grub_scan_disk), inserting
scan.cfg is superfluous, because grub.cfg defaults to
both anyway, unless otherwise specified by scan.cfg,
and only if that file exists within cbfs.

thus, save a bit of build time (only a slight saving)

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-09 00:10:23 +01:00
Leah Rowe 0e3f3efcaa build/boot/roms: delete tmpcfg when done
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-09 00:02:00 +01:00
Leah Rowe a69e8548b3 set grub.cfg timeout to 5s (10 on some boards)
target.cfg can now specify e.g.

grub_timeout=20

this would then be inserted as timeout.cfg in cbfs,
containing the instruction:
set timeout=20

HP laptops need a bit of extra time, due to the delay
caused by the EC bug workaround deployed in GRUB

desktops in general need extra time. this too is set to
10s, like the HP laptops.

only insert timeout.cfg if actually needed (declared in
target.cfg), otherwise grub.cfg will default to 5s

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-09 00:01:22 +01:00
Leah Rowe 4a459b0217 Merge pull request 'pico-serprog improvements' (#128) from Riku_V/lbmk:master into master
Reviewed-on: https://codeberg.org/libreboot/lbmk/pulls/128
2023-09-08 21:02:04 +00:00
Riku Viitanen 7b6fb95897 Build pico-serprog binary release archive
Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
2023-09-08 20:43:53 +03:00
Riku Viitanen c292e01b00 Build for all pico board, not just the "original"
Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
2023-09-08 20:43:53 +03:00
Riku Viitanen 1bde6bb3c4 Support multiple dependencies per project
Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
2023-09-08 20:43:53 +03:00
Riku Viitanen 4d3b16da38 Cleaner parent directory creation
My previous patch b0rked memtest and others because when making sure
their parent directory (the project root) exists, it would instead create
the project directory (memtest86lus). The later move would then put the
git repo inside that (memtest86plus/memtest86plus_123456).

We just need to make sure we don't create the target directory itself.
This way, there's no need to hardcode any project names.

Tested by ./updating rpi-pico-serprog, memtest86plus, grub and seabios.

Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
2023-09-08 00:25:58 +03:00
Leah Rowe 7e8465bec8 grub: re-add module: play
for example, the beep sound in debian's installer needs
this module.

the cute ding in the arch/artix menu also needs it

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-06 09:39:44 +01:00
Leah Rowe e3b9dfc959 util/nvmutil: put code all in nvmutil.c
it doesn't really make sense to have nvmutil.h
since this is only a very small program and not
intended for use as a library

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-05 15:24:21 +01:00
Leah Rowe 8fc5f6ed53 update/blobs/inject: use tmp/romdir, not TMPDIR
we are copying large numbers of ROM images, and the
host system may have /tmp under a tmpfs; that same
host system may or may not have a lot of memory.

respect the user's machine.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-05 01:49:35 +01:00
Leah Rowe da991262a3 build/release/roms: use tmp/romdir, not TMPDIR
we must conserve memory usage, in the event that the
user's /tmp is a tmpfs. copying of ROM images into
tmpfs is ill advised; we must copy them, due to how
the release process works (e.g. stripping of blobs,
but this must be done in a way so as to not interfere
with regular builds, thus they are copied instead)

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-05 01:39:36 +01:00
Leah Rowe 15081ed9ef grub: make backgrounds configurable in target.cfg
now under coreboot mainboards, target.cfg can specify
a background. if not specified, the 1280x800 one is
assumed, and used by default. it can be overridden.
the path should be relative to:
config/grub/background/

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-05 00:53:28 +01:00
Leah Rowe 0d315c3a4e curl/wget downloads: set re-try count to 3
explicitly set the count to 3, so that a maximum of 3
attemps are made per download, barring fatal errors such
as http 404.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-04 22:12:02 +01:00
Leah Rowe bdf171e3ec don't use /tmp/ for git clones. use tmp/ instead.
the /tmp/ file system may be a tmpfs, with conservative
memory limits, depending on host system.

it's more likely that the user will have enough disk space
under tmp/ within lbmk (if they don't, they can't use
lbmk anyway). that is to say: more likely that they would
have the disk space, but not the memory.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-04 21:45:29 +01:00
Leah Rowe 196f293a27 build/release/roms: fix ucode handling
microcode_required wasn't being reset per target,
leading to unreliable results. this fixes that.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-04 21:23:18 +01:00
Leah Rowe c0c7f3ae15 build/release/roms: simplify defcongic handling
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-04 21:19:27 +01:00
Leah Rowe a56cad71c0 update/blobs: unify global variables
they all more or less use the same variables, so put
them all under include/blobutil.sh

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-04 18:12:49 +01:00
Leah Rowe 2cbc7eea95 update/blobs/*: unify checking of defconfig files
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-04 16:16:53 +01:00
Leah Rowe 52677309c5 update/blobs/extract: replace errant target code
check based on whether defconfigs are available, which
are used extensively, rather than checking based on
whether target.cfg is available, which is not used

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-04 15:57:48 +01:00
Leah Rowe ea7fae97bd build/boot/roms: don't create empty bin/ directory
also: only return zero status if rom images were succesfully
built, and print a list of each rom image directory based on
what was actually compiled, rather than just saying that the
rom images are stored under bin/

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-04 14:54:36 +01:00
Leah Rowe c62a423909 update/blobs/inject: remove errant target handling
just like the last patch, target.cfg handling is not
required in this script either. remove it.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-04 14:17:09 +01:00
Leah Rowe 950166da7b update/blobs/download: remove errant code
the handling of target.cfg is *not* required, in
this script. other mechanisms are also used for
error checking. this script only uses defconfigs.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-04 13:44:07 +01:00
Leah Rowe 0668d234f0 add checkversion to build/release/src
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-04 12:39:22 +01:00
Leah Rowe c92a596cb9 grub: remove xnu module
this causes a saving of about 131KB uncompressed, when
i tested. we don't need mach kernel support. nobody will
ever use it.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-04 04:22:58 +01:00
Leah Rowe e659ddd849 grub: remove legacy file system modules
this causes a 6.7% decrease in the payload size

these file systems are microsoft(fat, ntfs) or mostly
oldschool amiga and beos file systems

also remove minix modules, and some old linux file
systems that nobody will use in 2023

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-04 04:16:45 +01:00
Leah Rowe cf5357856c re-add grub modules cat, eval and pbkdf2
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-04 03:49:03 +01:00