mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
Introduce integrated extension for 3D and multimedia (#6646)
This commit is contained in:
@@ -1 +0,0 @@
|
||||
../../common/appgroups/3dsupport
|
||||
@@ -1,4 +0,0 @@
|
||||
libglx-mesa0
|
||||
libgl1-mesa-dri
|
||||
mesa-utils
|
||||
mesa-utils-extra
|
||||
@@ -1,62 +0,0 @@
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (c) 2024 Ricardo Pardini <ricardo@pardini.net>
|
||||
# Copyright (c) 2024 Monka
|
||||
# This file is a part of the Armbian Build Framework https://github.com/armbian/build/
|
||||
|
||||
# This add's oibaf PPAs to the the image, and installs all needed packages.
|
||||
# It only works with mainline mesa enabled kernels, eg, not legacy/vendor ones, usually.
|
||||
|
||||
function extension_prepare_config__oibaf() {
|
||||
display_alert "Preparing oibaf extension" "${EXTENSION}" "info"
|
||||
|
||||
if [[ "${DISTRIBUTION}" != "Ubuntu" ]]; then
|
||||
display_alert "oibaf" "${EXTENSION} extension only works with Ubuntu (currently '${DISTRIBUTION}'), skipping" "warn"
|
||||
return 0
|
||||
fi
|
||||
|
||||
[[ "${BUILD_DESKTOP}" != "yes" ]] && return 0
|
||||
|
||||
# Add to the image suffix.
|
||||
EXTRA_IMAGE_SUFFIXES+=("-oibaf") # global array
|
||||
}
|
||||
|
||||
function post_install_kernel_debs__oibaf() {
|
||||
|
||||
if [[ "${DISTRIBUTION}" != "Ubuntu" ]]; then
|
||||
display_alert "oibaf" "${EXTENSION} extension only works with Ubuntu, skipping" "debug"
|
||||
return 0
|
||||
fi
|
||||
|
||||
[[ "${BUILD_DESKTOP}" != "yes" ]] && return 0
|
||||
|
||||
display_alert "Adding oibaf PPAs" "${EXTENSION}" "info"
|
||||
do_with_retries 3 chroot_sdcard add-apt-repository ppa:oibaf/graphics-drivers --yes --no-update
|
||||
|
||||
display_alert "Pinning oibaf PPAs" "${EXTENSION}" "info"
|
||||
cat <<- EOF > "${SDCARD}"/etc/apt/preferences.d/mesa-oibaf-graphics-drivers-pin
|
||||
Package: *
|
||||
Pin: release o=LP-PPA-oibaf-graphics-drivers
|
||||
Pin-Priority: 1001
|
||||
EOF
|
||||
|
||||
# Ubuntu oracular workaround
|
||||
local url_to_check="https://ppa.launchpadcontent.net/oibaf/graphics-drivers/ubuntu/dists/${RELEASE}/Release"
|
||||
if curl -o/dev/null -sfIL "$url_to_check" 2>&1; then
|
||||
:
|
||||
else
|
||||
display_alert "Converting to generic sources list due to missing release file" "${EXTENSION}" "info"
|
||||
sed -i "s/${RELEASE}/noble/g" "${SDCARD}"/etc/apt/sources.list.d/oibaf-ubuntu-graphics-drivers-"${RELEASE}".sources
|
||||
fi
|
||||
|
||||
display_alert "Updating sources list, after oibaf PPAs" "${EXTENSION}" "info"
|
||||
do_with_retries 3 chroot_sdcard_apt_get_update
|
||||
|
||||
display_alert "Installing oibaf packages" "${EXTENSION}" "info"
|
||||
do_with_retries 3 chroot_sdcard_apt_get_install --allow-downgrades glmark2-wayland glmark2 glmark2-es2 glmark2-es2-wayland mesa-utils
|
||||
|
||||
display_alert "Upgrading oibaf packages" "${EXTENSION}" "info"
|
||||
do_with_retries 3 chroot_sdcard_apt_get dist-upgrade
|
||||
|
||||
display_alert "Installed oibaf packages" "${EXTENSION}" "info"
|
||||
}
|
||||
106
extensions/mesa-vpu.sh
Normal file
106
extensions/mesa-vpu.sh
Normal file
@@ -0,0 +1,106 @@
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Armbian build framework extension
|
||||
#
|
||||
# Enables 3D and multimedia, 4K VPU with Chromium, acceleration for Ubuntu. Debian only 3D
|
||||
#
|
||||
|
||||
function extension_prepare_config__3d() {
|
||||
|
||||
# only used when generating image
|
||||
[[ "${BUILDING_IMAGE}" != "yes" ]] && return 0
|
||||
|
||||
# only used when generating desktop
|
||||
[[ "${BUILD_DESKTOP}" != "yes" ]] && return 0
|
||||
|
||||
# Define image suffix
|
||||
if [[ "${LINUXFAMILY}" =~ ^(rockchip-rk3588|rk35xx)$ && "$BRANCH" =~ ^(legacy)$ && "${RELEASE}" =~ ^(jammy|noble)$ ]]; then
|
||||
|
||||
EXTRA_IMAGE_SUFFIXES+=("-panfork")
|
||||
|
||||
elif [[ "${DISTRIBUTION}" == "Ubuntu" ]]; then
|
||||
|
||||
EXTRA_IMAGE_SUFFIXES+=("-oibaf")
|
||||
|
||||
fi
|
||||
|
||||
# This should be enabled on all for rk3588 distributions where mesa and vendor kernel is present
|
||||
if [[ "${LINUXFAMILY}" =~ ^(rockchip-rk3588|rk35xx)$ && "$BRANCH" == vendor ]]; then
|
||||
declare -g DEFAULT_OVERLAYS="panthor-gpu"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
function post_install_kernel_debs__3d() {
|
||||
|
||||
# Silently deny old releases which are not supported but are still in the system
|
||||
[[ "${RELEASE}" =~ ^(bullseye|buster|focal)$ ]] && return 0
|
||||
|
||||
# Do not install those packages on CLI and minimal images
|
||||
[[ "${BUILD_DESKTOP}" != "yes" ]] && return 0
|
||||
|
||||
# Packages that are going to be installed
|
||||
declare -a pkgs=("mesa-utils" "mesa-utils-extra" "libglx-mesa0" "libgl1-mesa-dri" "glmark2" "glmark2-wayland" "glmark2-es2-wayland" "glmark2-es2")
|
||||
|
||||
# Some packages, x11gl benchmark, came late into Ubuntu
|
||||
[[ "${RELEASE}" != jammy ]] && pkgs+=("glmark2-x11" "glmark2-es2-x11")
|
||||
|
||||
# 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" ]]; then
|
||||
|
||||
display_alert "Adding oibaf PPAs" "${EXTENSION}" "info"
|
||||
do_with_retries 3 chroot_sdcard add-apt-repository ppa:oibaf/graphics-drivers --yes --no-update
|
||||
|
||||
display_alert "Pinning oibaf PPAs" "${EXTENSION}" "info"
|
||||
cat <<- EOF > "${SDCARD}"/etc/apt/preferences.d/mesa-oibaf-graphics-drivers-pin
|
||||
Package: *
|
||||
Pin: release o=LP-PPA-oibaf-graphics-drivers
|
||||
Pin-Priority: 1001
|
||||
EOF
|
||||
|
||||
fi
|
||||
|
||||
if [[ "${LINUXFAMILY}" =~ ^(rockchip-rk3588|rk35xx)$ && "${RELEASE}" =~ ^(jammy|noble)$ && "${BRANCH}" =~ ^(legacy|vendor)$ ]]; then
|
||||
|
||||
pkgs+=("rockchip-multimedia-config" "chromium-browser" "libv4l-rkmpp" "gstreamer1.0-rockchip")
|
||||
if [[ "${RELEASE}" == "jammy" ]]; then
|
||||
pkgs+=(libwidevinecdm)
|
||||
else
|
||||
pkgs+=(libwidevinecdm0)
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
display_alert "Pinning amazingfated's multimedia PPAs" "${EXTENSION}" "info"
|
||||
cat <<- EOF > "${SDCARD}"/etc/apt/preferences.d/amazingfated-rk3588-rockchip-multimedia-pin
|
||||
Package: *
|
||||
Pin: release o=LP-PPA-liujianfeng1994-rockchip-multimedia
|
||||
Pin-Priority: 1001
|
||||
EOF
|
||||
fi
|
||||
|
||||
display_alert "Updating sources list, after oibaf PPAs" "${EXTENSION}" "info"
|
||||
do_with_retries 3 chroot_sdcard_apt_get_update
|
||||
|
||||
display_alert "Installing 3D extension packages" "${EXTENSION}" "info"
|
||||
do_with_retries 3 chroot_sdcard_apt_get_install --allow-downgrades "${pkgs[@]}"
|
||||
|
||||
display_alert "Upgrading Mesa packages" "${EXTENSION}" "info"
|
||||
do_with_retries 3 chroot_sdcard_apt_get dist-upgrade
|
||||
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (c) 2023 Ricardo Pardini <ricardo@pardini.net>
|
||||
# This file is a part of the Armbian Build Framework https://github.com/armbian/build/
|
||||
#
|
||||
|
||||
# This add's amazingfate's PPAs to the the image, and installs all needed packages.
|
||||
# It only works on LINUXFAMILY="rk3588-legacy" and RELEASE=jammy/noble and BRANCH=legacy/vendor
|
||||
# if on a desktop, installs more useful packages, and tries to coerce lightdm to use gtk-greeter and a Wayland session.
|
||||
function extension_prepare_config__amazingfate_rk35xx_multimedia() {
|
||||
display_alert "Preparing amazingfate's PPAs for rk35xx multimedia" "${EXTENSION}" "info"
|
||||
EXTRA_IMAGE_SUFFIXES+=("-amazingfated") # Add to the image suffix. # global array
|
||||
|
||||
[[ "${BUILDING_IMAGE}" != "yes" ]] && return 0
|
||||
|
||||
if [[ "${RELEASE}" != "jammy" ]] && [[ "${RELEASE}" != "noble" ]]; then
|
||||
display_alert "skipping..." "${EXTENSION} not for ${RELEASE}, only jammy/noble, skipping" "warn"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [[ "${LINUXFAMILY}" != "rockchip-rk3588" && "${LINUXFAMILY}" != "rk35xx" ]]; then
|
||||
exit_with_error "${EXTENSION} only works on LINUXFAMILY=rockchip-rk3588/rk35xx, currently on '${LINUXFAMILY}'"
|
||||
fi
|
||||
|
||||
if [[ "${BRANCH}" != "legacy" && "${BRANCH}" != "vendor" ]]; then
|
||||
exit_with_error "${EXTENSION} only works on BRANCH=legacy/vendor, currently on '${BRANCH}'"
|
||||
fi
|
||||
}
|
||||
|
||||
function post_install_kernel_debs__amazingfated_rk35xx_multimedia() {
|
||||
if [[ "${RELEASE}" != "jammy" ]] && [[ "${RELEASE}" != "noble" ]]; then
|
||||
display_alert "skipping..." "${EXTENSION} not for ${RELEASE}, only jammy/noble, skipping" "info"
|
||||
return 0
|
||||
fi
|
||||
|
||||
display_alert "Adding rockchip-multimedia by Amazingfate PPAs" "${EXTENSION}" "info"
|
||||
|
||||
do_with_retries 3 chroot_sdcard add-apt-repository ppa:liujianfeng1994/rockchip-multimedia --yes --no-update
|
||||
|
||||
display_alert "Updating sources list, after rockchip-multimedia by Amazingfate PPAs" "${EXTENSION}" "info"
|
||||
do_with_retries 3 chroot_sdcard_apt_get_update
|
||||
|
||||
declare -a pkgs=(rockchip-multimedia-config)
|
||||
if [[ "${BUILD_DESKTOP}" == "yes" ]]; then
|
||||
pkgs+=(chromium-browser)
|
||||
if [[ "${RELEASE}" == "jammy" ]]; then
|
||||
pkgs+=(libwidevinecdm)
|
||||
else
|
||||
pkgs+=(libwidevinecdm0)
|
||||
fi
|
||||
pkgs+=("libv4l-rkmpp" "gstreamer1.0-rockchip") # @TODO: remove when added as dependencies to chromium...?
|
||||
fi
|
||||
|
||||
display_alert "Installing rockchip-multimedia by Amazingfate packages" "${EXTENSION} :: ${pkgs[*]}" "info"
|
||||
do_with_retries 3 chroot_sdcard_apt_get_install "${pkgs[@]}"
|
||||
|
||||
display_alert "Upgrading rockchip-multimedia by Amazingfate packages" "${EXTENSION}" "info"
|
||||
do_with_retries 3 chroot_sdcard_apt_get upgrade
|
||||
|
||||
display_alert "Installed rockchip-multimedia by Amazingfate packages" "${EXTENSION}" "info"
|
||||
|
||||
return 0
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (c) 2024 Ricardo Pardini <ricardo@pardini.net>
|
||||
# This file is a part of the Armbian Build Framework https://github.com/armbian/build/
|
||||
#
|
||||
|
||||
# Enables panthor-gpu overlay and oibaf-mesa extension. Only meant for legacy/vendor branches of Rockchip boards.
|
||||
enable_extension "mesa-oibaf" # Enable OIBAF repo for mainline mesa
|
||||
|
||||
function extension_prepare_config__rk_panthor() {
|
||||
display_alert "Preparing rk-panthor" "${EXTENSION}" "info"
|
||||
EXTRA_IMAGE_SUFFIXES+=("-panthor") # Add to the image suffix. # global array
|
||||
|
||||
# Enable panthor overlay by default
|
||||
declare -g DEFAULT_OVERLAYS="panthor-gpu"
|
||||
|
||||
[[ "${BUILDING_IMAGE}" != "yes" ]] && return 0
|
||||
|
||||
if [[ "${LINUXFAMILY}" != "rockchip-rk3588" && "${LINUXFAMILY}" != "rk35xx" ]]; then
|
||||
exit_with_error "${EXTENSION} only works on LINUXFAMILY=rockchip-rk3588/rk35xx, currently on '${LINUXFAMILY}'"
|
||||
fi
|
||||
|
||||
if [[ "${BRANCH}" != "vendor" ]]; then
|
||||
exit_with_error "${EXTENSION} only works on BRANCH=vendor, currently on '${BRANCH}'"
|
||||
fi
|
||||
}
|
||||
Reference in New Issue
Block a user