Skip to content

orange-pi-5-max: init #1409

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -340,6 +340,7 @@ See code for all available configurations.
| [Omen 15-en1007sa](omen/15-en1007sa) | `<nixos-hardware/omen/15-en1007sa>` |
| [Omen 15-en0002np](omen/15-en0002np) | `<nixos-hardware/omen/15-en0002np>` |
| [One-Netbook OneNetbook 4](onenetbook/4) | `<nixos-hardware/onenetbook/4>` |
| [Orange Pi 5 Max](orange-pi/5-max) | `<nixos-hardware/orange-pi/5-max>` |
| [Panasonic Let's Note CF-LX4](panasonic/letsnote/cf-lx4) | `<nixos-hardware/panasonic/letsnote/cf-lx4>` |
| [PC Engines APU](pcengines/apu) | `<nixos-hardware/pcengines/apu>` |
| [PINE64 Pinebook Pro](pine64/pinebook-pro/) | `<nixos-hardware/pine64/pinebook-pro>` |
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -292,6 +292,7 @@
omen-15-en0002np = import ./omen/15-en0002np;
onenetbook-4 = import ./onenetbook/4;
olimex-teres_i = import ./olimex/teres_i;
orange-pi-5-max = import ./orange-pi/5-max;
pcengines-apu = import ./pcengines/apu;
pine64-pinebook-pro = import ./pine64/pinebook-pro;
pine64-rockpro64 = import ./pine64/rockpro64;
85 changes: 85 additions & 0 deletions orange-pi/5-max/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Creating an installation SD card image

Create and customize a `flake.nix` file:

```nix
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixos-hardware.url = "github:nixos/nixos-hardware";
};

outputs = { nixpkgs, nixos-hardware, ... }:
let
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"riscv64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSupportedSystems = nixpkgs.lib.genAttrs supportedSystems;
in
{
packages = forAllSupportedSystems (system: rec {
default = sd-image;
sd-image = (import "${nixpkgs}/nixos" {
configuration = {
imports = [
"${nixos-hardware}/orange-pi/5-max/sd-image-installer.nix"
];

nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (nixpkgs.lib.getName pkg) [
"orangepi-firmware"
"mali-g610-firmware"
];

# If you want to use ssh set a password
# users.users.nixos.password = "super secure password";
# OR add your public ssh key
# users.users.nixos.openssh.authorizedKeys.keys = [ "ssh-rsa ..." ];

nixpkgs.buildPlatform.system = system;
nixpkgs.hostPlatform.system = "aarch64-linux";

system.stateVersion = "24.11";
};
inherit system;
}).config.system.build.sdImage;
});
};
}
```

Then build the image by running `nix build .#` in the same folder.

## Flashing image
Replace `/dev/sdX` with the device name of your sd card.
```sh
zstdcat result/sd-image/nixos-sd-image-*-orange-pi-5-max.img.zst | sudo dd status=progress bs=8M of=/dev/sdX
```

# Updating the bootloader
Install the enable the update scripts
```nix
hardware.orange-pi."5-max".uboot.updater.enable = true;
```

uart debugging options are applied to the bootloader installed by the firmware update script
```nix
hardware.orange-pi."5-max".uartDebug = {
enable = true; # enabled by default for debugging
baudRate = 57600; # default is 1500000
};
```

## SD-Card
Run as root
``` sh
orangepi5max-firmware-update-sd
```
## SPI Flash
Run as root
``` sh
orangepi5max-firmware-update-flash
```
42 changes: 42 additions & 0 deletions orange-pi/5-max/audio.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{ config, lib, ... }:
let
cfg = config.hardware.orange-pi."5-max".audio;
in
{
options.hardware = {
orange-pi."5-max".audio = {
enable = lib.mkEnableOption "audio device configuration" // {
default = true;
};
};
};

config = lib.mkIf cfg.enable {
services.pipewire.wireplumber.extraConfig = {
"orange-pi-5-max-descriptions" = {
"monitor.alsa.rules" =
let
makeRule = name: description: {
matches = [{ "device.name" = name; }];
actions = {
update-props = {
"device.description" = description;
};
};
};
in
[
(makeRule "alsa_card.platform-hdmi0-sound" "HDMI0 Audio")
(makeRule "alsa_card.platform-hdmi1-sound" "HDMI1 Audio")
(makeRule "alsa_card.platform-es8388-sound" "ES8388 Audio")
];
};
};

services.udev.extraRules = ''
SUBSYSTEM=="sound", ENV{ID_PATH}=="platform-hdmi0-sound", ENV{SOUND_DESCRIPTION}="HDMI0 Audio"
SUBSYSTEM=="sound", ENV{ID_PATH}=="platform-hdmi1-sound", ENV{SOUND_DESCRIPTION}="HDMI1 Audio"
SUBSYSTEM=="sound", ENV{ID_PATH}=="platform-es8388-sound", ENV{SOUND_DESCRIPTION}="ES8388 Audio"
'';
};
}
48 changes: 48 additions & 0 deletions orange-pi/5-max/bluetooth.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{ config, pkgs, lib, ... }:
let
cfg = config.hardware.orange-pi."5-max".bluetooth;
bcmdhd_sdio = config.boot.kernelPackages.callPackage ./kernel/bcmdhd_sdio.nix { };
brcm_patchram_plus = pkgs.callPackage ./brcm_patchram_plus.nix { };
orangepi-firmware = pkgs.callPackage ./orangepi-firmware.nix { };
in
{
options.hardware = {
orange-pi."5-max".bluetooth = {
enable = lib.mkEnableOption "configuration for bluetooth" // {
default = config.hardware.bluetooth.enable;
};
};
};

