Try to install xpadneo on RPi 4

Hi,
I’m trying to install xpadneo on a RPi 4, since DKMS is supported now.
To do that rbp2-headers are needed, but if I try to install them with
“sudo apt-get install rbp2-headers-uname -r
I get the following error:
"E: Unable to locate package rbp2-headers-5.10.32-1-osmc
E: Couldn’t find any package by glob ‘rbp2-headers-5.10.32-1-osmc’
E: Couldn’t find any package by regex ‘rbp2-headers-5.10.32-1-osmc’ "

It is possible to install rbp2-headers-5.10.32-2-osmc with
“sudo apt-get install rbp2-headers-5.10.32-2-osmc”,
but if I try to install xpadneo I get
“Error! Your kernel headers for kernel 5.10.32-1-osmc cannot be found.
Please install the linux-headers-5.10.32-1-osmc package,
or use the --kernelsourcedir option to tell DKMS where it’s located”
referencing to the wrong linux-headers version.
Is this an error or do I need something else?

Greetings

Did you try installing linux-headers-5.10.32-1 -osmc like it suggested

Well, I thought “sudo apt-get install rbp2-headers-uname -r” would install linux-headers-5.10.32-1 -osmc. But I tried sudo apt-get install linux-headers-5.10.32-1-osmc
which gives the same error as
“sudo apt-get install rbp2-headers-uname -r ”.

E: Unable to locate package linux-headers-5.10.32-1-osmc
E: Couldn’t find any package by glob ‘linux-headers-5.10.32-1-osmc’
E: Couldn’t find any package by regex ‘linux-headers-5.10.32-1-osmc’

Have you done a sudo apt-get update recently?

I didn’t try until now. I used a fresh install from the recent release.
After trying sudo apt-get update the error remains the same, I also tried dist-upgrade, with no results.

You cna see what headers are available with

sudo apt search linux-headers-5.10*

rbp2-headers-5.10.32-2-osmc should be the right ones.

Hmm, sudo apt search linux-headers-5.10* returns nothing.
It is possible to install rbp2-headers-5.10.32-2-osmc, but trying to install xpadneo returns “Error! Your kernel headers for kernel 5.10.32-1 -osmc cannot be found.
Please install the linux-headers-5.10.32-1-osmc package”
So, do you think it is an error on the dkms side or maybe xpadneo?

FYI, the headers for the Pi4 are prefixed rbp464, rather than rbp2.

The latest kernel version for the Pi4 is 5.10.32-1.

If you want to create a driver, please be aware that it will need to be built inside the 64-bit OSMC toolchain, so getting DKMS to work might be challenging.

Indeed – at a minimum OP would want sudo apt-get install aarch64-toolchain-osmc to have a compatible build environment.

I’m pretty overwhelmed with this. Any help would be appreciated.

Tell us what you’ve done so far.

I’m struggling with the same task, trying to install xpadneo on OSMC running on rpi4. So far I was able to compose simple Makefile creating suitable chrooted environment, but I still can not get the whole process into success.

Here’s the Makefile:

So far I was able to get only the following out of it:

root@rpi4-osmc:/home/osmc# ./Makefile.xpadneo-osmc-aarch64 
cd xpadneo/hid-xpadneo && make ../VERSION
make[1]: Entering directory '/home/osmc/xpadneo/hid-xpadneo'
make[1]: '../VERSION' is up to date.
make[1]: Leaving directory '/home/osmc/xpadneo/hid-xpadneo'
sudo rm -rf /opt/osmc-tc/aarch64-toolchain-osmc/root/xpadneo && sudo cp -r xpadneo /opt/osmc-tc/aarch64-toolchain-osmc/root/
sudo chroot /opt/osmc-tc/aarch64-toolchain-osmc /bin/sh -c 'cd /root/xpadneo/hid-xpadneo && make modules'
make -C /usr/src/linux INSTALL_MOD_DIR="kernel/drivers/hid" LD=ld.bfd M=/root/xpadneo/hid-xpadneo/src VERSION="v0.9-93-gcf392a7" modules
make[1]: Entering directory '/usr/src/rbp464-source-5.10.78-2-osmc'
cp /root/xpadneo/hid-xpadneo/src/hid-xpadneo.c /root/xpadneo/hid-xpadneo/src/xpadneo.c
  CC [M]  /root/xpadneo/hid-xpadneo/src/xpadneo.o
  CC [M]  /root/xpadneo/hid-xpadneo/src/xpadneo/core.o
  CC [M]  /root/xpadneo/hid-xpadneo/src/xpadneo/consumer.o
  LD [M]  /root/xpadneo/hid-xpadneo/src/hid-xpadneo.o
WARNING: Symbol version dump "Module.symvers" is missing.
         Modules may not have dependencies or modversions.
  MODPOST /root/xpadneo/hid-xpadneo/src/Module.symvers
WARNING: modpost: Symbol info of vmlinux is missing. Unresolved symbol check will be entirely skipped.
  CC [M]  /root/xpadneo/hid-xpadneo/src/hid-xpadneo.mod.o
