Commit Graph

405 Commits (master)

Author SHA1 Message Date
Leah Rowe 82bd87fa16 build/roms: re-add SeaGRUB build support
it didn't work in the past, but it does work nowadays;
specifically, it only worked with libgfxinit in the past,
but not on VGA ROMs.

now it does work on VGA ROMs, tested on e6400 and t1650 so
it was enabled there.

in this setup, a special image is provided where SeaBIOS is
the main payload, but it only loads GRUB; nothing else, every.

this is called SeaGRUB. this setup is useful in cases where
the user only has a GPU that lacks libgfxinit support.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-11-01 09:30:16 +00:00
Leah Rowe 65675a200c build/roms: properly print noblobs rom names
when printing the name of the rom being created, it's
done before the check to rename based on vendorfiles
in target.cfg. this patch fixes that bug.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-31 22:04:33 +00:00
Leah Rowe 42fde8e574 update/release: insert fake x201 me.bin
this makes the build work, for releases.

this is not done during regular builds, only releases.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-31 20:13:35 +00:00
Leah Rowe 7e6fd7e5b4 add lenovo x201 support
note: me6_update_parser needs to be written, similar
to me7_update_parser, to generate the partition
tables within intel me6 on lenovo bios updates.

the current logic in lbmk goes like this:
mkdir -p vendorfiles/cache/

and save your factory dump as:
vendorfiles/cache/x201_factory.rom

the build system has been modified, in such a way
as to support extracting me.bin (which is the full
one) and then neutering from this.

this is done automatically, if the file is present,
but you must first insert that file there, which means
you'll need a dump of the original boot flash on your
thinkpad x201

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-29 04:46:25 +00:00
Leah Rowe 5f6ba01d41 include/option.sh: fix i945 bootblock copy
it wasn't being copied right

the roms under elf/ were being copied, but not the ones
under bin/ - i need to audit it further

for now, i run modify_coreboot_roms from build/roms
instead of update/trees

so, the ones under elf/ no longer have bootblocks copied.
it's only done in bin/

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-25 12:58:52 +01:00
Leah Rowe 85bc915684 build/roms: copy base rom again for u-boot
when building only for u-boot, the current script
works just fine. however, when building for other
payloads in additional to u-boot, the final u-boot
stage fails because other payloads are already
inserted via cbfs.

when we build u-boot, we do that last because we want
u-boot setups to only be u-boot, nothing else.

this patch enables qemu x86 to build properly with
u-boot.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-24 00:14:01 +01:00
Leah Rowe e86af9a60a 20231021hotfix: replace x_ with err in some places
keymaps weren't being set in keymay.cfg of cbfs, due
to use of x_ in the rom script, and x_ doesn't handle
quotes or spaces in arguments well.

i'm going to remove use of x_ and xx_ (it's in my todo),
for next release.

for now, hot patch the release. i've gone through and
replaced use of x_ with || err, in some places.

not just the keymap.cfg command, but others too. in case
there are more issues we missed.

this commit is being tagged "20231021fix" and i'm using
this tag to re-build the 20231021 release. i'll just
replace the tarballs in rsync and add errata to the news
page announcing the release. all i did was break peoples
umlauts, i didn't brick their machines fortunately!

very minor bug. anyway, x_/xx_ is a great idea, but sh
isn't really designed for that style of programming. i'll
go back to using just || err in the next release.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-22 12:34:45 +01:00
Leah Rowe 23958f4eae Libreboot 20231021
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-21 02:08:12 +01:00
Leah Rowe 5162b912b2 update/release: clean up temporary crossgcc dir
clean it up after copying the tarballs

i really hate how this logic is written, it's clunky
but it should work; the only issue is that it's quite
slow, and inefficient on use of disk space.

however, i've not yet figured out how to reproducible
add files to a tarball, once the tarball has been created,
and i rely on sorting (of file names) when creating them.

it's really not a problem because normal people won't
use this script, only i or anyone who wants to test out
the libreboot release infrastructure. this script is
largely intended to *work*

but i'm still annoyed by how crappy it is. i'll fix it
after the Libreboot 20231021 release.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-20 21:55:57 +01:00
Leah Rowe c7e764a3f0 update/release: confirm vdir path on exit
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-20 12:09:31 +01:00
Leah Rowe 1c8b2114cc update/release: copy crossgcc to archive
everything downloaded, then tarballed, then built,
now crossgcc is downloaded by coreboot.

