Skip to content

Support a persistent Linux board override - #418

Merged
makermelissa merged 2 commits into
adafruit:mainfrom
makermelissa-ai-assistant:assistant/cm4-carrier-board-override
Oct 26, 2026
Merged

makermelissa merged 2 commits into
adafruit:mainfrom
makermelissa-ai-assistant:assistant/cm4-carrier-board-override

Conversation

@makermelissa-ai-assistant

@makermelissa-ai-assistant makermelissa-ai-assistant commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #165 by implementing a vendor- and generation-independent Linux board-ID file for custom boards and SoM carriers.

Changes

  • On Linux, optionally read /etc/blinka-board before ordinary board detection to select a known public constant from adafruit_platformdetect.constants.boards.
  • Preserve BLINKA_FORCEBOARD precedence and existing per-Detector caching. Chip detection remains independent; non-Linux platforms do not consult the file.
  • Keep ordinary board detection if the file is missing, unreadable, invalid UTF-8, empty, or does not select a known public string constant.
  • Document configuration and support boundaries, and run hardware-free regression tests in CI using the standard library.

This is an explicit system-wide administrator-selected override, like a persistent BLINKA_FORCEBOARD, not automatic carrier identification or an electrical-compatibility check. BLINKA_FORCEBOARD can override the file for an individual process, including USB-adapter use. It does not configure peripherals, change device trees, add chip support, or add a particular carrier's pin mapping. A new carrier still needs its PlatformDetect constant/family memberships and corresponding Blinka board definition/routing. Connector-compatible modules with different SoCs still require appropriate mappings.

The file is deliberately not limited to Raspberry Pi CM4: it also applies to other Raspberry Pi Compute Module generations, third-party compatible modules, and other Linux SoM designs. The initial, unmerged /etc/cm4-board path has been replaced rather than retained as an alias.

Verification

  • All 22 hardware-free tests pass (python -m unittest discover -s tests -v). They cover all seven supported Raspberry Pi Compute Module types, non-Broadcom chip identities, independent chip/board selection, non-Linux isolation, revision decoding and model fallback without a valid override, explicit environment precedence, caching, and failure fallback.
  • GitHub's Linux Build CI passes at e5fcb77.
  • Black, the repository's Pylint rules, REUSE licensing checks, and git diff --check pass.
  • README reStructuredText parsing and Python 3.7 syntax checks pass.
  • Approved fresh-context re-review of e5fcb77 found no issues. Beyond passing the 22 committed tests, the reviewer used real Detector/Chip objects, actual UTF-8 decoding, and in-memory BCM2711/RK3566/A311D device-tree fixtures to verify chip independence and cached selection. The reviewer also checked Blinka's chip-first initialization and first-match board routing, including the documented system-wide effect on USB-adapter processes and per-process BLINKA_FORCEBOARD precedence.
  • Sphinx renders the updated documentation; a strict build with the available Sphinx 8 environment still reports the existing theme configuration's get_html_theme_path deprecation warning. No documentation configuration is changed here.

Local tests and review ran on macOS with hardware-path reads intercepted, not native Linux or MicroPython hardware. No physical GPIOs, USB devices, or board configuration were accessed or changed.

@makermelissa makermelissa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can also apply to Pi CM5, CM3 boards, etc.

@makermelissa-ai-assistant makermelissa-ai-assistant changed the title Support explicit CM4 carrier board selection Support a persistent Linux board override Oct 26, 2026
@makermelissa-ai-assistant

makermelissa-ai-assistant commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor Author

Updated in e5fcb77: the file is now /etc/blinka-board and is not gated by Raspberry Pi model or module vendor. It is a Linux-wide, persistent board override below BLINKA_FORCEBOARD, with chip detection remaining independent. This covers other Pi Compute Module generations and third-party or other SoM designs without maintaining a module allowlist. Non-Linux platforms do not read it. The README explains that connector compatibility does not imply interchangeable GPIO mappings. All 22 hardware-free tests and local lint checks pass. The approved fresh-context re-review of the broader revision is complete with no findings, and GitHub Linux CI passes. The PR description records verification and limitations; no hardware was accessed.

@makermelissa makermelissa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@makermelissa
makermelissa merged commit 11665fc into adafruit:main Oct 26, 2026
1 check passed
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.

How to deal with custom SoC/SoM implementations

2 participants