fix(build): guard dev wrapper scripts against cross/OE env + document 3rd-party integration - #628
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens the boundary between developer-only wrapper scripts and production/cross build integrations by adding an explicit environment guard and documenting the supported third-party (Yocto/BitBake) CMake-direct build contract (refs #624).
Changes:
- Added a shared
dev_env_guard.shand sourced it frombuild_binder.sh,build_modules.sh, andbuild_interfaces.shto abort early in cross/OpenEmbedded environments (with an override env var). - Added new third-party integration documentation and linked it from the README and MkDocs navigation.
- Updated wrapper scripts to allow help/clean paths without requiring a host toolchain (with one exception noted in comments).
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Adds an explicit statement that production/cross builds must invoke CMake directly and links the new integration doc. |
| mkdocs.yml | Wires the new “Third-Party Build Integration” doc into the published nav. |
| docs/standards/build_integration.md | New guide describing the two-stage production build contract and BitBake patterns. |
| dev_env_guard.sh | New shared guard that detects OE/cross environments and aborts wrapper scripts with guidance. |
| build_modules.sh | Sources the guard for non-clean/help invocations to prevent misuse in cross/OE shells. |
| build_interfaces.sh | Sources the guard for non-clean/help invocations to prevent misuse in cross/OE shells. |
| build_binder.sh | Sources the guard early to prevent staging the SDK in cross/OE shells. |
Ulrond
added a commit
that referenced
this pull request
Jun 22, 2026
Per Copilot review on #624/#628: - dev_env_guard.sh: name the wrapper via BASH_SOURCE[1] (not $0), so the message is correct when a wrapper is sourced; point users at the in-tree docs/standards/build_integration.md instead of build-tools/.../BUILD.md (which is a gitignored clone, absent from a fresh checkout). - build_binder.sh: clarify that 'clean' force-rebuilds here, so it is a build operation and is intentionally not exempt from the guard. - build_integration.md: clarify that versions_released.yaml is consumed by build_modules.sh, not the top-level CMake (a cohort build iterates versions itself); link the upstream linux_binder_idl BUILD guide; replace the BitBake recipe's incorrect ${B}/out/target install path with the cmake class (EXTRA_OECMAKE + class-managed install).
Collaborator
Author
|
Addressed Copilot review feedback (pushed):
|
Contributor
mhughesacn
reviewed
Jun 22, 2026
Ulrond
added a commit
that referenced
this pull request
Jun 24, 2026
…sistency - Remove the Apache header from the reference recipes per @mhughesacn / RDK meta-layer convention (recipes are licensed via the repo, not per-file). - Point the guard comments at docs/standards/build_integration.md (not BUILD.md). - Drop the cross-compile/Yocto examples from build_modules.sh & build_interfaces.sh help text — the host-toolchain guard blocks that path; cross/Yocto use direct CMake (build_integration.md).
Contributor
Contributor
Contributor
|
b'## WARNING: A Blackduck scan failure has been waived A prior failure has been upvoted
|
Ulrond
added a commit
that referenced
this pull request
Jul 4, 2026
Copilot review: 'SRCREV = "0.21.0"' is misleading — BitBake SRCREV must be a git commit SHA, not a tag name. Show the correct form: reference the tag in SRC_URI (;tag=0.21.0) and set SRCREV to that tag's commit SHA.
Collaborator
Author
|
Copilot review: fixed the SRCREV pinning example (SHA, not tag name). The |
Ulrond
added a commit
that referenced
this pull request
Jul 5, 2026
…iew) Copilot review: the cross-toolchain heuristic derived host_machine from a PATH-resolved cc/gcc, which a cross toolchain that prepends PATH could point at the cross compiler — masking the host triple so the triple-mismatch check wouldn't fire. Prefer /usr/bin/gcc|cc (fixed paths, immune to PATH prepend), falling back to PATH cc/gcc only when absent. (OE shells are still primarily caught by the OECORE_*_SYSROOT check above.)
…3rd-party integration build_binder.sh / build_modules.sh / build_interfaces.sh are developer and architecture-team tools that assume a native host toolchain. Run inside an OpenEmbedded cross shell they fail silently: the host AIDL tool is cross- compiled (can't run on the build host) and the binder CMake auto-enables BUILD_ENV_YOCTO from OECORE_*, disabling install() so out/target is empty. That CMake behaviour is correct for production builds invoked directly; the bug is only that the dev scripts were run in an environment they don't support. Add a shared dev_env_guard.sh that fails fast (with a pointer to the direct- CMake recipe) when a cross CC or OECORE_*_SYSROOT is detected; clean/help paths stay usable, and BINDER_ALLOW_CROSS_ENV=1 overrides. Document the contract: new docs/standards/build_integration.md (required CMake variables, BitBake recipe pattern, why not the scripts) wired into the nav, and a pointer from the README production-build section. Refs #624
Per Copilot review on #624/#628: - dev_env_guard.sh: name the wrapper via BASH_SOURCE[1] (not $0), so the message is correct when a wrapper is sourced; point users at the in-tree docs/standards/build_integration.md instead of build-tools/.../BUILD.md (which is a gitignored clone, absent from a fresh checkout). - build_binder.sh: clarify that 'clean' force-rebuilds here, so it is a build operation and is intentionally not exempt from the guard. - build_integration.md: clarify that versions_released.yaml is consumed by build_modules.sh, not the top-level CMake (a cohort build iterates versions itself); link the upstream linux_binder_idl BUILD guide; replace the BitBake recipe's incorrect ${B}/out/target install path with the cmake class (EXTRA_OECMAKE + class-managed install).
Fold copy-me integration recipes into the third-party build guide so it ships instructions AND examples: - docs/standards/examples/rdk-halif-aidl.bb — BitBake reference recipe - docs/standards/examples/rdk-halif-aidl.yaml — Bob Build Tool reference recipe Both are thin wrappers over the same direct-CMake invocation (BINDER_SDK_DIR / BINDER_SDK_INCLUDE_DIR / INTERFACE_TARGET), demonstrating that the build is build-system-agnostic. Linked from build_integration.md; marked as reference templates (pin to a release tag, adapt toolchain/sysroot), not CI-verified.
…sistency - Remove the Apache header from the reference recipes per @mhughesacn / RDK meta-layer convention (recipes are licensed via the repo, not per-file). - Point the guard comments at docs/standards/build_integration.md (not BUILD.md). - Drop the cross-compile/Yocto examples from build_modules.sh & build_interfaces.sh help text — the host-toolchain guard blocks that path; cross/Yocto use direct CMake (build_integration.md).
…rence Reframe the production section as 'Consuming the interfaces (build with CMake directly)' and add a switch table (INTERFACE_TARGET / AIDL_SRC_VERSION / BINDER_SDK_DIR / BINDER_SDK_INCLUDE_DIR) so integrators select what to build via -D switches rather than the wrapper scripts. Mark the Scripts section as developer/architecture-team-only (refuse cross/OE). Replace the two dead TWO_STAGE_BUILD.md links with docs/standards/build_integration.md.
Copilot review: 'SRCREV = "0.21.0"' is misleading — BitBake SRCREV must be a git commit SHA, not a tag name. Show the correct form: reference the tag in SRC_URI (;tag=0.21.0) and set SRCREV to that tag's commit SHA.
…iew) Copilot review: the cross-toolchain heuristic derived host_machine from a PATH-resolved cc/gcc, which a cross toolchain that prepends PATH could point at the cross compiler — masking the host triple so the triple-mismatch check wouldn't fire. Prefer /usr/bin/gcc|cc (fixed paths, immune to PATH prepend), falling back to PATH cc/gcc only when absent. (OE shells are still primarily caught by the OECORE_*_SYSROOT check above.)
Ulrond
force-pushed
the
feature/624-build-binder-oe-cross
branch
from
July 5, 2026 08:39
5ac42a0 to
78654ee
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #624
Background
#624 reports
build_binder.shfailing in an OpenEmbedded ARM cross environment two ways: the host AIDL tool gets cross-compiled (can't run on the build host), andOECORE_*_SYSROOTmakes the binder CMake setBUILD_ENV_YOCTO=ON, which disables everyinstall()rule soout/targetends up empty.Both behaviours are correct for a production build invoked directly through CMake. The actual problem is that the
build_*.shwrapper scripts — which are documented as developer/architecture-only tools (BUILD.md: "Yocto/BitBake recipes must NOT use these wrapper scripts") — were run in an environment they were never meant for. The HAL libraries build from committed generated C++, so the AIDL host tool is never needed on a target at all.So this is not a code adaptation bug — the fix is to enforce and document the boundary.
Changes
dev_env_guard.sh(new) — shared guard sourced bybuild_binder.sh,build_modules.sh,build_interfaces.sh. If it detects a crossCC(target triple ≠ host) orOECORE_*_SYSROOT, it aborts with a clear message pointing to the direct-CMake recipe.clean/help paths bypass it so they stay usable anywhere;BINDER_ALLOW_CROSS_ENV=1overrides.docs/standards/build_integration.md(new, wired into the nav) — the integration contract for third-party/Yocto build systems: two-stage build via direct CMake, required variables, BitBake recipe pattern, and why the wrapper scripts are not used.Testing
bash -non all four scripts — clean.CC/OECORE) → allowed;OECORE_*set → blocked; crossCC→ blocked;BINDER_ALLOW_CROSS_ENV=1→ allowed.build_modules.sh --helpbypasses the guard (exit 0);build_modules.sh <module>andbuild_interfaces.sh sdkin a simulated OE env abort before doing any work with the pointer message.Update: reference recipes added
Folded in copy-me integration recipes so the guide ships instructions + examples:
docs/standards/examples/rdk-halif-aidl.bb— BitBake reference recipe.docs/standards/examples/rdk-halif-aidl.yaml— Bob Build Tool reference recipe.Both are thin wrappers over the same direct-CMake invocation, demonstrating the build is build-system-agnostic. Linked from
build_integration.md; marked as reference templates (pin to a release tag, adapt toolchain/sysroot), not CI-verified — I have no Yocto/Bob environment to execute-test them.