Jetpack6.2 oot module install question

Hi, I’m building jetpack 6.2 sources in my own way follow the instruction. But it’s so wired that in-tree modules install location is lib/modules/5.15.148-prod-tegra/ but oot module install location is lib/modules/5.4.0-150-generic
Why they are two different location and when I install them to rootfs does it cause err?

Kernel configuration has an option “CONFIG_LOCALVERSION”. This determines the suffix of the output from the command “uname -r”. This is wired into the kernel itself, and determines module search location. If the “uname -r” is 5.15.148-prod-tegra, then it means CONFIG_LOCALVERSION was this during compile:
CONFIG_LOCALVERSION="-prod-tegra"

If the “uname -r” is “5.4.0-150-generic”, then it means this was specified during compile:
CONFIG_LOCALVERSION=-150-generic

There are some variations on this, but run “uname -r” and this will tell you what needed to be set for the out of tree (there are more requirements than this, explained below, but this is the first requirement). Modules are searched for at:
/lib/modules/$(uname -r)/kernel/

Searching in the correct place requires knowing the current “uname -r”. Being able to load that module is an additional set of requirements. If you build a module at a separate time, or out of tree, then the configuration used for building the module must equal the configuration of the integrated features which built the actual kernel Image. Integrated features are set with “=y” in configuration; module features are set with “=m” in configuration. Once the “=y” are set you should keep those the same at all times when building modules which are intended to load in that kernel. This is the content in the actual Image file. Modules compiled against that configuration, and in which the “uname -r” matches, will be both found and loadable.

You might find some related feature which appears to be part of the suffix of a mainline kernel, just ask if you run into that case.

Do note that Jetsons arrive with a default configuration, and that configuration was built against a “-tegra” suffix, but default configuration files do not show the “-tegra”. You have to set that yourself.

Normally the “uname -r” is the base kernel version, plus appended CONFIG_LOCALVERSION, but there might be something extra. For example, “5.15.148-prod-tegra” should be 5.15.148 source code, configured in some manner, and then CONFIG_LOCALVERSION is “-prod-tegra”. You can build test kernels configured the same way and not collide with the original if you alter the CONFIG_LOCALVERSION slightly and rename one of the kernels. For example, the Image file could be named Image-prod-tegra, and you could build the same kernel source version with a test change, but name it Image-test; this would not work until you also set CONFIG_LOCALVERSION to something new because the new kernel won’t be able to load the other modules (maybe you’d set it to “-test” and name the kernel Image-test).