Commit Graph

63 Commits

Author SHA1 Message Date
Leah Rowe d147c5d915 rename include/option.sh to include/lib.sh
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-26 12:11:40 +01:00
Leah Rowe f534b0e973 merge nuke() back into git.sh
as stated in the previous commit, i'm adding this function
to lbmk because there are files i want to systematically
delete in libreboot releases, not just canoeboot releases,
but libreboot releases delete things such as unlicensed
readme files, or poorly licensed other files.

i initially moved the nuke function to its own file so as
to reduce the number of merge conflicts when merging
changes to git.sh between cbmk and lbmk, but if they're
going to both contain this file, then it makes sense
to have this in git.sh once again.

Signed-off-by: Leah Rowe <info@minifree.org>
2024-05-26 09:37:28 +01:00
Leah Rowe a02b152f44 rename nukeblobs to a more generic name
blobs.list is now nuke.list

this is because i'm going to import this functionality
into lbmk (libreboot build system).

libreboot will not do full deblobbing like canoeboot does,
but there are still certain files that i like to delete
in releases, such as u-boot's strlcat.c file under tests

calling it "nukeblobs" in libreboot makes no sense, but
i like to avoid merge conflicts when cherry-picking
patches between cbmk and lbmk, so i like to make sure
that functions and variables common to both are named
the name.

simply calling it "nuke" or calling the files "nuke.list"
is probably inoffensive while conveying the same meaning.

Signed-off-by: Leah Rowe <info@minifree.org>
2024-05-26 09:33:27 +01:00
Leah Rowe dc487df12f git.sh: remove errant whitespace
Signed-off-by: Leah Rowe <info@minifree.org>
2024-05-26 08:24:33 +01:00
Leah Rowe cbb2f4f8a9 general code cleanup in the build system
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-26 08:14:23 +01:00
Leah Rowe 84ee6a1ed8 option.sh: fix bad check for version/versiondate
i was checking whether it's a directory, whereas i should
have been checking whether it's a file. this is a workaround
put in place in case someone downloaded a tarball from codeberg
which is pre-generated per commit. in this situation, the
version and versiondate files do not exist, but the design
of the build system requires that they do exist.

the existing check is correct except for this bug, so fix
the bug. check that they are files, not directories

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-25 14:39:35 +01:00
Leah Rowe 27f21c32d3 git.sh: break if a submodule clone succeeds
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-25 11:44:13 +01:00
Leah Rowe b5aa8b2d35 git.sh: allow finer control of git submodules
in each submodule configuration directory, a module.cfg
file can now be provided. in it, the user can specify
two repository links (main and backup) and a revision, like
so:

subrepo="repo link goes here"
subrepo_bkup="backup repo link goes here"
subrev="git revision id goes here"

additionally:

in the *main* project directory for the submodules,
a module.list file can be provided. example entries:

3rdparty/vboot
3rdparty/libgfxinit

if the module.list file is provided, only those submodules
will be downloaded. this can be combined with the module.cfg
files, if you wish, but it's optional. you can mix and match.

example locations:

multi-tree project:
config/submodule/coreboot/default/module.list
config/submodule/coreboot/default/vboot/module.cfg
single-tree project:
config/submodule/flashprog/module.list
config/submodule/flashprog/foo/module.cfg

*no* configuration files have been provided, in this commit,
which means that the current behaviour is maintained.

follow-up commits will absolutely configure the submodules.
this is being done to reduce the number of modules downloaded,
because we don't use most of the coreboot submodules that are
downloaded, thus wasting bandwidth and the releases are also
much bigger than necessary.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-25 11:39:50 +01:00
Leah Rowe 31e089aff3 option.sh: generate version file if .git not found
a user was getting error "version unset" when using the
tarball generated from codeberg. it's recommended to use
the git repository properly, or a release archive.

mitigate this so that the build succeeds anyway.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-25 11:37:56 +01:00
Leah Rowe 2b0e71412e git.sh: move repo copying to a new function
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-25 11:37:35 +01:00
Leah Rowe d71c4d326e git.sh: move link_crossgcc to end of file
link_crossgcc is called after git_am_patches, so
put it after ward

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-25 11:37:18 +01:00
Leah Rowe 0d7c249c9b move deblob function to new file "deblob.sh"
i'm importing some changes from lbmk and they go at the
end of git.sh, in the diffs. moving the deblob function
to its own file will allow me to cherry-pick with fewer
merge conflicts.

