Notes DKMS et construction paquet Debian netatop

DKMS

http://blog.valouille.fr/2013/05/compiler-un-paquet-debian-dkms-pour-un-module-noyau/

http://www.xkyle.com/building-linux-packages-for-kernel-drivers/

Netatop DKMS :

https://aur.archlinux.org/packages/netatop-dkms/

Error! Build offailed for:
Consult the make.log in the build directory

On met le code source dans/usr/src/netatop-0.7

On créer un fichier dkms.conf

PACKAGE_NAME="netatop" PACKAGE_VERSION="0.7" MAKE="make" CLEAN="make clean" BUILT_MODULE_NAME[0]="netatop" DEST_MODULE_LOCATION[0]="/updates" AUTOINSTALL="yes" REMAKE_INITRD=no
dkms add -m netatop -v 0.7

Creating symlink /var/lib/dkms/netatop/0.7/source ->
/usr/src/netatop-0.7
DKMS: add completed

dkms build -m netatop -v 0.7

Error! Build of netatop.ko failed for: 3.16.0-4-amd64 (x86_64)
Consult the make.log in the build directory

Si erreur on copie le Makefile, que l'on modifiera

cp -p Makefile Makefile.dkms vim Makefile.dkms
all: ./mkversion cd module; make cp -p ./module/netatop.ko . clean: cd module; make clean

On modifie me fichier dkms.conf pour que make prend le nouveau Makefile.dkms

PACKAGE_NAME="netatop" PACKAGE_VERSION="0.7" MAKE="make -f Makefile.dkms" CLEAN="make -f Makefile.dkms clean" BUILT_MODULE_NAME[0]="netatop" DEST_MODULE_LOCATION[0]="/updates" AUTOINSTALL="yes" REMAKE_INITRD=no

Puis

dkms build -m netatop -v 0.7

Construction d'un paquet Debian

dkms mkdeb -m netatop -v 0.7 cp -p /var/lib/dkms/netatop/0.7/deb/netatop-dkms_0.7_all.deb ~

Reset : On remet tous à neuf

make clean dkms remove -m netatop -v 0.7 -k all rm /var/lib/dkms/netatop -rf

On test

dpkg -i netatop-dkms_0.7_all.deb

DKMS: add completed.
First Installation: checking all kernels...
Building only for 3.16.0-4-amd64
Building for architecture amd64
Building initial module for 3.16.0-4-amd64
Error! Bad return status for module build on kernel: 3.16.0-4-amd64 (amd64)
Consult /var/lib/dkms/netatop/0.7/build/make.log for more information.

Voyons ça

DKMS make.log for netatop-0.7 for kernel 3.16.0-4-amd64 (amd64)
dimanche 8 mai 2016, 22:05:44 (UTC+0200)
./mkversion
make: execvp: ./mkversion: Permission non accordée
Makefile.dkms:2: recipe for target 'all' failed
make: *** [all] Error 127

La solution la plus simple, on ajoute un chmod +x dans le Makefile.dkms

all: chmod +x ./mkversion ./netatop.init ./mkversion cd module; make cp -p ./module/netatop.ko . clean: cd module; make clean

Notes

Status

dkms status -m netatop

Reset : On remet tous à neuf

make clean dkms remove -m netatop -v 0.7 -k all rm /var/lib/dkms/netatop -rf

Module linux

rmmod netatop
modprobe netatop
depmod -a

Exemple de conf

PACKAGE_NAME="e1000e" PACKAGE_VERSION="3.4.2.4" MAKE[0]="cd src/ && make KVERSION=$kernelver BUILD_KERNEL=$kernelver" CLEAN="cd src/ && make clean" BUILT_MODULE_NAME[0]="e1000e" BUILT_MODULE_LOCATION[0]="src/" DEST_MODULE_LOCATION[0]="/updates" REMAKE_INITRD="yes" AUTOINSTALL="yes"

Source : https://github.com/kelebek333/e1000e-dkms/blob/master/dkms.conf