@@ -102,66 +102,144 @@ function _module_desktops_write_apt_pin() {
102102}
103103
104104#
105- # Enable the panthor-gpu DT overlay on Rockchip RK3588 -family boards
105+ # Wire up the Rockchip 3D + multimedia stack on rk3588 -family boards
106106# running the vendor kernel, when a Wayland-capable desktop is being
107- # installed. Mirrors the old extensions/network/… no, wait — mirrors
108- # armbian/build's extensions/mesa-vpu.sh 'extension_prepare_config__3d'
109- # hook so that install-on-minimal converges on the same overlay set
107+ # installed. Two stages:
108+ #
109+ # 1. On noble specifically: add amazingfated's rockchip-multimedia
110+ # PPA (ppa:liujianfeng1994/rockchip-multimedia), pin it at 1001,
111+ # and pull the hardware-accelerated userspace —
112+ # rockchip-multimedia-config, libv4l-rkmpp (V4L2 -> MPP codec
113+ # plugin), gstreamer1.0-rockchip, and libwidevinecdm0 (so
114+ # Netflix/Spotify/DRM video actually plays in the PPA's
115+ # chromium). The PPA ships a chromium build patched for
116+ # rk3588 VPU + Widevine; pin priority 1001 is required to
117+ # override apt.armbian.com and the Ubuntu archive.
118+ #
119+ # 2. On any non-legacy release: enable the panthor-gpu DT overlay.
120+ # panthor-gpu is the Mesa panthor-kbase GPU driver overlay —
121+ # required for hardware-accelerated GL / Vulkan / GBM on rk3588
122+ # under Mesa + vendor kernel, unused (and ignored) elsewhere.
123+ #
124+ # Mirrors armbian/build's extensions/mesa-vpu.sh so a desktop
125+ # installed on top of a minimal image converges on the same state
110126# an image-built desktop would have.
111127#
112- # panthor-gpu is the Mesa panthor-kbase GPU driver overlay: required
113- # for hardware-accelerated GL / Vulkan / GBM on rk3588 under Mesa +
114- # vendor kernel, unused (and ignored) on everything else.
128+ # Gating (both stages):
129+ # - BOARDFAMILY rockchip-rk3588 / rk35xx, BRANCH=vendor.
130+ # - Skip tier=minimal — neither the Mesa stack nor the GStreamer
131+ # plugin has a consumer in minimal.
132+ # - Skip xfce / i3-wm — X11-only, no GBM/Wayland path.
115133#
116- # Gating mirrors the upstream hook:
117- # - Skip on pre-bookworm / bookworm / jammy / older releases —
118- # panthor kernel bits didn't land there in a usable shape.
119- # - Skip on tier=minimal — the overlay is only useful with a
120- # compositor stack (Mesa/Vulkan loaders) that mid/full pulls in.
121- # - Skip on xfce / i3-wm — these are X11-only in our default
122- # configuration and don't benefit from a GBM GPU path.
123- # - Only fire on BOARDFAMILY rockchip-rk3588 / rk35xx and
124- # BRANCH=vendor.
134+ # Extra gating:
135+ # - PPA stage: noble only. The PPA publishes against noble; on
136+ # other releases the .debs would hit ABI mismatches.
137+ # - Overlay stage: skip bookworm / bullseye / buster / focal /
138+ # jammy — panthor kernel bits didn't land in a usable shape.
125139#
126140# BOARDFAMILY + BRANCH are globals set at configng init time by
127141# module_env_init.sh (which sources /etc/armbian-release); present
128142# in the chroot under mode=build because armbian-base-files is
129- # installed before module_desktops. Delegates the actual
130- # armbianEnv.txt write to module_devicetree_overlays (atomic
131- # temp+mv, .bak preserved, validates name against the discovered
132- # .dtbo set, idempotent).
143+ # installed before module_desktops. Overlay write is delegated to
144+ # module_devicetree_overlays (atomic temp+mv, .bak preserved,
145+ # validates name against the discovered .dtbo set, idempotent).
133146#
134- function _module_desktops_add_3d_overlay () {
135- # Board/branch gate.
147+ function _module_desktops_rockchip_multimedia () {
148+ # Board/branch gate — shared by both stages .
136149 if [[ ! " ${BOARDFAMILY:- } " =~ ^(rockchip-rk3588| rk35xx)$ ]]; then
137- debug_log " _module_desktops_add_3d_overlay : BOARDFAMILY='${BOARDFAMILY:- } ' — not rk3588-family, skipping"
150+ debug_log " _module_desktops_rockchip_multimedia : BOARDFAMILY='${BOARDFAMILY:- } ' — not rk3588-family, skipping"
138151 return 0
139152 fi
140153 if [[ " ${BRANCH:- } " != " vendor" ]]; then
141- debug_log " _module_desktops_add_3d_overlay : BRANCH='${BRANCH:- } ' — not vendor, skipping"
154+ debug_log " _module_desktops_rockchip_multimedia : BRANCH='${BRANCH:- } ' — not vendor, skipping"
142155 return 0
143156 fi
144157
145- # Release gate — old releases ship kernels that don't have the
146- # panthor driver, or have a non-working version.
147- case " ${DISTROID:- } " in
148- bookworm|bullseye|buster|focal|jammy)
149- debug_log " _module_desktops_add_3d_overlay: release '${DISTROID} ' predates usable panthor, skipping"
150- return 0
151- ;;
152- esac
153-
154- # Tier gate — minimal doesn't install the Mesa/Vulkan stack that
155- # would use the overlay.
158+ # Tier gate — minimal doesn't install the Mesa / GStreamer stack
159+ # that would use any of this.
156160 if [[ " ${tier:- } " == " minimal" ]]; then
157- debug_log " _module_desktops_add_3d_overlay : tier=minimal, skipping"
161+ debug_log " _module_desktops_rockchip_multimedia : tier=minimal, skipping"
158162 return 0
159163 fi
160164
161- # X11-only DEs — no Wayland compositor, no GBM path.
165+ # X11-only DEs — no Wayland compositor, no GBM path, and no
166+ # chromium-in-Wayland benefit from the PPA build either.
162167 case " ${de:- } " in
163168 xfce|i3-wm)
164- debug_log " _module_desktops_add_3d_overlay: de=${de} is X11-only, skipping"
169+ debug_log " _module_desktops_rockchip_multimedia: de=${de} is X11-only, skipping"
170+ return 0
171+ ;;
172+ esac
173+
174+ # ---------------------------------------------------------------
175+ # Stage 1: amazingfated rockchip-multimedia PPA (noble only).
176+ # ---------------------------------------------------------------
177+ if [[ " ${DISTROID:- } " == " noble" ]]; then
178+ display_alert " Adding amazingfated's multimedia PPA" " liujianfeng1994/rockchip-multimedia" " info" 2> /dev/null \
179+ || echo " Adding amazingfated's multimedia PPA (liujianfeng1994/rockchip-multimedia)"
180+
181+ # add-apt-repository lives in software-properties-common —
182+ # minimal images do not ship it. Pull it on demand; track
183+ # via pkg_install so uninstall removes it.
184+ if ! command -v add-apt-repository > /dev/null 2>&1 ; then
185+ if ! pkg_install software-properties-common; then
186+ echo " Warning: could not install software-properties-common; skipping rockchip-multimedia PPA" >&2
187+ return 0
188+ fi
189+ fi
190+
191+ # --yes: non-interactive. --no-update: skip the implicit
192+ # apt-get update — we run pkg_update ourselves once the pin
193+ # is in place so the first resolution already sees priority
194+ # 1001 for the PPA.
195+ if ! DEBIAN_FRONTEND=noninteractive add-apt-repository --yes --no-update ppa:liujianfeng1994/rockchip-multimedia; then
196+ echo " Warning: add-apt-repository ppa:liujianfeng1994/rockchip-multimedia failed; skipping multimedia packages" >&2
197+ return 0
198+ fi
199+
200+ # Pin the PPA above both apt.armbian.com and the Ubuntu
201+ # archive. Priority 1001 is required (not 990) so the PPA's
202+ # patched chromium can *replace* an already-installed
203+ # apt.armbian.com chromium — a downgrade-across-origins that
204+ # 990 would refuse.
205+ display_alert " Pinning amazingfated's multimedia PPA" " priority 1001" " info" 2> /dev/null \
206+ || echo " Pinning amazingfated's multimedia PPA (priority 1001)"
207+ local pin_file=" /etc/apt/preferences.d/amazingfated-rk3588-rockchip-multimedia-pin"
208+ local pin_tmp=" ${pin_file} .tmp"
209+ if ! cat > " $pin_tmp " << - EOF
210+ Package: *
211+ Pin: release o=LP-PPA-liujianfeng1994-rockchip-multimedia
212+ Pin-Priority: 1001
213+ EOF
214+ then
215+ echo " Warning: failed to write ${pin_tmp} ; multimedia PPA left unpinned" >&2
216+ rm -f " $pin_tmp "
217+ elif ! mv " $pin_tmp " " $pin_file " ; then
218+ echo " Warning: failed to install ${pin_file} ; multimedia PPA left unpinned" >&2
219+ rm -f " $pin_tmp "
220+ fi
221+
222+ # Refresh apt with the PPA now in sources + the pin in place.
223+ pkg_update
224+
225+ # Install the Rockchip multimedia + Widevine stack. These
226+ # packages all come from the PPA (except libwidevinecdm0 on
227+ # arm64, which the PPA specifically republishes with a
228+ # working arm64 binary). pkg_install tracks them in
229+ # ACTUALLY_INSTALLED so uninstall removes them.
230+ display_alert " Installing Rockchip multimedia + Widevine" " de=${de} tier=${tier} " " info" 2> /dev/null \
231+ || echo " Installing Rockchip multimedia + Widevine (de=${de} tier=${tier} )"
232+ pkg_install -o Dpkg::Options::=" --force-confdef" -o Dpkg::Options::=" --force-confold" \
233+ rockchip-multimedia-config libv4l-rkmpp gstreamer1.0-rockchip libwidevinecdm0 || \
234+ echo " Warning: rockchip multimedia package install failed (see above)" >&2
235+ fi
236+
237+ # ---------------------------------------------------------------
238+ # Stage 2: panthor-gpu DT overlay (any non-legacy release).
239+ # ---------------------------------------------------------------
240+ case " ${DISTROID:- } " in
241+ bookworm|bullseye|buster|focal|jammy)
242+ debug_log " _module_desktops_rockchip_multimedia: release '${DISTROID} ' predates usable panthor, skipping overlay"
165243 return 0
166244 ;;
167245 esac
@@ -481,14 +559,15 @@ function module_desktops() {
481559 # even though the machine is online.
482560 _module_desktops_configure_networking
483561
484- # Enable panthor-gpu DT overlay on rk3588-family boards
485- # running the vendor kernel when a Wayland-capable
486- # desktop is installed. No-op on every other board /
562+ # Wire up the Rockchip 3D + multimedia stack on
563+ # rk3588-family / vendor-kernel boards: panthor-gpu DT
564+ # overlay (Mesa GBM path), and — on noble — the
565+ # amazingfated multimedia PPA with its hardware-
566+ # accelerated chromium, gstreamer plugins, libv4l-rkmpp,
567+ # and libwidevinecdm0. No-op on every other board /
487568 # branch / release / tier / DE combination. Mirrors
488- # armbian/build's extensions/mesa-vpu.sh 'Hook 1' so
489- # runtime-installed desktops converge on the same
490- # overlay set an image-built desktop would have.
491- _module_desktops_add_3d_overlay
569+ # armbian/build's extensions/mesa-vpu.sh.
570+ _module_desktops_rockchip_multimedia
492571
493572 # add user to desktop groups
494573 # User-specific setup: group membership, skel propagation,
@@ -684,6 +763,16 @@ function module_desktops() {
684763 rm -f " /etc/apt/preferences.d/${de} "
685764 fi
686765
766+ # Drop the amazingfated rockchip-multimedia PPA pin written
767+ # by _module_desktops_rockchip_multimedia. Pin priority 1001
768+ # overrides the distro for *every* package on the system,
769+ # not just the DE's — leaving it behind after the multimedia
770+ # packages are gone would keep the PPA outranking the
771+ # archive on the next unrelated apt upgrade. Safe to rm
772+ # unconditionally: the file is absent when the DE had no
773+ # PPA stage (non-noble, non-rk3588, tier=minimal, etc.).
774+ rm -f /etc/apt/preferences.d/amazingfated-rk3588-rockchip-multimedia-pin
775+
687776 # Reclaim disk space: clear apt's downloaded .deb cache. A full
688777 # DE removal frees hundreds of MB of installed files; the
689778 # matching .deb archives in /var/cache/apt/archives are no
0 commit comments