This isn’t specific here at the start, but you might find this as a “good practice”:
- Keep your kernel source and the output of build in separate directories. This is what the “
O=...” location is…the separate output. Within the kernel source (which should be owned by root and not writable by anyone else, but is readable by all) run “
sudo make mrproper”, and then never use
sudo again during a build to ensure the original source does not get modified. If you follow this, then everyone will have valid source at all times when using the “
O=...somewhere...” alternate output location. You could have five different output locations being built by five different people, and each would be guaranteed valid source without one configuration interfering with another.
- There is an exception to the above, but you should probably avoid it unless you know why you are doing it: After the
mrproper one might config the actual source to the currently running system (usually for package based software looking for an official kernel source to configure against).
- When you use “
O=...somewhere...” to specify the output directory, you have to always use this on all commands (other than the previously mentioned “
sudo make mrproper”. This means any variant of “
make tegra_defconfig” or “
make menuconfig” or just “
make Image” or “
make modules_prepare”, so on, will always require “
- You should start with any general config, e.g., “
make O=...somewhere... tegra_defconfig”, and then use “
make O=...somewhere... menuconfig” (or other editors…I recommend “
nconfig” because it has symbol search). Note that these config editors might require “
sudo apt-get install libncurses5-dev” installed.
- Or use the currently running Jetson’s “
/proc/config.gz” and put it in the “
O=...somewhere...” location after using
gunzip on it and renaming to “
.config”. Then use the menu editor.
This script is a “helper” you can just read instead of executing, and is designed for native compile, not cross compile.
kern_setup.sh (2.3 KB)
If you cross compile, then you’d also need to edit this with the correct:
# Locations writable by your user, and not root owned:
Most people won’t build or use the
firmware target. If you are building modules and not the kernel, then don’t forget build target “
modules_prepare”. However, I recommend, as a sanity check, always building
Image (the integrated kernel) prior to building modules.
Also, don’t forget that your “
.config” in the “
TEGRA_KERNEL_OUT” location should also have the “
CONFIG_LOCALVERSION” set, most likely to:
…but there is more than one way to add that, so you might see different instructions which do the same thing, e.g., via an environment variable export instead of as part of the “