Skip to content
Open
Show file tree
Hide file tree
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
83 changes: 83 additions & 0 deletions config/boards/recomputer-rk3588-devkit.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,106 @@ 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"
}

# 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
PREREQ=""
prereqs()
{
echo "$PREREQ"
}

case "$1" in
prereqs)
prereqs
exit 0
;;
esac

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"
}
Comment thread
Mkiring marked this conversation as resolved.

# 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"
Expand Down
24 changes: 11 additions & 13 deletions config/kernel/linux-seeed-rk3588-vendor.config
Original file line number Diff line number Diff line change
Expand Up @@ -1970,19 +1970,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
Comment on lines +1974 to +1983

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This unconditionally disables the Mali KMD at compile time, regardless of whether RECOMPUTER_GPU_STACK=panthor is set. It is not possible for the user to switch back to libmali for opencl/vulkan compute use cases.

CONFIG_FB=y
CONFIG_LCD_CLASS_DEVICE=m
CONFIG_LCD_L4F00242T03=m
Expand Down
25 changes: 25 additions & 0 deletions config/sources/vendors/seeed-studio/recomputer-rk35xx-common.inc
Original file line number Diff line number Diff line change
Expand Up @@ -389,11 +389,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"

Expand Down Expand Up @@ -437,6 +454,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"
Expand Down
Loading