mirror of
				https://github.com/krislamo/kernmod.git
				synced 2025-10-31 10:48:35 +00:00 
			
		
		
		
	Build and install DKMS Debian package
This commit is contained in:
		
							
								
								
									
										33
									
								
								build.sh
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										33
									
								
								build.sh
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							| @@ -1,28 +1,29 @@ | |||||||
| #!/bin/bash | #!/bin/bash | ||||||
|  |  | ||||||
|  | PACKAGE="helloworld" | ||||||
| VERSION="0.1" | VERSION="0.1" | ||||||
|  | REVISION="1" | ||||||
|  | BUILDDIR="$(mktemp -d)/${PACKAGE}_$VERSION-$REVISION" | ||||||
|  |  | ||||||
| # Install build prerequisites | # Place sources and build package | ||||||
|  | mkdir -p "$BUILDDIR/usr/src/${PACKAGE}-$VERSION" | ||||||
|  | mkdir -p "$BUILDDIR/etc" | ||||||
|  | mkdir -p "$BUILDDIR/DEBIAN" | ||||||
|  | cp -r /vagrant/src/usr/src/* "$BUILDDIR/usr/src/${PACKAGE}-$VERSION" | ||||||
|  | cp -r /vagrant/src/etc/* "$BUILDDIR/etc" | ||||||
|  | cp -r /vagrant/src/DEBIAN/* "$BUILDDIR/DEBIAN" | ||||||
|  | cd "$BUILDDIR/.." | ||||||
|  | dpkg-deb --build "${PACKAGE}_$VERSION-$REVISION" | ||||||
|  |  | ||||||
|  | # Install package | ||||||
| export DEBIAN_FRONTEND=noninteractive | export DEBIAN_FRONTEND=noninteractive | ||||||
| apt-get update | apt-get update | ||||||
| apt-get install -y dkms build-essential linux-headers-$(uname -r) | apt-get install -y linux-headers-$(uname -r) | ||||||
|  | apt-get install -y "./${PACKAGE}_$VERSION-$REVISION.deb" | ||||||
| # Place source and configuration files on the system |  | ||||||
| cd /vagrant |  | ||||||
| mkdir /usr/src/helloworld-$VERSION |  | ||||||
| cp Makefile /usr/src/helloworld-$VERSION/Makefile |  | ||||||
| cp helloworld.c /usr/src/helloworld-$VERSION/helloworld.c |  | ||||||
| cp dkms.conf /usr/src/helloworld-$VERSION/dkms.conf |  | ||||||
| cp helloworld.conf /etc/modules-load.d/helloworld.conf |  | ||||||
|  |  | ||||||
| # Build and install kernel module with DKMS |  | ||||||
| dkms add -m helloworld -v $VERSION |  | ||||||
| dkms build -m helloworld -v $VERSION |  | ||||||
| dkms install -m helloworld -v $VERSION |  | ||||||
|  |  | ||||||
| # Load module and show details about it | # Load module and show details about it | ||||||
| modprobe helloworld |  | ||||||
| modinfo helloworld | modinfo helloworld | ||||||
| cat /proc/modules | grep helloworld | cat /proc/modules | grep helloworld | ||||||
| rmmod helloworld | rmmod helloworld | ||||||
|  | modprobe helloworld | ||||||
| cat /var/log/messages | grep helloworld | cat /var/log/messages | grep helloworld | ||||||
|   | |||||||
							
								
								
									
										8
									
								
								src/DEBIAN/control
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								src/DEBIAN/control
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | |||||||
|  | Package: helloworld | ||||||
|  | Version: 0.1-1 | ||||||
|  | Section: base | ||||||
|  | Priority: optional | ||||||
|  | Architecture: amd64 | ||||||
|  | Depends: dkms | ||||||
|  | Maintainer: Kris Lamoureux <kris@lamoureux.io> | ||||||
|  | Description: hello, world | ||||||
							
								
								
									
										5
									
								
								src/DEBIAN/postinst
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										5
									
								
								src/DEBIAN/postinst
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,5 @@ | |||||||
|  | VERSION="0.1" | ||||||
|  | dkms add -m helloworld -v $VERSION | ||||||
|  | dkms build -m helloworld -v $VERSION | ||||||
|  | dkms install -m helloworld -v $VERSION | ||||||
|  | modprobe helloworld | ||||||
		Reference in New Issue
	
	Block a user