Unable to flash debug kernel on xavier dev kit using jetpack 4.3 l4t 32.3.1

I want to debug kernel module using KDBG, i extracted kernel sources , ran xconfig on the tegra_defconfig generated .config using of course all the command line parameters as in the development guide.

after building the kernel, i copied the generated Image and dtb under the /kernel and also generated kernel_supplements and copied there as well.

i put the xavier to recovery mode and run the command:
sudo ./flash.sh -k kernel jetson-xavier mmcblk0p1

the script runs and seems to finish flashing, the xavier reboots to linux normally.
when i check if any configuration was changed:
zcat /proc/config.gz | egrep ‘CONFIG_KGDB|KDGB|CONFIG_FRAME_POINTER|CONFIG_WATCHDOG|IKCONFIG’

having to flash entire filesystem and erase everything every time i need to make a small change to kernel is time consuming as well as unacceptable.
for a development kit,integrtation process is extermely convoluted.
with earlier versions this didn’t seem to be a problem as far as i can remember, but still i’m not the only one having problems with the flash process.

Did you try to copy the Image to Xavier at /boot/Image?

it is my understanding that for the Xavier that directory is only a temporary one that reflects the boot partition but doesn’t affect it at all, i know it works like that for the TX2 but with the xavier it’s different. i’ll give it a try just to be sure

Someone correct me if I am wrong…

Some parts of “/boot” stopped working when earlier boot stages began using alternate methods which support secure boot, and then passed that data along as an argument to later boot stages (versus reading directly from “/boot” content). Some of that content was still used (e.g., Image) even then.

Xavier does not use U-Boot at all. For more recent L4T releases of CBoot (especially on Xavier) U-Boot functionality has begun to be added directly into CBoot, but it changes depending on release (this is still being evolved, it is a moving target). As an example some content from extlinux.conf (traditionally the territory of U-Boot) is now actually read by more recent L4T releases on Xavier even though there is no U-Boot (new and evolving functionality…earlier CBoot would have ignored some content which it now looks at in the same way as U-Boot).

So far as I know the “/boot/Image” file should be used directly even though specifying it through “/boot/extlinux/extlinux.conf” has changed over time.

The host PC side “Linux_for_Tegra/rootfs/boot/” content is edited before creating the flashed image. Content put directly there can be lost during a flash.

1 Like

Hi all
As I know Xavier support boot from the partition and file from the file.
If you have configure the extlinux.conf it will boot from this assign. And boot from partition when remove the boot lebel from extlinux.conf.

finally had a chance to check this out, just replaced the Image file at /boot and it worked
i also copied the newly created modules to /lib/modules
and the generated modules.symvers to usr/src/linux-headers-4.9.140-tegra-ubuntu18.04_aarch64
those last steps are required in order to be able to compile kernel modules.

i’m really glad this functionality has been added in order to allow easy kernel changes.
i really do hope it WOULD BE PROPERLY DOCUMENTED!
are there any other options to do with the /boot partition or the now somewhat working extlinux.conf? ( as it’s hardly documented)?

Especially is there a way to change the kernel command line without flashing?

Yes, you can change kernel command line using the extlinux.conf file. Just add after “{cbootargs}” variable.

BTW, if you have serial console to the board (which I am assuming there is for KGDB to work), I would recommend creating another entry in /boot/extlinux/extlinux.conf instead of replacing the L4T “Image” entry as it becomes easier to boot back to the original (working) kernel in case the new kernel Image doesn’t work as expected.

2 Likes

is it also possible to change the device tree dtb the same way or does it require the flash tool?