Assuming you started with the “defconfig”, or some other known working configuration, and only added modules, then that approach of adding the modules you want via menuconfig is a good way to go. You still need to know that all of the modules in “/lib/modules/$(uname -r)/kernel” can load correctly. I assume they probably can if all of the modules in that directory (prior to adding yours) originally paired with that kernel which ran with the original modules. Mostly if the “/boot/Image” file itself has never changed, then you know this is correct. If you’ve ever changed the actual “/boot/Image” file, then those modules might differ. Most likely what you have is correct (I’m just trying to be thorough).
What currently shows up from the command “uname -r”? If answer names a kernel version with “-tegra” suffix, then all checks out for module placement. This command comes as an answer from the kernel itself, and so regardless of whether this is the old Image or a new Image, this decides where modules are searched for. When the modules are found, and when you see no load failures in “dmesg”, the implication is that everything “fits together” as it should. The process of flashing can of course do things you won’t expect, so it is important to check that after any flash. You might even run a simple checksum on the kernel which is present at “/boot/Image” and the kernel you think you added, e.g., “md5sum /boot/Image” is a fast checksum. Any Image you modified to flash with should have its checksum verified against the /boot file.
Note that the above checksum is for a comparison of the newly built kernel Image and what you’ve flashed. I generally prefer a direct file copy instead of flash, but that is a different topic. It is very likely that any kernel you’ve just built, even if it has the same exact options as the previous kernel, will have a different size and checksum. One reason is that files distributed by NVIDIA are likely stripped of debug metadata, but your build is not stripped the same way. Even when they are stripped, if it turns out there is a slightly different compiler version, then that too might produce different assembler, and thus a different size/checksum. However, if you think you’ve added your Image of a given size to flash content, and then flashed, you can expect that the flashed Jetson’s Image should not have a different size or checksum.
Two different Image files, even if one is stripped and the other is not, and even if built on different compilers using different assembler, depend on the configuration to decide if a module can load into it. Just beware as you work:
- Configurations on a given kernel source code release determine if modules are compatible.
- Matching checksums and file sizes looks at whether or not files are exact matches (useful for testing installations having what you expect).
Regarding the initrd, the only time this mandates an update is if the modules inside that initrd cannot load into the “/boot/Image”. Examples causing a change mandating update:
- The “
/boot/Image” kernel source version changed. Changing the actual kernel source version changes “uname -r” and also stops most modules from loading.
- The “
uname -r” changed (which can be same kernel source version, but new CONFIG_LOCALVERSION). Changing “uname -r” causes failure to find modules, and possibly failure to load even if found.
- A new module has been created, and that module is required to boot (examples being a module for the type of filesystem the kernel is accessing, or perhaps a RAID module if rootfs is a RAID array). If no boot dependency has changed, then you don’t need a new
initrd.
On the topic of flashing, if you’ve changed only modules, then you don’t need to flash. The existing kernel will answer where it is looking for modules via “uname -r”. If you’ve changed the “/boot/Image”, then you will normally find information for adding this via flash, but it still is not mandatory to flash. You can always ask for information on how to manually add files.
I’ll add that if you go to “/boot/extlinux/extlinux.conf”, then you can see your boot entries. Normally you have only one. You can duplicate that entry and give it new labels, and then it is possible to boot by either entry. Now let’s say you’ve added a new kernel, but you instead name your kernel file something like “/boot/Image-new”; then you can edit the file name in the second boot entry…you will still have your original in case something goes wrong, but you will have the ability at boot to pick the new or old entry.
If you make any boot entry a default, and it fails, then you simply figure out how to pick the alternate entry. Both entries can name their own initrd, their own device tree, their own Image file name, so on. I try to always keep one completely original entry. If what I modify works as I want, then I turn that entry into the first entry and make it default. For this to work with alternate boot schemes you probably need an alternate initrd as well, but often everything can be kept the same other than the Image file itself. You can always create multiple boot entries and test different initrds or device trees or Image files, so on.
Do beware that “apply_binaries.sh” is meant to run only once. This is what adds the NVIDIA content into an otherwise purely Ubuntu rootfs. Once that content is present you don’t need to add it again.
Also, it is useful to illustrate some of what goes on in flash using a manual command line flash (this won’t work for initrd flash, but it is a useful illustration). An example “ordinary” flash (this is for an AGX Orin, so it is definitely not applicable directly to your nano) which does not use an initrd is:
sudo ./flash.sh jetson-agx-orin-devkit mmcblk0p1
If you were to go to the “Linux_for_Tegra/” directory where you would flash from (and in which you’ve added the AGX Orin software), then you would see a number of files with the suffix “.conf”. The prefix would include “jetson-agx-orin-devkit”, and the full file name would be “jetson-agx-orin-devkit.conf”. Each .conf file, with the suffix removed, is a flash target. Your version of Orin Nano will have such a file.
Part of what is specified in the .conf file is any boot requirement. This includes the actual kernel Image. It is during flash that the final boot-dependent files are added into “Linux_for_Tegra/rootfs/”. Unless you’ve placed your kernel Image file in the correct place you can expect the default for that target to overwrite your “rootfs/boot/Image”. This also might include replacing the extlinux.conf file, the initrd, so on. Most of everything else in “rootfs/” is taken verbatim and any modification you make on that other content will live through any and every flash.