Commit Graph

1124 Commits (8a063f6b4bf26dee1d32c0e4a67059d60f8a64d7)

Author SHA1 Message Date
Leah Rowe ac0e49996a util/nvmutil: remove unnecessary xclose macro
it is only used once. use err_if instead.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-18 16:26:03 +01:00
Leah Rowe 83e6cfb294 util/nvmutil: simplify pledge and unveil handling
there is no need to have these as defines, when err_if
exists; get rid of xunveil and xpledge. use the bare
pledge and unveil functions directly, with err_if().

268 sloccount now on nvmutil.c, versus 289 sloccount
before this change, with no loss of functionality.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-18 15:50:44 +01:00
Leah Rowe 7bb92acd50 Merge pull request 'merge serprog scripts' (#131) from Riku_V/lbmk:master into master
Reviewed-on: https://codeberg.org/libreboot/lbmk/pulls/131
2023-09-16 23:29:42 +00:00
Riku Viitanen 3c30e1e3dd merge serprog scripts
13 sloc reduction

Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
2023-09-16 21:49:45 +03:00
Leah Rowe f8704c0a0d lbmk: more verbose error messages
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-16 11:37:20 +01:00
Leah Rowe a1db59a583 lbmk: reduce indentation in execute_command()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-16 11:28:26 +01:00
Leah Rowe a9ea277e56 lbmk: fail if ./build command options fails
non-zero exit, whereas it was previously an unhandled
non-zero exit as per -e - now it is simply more verbose.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-16 11:25:35 +01:00
Leah Rowe f1f5b91a85 lbmk: simplify execute_command()
if ./build command options fails, it just means that
lbmk would next check whether ./buildpath mode list exists,
which it never will because that would violate lbmk design.

the generic "help" output is more than sufficient, and tells
the user to check "list" anyway, so there's no point in saying
it here. simplify this function.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-16 11:24:03 +01:00
Leah Rowe 662b926630 lbmk: remove "./buildpath mode all"
for example: ./build boot all

the "all" function is a relic from a much older lbmk
design, where for example we might have done:

./build clean all
./download all

this is no longer used, nor is this currently relevant
for the types of scripts present in lbmk.

we can always re-add this function later if needed,
but for now? remove unwanted code.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-16 10:58:04 +01:00
Leah Rowe 4c7343088b lbmk: break up main()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-16 10:56:40 +01:00
Leah Rowe 5f197023db lbmk: always use lbmk_exit for exits
there were certain edge cases where TMPDIR wasn't
being cleaned. this patch will fix that.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-16 10:39:04 +01:00
Leah Rowe 3400e5a12b rel/src: fix multi-line command
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-12 16:25:20 +01:00
Leah Rowe 4df3d09b01 remove ich9utils entries from .gitignore
they are not needed anymore

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-12 14:51:34 +01:00
Leah Rowe 20bf3a19cd Merge pull request 'make clean stm32-vserprog for release' (#130) from Riku_V/lbmk:makeclean into master
Reviewed-on: https://codeberg.org/libreboot/lbmk/pulls/130
2023-09-12 13:50:22 +00:00
Riku Viitanen c3ac62b173 serprog: list available boards
Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
2023-09-12 02:53:23 +03:00
Riku Viitanen 24185bca42 fix typo serprog -> vserprog
Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
2023-09-11 14:42:43 +03:00
Riku Viitanen ccb36aa652 make libopencm3 correctly
Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
2023-09-11 14:35:00 +03:00
Riku Viitanen 5737abf0ed make clean libopencm3
Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
2023-09-11 11:58:16 +03:00
Riku Viitanen 0bed0c35f3 Download libopencm3 before building
Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
2023-09-11 11:39:13 +03:00
Leah Rowe c400916e33 coreboot/hp8200sff_4mb: fix bad ifd path in config
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-11 00:43:25 +01:00
Riku Viitanen 3d77b8a0b9 download and copy serprog related src
Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
2023-09-11 01:08:34 +03:00
Riku Viitanen 7dc8632514 clean up pico-serprog for release
moved cmake files into a separate build directory.
this can just be deleted for the source release.

might as well use cmake for the actual build too.
that makes repeated builds faster for some reason.

Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
2023-09-11 01:01:32 +03:00
Riku Viitanen 34d3629ebf make clean stm32-vserprog for release
Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
2023-09-10 22:52:26 +03:00
Leah Rowe 087f0e066a make lbmk help text actually vaguely helpful
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-10 19:25:22 +01:00
Leah Rowe 093d40eec2 build/release/src: be more thorough deleting .git
a few were missed. nuke all of it from orbit.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-10 17:45:56 +01:00
Leah Rowe 630a65462f build/release/src: delete elf/ in srcdir
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-10 17:23:37 +01:00
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