Commit Graph

299 Commits (2d7e7306ff3213fee6f7a6178d6c135a3a41ec84)

Author SHA1 Message Date
Leah Rowe 2d7e7306ff build/roms: rename more functions for clarity
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01 18:00:53 +00:00
Leah Rowe 62a5f54385 build/roms: rename payload functions for clarity
they are functions that build payloads, so name them as
such. don't call them "dependencies" functions

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01 17:57:35 +00:00
Leah Rowe 042c7877e9 build/roms: simplify seabios dependency check
the update/trees script checks this binary itself, before
deciding whether to recompile/compile, so we don't need
to do such checks here.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01 17:52:23 +00:00
Leah Rowe fcf2b2bb05 build/roms: simplify grub dependency check
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01 17:47:43 +00:00
Leah Rowe 535c9007fd add copyright 2024 leah rowe to edited files
i forgot to add 2024 on the copyright years, for my
copyright files that i edited on 1 january 2024

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01 17:08:38 +00:00
Leah Rowe 48551ced3f git.sh: unify am/submodule and tree copying
do it all in a single function!

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01 15:21:46 +00:00
Leah Rowe e6953dc4f0 git.sh: clean up handling of tmp_git_dir
delete it once once, and delete it much sooner, right
at the start of script/update/trees main()

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01 12:41:43 +00:00
Leah Rowe 5fb6e36f03 update/trees: clean up the coreboot-version check
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-30 20:30:24 +00:00
Leah Rowe 4c9ee172be update/trees: support custom make/autogen argument
this is now used in grub, for the FS_PAYLOAD_MODULES
option in the make command

lbmk should generalise as much logic as possible. in
some parts of it, logic is hurrently hardcoded, specific
to a given project that lbmk uses, but lbmk is essentially
a source-based package manager, like what you might find
on a small linux distro, so we need to try to
be as generic as possible.

lbmk is the "build system of build systems", so it has to
work generically with as many of them as possible

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-30 19:25:26 +00:00
Leah Rowe c6a0e4952e update/trees: generic cmake handling
it is no longer hardcoded just to be handled for uefiextract.

it is now defined as cmakedir in target.cfg, for a single or
multi tree project. if multi tree, it is applied to the specific
tree, and has to be defined per tree

the way it works is: as per cmakelist, a project will define
which directory is to be built, and it will then generate
a makefile in the main source tree (the build tree in cmake
language, where the main CMakeLists.txt file exists)

when the makefile has been generated, the project is then treated
like any other project. the way cmake works, if a makefile has
already been generated by it, in a given directory, running it
again will fail and not affect anything; if it fails but the
makefile doesn't exist, then something is wrong, but if the
makefile does exist, then it's all fine and nothing happens

at present, this is only used for uefiextract, which is part
of src/uefitool

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-30 19:03:03 +00:00
Leah Rowe 30337b8fa5 update/trees: avoid namespace clash in function
the logic of the previous commit was correct, but one
of the functions was named the same as another function
used in this file, causing a namespace conflict, and
a build error

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-30 16:46:49 +00:00
Leah Rowe b061558104 update/trees: dont hardcode autoconf/bootstrap arg
at present, the bootstrap and configure script is only
directly executed for grub, because grub is the only
project that uses them in lbmk

however, when i start adding linuxboot support, i will
have to start building a lot of projects, some of which
make use autoconf and bootstrap scripts

e.g.

./bootstrap --foo
./configure --bar

the "bootstrap" script is often used on GNU programs,
because they like to over-engineer absolutely everything

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-30 16:03:29 +00:00
Leah Rowe eb3a8e2b53 unify script/update/trees and script/build/grub
the script can now also handle autoconf build systems,
whereas this could previously only be done for grub.

