Refactor mesa-vpu extension: simplify and add arch-specific browser selection

- Remove legacy panfork/kisak PPAs and image suffix logic
- Restrict Rockchip multimedia to noble+vendor only
- Simplify chromium installation (remove distribution checks)
- Add new post_armbian_repo_customize_image__browser() function for
  architecture-dependent browser selection:
  - amd64: google-chrome-stable
  - arm64/armhf: chromium
  - other: firefox

Signed-off-by: Igor Pecovnik <igor@armbian.com>
This commit is contained in:
Igor Pecovnik 2026-02-03 15:06:53 +01:00 committed by Igor
parent f169f2c22c
commit 5abb97453f
2 changed files with 33 additions and 72 deletions

View File

@ -7,7 +7,7 @@
function extension_prepare_config__3d() { function extension_prepare_config__3d() {
# Silently deny old releases which are not supported but are still in the system # Silently deny old releases which are not supported but are still in the system
[[ "${RELEASE}" =~ ^(bullseye|buster|focal)$ ]] && return 0 [[ "${RELEASE}" =~ ^(bookworm|bullseye|buster|focal|jammy)$ ]] && return 0
# Deny on minimal CLI images # Deny on minimal CLI images
if [[ "${BUILD_MINIMAL}" == "yes" ]]; then if [[ "${BUILD_MINIMAL}" == "yes" ]]; then
@ -18,15 +18,6 @@ function extension_prepare_config__3d() {
# some desktops doesn't support wayland # some desktops doesn't support wayland
[[ "${DESKTOP_ENVIRONMENT}" == "xfce" || "${DESKTOP_ENVIRONMENT}" == "i3-wm" ]] && return 0 [[ "${DESKTOP_ENVIRONMENT}" == "xfce" || "${DESKTOP_ENVIRONMENT}" == "i3-wm" ]] && return 0
# Define image suffix
if [[ "${LINUXFAMILY}" =~ ^(rockchip-rk3588|rk35xx)$ && "$BRANCH" =~ ^(legacy)$ && "${RELEASE}" =~ ^(jammy|noble)$ ]]; then
EXTRA_IMAGE_SUFFIXES+=("-panfork")
elif [[ "${DISTRIBUTION}" == "Ubuntu" && "${RELEASE}" =~ ^(jammy)$ ]]; then
EXTRA_IMAGE_SUFFIXES+=("-kisak")
elif [[ "${DISTRIBUTION}" == "Debian" && "${RELEASE}" == "bookworm" ]]; then
EXTRA_IMAGE_SUFFIXES+=("-backported-mesa")
fi
# This should be enabled on all for rk3588 distributions where mesa and vendor kernel is present # This should be enabled on all for rk3588 distributions where mesa and vendor kernel is present
if [[ "${LINUXFAMILY}" =~ ^(rockchip-rk3588|rk35xx)$ && "$BRANCH" == vendor ]]; then if [[ "${LINUXFAMILY}" =~ ^(rockchip-rk3588|rk35xx)$ && "$BRANCH" == vendor ]]; then
if [[ -n $DEFAULT_OVERLAYS ]]; then if [[ -n $DEFAULT_OVERLAYS ]]; then
@ -40,7 +31,7 @@ function extension_prepare_config__3d() {
function post_install_kernel_debs__3d() { function post_install_kernel_debs__3d() {
# Silently deny old releases which are not supported but are still in the system # Silently deny old releases which are not supported but are still in the system
[[ "${RELEASE}" =~ ^(bullseye|buster|focal)$ ]] && return 0 [[ "${RELEASE}" =~ ^(bookworm|bullseye|buster|focal|jammy)$ ]] && return 0
# Deny on minimal CLI images # Deny on minimal CLI images
if [[ "${BUILD_MINIMAL}" == "yes" ]]; then if [[ "${BUILD_MINIMAL}" == "yes" ]]; then
@ -57,60 +48,14 @@ function post_install_kernel_debs__3d() {
if [[ "${BUILD_DESKTOP}" == "yes" ]]; then if [[ "${BUILD_DESKTOP}" == "yes" ]]; then
pkgs+=("libglx-mesa0") # x11 stuff all the way pkgs+=("libglx-mesa0") # x11 stuff all the way
pkgs+=("mesa-utils" "mesa-utils-extra") pkgs+=("mesa-utils" "mesa-utils-extra")
pkgs+=("glmark2" "glmark2-wayland" "glmark2-es2-wayland" "glmark2-es2") pkgs+=("glmark2" "glmark2-wayland" "glmark2-es2-wayland" "glmark2-es2" "glmark2-x11" "glmark2-es2-x11")
[[ "${RELEASE}" != jammy ]] && pkgs+=("glmark2-x11" "glmark2-es2-x11") # Some packages, x11gl benchmark, came late into Ubuntu
fi
# Rockchip RK3588 will use panfork only with legacy kernel
if [[ "${LINUXFAMILY}" =~ ^(rockchip-rk3588|rk35xx)$ && "$BRANCH" =~ ^(legacy)$ && "${RELEASE}" =~ ^(jammy|noble)$ ]]; then
display_alert "Adding amazingfated's rk3588 PPAs" "${EXTENSION}" "info"
do_with_retries 3 chroot_sdcard add-apt-repository ppa:liujianfeng1994/panfork-mesa --yes --no-update
display_alert "Pinning amazingfated's rk3588 PPAs" "${EXTENSION}" "info"
cat <<- EOF > "${SDCARD}"/etc/apt/preferences.d/amazingfated-rk3588-panfork-pin
Package: *
Pin: release o=LP-PPA-liujianfeng1994-panfork-mesa
Pin-Priority: 1001
EOF
sed -i "s/noble/jammy/g" "${SDCARD}"/etc/apt/sources.list.d/liujianfeng1994-ubuntu-panfork-mesa-"${RELEASE}".*
elif [[ "${DISTRIBUTION}" == "Ubuntu" && "${RELEASE}" =~ ^(jammy)$ ]]; then
display_alert "Adding kisak PPAs" "${EXTENSION}" "info"
do_with_retries 3 chroot_sdcard add-apt-repository ppa:kisak/kisak-mesa --yes --no-update
display_alert "Pinning kisak PPAs" "${EXTENSION}" "info"
cat <<- EOF > "${SDCARD}"/etc/apt/preferences.d/mesa-kisak-kisak-mesa-pin
Package: *
Pin: release o=LP-PPA-kisak-kisak-mesa
Pin-Priority: 1001
EOF
fi
# Add chromium if building a desktop
if [[ "${BUILD_DESKTOP}" == "yes" ]]; then
if [[ "${DISTRIBUTION}" == "Debian" ]]; then
pkgs+=("chromium")
elif [[ "${DISTRIBUTION}" == "Ubuntu" && "${RELEASE}" =~ ^(jammy|noble)$ ]]; then
pkgs+=("chromium")
fi
fi fi
if [[ "${BUILD_DESKTOP}" == "yes" ]]; then # if desktop, add amazingfated's multimedia PPAs and rockchip-multimedia-config utility, chromium, gstreamer, etc if [[ "${BUILD_DESKTOP}" == "yes" ]]; then # if desktop, add amazingfated's multimedia PPAs and rockchip-multimedia-config utility, chromium, gstreamer, etc
if [[ "${LINUXFAMILY}" =~ ^(rockchip-rk3588|rk35xx)$ && "${RELEASE}" =~ ^(jammy|noble)$ && "${BRANCH}" =~ ^(legacy|vendor)$ ]]; then if [[ "${LINUXFAMILY}" =~ ^(rockchip-rk3588|rk35xx)$ && "${RELEASE}" =~ ^(noble)$ && "${BRANCH}" =~ ^(vendor)$ ]]; then
pkgs+=("rockchip-multimedia-config" "libv4l-rkmpp" "gstreamer1.0-rockchip" "libwidevinecdm0")
pkgs+=("rockchip-multimedia-config" "chromium" "libv4l-rkmpp" "gstreamer1.0-rockchip")
if [[ "${RELEASE}" == "jammy" ]]; then
pkgs+=(libwidevinecdm)
else
pkgs+=(libwidevinecdm0)
fi
display_alert "Adding amazingfated's multimedia PPAs" "${EXTENSION}" "info" display_alert "Adding amazingfated's multimedia PPAs" "${EXTENSION}" "info"
do_with_retries 3 chroot_sdcard add-apt-repository ppa:liujianfeng1994/rockchip-multimedia --yes --no-update do_with_retries 3 chroot_sdcard add-apt-repository ppa:liujianfeng1994/rockchip-multimedia --yes --no-update
display_alert "Pinning amazingfated's multimedia PPAs" "${EXTENSION}" "info" display_alert "Pinning amazingfated's multimedia PPAs" "${EXTENSION}" "info"
cat <<- EOF > "${SDCARD}"/etc/apt/preferences.d/amazingfated-rk3588-rockchip-multimedia-pin cat <<- EOF > "${SDCARD}"/etc/apt/preferences.d/amazingfated-rk3588-rockchip-multimedia-pin
Package: * Package: *
@ -119,6 +64,7 @@ function post_install_kernel_debs__3d() {
EOF EOF
fi fi
fi fi
display_alert "Updating sources list, after adding all PPAs" "${EXTENSION}" "info" display_alert "Updating sources list, after adding all PPAs" "${EXTENSION}" "info"
do_with_retries 3 chroot_sdcard_apt_get_update do_with_retries 3 chroot_sdcard_apt_get_update
@ -130,15 +76,11 @@ function post_install_kernel_debs__3d() {
fi fi
display_alert "Installing 3D extension packages" "${EXTENSION}" "info" display_alert "Installing 3D extension packages" "${EXTENSION}" "info"
if [[ "${DISTRIBUTION}" == "Debian" && "${RELEASE}" == "bookworm" ]]; then do_with_retries 3 chroot_sdcard_apt_get_install "${pkgs[@]}"
do_with_retries 3 chroot_sdcard_apt_get_install -t bookworm-backports "${pkgs[@]}"
else
do_with_retries 3 chroot_sdcard_apt_get_install "${pkgs[@]}"
fi
# This library gets downgraded # This library gets downgraded
if [[ "${BUILD_DESKTOP}" == "yes" ]]; then if [[ "${BUILD_DESKTOP}" == "yes" ]]; then
if [[ "${RELEASE}" =~ ^(oracular|noble|jammy)$ && "${ARCH}" == arm* ]]; then if [[ "${RELEASE}" =~ ^(oracular|noble)$ && "${ARCH}" == arm* ]]; then
do_with_retries 3 chroot_sdcard apt-mark hold libdav1d7 do_with_retries 3 chroot_sdcard apt-mark hold libdav1d7
fi fi
fi fi
@ -150,15 +92,34 @@ function post_install_kernel_debs__3d() {
do_with_retries 3 chroot_sdcard apt-mark unhold base-files do_with_retries 3 chroot_sdcard apt-mark unhold base-files
if [[ "${BUILD_DESKTOP}" == "yes" ]]; then if [[ "${BUILD_DESKTOP}" == "yes" ]]; then
if [[ "${RELEASE}" =~ ^(oracular|noble|jammy)$ && "${ARCH}" == arm* ]]; then if [[ "${RELEASE}" =~ ^(oracular|noble)$ && "${ARCH}" == arm* ]]; then
do_with_retries 3 chroot_sdcard apt-mark unhold libdav1d7 do_with_retries 3 chroot_sdcard apt-mark unhold libdav1d7
fi fi
fi fi
# Disable wayland flag for XFCE return 0
#if [[ "${DESKTOP_ENVIRONMENT}" == "xfce" ]]; then }
# sed -e '/wayland/ s/^#*/#/' -i "${SDCARD}"/etc/chromium.d/default-flags
#fi function post_armbian_repo_customize_image__browser() {
# Silently deny old releases which are not supported but are still in the system
[[ "${RELEASE}" =~ ^(bookworm|bullseye|buster|focal|jammy)$ ]] && return 0
# Add browser if building a desktop - architecture dependent
[[ "${BUILD_DESKTOP}" != "yes" ]] && return 0
if [[ "${ARCH}" == "amd64" ]]; then
# amd64: prefer google-chrome
pkgs=("google-chrome-stable")
elif [[ "${ARCH}" =~ ^(arm64|armhf)$ ]]; then
# arm64/armhf: use chromium
pkgs=("chromium")
else
# other architectures: fallback to firefox
pkgs=("firefox")
fi
display_alert "Installing browser" "${EXTENSION}" "info"
do_with_retries 3 chroot_sdcard_apt_get_install "${pkgs[@]}"
return 0 return 0
} }

View File

@ -1,4 +1,4 @@
# Install those packages rather from Armbian repo # Install those packages rather from Armbian repo
Package: firefox thunderbird Package: firefox firefox-esr thunderbird
Pin: origin apt.armbian.com Pin: origin apt.armbian.com
Pin-Priority: 700 Pin-Priority: 700