Compare commits

...

81 Commits

Author SHA1 Message Date
Leah Rowe 489a81eb6d Merge pull request 'fix smbios_product_name for t1700 mt and sff' (#452) from Ronanand0/lbmk:fix-smbios-prod-name-for-t1700 into master
Reviewed-on: https://codeberg.org/libreboot/lbmk/pulls/452
2026-09-18 12:23:58 +02:00
Ronanand0 272e306ba2 Update config/coreboot/t1700sff_bmrc_12mb/config/libgfxinit_txtmode 2026-09-18 11:14:03 +02:00
Ronanand0 f1f7fa2925 Update config/coreboot/t1700mt_bmrc_12mb/config/libgfxinit_txtmode 2026-09-18 11:13:11 +02:00
Ronanand0 9e189bbd06 Update config/coreboot/t1700mt_bmrc_12mb/config/libgfxinit_corebootfb 2026-09-18 11:12:28 +02:00
Ronanand0 688e541c58 Update config/coreboot/t1700sff_bmrc_12mb/config/libgfxinit_corebootfb 2026-09-18 11:10:47 +02:00
Leah Rowe 387e6dd771 mk: much safer forx loop
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-17 21:14:08 +01:00
Leah Rowe a0951d1127 minor cleanup
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-17 11:06:12 +01:00
Leah Rowe f59e5d8e2b rom.sh: remove redundant check
if_build / empty mode are a given here, since this
is a premake function which only executes if
the mode string is empty and/or if_build is empty

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-17 10:55:19 +01:00
Leah Rowe 4530c6f2e3 rom.sh: put coreboot dry checks in mkhelper
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-17 10:52:52 +01:00
Leah Rowe e0714ad929 rom.sh: check grub dry build in mkhelper
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-17 10:46:53 +01:00
Leah Rowe 058a70a16e pcsx-redux: check dry build in mkhelper
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-17 10:45:16 +01:00
Leah Rowe e1c2525783 lib.sh: make build_sbase a macro
sh macros are cool

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-17 10:40:55 +01:00
Leah Rowe 69875b8e10 xbmk: general cleanup
note: mecleaner check removed in vendor.sh, because
it's already guaranteed to be fetched. the check will
never indicate failure, so we can just assume that
the me cleaner python script exists.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-17 10:33:43 +01:00
Leah Rowe 1722964f66 mk: add safety check for grep -o usage
very unlikely not to have it, but we deal in
certainty, not rm -Rf /

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-17 10:33:43 +01:00
Leah Rowe 63596046d1 rom.sh: simplify add_uboot
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-17 10:33:36 +01:00
Leah Rowe 40b120c26b remove ccache from dependencies
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-17 07:23:18 +01:00
Leah Rowe bf654d4c19 rom.sh: just remove the coreboot cook function
ccache isn't used at all in any of the configs

ensuring that this remains the case is much
cleaner. coreboot will never enable it by default,
precisely because of how buggy it is.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-17 07:20:25 +01:00
Leah Rowe 94ff1ec49a inject.sh: simplify variable init and end message
the modified/not message is pointless, because the
message indicating tarball rebuild will suffice

variable initialisation simplified (global newvar)

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-17 02:22:11 +01:00
Leah Rowe 08021d71c2 rom.sh: simplify add_uboot
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-17 02:06:00 +01:00
Leah Rowe 856551a36d mk: add forx function for shorthand loops
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-17 01:53:56 +01:00
Leah Rowe 7c025e1036 release.sh: remove -m option
-m src can skip building binaries

this is pointless. i always want them.

i won't use it, and i'm the only person
who will ever use ./mk release

i'm going to add a -t option in the future
to allow e.g. ./mk -t coreboot

this would do -f but create a tarball of
the source, versioned. e.g.
coreboot-libreboot-27.05_src.tar.xz

or something like that. this would allow
more granular control, if you just want to
get sources.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-17 01:13:36 +01:00
Leah Rowe 60a2f5cbff rom.sh: disable ccache on coreboot builds
this fixes a build issue i was having on ./mk release,
and it's also a preventative bug fix.

instead of forcing it to be enabled, we now force
it to be disabled. all current configs already disable
it, and disabled is the default.

just in case, disable it by force. i encountered build
errors on ./mk release, due to stale build artifacts.

i had no issues on normal lbmk.git, doing builds, but
./mk release builds everything in bulk. we want the
release build process to be as reliable as possible.

this won't actually affect build speed much, due to
lbmk's design (clean builds before running make).

work is needed upstream, to make ccache more reliable.
ccache is fine when you're re-building the same board
a lot, but there's just no way it can be used reliably
when building lots of very different boards, where the
code greatly differs in coreboot.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-16 23:27:53 +01:00
Leah Rowe 3b565ce056 vendor.sh: minor cleanup
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-16 21:06:39 +01:00
Leah Rowe 089875ac1f mk: error handling on command -v
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-16 11:43:58 +01:00
Leah Rowe 2dc01a93b9 mk: tidy up xbmk_sanitize_version
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-16 11:21:56 +01:00
Leah Rowe cebae0ed80 mk: rename autoconfargs to configureargs
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-16 10:58:00 +01:00
Leah Rowe d165f14a4d mk: general cleanup and awk appreciation
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-16 10:39:52 +01:00
Leah Rowe 5afd77433d mk: tidy up handle_defconfig
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-16 09:41:40 +01:00
Leah Rowe 08ec187842 wip
defconfig file test unnecessary in check_defconfig
because it's already checked in handle_defconfig

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-16 09:25:55 +01:00
Leah Rowe 2dc4a4d16b mk: clean up run_make_command_real
merge check_cmake with run_make_command_real

tidied up some redundant checks

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-16 07:54:16 +01:00
Leah Rowe ca55077032 mk: tidy up check_cmake
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-16 07:25:31 +01:00
Leah Rowe 113dac006f variable ./mk location, based on user input
when calling ./mk, or from PATH, an absolute path
is created to ./mk

this will likely be different than mk, but it might
be a different script. perhaps the operator is making
a copy of the mk script temporarily - obviously not
advised, no, but here we have a problem because then
lbmk is still running ./mk everywhere

run arg0 instead, now called "mk"

./mk is still hardcoded in release.sh, because we
do need to make sure we're using the right script
there

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-16 05:52:06 +01:00
Leah Rowe 88887c0163 mk: fix check_cross_compiler call
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-15 22:15:16 +01:00
Leah Rowe 0c41ea82dd mk: move config back to getopt
really pointless doing it here. do it in the loop.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-15 22:10:37 +01:00
Leah Rowe bbc56b714b fix build error on no-makefile projects
e.g. biosutilities

the subshell screws up error handling. this
patch changes it to old behaviour.

some projects don't have makefiles. the
non-zero exit also prevents further call
to copy_elf when no binaries are created,
as in this example.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-15 21:17:10 +01:00
Leah Rowe 6a5b4c98d6 mk: clean up getopt flags
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-15 21:11:51 +01:00
Leah Rowe 50eec6d485 mk: simplify single_tree_build
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-15 20:58:40 +01:00
Leah Rowe 40b1a3e0bb Revert "init.sh: re-initialise upstream src .git"
This reverts commit cf079dbd17.

we don't need it anymore. we don't bother cleaning sources
for releases, because tehy're never dirtied. we build
using ./mk release which does everything fresh.

the git-clean feature was only used on ./mk -c, which was
removed because it's not needed for the same reason as
above. lbmk always cleans and re-builds everything when
metadata changes, otherwise storing builds out of tree
in a cache directory.

get rid of this dead code.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-15 20:42:33 +01:00
Leah Rowe 59cbc1784c mk: remove -c and -x commands (clean/xgcc-clean)
the user never runs these. it's not needed. the design
of lbmk already cleans everything, or caches everything,
between builds. everything cached out of tree.

it's not expected to ever need to clean manually, so just
remove the option. knobs are for nobs.

releases don't need it either, because we tar everything
before building, thus eliminating all build artifacts.
we do this on a fresh copy of lbmk on ./mk release

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-15 20:38:08 +01:00
Leah Rowe 6725b616f3 mk: skip build if makefile check fails
this was the previous behaviour, and prevents
single-tree builds from proceeding with
use of copy_elf

otherwise you get a bunch of build errors

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-15 20:24:08 +01:00
Leah Rowe 7507655d34 simplified make-clean handling
no point using distclean, because the context there
is providing clean sources for distribution, but we
use ./mk release which tars everything up before ever
running any build commands.

make-clean is enough

distclean is a stupid gnuism anyway, and most makefiles
that have it will just do the same as clean anyway

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-15 20:20:03 +01:00
Leah Rowe 2aad50cd59 even more tidy up run_make_command
tidy it all the way up

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-15 19:51:55 +01:00
Leah Rowe f7b9c9e410 mk: tidy up run_make_command
yeah, this reverses the last change

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-15 19:03:39 +01:00
Leah Rowe 4878cec84d mk: optimise make-clean check
only check makefiles if if_not_make_clean is set

this avoids unnecessary disk usage

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-15 18:06:52 +01:00
Leah Rowe 04be963383 mk: remove unnecessary check
on dry builds, if_not_make_clean will also be empty

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-15 18:06:14 +01:00
Leah Rowe 5043b6dc97 mk: abuse an absurd number of sh macros
just the right amount of absurd

this is why i don't need to use python

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-15 17:08:05 +01:00
Leah Rowe a65d804f1e add dir check
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-15 10:37:06 +01:00
Leah Rowe cf079dbd17 init.sh: re-initialise upstream src .git
we have git-clean in use for projects, but that
only affects lbmk.git

now we re-initialise .git in upstream projects,
when .git is missing. this ensures consistent
cleaning behaviour between lbmk.git and the
libreboot releases.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-15 10:32:38 +01:00
Leah Rowe 828578cc57 mk: use correct elddir for coreboot xgcc
in practise, it was always correct because on projects
that used coreboot xgcc, the tree would always be called
default.

however, this is a bug. the logic uses a correct directory
name for coreboot in src/, but not elf/

this patch makes the two consistent, programattically.

this is therefore a preventative bugfix.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-15 09:16:28 +01:00
Leah Rowe 7cb4cdf0f2 mk: turn on git-clean by default, except coreboot
libreboot's policy is to thoroughly clean sources per
build, because we cache builds out of tree and avoid
re-builds if they exist; these and the sources are
deleted if metadata in config/ changes per project,
tree and/or target.

the problem is that this change only affects lbmk.git

it doesn't affect release archives, where project sources
do not have git-init applied to them. this will be
addressed.

can't use it on coreboot, because it will delete xgcc
tarballs in a way currently not handled, and handling
it will mean adding a project-specific hack.

the xgcc tarballs could be built out-of-tree, and this
will have to be done, otherwise coreboot will have to be
made gitclean="y" for now.

everything else is fair game.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-14 18:01:57 +01:00
Leah Rowe 300f2cb434 mk: remove u-boot-specific git-clean handling
yes, make it generalised. use a new variable in
mkhelper.cfg, gitclean and gitcleanargs

not enabled by default, but u-boot enables it. i'm
considering whether to use this by default, as it
is the general policy of lbmk to clean everything
just after a build, as builds are cached out of
tree. this way, we can do re-builds safely for each
project. there are probably a lot of subtle bugs that
might be fixed if we used this

the problem is that this is currently only used on
lbmk.git, but not on libreboot release archives which
lack .git directories; the main one is initialised in
lbmk, but not in upstream sources. we could just initialise
those.

in fact, that is probably what i'm going to do.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-14 17:46:34 +01:00
Leah Rowe 2c94101884 mk: remove cleanargs from git-clean
totally worthless

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-14 17:35:19 +01:00
Leah Rowe 08f93ec812 mk: redirect readlink err to /dev/null
i had this before. forgot to add it in the new
design. oops.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-14 13:23:10 +01:00
Leah Rowe e99be6e5dc mk: ruthlessly simplify findpath()
i love eval, printf and awk

eval, printf and awk are the best things ever

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-14 12:47:01 +01:00
Leah Rowe e075a79867 err even louder
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-14 12:27:42 +01:00
Leah Rowe cd52750fec mk: further simplify err()
yes, just awk everything, double-quoted

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-14 12:25:35 +01:00
Leah Rowe f115bdfe37 mk: add error check on xbmkpwd init
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-14 12:19:08 +01:00
Leah Rowe 76bf71ff65 mk: simplified findpath()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-14 12:08:53 +01:00
Leah Rowe c4695497f5 mk: simplified error functions
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-14 11:54:52 +01:00
Leah Rowe d9ca4265ef mk: remove xprintf
totally useless function. all it does is print
quotes. just printf the args into awk

this does literally the same thing. the output
will literally be the same.

unclear thinking == unclear code

right thinking == this patch

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-14 11:45:28 +01:00
Leah Rowe b32dd39262 move findpath and err functions to mk
otherwise, it's totally broken. i also now include
lib.sh later.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-14 11:37:34 +01:00
Leah Rowe c6900c8571 init.sh: remove redundant sha512sum init
it's done in xbmk_init. the initial value
is never used.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-14 11:33:15 +01:00
Leah Rowe c0402ef642 mk: simplify xbmkpwd initialisation
do it from mk instead. we don't need to run pwd
anymore, because we just get the path and cd
to it, setting that as the path.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-14 11:30:49 +01:00
Leah Rowe 16e04411f2 mk: include lib.sh earlier
this means we can now cd to wrkdir using findpath,
and it means the cd command can be wrapped in x_

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-14 11:11:04 +01:00
Leah Rowe b09cd4ada4 mk: call xbmk_init through x_
the function never returns 1 at the moment, but
this is a useful future trap.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-14 11:07:56 +01:00
Leah Rowe abee462f2a mk: run xbmk_init here, not from init.sh
it should be clear on first reading, what the actual
control flow is. hiding the call in init.sh obscures
first reading.

now it is absolutely clear on first reading, that
xbmk_init is called before going through everything
else in mk.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-14 11:07:24 +01:00
Leah Rowe cb49e77947 delete straggler
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-14 10:09:22 +01:00
Leah Rowe 93b49afa3f mk: remove gcc/gnat matching logic (obsolete)
coreboot has this now:

commit c421847fe2fef61586eb313206a4be0f2e491974
Author: Matt DeVillier <matt.devillier@gmail.com>
Date:   Mon Dec 29 10:12:17 2025 -0600

    util/crossgcc: Fix GNAT detection for gnat-15

this one is advisory instead, telling the user to
create such a symlink as we did. this is much less
invasive.

our own check was bad, because it basically silences
what is otherwise an error. coreboot's approach is
more correct, so we will defer to that instead.

note that this means older coreboot (for fam15h) is
no longer covered, but those trees don't use gnat
anyway as libgfxinit is unused on those targets

this lbmk patch removes 61 sloc of dead code, which
makes me very happy.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-14 10:05:16 +01:00
Leah Rowe 6c3791ce81 mk: rename trees() to main()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-14 09:33:30 +01:00
Leah Rowe d17b06f589 merge tree.sh into mk
mk is so tiny now, and will likely never get
bigger. tree.sh is effectively the main script
now, so let's treat it as such.

i'll start splitting tree.sh instead. e.g.
move gcc setup to its own file.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-14 09:26:37 +01:00
Leah Rowe 2fc37b4b47 use -mindepth alongside -maxdepth in find
use of maxdepth 1 does not exclude the main
directory, which is undesired in these contexts,
though excluded in practise due to how find is
actually used.

technically, mindepth should be used, just in
case, as a defensive measure. the context here
is files and directories within a main directory,
used as arguments in other commands.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-14 08:48:16 +01:00
Leah Rowe 4ebede5b99 tree.sh: fix globbing in multi-tree command args
this solves a bug that does not yet manifest, because
this bug *can't* currently trigger any error due to
lbmk's design. this is therefore a preventative fix,
for reasons that will become clear.

we previously put arguments in a variable, in a way
that didn't handle globbing. now we avoid a variable
and use "$@" instead, which solves the problem.

this also means that the main logic in mk can be
cleaner, as trees-specific control logic is now
placed entirely in tree.sh's main.

this means that we can now also wrap x_ around trees()

this was never a problem in the past, because all of
the arguments for trees commands never have globbing;
config names are always e.g. foo_bar, not foo bar

in commands where globbing did need to be handled,
those commands were never trees commands. e.g.
you had ./mk inject filename

yes, this is a design improvement, or a preventative
bug fix. pick your poison.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-14 08:06:51 +01:00
Leah Rowe a82328904e mk: clean up printf command
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-14 00:36:10 +01:00
Leah Rowe 823a1fd011 mk: put all includes in one place
the previous design flaw was fixed by recent
refactors, such that i can now . include all
of lbmk at once, and have control logic right
after that.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-14 00:14:55 +01:00
Leah Rowe 5fb0d1098f mk: simplified command handling
just do includes in mk again. common.sh was stupidly
small, just pointless.

replace the entire command dispatcher with eval, printf
and awk, because i can, and it further reduces sloccount.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-14 00:05:48 +01:00
Leah Rowe dcaa15ab01 common.h: re-order includes
the new order more reliably indicates which order
everything is executed in, by virtue of the functions
provided in each file.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-13 22:25:15 +01:00
Leah Rowe f5f6464c60 79 lines
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-13 20:55:30 +01:00
Leah Rowe 74c374a3a2 use awk instead
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-13 20:38:54 +01:00
Leah Rowe de09b71e0a init.sh: tidy up main loop
the new loop is incredibly novel in nature, and will
break if anyone but me ever touches it. it also
reduces sloccount by two lines.

i did it because i can, and it's perfectly safe.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-13 20:12:03 +01:00
Leah Rowe eb23cd3de8 split up include/
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-13 15:33:21 +01:00
Leah Rowe 07ed4e940b more build system cleanup
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-13 15:28:15 +01:00
31 changed files with 745 additions and 1145 deletions
@@ -21,6 +21,7 @@ CONFIG_OPTION_BACKEND_NONE=y
# CONFIG_USE_CBFS_FILE_OPTION_BACKEND is not set
CONFIG_COMPRESS_RAMSTAGE_LZMA=y
# CONFIG_COMPRESS_RAMSTAGE_LZ4 is not set
# CONFIG_COMPRESS_RAMSTAGE_ZSTD is not set
CONFIG_SEPARATE_ROMSTAGE=y
CONFIG_INCLUDE_CONFIG_FILE=y
CONFIG_COLLECT_TIMESTAMPS=y
@@ -99,6 +100,7 @@ CONFIG_VENDOR_DELL=y
# CONFIG_VENDOR_PRODRIVE is not set
# CONFIG_VENDOR_PROTECTLI is not set
# CONFIG_VENDOR_PURISM is not set
# CONFIG_VENDOR_QOTOM is not set
# CONFIG_VENDOR_RAPTOR_CS is not set
# CONFIG_VENDOR_RAZER is not set
# CONFIG_VENDOR_RODA is not set
@@ -127,7 +129,7 @@ CONFIG_CBFS_SIZE=0xEEE000
CONFIG_CONSOLE_SERIAL=y
CONFIG_LINEAR_FRAMEBUFFER_MAX_HEIGHT=2160
CONFIG_LINEAR_FRAMEBUFFER_MAX_WIDTH=3840
CONFIG_MAX_CPUS=16
CONFIG_MAX_CPUS=8
# CONFIG_ONBOARD_VGA_IS_PRIMARY is not set
CONFIG_POST_DEVICE=y
CONFIG_POST_IO=y
@@ -149,19 +151,21 @@ CONFIG_INTEL_GMA_VBT_FILE="src/mainboard/$(MAINBOARDDIR)/data.vbt"
CONFIG_PRERAM_CBMEM_CONSOLE_SIZE=0xc00
CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="OptiPlex 3040 Micro"
# CONFIG_CONSOLE_POST is not set
CONFIG_FSP_FD_PATH="3rdparty/fsp/KabylakeFspBinPkg/Fsp.fd"
CONFIG_MAX_SOCKET=1
CONFIG_CMOS_DEFAULT_FILE="src/mainboard/$(MAINBOARDDIR)/cmos.default"
CONFIG_CMOS_LAYOUT_FILE="src/mainboard/$(MAINBOARDDIR)/cmos.layout"
CONFIG_MAX_SOCKET=1
CONFIG_BOOT_DEVICE_SPI_FLASH_BUS=0
CONFIG_USE_PM_ACPI_TIMER=y
# CONFIG_BOARD_DELL_LATITUDE_E7240 is not set
CONFIG_BOOT_DEVICE_SPI_FLASH_BUS=0
# CONFIG_BOARD_DELL_E4300 is not set
# CONFIG_BOARD_DELL_E6400 is not set
# CONFIG_BOARD_DELL_LATITUDE_E7240 is not set
CONFIG_BOARD_DELL_OPTIPLEX_3040=y
# CONFIG_BOARD_DELL_OPTIPLEX_780_MT is not set
# CONFIG_BOARD_DELL_OPTIPLEX_780_USFF is not set
# CONFIG_BOARD_DELL_OPTIPLEX_9020_SFF is not set
# CONFIG_BOARD_DELL_OPTIPLEX_9020_MT is not set
# CONFIG_BOARD_DELL_OPTIPLEX_3050 is not set
# CONFIG_BOARD_DELL_LATITUDE_E5420 is not set
# CONFIG_BOARD_DELL_LATITUDE_E5520 is not set
# CONFIG_BOARD_DELL_LATITUDE_E6220 is not set
@@ -205,7 +209,8 @@ CONFIG_GFX_GMA_PANEL_1_ON_EDP=y
CONFIG_DRIVERS_UART_8250IO=y
CONFIG_PC_CMOS_BASE_PORT_BANK1=0x72
CONFIG_HEAP_SIZE=0x100000
CONFIG_EC_GPE_SCI=0x50
# CONFIG_BOOTMEDIA_SMM_BWP is not set
# CONFIG_DRIVERS_EFI_FW_INFO is not set
CONFIG_BOARD_ROMSIZE_KB_16384=y
# CONFIG_COREBOOT_ROMSIZE_KB_256 is not set
# CONFIG_COREBOOT_ROMSIZE_KB_512 is not set
@@ -249,6 +254,7 @@ CONFIG_SMM_RESERVED_SIZE=0x200000
CONFIG_SMM_MODULE_STACK_SIZE=0x800
CONFIG_ACPI_BERT_SIZE=0x0
CONFIG_DRIVERS_I2C_DESIGNWARE_CLOCK_MHZ=120
CONFIG_CPU_PT_ROM_MAP_GB=512
CONFIG_PRERAM_CBFS_CACHE_SIZE=0x4000
CONFIG_DOMAIN_RESOURCE_32BIT_LIMIT=0xe0000000
CONFIG_ACPI_CPU_STRING="CP%02X"
@@ -266,7 +272,6 @@ CONFIG_SOC_INTEL_I2C_DEV_MAX=6
CONFIG_SOC_INTEL_COMMON_LPSS_UART_CLK_M_VAL=0x30
CONFIG_SOC_INTEL_COMMON_LPSS_UART_CLK_N_VAL=0xc35
CONFIG_FSP_HEADER_PATH="3rdparty/fsp/KabylakeFspBinPkg/Include/"
CONFIG_FSP_FD_PATH="3rdparty/fsp/KabylakeFspBinPkg/Fsp.fd"
CONFIG_SOC_INTEL_COMMON_DEBUG_CONSENT=0
CONFIG_INTEL_GMA_BCLV_OFFSET=0xc8254
CONFIG_INTEL_GMA_BCLV_WIDTH=16
@@ -284,6 +289,8 @@ CONFIG_SOC_INTEL_GFX_FRAMEBUFFER_OFFSET=0x0
CONFIG_PCIE_LTR_MAX_SNOOP_LATENCY=0x1003
CONFIG_PCIE_LTR_MAX_NO_SNOOP_LATENCY=0x1003
CONFIG_SOC_PHYSICAL_ADDRESS_WIDTH=0
CONFIG_RAMSTAGE_CBFS_CACHE_SIZE=0x4000
CONFIG_CBFS_CACHE_ALIGN=8
CONFIG_SOC_INTEL_COMMON_SKYLAKE_BASE=y
CONFIG_SOC_INTEL_KABYLAKE=y
CONFIG_SKYLAKE_SOC_PCH_H=y
@@ -293,7 +300,7 @@ CONFIG_SKYLAKE_SOC_PCH_H=y
CONFIG_FSP_T_LOCATION=0xfffe0000
CONFIG_SOC_INTEL_COMMON_BLOCK_P2SB=y
CONFIG_FIXED_SMBUS_IO_BASE=0xefa0
CONFIG_CBFS_CACHE_ALIGN=8
CONFIG_UART_BITBANG_TX_DELAY_MS=5
CONFIG_SOC_INTEL_COMMON=y
#
@@ -431,7 +438,6 @@ CONFIG_UDELAY_TSC=y
CONFIG_TSC_MONOTONIC_TIMER=y
CONFIG_TSC_SYNC_MFENCE=y
CONFIG_HAVE_SMI_HANDLER=y
CONFIG_CPU_PT_ROM_MAP_GB=512
CONFIG_SMM_TSEG=y
CONFIG_SMM_PCI_RESOURCE_STORE_NUM_SLOTS=8
CONFIG_AP_STACK_SIZE=0x800
@@ -500,7 +506,6 @@ CONFIG_ARCH_ALL_STAGES_X86_32=y
CONFIG_RESERVED_PHYSICAL_ADDRESS_BITS_SUPPORT=y
CONFIG_X86_TOP4G_BOOTMEDIA_MAP=y
CONFIG_POSTRAM_CBFS_CACHE_IN_BSS=y
CONFIG_RAMSTAGE_CBFS_CACHE_SIZE=0x4000
CONFIG_PC80_SYSTEM=y
CONFIG_HAVE_CMOS_DEFAULT=y
CONFIG_POSTCAR_STAGE=y
@@ -564,6 +569,8 @@ CONFIG_INTEL_GMA_ADD_VBT=y
# CONFIG_SOFTWARE_I2C is not set
CONFIG_I2C_TRANSFER_TIMEOUT_US=500000
CONFIG_RESOURCE_ALLOCATION_TOP_DOWN=y
CONFIG_DRAM_SUPPORT_DDR4=y
CONFIG_DRAM_SUPPORT_DDR3=y
# end of Devices
#
@@ -571,8 +578,8 @@ CONFIG_RESOURCE_ALLOCATION_TOP_DOWN=y
#
CONFIG_CRB_TPM_BASE_ADDRESS=0xfed40000
# CONFIG_DRIVERS_EFI_VARIABLE_STORE is not set
# CONFIG_DRIVERS_EFI_FW_INFO is not set
# CONFIG_ELOG is not set
# CONFIG_DRIVERS_HWID_DMI is not set
CONFIG_CACHE_MRC_SETTINGS=y
CONFIG_MRC_SETTINGS_PROTECT=y
# CONFIG_DRIVERS_OPTION_CFR is not set
@@ -610,6 +617,7 @@ CONFIG_USE_FSP_NOTIFY_PHASE_READY_TO_BOOT=y
CONFIG_USE_FSP_NOTIFY_PHASE_END_OF_FIRMWARE=y
# CONFIG_DISPLAY_FSP_TIMESTAMPS is not set
# CONFIG_BUILDING_WITH_DEBUG_FSP is not set
CONFIG_FSP_VGA_MODE12_BPP=0x0
CONFIG_INTEL_GMA_ACPI=y
CONFIG_VBT_CBFS_COMPRESSION_LZMA=y
# CONFIG_VBT_CBFS_COMPRESSION_LZ4 is not set
@@ -670,7 +678,6 @@ CONFIG_PLATFORM_HAS_DRAM_CLEAR=y
CONFIG_BOOTMEDIA_LOCK_NONE=y
# CONFIG_BOOTMEDIA_LOCK_CONTROLLER is not set
# CONFIG_BOOTMEDIA_LOCK_CHIP is not set
# CONFIG_BOOTMEDIA_SMM_BWP is not set
# end of Security
CONFIG_ACPI_HAVE_PCAT_8259=y
@@ -811,6 +818,9 @@ CONFIG_DECOMPRESS_OFAST=y
# Boot Logo Configuration
#
# CONFIG_BMP_LOGO is not set
CONFIG_PLATFORM_POST_RENDER_DELAY_SEC=5
CONFIG_PLATFORM_OFF_MODE_CHARGING_INDICATOR_LOGO_PATH="3rdparty/blobs/mainboard/$(MAINBOARDDIR)/off_mode_charging.bmp"
# CONFIG_FRAMEBUFFER_SPLASH_TEXT is not set
# end of Boot Logo Configuration
CONFIG_WARNINGS_ARE_ERRORS=y
@@ -21,6 +21,7 @@ CONFIG_OPTION_BACKEND_NONE=y
# CONFIG_USE_CBFS_FILE_OPTION_BACKEND is not set
CONFIG_COMPRESS_RAMSTAGE_LZMA=y
# CONFIG_COMPRESS_RAMSTAGE_LZ4 is not set
# CONFIG_COMPRESS_RAMSTAGE_ZSTD is not set
CONFIG_SEPARATE_ROMSTAGE=y
CONFIG_INCLUDE_CONFIG_FILE=y
CONFIG_COLLECT_TIMESTAMPS=y
@@ -99,6 +100,7 @@ CONFIG_VENDOR_DELL=y
# CONFIG_VENDOR_PRODRIVE is not set
# CONFIG_VENDOR_PROTECTLI is not set
# CONFIG_VENDOR_PURISM is not set
# CONFIG_VENDOR_QOTOM is not set
# CONFIG_VENDOR_RAPTOR_CS is not set
# CONFIG_VENDOR_RAZER is not set
# CONFIG_VENDOR_RODA is not set
@@ -125,7 +127,7 @@ CONFIG_FMDFILE=""
CONFIG_MAINBOARD_VENDOR="Dell Inc."
CONFIG_CBFS_SIZE=0xEEE000
CONFIG_CONSOLE_SERIAL=y
CONFIG_MAX_CPUS=16
CONFIG_MAX_CPUS=8
# CONFIG_ONBOARD_VGA_IS_PRIMARY is not set
CONFIG_POST_DEVICE=y
CONFIG_POST_IO=y
@@ -147,19 +149,21 @@ CONFIG_INTEL_GMA_VBT_FILE="src/mainboard/$(MAINBOARDDIR)/data.vbt"
CONFIG_PRERAM_CBMEM_CONSOLE_SIZE=0xc00
CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="OptiPlex 3040 Micro"
# CONFIG_CONSOLE_POST is not set
CONFIG_FSP_FD_PATH="3rdparty/fsp/KabylakeFspBinPkg/Fsp.fd"
CONFIG_MAX_SOCKET=1
CONFIG_CMOS_DEFAULT_FILE="src/mainboard/$(MAINBOARDDIR)/cmos.default"
CONFIG_CMOS_LAYOUT_FILE="src/mainboard/$(MAINBOARDDIR)/cmos.layout"
CONFIG_MAX_SOCKET=1
CONFIG_BOOT_DEVICE_SPI_FLASH_BUS=0
CONFIG_USE_PM_ACPI_TIMER=y
# CONFIG_BOARD_DELL_LATITUDE_E7240 is not set
CONFIG_BOOT_DEVICE_SPI_FLASH_BUS=0
# CONFIG_BOARD_DELL_E4300 is not set
# CONFIG_BOARD_DELL_E6400 is not set
# CONFIG_BOARD_DELL_LATITUDE_E7240 is not set
CONFIG_BOARD_DELL_OPTIPLEX_3040=y
# CONFIG_BOARD_DELL_OPTIPLEX_780_MT is not set
# CONFIG_BOARD_DELL_OPTIPLEX_780_USFF is not set
# CONFIG_BOARD_DELL_OPTIPLEX_9020_SFF is not set
# CONFIG_BOARD_DELL_OPTIPLEX_9020_MT is not set
# CONFIG_BOARD_DELL_OPTIPLEX_3050 is not set
# CONFIG_BOARD_DELL_LATITUDE_E5420 is not set
# CONFIG_BOARD_DELL_LATITUDE_E5520 is not set
# CONFIG_BOARD_DELL_LATITUDE_E6220 is not set
@@ -203,7 +207,8 @@ CONFIG_GFX_GMA_PANEL_1_ON_EDP=y
CONFIG_DRIVERS_UART_8250IO=y
CONFIG_PC_CMOS_BASE_PORT_BANK1=0x72
CONFIG_HEAP_SIZE=0x100000
CONFIG_EC_GPE_SCI=0x50
# CONFIG_BOOTMEDIA_SMM_BWP is not set
# CONFIG_DRIVERS_EFI_FW_INFO is not set
CONFIG_BOARD_ROMSIZE_KB_16384=y
# CONFIG_COREBOOT_ROMSIZE_KB_256 is not set
# CONFIG_COREBOOT_ROMSIZE_KB_512 is not set
@@ -247,6 +252,7 @@ CONFIG_SMM_RESERVED_SIZE=0x200000
CONFIG_SMM_MODULE_STACK_SIZE=0x800
CONFIG_ACPI_BERT_SIZE=0x0
CONFIG_DRIVERS_I2C_DESIGNWARE_CLOCK_MHZ=120
CONFIG_CPU_PT_ROM_MAP_GB=512
CONFIG_PRERAM_CBFS_CACHE_SIZE=0x4000
CONFIG_DOMAIN_RESOURCE_32BIT_LIMIT=0xe0000000
CONFIG_ACPI_CPU_STRING="CP%02X"
@@ -264,7 +270,6 @@ CONFIG_SOC_INTEL_I2C_DEV_MAX=6
CONFIG_SOC_INTEL_COMMON_LPSS_UART_CLK_M_VAL=0x30
CONFIG_SOC_INTEL_COMMON_LPSS_UART_CLK_N_VAL=0xc35
CONFIG_FSP_HEADER_PATH="3rdparty/fsp/KabylakeFspBinPkg/Include/"
CONFIG_FSP_FD_PATH="3rdparty/fsp/KabylakeFspBinPkg/Fsp.fd"
CONFIG_SOC_INTEL_COMMON_DEBUG_CONSENT=0
CONFIG_INTEL_GMA_BCLV_OFFSET=0xc8254
CONFIG_INTEL_GMA_BCLV_WIDTH=16
@@ -282,6 +287,8 @@ CONFIG_SOC_INTEL_GFX_FRAMEBUFFER_OFFSET=0x0
CONFIG_PCIE_LTR_MAX_SNOOP_LATENCY=0x1003
CONFIG_PCIE_LTR_MAX_NO_SNOOP_LATENCY=0x1003
CONFIG_SOC_PHYSICAL_ADDRESS_WIDTH=0
CONFIG_RAMSTAGE_CBFS_CACHE_SIZE=0x4000
CONFIG_CBFS_CACHE_ALIGN=8
CONFIG_SOC_INTEL_COMMON_SKYLAKE_BASE=y
CONFIG_SOC_INTEL_KABYLAKE=y
CONFIG_SKYLAKE_SOC_PCH_H=y
@@ -291,7 +298,7 @@ CONFIG_SKYLAKE_SOC_PCH_H=y
CONFIG_FSP_T_LOCATION=0xfffe0000
CONFIG_SOC_INTEL_COMMON_BLOCK_P2SB=y
CONFIG_FIXED_SMBUS_IO_BASE=0xefa0
CONFIG_CBFS_CACHE_ALIGN=8
CONFIG_UART_BITBANG_TX_DELAY_MS=5
CONFIG_SOC_INTEL_COMMON=y
#
@@ -429,7 +436,6 @@ CONFIG_UDELAY_TSC=y
CONFIG_TSC_MONOTONIC_TIMER=y
CONFIG_TSC_SYNC_MFENCE=y
CONFIG_HAVE_SMI_HANDLER=y
CONFIG_CPU_PT_ROM_MAP_GB=512
CONFIG_SMM_TSEG=y
CONFIG_SMM_PCI_RESOURCE_STORE_NUM_SLOTS=8
CONFIG_AP_STACK_SIZE=0x800
@@ -498,7 +504,6 @@ CONFIG_ARCH_ALL_STAGES_X86_32=y
CONFIG_RESERVED_PHYSICAL_ADDRESS_BITS_SUPPORT=y
CONFIG_X86_TOP4G_BOOTMEDIA_MAP=y
CONFIG_POSTRAM_CBFS_CACHE_IN_BSS=y
CONFIG_RAMSTAGE_CBFS_CACHE_SIZE=0x4000
CONFIG_PC80_SYSTEM=y
CONFIG_HAVE_CMOS_DEFAULT=y
CONFIG_POSTCAR_STAGE=y
@@ -556,6 +561,8 @@ CONFIG_INTEL_GMA_ADD_VBT=y
# CONFIG_SOFTWARE_I2C is not set
CONFIG_I2C_TRANSFER_TIMEOUT_US=500000
CONFIG_RESOURCE_ALLOCATION_TOP_DOWN=y
CONFIG_DRAM_SUPPORT_DDR4=y
CONFIG_DRAM_SUPPORT_DDR3=y
# end of Devices
#
@@ -563,8 +570,8 @@ CONFIG_RESOURCE_ALLOCATION_TOP_DOWN=y
#
CONFIG_CRB_TPM_BASE_ADDRESS=0xfed40000
# CONFIG_DRIVERS_EFI_VARIABLE_STORE is not set
# CONFIG_DRIVERS_EFI_FW_INFO is not set
# CONFIG_ELOG is not set
# CONFIG_DRIVERS_HWID_DMI is not set
CONFIG_CACHE_MRC_SETTINGS=y
CONFIG_MRC_SETTINGS_PROTECT=y
# CONFIG_DRIVERS_OPTION_CFR is not set
@@ -602,6 +609,7 @@ CONFIG_USE_FSP_NOTIFY_PHASE_READY_TO_BOOT=y
CONFIG_USE_FSP_NOTIFY_PHASE_END_OF_FIRMWARE=y
# CONFIG_DISPLAY_FSP_TIMESTAMPS is not set
# CONFIG_BUILDING_WITH_DEBUG_FSP is not set
CONFIG_FSP_VGA_MODE12_BPP=0x0
CONFIG_INTEL_GMA_ACPI=y
CONFIG_VBT_CBFS_COMPRESSION_LZMA=y
# CONFIG_VBT_CBFS_COMPRESSION_LZ4 is not set
@@ -663,7 +671,6 @@ CONFIG_PLATFORM_HAS_DRAM_CLEAR=y
CONFIG_BOOTMEDIA_LOCK_NONE=y
# CONFIG_BOOTMEDIA_LOCK_CONTROLLER is not set
# CONFIG_BOOTMEDIA_LOCK_CHIP is not set
# CONFIG_BOOTMEDIA_SMM_BWP is not set
# end of Security
CONFIG_ACPI_HAVE_PCAT_8259=y
@@ -804,6 +811,9 @@ CONFIG_DECOMPRESS_OFAST=y
# Boot Logo Configuration
#
# CONFIG_BMP_LOGO is not set
CONFIG_PLATFORM_POST_RENDER_DELAY_SEC=5
CONFIG_PLATFORM_OFF_MODE_CHARGING_INDICATOR_LOGO_PATH="3rdparty/blobs/mainboard/$(MAINBOARDDIR)/off_mode_charging.bmp"
# CONFIG_FRAMEBUFFER_SPLASH_TEXT is not set
# end of Boot Logo Configuration
CONFIG_WARNINGS_ARE_ERRORS=y
@@ -150,7 +150,7 @@ CONFIG_MEMLAYOUT_LD_FILE="src/arch/x86/memlayout.ld"
# CONFIG_FATAL_ASSERTS is not set
CONFIG_INTEL_GMA_VBT_FILE="src/mainboard/$(MAINBOARDDIR)/data.vbt"
CONFIG_PRERAM_CBMEM_CONSOLE_SIZE=0xc00
CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="OptiPlex 7020/9020 SFF"
CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="Precision T1700 MT"
# CONFIG_CONSOLE_POST is not set
CONFIG_MAX_SOCKET=1
CONFIG_CMOS_DEFAULT_FILE="src/mainboard/$(MAINBOARDDIR)/cmos.default"
@@ -148,7 +148,7 @@ CONFIG_MEMLAYOUT_LD_FILE="src/arch/x86/memlayout.ld"
# CONFIG_FATAL_ASSERTS is not set
CONFIG_INTEL_GMA_VBT_FILE="src/mainboard/$(MAINBOARDDIR)/data.vbt"
CONFIG_PRERAM_CBMEM_CONSOLE_SIZE=0xc00
CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="OptiPlex 7020/9020 SFF"
CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="Precision T1700 MT"
# CONFIG_CONSOLE_POST is not set
CONFIG_MAX_SOCKET=1
CONFIG_CMOS_DEFAULT_FILE="src/mainboard/$(MAINBOARDDIR)/cmos.default"
@@ -150,7 +150,7 @@ CONFIG_MEMLAYOUT_LD_FILE="src/arch/x86/memlayout.ld"
# CONFIG_FATAL_ASSERTS is not set
CONFIG_INTEL_GMA_VBT_FILE="src/mainboard/$(MAINBOARDDIR)/data.vbt"
CONFIG_PRERAM_CBMEM_CONSOLE_SIZE=0xc00
CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="OptiPlex 7020/9020 SFF"
CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="Precision T1700 SFF"
# CONFIG_CONSOLE_POST is not set
CONFIG_MAX_SOCKET=1
CONFIG_CMOS_DEFAULT_FILE="src/mainboard/$(MAINBOARDDIR)/cmos.default"
@@ -148,7 +148,7 @@ CONFIG_MEMLAYOUT_LD_FILE="src/arch/x86/memlayout.ld"
# CONFIG_FATAL_ASSERTS is not set
CONFIG_INTEL_GMA_VBT_FILE="src/mainboard/$(MAINBOARDDIR)/data.vbt"
CONFIG_PRERAM_CBMEM_CONSOLE_SIZE=0xc00
CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="OptiPlex 7020/9020 SFF"
CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="Precision T1700 SFF"
# CONFIG_CONSOLE_POST is not set
CONFIG_MAX_SOCKET=1
CONFIG_CMOS_DEFAULT_FILE="src/mainboard/$(MAINBOARDDIR)/cmos.default"
+2 -2
View File
@@ -24,5 +24,5 @@ payload_uboot=""
cbfscfg=""
premake="corebootpremake"
mkhelper="coreboot_pad_one_byte"
postmake="mkcorebootbin"
mkhelper="$if_not_dry_build coreboot_pad_one_byte"
postmake="$if_not_dry_build mkcorebootbin"
+2 -2
View File
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
bootstrapargs="--gnulib-srcdir=gnulib/ --no-git"
autoconfargs="--with-platform=coreboot --disable-werror"
configureargs="--with-platform=coreboot --disable-werror"
makeargs="FS_PAYLOAD_MODULES=\"\""
buildtype="autohell"
mkhelper="mkpayload_grub"
mkhelper="$if_not_dry_build mkpayload_grub"
+2 -1
View File
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: GPL-3.0-or-later
postmake="copyps1bios"
mkhelper="$if_not_dry_build copyps1bios"
postmake="$if_not_dry_build copyps1bios"
+1 -1
View File
@@ -6,7 +6,7 @@ acpica arm-none-eabi-binutils arm-none-eabi-gcc arm-none-eabi-newlib \
autogen base-devel bison cdrtools cmake curl device-mapper doxygen \
dtc e2fsprogs flex freetype2 fuse2 gawk gcc-ada gdb gettext git \
help2man innoextract libftdi libgpiod libjaylink libpciaccess libusb nasm \
ncurses openssl 7zip ccache less libx86 \
ncurses openssl 7zip less libx86 \
pandoc parted pciutils perl perl-libwww python python-setuptools rsync \
sharutils subversion swig texinfo ttf-dejavu unarchiver unzip wget xz zlib mtools \
"
+1 -1
View File
@@ -13,6 +13,6 @@ libsdl2-dev libselinux1-dev libssl-dev libtool libusb-1.0-0 libusb-1.0-0-dev \
libusb-dev lz4 lzma lzma-alone m4 nasm openssl 7zip parted pciutils \
perl pkg-config python3 python3-distutils-extra python3-pkg-resources python3-pycryptodome \
python3-pyelftools python3-setuptools python-is-python3 sharutils swig unar \
unifont unifont-bin unzip uuid-dev wget xfonts-unifont zlib1g-dev ccache \
unifont unifont-bin unzip uuid-dev wget xfonts-unifont zlib1g-dev \
g++-mipsel-linux-gnu make genisoimage mtools libx86-1 libx86-dev libstdc++-arm-none-eabi-newlib autoconf-archive \
"
+1 -1
View File
@@ -10,5 +10,5 @@ innoextract intltool libftdi-devel libselinux-devel libusb1 libusb1-devel \
nasm ncurses-devel openssl-devel p7zip p7zip-plugins pandoc parted \
pciutils-devel perl perl-libwww-perl python-unversioned-command python3 \
python3-setuptools rsync sharutils subversion texinfo unar unifont \
unifont-fonts unifont-ttf-fonts unzip wget xz zlib-devel ccache swig \
unifont-fonts unifont-ttf-fonts unzip wget xz zlib-devel swig \
"
+1 -1
View File
@@ -11,5 +11,5 @@ libselinux-devel libusb1 libusb1-devel nasm ncurses-devel openssl-devel \
p7zip p7zip-plugins pandoc parted pciutils-devel perl perl-libwww-perl \
python-unversioned-command python3 python3-setuptools rsync sharutils \
subversion systemd-devel texinfo unar unifont unifont-fonts \
unifont-ttf-fonts unzip wget xz zlib-devel ccache swig python3-devel \
unifont-ttf-fonts unzip wget xz zlib-devel swig python3-devel \
"
+1 -1
View File
@@ -11,6 +11,6 @@ libselinux-devel libusb1 libusb1-devel nasm ncurses-devel openssl-devel openssl-
p7zip p7zip-plugins pandoc parted pciutils-devel perl perl-libwww-perl \
python-unversioned-command python3 python3-setuptools rsync sharutils \
subversion systemd-devel texinfo unar unifont unifont-fonts uuid-devel \
unifont-ttf-fonts unzip wget xz zlib-devel ccache swig python3-devel \
unifont-ttf-fonts unzip wget xz zlib-devel swig python3-devel \
libuuid-devel gnutls-devel \
"
+1 -1
View File
@@ -11,6 +11,6 @@ libselinux-devel libusb1 libusb1-devel nasm ncurses-devel openssl-devel openssl-
p7zip p7zip-plugins pandoc parted pciutils-devel perl perl-libwww-perl \
python-unversioned-command python3 python3-setuptools rsync sharutils \
subversion systemd-devel texinfo unifont unifont-fonts uuid-devel \
unifont-ttf-fonts unzip wget xz zlib-devel ccache swig python3-devel \
unifont-ttf-fonts unzip wget xz zlib-devel swig python3-devel \
libuuid-devel gnutls-devel tar unar libtool \
"
+1 -1
View File
@@ -11,6 +11,6 @@ libselinux-devel libusb1 libusb1-devel nasm ncurses-devel openssl-devel openssl-
p7zip p7zip-plugins pandoc parted pciutils-devel perl perl-libwww-perl \
python-unversioned-command python3 python3-setuptools rsync sharutils \
subversion systemd-devel texinfo unifont unifont-fonts uuid-devel \
unifont-ttf-fonts unzip wget xz zlib-devel ccache swig python3-devel \
unifont-ttf-fonts unzip wget xz zlib-devel swig python3-devel \
libuuid-devel gnutls-devel tar unar libtool \
"
+1 -1
View File
@@ -11,7 +11,7 @@ dev-libs/libgpiod app-arch/sharutils dev-libs/libtomcrypt sys-devel/autogen \
media-libs/freetype sys-fs/e2fsprogs sys-fs/lvm2 dev-libs/libusb \
sys-block/parted sys-fs/mtools app-arch/lz4 dev-libs/leancrypto sys-fs/fuse \
sys-apps/dtc net-libs/gnutls net-misc/curl dev-build/cmake dev-vcs/git \
dev-util/ccache dev-embedded/libftdi app-arch/innoextract sys-devel/gcc \
dev-embedded/libftdi app-arch/innoextract sys-devel/gcc \
sys-apps/pciutils app-crypt/efitools gnustep-base/gnustep-make gnustep-base/gnustep-base \
app-arch/unar app-arch/7zip dev-lang/python dev-python/setuptools dev-python/ply \
sys-libs/libselinux dev-python/pyelftools dev-python/pycparser dev-python/cffi \
+1 -1
View File
@@ -12,6 +12,6 @@ libpython3-dev libsdl2-dev libselinux1-dev libssl-dev libtool libusb-1.0-0 \
libusb-1.0-0-dev lz4 lzma lzma-alone m4 nasm openssl p7zip p7zip-full parted \
pciutils perl pkg-config python3 python3-pkg-resources python3-pycryptodome \
python3-pyelftools python3-setuptools python-is-python3 sharutils swig \
fonts-unifont unar unifont unzip uuid-dev wget zlib1g-dev ccache \
fonts-unifont unar unifont unzip uuid-dev wget zlib1g-dev \
g++-mipsel-linux-gnu make genisoimage mtools \
"
+1 -1
View File
@@ -8,5 +8,5 @@ freetype freetype-devel fuse gawk gcc-ada gdb gettext gettext-devel git \
gnutls-devel help2man innoextract libftdi1 libpciaccess libusb libuuid-devel \
nasm ncurses ncurses-devel openssl openssl-devel 7zip parted pciutils perl \
perl-LWP python python3 python3-devel python3-setuptools rsync sharutils \
subversion swig texinfo unar unzip wget xz zlib ccache \
subversion swig texinfo unar unzip wget xz zlib \
"
-1
View File
@@ -2,4 +2,3 @@
makeargs="-f lbmkbofhmakefile"
cleanargs="-f lbmkbofhmakefile"
mkhelper="copyps1bios"
-17
View File
@@ -1,17 +0,0 @@
# SPDX-License-Identifier: GPL-3.0-or-later
. "include/lib.sh"
. "include/init.sh"
. "include/vendor.sh"
. "include/mrc.sh"
. "include/inject.sh"
. "include/rom.sh"
. "include/release.sh"
. "include/get.sh"
xbcommands=" \
version \
release \
download \
inject \
"
+20 -37
View File
@@ -9,47 +9,43 @@ eval "`newvar url bkup_url depend loc subcurl subcurl_bkup subgit subgit_bkup \
tmpgit="$xbtmp/gitclone"
tmpgitcache="$xbtmp/tmpgit"
fetch_targets()
multi_tree_fetch()
{
[ -d "src/$project/$tree" ] && \
return 0
[ -d "src/$project/$tree" ] && return 0
git_prep "$url" "$bkup_url" "$xbmkpwd/$configdir/$tree/patches" \
"src/$project/$tree" "submod"
}
fetch_project()
single_tree_fetch()
{
xgcctree=""
. "config/git/$project/pkg.cfg" || \
err "Can't read config 'config/git/$project/pkg.cfg'" \
"fetch_project" "@"
"single_tree_fetch" "@"
if [ -z "$url" ] || [ -z "$bkup_url" ]; then
err "url/bkup_url not both set 'config/git/$project/pkg.cfg'" \
"fetch_project" "$@"
"single_tree_fetch" "$@"
fi
[ -n "$xgcctree" ] && \
x_ ./mk -f coreboot "$xgcctree"
x_ "$mk" -f coreboot "$xgcctree"
[ -n "$depend" ] && \
for d in $depend ; do
x_ ./mk -f $d
x_ "$mk" -f $d
done
clone_project
$if_single_tree \
clone_project; :
}
clone_project()
{
singletree "$project" || \
return 0
loc="src/$project"
[ -d "$loc" ] && \
return 0
[ -d "$loc" ] && return 0
remkdir "${tmpgit%/*}"
git_prep "$url" "$bkup_url" "$xbmkpwd/config/$project/patches" "$loc"
@@ -81,9 +77,7 @@ fetch_submodule()
mcfgdir="$mdir/${1##*/}"
eval "`newvar st subcurl subcurl_bkup subgit subgit_bkup subhash`"
if e "$mcfgdir/module.cfg" f missing; then
return 0
fi
e "$mcfgdir/module.cfg" f missing && return 0
. "$mcfgdir/module.cfg" || \
err "Can't read '$mcfgdir/module.cfg'" "fetch_submodules" "$@"
@@ -119,8 +113,7 @@ xbget()
err "empty URL given in" "xbget" "$@"
try_fetch_$1 "$url" "$@" || \
continue
[ -e "$4" ] && \
return 0; : # successful download/copy
[ -e "$4" ] && return 0; : # successful download/copy
done
err "failed to download file/repository" "xbget" "$@"; :
@@ -174,10 +167,8 @@ try_fetch_curl()
try_$2 "$cached" "$@" || \
return 1
[ -f "$5" ] && \
if bad_checksum "$6" "$5" 2>/dev/null; then
x_ cp "$cached" "$5"
fi
[ -f "$5" ] && bad_checksum "$6" "$5" 2>/dev/null && \
x_ cp "$cached" "$5"
if [ ! -f "$cached" ]; then
return 1
@@ -202,8 +193,7 @@ try_curl()
ua="Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0"
( x_ curl --location --retry 3 -A "$ua" "$2" -o "$1" ) \
|| ( x_ wget --tries 3 -U "$ua" "$2" -O "$1" ) \
|| return 1; :
|| ( x_ wget --tries 3 -U "$ua" "$2" -O "$1" ) || return 1; :
}
try_copy()
@@ -230,15 +220,9 @@ try_git()
x_ mv "$tmpgitcache" "$gitdest"
fi
if git -C "$gitdest" show "$7" 1>/dev/null 2>/dev/null && \
[ "$forcepull" != "y" ]; then
# don't try to pull the latest changes if the given target
# revision already exists locally. this saves a lot of time
# during release builds, and reduces the chance that we will
# interact with grub.git or gnulib.git overall during runtime
return 0
fi
git -C "$gitdest" show "$7" 1>/dev/null 2>/dev/null && \
[ "$forcepull" != "y" ] && \
return 0 # don't pull changes if target rev exists locally
if [ "$XBMK_CACHE_MIRROR" = "y" ]; then
( x_ git -C "$gitdest" fetch ) || :; :
@@ -250,11 +234,10 @@ try_git()
bad_checksum()
{
if e "$2" f missing; then
e "$2" f missing && \
return 0
fi
build_sbase
eval "$build_sbase"
csum="$(x_ "$sha512sum" "$2" | awk '{print $1}')" || \
err "!sha512 '$2' $1" bad_checksum "$@"
+25 -35
View File
@@ -8,15 +8,12 @@
projectname="libreboot"
projectsite="https://libreboot.org/"
sha512sum="util/sbase/sha512sum"
eval "`newvar aur_notice basetmp board checkvarschk checkvarsxbmk configdir \
datadir is_child python pyver reinstall relname version versiondate \
xbmklock xbmkpath xbmkpwd xbmkpwd xbtmp`"
xbmklock xbmkpath xbtmp sha512sum`"
xbmk_init()
{
xbmkpwd="`pwd || err "Cannot generate PWD"`" || err "!" xbmk_init "$@"
xbmklock="$xbmkpwd/lock"
basetmp="$xbmkpwd/xbmkwd"
sha512sum="$xbmkpwd/util/sbase/sha512sum"
@@ -35,10 +32,8 @@ xbmk_init()
export PWD="$xbmkpwd"
x_ mkdir -p "$basetmp" "cache"
for init_cmd in get_version set_env set_threads git_init child_exec; do
xbmk_$init_cmd "$@" || \
break; :
done
eval "$(printf "get_ver set_env set_threads git_init xchild\n" | awk \
'{ for (i=1; i<=NF; i++) $i = $i " \"$@\" || return 0;"; print }')"
}
xbmkpkg()
@@ -75,19 +70,19 @@ xbmkpkg()
printf "You need AUR packages: %s\n" "$aur_notice" 1>&2; :
}
xbmk_get_version()
get_ver()
{
[ ! -f ".version" ] || \
read -r version < ".version" || \
err "can't read version file" "xbmk_get_version" "$@"
err "can't read version file" "get_ver" "$@"
[ ! -f ".versiondate" ] || \
read -r versiondate < ".versiondate" || \
err "can't read versiondate" xbmk_get_version "$@"
err "can't read versiondate" get_ver "$@"
[ -f ".version" ] && [ -z "$version" ] && \
err "version not set" "xbmk_get_version" "$@"
err "version not set" "get_ver" "$@"
[ -f ".versiondate" ] && [ -z "$versiondate" ] && \
err "versiondate not set" "xbmk_get_version" "$@"
err "versiondate not set" "get_ver" "$@"
[ ! -e ".git" ] && [ ! -f ".version" ] && \
version="unknown"
@@ -103,7 +98,7 @@ xbmk_get_version()
# a parent instance will cause this function to return 0.
# a child instance will return 1, skipping further initialisation
# after this function is called.
xbmk_set_env()
set_env()
{
is_child="n"
xbmkpath="$PATH"
@@ -130,9 +125,9 @@ xbmk_child_set_env()
xbmk_child_set_tmp
[ -z "${XBMK_CACHE+x}" ] && \
err "XBMK_CACHE unset on child" "xbmk_set_env" "$@"
err "XBMK_CACHE unset on child" "set_env" "$@"
[ -z "${XBMK_THREADS+x}" ] && \
xbmk_set_threads
set_threads
[ -z "${XBMK_CACHE_MIRROR+x}" ] && \
xbmk_set_mirror; :
}
@@ -162,7 +157,7 @@ xbmk_parent_set_env()
xbmk_parent_check_tmp
printf "%s\n" "$xbtmp" > "$xbmklock" || \
err "cannot create '$xbmklock'" xbmk_set_env "$@"; :
err "cannot create '$xbmklock'" set_env "$@"; :
# not really critical for security, but it's a barrier
# against the user to make them think twice before deleting it
@@ -170,13 +165,11 @@ xbmk_parent_set_env()
x_ chmod -w "$xbmklock"
xbmk_parent_set_export
xbmk_set_version
forx 'xbmk_%s' parent_set_export set_version
remkdir "$xbtmp" "$xbtmp/gnupath" "$xbtmp/xbmkpath"
remkdir "$xbtmp" "$xbtmp/xbmkpath"
xbmk_set_pyver
xbmk_set_mirror
forx 'xbmk_set_%s' pyver mirror
}
xbmk_parent_check_tmp()
@@ -190,11 +183,10 @@ xbmk_parent_check_tmp()
x_ touch "$xbmklist"
for xtmpdir in "$basetmp"/xbmk_*; do
if [ -e "$xtmpdir" ]; then
[ ! -e "$xtmpdir" ] || \
printf "%s\n" "$xtmpdir" >> "$xbmklist" || \
err "can't write '$xtmpdir' to '$xbmklist'" \
"xbmk_parent_check_tmp" "$@"; :
fi
done
# set up a unified temporary directory, for common deletion later:
@@ -219,7 +211,7 @@ xbmk_parent_set_export()
err "cachedir '$XBMK_CACHE' is a file" \
"xbmk_parent_set_export" "$@"
export PATH="$xbtmp/xbmkpath:$xbtmp/gnupath:$PATH"
export PATH="$xbtmp/xbmkpath:$PATH"
xbmkpath="$PATH"
# if "y": a coreboot target won't be built if target.cfg says release=n
@@ -233,7 +225,7 @@ xbmk_parent_set_export()
export XBMK_RELEASE="n"; :
}
xbmk_set_threads()
set_threads()
{
[ -z "${XBMK_THREADS+x}" ] && \
export XBMK_THREADS=1
@@ -352,18 +344,18 @@ xbmk_set_mirror()
export XBMK_CACHE_MIRROR="n"; :
}
xbmk_git_init()
git_init()
{
# the git identity check is only needed for: ./mk -b coreboot [args]
# the git identity check is only needed for: "$mk" -b coreboot [args]
[ "${2-}" = "-b" ] && [ "${3-}" = "coreboot" ] && \
for gitarg in "user.name" "user.email"; do
git config --includes $gitarg 1>/dev/null 2>/dev/null || \
err "Run this first: $gitcmd \"your ${gitcmd##*.}\"" \
"xbmk_git_init" "$@"; :
"git_init" "$@"; :
done
[ -L ".git" ] && \
err "'$xbmkpwd/.git' is a symlink" "xbmk_git_init" "$@"
err "'$xbmkpwd/.git' is a symlink" "git_init" "$@"
[ -e ".git" ] && \
return 0
@@ -380,19 +372,17 @@ xbmk_git_init()
tag -a "$version" -m "$projectname $version" \
1>/dev/null 2>/dev/null; :
) || err "Can't initialise workdir" xbmk_git_init "$@"; :
) || err "Can't initialise workdir" git_init "$@"; :
}
xbmk_child_exec()
xchild()
{
xbmk_rval=0
( x_ ./mk "$@" ) || xbmk_rval=1
( x_ "$mk" "$@" ) || xbmk_rval=1
( x_ rm -Rf "$xbtmp" ) || xbmk_rval=1
( x_ rm -f "$xbmklock" ) || xbmk_rval=1
exit $xbmk_rval
}
xbmk_init "$@"
+17 -37
View File
@@ -12,21 +12,17 @@ ifdtool="elf/coreboot/default/ifdtool"
checkvars="CONFIG_GBE_BIN_PATH ${checkvarsxbmk-} ${checkvarschk-}"
eval "`newvar archive board boarddir IFD_platform ifdprefix \
new_mac tmpromdir tree xchanged $checkvars`"
new_mac nuke tmpromdir tree xchanged $checkvars`"
inject()
{
remkdir "$tmpromdel"
[ $# -lt 1 ] && \
err "No options specified" "inject" "$@"
[ $# -lt 1 ] && err "No options specified" "inject" "$@"
archive="$1";
new_mac="xx:xx:xx:xx:xx:xx"
nuke=""
xchanged=""
[ $# -gt 1 ] && case "$2" in
nuke)
new_mac=""
@@ -48,18 +44,11 @@ inject()
check_release
if check_target; then
patch_release || \
return 0; :
patch_release || return 0
fi
[ "$xchanged" = "y" ] && \
remktar
if [ "$xchanged" = "y" ]; then
printf "\n'%s' was modified\n" "$archive" 1>&2
else
printf "\n'%s' was NOT modified\n" "$archive" 1>&2
fi
x_ rm -Rf "$tmpromdel"
}
@@ -67,9 +56,8 @@ check_release()
{
[ -L "$archive" ] && \
err "'$archive' is a symlink" "check_release" "$@"
if e "$archive" f missing; then
e "$archive" f missing && \
err "'$archive' missing" "check_release" "$@"
fi
archivename="`basename "$archive" || err "Can't get '$archive' name"`" \
|| err "can't get '$archive' name" "check_release" "$@"
@@ -95,8 +83,7 @@ check_release()
check_target()
{
[ "$board" != "${board#serprog_}" ] && \
return 1
[ "$board" = "${board#serprog_}" ] || return 1
boarddir="$cbcfgsdir/$board"
@@ -106,10 +93,9 @@ check_target()
[ -z "$tree" ] && \
err "tree unset in '$boarddir/target.cfg'" "check_target" "$@"
x_ ./mk -d coreboot "$tree"
x_ "$mk" -d coreboot "$tree"
ifdtool="elf/coreboot/$tree/ifdtool"
[ -n "$IFD_platform" ] && \
ifdprefix="-p $IFD_platform"; :
}
@@ -117,7 +103,7 @@ check_target()
patch_release()
{
[ "$nuke" != "nuke" ] && \
x_ ./mk download "$board"
x_ "$mk" download "$board"
has_hashes="n"
tmpromdir="$tmpromdel/bin/$board"
@@ -134,8 +120,7 @@ patch_release()
fi
done
readkconfig || \
return 1
readkconfig || return 1
[ -n "$new_mac" ] && [ -n "$CONFIG_GBE_BIN_PATH" ] && \
modify_mac; :
@@ -146,15 +131,13 @@ readkconfig()
x_ rm -f "$xbtmp/cbcfg"
fx_ scankconfig x_ find "$boarddir/config" -type f
if e "$xbtmp/cbcfg" f missing; then
e "$xbtmp/cbcfg" f missing && \
return 1
fi
. "$xbtmp/cbcfg" || \
err "Can't read '$xbtmp/cbcfg'" "readkconfig" "$@"
setvfile "$@" || \
return 1; :
setvfile "$@" || return 1; :
}
scankconfig()
@@ -169,13 +152,12 @@ modify_mac()
x_ cp "${CONFIG_GBE_BIN_PATH##*../}" "$xbtmp/gbe"
if [ -n "$new_mac" ] && [ "$new_mac" != "restore" ]; then
x_ make -C util/nvmutil clean
x_ make -C util/nvmutil
forx 'x_ make -C util/nvmutil %s' clean nvmutil
x_ "$nvmutil" "$xbtmp/gbe" setmac "$new_mac"
fi
fx_ newmac x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom"
fx_ newmac x_ find "$tmpromdir" -mindepth 1 -maxdepth 1 \
-type f -name "*.rom"
printf "\nThe following GbE NVM data will be written:\n"
x_ "$nvmutil" "$xbtmp/gbe" dump | grep -v "bytes read from file" || :
@@ -183,10 +165,9 @@ modify_mac()
newmac()
{
if e "$1" f; then
xchanged="y"
x_ "$ifdtool" $ifdprefix -i GbE:"$xbtmp/gbe" "$1" -O "$1"
fi
e "$1" f || return 0
xchanged="y"
x_ "$ifdtool" $ifdprefix -i GbE:"$xbtmp/gbe" "$1" -O "$1"
}
remktar()
@@ -200,6 +181,5 @@ remktar()
) || err "Cannot re-generate '$archive'" "remktar" "$@"
mv "${tmpromdir%"/bin/$board"}/bin/${relname}_${board}.tar.xz" \
"$archive" || \
err "'$archive' -> Can't overwrite" "remktar" "$@"; :
"$archive" || err "'$archive' -> Can't overwrite" "remktar" "$@"; :
}
+28 -93
View File
@@ -25,9 +25,6 @@ buildser()
copyps1bios()
{
$if_dry_build \
return 0
remkdir "bin/playstation"
x_ cp src/pcsx-redux/src/mips/openbios/openbios.bin bin/playstation
@@ -43,9 +40,6 @@ mkpayload_grub()
{
eval "`newvar grub_modules grub_install_modules`"
$if_dry_build \
return 0
. "$grubdata/module/$tree" || \
err "Can't read '$grubdata/module/$tree'" "mkpayload_grub" "$@"
@@ -65,33 +59,21 @@ corebootpremake()
[ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ] && \
return 0
$if_not_dry_build \
cook_coreboot_config
fx_ check_coreboot_util printf "cbfstool\nifdtool\n"
printf "%s\n" "${version%%-*}" > "$srcdir/.coreboot-version" || \
err "!mk $srcdir .coreboot-version" "corebootpremake" "$@"
[ -z "$mode" ] && [ "$target" != "$tree" ] && \
x_ ./mk download "$target"; :
}
cook_coreboot_config()
{
if [ -z "$mode" ] && [ -f "$srcdir/.config" ]; then
printf "CONFIG_CCACHE=y\n" >> "$srcdir/.config" || \
err "can't cook '$srcdir'" "cook_coreboot_config" "$@"
fi
[ "$target" != "$tree" ] && \
x_ "$mk" download "$target"; :
}
check_coreboot_util()
{
[ "$badhash" = "y" ] && \
x_ rm -f "elf/coreboot/$tree/$1"
if e "elf/coreboot/$tree/$1" f; then
e "elf/coreboot/$tree/$1" f && \
return 0
fi
utilelfdir="elf/coreboot/$tree"
utilsrcdir="src/coreboot/$tree/util/$1"
@@ -121,8 +103,7 @@ coreboot_pad_one_byte()
[ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ] && \
return 0
$if_not_dry_build \
pad_one_byte "$srcdir/build/coreboot.rom"
pad_one_byte "$srcdir/build/coreboot.rom"
}
mkcorebootbin()
@@ -130,11 +111,7 @@ mkcorebootbin()
[ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ] && \
return 0
$if_not_dry_build \
check_coreboot_util cbfstool
$if_not_dry_build \
check_coreboot_util ifdtool
forx 'check_coreboot_util %s' cbfstool ifdtool
for y in "$target_dir/config"/*; do
defconfig="$y"
@@ -146,8 +123,7 @@ mkcorebootbin()
mkcorebootbin_real()
{
[ "$target" = "$tree" ] && \
return 0
[ "$target" = "$tree" ] && return 0
tmprom="$xbtmp/coreboot.rom"
@@ -169,11 +145,8 @@ mkcorebootbin_real()
elfrom="${elfrom}_$displaymode"
elfrom="$elfrom/coreboot.rom"
$if_not_dry_build \
x_ cp "$elfrom" "$tmprom"
$if_not_dry_build \
unpad_one_byte "$tmprom"
x_ cp "$elfrom" "$tmprom"
unpad_one_byte "$tmprom"
[ -n "$payload_uboot" ] && [ "$payload_uboot" != "amd64" ] && \
[ "$payload_uboot" != "i386" ] && [ "$payload_uboot" != "arm64" ] \
@@ -188,9 +161,8 @@ mkcorebootbin_real()
[ "$payload_grub" = "y" ] && \
payload_seabios="y"
[ "$payload_seabios" = "y" ] && [ "$payload_uboot" = "arm64" ] && \
$if_not_dry_build \
err "$target: U-Boot arm / SeaBIOS/GRUB both enabled" \
"mkcorebootbin_real" "$@"
err "$target: U-Boot arm / SeaBIOS/GRUB both enabled" \
"mkcorebootbin_real" "$@"
[ -z "$grub_scan_disk" ] && \
grub_scan_disk="nvme ahci ata"
@@ -208,9 +180,6 @@ mkcorebootbin_real()
[ "$payload_grub" != "y" ] && \
payload_grubsea="n"
$if_dry_build \
return 0
[ -f "$cbfscfg" ] && \
dx_ add_cbfs_option "$cbfscfg"
@@ -221,7 +190,8 @@ mkcorebootbin_real()
fi
if [ "$payload_uboot" = "arm64" ]; then
pname="uboot"
add_uboot
add_uboot "" fallback/payload default \
"$target" u-boot.elf
fi
else
pname="custom"
@@ -256,8 +226,8 @@ add_cbfs_option()
add_seabios()
{
[ -n "$payload_uboot" ] && [ "$payload_uboot" != "arm64" ] && \
$if_not_dry_build \
add_uboot # add u-boot first, due to fixed cbfs offset
[ "$displaymode" != "txtmode" ] && [ "$initmode" != "normal" ] && \
add_uboot_x86 # u-boot first, due to fixed cbfs offset
_seabioself="elf/seabios/default/default/$initmode/bios.bin.elf"
[ "$initmode" = "fspgop" ] && \
@@ -337,60 +307,28 @@ mkseagrub()
fx_ cprom x_ find "$grubdata/keymap" -type f -name "*.gkb"
}
add_uboot_x86()
{
[ "$payload_uboot" = "amd64" ] && \
add_uboot "-l 0x1110000 -e 0x1110000" "img/u-boot" \
"x86_64" "amd64coreboot" "u-boot-x86-with-spl.bin"
[ "$payload_uboot" = "i386" ] && \
add_uboot "-l 0x1110000 -e 0x1110000" "u-boot" "x86" \
"i386coreboot" "u-boot-dtb.bin"; :
}
add_uboot()
{
if [ "$displaymode" = "txtmode" ]; then
printf "cb/%s: Can't use U-Boot in text mode\n" "$target" 1>&2
return 0
elif [ "$initmode" = "normal" ]; then
printf "cb/%s: Can't use U-Boot in normal initmode\n" \
"$target" 1>&2
return 0
fi
# TODO: re-work to allow each coreboot target to say which ub tree
# instead of hardcoding as in the current logic below:
# aarch64 targets:
ubcbfsargs=""
ubpath="fallback/payload"
ubtree="default"
ubtarget="$target"
# override for x86/x86_64 targets:
if [ -n "$payload_uboot" ] && [ "$payload_uboot" != "arm64" ]; then
ubcbfsargs="-l 0x1110000 -e 0x1110000" # 64-bit and 32-bit
# on 64-bit, 0x1120000 is the SPL, with a stub that
# loads it, located at 0x1110000
ubpath="img/u-boot" # 64-bit
ubtree="x86_64"
ubtarget="amd64coreboot"
if [ "$payload_uboot" = "i386" ]; then
ubpath="u-boot" # 32-bit
ubtree="x86"
ubtarget="i386coreboot"; :
fi
fi
ubdir="elf/u-boot/$ubtree/$ubtarget/$uboot_config"
ubootelf="$ubdir/u-boot.elf" # aarch64
ubootelf="elf/u-boot/$3/$4/$uboot_config/$5"
[ ! -f "$ubootelf" ] && \
ubootelf="$ubdir/u-boot" # aarch64 (fallback)
[ "$payload_uboot" = "i386" ] && \
ubootelf="$ubdir/u-boot-dtb.bin" # x86 override
[ "$payload_uboot" = "amd64" ] && \
ubootelf="$ubdir/u-boot-x86-with-spl.bin" # x86_64 override
ubootelf="${ubootelf%.elf}" # hack (fix arm64 build)
cbfs "$tmprom" "$ubootelf" "$ubpath" $ubcbfsargs
cbfs "$tmprom" "$ubootelf" "$2" $1
[ "$payload_seabios" != "y" ] && \
cprom; :
}
# prepare the final image in bin/ for user installation:
cprom()
{
cpcmd="cp"
@@ -446,14 +384,11 @@ cbfs()
mkcoreboottar()
{
$if_dry_build \
return 0
if [ "$target" = "$tree" ] || [ "$XBMK_RELEASE" != "y" ] || \
[ "$release" = "n" ]; then
return 0
fi
mkrom_tarball "bin/$target"
x_ ./mk inject "bin/${relname}_${target}.tar.xz" nuke
x_ "$mk" inject "bin/${relname}_${target}.tar.xz" nuke
}
+52 -112
View File
@@ -51,15 +51,12 @@ eval "`newvar DL_hash DL_url DL_url_bkup E6400_VGA_bin_hash E6400_VGA_DL_hash \
download()
{
[ $# -lt 1 ] && \
err "No argument given" "download" "$@"
[ $# -lt 1 ] && err "No argument given" "download" "$@"
export PATH="$PATH:/sbin"
board="$1"
if check_target; then
readkconfig download
fi
check_target && readkconfig download; :
}
getfiles()
@@ -109,56 +106,43 @@ fetch()
dlop="$6"
binsum="$7"
[ -z "$binsum" ] && \
err "binsum is empty (no checksum)" "fetch" "$@"
[ -z "$binsum" ] && err "binsum is empty (no checksum)" "fetch" "$@"
_dl="$XBMK_CACHE/file/$dlsum" # internet file to extract from e.g. .exe
_dl_bin="$XBMK_CACHE/file/$binsum" # extracted file e.g. me.bin
[ "$5" = "/dev/null" ] && \
return 0
[ "$5" = "/dev/null" ] && return 0 # fetch/extract disabled
# an extracted vendor file will be placed in pre_dest first, for
# verifying its checksum. if it matches, it is later moved to _dest
remkdir "${_pre_dest%/*}" "$appdir"
# HACK: if grabbing fsp from coreboot, fix the path for lbmk
if [ "$dl_type" = "fsp" ]; then
dl="${dl##*../}"
_cdp="$dl"
[ "$dl_type" = "fsp" ] && for bkup in "" "_bkup"; do
eval "dl$bkup=\"\${dl$bkup##*../}\""
eval "_cdp=\"\$dl$bkup\""
[ ! -f "$_cdp" ] && \
_cdp="$cbdir/$_cdp"
[ -f "$_cdp" ] && \
dl="$_cdp"
dl_bkup="${dl_bkup##*../}"
_cdp="$dl_bkup"
[ ! -f "$_cdp" ] && \
_cdp="$cbdir/$_cdp"
[ -f "$_cdp" ] && \
dl_bkup="$_cdp"; :
fi
eval "dl$bkup=\"\$_cdp\""; :
done; :
# download the file (from the internet) to extract from:
xbget "$dlop" "$dl" "$dl_bkup" "$_dl" "$dlsum"
x_ rm -Rf "${_dl}_extracted"
# skip extraction if a cached extracted file exists:
( xbget copy "$_dl_bin" "$_dl_bin" "$_dest" "$binsum" 2>/dev/null ) || :
[ -f "$_dest" ] && \
return 0
x_ mkdir -p "${_dest%/*}"
if [ "$dl_type" != "fsp" ]; then
[ "$dl_type" = "fsp" ] || \
extract_archive "$_dl" "$appdir" || \
[ "$dl_type" = "e6400vga" ] || \
err "$_dest $dl_type: !extract" "fetch" "$@"
fi
x_ extract_$dl_type "$_dl" "$appdir"
set -u -e
@@ -169,39 +153,26 @@ fetch()
( fx_ "mkdst $binsum" x_ find "${_pre_dest%/*}" -type f ) || :
bad_checksum "$binsum" "$_dest" || \
[ ! -f "$_dest" ] || \
return 0; :
[ ! -f "$_dest" ] || return 0; :
[ -z "$binsum" ] && \
printf "'%s': checksum undefined\n" "$_dest" 1>&2
if [ -L "$_dest" ]; then
printf "WARNING: '%s' is a link!\n" "$_dest" 1>&2
else
x_ rm -f "$_dest"
fi
x_ rm -f "$_dest"
[ -z "$binsum" ] && printf "WARNING: %s: no checksum\n" "$_dest" 1>&2
err "Can't safely extract '$_dest', for board '$board'" "fetch" "$@"
}
mkdst()
{
if bad_checksum "$1" "$2" 2>/dev/null; then
x_ rm -f "$2"
else
if ! bad_checksum "$1" "$2" 2>/dev/null; then
x_ mv "$2" "$_dl_bin"
x_ cp "$_dl_bin" "$_dest"
exit 1
fi
x_ rm -f "$2"
}
extract_intel_me()
{
if e "$mecleaner" f missing; then
err "$cbdir: me_cleaner missing" "extract_intel_me" "$@"
fi
mfs=""
_7ztest="$xbtmp/metmp/a"
_metmp="$xbtmp/me.bin"
@@ -223,7 +194,7 @@ extract_intel_me()
"extract_intel_me" "$@"
fi
x_ ./mk -f deguard
x_ "$mk" -f deguard
fi
set +u +e
@@ -244,29 +215,24 @@ extract_intel_me()
# must be called inside a subshell.
find_me()
{
[ -f "$_metmp" ] && \
exit 1 # me.bin found
[ -L "$1" ] && \
return 0 # symlinks disabled for security reasons
[ -f "$_metmp" ] && exit 1 # me.bin found
[ -L "$1" ] && return 0 # symlinks disabled for security reasons
_7ztest="${_7ztest}a"
_keep="" # -k: keep fptr modules even if they can be removed
_pass="" # -p: skip fptr check
_r="-r" # re-locate modules
_trunc="-t" # -t: truncate the ME size
eval "`newvar _keep _pass`" # -k (keep fptr modules), -p (skip checks)
[ "$ME11bootguard" = "y" ] && \
mfs="--whitelist MFS"
if [ "$MEclean" = "n" ]; then
MEshrink="n"
_keep="-k" # keep ME modules, don't delete anything
mfs="" # no MFS whitelist needed, due to -r:
fi
if [ "$MEclean" = "n" ] || [ "$MEshrink" != "y" ]; then
_r="" # don't re-locate ME modules
_trunc="" # don't shrink the me.bin file size
eval "`newvar _r _trunc`"
fi
[ "$MEcheck" = "n" ] && \
_pass="-p" # skip fptr check
@@ -287,8 +253,7 @@ find_me()
return 0 # can't extract, so try the next file
fi
[ -f "$_metmp" ] && \
exit 1 # me.bin found
[ -f "$_metmp" ] && exit 1 # me.bin found
( fx_ find_me x_ find "$_7ztest" -type f ) || exit 1; : # 1==me found
}
@@ -304,19 +269,12 @@ apply_deguard_hack()
extract_archive()
{
if innoextract "$1" -d "$2"; then
:
elif python "$pfs_extract" "$1" -e; then
:
elif 7z x "$1" -o"$2"; then
:
elif "$bsdtar" -C "$2" -xf "$1"; then
:
elif "$bsdunzip" "$1" -d "$2"; then
:
else
innoextract "$1" -d "$2" || \
python "$pfs_extract" "$1" -e || \
7z x "$1" -o"$2" || \
"$bsdtar" -C "$2" -xf "$1" || \
"$bsdunzip" "$1" -d "$2" || \
return 1
fi
[ -d "${_dl}_extracted" ] && \
x_ cp -R "${_dl}_extracted" "$2"; :
@@ -338,24 +296,16 @@ extract_kbc1126ec_dump()
{
x_ cd "$appdir/"
if mv Rompaq/68*.BIN ec.bin; then
:
elif unar -D ROM.CAB Rom.bin; then
:
elif unar -D Rom.CAB Rom.bin; then
:
elif unar -D 68*.CAB Rom.bin; then
:
else
mv Rompaq/68*.BIN ec.bin || \
unar -D ROM.CAB Rom.bin || \
unar -D Rom.CAB Rom.bin || \
unar -D 68*.CAB Rom.bin || \
err "!kbc1126 unar" "extract_kbc1126ec" "$@"
fi
[ ! -f "ec.bin" ] && \
x_ mv Rom.bin ec.bin
[ -f "ec.bin" ] || x_ mv Rom.bin ec.bin
if x_ e ec.bin f; then
x_ "$kbc1126_ec_dump" ec.bin
fi
x_ e ec.bin f
x_ "$kbc1126_ec_dump" ec.bin
}
extract_e6400vga()
@@ -376,6 +326,8 @@ extract_e6400vga()
) || err "can't extract e6400 vga rom" "extract_e6400vga" "$@"
x_ cp "$appdir/$E6400_VGA_romname" "$_pre_dest"
set -u -e
}
extract_sch5545ec()
@@ -396,8 +348,7 @@ extract_sch5545ec()
# https://pcsupport.lenovo.com/us/en/products/laptops-and-netbooks/thinkpad-t-series-laptops/thinkpad-t480-type-20l5-20l6/20l5/solutions/ht508988
extract_tbfw()
{
[ -z "$TBFW_size" ] && \
err "$board: TBFW_size unset" "extract_tbfw" "$@"
[ -z "$TBFW_size" ] && err "$board: TBFW_size unset" extract_tbfw "$@"
fx_ copytb x_ find "$appdir" -type f -name "TBT.bin"
}
@@ -428,17 +379,15 @@ setvfile()
eval "$vcmd && do_getvfile=\"y\""
[ "$do_getvfile" = "y" ] && \
if getvfile "$@"; then
return 0
fi; :
getvfile "$@" && \
return 0; :
done && return 1; :
}
getvfile()
{
if e "config/vendor/$vcfg/pkg.cfg" f missing; then
e "config/vendor/$vcfg/pkg.cfg" f missing && \
return 1
fi
. "config/vendor/$vcfg/pkg.cfg" || \
err "Can't read 'config/vendor/$vcfg/pkg.cfg'" "getvfile" "$@"
@@ -446,13 +395,10 @@ getvfile()
bootstrap
if [ $# -gt 0 ]; then
# download vendor files
getfiles
else
# inject vendor files
fx_ prep x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom"
getfiles # ./mk download
else # ./mk inject
fx_ prep x_ find "$tmpromdir" -mindepth 1 -maxdepth 1 \
-type f -name "*.rom"
( check_vendor_hashes ) || \
err "$archive: Can't verify hashes" "getvfile" "$@"; :
fi
@@ -470,20 +416,17 @@ bootstrap()
[ "$XBMKmecleaner" = "y" ] && \
mecleaner="$xbmkpwd/src/me_cleaner/me_cleaner.py"
x_ ./mk -f coreboot "${cbdir##*/}"
x_ ./mk -f me_cleaner
x_ "$mk" -f coreboot "${cbdir##*/}"
x_ "$mk" -f me_cleaner
x_ ./mk -b bios_extract
x_ ./mk -b biosutilities
x_ ./mk -b uefitool
x_ ./mk -b libarchive # for bsdtar and bsdunzip
forx 'x_ \"$mk\" -b %s' bios_extract biosutilities uefitool libarchive
[ -d "${kbc1126_ec_dump%/*}" ] && \
x_ make -C "$cbdir/util/kbc1126"
if [ -n "$MRC_refcode_cbtree" ]; then
cbfstoolref="elf/coreboot/$MRC_refcode_cbtree/cbfstool"
x_ ./mk -d coreboot "$MRC_refcode_cbtree"; :
x_ "$mk" -d coreboot "$MRC_refcode_cbtree"; :
fi
}
@@ -496,9 +439,8 @@ prep()
[ "$nuke" = "nuke" ] && \
_xromnew="${_xrom%/*}/$vfix${_xrom##*/}"
if e "$_xrom" f missing; then
e "$_xrom" f missing && \
return 0
fi
[ -z "${_xromname#"$vfix"}" ] && \
err "$_xromname / $vfix: name match" "prep" "$@"
@@ -517,8 +459,7 @@ prep()
( mksha512 "$_xrom" "vendorhashes" ) || err; :
fi
add_vfiles "$_xrom" || \
return 1 # no need to insert files
add_vfiles "$_xrom" || return 1 # no need to insert files
if [ "$nuke" = "nuke" ]; then
pad_one_byte "$_xrom"
@@ -528,7 +469,7 @@ prep()
mksha512()
{
build_sbase
eval "$build_sbase"
[ "${1%/*}" != "$1" ] && \
x_ cd "${1%/*}"
@@ -581,8 +522,7 @@ add_vfiles()
vfile()
{
[ "$2" = "/dev/null" ] && \
return 0
[ "$2" = "/dev/null" ] && return 0
cbfsname="$1"
_dest="${2##*../}"
@@ -627,7 +567,7 @@ vfile()
# must be called from a subshell
check_vendor_hashes()
{
build_sbase
eval "$build_sbase"
x_ cd "$tmpromdir"
+6 -100
View File
@@ -8,6 +8,8 @@
cbfstool="elf/coreboot/default/cbfstool"
rmodtool="elf/coreboot/default/rmodtool"
build_sbase="[ ! -f \"\$sha512sum\" ] && x_ make -C util/sbase"
newvar()
{
printf "%s\n" "$*" | \
@@ -44,13 +46,9 @@ version()
xbmk_sanitize_version()
{
[ -z "$version" ] && \
return 0
version="`printf '%s\n' "$version" | sed \
's/[[:space:]]//g; s/\.\.//g; s/\.\///g; s/\//-/g; s/^-//'`"
[ -z "$version" ] && \
[ -n "$version" ] && version="`printf '%s\n' "$version" | sed \
's/[[:space:]]//g; s/\.\.//g; s/\.\///g; s/\//-/g; s/^-//'`" \
&& [ -z "$version" ] && \
err "'version' empty after sanitization" \
"xbmk_sanitize_version" "$@"; :
}
@@ -84,33 +82,12 @@ e()
printf "%s %s\n" "$1" "$es2" 1>&2
}
# return 0 if project is single-tree, otherwise 1
# e.g. coreboot is multi-tree, so 1
singletree()
{
( fx_ "eval exit 1 && err" find "config/$1/"*/ -type f \
-name "target.cfg" ) || return 1; :
}
findpath()
{
[ $# -lt 1 ] && \
err "findpath: No arguments provided" "findpath" "$@"
while [ $# -gt 0 ]
do
found="`readlink -f "$1" 2>/dev/null`" || return 1; :
if [ -z "$found" ]; then
found="`realpath "$1" 2>/dev/null`" || \
return 1
fi
printf "%s\n" "$found"
shift 1
done
}
pad_one_byte()
{
paddedfile="`mktemp || err "mktemp pad_one_byte"`" || \
@@ -137,12 +114,6 @@ unpad_one_byte()
x_ mv "$unpaddedfile" "$1"
}
build_sbase()
{
[ ! -f "$sha512sum" ] && \
x_ make -C "$xbmkpwd/util/sbase"; :
}
remkdir()
{
x_ rm -Rf "$@"
@@ -173,48 +144,13 @@ dx_()
{
xchk dx_ "$@"
[ ! -f "$2" ] && \
return 0
[ ! -f "$2" ] && return 0
while read -r fx; do
$1 "$fx" || return 1; :
done < "$2" || err "cannot read '$2'" "dx_" "$@"; :
}
x_()
{
[ $# -lt 1 ] && \
return 0
[ -z "$1" ] && \
err "Empty first arg" "x_" "$@"
"$@" || err "Unhandled error" "x_" "$@"
}
xeq()
{
[ $# -lt 2 ] && \
err "no args" xeq
xbcmd="$1"
chk="$2"
shift 2
case "$chk" in
-*)
return 1
;;
*)
for eq in "$@"; do
[ "$chk" = "$eq" ] && \
return 0; :
done
;;
esac
err "bad command" xeq "$xbcmd" "$chk" "$@"
}
xchk()
{
if [ $# -lt 3 ]; then
@@ -223,33 +159,3 @@ xchk()
err "arguments must not be empty" "xchk" "$@"
fi
}
err()
{
if [ $# -eq 1 ]; then
printf "ERROR %s: %s\n" "$0" "$1" 1>&2 || :
elif [ $# -gt 1 ]; then
printf "ERROR %s: %s: in command with args: " "$0" "$1" 1>&2
shift 1
xprintf "$@" 1>&2
else
printf "ERROR, but no arguments provided to err\n" 1>&2
fi
exit 1
}
xprintf()
{
xprintfargs=0
while [ $# -gt 0 ]; do
printf "\"%s\"" "$1"
[ $# -gt 1 ] && \
printf " "
xprintfargs=1
shift 1
done
[ $xprintfargs -gt 0 ] && \
printf "\n"; :
}
+6 -22
View File
@@ -2,23 +2,13 @@
# Copyright (c) 2023-2026 Leah Rowe <leah@libreboot.org>
eval "`newvar reldest reldir relmode rsrc vdir`"
eval "`newvar reldest reldir rsrc vdir`"
release()
{
export XBMK_RELEASE="y"
reldir="release"
while getopts m: option
do
[ -z "$OPTARG" ] && \
err "empty argument not allowed" "release" "$@"
[ "$option" != "m" ] && \
err "invalid option '-$option'" "release" "$@"
relmode="$OPTARG"
done
reldest="$reldir/$version"
[ -e "$reldest" ] && \
err "already exists: \"$reldest\"" "release" "$@"
@@ -32,10 +22,7 @@ release()
x_ git clone . "$rsrc"
update_xbmkver "$rsrc"
prep_release src
prep_release tarball
[ "$relmode" != "src" ] && \
prep_release bin
forx 'prep_release %s' src tarball bin
x_ rm -Rf "$rsrc"
@@ -66,8 +53,7 @@ prep_release_src()
x_ ./mk -f
fx_ "x_ rm -Rf" x_ find . -name ".git"
fx_ "x_ rm -Rf" x_ find . -name ".gitmodules"
forx 'fx_ \"x_ rm -Rf\" x_ find . -name \".%s\"' git gitmodules
( fx_ nuke x_ find config -type f -name "nuke.list" ) || \
err "can't prune project files" "prep_release_src" "$@"; :
@@ -104,12 +90,10 @@ prep_release_bin()
{
x_ ./mk -d coreboot
x_ ./mk -b coreboot
x_ ./mk -b pico-serprog
x_ ./mk -b stm32-vserprog
x_ ./mk -b pcsx-redux
forx 'x_ ./mk -b' coreboot pico-serprog stm32-vserprog pcsx-redux
fx_ mkrom_tarball x_ find bin -maxdepth 1 -type d -name "serprog_*"
fx_ mkrom_tarball x_ find bin -mindepth 1 -maxdepth 1 \
-type d -name "serprog_*"
x_ mv bin ../roms
}
-628
View File
@@ -1,628 +0,0 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright (c) 2022-2023 Alper Nebi Yasak <alpernebiyasak@gmail.com>
# Copyright (c) 2022 Ferass El Hafidi <vitali64pmemail@protonmail.com>
# Copyright (c) 2023-2025 Leah Rowe <leah@libreboot.org>
# flag e.g. ./mk -b <-- mkflag would be "b"
flag=""
# macros, overridden depending on the flag
if_do_make=""
if_dry_build=":"
if_not_do_make=":"
if_not_dry_build=""
eval "`newvar autoconfargs autogenargs badhash badtghash bootstrapargs \
build_depend buildtype cleanargs cmakedir cmd defconfig dest_dir elfdir \
forcepull gccdir gccfull gccver gnatdir gnatfull gnatver listfile \
makeargs mdir mkhelper mkhelpercfg mode postmake premake project release \
rev srcdir target target_dir targets tree xarch xgcctree xlang`"
trees()
{
flags="f:F:b:m:u:c:x:s:l:n:d:"
while getopts $flags option
do
[ -n "$flag" ] && \
err "only one flag is permitted" "trees" "$@"
flag="$1"
# the "mode" variable is affixed to a make command, example:
# ./mk -m coreboot does: make menuconfig -C src/coreboot/tree
case "$flag" in
-d)
# -d is similar to -b, except that
# a large number of operations will be
# skipped. these are "if_not_dry_build build" scenarios
# where only a subset of build tasks are done,
# and $if_not_dry_build is prefixed to skipped commands
if_dry_build=""
if_not_dry_build=":"
;;
-b) : ;;
-u) mode="oldconfig" ;;
-m) mode="menuconfig" ;;
-c) mode="distclean" ;;
-x) mode="crossgcc-clean" ;;
-f|-F) # download source code for a project
# macros. colon means false.
if_do_make=":"
if_dry_build=""
if_not_do_make=""
if_not_dry_build=":"
[ "$flag" = "-F" ] && \
forcepull="y"; : # never skip git fetch/pull
;;
-s) mode="savedefconfig" ;;
-l) mode="olddefconfig" ;;
-n) mode="nconfig" ;;
*) err "invalid option '-$option'" "trees" "$@" ;;
esac
if [ -z "${OPTARG+x}" ]; then
shift 1
break
fi
project="${OPTARG#src/}"
project="${project#config/git/}"
shift 2
done
if [ -z "$flag" ]; then
err "missing flag ($flags)" "trees" "$@"
elif [ -z "$project" ]; then
fx_ "x_ ./mk $flag" x_ ls -1 config/git
return 1
elif [ ! -f "config/git/$project/pkg.cfg" ]; then
err "config/git/$project/pkg.cfg missing" "trees" "$@"
fi
elfdir="elf/$project"
datadir="config/data/$project"
configdir="config/$project"
srcdir="src/$project"
dest_dir="$elfdir"
listfile="$datadir/build.list"
[ ! -f "$listfile" ] && \
listfile="" # build.list is optional on all projects
mkhelpercfg="$datadir/mkhelper.cfg"
if e "$mkhelpercfg" f missing; then
mkhelpercfg="$xbtmp/mkhelper.cfg"
x_ touch "$mkhelpercfg"
fi
targets="$*"
cmd="build_targets $targets"
if singletree "$project"; then
cmd="build_project"
fi
remkdir "${tmpgit%/*}"
}
build_project()
{
configure_project "$configdir" || \
return 0
[ ! -f "$listfile" ] || \
$if_not_dry_build elfcheck || \
return 0
[ "$mode" = "distclean" ] && \
mode="clean"
run_make_command || \
return 0
[ -z "$mode" ] && \
$if_not_dry_build \
copy_elf; :
}
build_targets()
{
if [ ! -d "$configdir" ]; then
err "directory '$configdir' doesn't exist" "build_targets" "$@"
elif [ $# -lt 1 ]; then
targets="$(ls -1 "$configdir")" || \
err "'$configdir': can't list targets" "build_targets" "$@"
fi
for x in $targets
do
unset CROSS_COMPILE
export PATH="$xbmkpath"
if [ "$x" = "list" ]; then
x_ ls -1 "config/$project"
listfile=""
break
fi
printf "'make %s', '%s', '%s'\n" "$mode" "$project" "$x"
target="$x"
x_ handle_defconfig
[ -z "$mode" ] && \
x_ $postmake; :
done; :
}
handle_defconfig()
{
target_dir="$configdir/$target"
[ ! -f "CHANGELOG" ] && \
fetch_project "$project"
configure_project "$target_dir" || \
return 0
[ -z "$tree" ] && \
err "$configdir: 'tree' not set" "handle_defconfig" "$@"
srcdir="src/$project/$tree"
[ "$mode" = "${mode%clean}" ] && [ ! -d "$srcdir" ] && \
return 0
for y in "$target_dir/config"/*
do
[ "$flag" != "-d" ] && [ ! -f "$y" ] && \
continue
[ "$flag" != "-d" ] && \
defconfig="$y"
if [ -z "$mode" ]; then
check_defconfig || continue; :
fi
[ -z "$mode" ] && \
for _xarch in $xarch; do
$if_dry_build \
break
[ -n "$_xarch" ] && \
check_cross_compiler "$_xarch"; :
done; :
handle_makefile
[ -z "$mode" ] && \
$if_not_dry_build \
copy_elf; :
done; :
}
configure_project()
{
_tcfg="$1/target.cfg"
eval "`newvar autoconfargs badhash badtghash bootstrapargs \
build_depend buildtype cleanargs makeargs mkhelper postmake \
premake release xarch xgcctree xlang`"
[ ! -f "$_tcfg" ] && \
buildtype="auto"
# globally initialise all variables for a source tree / target:
if e "$datadir/mkhelper.cfg" f; then
. "$datadir/mkhelper.cfg" || \
err "Can't read '$datadir/mkhelper.cfg'" \
"configure_project" "$@"
fi
# override target/tree specific variables from per-target config:
while e "$_tcfg" f || [ "$cmd" != "build_project" ]
do
printf "Loading %s config: %s\n" "$project" "$_tcfg"
eval "`newvar rev tree`"
. "$_tcfg" || \
err "Can't read '$_tcfg'" "configure_project" "$@"
[ "$flag" = "-d" ] && \
build_depend="" # dry run
[ "$cmd" = "build_project" ] && \
break # single-tree, so targeting is unnecessary
$if_do_make \
break
[ "${_tcfg%/*/target.cfg}" = "${_tcfg%"/$tree/target.cfg"}" ] \
&& break # target and tree matching was successful
_tcfg="${_tcfg%/*/target.cfg}/$tree/target.cfg" # try next
done
[ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ] && \
return 1
[ -n "$buildtype" ] && [ "${mode%config}" != "$mode" ] && \
return 1
[ -z "$mode" ] && \
$if_not_dry_build \
build_dependencies
mdir="$xbmkpwd/config/submodule/$project"
[ -n "$tree" ] && \
mdir="$mdir/$tree"
if [ ! -f "CHANGELOG" ]; then
delete_old_project_files
$if_not_do_make \
fetch_${cmd#build_}
fi
$if_not_do_make \
return 1
x_ ./mk -f "$project" "$target"
}
# projects can specify which other projects
# to build first, as declared dependencies:
build_dependencies()
{
for bd in $build_depend
do
bd_project="${bd%%/*}"
bd_tree="${bd##*/}"
[ -z "$bd_project" ] && \
$if_not_dry_build \
err "$project/$tree: !bd '$bd'" \
"build_dependencies" "$@"
[ "${bd##*/}" = "$bd" ] && \
bd_tree=""
[ -n "$bd_project" ] && \
$if_not_dry_build \
x_ ./mk -b $bd_project $bd_tree; :
done; :
}
# delete_old_project_files along with project_up_to_date,
# concatenates the sha512sum hashes of all files related to
# a project, tree or target, then gets the sha512sum of that
# concatenation. this is checked against any existing
# calculation previously cached; if the result differs, or
# nothing was previously stored, we know to delete resources
# such as builds, project sources and so on, for auto-rebuild:
delete_old_project_files()
{
# delete an entire source tree along with its builds:
project_up_to_date hash "$tree" badhash "$datadir" \
"$configdir/$tree" "$mdir" || \
x_ rm -Rf "src/$project/$tree" "elf/$project/$tree"
x_ cp "$xbtmp/new.hash" "$XBMK_CACHE/hash/$project$tree"
if singletree "$project" || [ -z "$target" ] || [ "$target" = "$tree" ]
then
return 0
fi
# delete only the builds of a given target, but not src.
# this is useful when only the target config changes, for
# example x200_8mb coreboot configs change, but not coreboot:
project_up_to_date tghash "$target" badtghash "$configdir/$target" || \
x_ rm -Rf "elf/$project/$tree/$target"
x_ cp "$xbtmp/new.hash" "$XBMK_CACHE/tghash/$project$target"
}
project_up_to_date()
{
eval "`newvar hash old_hash`"
hashdir="$1"
hashname="$2"
badhashvar="$3"
shift 3
x_ mkdir -p "$XBMK_CACHE/$hashdir"
if [ -f "$XBMK_CACHE/$hashdir/$project$hashname" ]; then
read -r old_hash < "$XBMK_CACHE/$hashdir/$project$hashname" \
|| err \
"$hashdir: err '$XBMK_CACHE/$hashdir/$project$hashname'" \
"project_up_to_date" "$hashdir" "$hashname" "$badhashvar" \
"$@"
fi
build_sbase
fx_ "x_ util/sbase/sha512sum" find "$@" -type f -not -path \
"*/.git*/*" | awk '{print $1}' > "$xbtmp/tmp.hash" || \
err "!h $project $hashdir" \
"project_up_to_date" "$hashdir" "$hashname" "$badhashvar" "$@"
hash="$(x_ "$sha512sum" "$xbtmp/tmp.hash" | awk '{print $1}' || \
err)" || err "$hashname: Can't read sha512 of '$xbtmp/tmp.hash'" \
"project_up_to_date" "$hashdir" "$hashname" "$badhashvar" "$@"
if [ "$hash" != "$old_hash" ] || \
[ ! -f "$XBMK_CACHE/$hashdir/$project$hashname" ]; then
eval "$badhashvar=\"y\""
fi
printf "%s\n" "$hash" > "$xbtmp/new.hash" || \
err "!mkhash $xbtmp/new.hash ($hashdir $hashname $badhashvar)" \
"project_up_to_date" "$hashdir" "$hashname" "$badhashvar" "$@"
eval "[ \"\$$badhashvar\" = \"y\" ] && return 1"; :
}
check_cross_compiler()
{
cbdir="src/coreboot/$tree"
[ "$project" != "coreboot" ] && \
cbdir="src/coreboot/default"
[ -n "$xgcctree" ] && \
cbdir="src/coreboot/$xgcctree"
xfix="${1%-*}"
[ "$xfix" = "x86_64" ] && \
xfix="x64"
xgccfile="elf/coreboot/$tree/xgcc_${xfix}_was_compiled"
xgccargs="crossgcc-$xfix UPDATED_SUBMODULES=1 CPUS=$XBMK_THREADS"
x_ ./mk -f coreboot "${cbdir#src/coreboot/}"
x_ mkdir -p "elf/coreboot/$tree" # TODO: is this needed?
# tell build systems what cross-compiler to use
export PATH="$xbmkpwd/$cbdir/util/crossgcc/xgcc/bin:$PATH"
export CROSS_COMPILE="${xarch% *}-" # used by e.g. u-boot
# coreboot-specific (we disable gnat on some trees)
[ -n "$xlang" ] && \
export BUILD_LANGUAGES="$xlang"
[ -f "$xgccfile" ] && \
return 0 # build exists already, so skip building
check_gnu_path gcc gnat || x_ check_gnu_path gnat gcc
make -C "$cbdir" $xgccargs || x_ make -C "$cbdir" $xgccargs
x_ touch "$xgccfile" # prevent unnecessary re-build operations
remkdir "$xbtmp/gnupath" # reset hostcc
}
# fix mismatching gcc/gnat versions on debian trixie/sid. as of december 2024,
# trixie/sid had gnat-13 as gnat and gcc-14 as gcc, but has gnat-14 in apt. in
# some cases, gcc 13+14 and gnat-13 are present; or gnat-14 and gcc-14, but
# gnat in PATH never resolves to gnat-14, because gnat-14 was "experimental"
check_gnu_path()
{
command -v "$1" 1>/dev/null || \
err "Host '$1' unavailable" "check_gnu_path" "$@"
eval "`newvar gccdir gccfull gccver gnatdir gnatfull gnatver`"
if host_gcc_gnat_match "$@"; then
return 0
elif ! match_gcc_gnat_versions "$@"; then
return 1
fi
}
# check if gcc/gnat versions already match:
host_gcc_gnat_match()
{
gnu_setver "$1" "$1" || \
err "Command '$1' unavailable." "check_gnu_path" "$@"
gnu_setver "$2" "$2" || :
eval "[ -z \"\$$1ver\" ] && err \"Cannot detect host '$1' version\""
[ "$gnatfull" != "$gccfull" ] && \
return 1; : # mismatched gcc/gnat versions
}
# find all gcc/gnat versions, matching them up in PATH:
match_gcc_gnat_versions()
{
eval "$1dir=\"$(dirname "$(command -v "$1")")\""
eval "_gnudir=\"\$$1dir\""
eval "_gnuver=\"\$$1ver\""
for _bin in "$_gnudir/$2-"*; do
if [ "${_bin#"$_gnudir/$2-"}" = "$_gnuver" ] && [ -x "$_bin" ]
then
_gnuver="${_bin#"$_gnudir/$2-"}"
break
fi
done
gnu_setver "$2" "$_gnudir/$2-$_gnuver" || \
return 1
[ "$gnatfull" != "$gccfull" ] && \
return 1
( link_gcc_gnat_versions "$@" "$_gnudir" "$_gnuver" ) || \
err "Can't link '$2-$_gnuver' '$_gnudir'" "check_gnu_path" "$@"; :
}
# create symlinks in PATH, so that the GCC/GNAT versions match:
link_gcc_gnat_versions()
{
_gnudir="$3"
_gnuver="$4"
remkdir "$xbtmp/gnupath"
x_ cd "$xbtmp/gnupath"
for _gnubin in "$_gnudir/$2"*"-$_gnuver"
do
_gnuutil="${_gnubin##*/}"
[ -e "$_gnubin" ] && \
x_ ln -s "$_gnubin" "${_gnuutil%"-$_gnuver"}"; :
done
}
# get the gcc/gnat version
# fail: return 1 if util not found
gnu_setver()
{
eval "$2 --version 1>/dev/null 2>/dev/null || return 1"
eval "$1ver=\"`"$2" --version 2>/dev/null | head -n1`\""
eval "$1ver=\"\${$1ver##* }\""
eval "$1full=\"\$$1ver\""
eval "$1ver=\"\${$1ver%%.*}\""; :
}
check_defconfig()
{
[ ! -f "$defconfig" ] && \
$if_not_dry_build \
err "$project/$target: no config" check_defconfig "$@"
dest_dir="$elfdir/$tree/$target/${defconfig#"$target_dir/config/"}"
# skip build if a previous one exists:
$if_dry_build \
return 0
elfcheck || \
return 1; :
}
elfcheck()
{
# TODO: *STILL* very hacky check. do it properly (based on build.list)
( fx_ "eval exit 1 && err" find "$dest_dir" -type f ) || return 1; :
}
handle_makefile()
{
if $if_not_dry_build check_makefile "$srcdir"; then
$if_not_dry_build \
x_ make -C "$srcdir" $cleanargs clean
fi
[ -f "$defconfig" ] && \
x_ cp "$defconfig" "$srcdir/.config"
run_make_command || \
err "no makefile!" "handle_makefile" "$@"
_copy=".config"
[ "$mode" = "savedefconfig" ] && \
_copy="defconfig"
[ "${mode%config}" != "$mode" ] && \
$if_not_dry_build \
x_ cp "$srcdir/$_copy" "$defconfig"; :
[ -e "$srcdir/.git" ] && [ "$project" = "u-boot" ] && \
[ "$mode" = "distclean" ] && \
$if_not_dry_build \
x_ git -C "$srcdir" $cleanargs clean -fdx; :
}
run_make_command()
{
[ -z "$mode" ] && \
x_ $premake
$if_not_dry_build check_cmake "$srcdir" && \
[ -z "$mode" ] && \
$if_not_dry_build \
check_autoconf "$srcdir"
$if_not_dry_build check_makefile "$srcdir" || \
return 1
$if_not_dry_build \
x_ make -C "$srcdir" $mode -j$XBMK_THREADS $makeargs
[ -z "$mode" ] && \
x_ $mkhelper
check_makefile "$srcdir" || \
return 0
[ "$mode" = "clean" ] || \
return 0
$if_dry_build \
return 0
make -C "$srcdir" $cleanargs distclean || \
x_ make -C "$srcdir" $cleanargs clean; :
}
check_cmake()
{
$if_dry_build \
return 0
[ ! -n "$cmakedir" ] && \
return 0
check_makefile "$1" || \
cmake -B "$1" "$1/$cmakedir" || \
x_ check_makefile "$1"
x_ check_makefile "$1"; :
}
check_autoconf()
{
(
x_ cd "$1"
[ -f "bootstrap" ] && \
x_ ./bootstrap $bootstrapargs
[ -f "autogen.sh" ] && \
x_ ./autogen.sh $autogenargs
[ -f "configure" ] && \
x_ ./configure $autoconfargs; :
) || err "can't bootstrap project: $1" "check_autoconf" "$@"; :
}
check_makefile()
{
[ ! -f "$1/Makefile" ] && [ ! -f "$1/makefile" ] && \
[ ! -f "$1/GNUmakefile" ] && \
return 1; :
}
copy_elf()
{
[ -f "$listfile" ] && \
x_ mkdir -p "$dest_dir"
if [ -f "$listfile" ]; then
while read -r f; do
[ -f "$srcdir/$f" ] && \
x_ cp "$srcdir/$f" "$dest_dir"; :
done < "$listfile" || err \
"cannot read '$listfile'" "copy_elf" "$@"; :
fi
( x_ make clean -C "$srcdir" $cleanargs ) || \
err "can't make-clean '$srcdir'" "copy_elf" "$@"; :
}
+529 -22
View File
@@ -4,40 +4,547 @@
# Copyright (c) 2020-2026 Leah Rowe <leah@libreboot.org>
# Copyright (c) 2022 Caleb La Grange <thonkpeasant@protonmail.com>
# Copyright (c) 2022-2023 Alper Nebi Yasak <alpernebiyasak@gmail.com>
# Copyright (c) 2022 Ferass El Hafidi <vitali64pmemail@protonmail.com>
set -u -e
eval "`printf "%s\n" "LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE \
LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE \
LC_MEASUREMENT LC_IDENTIFICATION LC_ALL" | \
awk '{ for (i=1; i<=NF; i++) $i = "export " $i "=C.UTF-8;"; print }'`"
findpath()
{
forx 'readlink -f \"%s\" 2>/dev/null || \
x_ realpath \"%s\" 2>/dev/null' "$@"
}
printf "%s\n" "%s" | grep -o "%s" 1>/dev/null || exit 1 # safety (-o check)
forx()
{
awkarg="{printf \"${1-};\""
shift 1 2>/dev/null || :
scount="$(printf "%s\n" "$awkarg" | grep -o "%s" | wc -l)"
while [ $scount -gt 0 ]; do
awkarg="$awkarg,\$0"
scount="$(expr $scount - 1 || :)"
done
while [ $# -gt 0 ]; do
eval "$(printf '%s\n' "$1" | awk "$awkarg}")"
shift 1
done
}
x_()
{
[ $# -lt 1 ] || "$@" || err "UNHANDLED ERROR" "x_" "$@"; :
}
err()
{
printf '%s\n' "$@" | awk '{printf "\"%s\" ", $0}'
printf "ERROR!\n"
exit 1
}
forx 'export %s=\"C.UTF-8\"' LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME \
LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS \
LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION LC_ALL
(
xbarg0="$0"
[ "${xbarg0##*/}" = "$xbarg0" ] && \
xbarg0="`command -v "$xbarg0"`"
mk="$0"
[ "${mk##*/}" != "$mk" ] || \
mk="$(x_ command -v "$mk")" || exit 1
commandv="`readlink -f "$xbarg0" 2>/dev/null`"
[ -z "$commandv" ] && \
commandv="`realpath "$xbarg0" 2>/dev/null`"
mk="$(x_ findpath "$mk")" || exit 1
xbmkpwd="$(x_ dirname "$mk")" || exit 1
cd "${commandv%/*}" || exit 1
x_ cd "$xbmkpwd"
. "include/common.sh"
. "include/lib.sh"
. "include/env/init.sh"
x_ xbmk_init "$@"
if xeq main "${1-}" \
$xbcommands; then
. "include/env/get.sh"
"$@" || exit 1
exit 0
fi
. "include/fw/vendor.sh"
. "include/fw/mrc.sh"
. "include/fw/inject.sh"
. "include/fw/rom.sh"
. "include/tree.sh"
. "include/mk/release.sh"
trees "$@" || exit 0
_f="${1-}"
shift 1 2>/dev/null || :
x_ touch "$mkhelpercfg"
eval "$(printf "version release download inject\n" | awk '{ for (i=1; i<=NF; \
i++) $i = "[ \""$i"\" = \"$_f\" ] && x_ "$i" \"$@\" && exit 0;"; print }')"
# macros, overridden depending on the flag
if_not_do_make=":" # : means false
if_make_config=":"
if_build=":" # can be false even if make is true
if_dry_build=":"
if_single_tree=":"
eval "`newvar if_do_make if_not_make_config if_not_build if_not_dry_build`"
eval "`newvar configureargs autogenargs badhash badtghash bootstrapargs \
build_depend buildtype cleanargs cmakedir cmd defconfig dest_dir elfdir \
flag forcepull listfile makeargs mdir mkhelper mkhelpercfg mode postmake \
premake project release rev srcdir target target_dir tree xarch xgcctree \
xlang`"
main()
{
flags="f:F:b:m:u:s:l:n:d:"
while getopts $flags option
do
[ -n "$flag" ] && \
err "only one flag is permitted" "trees" "$@"
flag="$1"
# the "mode" variable is affixed to a make command, example:
# "$mk" -m coreboot does: make menuconfig -C src/coreboot/tree
case "$flag" in
-b) : ;; # build a source tree
-d) # dry builds. -d is like -b but skips many build steps
if_dry_build=""
if_not_dry_build=":"
;;
-f|-F) # download source code for a project
eval "`newvar if_not_do_make if_dry_build`"
if_do_make=":"
if_not_dry_build=":"
[ "$flag" = "-F" ] && \
forcepull="y"; : # never skip git fetch/pull
;;
-u) mode="oldconfig" ;;
-m) mode="menuconfig" ;;
-s) mode="savedefconfig" ;;
-l) mode="olddefconfig" ;;
-n) mode="nconfig" ;;
*) err "invalid option '-$option'" "trees" "$@" ;;
esac
if [ -z "$mode" ]; then
if_build=""
if_not_build=":"
fi
if [ "${mode%config}" != "$mode" ]; then
if_make_config=""
if_not_make_config=":"
fi
if [ -z "${OPTARG+x}" ]; then
shift 1
break
fi
project="${OPTARG#src/}"
project="${project#config/git/}"
shift 2
done
if [ -z "$flag" ]; then
err "missing flag ($flags)" "trees" "$@"
elif [ -z "$project" ]; then
fx_ "x_ "$mk" $flag" x_ ls -1 config/git
return 0
elif [ ! -f "config/git/$project/pkg.cfg" ]; then
err "config/git/$project/pkg.cfg missing" "trees" "$@"
fi
elfdir="elf/$project"
datadir="config/data/$project"
configdir="config/$project"
srcdir="src/$project"
dest_dir="$elfdir"
listfile="$datadir/build.list"
[ ! -f "$listfile" ] && \
listfile="" # build.list is optional on all projects
mkhelpercfg="$datadir/mkhelper.cfg"
if e "$mkhelpercfg" f missing; then
mkhelpercfg="$xbtmp/mkhelper.cfg"
x_ touch "$mkhelpercfg"
fi
if singletree "$project"; then
cmd="mk_single_tree"
if_single_tree=""
else
cmd="mk_multi_tree"
fi
remkdir "${tmpgit%/*}"
x_ touch "$mkhelpercfg"
. "$mkhelpercfg"
$cmd "$@"
}
mk_single_tree()
{
configure_project "$configdir" || \
return 0
[ ! -f "$listfile" ] || $if_not_dry_build \
elfcheck || return 0
run_make_command && $if_build $if_not_dry_build \
copy_elf; :
}
mk_multi_tree()
{
[ ! -d "$configdir" ] && err "missing '$configdir'" mk_multi_tree "$@"
[ $# -lt 1 ] && fx_ mk_multi_tree find "$configdir" \
-mindepth 1 -maxdepth 1 -type d
[ $# -gt 0 ] && for x in "$@"
do
unset CROSS_COMPILE
export PATH="$xbmkpath"
if [ "$x" = "list" ]; then
x_ ls -1 "config/$project"
listfile=""
break
fi
printf "'make %s', '%s', '%s'\n" "$mode" "$project" "$x"
target="${x##*/}"
x_ handle_defconfig
$if_build \
x_ $postmake; :
done; :
}
handle_defconfig()
{
target_dir="$configdir/$target"
[ ! -f "CHANGELOG" ] && \
single_tree_fetch "$project"
configure_project "$target_dir" || \
return 0
[ -z "$tree" ] && err "$configdir: 'tree' unset" handle_defconfig "$@"
srcdir="src/$project/$tree"
[ -d "$srcdir" ] && for y in "$target_dir/config"/*
do
[ ! -f "$y" ] && \
$if_not_dry_build \
continue
$if_not_dry_build eval \
defconfig="$y"
$if_build \
prep_mk_multi_tree || continue
handle_makefile
$if_build $if_not_dry_build \
copy_elf; :
done; :
}
configure_project()
{
_tcfg="$1/target.cfg"
eval "`newvar configureargs badhash badtghash bootstrapargs \
build_depend buildtype cleanargs makeargs mkhelper postmake \
premake release xarch xgcctree xlang`"
[ ! -f "$_tcfg" ] && buildtype="auto"
# globally initialise all variables for a source tree / target:
if e "$datadir/mkhelper.cfg" f; then
. "$datadir/mkhelper.cfg" || \
err "Can't read '$datadir/mkhelper.cfg'" \
"configure_project" "$@"
fi
# override target/tree specific variables from per-target config:
while e "$_tcfg" f || [ "$cmd" != "mk_single_tree" ]
do
printf "Loading %s config: %s\n" "$project" "$_tcfg"
eval "`newvar rev tree`"
. "$_tcfg" || err "Can't read '$_tcfg'" configure_project "$@"
$if_dry_build eval \
build_depend=""
$if_single_tree \
break
$if_do_make \
break
[ "${_tcfg%/*/target.cfg}" = "${_tcfg%"/$tree/target.cfg"}" ] \
&& break # target and tree matching was successful
_tcfg="${_tcfg%/*/target.cfg}/$tree/target.cfg" # try next
done
[ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ] && \
return 1
[ -n "$buildtype" ] && $if_make_config \
return 1
$if_build $if_not_dry_build \
build_dependencies
mdir="$xbmkpwd/config/submodule/$project"
[ -n "$tree" ] && mdir="$mdir/$tree"
if [ ! -f "CHANGELOG" ]; then
delete_old_project_files
$if_not_do_make \
${cmd#mk_}_fetch
fi
$if_not_do_make \
return 1
x_ "$mk" -f "$project" "$target"
}
# projects can specify which other projects
# to build first, as declared dependencies:
build_dependencies()
{
for bd in $build_depend
do
bd_project="${bd%%/*}"
bd_tree="${bd##*/}"
[ -z "$bd_project" ] && \
$if_not_dry_build \
err "$project/$tree: !bd '$bd'" \
"build_dependencies" "$@"
[ "${bd##*/}" = "$bd" ] && \
bd_tree=""
[ -n "$bd_project" ] && \
$if_not_dry_build \
x_ "$mk" -b $bd_project $bd_tree; :
done; :
}
# delete_old_project_files along with project_up_to_date,
# concatenates the sha512sum hashes of all files related to
# a project, tree or target, then gets the sha512sum of that
# concatenation. this is checked against any existing
# calculation previously cached; if the result differs, or
# nothing was previously stored, we know to delete resources
# such as builds, project sources and so on, for auto-rebuild:
delete_old_project_files()
{
# delete an entire source tree along with its builds:
project_up_to_date hash "$tree" badhash "$datadir" \
"$configdir/$tree" "$mdir" || \
x_ rm -Rf "src/$project/$tree" "elf/$project/$tree"
x_ cp "$xbtmp/new.hash" "$XBMK_CACHE/hash/$project$tree"
if singletree "$project" || [ -z "$target" ] || [ "$target" = "$tree" ]
then
return 0
fi
# delete only the builds of a given target, but not src.
# this is useful when only the target config changes, for
# example x200_8mb coreboot configs change, but not coreboot:
project_up_to_date tghash "$target" badtghash "$configdir/$target" || \
x_ rm -Rf "elf/$project/$tree/$target"
x_ cp "$xbtmp/new.hash" "$XBMK_CACHE/tghash/$project$target"
}
project_up_to_date()
{
eval "`newvar hash old_hash`"
hashdir="$1"
hashname="$2"
badhashvar="$3"
shift 3
x_ mkdir -p "$XBMK_CACHE/$hashdir"
if [ -f "$XBMK_CACHE/$hashdir/$project$hashname" ]; then
read -r old_hash < "$XBMK_CACHE/$hashdir/$project$hashname" \
|| err \
"$hashdir: err '$XBMK_CACHE/$hashdir/$project$hashname'" \
"project_up_to_date" "$hashdir" "$hashname" "$badhashvar" \
"$@"
fi
eval "$build_sbase"
fx_ "x_ util/sbase/sha512sum" find "$@" -type f -not -path \
"*/.git*/*" | awk '{print $1}' > "$xbtmp/tmp.hash" || \
err "!h $project $hashdir" \
"project_up_to_date" "$hashdir" "$hashname" "$badhashvar" "$@"
hash="$(x_ "$sha512sum" "$xbtmp/tmp.hash" | awk '{print $1}' || \
err)" || err "$hashname: Can't read sha512 of '$xbtmp/tmp.hash'" \
"project_up_to_date" "$hashdir" "$hashname" "$badhashvar" "$@"
if [ "$hash" != "$old_hash" ] || \
[ ! -f "$XBMK_CACHE/$hashdir/$project$hashname" ]; then
eval "$badhashvar=\"y\""
fi
printf "%s\n" "$hash" > "$xbtmp/new.hash" || \
err "!mkhash $xbtmp/new.hash ($hashdir $hashname $badhashvar)" \
"project_up_to_date" "$hashdir" "$hashname" "$badhashvar" "$@"
eval "[ \"\$$badhashvar\" = \"y\" ] && return 1"; :
}
prep_mk_multi_tree()
{
dest_dir="$elfdir/$tree/$target/${defconfig#"$target_dir/config/"}"
$if_not_dry_build elfcheck || return 1 # skip if a build exists
$if_not_dry_build eval "$(printf '%s\n' "$xarch" | awk \
'{ for (i=1; i<=NF; i++) $i = "check_xgcc \""$i"\";"; print }')"
}
check_xgcc()
{
cbdir="src/coreboot/$tree"
[ "$project" != "coreboot" ] && \
cbdir="src/coreboot/default"
[ -n "$xgcctree" ] && \
cbdir="src/coreboot/$xgcctree"
cbelfdir="elf${cbdir#src}"
xfix="${1%-*}"
[ "$xfix" = "x86_64" ] && xfix="x64"
xgccfile="$cbelfdir/xgcc_${xfix}_was_compiled"
xgccargs="crossgcc-$xfix UPDATED_SUBMODULES=1 CPUS=$XBMK_THREADS"
x_ "$mk" -f coreboot "${cbdir#src/coreboot/}"
x_ mkdir -p "$cbelfdir"
# tell build systems what cross-compiler to use
export PATH="$xbmkpwd/$cbdir/util/crossgcc/xgcc/bin:$PATH"
export CROSS_COMPILE="${xarch% *}-" # used by e.g. u-boot
# coreboot-specific (we disable gnat on some trees)
[ -n "$xlang" ] && \
export BUILD_LANGUAGES="$xlang"
[ -f "$xgccfile" ] && return 0 # skip (build already exists)
make -C "$cbdir" $xgccargs || x_ make -C "$cbdir" $xgccargs
x_ touch "$xgccfile" # prevent unnecessary re-build operations
}
elfcheck()
{
# TODO: *STILL* very hacky check. do it properly (based on build.list)
( fx_ "eval exit 1 && err" find "$dest_dir" -type f ) || return 1; :
}
handle_makefile()
{
check_makefile "$srcdir" && $if_not_dry_build \
x_ make -C "$srcdir" clean $cleanargs
[ -f "$defconfig" ] && \
x_ cp "$defconfig" "$srcdir/.config"
run_make_command || err "no makefile!" "handle_makefile" "$@"
_copy=".config"
[ "$mode" = "savedefconfig" ] && \
_copy="defconfig"
$if_make_config \
x_ cp "$srcdir/$_copy" "$defconfig"; :
}
run_make_command()
{
$if_build \
x_ $premake
$if_not_dry_build \
run_make_command_real || return 1
$if_build \
x_ $mkhelper; :
}
run_make_command_real()
{
[ -z "$cmakedir" ] || \
x_ cmake -B "$srcdir" "$srcdir/$cmakedir"
$if_build \
check_autoconf "$srcdir"
check_makefile "$srcdir" || return 1
x_ make -C "$srcdir" $mode -j$XBMK_THREADS $makeargs
}
check_autoconf()
{
(
x_ cd "$1"
[ -f "bootstrap" ] && \
x_ ./bootstrap $bootstrapargs
[ -f "autogen.sh" ] && \
x_ ./autogen.sh $autogenargs
[ -f "configure" ] && \
x_ ./configure $configureargs; :
) || err "can't bootstrap project: $1" check_autoconf "$@"; :
}
check_makefile()
{
[ ! -f "$1/Makefile" ] && [ ! -f "$1/makefile" ] && \
[ ! -f "$1/GNUmakefile" ] && return 1; :
}
copy_elf()
{
[ -f "$listfile" ] && \
x_ mkdir -p "$dest_dir"
if [ -f "$listfile" ]; then
while read -r f; do
[ -f "$srcdir/$f" ] && \
x_ cp "$srcdir/$f" "$dest_dir"; :
done < "$listfile" || err \
"cannot read '$listfile'" "copy_elf" "$@"; :
fi
( x_ make -C "$srcdir" clean $cleanargs ) || \
err "can't make-clean '$srcdir'" "copy_elf" "$@"; :
}
x_ main "$_f" "$@"
. "$mkhelpercfg"
$cmd
) || exit 1; :