ff9db4e273
DKMS build for daedalus_v4l2 fails against kernel 6.18+ with:
daedalus_v4l2_main.c:1049: error: too few arguments to function
'v4l2_fh_add'
v4l2-fh.h:97: void v4l2_fh_add(struct v4l2_fh *fh, struct file *filp);
(same for v4l2_fh_del). Signature changed exactly at v6.18 — verified
v6.13–v6.17 still use the one-arg form via raw.githubusercontent.com
tag walk.
Upstream commit f0cd29a wraps the calls with LINUX_VERSION_CODE so the
module keeps building against:
* 6.12 LTS / RPi 6.12.75 (one-arg) — hertz
* 6.12.88+deb13-arm64 (one-arg)
* 6.18.29+rpt-rpi-2712 (file* arg) — higgs running kernel
Higgs (Pi CM5) was hitting this: daedalus-v4l2-dkms 0.1.0+r16+gf55b2cd
showed 'installed' in dpkg but DKMS autoinstall failed for the running
6.18.29 kernel. Re-running 'dkms autoinstall' after this bump succeeds
+ /dev/daedalus-v4l2 appears.
Also widens debian/daedalus-v4l2-dkms Recommends from
linux-headers-generic | linux-headers
to
linux-headers-rpi-2712 | linux-headers-rpi | linux-headers-generic | linux-headers
so apt pulls the right metapackage on Raspberry Pi OS / RPi-2712
kernels by default.
Userspace pkgver bumps in lockstep (no userspace change in f0cd29a, but
keeps daedalus-v4l2 + daedalus-v4l2-dkms versions matching for
LIBVA_DRIVER_NAME selection sanity).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
175 lines
5.9 KiB
Bash
Executable File
175 lines
5.9 KiB
Bash
Executable File
#!/bin/bash
|
|
# Build daedalus-v4l2-dkms_<ver>_all.deb (kernel module via DKMS).
|
|
#
|
|
# Installs kernel/ source tree to /usr/src/daedalus_v4l2-${PKGVER}/
|
|
# plus a dkms.conf. Postinst registers with DKMS (dkms add + build +
|
|
# install). Prerm deregisters. Result: the daedalus_v4l2 module
|
|
# auto-rebuilds against any installed kernel headers without users
|
|
# needing to remember to dkms-add it.
|
|
#
|
|
# Architecture: all. The kernel module itself is per-kernel-version,
|
|
# but the SOURCE package is arch-independent.
|
|
#
|
|
# Sibling Arch package: ../../arch/daedalus-v4l2-dkms/PKGBUILD
|
|
# Sibling userspace package: ../daedalus-v4l2/build-deb.sh
|
|
set -euo pipefail
|
|
|
|
UPSTREAM_COMMIT=f0cd29a3400cb9af192842c3e2bcc90cc08c68ca
|
|
PKGVER=0.1.0+r17+gf0cd29a
|
|
PKGREL=2 # pkgrel=2 — corrected upstream commit SHA
|
|
MODULE_NAME=daedalus_v4l2
|
|
|
|
HERE=$(dirname "$(readlink -f "$0")")
|
|
|
|
# Reproducible build. 2026-05-18 23:00 UTC — Phase 8.13 close.
|
|
export SOURCE_DATE_EPOCH=1779231600
|
|
|
|
work=$(mktemp -d)
|
|
trap "rm -rf $work" EXIT
|
|
|
|
cd "$work"
|
|
curl -sSLfo daedalus-v4l2.tar.gz \
|
|
"https://git.reauktion.de/reauktion/daedalus-v4l2/archive/${UPSTREAM_COMMIT}.tar.gz"
|
|
tar xzf daedalus-v4l2.tar.gz
|
|
SRCDIR=daedalus-v4l2
|
|
|
|
ROOT="$work/pkgroot"
|
|
SRCROOT="$ROOT/usr/src/${MODULE_NAME}-${PKGVER}"
|
|
|
|
mkdir -p "$SRCROOT/include" \
|
|
"$ROOT/DEBIAN" \
|
|
"$ROOT/usr/share/doc/daedalus-v4l2-dkms"
|
|
|
|
# Copy kernel/ source files to the DKMS source dir.
|
|
cp -r "$work/$SRCDIR/kernel/." "$SRCROOT/"
|
|
|
|
# Embed the shared protocol header inline (rather than referencing
|
|
# ../include/ which doesn't exist after DKMS extracts the tree).
|
|
# Patch the Makefile to find it at $SRCROOT/include/ instead.
|
|
install -m 644 "$work/$SRCDIR/include/daedalus_v4l2_proto.h" \
|
|
"$SRCROOT/include/daedalus_v4l2_proto.h"
|
|
sed -i 's|-I\$(src)/\.\./include|-I$(src)/include|' "$SRCROOT/Makefile"
|
|
|
|
# Generate dkms.conf with the actual version substituted.
|
|
cat > "$SRCROOT/dkms.conf" <<EOF
|
|
PACKAGE_NAME="${MODULE_NAME}"
|
|
PACKAGE_VERSION="${PKGVER}"
|
|
|
|
BUILT_MODULE_NAME[0]="${MODULE_NAME}"
|
|
DEST_MODULE_LOCATION[0]="/updates"
|
|
|
|
MAKE[0]="make KERNELDIR=/lib/modules/\${kernelver}/build all"
|
|
CLEAN="make KERNELDIR=/lib/modules/\${kernelver}/build clean"
|
|
|
|
AUTOINSTALL="yes"
|
|
EOF
|
|
|
|
# Doc
|
|
install -m 644 "$work/$SRCDIR/README.md" \
|
|
"$ROOT/usr/share/doc/daedalus-v4l2-dkms/README.md"
|
|
install -Dm644 "$HERE/debian/copyright" "$ROOT/usr/share/doc/daedalus-v4l2-dkms/copyright"
|
|
install -Dm644 "$HERE/debian/changelog" "$ROOT/usr/share/doc/daedalus-v4l2-dkms/changelog.Debian"
|
|
gzip -9 -n "$ROOT/usr/share/doc/daedalus-v4l2-dkms/changelog.Debian"
|
|
|
|
# DKMS post-install / pre-remove hooks.
|
|
cat > "$ROOT/DEBIAN/postinst" <<EOF
|
|
#!/bin/sh
|
|
set -e
|
|
|
|
NAME=${MODULE_NAME}
|
|
VERSION=${PKGVER}
|
|
KERNELVER=\$(uname -r)
|
|
|
|
# Yellow + bold ANSI for the warning so it stands out in apt's
|
|
# stream of "Setting up" lines. Disable colour on non-TTY.
|
|
if [ -t 1 ]; then
|
|
Y=\$(printf '\\033[1;33m'); R=\$(printf '\\033[0m')
|
|
else
|
|
Y=''; R=''
|
|
fi
|
|
|
|
warn() {
|
|
printf '%s==> daedalus-v4l2-dkms: %s%s\\n' "\$Y" "\$1" "\$R" >&2
|
|
}
|
|
|
|
if [ "\$1" = "configure" ]; then
|
|
if ! command -v dkms >/dev/null 2>&1; then
|
|
warn "dkms not installed; module \$NAME/\$VERSION not registered."
|
|
warn "Install 'dkms' then run: dkms add \$NAME/\$VERSION && dkms autoinstall"
|
|
exit 0
|
|
fi
|
|
|
|
dkms add "\$NAME/\$VERSION" 2>/dev/null || true
|
|
|
|
# Don't let autoinstall failure mask the actual problem behind '|| true'.
|
|
# Run it, capture the result, then verify post-condition.
|
|
autoinstall_rc=0
|
|
dkms autoinstall "\$NAME/\$VERSION" || autoinstall_rc=\$?
|
|
|
|
# Verify the module actually built + installed for the running kernel.
|
|
status=\$(dkms status -m "\$NAME" -v "\$VERSION" -k "\$KERNELVER" 2>/dev/null || true)
|
|
if ! printf '%s\\n' "\$status" | grep -q -E 'installed|loaded'; then
|
|
warn ""
|
|
warn "DKMS build did NOT land for kernel \$KERNELVER."
|
|
warn " dkms status -m \$NAME -v \$VERSION -k \$KERNELVER:"
|
|
warn " \$(printf '%s' "\$status" | head -1)"
|
|
warn ""
|
|
warn "Most likely cause: kernel headers package is missing."
|
|
warn " Raspberry Pi OS / Pi 5: apt install linux-headers-rpi-2712"
|
|
warn " Debian generic: apt install linux-headers-\$KERNELVER"
|
|
warn ""
|
|
warn "After installing headers, finish the install with:"
|
|
warn " sudo dkms autoinstall \$NAME/\$VERSION"
|
|
warn " sudo modprobe daedalus_v4l2"
|
|
warn ""
|
|
warn "Until then daedalus_v4l2 will NOT be loadable and the"
|
|
warn "userspace daedalus-v4l2 daemon will have nothing to talk to."
|
|
fi
|
|
fi
|
|
|
|
#DEBHELPER#
|
|
EOF
|
|
chmod 755 "$ROOT/DEBIAN/postinst"
|
|
|
|
cat > "$ROOT/DEBIAN/prerm" <<EOF
|
|
#!/bin/sh
|
|
set -e
|
|
|
|
NAME=${MODULE_NAME}
|
|
VERSION=${PKGVER}
|
|
|
|
if [ "\$1" = "remove" ] && command -v dkms >/dev/null 2>&1; then
|
|
dkms remove "\$NAME/\$VERSION" --all || true
|
|
fi
|
|
|
|
#DEBHELPER#
|
|
EOF
|
|
chmod 755 "$ROOT/DEBIAN/prerm"
|
|
|
|
cat > "$ROOT/DEBIAN/control" <<EOF
|
|
Package: daedalus-v4l2-dkms
|
|
Version: ${PKGVER}-${PKGREL}
|
|
Section: kernel
|
|
Priority: optional
|
|
Architecture: all
|
|
Depends: dkms (>= 2.1.0.0)
|
|
Recommends: daedalus-v4l2, linux-headers-rpi-2712 | linux-headers-rpi | linux-headers-generic | linux-headers
|
|
Maintainer: Markus Fritsche <mfritsche@reauktion.de>
|
|
Homepage: https://git.reauktion.de/reauktion/daedalus-v4l2
|
|
Description: V4L2 stateless decoder shim kernel module (DKMS) — Pi 5 / CM5
|
|
Out-of-tree V4L2 m2m kernel module for the daedalus-v4l2 stack on
|
|
Raspberry Pi 5 / CM5. Registers /dev/videoNN (V4L2 stateless m2m
|
|
decoder), /dev/mediaNN (media controller with request API), and
|
|
/dev/daedalus-v4l2 (chardev bridge to the userspace daemon).
|
|
.
|
|
The actual decode happens in the userspace daemon shipped by the
|
|
daedalus-v4l2 package — this module is just the kernel-side V4L2
|
|
plumbing. Install both to actually serve VAAPI / V4L2 clients.
|
|
.
|
|
Built via DKMS against the running kernel's headers.
|
|
EOF
|
|
|
|
DEB_OUT="daedalus-v4l2-dkms_${PKGVER}-${PKGREL}_all.deb"
|
|
dpkg-deb --root-owner-group --build "$ROOT" "$HERE/$DEB_OUT"
|
|
echo "built: $HERE/$DEB_OUT"
|