Unable to boot the customised kernel image

Hi,
I have built a customized kernel image to boot on the Jetson Orin Nano developer kit. On rebooting the device, there seems to be an issue with the mount. I have attached an image for your reference.

I will run you through the steps I have followed:
First, I started off with installing Jetpack 6 form the Nvidia SDK manager to get the default kernel image.
Next, I downloaded the kernel source code v36.3.
Post which, I made the changes in the menuconfig and then built the kernel.
Then I replaced the old kernel image with custom image.
Could you tell me where i am going wrong.

  • How did you install the new kernel Image?
  • Did you first configure the kernel with something like the make target defconfig?
  • Did you set CONFIG_LOCALVERSION to “-tegra”? If not, did you also build and install all modules?
  • Is this an NVIDIA developer’s kit, or does it involve a third party carrier board? My assumption is that this is flashed to the SD card of a dev kit. Any other external media, or a module which uses eMMC, changes procedures.
  • Note: You should try to get a full serial console boot log. Some models require you to have your own serial USB UART going to header pins 8 and 10 (plus ground), and some models have a USB header for that purpose (I’m not sure what the Orin Nano dev kit uses).

Hi,
Thank you for the reply.

  • I copied the newly built kernel image from the kernel source directory into the boot directory of the kernel where the original kernel image is present. After which I made changes in the extlinux.conf for my customized kernel image to boot as the primary kernel and the original as backup.
  • Yes, I did configure the kernel with above-mentioned command first before running make menuconfig.
  • I didn’t set the CONFIG_LOCALVERSION. I did run build and install command.
  • As I have mentioned already, I am using Nvidia’s Jetson Orin Nano developer kit. We are using nvme.

Although now the booting issue has been solved. I set the CONFIG_LOCALVERSION to -demo after following a solution you had posted on another ticket:

Compile & install customized Kernel directly on Orin Developer Kit - #2 by daniel.hopf

But now I am facing another issue. After booting the dev kit with the new customized image, I ran this command:

uname -r

The output is as follows:

5.15.136-demo

So now I know it is pointing to the customized kernel image.
Post which, I ran this command to load the gadgetfs module:

sudo modprobe gadgetfs

Then, I ran this command:

lsmod

Output:

Next, I tried to mount gadgetfs using this command:

sudo mkdir /dev/gadget
sudo mount -t gadgetfs gadgetfs /dev/gadget

Output:

mount: /dev/gadget: unknown filesystem type ‘gadgetfs’.

I am a newbie and I do not know where I am going wrong, so could you please help me out on how to proceed further.

Boot chains differ when using an NVMe. On a system with a BIOS this wouldn’t matter so much, but Jetsons do not have a BIOS. Jetsons do still have that functionality, but it is in software (for eMMC models it tends to be in eMMC partitions; for SD card models, this would likely be in QSPI memory on the module). That “equivalent to BIOS” software is not as flexible, although once it gets to the UEFI stage which is in JP6/L4T R36.x, more uniformity is possible. However, arrangement of things like drivers for the NVMe might or might not still be an issue (somehow the kernel must be loaded, and the boot configuration to pass to the kernel; with multiple devices and possibly transferring control from one device to the next things might not work the way it is expected for an actual BIOS). More on this topic further down.

You did not mention installing all modules, so you might mention if you installed all of the modules.

I should explain a bit about initial ramdisks (an initrd; the INITRD key/value pair in extlinux.conf). Traditional older systems always read the kernel from some “/boot” partition using a filesystem type which was understood by both the bootloader and the kernel. How could you load a kernel on a filesystem if the bootloader itself does not have the knowledge of the filesystem to decode the bytes? However, one might have a working “/boot”, and the rest of the “/” (rootfs) filesystem could be on some filesystem type that the kernel itself understands, and since the bootloader has more or less ended its own life by overwriting itself with the Linux kernel, it no longer matters that the bootloader cannot read this new “mystery” filesystem type. The kernel can do that.

However, kernels did not always have dynamically loadable modules for drivers (trivia: back in my days with the dinosaurs I was using kernel 1.0.13(?memory hazy?), which was monolithic; a short time later the experimental 1.1.59, or something like that, was introduced, and it was the first kernel with loadable modules). This means that the bootloader knew nothing about loadable modules, nor did the bootloader have any design to help this. At this time any driver for the rootfs itself had to be integrated into the kernel and not in the form of a module. “Why would this be mandatory” would be a good question; the reason is that modules themselves are stored within “/lib/modules/”, and so you needed the module to read the rootfs, but the module to read the rootfs was unreachable until you had the module loaded (the proverbial “Catch 22”). Along came the initrd.

If you take a block of RAM, and you cover it with loopback so it looks like a simple filesystem which the bootloader understands, and then copy a tiny and temporary filesystem into it (including a mini init and the kernel modules needed to read the actual hard drive), then you can load the kernel and the module used for whatever odd filesystem type is on the actual hard drive (or something else difficult to configure, e.g., a RAID array). You’re still stuck with a miniature “mini me” Linux, but then a “pivot root” is performed; the kernel has been accessing “/” on a simple ramdisk (initrd since it is the first or “initial” ramdisk used in init), and when the root is mutated to say that it is now the actual hard drive, magic happens and the kernel uses that hard drive as if it was always using it.

There is a very important point here: Any driver needed to run that alternate hard drive must have the driver added to the initrd, otherwise one cannot find the drivers on the hard drive. Any module not mandatory for reading that filesystem does not need to be on the initrd. If you have made a kernel modification which is required for boot, and if any of that is in the form of a module, then it is possible the boot failure is due to missing the driver which runs in initrd prior to pivot root.

This gets a bit more confusing on Jetsons. The explanation will differ between the Orin Nano variants. If you have a dev kit, then the Orin Nano will not have eMMC, but it will have QSPI memory. If you have a commercial Nano (which is normally what is sold with third party commercial carrier boards), then there is eMMC memory. That boot chain which loads the kernel is quite different between those two models. Which Orin Nano model do you have? Is this a commercial module with eMMC on a third party carrier board? Or is this an actual developer’s kit which would normally use only an SD card? Answers change depending on the model.

When adding drivers, sometimes there are options which you may not personally encounter, but which the flash software might try to perform depending on the type of module detected (eMMC model versus SD card plus QSPI model). My thought is that perhaps (I don’t know for certain) the inability to find the filesystem is one of these reasons:

  • Some sort of flash changed the partition UUID. Only occurs when flashing creates a partition.
  • There is now a missing driver and the device with that PARTUUID requiring the driver to see the partition (e.g., a module was used to understand the partition and filesystem, but it is missing from the initrd).
  • The content being used (drivers and configuration) may not be where you expect it to be, e.g., it is in QSPI of a non-eMMC model, or it is in a partition of an eMMC model), and you’ve updated part of what is needed, but the chain of searching devices has somehow skipped over your configuration and is using some other configuration (keep in mind that booting is a chain of events in multiple memory devices because Jetsons do not have a hardware BIOS; Jetsons have the equivalent of a BIOS in software which might be spread out in ways you don’t know about).

Also, I’m not so certain that gadgetfs is a filesystem type. Certainly “/dev/gadgetfs” would be a block device (e.g., a partition). However, partitions also have a filesystem type, e.g., ext4. I’m not familiar enough with this particular gadget layout (where there is a device special file in /dev; I’ve only worked with loopback covered files directly named in a gadget export). Keep in mind that you can let mount try to auto detect the format. What is your entry in “/etc/fstab” related to this gadget filesystem, if any?