Skip to content

Recognise compute modules in assert_hw_rpi - #19

Merged
rmens merged 2 commits into
mainfrom
recognise-compute-modules
Sep 30, 2026
Merged

rmens merged 2 commits into
mainfrom
recognise-compute-modules

Conversation

@mitchellklijs

@mitchellklijs mitchellklijs commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

assert_hw_rpi rejects every Raspberry Pi Compute Module.

A CM4 or CM5 reports Raspberry Pi Compute Module 4 Rev 1.1 / Raspberry Pi Compute Module 5 Rev 1.0 in /proc/device-tree/model. The generic pattern looks for a digit directly after Raspberry Pi, which those strings never contain, so they fall through to the else branch and the caller exits with:

** NOT RUNNING ON A RECOGNIZED RASPBERRY PI MODEL **

This matches compute modules before the generic pattern and maps them to their generation, which is the question the function is really asking: a CM5 is a Pi 5 on a different carrier, with the same SoC. The original CM carries no number at all and maps to 1.

Checked against the model strings of CM1 through CM5 and of the Pi 1, 4, 5 and 400:

model before after
Raspberry Pi Compute Module 5 Rev 1.0 unrecognised 5
Raspberry Pi Compute Module 4 Rev 1.1 unrecognised 4
Raspberry Pi Compute Module 3 Plus Rev 1.0 unrecognised 3
Raspberry Pi Compute Module Rev 1.1 unrecognised 1
Raspberry Pi 5 Model B Rev 1.1 5 5
Raspberry Pi 4 Model B Rev 1.4 4 4
Raspberry Pi 400 Rev 1.0 400 400
Raspberry Pi Model B Plus Rev 1.2 1 1

No previously recognised board changes. A Pi Zero 2 W is still unrecognised, as it was before; that is a separate question and is left alone here.

Found while provisioning a CM5 with rpi-texttv, which calls assert_hw_rpi 4 and could not get past it.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved Raspberry Pi hardware detection for numbered Compute Modules; unnumbered Compute Modules are recognized as model 1. Other Raspberry Pi model checks remain unchanged.

@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 50 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: d44f4635-f4d8-479b-beb1-015a3078c26a

📥 Commits

Reviewing files that changed from the base of the PR and between b789c69 and 0d52588.

📒 Files selected for processing (1)
  • common-functions.sh

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 7357cbec-2d33-4202-b6b4-d027f742ceaa

📥 Commits

Reviewing files that changed from the base of the PR and between 8210fd5 and b789c69.

📒 Files selected for processing (1)
  • common-functions.sh

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

assert_hw_rpi now identifies numbered Raspberry Pi Compute Modules by generation number and treats unnumbered Compute Modules as model 1 before checking the existing generic Raspberry Pi model pattern.

Changes

Raspberry Pi model detection

Layer / File(s) Summary
Compute Module detection
common-functions.sh
assert_hw_rpi recognizes numbered Compute Modules by generation number and unnumbered Compute Modules as model 1 before applying the existing generic model-number pattern.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to b789c

The documented minimum-generation check accepts Compute Module 5, so the stated provisioning path is not blocked. No actionable merge risk is evident.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding Compute Module recognition to assert_hw_rpi.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

A CM4 or CM5 reports "Raspberry Pi Compute Module 4/5" in
/proc/device-tree/model. The generic pattern looks for a digit directly
after "Raspberry Pi", which such a string never contains, so every
compute module fell through to the else branch and the script exited
with "NOT RUNNING ON A RECOGNIZED RASPBERRY PI MODEL".

Match compute modules before the generic pattern and map them to their
generation, which is the question the function is actually asking: a CM5
is a Pi 5 on a different carrier. The original CM carries no number and
maps to 1.

Verified against the model strings of CM1 through CM5 and of the Pi 1,
4, 5 and 400; none of the previously recognised boards change. A Pi Zero
2 W is still unrecognised, as it was before, and is left alone here.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@mitchellklijs
mitchellklijs force-pushed the recognise-compute-modules branch from bc4d62c to a081eef Compare September 30, 2026 21:53
@rmens
rmens merged commit d3db3f3 into main Sep 30, 2026
3 checks passed
@rmens
rmens deleted the recognise-compute-modules branch September 30, 2026 21:56
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.

2 participants