config = lib.mkIf cfg.enable {
boot = {
kernelModules = [ "bcmdhd_sdio" ];
blacklistedKernelModules = [ "bcmdhd" "dhd_static_buf" ];
extraModulePackages = [ bcmdhd_sdio ];
extraModprobeConfig =
let
options = [
"firmware_path=${orangepi-firmware}/lib/firmware/fw_syn43711a0_sdio.bin"
"nvram_path=${orangepi-firmware}/lib/firmware/nvram_ap6611s.txt"
"clm_path=${orangepi-firmware}/lib/firmware/clm_syn43711a0.blob"
];
in
''
options bcmdhd_sdio ${lib.concatStringsSep " " options}
'';
};

systemd.services."ap611s-bluetooth" = {
enable = lib.mkDefault config.hardware.bluetooth.enable;
description = "Bluetooth loading for AP611S";
after = [ "bluetooth.target" ];
serviceConfig = {
Type = "forking";
ExecStart = "${brcm_patchram_plus}/bin/brcm_patchram_plus --bd_addr_rand --enable_hci --no2bytes --use_baudrate_for_download --tosleep 200000 --baudrate 1500000 --patchram ${orangepi-firmware}/lib/firmware/SYN43711A0.hcd /dev/ttyS7 &";
TimeoutSec = "0s";
RemainAfterExit = true;
};
wantedBy = [ "multi-user.target" ];
};
};
}
24 changes: 24 additions & 0 deletions orange-pi/5-max/brcm_patchram_plus.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{ fetchFromGitHub
, lib
, stdenv
, ...
}:
stdenv.mkDerivation rec {
pname = "brcm_patchram_plus";
version = "2024.11.26";

src = fetchFromGitHub {
owner = "orangepi-xunlong";
repo = "orangepi-build";
rev = "5f17bb471115d2764b66eeb40b99cd1a885b8be4";
sha256 = "sha256-gn/y8HVb4pZZNZyQXqhkI3NqNKAfnprfvIp1oSaT05I=";
};

sourceRoot = "${src.name}/external/cache/sources/brcm_patchram_plus";

installPhase = ''
install -Dm755 brcm_patchram_plus -t $out/bin
'';

meta.license = lib.licenses.asl20;
}
68 changes: 68 additions & 0 deletions orange-pi/5-max/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{ lib, pkgs, ... }:
let
linux_rk3588 = pkgs.linuxPackagesFor (pkgs.callPackage ./kernel { });
orangepi-firmware = pkgs.callPackage ./orangepi-firmware.nix { };
in
{
imports = [
./audio.nix
./bluetooth.nix
./graphics.nix
./leds.nix
./uart.nix
./uboot
../../common/gpu/24.05-compat.nix
];

powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";

boot = {
kernelPackages = linux_rk3588;

kernelParams = [
"rootwait"
"consoleblank=0"
"console=tty1"
];

initrd.includeDefaultModules = false;
initrd.availableKernelModules = [
"nvme"
"mmc_block"
"usbhid"
"hid_generic"
"dm_mod"
"input_leds"
];

loader = {
grub.enable = lib.mkDefault false;
generic-extlinux-compatible.enable = lib.mkDefault true;
};
};

disabledModules = [ "profiles/all-hardware.nix" ];

hardware = {
deviceTree = {
enable = lib.mkDefault true;
name = lib.mkDefault "rockchip/rk3588-orangepi-5-max.dtb";
filter = lib.mkDefault "rk3588-orangepi-5-max.dtb";
};

firmware = [ orangepi-firmware ];

enableRedistributableFirmware = lib.mkDefault true;
};

networking.networkmanager.wifi.scanRandMacAddress = lib.mkDefault false;

systemd.services."orangepi5-usb2-init" = {
description = "Initialize USB2 on Orange Pi 5";
wantedBy = [ "default.target" ];
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkgs.bash}/bin/sh -c 'echo host > /sys/kernel/debug/usb/fc000000.usb/mode'";
};
};
}
52 changes: 52 additions & 0 deletions orange-pi/5-max/graphics.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{ config, pkgs, lib, ... }:
let
cfg = config.hardware.orange-pi."5-max".graphics;
mali-firmware = pkgs.callPackage ./mali-firmware.nix { };
in
{
options.hardware = {
orange-pi."5-max".graphics = {
enable = lib.mkEnableOption "gpu configuration" // {
default = config.hardware.graphics.enable;
};
};
};

