Jetson RT-patch headers - EtherCAT use case not working

Hi,

After applying the RT-patch solution - see here, I was trying to install an EtherCAT package without success.

The package is IgH-EtherCAT (EtherLAB), and it works fine on a clear install of JetPack 5.1.1 using SDK manager without RT-patch.
There is an old issue which I was not able to extract any clear actions from it, but it deals with the same problem.

After several attempts, it came down to installing the RT headers.
My question is - how do I build the RT headers and get similar output to the ones extracted from “kernel_headers.tbz2” during “apply_binaries.sh” ?

Thank you

2 Likes

Hi,

another user had a similar issue last month as you:

We are still waiting for the developer team to give a solution on it.

1 Like

Can you share your methods on how to install the RT headers? Thanks.

In r3541, this issue can cause external kernel modules (such as the above-mentioned igh EtherCAT modules @shir1 @Gorgo90) not to install at /lib/modules/5.10.120-rt70-tegra/ in rt kernel built by the official method and hence modprobe it failed. Because there is no matching kernel header file in /usr/src/ (only linux-headers-5.10.120-tegra-ubuntu20.04_aarch64/ exists). The linux-headers-5.10.120-rt70-tegra-ubuntu20.04_aarch64/ should exist. If I include linux-headers-5.10.120-tegra-ubuntu20.04_aarch64/ to build my external modules, it will install at /lib/modules/5.10.120-tegra/ instead of /lib/modules/5.10.120-rt70-tegra/.

In r3274, the rt kernel is installed by apt install. It will install the rt kernel headers. I think this version doesn’t have this issue. This is just based on my experience and has not been verified in practice.

sudo apt install nvidia-l4t-rt-kernel nvidia-l4t-rt-kernel-headers

In my opinion, the developer team should propose a method to install the rt kernel headers of r35xx. Then everything will be fine.

I hope the developer team can higher the priority of this issue and resolve it as soon as possible. I think it will cause all external kernel modules to be installed failed under the r35xx rt kernel.

Maybe the rt kernel headers could be built by the make-kpkg command, like:

CONCURRENCY_LEVEL=`nproc` LOCALVERSION="-tegra" fakeroot make-kpkg --initrd --revision 1.0 --arch arm64 --cross_compile aarch64-buildroot-linux-gnu- kernel_image kernel_headers

Unfortunately, my attempt was unsuccessful on host computer. It may be that the cross_compile environment was not configured successfully, or there may be other reasons (L4T may don’t support this compiling manner).
Thank you.

Regarding my question - I was NOT able to install the RT headers. But it came down to this problem :)

@DaveYYY any update regarding this issue? How can we build the RT headers?

1 Like

Sorry, I didn’t understand what you meant before.

Sorry for the late update.

I think cross-compiling should do it, but make-kpkg is deprecated, and for building Debian kernel packages, you should use make deb-pkg.
Assuming you are building natively on Jetson:

make ARCH=arm64 LOCALVERSION=“-tegra” -j<x> deb-pkg

https://debian-handbook.info/browse/zh-TW/stable/sect.kernel-compilation.html
You would get a few .deb packages available for installation.

Or add a new target in nvbuild.sh:

	"${MAKE_BIN}" -C "${source_dir}" ARCH=arm64 \
		LOCALVERSION="-tegra" \
		CROSS_COMPILE="${CROSS_COMPILE_AARCH64}" \
		"${O_OPT[@]}" "${config_file}"

	"${MAKE_BIN}" -C "${source_dir}" ARCH=arm64 \
		LOCALVERSION="-tegra" \
		CROSS_COMPILE="${CROSS_COMPILE_AARCH64}" \
		"${O_OPT[@]}" -j"${NPROC}" \
		--output-sync=target Image

	"${MAKE_BIN}" -C "${source_dir}" ARCH=arm64 \
		LOCALVERSION="-tegra" \
		CROSS_COMPILE="${CROSS_COMPILE_AARCH64}" \
		"${O_OPT[@]}" -j"${NPROC}" \
		--output-sync=target dtbs

	"${MAKE_BIN}" -C "${source_dir}" ARCH=arm64 \
		LOCALVERSION="-tegra" \
		CROSS_COMPILE="${CROSS_COMPILE_AARCH64}" \
		"${O_OPT[@]}" -j"${NPROC}" \
		--output-sync=target modules

	"${MAKE_BIN}" -C "${source_dir}" ARCH=arm64 \
		LOCALVERSION="-tegra" \
		CROSS_COMPILE="${CROSS_COMPILE_AARCH64}" \
		"${O_OPT[@]}" -j"${NPROC}" \
		--output-sync=target headers

