Update kernel_headers with customized kernel built

Hello all,

From the kernel build steps, kernel headers will be extracted to …/Linux_for_Tegra/rootfs/usr/src. However, I observed that kernel_headers not up-to-date as per the new customized kernel if I change.

Extracting the kernel headers to ../Linux_for_Tegra/rootfs/usr/src

From my understanding, following Driver Package Development Guideline, I may need to run sudo make modules_prepare to update the kernel_headers.tbz2

I have done the below commands, but no outcome as expected.

cd ${JETPACK}/Linux_for_Tegra/sources/kernel/kernel-4.9

sudo make mrproper

sudo make ARCH=arm64 O=${JETPACK}/Linux_for_Tegra/kernel/kernel_headers/linux-headers-4.9.140-tegra-ubuntu18.04_aarch64/kernel-4.9 CROSS_COMPILE=${CROSS_COMPILE} -j4 modules_prepare

Please share me your experience. Much appreciate for your support!

I don’t know your particular errors, but you might be running into this:
[url]https://devtalk.nvidia.com/default/topic/1047880/jetson-tx1/mount-network-folder-samba-cifs/post/5324395/#5324395[/url]

Hi Linuxdev,

I went through that topic, but it seems not the same.

Sorry that I forgot putting the errors. Here they are.

init/Kconfig:2052: symbol 'MODULES' redefines option 'modules' already defined by symbol 'MODULES'
../Linux_for_Tegra/sources/kernel/kernel-4.9/scripts/kconfig/Makefile:37: recipe for target 'silentoldconfig' failed
make[3]: *** [silentoldconfig] Error 1
../Linux_for_Tegra/sources/kernel/kernel-4.9/Makefile:565: recipe for target 'silentoldconfig' failed
make[2]: *** [silentoldconfig] Error 2
make[1]: *** No rule to make target 'include/config/auto.conf', needed by 'include/config/kernel.release'.  Stop.
make[1]: Leaving directory '../Linux_for_Tegra/kernel/kernel_headers/linux-headers-4.9.140-tegra-ubuntu18.04_aarch64/kernel-4.9'
Makefile:171: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2

You need to configure before you can compile. My suggestion is to take the existing kernel configuration (“/proc/config.gz”) running on a default Xavier and save a copy of this somewhere safe (you’ll want this in the future after you’ve modified the running system, and this file is a reflection of the running kernel…if you change the kernel config, then this changes).

Also, note that you are trying to compile from the headers directory…this is not full kernel source, although you are correct to do the modules_prepare. Before doing this:

  1. Copy "/proc/config.gz" somewhere permanently safe.
  2. Copy this to your build location. In the case of headers, then it is the top level of the headers.
  3. gunzip config.gz
  4. ``` mv config.gz .config ```
  5. Edit ".config" for item "CONFIG_LOCALVERSION".
    • If "uname -r" has a suffix of "-tegra", then this will be:
      CONFIG_LOCALVERSION="-tegra"
      
  6. Now do your modules_prepare.

Note that the various “_defconfig” build targets (e.g., “tegra_defconfig”) are similar, but there may be differences from your running system.