config = lib.mkIf cfg.enable {
hardware = {
deviceTree = {
overlays = [
{
name = "rockchip-rk3588-panthor-gpu";
dtsText = ''
/dts-v1/;
/plugin/;
/ {
compatible = "rockchip,rk3588";
};
/ {
fragment@0 {
target = <&gpu>;
__overlay__ {
status = "disabled";
};
};
fragment@1 {
target = <&gpu_panthor>;
__overlay__ {
status = "okay";
mali-supply = <&vdd_gpu_s0>;
};
};
};
'';
}
];
};

firmware = [
mali-firmware
];
};
};
}
46 changes: 46 additions & 0 deletions orange-pi/5-max/kernel/bcmdhd_sdio.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{ fetchFromGitHub
, kernel
, lib
, stdenv
, ...
}:
let
rev = "101.10.591.52.27-1";
in
stdenv.mkDerivation rec {
pname = "bcmdhd_sdio";
version = "${rev}-${kernel.version}";

passthru.moduleName = "bcmdhd_sdio";

src = fetchFromGitHub {
owner = "Joshua-Riek";
repo = "bcmdhd-dkms";
inherit rev;
hash = "sha256-vOpyQB5HMJxL8vKdyHDz3d5R6LWC9yUcjH50Nwbch38=";
};

sourceRoot = "${src.name}/src";

hardeningDisable = [ "pic" ];

nativeBuildInputs = kernel.moduleBuildDependencies;

buildPhase = ''
make -C ${kernel.dev}/lib/modules/${kernel.modDirVersion}/build \
M=$PWD \
ARCH=arm64 \
CROSS_COMPILE=${stdenv.cc.targetPrefix} \
modules \
CONFIG_BCMDHD_SDIO=y \
CONFIG_BCMDHD_PCIE= \
CONFIG_BCMDHD_USB=
'';

installPhase = ''
install -D bcmdhd_sdio.ko $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/bcmdhd_sdio.ko
install -D dhd_static_buf_sdio.ko $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_static_buf_sdio.ko
'';

meta.license = lib.licenses.gpl2Only;
}
26 changes: 26 additions & 0 deletions orange-pi/5-max/kernel/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{ fetchFromGitHub
, lib
, linuxManualConfig
, stdenv
, ubootTools
, ...
}:
(linuxManualConfig rec {
inherit lib stdenv;
modDirVersion = "6.1.75";
version = "${modDirVersion}-rk3588";
src = fetchFromGitHub {
owner = "armbian";
repo = "linux-rockchip";
rev = "v24.11.1";
hash = "sha256-ZqEKQyFeE0UXN+tY8uAGrKgi9mXEp6s5WGyjVuxmuyM=";
};
# fetched from https://github.com/armbian/build/blob/v24.11.1/config/kernel/linux-rk35xx-vendor.config
configfile = ./linux-rk35xx-vendor.config;
# converted to nix using https://github.com/NixOS/nixpkgs/blob/79aaddff29307748c351a13d66f9d1fba4218624/pkgs/os-specific/linux/kernel/manual-config.nix#L11-L19
config = import ./linux-rk35xx-vendor.nix;
extraMeta.branch = "rk-6.1-rkr3";
}).overrideAttrs (old: {
name = "k"; # dodge uboot length limits
nativeBuildInputs = old.nativeBuildInputs ++ [ ubootTools ];
})
9,679 changes: 9,679 additions & 0 deletions orange-pi/5-max/kernel/linux-rk35xx-vendor.config