Signed-off-by: Leah Rowe <info@minifree.org>
2024-05-25 11:35:50 +01:00
Leah Rowe 1300f09e67 git.sh: move xgcc linking to a new function
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-22 18:51:25 +01:00
Leah Rowe 24934e6569 git.sh: don't include --checkout in submodules
this is an oversight in the last few commits.

canoeboot must not use --checkout, because doing so
would download blob repositories from coreboot.org

by only including "--init" in the submodule command,
coreboot's build system skips almost all blobs.

(and then canoeboot deletes any remaining stragglers)

Signed-off-by: Leah Rowe <info@minifree.org>
2024-05-22 18:15:03 +01:00
Leah Rowe 5e0129eb0f git.sh: skip submodules if .gitmodules missing
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-22 18:09:29 +01:00
Leah Rowe 7f82622caf git.sh: merge patch_submodules in prep_submodules
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-22 18:09:19 +01:00
Leah Rowe 9c0a7f14fc git.sh: split submodule handling to new function
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-22 18:09:12 +01:00
Leah Rowe b593127795 git.sh: remove errant line break
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-22 16:48:38 +01:00
Leah Rowe 19f694bf2a git.sh: remove another meaningless check
again, the directory in question is simply used
in a for loop using asterisk (git_am_patches) and
the for loop simply won't iterate if either the
directory doesn't exist or it contains no items.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-22 16:48:32 +01:00
Leah Rowe 71a9fcced8 git.sh: shorter variable names
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-22 16:48:26 +01:00
Leah Rowe 6693588857 git.sh: remove meaningless check
in the function that immediately follows, it
starts two for loops that check every item in
that directory, using the asterisk wildcard.

if the directory does not exist, then the for
loop will simply break on first pass.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-22 16:48:20 +01:00
Leah Rowe 5c459ad4ac git.sh: remove variable not meaningfully used
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-22 16:48:14 +01:00
Leah Rowe 58f6741fb4 git.sh: fix invalid command in git_prep()
"./update project trees" is a leftover from the
old build system design, prior to audits.

this particular call is for when xtree is defined,
which means that a given tree must rely on the given
coreboot tree defined by xtree. the "xtree" tree is
downloaded, so that its crossgcc builds can be re-used
to save time when building targets across many trees.

this is because trees often use identical crossgcc builds.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-21 18:25:30 +01:00
Leah Rowe 849466c0ac git.sh: allow patching submodules
for single-tree project (e.g. flashprog):
config/submodule/PROJECT/MODNAME/patches

for multi-tree project (e.g. coreboot):
config/submodule/PROJECT/TREE/MODNAME/patches

MODNAME is e.g.:
3rdparty/vboot directory in coreboot: would become vboot
(the submodule codepath is filtered to up to the final slash)

another example:
submodire src dir 3rdparty/foo/bar
MODNAME would be "bar"

Add whatever patches you like to a given submodule.

An example patch is included in this commit.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-20 00:28:46 +01:00
Leah Rowe 8d4d063ace git.sh: don't delete .git if src/project/project
otherwise, "./update release" will epicly fail

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-20 00:28:00 +01:00
Leah Rowe 10ecf41ee0 git.sh: remove fetch_from_upstream()
the function is very small and only called once,
from fetch_project_trees()

merge it into fetch_project_trees()

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-19 08:16:48 +01:00
Leah Rowe ddcb793bd2 option.sh: don't return 1 in mkrom_tarball
one of the calling functions relies on the return value
to be always 0, so these error conditions in mkrom_tarball
have been altered to cause an *exit* (non-zero) instead.

in practise, the commands in question were printf commands
run after tho directory they output to had been created,
so write access would probably not be an issue.

nonetheless, technically correct is the best kind of correct.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-19 06:53:20 +01:00
Leah Rowe ae8637b620 option.sh: mktar_release to mkrom_tarball
that's all it's used for, to compress the rom images

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-19 06:47:39 +01:00
Leah Rowe a243dc2308 option.sh: err if config directory is missing
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-18 22:20:48 +01:00
Leah Rowe c28166ff9e option.sh: print the config filename being checked
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-18 22:19:53 +01:00
Leah Rowe 9fd504e24a git.sh: Remove .git if XBMK_RELEASE=y
The build system already deletes .git in all source
directories for each given release, but does so at
the very end; it still does, but now it is deleted
one by one per project, to save space during very
large builds (release sizes vary wildly, depending
on how many trees exist for coreboot basically).

