Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
618 changes: 618 additions & 0 deletions overlay/README.md

Large diffs are not rendered by default.

72 changes: 72 additions & 0 deletions overlay/build-package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-only
set -e

# Determine script location and project structure
SCRIPT_PATH="$(realpath "$0")"
SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"

# Check if we're running from overlay directory or video-driver root
if [[ "$SCRIPT_DIR" == */overlay ]]; then
# Running from overlay directory
OVERLAY_DIR="$SCRIPT_DIR"
VIDEO_DRIVER_ROOT="$(dirname "$OVERLAY_DIR")"
else
# Running from video-driver root directory
VIDEO_DRIVER_ROOT="$SCRIPT_DIR"
OVERLAY_DIR="$VIDEO_DRIVER_ROOT/overlay"
fi

BUILD_OUTPUT="$OVERLAY_DIR/build"

echo "Building DKMS package for video-driver..."
echo "Script location: $SCRIPT_DIR"
echo "Overlay directory: $OVERLAY_DIR"
echo "Video driver root: $VIDEO_DRIVER_ROOT"

# Create output directory
mkdir -p "$BUILD_OUTPUT"

# Execute build in video-driver root directory
cd "$VIDEO_DRIVER_ROOT"

echo "Preparing build environment..."

# Clean up any previous build artifacts first
echo "Cleaning up any previous build artifacts..."
rm -rf debian dkms.conf scripts 2>/dev/null || true

# Check if we need to copy files (avoid copying to same location)
if [ "$PWD" != "$OVERLAY_DIR" ]; then
# Temporarily copy overlay files to root directory (cleanup after build)
echo "Copying debian configuration files..."
cp -r "$OVERLAY_DIR/debian" ./
cp "$OVERLAY_DIR/dkms.conf" ./

# Copy scripts directory to root directory
echo "Copying build scripts..."
cp -r "$OVERLAY_DIR/scripts" ./
else
echo "Already in overlay directory, skipping file copy..."
fi

