Skip to content

Conversation

@troglobit
Copy link
Contributor

@troglobit troglobit commented Oct 29, 2025

Description

New Hardware Support:

  • NanoPi R2S (Tier 2, added to default aarch64 build)
  • Raspberry Pi 3B (BCM2837)
  • Raspberry Pi CM4 variants, Waveshare IoT Router Board Mini and NVME NAS box

Board Infrastructure:

  • Relocated src/board/* and package/board/* to unified board/ directory
  • Renamed raspberry-pi-4raspberrypi-rpi64
  • Consolidated SD card image generation into utils/mkimage.sh
  • Extended /var partition auto-expansion to all MMC devices
  • Renamed mt7986_sd_boot_defconfigbpi_r3_boot_defconfig

USB & Drivers:

  • Fixed duplicate USB port names in discovery
  • Made USB subsystem built-in
  • Added common USB-to-Ethernet drivers

Hardware Monitoring & Sensors

show-sys

YANG Models:

  • infix-hardware@2025-10-18: Added wifi identity, enabled parent/child hierarchy
  • infix-system@2025-10-18: Added resource usage and service monitoring

Sensor Support:

  • Complete hwmon sensor discovery: temp, fan, voltage, current, power
  • Hierarchical display with parent/child relationships for multi-sensor devices
  • WiFi PHY identification with band detection (2.4/5/6 GHz)
  • Human-readable descriptions from hwmon labels

CLI:

  • New show system: hostname, uptime, load, CPU temp, fan, memory, disk
  • Enhanced show hardware: hierarchical sensors, improved formatting, color-coded temps
  • Fixed WiFi PHY to interface mapping (phy0→wifi0, phy1→wifi1)

Configuration

  • Updated BPi-R3 factory-config with full network setup
  • Synced NanoPi R2S factory-config (bridge, DHCP, firewall, crypto types)
  • Fixed firewall zone description type (was int, now string)

Checklist

Tick relevant boxes, this PR is-a or has-a:

  • Bugfix
    • Regression tests
    • ChangeLog updates (for next release)
  • Feature
    • YANG model change => revision updated?
    • Regression tests added?
    • ChangeLog updates (for next release)
    • Documentation added?
  • Test changes
    • Checked in changed Readme.adoc (make test-spec)
    • Added new test to group Readme.adoc and yaml file
  • Code style update (formatting, renaming)
  • Refactoring (please detail in commit messages)
  • Build related changes
  • Documentation content changes
    • ChangeLog updated (for major changes)
  • Other (please describe):

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
@troglobit troglobit requested review from mattiaswal and wkz October 29, 2025 20:15
@troglobit troglobit added the ci:main Build default defconfig, not minimal label Oct 29, 2025
@troglobit troglobit changed the title Massive board refactoring, and new sensor support, as well as NanoPi R2S, RPi 3B and CM4 support Board refactor, new sensor support, and NanoPi R2S, RPi 3B + CM4 support Oct 29, 2025
@troglobit troglobit changed the title Board refactor, new sensor support, and NanoPi R2S, RPi 3B + CM4 support Board refactor, sensor support, and NanoPi R2S, RPi 3B + CM4 support Oct 29, 2025
@troglobit troglobit changed the title Board refactor, sensor support, and NanoPi R2S, RPi 3B + CM4 support Board refactor, sensors and NanoPi R2S, RPi 3B + CM4 support Oct 29, 2025
@troglobit troglobit force-pushed the rpi-and-more branch 2 times, most recently from 1a5f8f4 to eb00386 Compare October 30, 2025 08:37
Copy link
Contributor

@wkz wkz left a comment

Choose a reason for hiding this comment

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

Awesome stuff! 🔥

Copy link
Contributor

Choose a reason for hiding this comment

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

I assume the regular udevadm triggers are not sufficient. Why is that? Can we move them to accommodate the R2S without the need for a board specific patch?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These triggers sometimes clash which is why we've made them board specific. Unfortunately udev starts before the init.d/ scripts run and install these udev rules. We've spent a good while thinking about how to fix this, but not yet come up with any good ideas.

@wkz
Copy link
Contributor

wkz commented Oct 30, 2025

One more thing: have a look at the matching stuff I added to has-quirk. With that, you can match on things like the driver name, rather than just interface names.

@troglobit
Copy link
Contributor Author

troglobit commented Oct 30, 2025

One more thing: have a look at the matching stuff I added to has-quirk. With that, you can match on things like the driver name, rather than just interface names.

Thanks for that, @wkz, didn't even know we had that type of matching!

I've addressed almost all of your comments, only one was squashed into an existing commit (the big board refactor), the others are follow-up commits starting with board/aarch64:. The one comment I cannot address is the udev rules chicken-and-egg situation, which I believe would require a significant retake on the Infix bootstrap process.

Also, for the foo-%m change I had to add a fallback base MAC detection mechanism. This base mac is now visible also in ietf-hardware.yang under the 'chassis' component.

@troglobit troglobit requested a review from wkz October 30, 2025 10:34
@troglobit
Copy link
Contributor Author

@mattiaswal I've addressed your comments and I hope I've answered your questions. I can push another update with the whitespace fix, but that feels a bit excessive to waste CPU cycles on, unless you want me to also drop the "confd: minor, coding style fixes in ietf-hardware.c" commit as well? It clashed with your PR, right?

@mattiaswal
Copy link
Contributor

@mattiaswal I've addressed your comments and I hope I've answered your questions. I can push another update with the whitespace fix, but that feels a bit excessive to waste CPU cycles on, unless you want me to also drop the "confd: minor, coding style fixes in ietf-hardware.c" commit as well? It clashed with your PR, right?

Thanks :D

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Use kernel cmdline option 'usbcore.authorized_default=2' to lock all
external/user-visible USB ports by default.

The kernel distinguishes internal vs external USB ports using ACPI
methods (_UPC and _PLD) on x86/x86_64 systems.  On ACPI systems, ports
marked as non-visible but connectable are considered internal (e.g.,
hard-wired USB-to-Ethernet adapters) and are automatically authorized,
while user-visible external ports require manual authorization.

However, on device tree systems the kernel lacks a standard mechanism
for identifying internal ports. The 'authorized_default=2' setting falls
back to requiring authorization for all devices on these platforms,

We list user-accessible USB ports in the device tree ('usb-ports' and
'usb-port-names'), with unlisted ports being implicitly internal and
managed separately.

Fixes #1065

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
The BCM2837 core is used not just in the RPi 3B but also in the Zero 2W,
both device trees have been added to the board config.

The BCM2711 support has been extended to include RPi 400 and CM4 I/O.

To support the BCM2837 family more firmware options habe been enabled,
since the RPi3 does not have bootcode.bin flashed in the SoC.  The SD
card image now uses a hybrid GPT/MBR format so the RPi3 bootcode.bin
can read all files from the first VFAT partition.

The default device tree for Linux is now chosen by the U-Boot probe and
the only exception is the "laundry room" detector that looks for a RPi4
with a 7" touch screen, which then selects the DSI enabled RPi4 variant.
This is enough to properly load an RPi 3B and a CM4 based router board.

The BCM2837 does not have PCI/PCIe or a built-in MAC so it relies on the
USB to Ethernet LAN78xx which does not support disabling pause frames.
I have opted for checking for EOPNOTSUPP instead of adding yet another
quirk, because it is likely to be a common limitation of more drivers
and chipsets, and this code is best-effort anyway.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit adds support for the Raspberry Pi CM4 based mini DFRobot IoT
Router board, SKU:DFR0767.  It comes with an additional RTL8111 PCIe NIC
hence the addidtional kernel module and firmware.  The latter fixes:

r8169 0000:01:00.0: Direct firmware load for rtl_nic/rtl8168h-2.fw failed with error -2
r8169 0000:01:00.0: Unable to load firmware rtl_nic/rtl8168h-2.fw (-2)

Please note, the change in BCMGENET from module to built-in is to ensure
it is probed before any PCIe NIC, both this board and the CM4-based NVME
NAS base board enumerate the built-in MAC as eth0.

Also, unlike the RPi 3B/4B, it is not a given fact that a CM4 based board
comes with WiFi onboard, and since most compute module setups are DYI, we
take the easy way out and leave it as an exercise to the user to add WiFi
interface to the config.

https://wiki.dfrobot.com/Compute_Module_4_IoT_Router_Board_Mini_SKU_DFR0767

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit refactors USB port probing to:

- Eliminate duplicates: previously, 'authorized' and 'authorized_default'
  were listed as separate USB port entries (confusing).  Now each USB
  port is represented once, with the path pointing to the USB device
  directory, confd appends the appropriate attribute file as needed

- Add support for Raspberry Pi 4B and CM4 USB port(s) using a generic
  discovery function that scans /sys/bus/usb/devices for USB root hubs.
  This should work seamlessly across all platforms

- For backwards compatibility and better UX:
   - Single USB port systems: Named "USB" (no number)
   - Multi-port systems: Named "USB1", "USB2", etc.

- Device tree-based discovery is tried first (for boards like Alder with
  explicit DT USB port definitions), with fallback to generic discovery
  for boards without DT

Fixes: #315

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
@mattiaswal mattiaswal self-requested a review October 30, 2025 13:34
Copy link
Contributor

@mattiaswal mattiaswal left a comment

Choose a reason for hiding this comment

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

Great work! 💯

On some boards, and in particular with a hybrid mbr/gpt partition table,
like on the RPi64, we must resize ext *after* reboot.

Also, do some cleanup and consolidation of error handling to prevent us
from entering an endless boot loop.

Follow-up to 391e971

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
The DWC2 controller is a very common IP block in ARM and RiscV SoCs.  With the
USB subsystem back to a built-in we can now enable host mode for the DWC2 (USB
2.0) ports on RPi.  It also opens up for merging the NanoPi R2S into the
generic aarch64 build.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Usually, when upgrading a system, you want to reboot it so the upgrade
takes effect.  This commit adds a 'reboot' option/flag, alongside the
'force' option, to facilitate this.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
 - Remove class deviation to allow iana-hardware:sensor
 - Populate sensor operational data from /sys/class/thermal
 - Extend 'show hardware'

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit adds resource usage: memory, loadavg, and filesystem usage
by augmenting ietf-system:/system-state.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
For more advanced hardware with multiple sensor types per device
(e.g., SFP modules with temperature, voltage, current, and power
sensors), use the YANG parent/child relationship to group related
sensors together for better presentation.

Changes:
 - Remove parent/parent-rel-pos deviations from infix-hardware.yang
 - Create parent components (class: module) for multi-sensor devices
 - Add parent references to child sensor components
 - Add human-readable descriptions from hwmon labels
 - Extend hwmon discovery to support voltage, current, and power
 - Normalize sensor names: strip vendor prefixes (mt7915_phy0 -> phy0)
 - Remove redundant TYPE column, clarify units (V -> VDC, add spaces)
 - Simplify child sensor display by stripping parent prefix
 - Fix "show system" to only show CPU temperature and fan speed

Example output from "show hardware":

  NAME                     VALUE               STATUS
  ===================================================
  sfp1:
    Rx Power               0.000 W             ok
    Tx Power               0.001 W             ok
    Vcc                    3.35 VDC            ok
    Bias                   0.006 A             ok
    Temperature            30.3 °C             ok

  sfp2:
    Rx Power               0.000 W             ok
    Tx Power               0.001 W             ok
    Vcc                    3.34 VDC            ok
    Bias                   0.006 A             ok
    Temperature            32.0 °C             ok

  cpu                      42.8 °C             ok
  phy0                     47.0 °C             ok
  phy1                     53.0 °C             ok

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
With the additional support for RPi3, including Zero 2W, this commit renames
all relevant directories and Config.In options to match.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit consolidates all BSP support files into the Buildroot standard
board/ directory.  The concept of selectable boards in menuconfig remains
as-is but now lives in board/ instead.

Drop support for board-specific post-build.sh scripts, not needed atm. and
we should really use Buildroot _POST_INSTALL_HOOKS in the board .mk files
instead.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit drops the board specific defconfig in favor of proper BSP
support for the FriendlyARM NanoPi R2S to Infix as part of the default
Aarch64 build.

The name FriendlyARM was elected over FriendlyELEC ("new" name) to be
consistent with both kernel and Buildroot naming standards.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
- Enable bridging of LAN ports in br0, default IP: 192.168.0.1/24
- Enable firewall with two zones: 'wan' and 'lan', policy: lan-to-wan
- Enable DHCP server on br0

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
The xPi's usually don't have a VPD so the chassis mac-address probed at
boot is usually null in /run/system.json.  This commit adds a fallbkack
mechanism to populate this field so it can be used for unique hostnames
even on these boards.

Ths ietf-hardware.yang model does not have a notion of physical address,
so we augment one tht is generic enought to be used for other hardware
components than Ethernet, similar to what ietf-interfaces.yang use.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Add new interface quirk to allow skipping disabling of flow control on
all RPi 3B/4B devices that have the smsc95xx driver.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit consolidates mkimage.sh scripts into a unified SD card image
creation tool that works for all boards.  It needs a bootloader an $ARCH
rootfs.squashfs image and a genimage.cfg.in template.

- Detects build directories from `O=` environment variable or `output/`
- Sources `.config` to discover Buildroot paths
- Uses Buildroot's `support/scripts/genimage.sh` when available
- Automatically generates `.bmap` files if `bmaptool` is available
- Fallback to direct `genimage` invocation if wrapper not found

See the online instructions for usage.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:main Build default defconfig, not minimal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants