df09c1c55d
481279c adds packaging/systemd/{daedalus-v4l2.service,modules-load} to
the upstream tree. This commit wires those into both the Arch
(PKGBUILD + .install) and Debian (build-deb.sh + postinst/prerm/postrm)
package layouts so that a fresh install of daedalus-v4l2 + daedalus-
v4l2-dkms on a Pi 5 leaves the kernel module loaded at next boot AND
the userspace broker daemon enabled — no manual modprobe / systemctl
enable dance needed.
arch/daedalus-v4l2:
* pkgver 0.1.0.r18.481279c, pkgrel reset to 1 (new upstream pin).
* Dropped 'systemd-libs' from depends — daemon doesn't link
libsystemd (no sd_notify); the .service unit is consumed by
systemd-the-init, no link-time dep required.
* package() now installs the .service to
/usr/lib/systemd/system/daedalus-v4l2.service and the modules-
load drop-in to /usr/lib/modules-load.d/daedalus-v4l2.conf.
* New .install file: post_install/post_upgrade run daemon-reload +
enable + systemd-modules-load + try-restart on upgrade; pre/post
remove tear down cleanly. No auto-start — operator decides.
arch/daedalus-v4l2-dkms:
* pkgver bump to 481279c, pkgrel reset to 1. Kernel module itself
is bit-identical to f0cd29a (commit only touches packaging/) but
bumping in lockstep keeps DKMS source-tree pkgver matched to the
userspace pkgver so /etc/modules-load.d points at a module that
actually exists.
debian/daedalus-v4l2:
* Same bump 481279c, PKGREL=1.
* build-deb.sh stages /lib/systemd/system/ + /usr/lib/modules-load.d/
and installs both files.
* Generates DEBIAN/postinst that runs daemon-reload, enables the
service, triggers systemd-modules-load, and conditionally starts
the service iff /dev/daedalus-v4l2 is already present (uses the
same ConditionPathExists= guard as the unit file so apt install
doesn't fail loudly on a host where dkms hasn't built yet).
* Generates DEBIAN/prerm (stop + disable on remove) and
DEBIAN/postrm (daemon-reload).
debian/daedalus-v4l2-dkms:
* Lockstep version bump, PKGREL=1. Postinst (loud-warn-on-missing-
headers) unchanged.
Verified the SHA via local rev-parse against ~/src/daedalus-v4l2 —
481279c is the "packaging/systemd: ship daedalus-v4l2.service +
modules-load drop-in" commit on main.
Co-Authored-By: Claude Opus 4.7 <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=481279c9bffd19e32c8f3299897e9b63fc5a24aa
|
|
PKGVER=0.1.0+r18+g481279c
|
|
PKGREL=1 # reset for new upstream pin (481279c — Phase 8.13 close)
|
|
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"
|