0

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?

2
  • You seem to have two source trees /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 set INSTALL_MOD_PATH to something else? Commented May 14 at 14:45
  • That's maybe because first I was trying to cross-compile mounting the Raspberry Pi filesystem via SSHFS, and then directly with the RPi SD plug to my PC. I don't if this last procedure is correct, since I'd had only cross-compile some C programs before. What I see is that it can't modify the folder /media/cce-team/writable/lib/modules/5.15.92-rt61-v8+, which doesn't exist. If I look the same route I get @host:~$ ls /media/cce-team/writable/lib/modules 5.15.98-rt62-raspi The kernel source I'm using is one I previously used to compile another kernel, not exactly the same the RPi has now. Commented May 15 at 18:07

0

You must log in to answer this question.

Browse other questions tagged .