Skip to content

container-imx: enable the Microsoft fTPM TA on i.MX8MP - #5

Closed
mmxsrup wants to merge 2 commits into
pr/perf-loggingfrom
pr/ftpm-enable
Closed

container-imx: enable the Microsoft fTPM TA on i.MX8MP#5
mmxsrup wants to merge 2 commits into
pr/perf-loggingfrom
pr/ftpm-enable

Conversation

@mmxsrup

@mmxsrup mmxsrup commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Enables the Microsoft firmware TPM (ms-tpm-20-ref, OP-TEE early TA) on the i.MX8MP EVK image.

What

  • optee-ftpm_%.bbappend: allow imx8mpevk in COMPATIBLE_MACHINE (meta-arm gates the recipe to QEMU/genericarm64) and build the TA as AArch64.
  • linux-imx_%.bbappend + ftpm.cfg: enable CONFIG_TCG_FTPM_TEE=m, gated on the optee-ftpm machine feature. The driver is a module on purpose — the fTPM persists state through tee-supplicant, so it must probe after the supplicant is running.
  • docs/ftpm-imx8mp.md / -j.md: build/enable/verify instructions and caveats.

How to enable

MACHINE_FEATURES:append = " optee-ftpm"
IMAGE_INSTALL:append = " optee-ftpm tpm2-tools kernel-module-tpm-ftpm-tee"

Without the machine feature, nothing changes: neither the OP-TEE binary (meta-arm's early-TA hook is feature-gated) nor the kernel config (the fragment is only added to SRC_URI when the feature is set — this matters because CONFIG_IKCONFIG=y embeds the config in the kernel Image, so an ungated fragment would make even default kernels byte-different).

Verification

  • Build verified: fTPM early-TA symbol present in tee.elf, tpm_ftpm_tee.ko present in the rootfs, HAB signing flow unchanged.
  • On device: pending — the board test has not been run yet. Planned steps (also in the docs): modprobe tpm_ftpm_tee/dev/tpm0tpm2_getcap properties-fixed / tpm2_pcrread, plus an RA regression run. Results will be posted here.

Caveats

  • fTPM state lives on the REE FS via tee-supplicant (RPMB not provisioned on the EVK): encrypted, but no rollback protection.
  • Nothing measures into the PCRs during boot on this platform; IMA / measured-boot integration is future work.

Stacked on #4 (branched from pr/perf-logging).

mmxsrup added 2 commits July 28, 2026 06:30
Make the meta-arm optee-ftpm recipe (ms-tpm-20-ref as an OP-TEE early
TA) usable on imx8mpevk. meta-arm gates COMPATIBLE_MACHINE to
QEMU/genericarm64, so a bbappend allows imx8mpevk and builds the TA as
AArch64; a linux-imx bbappend enables the tpm_ftpm_tee driver as a
module (CONFIG_TCG_FTPM_TEE=m — the fTPM persists its state through
tee-supplicant, so the driver must probe after the supplicant is up).
Opt in via MACHINE_FEATURES "optee-ftpm" plus the optee-ftpm,
tpm2-tools and kernel-module-tpm-ftpm-tee packages; default builds are
unchanged. Documented in docs/ftpm-imx8mp.md (EN/JA), including the
REE-FS state storage caveat (no RPMB, no rollback protection) and that
nothing measures into the PCRs during boot on this platform.
The linux-imx bbappend applied CONFIG_TCG_FTPM_TEE=m unconditionally,
so builds without the optee-ftpm machine feature also got the config
change — and since imx_v8_defconfig has CONFIG_IKCONFIG=y, that makes
even a feature-off kernel Image byte-different, which matters for a
repo whose whole point is signing and measuring boot artifacts. Add
the fragment to SRC_URI only when MACHINE_FEATURES contains optee-ftpm
and make the do_configure step a no-op when the fragment is absent.
(The appended task code itself still alters the do_configure signature
once, but the resulting kernel is unchanged.)

Also fix two doc inaccuracies: CFG_CORE_HEAP_SIZE=131072 from meta-arm
is not a raise on i.MX (the NXP tree already defaults i.MX platforms
to 128 KiB; the raise only applies vs OP-TEE's generic 64 KiB), and
state explicitly where local.conf lives and that re-running
"yocto.sh full" performs the documented rebuild sequence.
@mmxsrup

mmxsrup commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator Author

実機テスト前かつ本 PR シリーズ(性能計測)とは独立した内容のため、いったんクローズします。ボードでの動作確認後に改めて PR を出します。ブランチ pr/ftpm-enable は残してあります。

@mmxsrup mmxsrup closed this Jul 28, 2026
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