Skip to content

Add support for Banana Pi BPi-R64#1430

Open
troglobit wants to merge 10 commits intomainfrom
bpi-r64
Open

Add support for Banana Pi BPi-R64#1430
troglobit wants to merge 10 commits intomainfrom
bpi-r64

Conversation

@troglobit
Copy link
Contributor

Description

  • Speed up boot time a bit (from initviz branch)
  • Add support for Banana Pi BPi-R64
  • Add support for Mediatek MT7615 firmware

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

@troglobit troglobit marked this pull request as ready for review March 8, 2026 19:25
@troglobit troglobit requested a review from mattiaswal March 8, 2026 19:25
Calling tune2fs for ext4 partitions at boot costs more than one second
boot time on 32-bit Arm systems, with very little gain.  Dropping this
restores the default periodic fsck *and* saves boot time.

Instead of calling sgdisk four times, call it only when resizing and
instead use sysfs to find named paritions.  Saves seconds on boards
with weaker CPU and slow media.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Replace the costly read-only filter loop (awk+tr per line) with a
stderr redirect, use /sys/class/net/ instead of ip+jq, and batch
all sysctl writes into a single call.

Reduces boot time by ~4s on 32-bit Arm systems.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Two related problems prevented devices behind an intermediate hub (e.g.
the VIA Labs hub on the RPi 400's VL805 xHCI) from being authorized
when confd unlocks a USB bus:

1. Cascade ordering: usb_authorize() ran nftw() with FTW_DEPTH, which
   visits children before the root-hub entry.  The hub was authorized
   while authorized_default was still 2, so when the kernel probed the
   hub's children it immediately denied them.  Fix: write
   authorized_default=1 on the bus before entering nftw.

2. Slow/async probe: hub port enumeration is asynchronous — devices
   behind a hub may appear in sysfs after nftw has already finished.
   Fix: add a udev rule that catches usb_device add events on buses
   where authorized_default=1 is already set on any ancestor root hub
   and authorizes them immediately.

The ATTRS{} matcher in udev walks the full sysfs parent chain, so
authorized_default=1 on the root hub is visible even for devices several
hubs deep.  Buses still locked at authorized_default=0 are left alone.

Also expand the docstring in generic_usb_ports() to document the
design: each root hub gets its own uniquely-named entry (USB, or USB1/
USB2/... when multiple) so buses can be individually controlled, and
boards needing finer control should use DT usb-ports annotations.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Remove console=map:0 from the [pi4] section which was suppressing HDMI
output and disabling the display getty.  Making it really difficult to
use it as a regular console.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
The Raspberry Pi 400 shares hardware with the RPi 4B but differs in one
important way: it has an internal keyboard and mouse connected through a
VIA Labs USB hub on the VL805 xHCI controller.  Break the symlink to
raspberrypi,4-model-b and maintain a dedicated product directory.

Factory config changes from the 4B default:
- USB1/USB2/USB3 all unlocked: USB2 carries the internal keyboard hub
  and USB3 the superspeed companion; all are unlocked as this is a
  desktop device
- DHCP vendor-class corrected to "Raspberry Pi 400"

Also add interface-quirks.json for the eth0 PHY detach behaviour and
the smsc95xx broken flow-control quirk (inherited from the 4B config
but now explicit), and remove the spurious bootable flag from the
primary and secondary rootfs partitions in genimage.cfg.in.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
In a hybrid MBR the conventional layout (used by gdisk and others) is:

  MBR[0] = 0xEE  (GPT protective, covers whole disk)
  MBR[1..3] = user-selected GPT partitions with legacy type codes

genimage currently appends the 0xEE entry after the data partitions,
producing the opposite order.  This is fine for most platforms, but
breaks firmware that detects GPT by inspecting only MBR entry 0: seeing
a non-0xEE type there it falls into pure-MBR mode and cannot look up
GPT partitions by name.

The TF-A partition driver (drivers/partition/partition.c) exhibits
exactly this behaviour: load_mbr_header() copies entry[0] and checks
type == 0xEE to select between MBR and GPT mode.  The MediaTek MT7622
platform (BananaPi BPI-R64) is a concrete example where this matters.

On the other hand, Raspberry Pi firmware scans all MBR slots for a
bootable FAT32 partition.  If slot 0 holds a 0xEE protective entry the
firmware switches to GPT detection, looks for an EFI System Partition
UUID, and reports "no bootable partitions" when none is found.

Add an opt-in hdimage option `gpt-protective-first = true` that places
the 0xEE entry at slot 0 and shifts data partitions to slots 1..3.
The default (false) preserves the existing genimage behaviour so that
platforms like Raspberry Pi continue to work without any changes.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Add board support for the BananaPi BPi-R64 router board, based on the
MediaTek MT7622 SoC and MT7531 Gigabit Ethernet switch.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Used in BPI-MT7615 802.11ac PCIe WiFi card for the BPi-R64 router board.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
dtoverlay=vc4-kms-v3d-pi4
lcd_rotate=2

# Prevent console on DSI
Copy link
Contributor

@mattiaswal mattiaswal Mar 10, 2026

Choose a reason for hiding this comment

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

I think i remember why this was added now, it is for uboot not clogging the splashimage.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Aha! Well it works fine on HDMI output without this, and is also needed to make RPi usable on HDMI. So what should we do?

Copy link
Contributor

Choose a reason for hiding this comment

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

I can test this on a rpi with display at home

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can test this on a rpi with display at home

Great, thanks! Then we'll hold off picking the first two commits (boot-time speedup) to the v26.02.x branch until you've had the time to test.

Copy link
Contributor

Choose a reason for hiding this comment

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

Move boottime speedup to a seperate pr, and we merge it.

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