From d0444e1e9d514ac5cbffbe286f7eab49e324478e Mon Sep 17 00:00:00 2001 From: Ricardo Pardini Date: Wed, 24 Dec 2025 19:37:40 +0100 Subject: [PATCH] mekotronics-r58-4x4: enable edge branch with mainline kernel & u-boot > merry everything and a happy always - mainline: - enable "edge" branch, with custom DT - works: almost everything - does NOT work: - USB-C port is only for OTG/UMS (NOT USB3-host) - didn't describe fusb302 et al in DT - any of the 3x HDMI -> MIPI (or whatever) HDMI-In's (thus this is a 1x1, not 4x1) - front USB3 blue ports are actually USB2 (also in vendor kernel) - front USB2 black ports don't work (but are powered) - Analog audio - didn't describe, could be, but I've no way to test - use mainline u-boot v2026.01-rc5 (with custom DT/defconfig/etc) with mainline ATF - boot order: SD -> NVMe -> USB -> eMMC -> ETH - adapt usage of shared "mekotronics" vendor include only for vendor/legacy - also fix DTB: `rockchip/rk3588-blueberry-r58-4x4.dtb` for vendor - same across vendor and mainline - mainline u-boot kinda-boots vendor kernel, but TF-A mismatch ref HDMI-rx - so use vendor u-boot and rk blob for vendor branch/kernel --- config/boards/mekotronics-r58-4x4.conf | 95 ++++++++++++++++++++++++-- 1 file changed, 88 insertions(+), 7 deletions(-) diff --git a/config/boards/mekotronics-r58-4x4.conf b/config/boards/mekotronics-r58-4x4.conf index c82b14f8cd..ae8d4ff2a3 100644 --- a/config/boards/mekotronics-r58-4x4.conf +++ b/config/boards/mekotronics-r58-4x4.conf @@ -1,15 +1,96 @@ -# Rockchip RK3588 SoC octa core 4-16GB SoC 2x1GBe eMMC USB3 NVMe SATA WiFi/BT HDMI DP HDMI-In RS232 RS485 +# Rockchip RK3588 SoC octa core 1GBe eMMC USB3 NVMe WiFi/BT HDMI 4xHDMI-In declare -g BOARD_NAME="Mekotronics R58-4X4" declare -g BOARD_VENDOR="mekotronics" declare -g BOARDFAMILY="rockchip-rk3588" declare -g BOARD_MAINTAINER="150balbes" -declare -g KERNEL_TARGET="vendor" -declare -g BOOTCONFIG="mekotronics_r58x-rk3588_defconfig" # vendor u-boot; with NVMe and a DTS -declare -g BOOT_FDT_FILE="rockchip/rk3588-r58-4x4.dtb" # Specific to this board -declare -g UEFI_EDK2_BOARD_ID="r58-4x4" # This _only_ used for uefi-edk2-rk3588 extension +declare -g KERNEL_TARGET="edge,vendor" +declare -g BOOT_FDT_FILE="rockchip/rk3588-blueberry-r58-4x4.dtb" # same name for mainline and vendor declare -g DISPLAY_MANAGER="wayland" declare -g ASOUND_STATE="asound.state.rk3588hd" +declare -g BOOT_SOC="rk3588" +declare -g IMAGE_PARTITION_TABLE="gpt" +# Does not have a UEFI_EDK2_BOARD_ID -# Source vendor-specific configuration -source "${SRC}/config/sources/vendors/mekotronics/mekotronics-rk3588.conf.sh" +if [[ "${BRANCH}" == "vendor" || "${BRANCH}" == "legacy" ]]; then + display_alert "$BOARD" "vendor/legacy configuration applied for $BOARD / $BRANCH" "info" + declare -g BOOTCONFIG="mekotronics_r58x-rk3588_defconfig" # vendor u-boot; with NVMe and a DTS (for the r58x, not 4x4) + # Source shared vendor configuration; it does BOOT_SCENARIO="spl-blobs" & hciattach - common to all vendor-kernel Meko's + source "${SRC}/config/sources/vendors/mekotronics/mekotronics-rk3588.conf.sh" + return 0 # this returns early so below code is only for current/edge branches +fi +# For current/edge branches: +display_alert "$BOARD" "applying mainline configuration for $BOARD / $BRANCH" "info" +declare -g BOOT_SCENARIO="tpl-blob-atf-mainline" # Mainline ATF + +function post_family_config__meko4x4_use_mainline_uboot() { + display_alert "$BOARD" "mainline u-boot overrides for $BOARD / $BRANCH" "info" + + declare -g BOOTCONFIG="mekotronics-r58-4x4-rk3588_defconfig" # mainline + declare -g BOOTDELAY=1 + declare -g BOOTSOURCE="https://github.com/u-boot/u-boot.git" + declare -g BOOTBRANCH="tag:v2026.01-rc5" + declare -g BOOTPATCHDIR="v2026.01" + declare -g BOOTDIR="u-boot-${BOARD}" + + declare -g UBOOT_TARGET_MAP="BL31=bl31.elf ROCKCHIP_TPL=${RKBIN_DIR}/${DDR_BLOB};;u-boot-rockchip.bin" + unset uboot_custom_postprocess write_uboot_platform write_uboot_platform_mtd + + function write_uboot_platform() { + dd "if=$1/u-boot-rockchip.bin" "of=$2" bs=32k seek=1 conv=notrunc status=none + } + + declare -g PLYMOUTH="no" # Disable plymouth as that only causes more confusion +} + +# "rockchip-common: boot SD card first, then NVMe, then mmc" +# include/configs/rockchip-common.h +# On the meko r58-4x4: mmc1 is eMMC; mmc0 is microSD +# Enumerating usb is pretty slow so do it after nvme +function pre_config_uboot_target__meko4x4_patch_rockchip_common_boot_order() { + declare -a rockchip_uboot_targets=("mmc0" "nvme" "scsi" "usb" "mmc1" "pxe" "dhcp" "spi") # for future make-this-generic delight + 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_config_uboot_target__extra_configs_for_meko4x4_mainline_environment_in_spi() { + display_alert "u-boot for ${BOARD}/${BRANCH}" "u-boot: enable board-specific configs" "info" + run_host_command_logged scripts/config --enable CONFIG_CMD_MISC + + display_alert "u-boot for ${BOARD}/${BRANCH}" "u-boot: enable preboot & flash user LED in preboot" "info" + run_host_command_logged scripts/config --enable CONFIG_USE_PREBOOT + run_host_command_logged scripts/config --set-str CONFIG_PREBOOT "'led power on; sleep 0.1; led power off; sleep 0.1; led power on'" # double quotes required due to run_host_command_logged's quirks + + display_alert "u-boot for ${BOARD}/${BRANCH}" "u-boot: enable EFI debugging commands" "info" + run_host_command_logged scripts/config --enable CMD_EFIDEBUG + run_host_command_logged scripts/config --enable CMD_NVEDIT_EFI + + display_alert "u-boot for ${BOARD}/${BRANCH}" "u-boot: enable more filesystems support" "info" + run_host_command_logged scripts/config --enable CONFIG_CMD_BTRFS + + display_alert "u-boot for ${BOARD}/${BRANCH}" "u-boot: enable more compression support" "info" + run_host_command_logged scripts/config --enable CONFIG_LZO + run_host_command_logged scripts/config --enable CONFIG_BZIP2 + run_host_command_logged scripts/config --enable CONFIG_ZSTD + + display_alert "u-boot for ${BOARD}/${BRANCH}" "u-boot: enable gpio LED support" "info" + run_host_command_logged scripts/config --enable CONFIG_LED + run_host_command_logged scripts/config --enable CONFIG_LED_GPIO + + display_alert "u-boot for ${BOARD}/${BRANCH}" "u-boot: enable networking cmds" "info" + run_host_command_logged scripts/config --enable CONFIG_CMD_NFS + run_host_command_logged scripts/config --enable CONFIG_CMD_WGET + run_host_command_logged scripts/config --enable CONFIG_CMD_DNS + run_host_command_logged scripts/config --enable CONFIG_PROT_TCP + run_host_command_logged scripts/config --enable CONFIG_PROT_TCP_SACK + + # UMS, RockUSB, gadget stuff + display_alert "u-boot for ${BOARD}/${BRANCH}" "u-boot: enable UMS/RockUSB gadget" "info" + declare -a enable_configs=("CONFIG_CMD_USB_MASS_STORAGE" "CONFIG_USB_GADGET" "USB_GADGET_DOWNLOAD" "CONFIG_USB_FUNCTION_ROCKUSB" "CONFIG_USB_FUNCTION_ACM" "CONFIG_CMD_ROCKUSB" "CONFIG_CMD_USB_MASS_STORAGE") + for config in "${enable_configs[@]}"; do + run_host_command_logged scripts/config --enable "${config}" + done + # Auto-enabled by the above, force off... + run_host_command_logged scripts/config --disable USB_FUNCTION_FASTBOOT +}