Install the kernel headers as you would do with kernel modules:

sudo make ARCH=arm64 O=$TEGRA_KERNEL_OUT modules_install INSTALL_HDR_PATH=/Linux_for_Tegra/rootfs/usr

Hi, I did not obtain the corresponding rt kernel headers file in Linux_for_Tegra/rootfs/usr using this command line.

My bad that I didn’t fully verify it.
I’m sure make deb-pkg is working, but the dtbs_install target in the Makefile is buggy, so you need to comment out some lines.
The the generated .deb file is good to go.

Hi, I truly encountered the dtbs_install error. But I don’t know which lines need to be commented out. Can you help me?

  LD [M]  virt/lib/irqbypass.ko
make KERNELRELEASE=5.10.120-rt70-tegra ARCH=arm64 	KBUILD_BUILD_VERSION=1 -f ./Makefile intdeb-pkg
sh ./scripts/package/builddeb
make[6]: *** No rule to make target 'debian/linux-image/usr/lib/linux-image-5.10.120-rt70-tegra/../../../../../../hardware/nvidia/platform/t23x/concord/kernel-dts/tegra234-p3701-0000-p3737-0000.dtb', needed by '__dtbs_install'.  Stop.
make[5]: *** [Makefile:1401: dtbs_install] Error 2
make[4]: *** [scripts/Makefile.package:87: intdeb-pkg] Error 2
make[3]: *** [Makefile:1582: intdeb-pkg] Error 2
make[2]: *** [debian/rules:13: binary-arch] Error 2
dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2
make[1]: *** [scripts/Makefile.package:77: deb-pkg] Error 2
make: *** [Makefile:1582: deb-pkg] Error 2

Hi,

Please refer to /Linux_for_Tegra/source/public/kernel/kernel-5.10/scripts/package/builddeb and take out the following script:

if is_enabled CONFIG_OF_EARLY_FLATTREE; then
       # Only some architectures with OF support have this target
       if [ -d "${srctree}/arch/$SRCARCH/boot/dts" ]; then
               $MAKE -f $srctree/Makefile INSTALL_DTBS_PATH="$tmpdir/usr/lib/$packagename" dtbs_install
       fi
fi

Then dtbs_install should not be triggered with make deb-pkg.

1 Like

I ran into the same issue with the kernel headers not being installed with RT but was able to get it installed and working by cross compiling on the host. Here are the steps I used

./bootstrap

CC=${CROSS_COMPILE_AARCH64}gcc \
LD=${CROSS_COMPILE_AARCH64}ld \
AR=${CROSS_COMPILE_AARCH64}ar \
CXX=${CROSS_COMPILE_AARCH64}g++ \
OBJCOPY=${CROSS_COMPILE_AARCH64}objcopy \
./configure --sysconfdir=/etc --host=arm-linux-gnueabi --enable-generic --with-linux-dir=${KERNEL_OUT} --enable-8139too=no

make -j \
    all modules  \
    SYSSRC=${L4T_DIR}/source/public/kernel/kernel-5.10 \
    SYSOUT=${KERNEL_OUT} \
    CC=${CROSS_COMPILE_AARCH64}gcc \
    LD=${CROSS_COMPILE_AARCH64}ld \
    AR=${CROSS_COMPILE_AARCH64}ar \
    CXX=${CROSS_COMPILE_AARCH64}g++ \
    OBJCOPY=${CROSS_COMPILE_AARCH64}objcopy \
    TARGET_ARCH=aarch64 \
    ARCH=arm64

sudo make install DESTDIR=${ROOTFS_DIR}

sudo make ARCH=arm64 O=${KERNEL_OUT} LOCALVERSION=-tegra INSTALL_MOD_PATH=${MODULES_OUT} modules_install

This was on L4T 35.3.1, I have not tested on the latest version.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.