From bb072a49b66161906b3a6e62990a384b72181bcd Mon Sep 17 00:00:00 2001 From: Mkirin Date: Mon, 3 Aug 2026 10:46:14 +0800 Subject: [PATCH 1/2] board: rk3588: switch reComputer RK3588 to Panthor open-source GPU stack The proprietary Mali/Bifrost GPU driver (mali-valhall-g610 / libmali) has poor compatibility with newer Debian releases and desktop environments, causing the desktop to fail to start. Switch the reComputer RK3588 DevKit to the upstream Panthor DRM driver + Mesa userspace stack. Changes: - Kernel: enable CONFIG_DRM_PANTHOR, disable all Mali/Bifrost configs - Boot: add RECOMPUTER_GPU_STACK="panthor" and load the panthor DT overlay - Rootfs: skip proprietary libmali, install Mesa from bookworm-backports - Firmware: ship mali_csffw.bin required by Panthor - Cleanup: remove Mali EGL/GBM wrapper leftovers when using Panthor --- config/boards/recomputer-rk3588-devkit.conf | 70 +++++++++++++++++++ .../kernel/linux-seeed-rk3588-vendor.config | 24 +++---- .../seeed-studio/recomputer-rk35xx-common.inc | 25 +++++++ 3 files changed, 106 insertions(+), 13 deletions(-) diff --git a/config/boards/recomputer-rk3588-devkit.conf b/config/boards/recomputer-rk3588-devkit.conf index 4f910b3adeec..f3069c32b1f5 100644 --- a/config/boards/recomputer-rk3588-devkit.conf +++ b/config/boards/recomputer-rk3588-devkit.conf @@ -20,10 +20,20 @@ SERIALCON="ttyFIQ0,ttyGS0" BT_UART="/dev/ttyS6" PACKAGE_LIST_BOARD="net-tools rfkill pulseaudio-module-bluetooth fail2ban" AIC8800_TYPE="sdio" +RECOMPUTER_GPU_STACK="panthor" enable_extension "radxa-aic8800" source "${SRC}/config/sources/vendors/seeed-studio/recomputer-rk35xx-common.inc" +# Load the Panthor GPU DT overlay at boot. The kernel has CONFIG_DRM_PANTHOR=y +# and the vendor Mali kbase configs disabled, so without this overlay the +# GPU node is never probed and Mesa falls back to llvmpipe. +# Guarded on RECOMPUTER_GPU_STACK so a future mali-stack flip won't leave a +# stale panthor overlay in armbianEnv.txt that fails to apply on boot. +if [[ "${RECOMPUTER_GPU_STACK}" == "panthor" ]]; then + DEFAULT_OVERLAYS="rockchip-rk3588-panthor-gpu" +fi + function post_family_config__recomputer_rk3588_devkit_use_seeed_bootscript() { display_alert "$BOARD" "Using Seeed bootscript: boot-seeed-rk35xx.cmd -> boot.cmd" "info" declare -g BOOTSCRIPT="boot-seeed-rk35xx.cmd:boot.cmd" @@ -31,12 +41,72 @@ function post_family_config__recomputer_rk3588_devkit_use_seeed_bootscript() { # Install libmali package for RK3588 GPU userspace function pre_install_distribution_specific__recomputer_rk3588_install_libmali() { + if [[ "${RECOMPUTER_GPU_STACK}" == "panthor" ]]; then + display_alert "Skipping Mali GPU libraries" "Using Panthor/Mesa userspace" "info" + return 0 + fi + display_alert "Installing Mali GPU libraries from APT repo" "libmali-g610" "info" seeed_recomputer_install_from_apt libmali-valhall-g610-g24p0-x11-wayland-gbm chroot_sdcard ldconfig } +function post_family_tweaks__recomputer_rk3588_install_panthor_mesa() { + [[ "${RECOMPUTER_GPU_STACK}" == "panthor" ]] || return 0 + [[ "${RELEASE}" == "bookworm" ]] || { + display_alert "Panthor Mesa userspace" "Skipping backports install for ${RELEASE}" "warn" + return 0 + } + + display_alert "Panthor Mesa userspace" "Installing Mesa from bookworm-backports" "info" + + cat > "${SDCARD}/etc/apt/sources.list.d/bookworm-backports.list" <<-'EOF' + deb http://deb.debian.org/debian bookworm-backports main contrib non-free non-free-firmware + EOF + + do_with_retries 3 chroot_sdcard_apt_get_update + do_with_retries 3 chroot_sdcard_apt_get --no-install-recommends install -t bookworm-backports \ + libgbm1 libegl-mesa0 libgl1-mesa-dri libglx-mesa0 \ + mesa-vulkan-drivers mesa-utils vulkan-tools +} + +function pre_update_initramfs__recomputer_rk3588_install_panthor_firmware() { + [[ "${RECOMPUTER_GPU_STACK}" == "panthor" ]] || return 0 + + local root_dir="${MOUNT:-${SDCARD}}" + local fw_src="" + local -a fw_candidates=( + "${SRC}/cache/sources/${LINUXSOURCEDIR:-}/drivers/gpu/arm/bifrost/mali_csffw.bin" + "${SRC}/../linux-rockchip/drivers/gpu/arm/bifrost/mali_csffw.bin" + ) + fw_candidates+=("${SRC}"/cache/sources/linux-kernel-worktree/*/drivers/gpu/arm/bifrost/mali_csffw.bin) + + for candidate in "${fw_candidates[@]}"; do + if [[ -f "${candidate}" ]]; then + fw_src="${candidate}" + break + fi + done + + [[ -n "${fw_src}" ]] || exit_with_error "Panthor firmware not found" "mali_csffw.bin" + + display_alert "Panthor firmware" "Installing ${fw_src}" "info" + install -Dm0644 "${fw_src}" "${root_dir}/lib/firmware/arm/mali/arch10.8/mali_csffw.bin" + + mkdir -p "${root_dir}/etc/initramfs-tools/hooks" + cat > "${root_dir}/etc/initramfs-tools/hooks/panthor-firmware" <<-'EOF' + #!/bin/sh + set -e + . /usr/share/initramfs-tools/hook-functions + + mkdir -p "${DESTDIR}/lib/firmware/arm/mali/arch10.8" + cp -p /lib/firmware/arm/mali/arch10.8/mali_csffw.bin \ + "${DESTDIR}/lib/firmware/arm/mali/arch10.8/" + EOF + chmod +x "${root_dir}/etc/initramfs-tools/hooks/panthor-firmware" +} + # Install RK camera engine package for RK3588 function pre_install_distribution_specific__recomputer_rk3588_install_camera_engine() { display_alert "Installing camera engine from APT repo" "camera-engine-rkaiq" "info" diff --git a/config/kernel/linux-seeed-rk3588-vendor.config b/config/kernel/linux-seeed-rk3588-vendor.config index 44f52755417a..e80604436d35 100644 --- a/config/kernel/linux-seeed-rk3588-vendor.config +++ b/config/kernel/linux-seeed-rk3588-vendor.config @@ -1979,19 +1979,17 @@ CONFIG_DRM_DW_HDMI_CEC=y CONFIG_DRM_PANEL_MIPI_DBI=y CONFIG_DRM_LIMA=m # CONFIG_DRM_PANFROST is not set -# CONFIG_DRM_PANTHOR is not set -CONFIG_MALI_DEVFREQ=y -CONFIG_MALI_MIDGARD=y -CONFIG_MALI_EXPERT=y -CONFIG_MALI_PLATFORM_THIRDPARTY=y -CONFIG_MALI_PLATFORM_THIRDPARTY_NAME="rk" -CONFIG_MALI_DEBUG=y -CONFIG_MALI_PWRSOFT_765=y -CONFIG_MALI_BIFROST=y -CONFIG_MALI_PLATFORM_NAME="rk" -CONFIG_MALI_CSF_SUPPORT=y -CONFIG_MALI_BIFROST_EXPERT=y -CONFIG_MALI_BIFROST_DEBUG=y +CONFIG_DRM_PANTHOR=y +# CONFIG_MALI_DEVFREQ is not set +# CONFIG_MALI_MIDGARD is not set +# CONFIG_MALI_EXPERT is not set +# CONFIG_MALI_PLATFORM_THIRDPARTY is not set +# CONFIG_MALI_DEBUG is not set +# CONFIG_MALI_PWRSOFT_765 is not set +# CONFIG_MALI_BIFROST is not set +# CONFIG_MALI_CSF_SUPPORT is not set +# CONFIG_MALI_BIFROST_EXPERT is not set +# CONFIG_MALI_BIFROST_DEBUG is not set CONFIG_FB=y CONFIG_LCD_CLASS_DEVICE=m CONFIG_LCD_L4F00242T03=m diff --git a/config/sources/vendors/seeed-studio/recomputer-rk35xx-common.inc b/config/sources/vendors/seeed-studio/recomputer-rk35xx-common.inc index 99125763575f..235668801d03 100644 --- a/config/sources/vendors/seeed-studio/recomputer-rk35xx-common.inc +++ b/config/sources/vendors/seeed-studio/recomputer-rk35xx-common.inc @@ -387,11 +387,28 @@ function post_family_tweaks__recomputer_mali_x11_kms_config() { EOF } +function post_family_tweaks__recomputer_panthor_userspace_cleanup() { + [[ "${RECOMPUTER_GPU_STACK:-mali}" == "panthor" ]] || return 0 + + display_alert "$BOARD" "Removing Mali userspace wrappers for Panthor" "info" + local LIB_DIR="${SDCARD}/usr/lib/aarch64-linux-gnu" + + rm -f "${SDCARD}/etc/ld.so.conf.d/00-aarch64-mali.conf" + rm -rf "${LIB_DIR}/mali" + rm -f "${SDCARD}/usr/share/glvnd/egl_vendor.d/00_mali.json" + chroot_sdcard ldconfig +} + # Mali EGL — bypass libglvnd for EGL/GLES so GLVND does not fall back to Mesa/llvmpipe. # When MALI_USE_SYSTEM_GBM=yes, also remove Mali deb's ldconfig entry and stubs # to prevent mali/ wrappers from shadowing our direct libmali.so.1 symlinks. # RK3588 keeps the ldconfig entry so libMaliOpenCL remains discoverable. function post_family_tweaks__recomputer_mali_egl_override() { + if [[ "${RECOMPUTER_GPU_STACK:-mali}" == "panthor" ]]; then + display_alert "$BOARD" "Skipping Mali EGL override for Panthor" "info" + return 0 + fi + display_alert "$BOARD" "Replacing libglvnd EGL/GLES with Mali" "info" local LIB_DIR="${SDCARD}/usr/lib/aarch64-linux-gnu" @@ -435,6 +452,14 @@ function post_family_tweaks__recomputer_mali_egl_override() { function pre_umount_final_image__recomputer_mali_gbm_fixup() { local LIB_DIR="${SDCARD}/usr/lib/aarch64-linux-gnu" + if [[ "${RECOMPUTER_GPU_STACK:-mali}" == "panthor" ]]; then + display_alert "$BOARD" "Using Mesa GBM for Panthor" "info" + rm -f "${SDCARD}/etc/ld.so.conf.d/00-aarch64-mali.conf" + rm -rf "${LIB_DIR}/mali" + chroot_sdcard ldconfig + return 0 + fi + if [[ "${MALI_USE_SYSTEM_GBM}" == "yes" ]]; then display_alert "$BOARD" "Using system libgbm" "info" rm -f "${LIB_DIR}/mali/libgbm.so" "${LIB_DIR}/mali/libgbm.so.1" From 53564f3ad7f782f07399d2a63a07dd1ce707e207 Mon Sep 17 00:00:00 2001 From: Mkirin Date: Mon, 3 Aug 2026 16:53:59 +0800 Subject: [PATCH 2/2] board: rk3588: handle prereqs invocation in panthor-firmware hook MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mkinitramfs calls each hook first with $1=prereqs to query dependencies, then again to perform the actual work. Add the standard prereqs guard so the hook prints an empty dependency list and exits before running mkdir/cp. The previous form worked in practice — mkinitramfs exports DESTDIR before the prereqs query (verified against initramfs-tools 0.151, and confirmed by the built initrd containing mali_csffw.bin), so the cp did not fail. But it relied on that invariant and ran side effects during a metadata-only call. Following the documented hook contract makes the behavior explicit and forward-compatible. --- config/boards/recomputer-rk3588-devkit.conf | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/config/boards/recomputer-rk3588-devkit.conf b/config/boards/recomputer-rk3588-devkit.conf index f3069c32b1f5..111e8505b6f2 100644 --- a/config/boards/recomputer-rk3588-devkit.conf +++ b/config/boards/recomputer-rk3588-devkit.conf @@ -97,6 +97,19 @@ function pre_update_initramfs__recomputer_rk3588_install_panthor_firmware() { mkdir -p "${root_dir}/etc/initramfs-tools/hooks" cat > "${root_dir}/etc/initramfs-tools/hooks/panthor-firmware" <<-'EOF' #!/bin/sh + PREREQ="" + prereqs() + { + echo "$PREREQ" + } + + case "$1" in + prereqs) + prereqs + exit 0 + ;; + esac + set -e . /usr/share/initramfs-tools/hook-functions