If you're building entirely in tmpfs (as I do), this
could be a problem if you have lots of .git/ directories.

This change reduces disk usage, or in the above example,
memory usage when running the build system from tmpfs.

This complements another recent change, where ROM images
are compressed per target during release builds, rather
than all at the very end of the process. It is part of a
series of optimisations, to reduce the memory and disk
usage of the build system, and to reduce I/O wastage
in general.

This change will not be the last of such changes!

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-18 04:57:47 +01:00
Leah Rowe 3e5db248dd cbmk: allow easier sync with lbmk
an equivalent change has been made in lbmk.

certain cbmk-specific variable names have been made
generic, with certain functions and other variables
moved around.

i maintain sync between libreboot and canoeboot, where
both projects can have the same behaviours, and most of
the merge conflicts have to do with variable names
containing "LBMK", "lbmk", "cbmk" or "CBMK", or
indeed "canoeboot" and "libreboot"

LBMK/lbmk/CBMK/cbmk variables between canoeboot and
libreboot now contain the string XBMK/xbmk

it should now be *much* easier to merge build system
changes between lbmk and cbmk.

Signed-off-by: Leah Rowe <info@minifree.org>
2024-05-16 03:59:23 +01:00
Leah Rowe 23854de888 option.sh: delete check_git()
it's only used from main() in the main build script,
and it's very small, as is main()

therefore, move the logic into main()

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-15 07:54:24 +01:00
Leah Rowe 0794127986 remove check_project() (always set variables)
in cbmk, we call check_project() to set variables
such as projectname, version, version date

this is unnecessary, because all main scripts use
this functionality anyway

do it by default

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-15 07:49:55 +01:00
Leah Rowe 21436c6a8f build/roms: create full release tarball name
set relname from option.sh under check_project()

now the release logic simply has to move a directory

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-15 07:40:53 +01:00
Leah Rowe 90c528032b option.sh: don't bother checking for GNU tar
releases aren't reproducible anyway. we were
using options available in gnu tar for this.

it will be revisited at a later date. however, the next
time this is done, we will use another method because
there are in fact portable ways to create tarballs
reproducibly, documented on reproducible-builds.org

to be revisited, at a later date. for now, remove bloat.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-15 07:38:02 +01:00
Leah Rowe 422d36a07c option.sh: remove insert_version_files()
it's only called once, from this file, within a small
function, and the function itself is very small.

remove, and put the contents of the function in the
calling function.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-15 07:36:55 +01:00
Leah Rowe a0ea7f7a92 unified sha512sum creation for tarballs
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-15 07:34:47 +01:00
Leah Rowe 09fcc343a3 move rom tarball creation to script/roms
export CBMK_RELEASE="y"

if this is done, the tarball is created instead
of a directory, and the rom images are nuked using
./vendor inject with the nuke option, inserting the
correct version files; the rom directory is deleted

now the release script logic simple renames existing
tarballs. the benefit of this change is fewer lines of
code, and now cbmk doesn't use an insane amount of disk
space when building a *lot* of release images (the
uncompressed directories are deleted after each build)

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-15 07:27:20 +01:00
Leah Rowe d423421995 remove all status checks. only handle release.
the release variable is all we need, turning a target on
or off for a given release.

the status checks were prone to bugs, and unnecessary; it
also broke certain benchmark scripts.

it's better to keep the cbmk logic simpler. board status
will be moved to the documentation instead.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-13 02:07:22 +01:00
Leah Rowe 4826364afb git.sh: remove errant comment
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-13 01:57:46 +01:00
Leah Rowe da748de455 merge include/err.sh with include/option.sh
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-10 05:25:23 +01:00
Leah Rowe 3acac46536 err.sh: correct copyright info
i replaced 2022, 2023 with 2022, 2024 when updating
the years, as per modifications, but the 2023 copyright
doesn't become invalidated