with this change, the overall sloccount is also lower

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-30 13:53:45 +00:00
Leah Rowe 34ded35fa6 lbmk scripts: general code cleanup
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-28 16:34:45 +00:00
Leah Rowe bc87b5f67e lbmk scripts: general code cleanup
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-27 17:26:37 +00:00
Leah Rowe 0c1d08d8b1 build/serprog: err if basename fails
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-27 17:20:55 +00:00
Leah Rowe eff9130b7a update/trees: further simplify crossgcc handling
arch no longer needs to be set, on multi-tree projects,
and it has been renamed to xarch

the new behaviour is: if xarch is set, treat it as a
list of crossgcc targets and go through the list. set
the first one as the target, for what lbmk builds, but
build all of the defined crossgccc targets

crossgcc_ada is now xlang, and defines which languages
to build, rather than whether to build gcc-gnat

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-27 16:07:32 +00:00
Leah Rowe 0aca6332ee lbmk scripts: shorter code lines
while seemingly pedantic, this does actually make code
easier to read. mostly just switching to shorthand for
variable names, where no expansions or patterns are used

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-24 09:04:36 +00:00
Leah Rowe b4ab30577f lbmk scripts: general code cleanup
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-24 06:32:19 +00:00
Leah Rowe 38a7aa3196 build/roms: rename two functions for clarity
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-24 06:02:12 +00:00
Leah Rowe 655d3cdc88 lbmk scripts: general code cleanup/optimisation
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-23 17:51:32 +00:00
Leah Rowe a48b3841d7 build/roms: improved error handling for roms
the rom functions print a path to the rom they built,
which is then used, but these are called inside what
are essentially subshells, and we had no error handling

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-23 12:16:14 +00:00
Leah Rowe 33695a56ae build/roms: remove redundant check
cros roms are always using libgfxinit, with a coreboot
framebuffer, so the "normal" initmode is never used.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-23 11:43:36 +00:00
Leah Rowe 9d5d98ebae set version/projectname properly
lbmk used to set version/versiondate directly in
err.sh, but now it's handled there by a function,
which is called by the main script.

script/update/release hadn't yet been adapted. the
only change necessary is to call check_project()

script/update/trees also makes use of it

script/build/roms is using "projectname"

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-23 08:54:45 +00:00
Leah Rowe aa525142aa update/trees: fix infinite loop
when make-all is being executed on a coreboot tree,
the "./vendor download target" command is used, where
target is the tree/board name.

that script then checks whether cbfstool and ifdtool
are built, and if they're not, they then call
./update trees -b coreboot utils bla bla bla

in this scenario, project=coreboot and mode="", meaning
make-all, and the same check that checks whether the
vendor download script should be run, is executed,
which in turn then checks cbutils again

fix the infinite loop by checking whether it was coreboot
utils, as opposed to *firmware*, that is to be built, before
running ./vendor download

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-23 08:34:55 +00:00
Leah Rowe 465077bc4a vendor/download: check whether configs exist first
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-23 07:48:15 +00:00
Leah Rowe 392932797b vendor/inject: fix dodgy error check (cd command)
the x_ function doesn't handle arguments with spaces
well, and this cd command is going to an asterisk, so
it's unknown what the resultant string will be.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-23 07:11:12 +00:00
Leah Rowe f44b99c808 don't delete microcode updates in rom images
at present, lbmk can remove microcode updates on images for
a given target, if the target specifies
microcode_required="n" in target.cfg

lbmk then provides images with microcode, and images without,
in a given release. although the user can also remove them
manually, this just makes it a bit more convenient, for those
users who do wish to run without the updates. this functionality
is provided only on those platforms where no-microcode is tested.

well, this behaviour implements a compromise on libreboot policy,
which is to always include microcode updates by default. see:
Binary Blob Reduction Policy

the *canoeboot* project now exists, developed in parallel with
libreboot, and it ships without microcode updates, on the same
targets where lbmk also handled this.

running without microcode updates is foolish, and should not
be encouraged. clean up lbmk by not providing this kludge.

the libreboot documentation will be updated, telling such users
to try canoeboot instead, or to remove the update from a given
libreboot rom - this is still possible, and mitigations such as
PECI disablement on GM45 are still in place (and will be kept),
so that this continues to work well.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-23 06:59:48 +00:00
Leah Rowe 72cd169ee5 update/release: don't test ./vendor inject
the purpose of script/update/release is not to test the
build system, but to build release archives.

