I'm trying to compile the EtherCAT IgH Master into a Raspberry Pi for a ROS2 application. It's currently running the following kernel:
@pi:~$ uname -r
5.15.98-rt62-raspi
I've got the RPi image from https://github.com/ros-realtime/ros-realtime-rpi4-image
All is working flawlessly, until I try to install the EtherCAT Master. If I follow the official installation steps and try to locally compile it, I got the following error:
@pi:~/ethercat$ make modules
make -C "/usr/src/linux-headers-5.15.98-rt62-raspi/" M="/home/ubuntu/ethercat" INSTALL_MOD_DIR="ethercat" modules
make[1]: Entering directory '/usr/src/linux-headers-5.15.98-rt62-raspi'
warning: the compiler differs from the one used to build the kernel
The kernel was built by: aarch64-linux-gnu-gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
You are using: gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
CC [M] /home/ubuntu/ethercat/examples/mini/mini.o
/bin/sh: 1: scripts/basic/fixdep: Exec format error
make[4]: *** [scripts/Makefile.build:297: /home/ubuntu/ethercat/examples/mini/mini.o] Error 126
make[4]: *** Deleting file '/home/ubuntu/ethercat/examples/mini/mini.o'
make[3]: *** [scripts/Makefile.build:560: /home/ubuntu/ethercat/examples/mini] Error 2
make[2]: *** [scripts/Makefile.build:560: /home/ubuntu/ethercat/examples] Error 2
make[1]: *** [Makefile:1907: /home/ubuntu/ethercat] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.15.98-rt62-raspi'
make: *** [Makefile:948: modules] Error 2
Whereas if I try to cross-compile, using the following guide https://embeng.dynv6.net/igh-ethercat-master-on-bbb-rpi, I can't make install_modules into the RPi:
@host:~/ethercat$ make modules_install install ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- export INSTALL_MOD_PATH=~/piroot
make -C "/home/cce-team/rpi_kernel/linux_5.15/linux/" M="/home/cce-team/ethercat" INSTALL_MOD_DIR="ethercat" modules_install
make[1]: Entering directory '/home/cce-team/rpi_kernel/linux_5.15/linux'
INSTALL /home/cce-team/piroot/lib/modules/5.15.92-rt61-v8+/ethercat/devices/ec_generic.ko
mkdir: cannot create directory ‘/home/cce-team/piroot/lib/modules/5.15.92-rt61-v8+’: Permission denied
make[2]: *** [scripts/Makefile.modinst:81: /home/cce-team/piroot/lib/modules/5.15.92-rt61-v8+/ethercat/devices/ec_generic.ko] Error 1
make[1]: *** [Makefile:1829: modules_install] Error 2
make[1]: Leaving directory '/home/cce-team/rpi_kernel/linux_5.15/linux'
make: *** [Makefile:952: modules_install] Error 2
I'am also currently seeing that the route /lib/modules/5.15.92-rt61-v8+ doesn't exists:
@host:/media/cce-team/writable/lib/modules$ ls
5.15.98-rt62-raspi
Maybe the Makefile is not looking for the correct modules? Could it be change?
/home/cce-team/piroot/lib/modules/
and/media/cce-team/writable/lib/modules
- the immediate error seems to be that the module is trying to install in the non-writable one? Did you mean to setINSTALL_MOD_PATH
to something else?