# Set script execution permissions
chmod +x scripts/*.sh
chmod +x debian/rules

echo "Building debian package..."
# Build debian package
dpkg-buildpackage -us -uc -b

echo "Moving build artifacts..."
# Move all generated package files and build artifacts to overlay/build
mv ../video-driver-dkms_* "$BUILD_OUTPUT/" 2>/dev/null || true

echo "Cleaning up temporary files..."
# Clean up temporary files
rm -rf debian dkms.conf scripts
rm -f ../video-driver-dkms_* 2>/dev/null || true

echo "Build completed successfully!"
echo "Package available in: $BUILD_OUTPUT"
ls -la "$BUILD_OUTPUT"
225 changes: 225 additions & 0 deletions overlay/cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-only

# Video Driver DKMS cleanup and uninstall script

set -e

SCRIPT_DIR="$(dirname "$0")"
PACKAGE_NAME="video-driver"
PACKAGE_VERSION="1.0.0"

show_help() {
cat << EOF
Video Driver DKMS Cleanup and Uninstall Tool

Usage: $0 [OPTIONS]

OPTIONS:
--clean-build Clean build artifacts (overlay/build directory)
--uninstall-dkms Uninstall DKMS package and modules
--clean-all Perform complete cleanup (build artifacts + DKMS uninstall)
--status Show current DKMS status
--help Show this help message

EXAMPLES:
$0 --clean-build # Clean build artifacts only
$0 --uninstall-dkms # Uninstall DKMS only
$0 --clean-all # Complete cleanup
$0 --status # Show status

EOF
}

# Clean build artifacts
clean_build() {
echo "Cleaning build artifacts..."

# Clean overlay/build directory
if [ -d "$SCRIPT_DIR/build" ]; then
echo "Removing $SCRIPT_DIR/build directory..."
rm -rf "$SCRIPT_DIR/build"
echo "Build artifacts cleanup completed"
else
echo "No build artifacts directory found"
fi

# Clean possible temporary files in root directory
cd "$(dirname "$SCRIPT_DIR")"
echo "Checking root directory temporary files..."

if [ -d "debian" ]; then
echo "Removing temporary debian/ directory..."
rm -rf debian
fi

if [ -f "dkms.conf" ]; then
echo "Removing temporary dkms.conf file..."
rm -f dkms.conf
fi

if [ -d "scripts" ]; then
echo "Removing temporary scripts/ directory..."
rm -rf scripts
fi

# Clean compilation artifacts
echo "Cleaning compilation artifacts..."
make clean 2>/dev/null || true
find . -name "*.ko" -delete 2>/dev/null || true
find . -name "*.mod" -delete 2>/dev/null || true
find . -name "*.mod.c" -delete 2>/dev/null || true
find . -name "*.mod.o" -delete 2>/dev/null || true
find . -name "*.o" -delete 2>/dev/null || true
find . -name ".*.cmd" -delete 2>/dev/null || true
rm -rf .tmp_versions 2>/dev/null || true
rm -f Module.symvers modules.order 2>/dev/null || true

echo "Build artifacts cleanup completed"
}

# Uninstall DKMS package
uninstall_dkms() {
echo "Uninstalling DKMS package and modules..."

# Check if DKMS package is installed
if dpkg -l | grep -q "video-driver-dkms"; then
echo "Found installed video-driver-dkms package, uninstalling..."

# Uninstall debian package
sudo dpkg -r video-driver-dkms || true

echo "Debian package uninstall completed"
else
echo "No installed video-driver-dkms package found"
fi

# Check DKMS status and cleanup
if command -v dkms >/dev/null 2>&1; then
echo "Checking DKMS status..."

# Show current status
sudo dkms status | grep "$PACKAGE_NAME" || echo "No DKMS modules found"

# Try to remove all versions of the module
for version in $(sudo dkms status | grep "$PACKAGE_NAME" | \
cut -d',' -f2 | cut -d':' -f1 | sort -u); do
echo "Removing DKMS module: $PACKAGE_NAME/$version"
sudo dkms remove "$PACKAGE_NAME/$version" --all || true
done

# Clean source directory
if [ -d "/usr/src/$PACKAGE_NAME-$PACKAGE_VERSION" ]; then
echo "Removing source directory: /usr/src/$PACKAGE_NAME-$PACKAGE_VERSION"
sudo rm -rf "/usr/src/$PACKAGE_NAME-$PACKAGE_VERSION"
fi

# Unload module (if loaded)
echo "Checking and unloading loaded modules..."
if lsmod | grep -q "^video "; then
echo "Unloading video module..."
sudo rmmod video || true
fi

# Update module dependencies
echo "Updating module dependencies..."
sudo depmod -a

echo "DKMS cleanup completed"
else
echo "DKMS not installed, skipping DKMS cleanup"
fi
}

# Show status
show_status() {
echo "=== Video Driver DKMS Status ==="
echo

# Check debian package status
echo "Debian package status:"
if dpkg -l | grep -q "video-driver-dkms"; then
dpkg -l | grep "video-driver-dkms"
else
echo " video-driver-dkms package not installed"
fi
echo

# Check DKMS status
if command -v dkms >/dev/null 2>&1; then
echo "DKMS status:"
sudo dkms status | grep "$PACKAGE_NAME" || echo " No DKMS modules found"
else
echo "DKMS not installed"
fi
echo

# Check module load status
echo "Module load status:"
if lsmod | grep -q "^video "; then
lsmod | grep "^video "
else
echo " video module not loaded"
fi
echo

# Check source directory
echo "Source directory:"
if [ -d "/usr/src/$PACKAGE_NAME-$PACKAGE_VERSION" ]; then
echo " /usr/src/$PACKAGE_NAME-$PACKAGE_VERSION exists"
ls -la "/usr/src/$PACKAGE_NAME-$PACKAGE_VERSION" | head -5
else
echo " /usr/src/$PACKAGE_NAME-$PACKAGE_VERSION does not exist"
fi
echo

# Check build artifacts
echo "Build artifacts:"
if [ -d "$SCRIPT_DIR/build" ]; then
echo " $SCRIPT_DIR/build exists"
ls -la "$SCRIPT_DIR/build"
else
echo " $SCRIPT_DIR/build does not exist"
fi
}

# Complete cleanup
clean_all() {
echo "Performing complete cleanup..."
uninstall_dkms
clean_build
echo "Complete cleanup finished"
}

# Main function
main() {
if [ $# -eq 0 ]; then
show_help
exit 1
fi

case "$1" in
--clean-build)
clean_build
;;
--uninstall-dkms)
uninstall_dkms
;;
--clean-all)
clean_all
;;
--status)
show_status
;;
--help)
show_help
;;
*)
echo "Unknown option: $1"
show_help
exit 1
;;
esac
}

main "$@"
15 changes: 15 additions & 0 deletions overlay/debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# SPDX-License-Identifier: GPL-2.0-only

video-driver (1.0.0-1) unstable; urgency=medium

* Initial DKMS package for MSM VIDC driver
* Support for multiple platforms via device tree detection
* Automatic platform configuration based on compatible string
* Cross-compilation support for ARM64 platforms
* Platforms supported: hamoa, lemans
* Auto-detection of platform from device tree compatible string
* Unified cross-compilation environment for all platforms
* Complete build isolation in overlay directory
* Fixed: Proper handling of multiple compatible strings in device tree

-- Renjiang Han <renjiang@qti.qualcomm.com> Tue, 28 Jan 2026 15:10:00 +0800
26 changes: 26 additions & 0 deletions overlay/debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# SPDX-License-Identifier: GPL-2.0-only

Source: video-driver
Section: kernel
Priority: optional
Maintainer: Renjiang Han <renjiang@qti.qualcomm.com>
Build-Depends: debhelper-compat (= 13), dkms
Standards-Version: 4.6.2
Homepage: https://github.com/qualcomm-linux/video-driver

Package: video-driver-dkms
Architecture: all
Depends: dkms (>= 2.6), kmod, ${misc:Depends}
Conflicts: qcom-iris-dkms
Description: DKMS package for MSM VIDC driver (out-of-tree)
This package installs source for the 'video' kernel module and builds
it via DKMS on the target machine using /lib/modules/${kernelver}/build.
.
DKMS packaging for MSM VIDC driver (out-of-tree).
Build occurs on install via /lib/modules/${kernelver}/build.
.
The driver supports multiple platforms and automatically detects the
platform from device tree compatible string to enable appropriate
configuration macros.
.
Supported platforms: hamoa, lemans.
24 changes: 24 additions & 0 deletions overlay/debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SPDX-License-Identifier: GPL-2.0-only

Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: video-driver
Source: https://github.com/qualcomm-linux/video-driver

Files: *
Copyright: Qualcomm Technologies, Inc. and/or its subsidiaries.
License: GPL-2.0-only
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>
.
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
Loading