Kernel Modules

Hi!

I’m working with Jetson board for some time and with all the helpful links from this forum i got close to the Linux sytem i need, but i getting problems with building a kernel module for a webcam. I have build this driver several times on different x86 ubuntu systems and it worked without any trouble.

What i did so far: Install and flash the latest L4T-19.3 to the board. Get the latest linux-3.18 kernel source via git from nv-tegra.nvidia.com. Use the .config file from the board to rebuild the kernel, basically to have the kernel-headers in place for building to external webcam driver. For testing i also flash the new kernel to the board, being happy to find:
root@tegra-ubuntu:/# uname -r
3.10.24-custom1-gf455cd4

I build the kernel directly on the board using:
export CONCURRENCY_LEVEL=grep -m1 cpu\ cores /proc/cpuinfo | cut -d : -f 2
fakeroot make-kpkg --initrd --append-to-version=-custom1 kernel_image kernel_headers
make EXTRAVERSION=-custom1 zImage
–> resulting into image and headers .deb packages i installed + a zImage i falshed

Then i started to build the webcam kernel modul, but i get the following error code:
/usr/src/linux-headers-3.10.24-custom1-gf455cd4/arch/arm/include/asm/memory.h:22:25: fatal error: mach/memory.h: No such file or directory

And yes, there are no files … are there any files missing in kernel package ? Or do i need to copy them by hand ? Or is the webcam drive code using any functions, that are not available on arm platforms?

Thanks for any feedback i’m stuck here.

First, you said you got kernel source 3.18…but both original R19.2 and current R19.3 use 3.10.24. You’ll need kernel source for the current running kernel, and you should configure it ahead of time based on the /proc/config.gz. The 3.10.24 kernel does have arch/arm/include/asm/memory.h, it seems like perhaps 3.18 does not. Get the kernel source here:

Be sure it is unpacked to /usr/src/kernels/uname -r/, and that the kernel was actually configured for ‘uname -r’.

Sorry, it’s the official Nvidia linux-3.10 source from http://nv-tegra.nvidia.com/
as you can see from uname -r.

The part missing is arch/arm/include/asm/mach/memory.h

http://nv-tegra.nvidia.com/ is probably the wrong kernel source for Jetson. Don’t use the git source, use the kernel source download at https://developer.nvidia.com/linux-tegra-rel-19, as the more recent kernel may not have changes needed for this Kepler board.

I also see that the path looks to be a headers-only install:
/usr/src/linux-headers-3.10.24-custom1-gf455cd4/arch/arm/include/asm/memory.h

So here is my suggestion…make sure 3.10.24 via the L4T R19.3 is installed at:
/usr/src/kernels/3.10.24/, and create these sym links:

cd /usr/src/kernels/
ln -s 3.10.24 3.10.24-custom1-gf455cd4
cd 3.10.24-custom1-gf455cd4
gunzip < /proc/config.gz > .config
make prepare
make modules_prepare
cd /usr/src/
mv linux-headers-3.10.24-custom1-gf455cd4 BACKUP-linux-headers-3.10.24-custom1-gf455cd4
ln -s kernels/3.10.24 3.10.24-custom1-gf455cd4 linux-headers-3.10.24-custom1-gf455cd4

What this would do is give you the headers from the exact kernel used in the distro using the exact configuration, place the source in a single location, and sym link to keep all the source users happy. Try compile again…the L4T R19.3 kernel does have the memory.h file you need.

It seems that the linux-3.10 repository from http://nv-tegra.nvidia.com/ , at the commit tagged with “tegra-l4t-r19.3” ( http://nv-tegra.nvidia.com/gitweb/?p=linux-3.10.git;a=tree;h=refs/heads/l4t/l4t-r19.3;hb=refs/heads/l4t/l4t-r19.3 ) , indeed has the right kernel source of Linux4Tegra 19.3 for Jetson, the same available at https://developer.nvidia.com/linux-tegra-rel-19 .