Are my kernel headers broken, and how to fix them

Hey!

So, I was trying to build an external kernel module for my Jetson TX2, I am building it natively. When I hit that make, I started seeing lots of “incompatible pointer type” errors and the build failed.

At first, I somehow suspected my code, but at the end I’ve decided to build a “hello world kernel module” on it. You know, a module kprints hello etc. that can be read from dmesg. So, today it is failed to be built. I think I somehow broke my linux headers located at “/usr/src/linux-headers-4.9.140-tegra-ubuntu18.04_aarch64”.

The device is not fully mine, so I’m trying to avoid re-flashing it. I want to know if it is possible for me to check if they are broken or not, and if there is another way to fix it rather than re-flashing the board. Thanks for your advices, XO!

Edit: I tried to build the hello world module on another TX2 and it completely works! I am sure the headers are broken on the other one. I guess I need to fix it, need help on it.

Have a try to copy the header file and overrides it.

…/Linux_for_Tegra/kernel/kernel_headers.tbz2