Commit Graph

1523 Commits (master)

Author SHA1 Message Date
Leah Rowe 8f3d3eada9 re-use crossgcc builds on the coreboot trees
don't build crossgcc twice, especially if two coreboot
trees use the same revision!

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-21 06:26:23 +00:00
Leah Rowe 8a9c70f2f6 allow multitree projects to define xgcc tree
let them specific it, rather than falling back
to coreboot/default (can also be used for coreboot boards)

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-21 05:59:37 +00:00
Leah Rowe c6d243af93 u-boot: don't define xarch in default
it's only needed for each board

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-21 05:55:54 +00:00
Leah Rowe 9877eb0968 coreboot/*/target.cfg: don't define xarch
it's defined per board

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-21 05:52:32 +00:00
Leah Rowe e329b365db grub/target.cfg: move --disable-werror
i meant to push it in configure args, not bootstrap

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-21 05:43:11 +00:00
Leah Rowe b71d4fd016 coreboot/fam15h: disable -Werror on binutils 2.32
work around newer build issues, on very bleeding edge distros

(disable treating warnings as errors)

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-21 00:20:51 +00:00
Leah Rowe 1d971fcdc9 grub: use --disable-werror on ./configure
work around build issues on very bleeding edge distros

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-21 00:18:35 +00:00
Leah Rowe 33e25a3355 dependencies/arch: add pandoc to dependencies
pandoc is required by the grub build system, when
running autoconf at the start of the build process

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-20 18:54:53 +00:00
Leah Rowe 37817e6bcb GRUB: insert only 1 keymap per board, in cbfs
There is no need to add multiple keymap files, because
GRUB can load keymaps from CBFS. The current build logic
is designed to avoid building multiple GRUB binaries,
which are expensive computationally because each one
would then have to be compressed for each board.

This patch provides the best of both worlds: less space
used in flash like in the old lbmk design (1 keymap per
board), but retaining the current build speeds and therefore
not re-introducing the slowness of lbmk's previous GRUB
build logic.

The grub.cfg file has been modified, accordingly. It now
only loads a keymap.gkb file from CBFS, by default. It does
this, only if that file exists; if not, GRUB already defaults
to US Qwerty layout anyway.

ALSO: compress all keymap gkb files with xz -6

GRUB automatically decompresses files when accessed.
This results in about 2KB of flash space saved in CBFS.

Here is real-world data, showing the increased flash space:

< fallback/payload               0x3eb80    simple elf     548821 none
< keymap.cfg                     0xc4bc0    raw                16 none
< (empty)                        0xc4c00    null         11633316 none
---
> fallback/payload               0x3eb80    simple elf     546787 none
> keymap.gkb                     0xc43c0    raw               344 none
> (empty)                        0xc4540    null         11635044 none

This was taken by diffing the cbfstool "print" output,
both before and after. The *after* result is with this change.
11633316. In this example, 1728 bytes have been saved. Therefore,
with compression taken into account, this patch saves about 1.7KB
of space in CBFS.

This change means that lbmk can now scale to support hundreds
of keymaps, without increasing the amount of flash space used,
in each given image. Since the keymap files are compressed in
lbmk.git, in advance, we spend no additional time on compression
at build time. The resulting change in build speed in negligible.

Adding your own keymap.gkb file was already possible, for changing
the keymap in libreboot images, if you didn't want to change the
memdisk (and thus re-compile grub.elf). Now, this is the default
behaviour, and the only way to do it. It's much more efficient.

The original keymap files can be restored, by running unxz.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-18 00:27:33 +00:00
Leah Rowe df007d22ec build/roms: err if -k layout doesn't exist
if the user defines a layout that doesn't exist, throw
an error in lbmk.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-17 23:22:22 +00:00
Leah Rowe d44c9551c5 build/roms: regression fix: uninitialised variable
the "kmapdir" variable was removed in an earlier audit,
but was overlooked for -k because that option was untested.

rather than initialise the variable, re-use grubcfgsdir.
this fix enables e.g. "-k usdvorak" to work again.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-17 19:32:54 +00:00
Leah Rowe 2b6beaf2f9 Merge pull request 'config/dependencies/trisquel: replaced package from ttf-unifont to fonts-unifont' (#177) from goodspeed/lbmk:master into master
Reviewed-on: https://codeberg.org/libreboot/lbmk/pulls/177
2024-01-14 12:01:36 +00:00
William Goodspeed 59096d8d7c config/dependencies/trisquel: replaced package from ttf-unifont to fonts-unifont
ttf-unifont no longer exists on trisquel aramo.
---
Package: fonts-unifont
Breaks: ttf-unifont (<< 1:13.0.02-1)
Replaces: ttf-unifont (<< 1:13.0.02-1)
---
Signed-off-by: William Goodspeed <goodspeed@anche.no>
2024-01-14 14:12:12 +08:00
Leah Rowe 09bed9a4c3 REMOVE MAINBOARD: lenovo x201
with neutered ME, fan control fails. while there are
ways to mitigate it, many users will not, and will
likely see their system overheat, which is very
dangerous.

this bug (failed fan control on neutered ME) only
affects arrandale machines such as lenovo x201.
the newer machines are not affected by this.

other arrandale machines will probably not be added
to libreboot because of this, or they will be subject
to further testing.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-12 16:08:56 +00:00
Leah Rowe 401c0882aa NEW MAINBOARD: HP EliteBook 820 G2
This is of Broadwell platform, one generation above Haswell.

Of note: this uses HP Sure Start. Although the flash is 16MB,
our CBFS section (and IFD configuration) assumes 12MB flash,
so the final 4MB will be left unflashed on installation,
after blanking the private flash. The coreboot documents have
more information about this.

Some minor design changes in lbmk were made, to accomodate
this port:

Support for extracting refcode binaries added (pulled from
Google recovery images). The refcode file is an ELF that
initialises the MRC and the PCH. It is also responsible for
enabling or disabling the Intel GbE device, where Google
does not enable it, but lbmk modifies it per the instructions
on the coreboot documentation, so as to enable Intel GbE.

Google's recovery image stores the refcode as a stage file,
but coreboot changed the format (for CBFS files) after 4.13
so coreboot 4.13's cbfstool is used to extract refcode. This
realisation made me also change the script logic to use a
cbfstool and ifdtool version matching the coreboot tree, for
all parts of lbmk, whereas lbmk previously used only the
default tree for cbfstool/ifdtool, on insertion and deletion
of vendor files - it was 81dc20e744 that broke extraction of
refcode on google's recovery images, where google used an older
version of cbfstool to insert the files in their coreboot ROMs.
A further backported patch has been added, copying coreboot
revision f22f408956 which is a build fix from Nico Huber.

Iru Cai submitted an ACPI bugfix after the revision lbmk
currently uses, for coreboot/default, and this fix is
needed for rebooting to work on Linux 6.1 or higher. This
patch has been backported to lbmk, while it still uses the
same October 2023 revision of coreboot.

Broadwell MRC is inserted at the same offset as Haswell,
so I didn't need to tweak that.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-10 00:50:29 +00:00
Leah Rowe a8a7a51b9b Merge pull request 'Dell-flash-unlock README updates' (#175) from nic3-14159/lbmk:dell-flash-unlock-updates into master
Reviewed-on: https://codeberg.org/libreboot/lbmk/pulls/175
2024-01-06 11:05:35 +00:00
Nicholas Chin bdd32a5c7f
README.md: Add Latitude E7270 as supported
Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
2024-01-05 14:53:33 -07:00
Nicholas Chin 051b17f4fe
README.md: Add notes about iopl and AC adapter requirement
In order for the EC to maintain the state of whether or not to set the
flash descriptor override across a power cycle, the AC adapter must be
connected, as the system leaves the voltage rail that the EC uses
powered under this condition. Without this, the utility may fail,
continually asking the user to power off and on.

On Linux, CONFIG_X86_IOPL_IOPERM must be set for the kernel, or else the
iopl call will error with "Function not implemented". Make a note of
this in case a user runs into this issue.

Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
2024-01-05 14:48:38 -07:00
Nicholas Chin d2de03cefa
README.md: List E6520, E5530, and M4800 as supported
Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
2024-01-05 14:48:37 -07:00
Leah Rowe f5b04fa505 build/roms: tidy up payload configuration handling
the eval for loop is overkill

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01 22:36:55 +00:00
Leah Rowe 0b08121829 build/roms: remove unused variable
the kmapdir variable is only used once, and just
the string makes it obvious what this is for

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01 22:36:49 +00:00
Leah Rowe 4870e84e71 build/roms: don't needlessly re-build grub.elf
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01 22:36:43 +00:00
Leah Rowe 0e955f1e70 build/roms: create elf/grub if non-existent
i overlooked this during previous re-factoring

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01 19:09:45 +00:00
Leah Rowe 3b66a5bbfb git.cfg: simplified revision checking
it only needs to be checked before git reset

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01 19:07:37 +00:00
Leah Rowe a7f58abb5a fix oversight in previous commit
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01 18:08:05 +00:00
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 cea88fa827 git.sh: simplify submodule handling in git_prep
u-boot doesn't use submodules, so there's no point in
checking for it. now we can do with just one call to
the git submodule command, for simplicity

also, general code cleanup in this file (minor code
formatting improvements)

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01 16:47:16 +00:00
Leah Rowe 1fcbadb8da git.sh: further simplify git_prep
the directory is checked for deletion, but it's already
checked before download, to see whether it already exists.
lbmk already exits with zero status if the directory exists,
so the check is pointless (in this function)

also, general code style/formatting cleanup

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01 15:27:01 +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 ce67c99f40 git.sh cleanup: git am handling (remove patchfail)
the patchfail variable was only needed in the old design,
where git am was being handled inside a subshell, and
also when we did it directly in the target directory
without using a temporary directory. with the current
design, we can just call err() and ditch the tmp repo

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01 14:32:37 +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 d819403a0b git.sh: fix regression: patches before submodulse
there isn't really a problem right now, but a desired
and implemented behavioural change was that patches are
to be applied *before* updating submodules. well, the
previous commit reversed this change, under certain
conditions, such that submodules were applied first.
this patch fixes it, so that patches are done first.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01 11:06:06 +00:00
Leah Rowe f4a14bd908 git.sh: clean up git submodule/am handling
unify all of the logic, where git am and submodule is handled

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-01 10:48:58 +00:00
Leah Rowe 11a821637d Bump GRUB to 2.12 release
Actually, it's 2 commits after 2.12, because there was a
patch added afterwards, fixing a build issue on Gentoo.

These changes are present in GRUB 2.12, relative to the
revision that we previously used on lbmk:

* b835601c7 build: Include grub-core/extra_deps.lst in dist
* 8961305b4 Bump version to 2.13
* 5ca9db22e Release 2.12
* 477a0dbd5 efi: Add support for reproducible builds
* dcc1af5d6 efi: Generate stack protector canary at build time if urandom is available
* e424e945c efi: Initialize canary to non-zero value
* 7c8ae7dcb gfxmenu/gui_image: Fix double free of bitmap
* 63fc253fc commands/acpi: Fix calculation of ACPI tables addresses when processing RSDT and XSDT
* f20123072 libnvpair: Support prefixed nvlist symbol names as found on NetBSD
* a13df3d15 bootstrap: Don't check gettext version
* 6d2aa7ee0 kern/mm: Use %x and cast for displaying sizeof()
* b3d49a697 configure: Add RPATH for freetype on NetBSD
* 52dbf66ea configure: Add *BSD font paths
* 2d6a89980 autogen: Accept python3.10 as a python alternative
* 3d4cb5a43 build: Rename HAVE_LIBZFS to USE_LIBZFS
* e4dbe5cfa gnulib: Tolerate always_inline attribute being ignored
* 31e47cfe2 util/editenv: Don't use %m formatter
* f5905f656 osdep/bsd/hostdisk: Fix NetBSD compilation
* cb1824a87 osdep/generic/blocklist: Fix compilation
* 2f3faf02c disk/diskfilter: Remove unused variable
* 3815acc57 build: Tolerate unused-but-set in generated lexer/bison files
* c129e44e7 loader/i386/bsdXX: Fix loading after unaligned module
* 89fbe0cac grub-core/Makefile.am: Make path to extra_deps.lst relative to $(top_srcdir)/grub-core
* 353beb80c util/grub-install: Move platdir path canonicalization after files were copied to grubdir
* f18a899ab util/grub-mkstandalone: Ensure deterministic tar file creation by sorting contents
* ed74bc376 util/grub-mkstandalone: Ensure stable timestamps for generated images
* 069cc46c9 net/http: Fix gcc-13 errors relating to type signedness
* e7a831963 templates: Reinstate unused version comparison functions with warning
* 3f9eace2d util/grub-install: Delay copying files to {grubdir,platdir} after install_device was validated
* e60015f57 efi: Set shim_lock_enabled even if validation is disabled
* e35683317 docs: Improve bli module documentation
* 57059ccb6 bli: Add explicit dependency on the part_gpt module
* 154dcb1ae build: Allow explicit module dependencies
* 17c68472d kern/ieee1275/init/ppc64: Display upper_mem_limit when debugging
* 5f8e091b6 kern/ieee1275/init/ppc64: Fix a comment
* dc569b077 kern/ieee1275/ieee1275: Display successful memory claims when debugging
* 0ac3d938a loader/powerpc/ieee1275: Use new allocation function for kernel and initrd
* 2a9a8518e kern/ieee1275/cmain/ppc64: Introduce flags to identify KVM and PowerVM
* 679691a13 kern/ieee1275/init/ppc64: Rename regions_claim() to grub_regions_claim()
* d49e86db2 kern/ieee1275/init/ppc64: Add support for alignment requirements
* fe5d5e857 kern/ieee1275/init/ppc64: Return allocated address using context
* ea2c93484 kern/ieee1275/init/ppc64: Decide by request whether to initialize region
* 0bb59fa9a kern/ieee1275/init/ppc64: Introduce a request for regions_claim()
* aa7c13226 fs/xfs: Add large extent counters incompat feature support

Most notable in the above log, that are beneficial to Libreboot
users, are:

aa7c13226 which improves XFS support (large extents), which is default
now on many setups.

ed74bc376 which introduces more stable timestamp generation when using
grub-mkstandalone. this is what lbmk uses to generate grub.elf, whereas
grub previously only implemented this fix on mkimage which we don't use

f18a899ab which ensures deterministic (reproducible) tar file creation
by sorting contents (file names / directories). this is done by sorting
the entries

f5905f656 which improves grub build system reliability on netbsd and
openbsd systems - useful for us because an ambition of lbmk is to port
the build system to run on bsd systems, and we will still want grub -
several other of the changes here are beneficial for BSD aswell, all
or most of them by Vladimir Serbinenko

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-31 19:57:30 +00:00
Leah Rowe f3098f566c git.sh multi-tree: grab submodules *after* patches
right now, if we want to patch a project such that certain
submodules are no tdownloaded, or diffreent submodules are
downloaded, or current ones are downloaded from other
locations, we cannot do this, because we apply submodule
updates *before* applying patches.

therefore, we should change it so that they are applied
*after* installing patches.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-30 20:30:49 +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 4e06779948 disable u-boot on x86 qemu
it's not well-tested and currently doesn't build

this is for later

remove for now

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-28 14:48:31 +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