RFC: Add OrangePi RV2 support with RISC-V KY platform
Description
OrangePi RV2 features Ky X1 SoC that seems to be similar to Spacemit K1, however the bananapif3 board is not 100% compatible because of a different boot process (OPi RV2 uses SPI flash, unlike eMMC on BananaPi-F3), different Ethernet PHYs and different WiFi module.
This patch implements board support for OrangePi RV2 including:
- New KY family configuration for RISC-V platform
- Custom U-Boot sources from OrangePi (v2022.10-ky branch)
- Custom kernel sources (orange-pi-6.6-ky branch)
- SPI NOR flash boot support with MTD partitioning
- Hardware support for WiFi (AP6256), Bluetooth, CAN, V4L
- BSP packages and platform-specific configurations
- Boot scripts and environment files
Board boots from SPI flash with specialized bootloader layout.
Based on OrangePi BSP adapted for current Armbian architecture. https://github.com/orangepi-xunlong/orangepi-build.git
How Has This Been Tested?
[*] Image built with
./compile.sh build BOARD=orangepirv2 BRANCH=edge RELEASE=trixie
[*] Written to the SD card and test-booted
[ 0.000000] Linux version 6.6.63-edge-ky (build@armbian) (riscv64-linux-gnu-gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0, GNU ld (GNU Binutils for Ubuntu) 2.42) #4 SMP PREEMPT Tue Mar 18 02:29:27 UTC 2025
[ 0.000000] Machine model: ky x1 orangepi-rv2 board
....
[] Written to the NVMe SSD and test-booted [] Ethernet works
[ 6.463699] x1_emac cac80000.ethernet end0: renamed from eth0
[ 6.504825] x1_emac cac81000.ethernet end1: renamed from eth1
[ 43.377774] x1_emac cac80000.ethernet end0: registered PTP clock
[ 46.455296] x1_emac cac80000.ethernet end0: Link is Up - 1Gbps/Full - flow control rx/tx
[*] WiFi works
[ 3.292460] ky-wlan rf-pwrseq:wlan-pwrseq: error -ENXIO: IRQ index 0 not found
[ 3.296957] ky-wlan rf-pwrseq:wlan-pwrseq: get platform irq failed, try to get gpio irq
[ 10.217539] [dhd] STATIC-MSG) dhd_static_buf_init : 101.10.361.36 (wlan=r892223-20231107-1)
[ 10.226489] [dhd] STATIC-MSG) dhd_init_wlan_mem : prealloc ok for index 0: 8459264(8261K)
[ 10.303821] [dhd] dhd_wlan_init_gpio: WL_HOST_WAKE=-1, oob_irq=72, oob_irq_flags=0x1
[ 10.303836] [dhd] dhd_wlan_init_gpio: WL_REG_ON=-1
[ 10.975192] [dhd] STATIC-MSG) dhd_wlan_mem_prealloc : section 3, size 139264
[ 10.986735] [dhd] STATIC-MSG) dhd_wlan_mem_prealloc : section 4, size 0
[ 11.046406] [dhd] STATIC-MSG) dhd_wlan_mem_prealloc : section 7, size 42968
[ 11.060940] [dhd] STATIC-MSG) dhd_wlan_mem_prealloc : section 0, size 10320
[ 11.100275] [dhd] STATIC-MSG) dhd_wlan_mem_prealloc : section 5, size 65536
[ 11.116201] [dhd] STATIC-MSG) dhd_wlan_mem_prealloc : section 19, size 65720
[ 11.188396] [dhd] STATIC-MSG) dhd_wlan_mem_prealloc : section 1, size 10300
[ 11.195559] [dhd] STATIC-MSG) dhd_wlan_mem_prealloc : section 2, size 65536
[ 11.225519] [dhd] Register interface [wlan0] MAC: 40:d9:5a:0d:b6:b0
[ 11.233572] [dhd] [wlan0] wl_android_wifi_off : g_wifi_on=1 force_off=1
[ 11.310743] [dhd] [wlan0] wl_android_wifi_off : out
[54418.421178] [dhd] [wlan0] dhd_open : Enter
[54418.448341] [dhd] [wlan0] wl_android_wifi_on : in g_wifi_on=0
[54419.639214] [dhd] [wlan0] wl_android_wifi_on : Success
[54419.705040] [dhd] [wlan0] dhd_open : Exit ret=0
[54419.709625] [dhd] [wlan0] dhd_pri_open : tx queue started
[54434.119570] [dhd] [wlan0] wl_run_escan : LEGACY_SCAN sync ID: 0, bssidx: 0
Checklist:
Please delete options that are not relevant.
- [?] My code follows the style guidelines of this project
- [?] I have performed a self-review of my own code
- [*] My changes generate no new warnings
Walkthrough
Adds Orange Pi RV2 board config with metadata, U-Boot extra configs, and BSP tweaks. Introduces a new “ky” family with kernel/boot settings, U-Boot write helpers, and BSP extras. Adds KY boot environment and boot script. Includes initramfs hook to bundle firmware, camera test JSON configs, and platform setup script. Provides a comprehensive USB gadget management tool, an Access Point setup utility, and an SSH reset script. Adds systemd overrides and an autologin helper for getty/serial-getty. Changes are primarily new files: configs, boot scripts, BSP utilities, and system services.
Estimated code review effort
🎯 5 (Critical) | ⏱️ ~120 minutes
Suggested labels
Needs review, size/large, Hardware, BSP, Patches, Framework
Suggested reviewers
- igorpecovnik
- clee
- rpardini
- leggewie
- EvilOlaf
- PanderMusubi
- teknoid
- janprunk
Pre-merge checks and finishing touches
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | ⚠️ Warning | Docstring coverage is 15.09% which is insufficient. The required threshold is 80.00%. | You can run @coderabbitai generate docstrings to improve docstring coverage. |
✅ Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title Check | ✅ Passed | The title succinctly and accurately summarizes the primary change of adding support for the OrangePi RV2 board on the RISC-V KY platform, reflecting the main focus of the pull request without introducing irrelevant details or vague terms. |
| Description check | ✅ Passed | The pull request description clearly explains the purpose of the changes: adding Orange Pi RV2 board support for the RISC-V KY platform, detailing key features like SPI flash boot, WiFi, and custom sources, with testing evidence. |
✨ Finishing touches
- [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
Comment @coderabbitai help to get the list of available commands and usage tips.
I'm no expert in riscv but from my guts feel it should be tried to merge this into existing riscv64 family if possible and do necessary adjustments on board level.
@EvilOlaf Yes, it seems ky.conf family has been forked from config/sources/families/spacemit.conf .
TBH I have no insight into Spacemit - Ky relationship and therefore this RFC PR is based on assumption that this SoC is indeed different from Spacemit K1 and therefore merits its own family. The public speculations go in both ways AFAIK:
- https://www.reddit.com/r/RISCV/comments/1ledew3/my_look_at_the_orange_pi_rv2_ky_x1_with_8x/
- https://www.reddit.com/r/spacemit_riscv/comments/1n28rru/relationship_between_ky_x1_and_spacemit_k1/
If there is an argument for integrating these two together I am fine with that and will try to do the work.
I'm no expert in riscv but from my guts feel it should be tried to merge this into existing riscv64 family if possible and do necessary adjustments on board level.
In general we try to minimize the number of family's (i.e. the number of distinct kernels we have to build and support) as they take a significant amount of both system and human resources ongoing. But it is always a balancing act, we could simply have a distinct family for every board, but then the maintenance of all those kernel patches across nearly identical boards would be taxing, but this provides ultimate flexibility. The other extreme is that we could try for one universal kernel that supports all archtectures. In the past there have been efforts to have one kernel that uspports all amlogic, allwinner and rockchip 64 bit cpus in one kernel. Obviously this has a lot of benefits as far as maintenance and system resources goes, but comes with the drawback of risk of breaking some random board for every patch applied. So the general strategy is to minimize the number of families but realize that there are good reasons to have different families at times. Neither I or @EvilOlaf have familiarity with your cpu, so I can only provide general guidance to you in this matter.
indeed different from Spacemit K1 and therefore merits its own family
New kernel family represent stress and long term burden. In most cases the difference between vendor kernels are minor and we only take patches from one and base on top of the other. In our case, Banana f3 SpaceMit kernel. Also boot scripts - we already have tons of them - there is initiative to get that in order as its going out of our hands (maintaining wise). Those are important aspects and should be taken care of rather then going the easy way. I understand its a bit more work for you and i hope you do understand - thank you for the time you invested so far.
There is no rush - replace with existing files and configs, one at the time.
Also we probably don't want to include scripts such as create AP, a copy from https://github.com/oblique/create_ap
You can refer to what I made. https://github.com/libiunc/Armbian-build/commit/f44b06a0f0c8d10a47a735f49c4ef0b241e0686c I finished it before, but forgot to do the PR.
The KY-X1 and Spacemit K1 are compatible SoCs. check this
https://gitee.com/bianbu-linux/uboot-2022.10/commit/deec0a67aa70a9457bbf1fc53d1b8dc53aaa10f4
https://gitee.com/bianbu-linux/linux-6.6/commit/f494df3b5844bdb74d1d31ef0b9d035c0232c364
TL.DR dts: InnoBoard-Pi == OrangePi RV2
In short, you can directly classify it as part of the Spacemit family. You only need to change the DTS name (this may require hacking the U-Boot parameters).