change it to 2022-2024 instead, which is correct

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-10 05:20:02 +01:00
Leah Rowe 029e30bfbc err.sh: update copyright info
i added a few changes during this year so far, 2024

update the copyright years

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-04 10:20:30 +01:00
Leah Rowe 8ddb1c7885 git.sh fix: only download submodules for coreboot
In practise, both cbmk and lbmk only need coreboot submodules,
but the pico sources download them too, and some of them may
not be FSDG compatible.

So, this change will be Canoeboot-specific, and only download
submodules for coreboot as a result.

The required submodules are defined already in config/git,
so pico-serprog and stm32-vserprog will work just fine.

To be sure: this patch restores behaviour from Canoeboot at
release 20231107. Canoeboot inherited some improvements from
lbmk and I forgot to adapt the code for this. This behaviour
is intentional, as part of Canoeboot's design.

Signed-off-by: Leah Rowe <info@minifree.org>
2024-05-03 15:53:48 +01:00
Leah Rowe 57a63343fb Update coreboot to LB 20240504 (sync lbmk cd9685d1)
With other recent changes, and this patch, Canoeboot is now
in sync with Libreboot lbmk, commit:
cd9685d12d2b71a00cb6766bb85f392d4db92c83

This is with updated deblobbing, and Canoeboot's no-microcode
patches, that disable microcode updates universally.

Several patches from lbmk (for coreboot) aren't needed,
due to being for boards that Canoeboot does not use, so
those patches have been somewhat rebased, and configs
adapted, but this is otherwise identical.

As in previous Canoeboot updates, I've turned off this
option in all coreboot configs:
CONFIG_USE_BLOBS

Turning off that option prevents the coreboot build system
from ever attempting to use any blobs, but in practise it
would not have done so anyway, because Canoeboot disables
all handling of microcode in the build system.

Signed-off-by: Leah Rowe <info@minifree.org>
2024-05-03 05:59:00 +01:00
Leah Rowe 3aa148aa2e build/roms: simplified status handling
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-03 01:27:37 +01:00
Leah Rowe 45ac5f1741 option.sh: don't use nproc (not portable)
export CBMK_THREADS=x

where x is an integer. this is already supported for
setting the number of build threads, but if not set
it uses nproc.

openbsd doesn't have nproc. default to 1 thread.

now you MUST set threads. e.g. in linux do:

export CBMK_THREADS=$(nproc)

preliminary work is being done to make cbmk run
on openbsd!

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-03 01:19:00 +01:00
Leah Rowe c7513ce31c allow disabling status checks during builds
export CBMK_STATUS=n

if not set, the status checks and confirmation dialogs
persist. if set to y they persist.

if you set it to n, all checks are disabled, so e.g.:

./build roms all

this would once again build all targets, regardless
of status. this is if you want the old behaviour.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-03 01:03:02 +01:00
Leah Rowe b56f79578a build/roms: report status when building images
export CBMK_VERSION_TYPE=x
x can be: stable, unstable

in target.cfg files, specify:
status=x
x can be: stable, unstable, broken, untested
if unset, cbmk defaults to "unknown"

if CBMK_VERSION_TYPE is set, no confirmation is asked
if the given target matches what's set (but what's set
in that environmental variable can only be stable or
unstable)

if CBMK_RELEASE="y", no confirmation is asked, unless
the target is something other than stable/unstable

"unstable" means it works, but has a few non-breaking
bugs, e.g. broken s3 on dell e6400

whereas, if raminit regularly fails or it is so absolutely
unreliable as to be unusable, then the board should be
declared "broken"

untested means: it has not been tested

With this change, it should now be easier to track whether
a given board is tested, in preparation for releases. When
working on trees/boards, status can be set for targets.

Also: in the board directory, you can add a "warn.txt" file
which will display a message. For example, if a board has a
particular quirk to watch out for, write that there. The message
will be printed during the build process, to stdout.

If status is anything *other* than stable, or it is unstable
but CBMK_VERSION_TYPE is not set to "unstable", and not building
a release, a confirmation is passed.

If the board is not specified as stable or unstable, during
a release build, the build is skipped and the ROM is not
provided in that release; this is in *addition* to
release="n" or release="y" that can be set in target.cfg,
which will skip the release build for that target if "n"

Signed-off-by: Leah Rowe <info@minifree.org>
2024-05-03 00:45:50 +01:00