Skip to content

mk: make the dev kit configuration available while Android.mk is parsed - #7897

Open
andrew2311 wants to merge 2 commits into
OP-TEE:masterfrom
andrew2311:ta-dev-kit-conf
Open

mk: make the dev kit configuration available while Android.mk is parsed#7897
andrew2311 wants to merge 2 commits into
OP-TEE:masterfrom
andrew2311:ta-dev-kit-conf

Conversation

@andrew2311

@andrew2311 andrew2311 commented Jul 29, 2026

Copy link
Copy Markdown

Adds ta_dev_kit_conf, a target that exports the dev kit configuration
(conf.h, conf.mk, conf.cmake): the files are written by shell commands, so
it builds no libraries and takes about a second. mk/aosp_optee.mk then
runs it while the makefiles are parsed, so the configuration is on disk
before any Android.mk is read. Building the dev kit itself is left to the
ninja graph, as before.

The md5 of the generated conf.mk is kept in a variable, so ckati re-parses
when the configuration changes, even though that configuration comes from
files ckati never reads itself. All optee_os invocations now share one
command line, so the configuration read while parsing cannot drift from the
one the dev kit is built with.

This fixes a long-standing trap for Android.mk files that select what to
build from the CFG_ flags of the TEE they are built against -
-include $(TA_DEV_KIT_DIR)/host_include/conf.mk, as optee_test does for its
GP socket tests. On a clean build that include finds nothing, because ckati
parses the makefiles to emit the ninja graph and the dev kit is built by
that very graph: the flags come out empty and the sources they select are
dropped with no diagnostic, so what ends up in the binary depends on whether
the output directory happens to be warm. It was reported as
OP-TEE/optee_test#275 in 2018 and closed without a fix; no build dependency
can close it, since the parsing is what produces the rules. The approach
here is the one @jforissier suggested in OP-TEE/optee_test#825, making the
dev kit configuration a required input.

Andrii Shtompel added 2 commits July 29, 2026 11:05
Add ta_dev_kit_conf, which exports conf.h, conf.mk and conf.cmake. They are
written by plain shell commands, so this target compiles nothing and
completes in about a second, unlike ta_dev_kit, which builds the libraries
too.

It is meant for dev kit consumers that need the configuration before they
can build anything: optee_test picks its sources from the CFG_* flags it
reads from the dev kit conf.mk, and some build systems have to know their
sources before any rule can run.

Signed-off-by: Andrii Shtompel <andrii_shtompel@epam.com>
Run ta_dev_kit_conf while the makefiles are parsed, so that the
configuration is on disk before any Android.mk is read; building the dev
kit itself is left to the graph as before. The md5 of the generated
conf.mk is kept in a variable so that ckati parses again when the
configuration changes, even though it comes from files ckati never reads
itself. All optee_os invocations now share one command line, so the
configuration read while parsing cannot drift from the one the dev kit is
built with.

This is for the Android.mk files which select what to build from the CFG_
flags of the dev kit, as optee_test does for its GP socket tests. They
read them with -include $(TA_DEV_KIT_DIR)/host_include/conf.mk, which
finds nothing on a clean build: ckati parses the makefiles to emit the
ninja graph, and the dev kit is built by that very graph. The flags then
come out empty and the sources they select are dropped with no
diagnostic, so what ends up in the binary depends on whether the output
directory is warm. No build dependency can fix this, as the parsing is
what produces the rules.

Signed-off-by: Andrii Shtompel <andrii_shtompel@epam.com>
@github-actions

Copy link
Copy Markdown

FYI @taddk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant