The base version of “uname -r”, e.g., “3.10.67”, is from the kernel source.
The suffix version of “uname -r”, e.g., “-g458d45c”, is from the .config file’s CONFIG_LOCALVERSION (usually set up in “make menuconfig”, but can be edited directly).
Base version of kernel plus CONFIG_LOCALVERSION give “uname -r”, e.g., “3.10.67-g458d45c”. Modules are searched for in “/lib/modues/${uname -r}”.
Assuming you want to output kernel builds to “/home/me/build”, and to output module installs (meaning what would end up copied over to Jetson, not intermediate build files) to “/home/me/modules”, you might do something like this:
mkdir /home/me/build
mkdir /home/me/modules
export TEGRA_KERNEL_OUT=/home/me/build
export TEGRA_MODULES_OUT=/home/me/modules
If your compiler is linaro-5.2-2015.11 (one of several compilers I have), and installed to /usr/local (which is where I put pre-built non-rpm-packaged binary installs), you would set up more environment like this:
export CROSS_COMPILE=/usr/local/gcc-linaro-5.2-2015.11-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
export CROSS32CC=/usr/local/gcc-linaro-5.2-2015.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc
export ARCH=arm64
You would then build something like this (note that “O=” can be used in any step…mixing this up can result in confusion)…note that not all steps are always needed:
cd ...whereever your L4T kernel source is...
make mrproper
make O=$TEGRA_KERNEL_OUT mrproper
make O=$TEGRA_KERNEL_OUT tegra21_defconfig
make O=$TEGRA_KERNEL_OUT menuconfig
...adjust to your settings, e.g., the LOCAL version...
make O=$TEGRA_KERNEL_OUT zImage
make O=$TEGRA_KERNEL_OUT dtbs
make O=$TEGRA_KERNEL_OUT modules
make O=$TEGRA_KERNEL_OUT modules_install INSTALL_MOD_PATH=$TEGRA_MODULES_OUT
You’ll get a lot of files in “$TEGRA_KERNEL_OUT”, some of which you’ll use directly. Within “$TEGRA_MODULES_OUT” is where it gets interesting and where you can test if your CONFIG_LOCALVERSION is what you expect. There will be a subdirectory “lib/”, and within that “firmware/” and “modules/”. Firmware is not dependent upon “uname -r”, so if the firmware was already on Jetson, that subdirectory can be ignored. The “modules/” subdirectory though must follow the “uname -r” scheme mentioned above. If you have added suffix “-g458d45c”, then there should exist “${TEGRA_MODULES_OUT}/lib/modules/${uname -r}/”. Installing the kernel from “${TEGRA_KERNEL_OUT}” implies that the “${TEGRA_MODULES_OUT}” “uname -r” will be used for finding modules.
Note that although various compilers and kernel source features will result in different errors or warnings, some steps are independent and those errors or warnings might be ignorable. You will always want to start with mrproper for pristine setup, and put your “.config” manually or via tegra21_defconfig and menuconfig; after this if base configuration is the same you could go straight to modules and modules_install…make zImage could crash and burn but if you are not putting in the base kernel, and only working with modules, then you probably don’t care that zImage fails. Assuming zImage did fail, then it might be due to changes in compilers which previously did not believe the issue was an error…or it might be there is some change in configuration which means something which was not previously compiled for lack of need is now getting tested. It requires knowing about the specific configuration and compiler combination.
Just to emphasize, if you use “O=${TEGRA_KERNEL_OUT}”, then this is where the “.config” is which you care about. If you run mrproper and use “O=” anywhere, then your mrproper and other commands must also have the “O=”.