Large diffs are not rendered by default.

4,761 changes: 4,761 additions & 0 deletions orange-pi/5-max/kernel/linux-rk35xx-vendor.nix

Large diffs are not rendered by default.

44 changes: 44 additions & 0 deletions orange-pi/5-max/leds.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{ config, lib, ... }:
let
cfg = config.hardware.orange-pi."5-max".leds;
in
{
options.hardware.orange-pi."5-max".leds = {
enable = lib.mkEnableOption "heartbeat leds" // {
default = true;
};
};

config = lib.mkIf (!cfg.enable) {
hardware = {
deviceTree = {
overlays = [
{
name = "orangepi-5-plus-disable-leds";
dtsText = ''
/dts-v1/;
/plugin/;
/ {
compatible = "rockchip,rk3588-orangepi-5-max";
};
/ {
fragment@0 {
target = <&leds>;
__overlay__ {
status = "okay";
blue_led@1 {
linux,default-trigger = "none";
};
green_led@2 {
linux,default-trigger = "none";
};
};
};
};
'';
}
];
};
};
};
}
22 changes: 22 additions & 0 deletions orange-pi/5-max/mali-firmware.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{ fetchurl
, lib
, stdenv
, ...
}:
stdenv.mkDerivation {
pname = "mali-g610-firmware";
version = "g18p0-01eac0";

src = fetchurl {
url = "https://github.com/JeffyCN/mirrors/raw/e08ced3e0235b25a7ba2a3aeefd0e2fcbd434b68/firmware/g610/mali_csffw.bin";
hash = "sha256-jnyCGlXKHDRcx59hJDYW3SX8NbgfCQlG8wKIbWdxLfU=";
};

buildCommand = ''
install -Dm444 $src $out/lib/firmware/mali_csffw.bin
'';

compressFirmware = false;

meta.license = lib.licenses.unfreeRedistributableFirmware;
}
30 changes: 30 additions & 0 deletions orange-pi/5-max/orangepi-firmware.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{ fetchFromGitHub
, lib
, stdenvNoCC
, ...
}:
stdenvNoCC.mkDerivation {
pname = "orangepi-firmware";
version = "2024.10.09";
dontBuild = true;
dontFixup = true;
compressFirmware = false;

src = fetchFromGitHub {
owner = "orangepi-xunlong";
repo = "firmware";
rev = "75ea6fc5f3c454861b39b33823cb6876f3eca598";
hash = "sha256-X+n0voO3HRtPPAQsajGPIN9LOfDKBxF+8l9wFwGAFSQ=";
};

installPhase = ''
runHook preInstall
mkdir -p $out/lib/firmware
cp -a * $out/lib/firmware/
runHook postInstall
'';

meta.license = lib.licenses.unfreeRedistributableFirmware;
}
11 changes: 11 additions & 0 deletions orange-pi/5-max/sd-image-installer.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{ modulesPath, ... }:
{
imports = [
"${modulesPath}/profiles/installation-device.nix"
./sd-image.nix
];

# the installation media is also the installation target,
# so we don't want to provide the installation configuration.nix.
installer.cloneConfig = false;
}
37 changes: 37 additions & 0 deletions orange-pi/5-max/sd-image.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{ modulesPath
, config
, pkgs
, ...
}:
let
uboot = config.hardware.orange-pi."5-max".uboot.package;
in
{
imports = [
"${modulesPath}/profiles/base.nix"
"${modulesPath}/installer/sd-card/sd-image.nix"
./default.nix
];

sdImage = {
imageName =
"${config.sdImage.imageBaseName}-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}-orange-pi-5-max.img";

firmwarePartitionOffset = 16;
firmwarePartitionName = "BOOT";

compressImage = true;
expandOnBoot = true;

populateFirmwareCommands = "dd if=${uboot}/u-boot-rockchip.bin of=$img seek=64 conv=notrunc";

postBuildCommands = ''
cp ${uboot}/u-boot-rockchip.bin firmware/
'';

populateRootCommands = ''
mkdir -p ./files/boot
${config.boot.loader.generic-extlinux-compatible.populateCmd} -c ${config.system.build.toplevel} -d ./files/boot
'';
};
}
61 changes: 61 additions & 0 deletions orange-pi/5-max/uart.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{ config, lib, ... }:
let
cfg = config.hardware.orange-pi."5-max".uartDebug;
in
{
options.hardware.orange-pi."5-max".uartDebug = {
enable = lib.mkEnableOption "UART2 serial console" // {
default = true;
};
baudRate = lib.mkOption {
type = lib.types.int;
default = 1500000;
description = "Baud rate for the UART2 serial console";
};
};

