This is incorrect:
The above is also why you see:
FYI, unlike many software projects, you should not just use “make
” without arguments in a kernel compile. The error is an attempt to deal with a lack of configuration. Normally the build
file in question is a symbolic link to a location which has configuration, but it doesn’t quite work this way with Jetsons.
To start with you want pristine kernel source. If the kernel source itself has been configured (hopefully it is not), then you can revert to pristine with:
make mrproper
Regarding this last point, you will find many instructions with a kernel build having the “O=/some/where
” option in the command line. This is for create a separate location for any configuration or editing such that the original source is left pristine. This is a very good idea to use.
As an example, if you go to where the source code itself is, you can do this:
export TOP=$pwd
If you happen to have this at “~/some/source
”, then “echo $TOP
” would reply with that path.
If you then create an empty directory, e.g. “~/kernel
”, the following would make sure both the source and that location are pristine:
cd $TOP
make mrproper
make O=~/kernel mrproper
It might be easier to export that output location via an environment variable. An optional name to use (and is in documentation) is TEGRA_KERNEL_OUT
. Then you could do this:
cd ~/kernel
export TEGRA_KERNEL_OUT=$pwd
echo $TEGRA_KERNEL_OUT
cd $TOP
make O=$TEGRA_KERNEL_OUT mrproper
Once you have pristine source code you should never actually make changes there. The default configuration to start with in JetPack 5.x/L4T R35.x is “tegra_defconfig
”. I will assume you have set up “TOP
” and “TEGRA_KERNEL_OUT
”:
cd $TOP
make O=$TEGRA_KERNEL_OUT tegra_defconfig
If you are only building modules and intend to keep the original kernel Image
, then you would also need to keep the CONFIG_LOCALVERSION
as “-tegra
”. An example for editing the existing tegra_defconfig
to set up CONFIG_LOCALVERSION
would be via either the menuconfig
target or the nconfig
target (I prefer nconfig
because it has symbol search; otherwise it is exactly the same thing as menuconfig
; CONFIG_LOCALVERSION
is one symbol):
cd $TOP
make O=$TEGRA_DEFCONFIG nconfig
If you are changing a non-module feature, then you probably need a new CONFIG_LOCALVERSION
and complete install of modules, kernel Image
, and any initrd.
Once you have the base configuration it must be propagated. One such method:
cd $TOP
# ...do config stuff...
make O=$TEGRA_KERNEL_OUT modules_prepare
In the case of the base kernel build this is done for you:
cd $TOP
# ...do config stuff....
make O=$TEGRA_KERNEL_OUT Image
In the case of building modules without building Image
:
cd $TOP
# ...do config stuff....
make O=$TEGRA_KERNEL_OUT modules_prepare
make O=$TEGRA_KERNEL_OUT modules
In the case of building both Image
and modules:
cd $TOP
# ...do config stuff....
make O=$TEGRA_KERNEL_OUT Image
# Note that the Image target would have done the equivalent of modules_prepare.
make O=$TEGRA_KERNEL_OUT modules
It is quite unlikely you need to build the device tree (dtbs
target).
It is a really good idea to not overwrite your existing modules or kernel Image
. It is usually a "bad idea"™ to just install the Image
and modules while overwriting the originals and not saving them. For modules you can install them to an empty location and then later copy them over:
# Assuming you've already built modules.
mkdir ~/modules_out
cd ~/modules_out
export TEGRA_MODULES_OUT=$pwd
cd $TOP
make O=$TEGRA_KERNEL_OUT INSTALL_MOD_PATH=$TEGRA_MODULES_OUT modules_install
After that you would find a lot of content in “$TEGRA_MODULES_OUT
” mirroring where the files would go if you were to manually copy them. I will emphasize that you would only be copying new or changed modules and not everything.
When you just run “make
” you are building everything. When you don’t configure first, then you have a lot of configuration which is just plain wrong or conflicting. For example, you’re probably building for an old IBM mainframe, specialized hardware only found in an Internet backbone router, old style sound cards…everything. And hardly any of it would be relevant or correct for the Jetson.
The official docs are for cross compile, and much of this is the same on native compile. Find your L4T release via “head -n 1 /etc/nv_tegra_release
”, and then go to the proper docs and source here:
https://developer.nvidia.com/linux-tegra
Just beware that the installation steps in the docs are about installing the content for flash and not for use with an existing installation. You can always ask more questions.