Jetson Xavier NX and Laird ST60-2230C WiFi module

The “.config” file is one of the more interesting configuration files. You don’t really need a “.config” file there, but you do need that file somewhere that the config system searches for during the kernel build. The use in “/lib/modules/$(uname -r)/build” is just one case typically used on a desktop PC. Note that if you are cross-compiling that you cannot use this since anything in a host PC’s “/lib/modules” is for it and not for the Jetson.

Jetsons have another way to get this file. On a running Jetson note that you have file “/proc/config.gz”. For a correctly running Jetson, by default, this file is basically the same as the configuration you get from “make tegra_defconfig”. Note that the tegra_defconfig make target generates a “.config”. This (either from tegra_defconfig or “/proc/config.gz”) should be your initial configuration when building a Jetson kernel. More explanation follows on using these, but always write down the output of “uname -r” and save that with the config you use.

One can use “/proc/config.gz” by saving it to some outside location and using gunzip to decompress it. Let’s just say that you want to keep a safe copy of this, in which case you might create directory “~/Jetson/kernel-4.9/archive” (either on host PC or on the Jetson, or both). On the Jetson you could do this:

mkdir -p ~/Jetson/kernel-4.9/archive
mkdir -p ~/Jetson/kernel-4.9/archive/$(uname -r)`
# As an example, you now have directory "~/Jetson/kernel-4.9/archive/4.9.140-tegra/"
cd ~/Jetson/kernel-4.9/archive/$(uname -r)
cp /proc/config.gz .
gunzip config.gz
# This creates a nearly exact replica of the config file for your running Jetson:
mv config config-$(uname -r)
# Now edit config-4.9.140-tegra such that:
CONFIG_LOCALVERSION="-tegra"
# The above makes an exact match of the existing Jetson config, including
# module directory search location...there are times you would change this,
# but this is good most of the time on a Jetson.

Any time you then use your config-4.9.140-tegra file, but rename it to “.config”, you have a perfect starting config. On the Jetson itself you could put this in “/lib/modules/$(uname -r)/build/.config”, but I would not bother unless you’ve create a custom “.deb” package which rebuilds against this.

If you build directly in the “kernel-4.9” directory, then simply copy the “.config” here. Or you could “make tegra_defconfig”, followed by editing CONFIG_LOCALVERSION. So long as your Jetson runs a default configuration both of these have the same result.

If you put your temporary content into a separate location using the "make O=...some/location... ", then this location is where you want the “.config”. If you cross-compile, then you cannot use the “/lib/modules” content since this is for the wrong computer.

I’ll add this question for you: Are you compiling natively on the Jetson, or are you cross-compiling from the host PC? It sounds like you are building from the host PC. Can you show me your current exact compile command, and the directory you are building from?