testing of lbmk is done during the course of development.

remove this bloat from the release script. we run the nuke
mode anyway, to scrub blobs from releases, which will more
or less test the logic in that script (the only difference
is that it runs e.g. ifdtool --nuke instead of -i).

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-23 04:41:25 +00:00
Leah Rowe e8eb52f8d7 update/release: don't insert crossgcc tarballs
why are we distributing gcc at all?

the coreboot build system downloads it at build time,
and the GNU rsync mirrors aren't going anywhere.

simplify script/update/release by not handling gcc.
this means: release archives will no longer contain gcc.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-23 04:29:50 +00:00
Leah Rowe b0e5fc9d9c lbmk scripts: general code cleanup
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-23 02:52:30 +00:00
Leah Rowe b111f4840a build/serprog: general code cleanup
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-22 11:53:14 +00:00
Leah Rowe ab65ea4c99 general code cleanup
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-22 10:24:00 +00:00
Leah Rowe 92986f0c42 build/roms: remove modify_coreboot_rom()
don't handle "romtype" at all, in board target.cfg files

add /dev/null as pike2008 rom on amd boards. this serves
the same purpose, adding them as empty vga roms, to add
an empty rom in cbfs. pike2008 cards cause seabios to hang,
when their oproms are executed, so we insert a fake rom

on i945 thinkpads, use the coreboot config option:
CONFIG_INTEL_ADD_TOP_SWAP_BOOTBLOCK

when set, this enables the same bootblock copy, for use
with bucts. these two cases, namely pike2008 roms and
i945 bootblock copies, no longer need to be handled in code

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-21 19:26:22 +00:00
Leah Rowe 95788059ce update/trees crossgcc: call err if arch isn't set
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-21 14:18:56 +00:00
Leah Rowe 90ac30b163 update/trees: simplified crossgcc handling
only call crossgcc for coreboot and u-boot, but use
hostcc for everything else. simplify the checking of
which architecture to compile for. "arch" in target.cfg
files has been modified, to allow further simplification.

without this patch, the logic currently only *barely* avoids
using crossgcc on things like utils, and only works in practise
because, in practise, lbmk only works on x86_64 anyway.

the new logic, as per this patch, is simpler and more robust.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-21 14:18:51 +00:00
Leah Rowe 9c00746ba9 update/release: minor cleanup
remove unnecessary "continue" command. it's written
at the end of a for loop, where it'll continue anyway

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-19 02:45:41 +00:00
Leah Rowe 39a3de574a remove DEBUG handling in lbmk (not needed)
all it did was set -v in the shell, which doesn't yield
very useful results. this is a relic of very old design
in the libreboot build system, that is no longer needed.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-16 07:58:13 +00:00
Leah Rowe 1eb4df6748 fix several shellcheck warnings
lbmk didn't quote certain arguments in commands, or
used ! -z instead of -n, things like that. simple fixes.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-16 07:56:26 +00:00
Leah Rowe 2e779a5495 handle errors on exits from subshells
most of these are probably redundant, and will never
be called, but lbmk needs to be as safe as possible
under fault conditions. fail early, fail hard.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-11 05:21:27 +00:00
Leah Rowe 5af3ae0586 lbmk: don't use status for unconditional returns
in cases where lbmk must always return from a function,
there are some cases where it relies on non-zero exit
status, which in practise is always the case, but may
change in the future if the relevant part is modified

e.g. do_something && return 0

the proper form is:
do_something
return 0

also do this for unconditional exits

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-11-08 06:34:12 +00:00
Leah Rowe 931d646df7 Libreboot 20231106
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-11-06 00:55:49 +00:00
Leah Rowe d5a3abdb80 put docs under docs/ in releases (not src/docs/)
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-11-06 00:04:13 +00:00
Leah Rowe 1f1498be74 Libreboot 20231101
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-11-01 16:36:16 +00:00
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