Skip to content

Add Banana Pi BPI-M1 support and LED locate RPC - #1686

Open
troglobit wants to merge 11 commits into
mainfrom
bpi-m1
Open

troglobit wants to merge 11 commits into
mainfrom
bpi-m1

Conversation

@troglobit

Copy link
Copy Markdown
Contributor

Description

This PR adds support for the Banana Pi BPI-M1 (Allwinner A20) to the 32-bit Arm build, with its own bpi_m1_boot_defconfig. Bringing it up showed a number of 32-bit Arm problems, which are fixed here.

Board:

  • BSP with kernel fixups, a GPT layout that keeps clear of the SPL at 8 KiB, a factory-config with DHCPv4 and DHCPv6 on eth0, temperature sensors, HDMI, the power button and the usr LED
  • MMC_SDHCI dropped from the common U-Boot fragment, since every board with an SDHCI controller already sets it
  • GPIOLIB added to the arm kernel config; without it, GPIO LEDs were missing on all 32-bit boards

32-bit Arm fixes:

  • FRR mgmtd crash on unaligned messages (patch)
  • mdns-alias never published, because libuev forces 64-bit time_t and the rest of the system was 32-bit. All 32-bit Arm builds now use 64-bit time_t
  • iitod crashed and never blinked (iito patches)
  • statd dropped all hardware status when a sensor label contained a space
  • The 32-bit Arm builds no longer include FRR, same as the minimal builds

Locate:

  • New infix-hardware:locate RPC that blinks all LEDs to find the chassis, by default for 60 s
  • Available as locate / no locate in the CLI and as a button on the Hardware page in the web interface
  • Fails with a clear error on systems where iitod is disabled
  • Depends on iitod: 32-bit fixes, control socket and iitoctl iito#4, included here as patches until iito has a release

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):

mgmtd hands its message handlers pointers into the receive stream, where
messages are packed back to back, so some start unaligned.  On 32-bit
Arm GCC uses VFP stores for their 64-bit members, which the kernel
cannot fix up, and mgmtd dies with SIGBUS as soon as a notification
is sent.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Every board with an SDHCI controller already enables MMC_SDHCI in its
own U-Boot defconfig, so the common fragment only forced the driver on
boards with other MMC controllers.  On sunxi this breaks the SPL build,
which has no DM_MMC and cannot compile sdhci.c.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
The first Banana Pi, an Allwinner A20 board.  Mainline U-Boot builds the
SPL and U-Boot together from its Bananapi defconfig, and the A20 boot ROM
loads them from 8 KiB into the SD card, so the GPT partition entries are
moved to 1 MiB.

The sunxi board code resets fdtfile after the environment is imported,
dropping the vendor directory on 32-bit Arm, so ixvariant sets it again
at preboot.  POWER_SUPPLY is enabled explicitly, the sun4i USB PHY
depends on it and the shared kernel config does not set it.

GPIOLIB is added to the shared arm kernel config.  Without it LEDS_GPIO
and LEDS_TRIGGER_GPIO are dropped before any board fixup has selected a
GPIO driver, so GPIO LEDs were missing on all 32-bit Arm boards.

The board is enabled in the arm defconfigs like the other 32-bit boards,
disable BR2_PACKAGE_BANANAPI_BPI_M1 to leave it out of a build.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
hwmon labels are free text, but normalize_sensor_name() only rewrote
underscores, so a label like "SoC temperature" from the Allwinner A20
SoC sensor ended up in the name.  The space breaks the pattern for
sensor names, statd fails to parse the yanger data, and no hardware
status is shown at all.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
libuev exports -D_TIME_BITS=64 to its users, its ABI has time_t in it,
so mdns-alias and finit were built with a 64-bit time_t while everything
else on 32-bit Arm used 32 bits.  mdns-alias passes a struct timeval
between libuev and Avahi, read the wrong size, and turned D-Bus timeouts
into garbage.  Avahi then reported every connection attempt as "Memory
exhausted" and mdns-alias never got to publish anything.

One time ABI for the whole system also makes 32-bit Arm Y2038 ready.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
The 32-bit Arm boards are small, and FRR with bash is a big part of the
image.  Static routing covers what they are used for.  As with the
minimal builds, BUSYBOX_SHOW_OTHERS is set explicitly, since it was
selected only through bash.  neofetch goes too, it selects bash.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
iitod unpacked a boolean into a bool where jansson writes an int,
corrupting the stack on 32-bit Arm as soon as an LED was set on or off,
and printed 64-bit integers with %d, so blink rates came out wrong.
Two latent bugs found along the way are fixed too: rule inputs were
matched by name prefix, and resolving an alias freed a string still in
use by the config.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
iitod gets a control socket, root:wheel so admin users need no sudo, and
the iitoctl tool to show which rule drives each LED and why.  The new
locate method blinks every LED iitod manages, the base for a locate RPC.

The patches change Makefile.am, so the package is now autoreconfigured.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
RPCs that act on the device should log who asked for them, but the
helper that finds the requesting user was private to support.c.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
A locate started from a management system is easily forgotten, and
keeps every LED blinking.  iitod now takes an optional timeout.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Blinks all LEDs, by default for 60 seconds, so the unit can be found,
e.g., in a rack.  Available over NETCONF/RESTCONF, as the CLI command
locate, and from the Hardware page in the web interface.  The default
NACM rules deny guests, all other users may call it.

confd forwards the request to iitod, which keeps the timer.  Systems
where iitod is disabled, because of unreliable kernel LED support, have
no control socket and the RPC fails with an error saying so.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
@troglobit
troglobit requested a review from mattiaswal October 4, 2026 21:35

This branch has not been deployed

No deployments
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