make[3]: *** No rule to make target 'scripts/module.lds', needed by '/root/xpadneo/hid-xpadneo/src/hid-xpadneo.ko'.  Stop.
make[2]: *** [scripts/Makefile.modpost:130: __modpost] Error 2
make[1]: *** [Makefile:1729: modules] Error 2
make[1]: Leaving directory '/usr/src/rbp464-source-5.10.78-2-osmc'
make: *** [Makefile:12: modules] Error 2
make: *** [Makefile.xpadneo-osmc-aarch64:38: hid-xpadneo.ko] Error 2

I’m leaving a link to xpadneo github issue just for the reference:

Appreciate any input. TIA!

Finally I was able to build the driver module.

Copying here from github just in case if anyone will found this first:

Ok, the following action fixed module.lds issue for me:

# cp /usr/src/rbp464-headers-5.10.78-2-osmc/scripts/module.lds /usr/src/rbp464-source-5.10.78-2-osmc/scripts/

Kernel source package does not seem to include the script in question:

osmc@rpi4-osmc:~$ dpkg -L rbp464-source-$(uname -r) | grep -- "module.lds$"
osmc@rpi4-osmc:~$ dpkg -L rbp464-headers-$(uname -r) | grep -- "module.lds$"
/usr/src/rbp464-headers-5.10.78-2-osmc/scripts/module.lds
osmc@rpi4-osmc:~$ 

Here’s how it goes for me now:

osmc@rpi4-osmc:~$ make -f Makefile.xpadneo-osmc-aarch64 
git clone https://github.com/atar-axis/xpadneo.git
Cloning into 'xpadneo'...
remote: Enumerating objects: 3909, done.
remote: Counting objects: 100% (399/399), done.
remote: Compressing objects: 100% (196/196), done.
remote: Total 3909 (delta 255), reused 266 (delta 193), pack-reused 3510
Receiving objects: 100% (3909/3909), 20.63 MiB | 1.85 MiB/s, done.
Resolving deltas: 100% (2471/2471), done.
sudo cp -p /usr/src/rbp464-headers-5.10.78-2-osmc/scripts/module.lds /usr/src/rbp464-source-5.10.78-2-osmc/scripts/module.lds
cd xpadneo/hid-xpadneo && make ../VERSION
make[1]: Entering directory '/home/osmc/xpadneo/hid-xpadneo'
git describe --tags --dirty >../VERSION
make[1]: Leaving directory '/home/osmc/xpadneo/hid-xpadneo'
sudo rm -rf /opt/osmc-tc/aarch64-toolchain-osmc/root/xpadneo && sudo cp -r xpadneo /opt/osmc-tc/aarch64-toolchain-osmc/root/
sudo chroot /opt/osmc-tc/aarch64-toolchain-osmc /bin/sh -c 'cd /root/xpadneo/hid-xpadneo && make modules'
make -C /usr/src/linux INSTALL_MOD_DIR="kernel/drivers/hid" LD=ld.bfd M=/root/xpadneo/hid-xpadneo/src VERSION="v0.9-93-gcf392a7" modules
make[1]: Entering directory '/usr/src/rbp464-source-5.10.78-2-osmc'
cp /root/xpadneo/hid-xpadneo/src/hid-xpadneo.c /root/xpadneo/hid-xpadneo/src/xpadneo.c
  CC [M]  /root/xpadneo/hid-xpadneo/src/xpadneo.o
  CC [M]  /root/xpadneo/hid-xpadneo/src/xpadneo/core.o
  CC [M]  /root/xpadneo/hid-xpadneo/src/xpadneo/consumer.o
  LD [M]  /root/xpadneo/hid-xpadneo/src/hid-xpadneo.o
WARNING: Symbol version dump "Module.symvers" is missing.
         Modules may not have dependencies or modversions.
  MODPOST /root/xpadneo/hid-xpadneo/src/Module.symvers
WARNING: modpost: Symbol info of vmlinux is missing. Unresolved symbol check will be entirely skipped.
  CC [M]  /root/xpadneo/hid-xpadneo/src/hid-xpadneo.mod.o
  LD [M]  /root/xpadneo/hid-xpadneo/src/hid-xpadneo.ko
make[1]: Leaving directory '/usr/src/rbp464-source-5.10.78-2-osmc'
sudo install -m644 -o osmc -g osmc /opt/osmc-tc/aarch64-toolchain-osmc/root/xpadneo/hid-xpadneo/src/hid-xpadneo.ko hid-xpadneo.ko

osmc@rpi4-osmc:~$ make -f Makefile.xpadneo-osmc-aarch64 
make: Nothing to be done for 'default'.

osmc@rpi4-osmc:~$ file hid-xpadneo.ko 
hid-xpadneo.ko: ELF 64-bit LSB relocatable, ARM aarch64, version 1 (SYSV), BuildID[sha1]=e17c454d47cd374b12f5946dc2ff6391b93d4749, not stripped

I have updated the makefile to include workaround for module.lds thing. Also, the following report seems to be relevant but for another distro (Ubuntu):

Can you PR a fix for this?

We have to package headers in a special way for ARM64 because make headers_install doesn’t give us everything we need.