mirror of
https://github.com/krislamo/kernmod.git
synced 2024-11-10 00:30:36 +00:00
Build and install module with DKMS
This commit is contained in:
parent
00e921ec10
commit
d00996062e
23
build.sh
23
build.sh
@ -1,13 +1,28 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
VERSION="0.1"
|
||||||
|
|
||||||
|
# Install build prerequisites
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install build-essential linux-headers-$(uname -r) -y
|
apt-get install -y dkms build-essential linux-headers-$(uname -r)
|
||||||
|
|
||||||
|
# Place source and configuration files on the system
|
||||||
cd /vagrant
|
cd /vagrant
|
||||||
make
|
mkdir /usr/src/helloworld-$VERSION
|
||||||
modinfo helloworld.ko
|
cp Makefile /usr/src/helloworld-$VERSION/Makefile
|
||||||
insmod helloworld.ko
|
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
|
||||||
|
modprobe helloworld
|
||||||
|
modinfo helloworld
|
||||||
cat /proc/modules | grep helloworld
|
cat /proc/modules | grep helloworld
|
||||||
rmmod helloworld
|
rmmod helloworld
|
||||||
cat /var/log/messages | grep helloworld
|
cat /var/log/messages | grep helloworld
|
||||||
|
5
dkms.conf
Normal file
5
dkms.conf
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
PACKAGE_NAME="helloworld"
|
||||||
|
PACKAGE_VERSION="0.1"
|
||||||
|
BUILT_MODULE_NAME[0]="helloworld"
|
||||||
|
DEST_MODULE_LOCATION[0]="/kernel/drivers/helloworld/"
|
||||||
|
AUTOINSTALL="yes"
|
3
helloworld.conf
Normal file
3
helloworld.conf
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# A kernel module that should be loaded at boot time
|
||||||
|
# /etc/modules-load.d/helloworld.conf
|
||||||
|
helloworld
|
Loading…
Reference in New Issue
Block a user