now extract, copy crossgcc tarballs, re-compress.

TODO: simply add files to the archive, without re-
compressing the whole thing.

this is still more efficient than the old way: build
everything, then clean and compress, making another
build test on the release archive necessary; with this,
there is still only one build test per release.

with this, and the previous revisions dealing with
submodules, the source archives should now be complete.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-20 12:08:36 +01:00
Leah Rowe 54a05fc167 always re-generate .git in lbmk
in release archives, .git is excluded but the version
and versiondate files are included. from these, the
git history is re-created with the exact date (but not
taking into account timezone, at present).

in this way, lbmk will have git history in a release
archive. some build systems, like coreboot, prefer that
there be git history available, so this is a nice
workaround on those build systems.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-20 11:16:25 +01:00
Leah Rowe 782371a59c update/release: delete *all* .git and .gitmodules
do it using find -exec

this is more robust, and it will never need to be
maintained over time (famous last words).

this is done because now we download submodules
for all git projects, so it's hard to predict.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-20 09:27:27 +01:00
Leah Rowe 31b35bb4ce include/git: fix error caused by sh idiosyncrasy
when [] is used right at the end of a function, or
certain loops/subshells, some sh implementations will
just return a non-zero exit

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-20 09:11:29 +01:00
Leah Rowe 182ee8e416 update/trees: don't run make if mode=fetch
this fixes a regression caused by a previous revision

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-20 08:45:57 +01:00
Leah Rowe 0c32c1d643 update/release .git/*: delete one more level up
it couldn't hurt

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-20 07:44:27 +01:00
Leah Rowe 0375cfaf1c update/release: don't hardcode project names
config/git has been re-arranged in a prior revision,
ensuring that each file only refers to a main source
tree defined within those files.

the erstwhile "./build clean all" functionality is now
once again possible in lbmk

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-20 07:37:51 +01:00
Leah Rowe d245e0b1b4 consistent naming for src/pico-serprog
don't ever name it rpi-pico-serprog

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-20 06:49:59 +01:00
Leah Rowe 6af65ad430 error handling code cleanup and fixes
in some cases, use of x_ or xx_ can be error-prone,
due to the way $@ is handled; commands requiring
quotes, or with funny file names as arguments such
as spaces in the file name, or other special
characters, can make the x/xx functions break.

in those cases, where x/xx must not be used, the
commands use || err instead

in other cases, use of x/xx is superfluous, and has
been removed in some commands.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-20 05:03:16 +01:00
Leah Rowe 4e54a051ef another code cleanup
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-20 03:29:55 +01:00
Leah Rowe 8d9aeef3de lbmk: use 2-level directory structure in script/
as opposed to the current 3-level structure.

recent build system simplifications have enabled
this change, thus:

./build fw coreboot -> ./build roms
./build fw grub -> ./build grub
./build fw serprog -> ./build serprog
./update project release -> ./update release
./update project trees -> ./update trees
./update vendor download -> ./vendor download
./update vendor inject -> ./vendor inject

alper criticised that the commands were too long,
so i made them shorter!

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-20 01:00:38 +01:00
Leah Rowe 0b98c9b00c minor code cleanup in shell scripts
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-19 23:36:56 +01:00
Leah Rowe fc2cab3124 update/release: fix missing variable definition
i forgot to include option.sh in this script,
during previous re-factoring. the cbfstoos variable
is now defined exclusively in option.sh, but other
scripts can set it to something else.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-15 23:33:29 +01:00
Leah Rowe c14461a56b delete include/vendor.sh and merge elsewhere
move it all to other files where items are used, and not
used anywhere else. this reduces the size of vendor.sh.

also remove a few redundant variables, or variables that
are not meaningfully used.

a few items have been moved to include/option.sh

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-15 13:00:14 +01:00
Leah Rowe d8c2c24507 vendor.sh: move some functions to vendor/download
they are the functions only used by the download
script, so they don't belong in vendor.sh

an include file should only contain variables and
functions used by multiple main scripts

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-15 10:01:16 +01:00
Alper Nebi Yasak 4d9567a756 coreboot: gru: Use default coreboot tree
We don't really need a custom coreboot tree for Chromebooks. I had added
one, because at a cursory glance to the available config/coreboot/board
subdirectories I had the impression that I should. But upstreams have
one tree for every board and I think we should move towards that too.

Move the one important BL31 makefile patch into the default coreboot
patches, update the gru boards' configs by running savedefconfig in the
cros tree and then running olddefconfig in the default tree.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2023-10-14 17:34:42 +03:00
Alper Nebi Yasak b2d84213da update/project/trees: Add flags for more kconfig actions
Add an "-s" flag for "make savedefconfig", "-l" for "make olddefconfig"
and "-n" for "make nconfig" to the update script. The first two are
mainly useful for U-Boot, to compare our configs to the upstream
defconfigs and stay in sync with any upstream changes. The latter is
because the ncurses one has a nice "Symbol Search" that can point out
the menu entry for a config symbol we know.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2023-10-14 16:48:41 +03:00
Alper Nebi Yasak eb267733fa build/fw/coreboot: Fix misuse of raw u-boot.bin as payload
The "u-boot.bin" file generated by U-Boot builds is a raw binary. When
adding payloads to a CBFS, we need to use ELF files with add-payload
or manually pass the entry point and load address of the payload binary
with add-flat-binary.

We primarily use the "u-boot.elf" which gets build with the REMAKE_ELF
option, as it also has the necessary device-tree binary that U-Boot
usually needs to work. When the option is not set (e.g. for QEMU), we
need to use the "u-boot" file which is an ELF.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2023-10-14 16:48:41 +03:00
Leah Rowe 19f1e0083d vendor/inject: only build nvmutil if required
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-14 08:57:11 +01:00
Leah Rowe 3f8636ff67 vendor/inject: simplified file handling
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-14 08:55:48 +01:00
Leah Rowe 7b741dd062 update/release: remove unused variables
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-14 05:30:54 +01:00
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
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 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 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 3738ec90ec update/project/*: unified patch handling
Handle patches by a function at include/git.sh

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-25 11:49:13 +01:00
Leah Rowe cd3225d845 update/project/trees: remove extra.sh handling
This functionality has never been used, except in the
erstwhile osboot project, and even then only experimentally.

It was intended for use with coreboot's gerrit site, but
it became Libreboot project policy that this not be relied
upon, instead preferring to include patches directly within
lbmk. This functionality can be re-added, if necessary.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-25 10:57:10 +01:00
Leah Rowe 42c9d7d28c build/grub/*: move common strings to variables
also general cleanup of these scripts

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-25 03:06:43 +01:00
Leah Rowe e94ba1f7c0 build/grub/payload: split up main()
also: the grub-mkstandalone command didn't have
a || at the end, even though it did specify an err
call. This has been corrected, so that the command
now defers to err() under fault conditions.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-25 02:57:45 +01:00
Leah Rowe 208620198c Update email address for Leah Rowe copyrights
also, some of them were out of date; years now updated.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-25 02:27:26 +01:00
Leah Rowe cc1642096e Use SPDX license headers on all scripts
This results in much cleaner copyright and license declarations.
SPDX headers are legally recognised and make auditing easier.

Also, remove descriptions of each script, from each script.
Libreboot documentation at docs/maintain/ describes them.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-25 02:19:48 +01:00
Leah Rowe a7b767a47b update/repos: concatenate multiple revision files
With this change, it's still possible to have a single
file at config/git/revisions, but this has been scrapped.

Instead, multiple files now exist under config/git/ with
the same modules declared, but the files are separated
logically. List of files under config/git:

* bios_extract
* biosutilities
* coreboot
* flashrom
* grub (gnulib also defined here)
* me_cleaner
* memtest86plus
* seabios
* serprog (multiple projects defined)
* u-boot
* uefitool

The rationale behind this change is simple: in the future,
we will stop relying on build systems within imported
projects for the import of git submodules. Instead, we
will handle them directly in lbmk.

Additionally, a Linux payload is planned for Libreboot, made
easier by the recent audit (script handle/make/config makes
it easy to integrate Linux, and handle cross-compilers for
userland utilities); a "linux" file under config/git/ could
also define rules for each project besides linux, such as
musl libc, busybox and other utilities.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-25 00:51:03 +01:00
Leah Rowe 7966f9111d handle/make/config: run fail() on error, not err()
This was an oversight, during a previous audit.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-24 18:57:01 +01: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 3400e5a12b rel/src: fix multi-line command
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-12 16:25:20 +01: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 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 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 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 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 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
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