config = lib.mkIf cfg.enable {
boot.kernelParams = [
"earlycon=uart8250,mmio32,0xfeb50000"
"console=ttyS2,${toString cfg.baudRate}"
];
hardware = {
deviceTree = {
overlays = [
{
name = "rockchip-rk3588-uart2-m0";
dtsText = ''
/dts-v1/;
/plugin/;
/ {
compatible = "rockchip,rk3588";
};
/ {
metadata {
title = "Enable UART2-M0";
compatible = "radxa,rock-5a", "radxa,rock-5b";
category = "misc";
exclusive = "GPIO0_B5", "GPIO0_B6";
description = "Enable UART2-M0.\nOn Radxa ROCK 5A this is TX pin 8 and RX pin 10.\nOn Radxa ROCK 5B this is TX pin 8 and this is RX pin 10.";
};
fragment@0 {
target = <&uart2>;
__overlay__ {
status = "okay";
pinctrl-0 = <&uart2m0_xfer>;
};
};
fragment@1 {
target = <&fiq_debugger>;
__overlay__ {
status = "disabled";
};
};
};
'';
}
];
};
};
};
}
41 changes: 41 additions & 0 deletions orange-pi/5-max/uboot/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{ config, pkgs, lib, ... }:
let
cfg = config.hardware.orange-pi."5-max".uboot;
uboot = pkgs.callPackage ./package.nix {
enableUart = config.hardware.orange-pi."5-max".uartDebug.enable;
baudRate = config.hardware.orange-pi."5-max".uartDebug.baudRate;
};
updater-flash = pkgs.writeShellApplication {
name = "orangepi5max-firmware-update-flash";
runtimeInputs = [ pkgs.mtdutils ];
text = ''
flashcp -v ${cfg.package}/u-boot-rockchip-spi.bin /dev/mtd0
'';
};
updater-sd = pkgs.writeShellApplication {
name = "orangepi5max-firmware-update-sd";
runtimeInputs = [ ];
text = ''
dd if=${cfg.package}/u-boot-rockchip.bin of=/dev/mmcblk1 seek=64 conv=notrunc
'';
};
in
{
options.hardware = {
orange-pi."5-max".uboot = {
package = lib.mkOption {
type = lib.types.package;
default = uboot;
description = "uboot package to use in sd image and updater scripts";
};
updater.enable = lib.mkEnableOption "updater program installation";
};
};

config = lib.mkIf cfg.updater.enable {
environment.systemPackages = [
updater-flash
updater-sd
];
};
}
16 changes: 16 additions & 0 deletions orange-pi/5-max/uboot/orangepi-5-max-dtb.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 6ad59aeed5..36442cf0f5 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -85,7 +85,10 @@ dtb-$(CONFIG_ROCKCHIP_RK3288) += \
dtb-$(CONFIG_ROCKCHIP_RK3368) += \
rk3368-sheep.dtb \
rk3368-geekbox.dtb \
- rk3368-px5-evb.dtb \
+ rk3368-px5-evb.dtb
+
+dtb-$(CONFIG_ROCKCHIP_RK3588) += \
+ rk3588-orangepi-5-max.dtb

