Xavier - Building the Kernel from Source

hi,i have referenced the <NVIDIA Jetson Xavier - Building the Kernel from Source>(
NVIDIA Xavier - Kernel)to build the kernel.but there are some questions.When I used the JetPack to build the kernel,In the folder [Linux_for_Tegra/rootfs/lib/modules/4.9.108-tegra],the linked file"build"links to “/usr/src/linux-headers-4.9.108-tegra/kernel-4.9”,but when i used the kernel sources to build,the link file"build" links to “/home/ubuntu/work/jetson_agx/public_sources/kernel/kernel-4.9/build/” ,i think it is not right,but i don’t know why?

Keep in mind that anything on the host PC is a copy of a different filesystem intended to exist on the Xavier. On the PC this is a foreign filesystem, on the Xavier the same thing is native.

The usual location for kernel modules is in “/lib/modules/$(uname -r)/”. The headers (which match the kernel source used to build the kernel and modules, and preferably configured to that same config) can exist in different places, especially if there is more than one kernel version installed. Any time someone builds a kernel or modules natively “uname -r” is automatically taken into account and headers are searched for at “/lib/modules/$(uname -r)/”. /lib/modules/$(uname -r)/build" is always an absolute path symbolic link on that native platform since it allows customization, but will not appear to point to the correct location if not actually starting in “/lib” (and on the PC doing the flash you can’t put this in “/lib”…you’d overwrite the PC with the other incorrect filesystem).

When “build” is linked it is an absolute path, and if that path is put in some other directory (such as on a host PC temp location), then the absolute path is wrong for that PC, but would be right if flashed to the other system. During a “make modules_install” the “/lib/modules/$(uname -r)/” is chosen. For a cross compile you have to name a module directory which isn’t the host PC’s modules. When copied over to the Xavier the “build” symbolic link becomes correct.

If you are not just copying the link from PC to Xavier, and you are cross compiling modules out of tree on the PC, then the compiler needs the actual module and/or source code of the kernel. The sym link gets rewritten to point at actual source on the PC, and that is what source_sync.sh produces. This is correct for cross compiles, but would be incorrect for native compiles. If cross compiling, then the link points at the real source on the host, but if preserving for copying over to the other system, then the link must point at where the header package is expected on the other system.

This note on fixing out-of-tree headers for native build on Xavier might be considered a similar explanation if you were to also take into account a non-native build layout on the PC (ignore the patch in that URL, just look at how headers are placed):
[url]R32.1 TX2 how can I build extra module in the tegra device - Jetson TX2 - NVIDIA Developer Forums