Phase 8.1: kernel V4L2 device skeleton (out-of-tree module)

Out-of-tree Linux kernel module registering /dev/videoNN. Phase
8.1 scope: skeleton only — VIDIOC_QUERYCAP works, no codec
ioctls / no vb2_queue / no controls yet.

Real V4L2 plumbing throughout per "correctness before speed":
platform_device + v4l2_device + video_device, properly nested
with error paths and devm_kzalloc-managed lifetime. Per-cycle 9
discipline ports to kernel code: SPDX header, kernel coding
style (8-tab, static-by-default), kerneldoc on structs, no
shortcuts.

Files (~250 LOC total):
- kernel/Makefile — out-of-tree kbuild with checkpatch target
- kernel/daedalus_v4l2_main.c — module init/exit + probe/remove

Verification on hertz (Pi 5, 6.12.75+rpt-rpi-2712):
- Builds clean with -Wall -Wextra. No warnings.
- modprobe / rmmod round-trip clean. No dmesg taints beyond
  the expected "out-of-tree taint" line.
- v4l2-ctl --list-devices shows: "daedalus-fourier V3D7+NEON
  (platform:daedalus_v4l2): /dev/video0"
- VIDIOC_QUERYCAP returns driver/card/bus/caps as specified.
- v4l2-compliance: 44/48 passing. The 4 failures are exactly
  the format/buffer ioctls Phase 8.2 will implement
  (ENUM_FMT, G_FMT, Scaling, REQBUFS) — not skeleton bugs,
  legitimately-absent features.

Documentation: docs/phase_8_1_closure.md captures full
verification output + Phase 8.2 plan.

Phase 8.1 acceptance criteria met:
- ✓ /dev/videoNN appears via v4l2-ctl --list-devices
- ✓ VIDIOC_QUERYCAP responds with sensible values
- ✓ rmmod is clean (no kref leaks)
- ✓ v4l2-compliance passes except for explicit Phase 8.2 work

Next: Phase 8.2 chardev bridge for kernel ↔ daemon IPC.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-18 15:03:22 +00:00
parent 89f56e4b49
commit 9415b7e0f7
3 changed files with 390 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
# SPDX-License-Identifier: GPL-2.0-or-later
#
# daedalus-v4l2 — out-of-tree kbuild for the Linux kernel V4L2
# stateless decoder shim. Forwards bitstream + controls to the
# daedalus-v4l2 userspace daemon via a chardev bridge.
#
# Build against the running kernel:
# make
# Or against a specific kernel:
# make KERNELDIR=/path/to/kernel/source
# Install (requires root):
# sudo make install
# Clean:
# make clean
obj-m := daedalus_v4l2.o
daedalus_v4l2-objs := daedalus_v4l2_main.o
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
# Be strict: warnings are errors, kernel coding style enforced.
ccflags-y := -Wall -Wextra -Wno-unused-parameter
all:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
install: all
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
depmod -a
clean:
$(MAKE) -C $(KERNELDIR) M=$(PWD) clean
# Run kernel checkpatch.pl against the source. Picks up the
# kernel-tree-installed checkpatch via the running kernel's
# build directory if present.
checkpatch:
@if [ -x $(KERNELDIR)/scripts/checkpatch.pl ]; then \
$(KERNELDIR)/scripts/checkpatch.pl --no-tree --strict -f *.c; \
else \
echo "checkpatch.pl not available at $(KERNELDIR)/scripts/"; \
exit 1; \
fi
.PHONY: all install clean checkpatch