dtb-$(CONFIG_ARCH_S5P4418) += \
s5p4418-nanopi2.dtb
90 changes: 90 additions & 0 deletions orange-pi/5-max/uboot/orangepi-5-max-rk3588_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
CONFIG_SYS_HAS_NONCACHED_MEMORY=y
CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SF_DEFAULT_SPEED=24000000
CONFIG_SF_DEFAULT_MODE=0x2000
CONFIG_DEFAULT_DEVICE_TREE="rk3588-orangepi-5-max"
CONFIG_ROCKCHIP_RK3588=y
CONFIG_ROCKCHIP_SPI_IMAGE=y
CONFIG_SPL_SERIAL=y
CONFIG_TARGET_EVB_RK3588=y
CONFIG_DEBUG_UART_BASE=0xFEB50000
CONFIG_DEBUG_UART_CLOCK=24000000
CONFIG_SPL_SPI_FLASH_SUPPORT=y
CONFIG_SPL_SPI=y
CONFIG_SYS_LOAD_ADDR=0xc00800
CONFIG_PCI=y
CONFIG_DEBUG_UART=y
CONFIG_AHCI=y
CONFIG_FIT=y
CONFIG_FIT_VERBOSE=y
CONFIG_SPL_FIT_SIGNATURE=y
CONFIG_SPL_LOAD_FIT=y
CONFIG_LEGACY_IMAGE_FORMAT=y
CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588-orangepi-5-max.dtb"
# CONFIG_DISPLAY_CPUINFO is not set
CONFIG_DISPLAY_BOARDINFO_LATE=y
CONFIG_SPL_MAX_SIZE=0x40000
CONFIG_SPL_PAD_TO=0x7f8000
# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
CONFIG_SPL_SPI_LOAD=y
CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000
CONFIG_SPL_ATF=y
CONFIG_CMD_GPIO=y
CONFIG_CMD_GPT=y
CONFIG_CMD_I2C=y
CONFIG_CMD_MMC=y
CONFIG_CMD_PCI=y
CONFIG_CMD_USB=y
# CONFIG_CMD_SETEXPR is not set
CONFIG_CMD_REGULATOR=y
# CONFIG_SPL_DOS_PARTITION is not set
CONFIG_SPL_OF_CONTROL=y
CONFIG_OF_LIVE=y
CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
# CONFIG_OF_UPSTREAM is not set
CONFIG_SPL_DM_SEQ_ALIAS=y
CONFIG_SPL_REGMAP=y
CONFIG_SPL_SYSCON=y
CONFIG_AHCI_PCI=y
CONFIG_DWC_AHCI=y
CONFIG_SPL_CLK=y
CONFIG_ROCKCHIP_GPIO=y
CONFIG_SYS_I2C_ROCKCHIP=y
CONFIG_MISC=y
CONFIG_SUPPORT_EMMC_RPMB=y
CONFIG_MMC_DW=y
CONFIG_MMC_DW_ROCKCHIP=y
CONFIG_MMC_SDHCI=y
CONFIG_MMC_SDHCI_SDMA=y
CONFIG_MMC_SDHCI_ROCKCHIP=y
CONFIG_SF_DEFAULT_BUS=5
CONFIG_SPI_FLASH_SFDP_SUPPORT=y
CONFIG_SPI_FLASH_XMC=y
CONFIG_PHYLIB=y
CONFIG_RTL8169=y
CONFIG_NVME_PCI=y
CONFIG_PCIE_DW_ROCKCHIP=y
CONFIG_PHY_ROCKCHIP_INNO_USB2=y
CONFIG_PHY_ROCKCHIP_NANENG_COMBOPHY=y
CONFIG_PHY_ROCKCHIP_USBDP=y
CONFIG_SPL_PINCTRL=y
CONFIG_PWM_ROCKCHIP=y
CONFIG_SPL_RAM=y
CONFIG_SCSI=y
CONFIG_BAUDRATE=1500000
CONFIG_DEBUG_UART_SHIFT=2
CONFIG_SYS_NS16550_MEM32=y
CONFIG_ROCKCHIP_SFC=y
CONFIG_SYSRESET=y
CONFIG_USB=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_GENERIC=y
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_OHCI_GENERIC=y
CONFIG_USB_DWC3=y
CONFIG_USB_DWC3_GENERIC=y
CONFIG_ERRNO_STR=y
30 changes: 30 additions & 0 deletions orange-pi/5-max/uboot/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{ armTrustedFirmwareRK3588
, buildUBoot
, lib
, rkbin
, enableUart ? true
, baudRate ? 1500000
, ...
}:
(buildUBoot {
defconfig = "orangepi-5-max-rk3588_defconfig";
BL31 = "${armTrustedFirmwareRK3588}/bl31.elf";
ROCKCHIP_TPL = rkbin.TPL_RK3588;

extraPatches = [
./orangepi-5-max-dtb.patch
];

preConfigure = ''
cp --no-preserve=mode ${./orangepi-5-max-rk3588_defconfig} configs/orangepi-5-max-rk3588_defconfig
cp --no-preserve=mode ${./rk3588-orangepi-5-max.dts} arch/arm/dts/rk3588-orangepi-5-max.dts
cp --no-preserve=mode ${./rk3588-orangepi-5-max-u-boot.dtsi} arch/arm/dts/rk3588-orangepi-5-max-u-boot.dtsi
sed -i "s/^CONFIG_BAUDRATE=1500000/CONFIG_BAUDRATE=${toString baudRate}/" configs/orangepi-5-max-rk3588_defconfig
sed -i "s/serial2:1500000n8/serial2:${toString baudRate}n8/" arch/arm/dts/rk3588-orangepi-5-max.dts
'' + lib.optionalString (!enableUart) ''
sed -i "s/^CONFIG_DEBUG_UART=y/# CONFIG_DEBUG_UART is not set/" configs/orangepi-5-max-rk3588_defconfig
'';

filesToInstall = [ "u-boot.itb" "idbloader.img" "u-boot-rockchip.bin" "u-boot-rockchip-spi.bin" ];
})
20 changes: 20 additions & 0 deletions orange-pi/5-max/uboot/rk3588-orangepi-5-max-u-boot.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)

#include "rk3588-u-boot.dtsi"

&fspim1_pins {
bootph-pre-ram;
bootph-some-ram;
};

&sdhci {
cap-mmc-highspeed;
mmc-hs200-1_8v;
};

&sfc {
flash@0 {
bootph-pre-ram;
bootph-some-ram;
};
};
847 changes: 847 additions & 0 deletions orange-pi/5-max/uboot/rk3588-orangepi-5-max.dts

Large diffs are not rendered by default.