Commit Graph

72 Commits (3fd2769bf68c1a1f9e66a15f04acfabc130f0e49)

Author SHA1 Message Date
Leah Rowe 16f9ad55ca put cachedir in environmental variable
XBMK_CACHE is now used, instead of hardcoding cache/

this is exported initialised to cache/, if unset.
this means you can set your own directory, and it means
./update release will use the same directory.

this means bandwidth wastage is further avoided.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-07-19 15:02:00 +01:00
Leah Rowe a7f9a7bb6f build: remove tmp/ on release archives
i overlooked this before. remove it. the directory
happened to be empty when i tested archives, but it's
still not a good thing that we have it. remove it!

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-07-19 15:00:57 +01:00
Leah Rowe ae3966a02f build: remove cache/ on making releases
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-07-18 02:17:17 +01:00
Leah Rowe 055c9be15b trees: auto-delete+auto-rebuild if project changes
actual source code is not scanned, but config directories are
scanned. simply get the checksum of each file under config/
pertaining to a given project/tree, and also for the given
target. coreboot utilities are also handled.

if it changes, in any way, delete and re-build automatically.

such deletions should probably still be done manually, as part
of understanding the build system, but this change should make
the build system much easier to use during development.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-07-18 02:10:58 +01:00
Leah Rowe e01995d491 rom.sh: new file, to replace script/roms
stub it from the trees script. the way it works now,
there is less code in the build system.

./build roms

this is no longer a thing

./build roms serprog

this is also no longer a thing. instead, do:

./update trees -b coreboot targetnamehere

./update trees -b pico-serprog

./update trees -b stm32-vserprog

the old commands still works, which causes the new
commands to run

coreboot roms now appear in elf/, not bin/, as before,
but those images now contain payloads.

NOTE: to contradict the above: ./build roms is no
longer a thing, in that it's now deprecated, but
backward compatibility is present for now. it will
be removed in a future release.

./build roms list also still works! it will do:
./update trees -b coreboot list

also:
./update trees -b grub list
this is now possible too

if a target "list" is provided, for multi-tree sources,
the targets are shown.

there is another difference: seagrub roms are now seagrub_,
instead of seabios_withgrub.

seabios-only roms are no longer provided, where grub is also
enabled; only seagrub is used. the user can easily remove
the bootorder file, if they want seabios to not try grub first.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-07-08 01:37:26 +01:00
Leah Rowe bdf43e07cf trees: handle all projects if project undefined
e.g. ./update trees -f

if passed, this command would download every tree

similarly, the -c option can be used in this way. this
solves a longstanding issue: on the current, much more
efficient design, it was not possible to systematically
clean every project.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-07-01 03:35:55 +01:00
Leah Rowe 1fbfc7303d remove use of _xm variable in the build system
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-27 23:19:14 +01:00
Leah Rowe f3baebe7e1 lib.sh: move git_err() to build
it's only used in the main build script, so move it there.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-27 16:23:11 +01:00
Leah Rowe 32e1b13416 build: don't rm TMPDIR if it's /tmp
we override TMPDIR, setting it to /tmp/xbmk*C

if it's just set to tmp, that means we didn't set it properly,
which is a bug.

this patch protects against deletion of /tmp under such a
fault condition, if it were ever to occur in the future.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-27 03:27:46 +01:00
Leah Rowe 6daea94df8 lib.sh: simplified TMPDIR handling
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-27 03:27:42 +01:00
Leah Rowe ad1d0cb58c use backticks on eval commands, not subshells
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-22 13:51:21 +01:00
Leah Rowe e7fcfac14e lib.sh: remove badcmd()
it's bloat. telling the user to rtfm is something that
we already do on irc; they will still ask how to do
everything, and ignore the message from badcmd(), or
they will automatically know to rtfm.

i'm on a massive purge, removing bloat from lbmk as
part of Libreboot Build System Audit 6.

all bloat must go.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-22 13:51:01 +01:00
Leah Rowe 6094542663 build: remove unused variables
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-16 12:39:30 +01:00
Leah Rowe 1399f2137f lib.sh: remove the items() function
it's pretty much just doing the same thing as ls -1

remove it!

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-15 23:17:06 +01:00
Leah Rowe 4f6fbfde81 minor code cleanup in the build system
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-09 19:18:41 +01:00
Leah Rowe fd9664c567 build: also make a lock file during release build
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-09 16:35:01 +01:00
Leah Rowe f1caf89a28 create a lock file during builds
prevent duplicate main instances of the build
system from running

the lock file is deleted when the parent process
exits, alongside the tmpdir deletion

the build system must only ever be run ot one
instance at a time, per work directory

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-09 16:34:49 +01:00
Leah Rowe a61794dfca don't use build.list to detect multi-tree projects
instead, check for the presence of target.cfg files
not in config/project/ but config/project/tree/

