CasperVector / npreal2

Moxa Linux Real TTY Driver
2 stars 0 forks source link

build does not work in dkms #1

Closed kreutpet closed 10 months ago

kreutpet commented 10 months ago

HI ,

i have being using the version 5.0.0 for log time and used dkms to integrate the build of kernel updates for the modules.

my dkms.conf looks likes this and has being successfully used in version 5.0.0

PACKAGE_NAME="npreal2"
PACKAGE_VERSION="6.0.0"
BUILT_MODULE_NAME[0]="npreal2"
DEST_MODULE_LOCATION[0]="/kernel/drivers/char/"
AUTOINSTALL="yes"

when executing the dkms build command i do get errors.

dkms build --force npreal2/6.0.0
Sign command: /lib/modules/5.15.131-2-pve/build/scripts/sign-file
Signing key: /var/lib/dkms/mok.key
Public certificate (MOK): /var/lib/dkms/mok.pub

Building module:
Cleaning build area...
make -j4 KERNELRELEASE=5.15.131-2-pve -C /lib/modules/5.15.131-2-pve/build M=/var/lib/dkms/npreal2/6.0.0/build...
Error!  Build of npreal2.ko failed for: 5.15.131-2-pve (x86_64)
Make sure the name of the generated module is correct and at the root of the
build directory, or consult make.log in the build directory
/var/lib/dkms/npreal2/6.0.0/build for more information.

the make.log looks like this

make: Verzeichnis „/usr/src/linux-headers-5.15.131-2-pve“ wird betreten
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc (Debian 10.2.1-6) 10.2.1 20210110
  You are using:           gcc (Debian 12.2.0-14) 12.2.0
  MODPOST /var/lib/dkms/npreal2/6.0.0/build/Module.symvers
make: Verzeichnis „/usr/src/linux-headers-5.15.131-2-pve“ wird verlassen

i am using proxmox und they have recently upgrade the kernel 6.5 running dkms build -k 6.5.11-7-pve npreal2/6.0.0 show same error

it looks like the Makefile does not work with the different

CasperVector commented 10 months ago

Frankly I do not use npreal2 on systems other than CentOS 7 or Rocky Linux 8 which I deal with at work. However, I have just managed to compile the module on my personal Devuan Daedalus computer like this:

# apt-get install linux-headers-"$(uname -r)"
$ cd /tmp && git clone https://github.com/CasperVector/npreal2 && cd npreal2 && make
$ make DESTDIR=/tmp/npreal2/image install && cd /tmp/npreal2/image/var/npreal2/module
$ make -C /usr/src/linux-headers-"$(uname -r)" M=/tmp/npreal2/image/var/npreal2/module

So in summary the npreal2 kernel modules can be compiled without error on Linux kernel 3 (CentOS 7), 4 (Rocky Linux 8), 5 (your previous system) and 6 (my machine). However, I note that the latest version of npreal2 has different module source files for different Linux kernel versions: npreal2-linux3.c, npreal2-linux4.c, npreal2-linux5.c and npreal2-linux6.c. Did you make sure your kernel version matches that of your kernel module? Additionally, from your build log it seems that the compiler versions do not match, either.

kreutpet commented 10 months ago

ok i could reproduce the build in our description. I am currently runnin kernel 5.15.131-2 which is from proxmox 7 the proxmox 8 has updated to debian 12 and kernel 6.5

how can i manually compile the version for kernel 6.5 , while i booted in kernel 5? I had issue to boot the new kernel , which I fixed . let me check again . I still have the issue that the dkms build does not work with the makefile you provide. The original makefile of version 5.0.0 from moxa was working in dkms

thanks for your support

CasperVector commented 10 months ago

I am not familiar with DKMS, but I guess it may work if you already boot your system with Linux kernel 6.x, perhaps without the module in the first time. To deliberately build the module for kernel 6.x with kernel 5.x being currently running, you may try the commands in my previous comment with "$(uname -r)" replaced with the actual 6.x version string you intend to switch to, like 6.5.0-0.deb12.4-amd64 which I use now.

kreutpet commented 10 months ago

i took now the original 5.0.0 version of the driver and copied your source files into it . the orginal Makefile seems to works with dkms