armbian-build/config/boards/radxa-rock-4d.conf
Mecid 77f919f6cd
Rock-4D: Add Edge + RK3576 Mainline U-Boot (with UFS support) (#9421)
* Rock-4D: Edge (u-boot and kernel)

* RK3576: Mainline u-boot ufs boot enablement patches

* Rock-4D: Use Mainline u-boot 2026.04-rc2

* Rock-4D: Update KERNEL_TEST_TARGET to edge

* Rock-4D: Use Mainline u-boot on vendor and edge

* Remove vendor branch check for mainline uboot
2026-02-20 21:55:32 +01:00

102 lines
4.4 KiB
Plaintext

# Rockchip RK3576 SoC octa core 4-16GB SoC GBe eMMC UFS USB3 WIFI
BOARD_NAME="Radxa Rock 4D"
BOARD_VENDOR="radxa"
BOARDFAMILY="rk35xx"
BOARD_MAINTAINER="HeyMeco"
BOOTCONFIG="rock-4d-spi-rk3576_defconfig"
KERNEL_TARGET="vendor,edge"
KERNEL_TEST_TARGET="edge"
FULL_DESKTOP="yes"
BOOT_LOGO="desktop"
BOOT_FDT_FILE="rockchip/rk3576-rock-4d-spi.dtb"
BOOT_SCENARIO="spl-blobs"
BOOT_SUPPORT_SPI="yes"
BOOT_SPI_RKSPI_LOADER="yes"
IMAGE_PARTITION_TABLE="gpt"
enable_extension "radxa-aic8800"
AIC8800_TYPE="usb"
# Mainline U-Boot
function post_family_config__rock4d_use_mainline_uboot() {
display_alert "$BOARD" "Using mainline U-Boot for $BOARD / $BRANCH" "info"
declare -g DDR_BLOB="rk35/rk3576_ddr_lp4_2112MHz_lp5_2736MHz_v1.09.bin"
# Use mainline ATF v2.14 (rk3576 support added in this release)
BOOT_SCENARIO="tpl-blob-atf-mainline"
prepare_boot_configuration
declare -g ATFBRANCH="tag:v2.14.0"
declare -g ATFPATCHDIR="atf-rockchip64/v2.14"
declare -g BOOTCONFIG="rock-4d-rk3576_defconfig"
declare -g BOOTDELAY=1
declare -g BOOTSOURCE="https://github.com/u-boot/u-boot.git"
declare -g BOOTBRANCH="tag:v2026.04-rc2"
declare -g BOOTPATCHDIR="v2026.04"
unset BOOT_FDT_FILE # mainline defconfig has DEFAULT_FDT_FILE set
# Binman produces both eMMC/SD and SPI images; mainline ATF bl31.elf + DDR blob
declare -g UBOOT_TARGET_MAP="BL31=bl31.elf ROCKCHIP_TPL=${RKBIN_DIR}/${DDR_BLOB};;u-boot-rockchip.bin u-boot-rockchip-spi.bin"
# Disable vendor-specific postprocessing; binman does all the work
unset uboot_custom_postprocess write_uboot_platform write_uboot_platform_mtd
# Just use the binman-provided u-boot-rockchip.bin, which is ready-to-go
function write_uboot_platform() {
dd "if=$1/u-boot-rockchip.bin" "of=$2" bs=32k seek=1 conv=notrunc status=none
}
function write_uboot_platform_mtd() {
flashcp -v -p "$1/u-boot-rockchip-spi.bin" /dev/mtd0
}
}
# Enable UFS and SPI environment storage for mainline U-Boot
function post_config_uboot_target__rock4d_enable_ufs_and_spi_env() {
display_alert "$BOARD" "Enabling UFS and SPI env for ${BOOTBRANCH} u-boot" "info"
# Enable RK3576 UFS storage support
run_host_command_logged scripts/config --enable CONFIG_SCSI
run_host_command_logged scripts/config --enable CONFIG_CMD_SCSI
run_host_command_logged scripts/config --enable CONFIG_UFS
run_host_command_logged scripts/config --enable CONFIG_UFS_ROCKCHIP
# Enable SPL UFS boot support; SPL_DM_GPIO/SPL_GPIO/SPL_DM_RESET are required
# by UFS_ROCKCHIP when SPL_UFS_SUPPORT is set (no longer auto-implied by Kconfig in v5 patches)
run_host_command_logged scripts/config --enable CONFIG_SPL_UFS_SUPPORT
run_host_command_logged scripts/config --enable CONFIG_SPL_DM_GPIO
run_host_command_logged scripts/config --enable CONFIG_SPL_GPIO
run_host_command_logged scripts/config --enable CONFIG_SPL_DM_RESET
# Store U-Boot environment in SPI flash
run_host_command_logged scripts/config --set-val CONFIG_ENV_IS_NOWHERE "n"
run_host_command_logged scripts/config --set-val CONFIG_ENV_IS_IN_SPI_FLASH "y"
run_host_command_logged scripts/config --set-val CONFIG_ENV_SECT_SIZE_AUTO "y"
run_host_command_logged scripts/config --set-val CONFIG_ENV_OVERWRITE "y"
run_host_command_logged scripts/config --set-val CONFIG_ENV_SIZE "0x20000"
run_host_command_logged scripts/config --set-val CONFIG_ENV_OFFSET "0xc00000"
}
# "rockchip-common: boot SD card first, then eMMC, then UFS/NVMe"
# On Rock 4D, mmc0 is SD card, mmc1 is eMMC, scsi covers UFS
function pre_config_uboot_target__rock4d_boot_order() {
declare -a rockchip_uboot_targets=("mmc0" "mmc1" "scsi" "nvme" "usb" "pxe" "dhcp")
display_alert "u-boot for ${BOARD}/${BRANCH}" "u-boot: adjust boot order to '${rockchip_uboot_targets[*]}'" "info"
sed -i -e "s/#define BOOT_TARGETS.*/#define BOOT_TARGETS \"${rockchip_uboot_targets[*]}\"/" include/configs/rockchip-common.h
regular_git diff -u include/configs/rockchip-common.h || true
}
function post_family_tweaks__rock-4d_naming_audios() {
display_alert "$BOARD" "Renaming Rock-4D audios" "info"
mkdir -p $SDCARD/etc/udev/rules.d/
echo 'SUBSYSTEM=="sound", ENV{ID_PATH}=="platform-hdmi0-sound", ENV{SOUND_DESCRIPTION}="HDMI0 Audio"' > $SDCARD/etc/udev/rules.d/90-naming-audios.rules
echo 'SUBSYSTEM=="sound", ENV{ID_PATH}=="platform-dp0-sound", ENV{SOUND_DESCRIPTION}="DP0 Audio"' >> $SDCARD/etc/udev/rules.d/90-naming-audios.rules
echo 'SUBSYSTEM=="sound", ENV{ID_PATH}=="platform-es8316-sound", ENV{SOUND_DESCRIPTION}="ES8316 Audio"' >> $SDCARD/etc/udev/rules.d/90-naming-audios.rules
return 0
}