the way this check is done, it merely returns 1 if
config/project/*/target.cfg is detected, and returns
0 in all other cases, even if config/project/target.cfg
exists

that way, if the maintainer accidentally adds a
target.cfg in the main directory, the given multi-tree
project will not break

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-07 17:27:40 +01:00
Leah Rowe 878056f37b move id check to lib.sh too
doesn't really matter, it's just an extra layer to ensure
reliability, but "id" is pretty standard

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-07 17:27:36 +01:00
Leah Rowe 3900642471 move root check to lib.sh (bugfix)
this avoids writing the version/versiondate files as root.

this complements the previous fix, that avoided writing those
same files when running the dependencies command.

initial setup of the build system requires root, to run the
dependencies script, but otherwise the build system prevents
running as root for everything else, so we must avoid writing
the version/versiondate files as root.

that same avoidance is necessary when checking whether running
other commands as root; ironically, this check then prevented
running the build system at all!

the bug should be fully fixed now. i found this quite by accident
the other day, when testing something else.

good thing this got fixed because the release!

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-05 11:15:44 +01:00
Leah Rowe 740b1803fa bugfix: move dependencies handling to lib.sh
do it strategically, in just the right place so that the
version and versiondate files aren't written.

otherwise, version/versiondate are written as root and
the build system becomes unusable after that, unless you
reset the file ownerships from root. hardly user-friendly.

mitigate this bug.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-05 11:15:39 +01:00
Leah Rowe 1d866d17d8 better help text on invalid commands
adding help again is a bad idea. code should never
document itself; that's what documentation is for.

so, make the code do a better job telling the user
where to find documentation.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-03 11:09:39 +01:00
Leah Rowe 1204bc3c96 build: print the project website address on help
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-03 11:09:32 +01:00
Leah Rowe a36504aa31 delete u-boot test/lib/strlcat.c using nuke()
we don't need to do it in the release function

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-30 07:38:32 +01:00
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 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 583135e548 build: simplify git_init()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-25 16:57:21 +01:00
Leah Rowe aaff90f5a5 build: do root check before git check
otherwise, git could be initialised as root.

running as root is not allowed.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-25 16:39:58 +01:00
Leah Rowe 687fdacc78 build: simplify git checks
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-25 16:39:47 +01:00
Leah Rowe 9339c6f3fd build: hide git-init output
following on from the previous commit, if you run
something like "./build roms list" when running for
the first time from a codeberg tarball, the output
of the git commands will be included in the output

hide this output

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-25 11:38:36 +01:00
Leah Rowe 4783c5b90e more minor cleanup in the build system
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-19 08:18:24 +01:00
Leah Rowe 309c3b1f33 build/roms: rename moverom to copyrom
it copies, it doesn't move, so name it right

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-19 06:47:33 +01:00
Leah Rowe a39c95cfac minor code cleanup in the build system
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-19 06:31:46 +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 e4956478db build: remove initcmd() and simplify main()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-16 11:37:22 +01:00
Leah Rowe f2b3bb142d build: initialise git first (before commands)
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-16 11:36:36 +01:00
Leah Rowe 571932d33e build: remove excmd() and simplify main()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-16 11:24:35 +01:00
Leah Rowe 525f5525d3 build: don't make script_path a global variable
this allows a mild cleanup of the code (reduction by 1 line)

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-16 11:13:28 +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 e71189420f remove help commands (user should read docs)
i always say, code should never document itself.

that's what documentation is for. the releases
contain documentation under docs/ but the git
repository does not; for that, use the website.

(in practise, cbmk usually needs internet anyway)

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-15 07:55:54 +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 2c5f52ce29 build: define "xp" in the global variables
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-15 07:54:06 +01:00
Leah Rowe 48c5c57cff build: simplify for loop in fetch_trees()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-15 07:53:47 +01:00
Leah Rowe c2baebc79a build: simplified downloads in fetch_trees()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-15 07:53:34 +01:00
Leah Rowe 18d0e53480 ./build release: don't do u-boot-only archives
it's a pointless feature, initially added just to one-up
gnuboot and only intended for canoeboot, to provide u-boot
tarballs with deblobbing. this was done, because the parabola
build system has certain limitations so the idea is to provide
them with tarballs. but why? they can just fix their build system...

delete this bloat from cbmk. we only need to provide full sources,
and rom images.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-15 07:53:10 +01:00
Leah Rowe d8a923f766 build: use utc+0 when initialising git repo dates
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-15 07:52:03 +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 c8bc797f31 build: simplify deletions in fetch_trees()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-15 07:48:11 +01:00
Leah Rowe 363ec7512c build: delete mkversion() (just print relname)
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-15 07:47:05 +01:00
Leah Rowe 3469836f18 rm src/u-boot/*/test/lib/strlcat.c in u-boot
i accidentally removed this in a previous commit

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-15 07:43:14 +01:00