How to rebuild kernel for Jetson Linux 35.2.1

The official documents for kernel customization are included with the particular L4T release (in your case R35.2.1). You can go here to reach that:
https://developer.nvidia.com/linux-tegra

The URL above would also be able to reach the correct kernel source download.

These are more for native compile, not cross compile, but still apply if you are manually configuring and building a kernel (you’d have to adjust to use a cross compiler and such if working on a PC):

In terms of “rebuild the…root filesystem”, what are you actually changing? On the host PC most of the rootfs is generated verbatim from the host PC’s “Linux_for_Tegra/rootfs/” content. The kernel, device tree, and extlinux.conf are updated into that location first, and then a partition image is generated. The particular kernel/device tree/extlinux.conf depends on the chosen target board. If you were to flash on command line, then you would use a command something like this for a dev kit:
sudo ./flash.sh jetson-agx-orin-devkit mmcblk0p1

The target always corresponds to a “.conf” file. For example, “jetson-agx-orin-devkit” is provided by “jetson-agx-orin-devkit.conf”. This is human-readable, and might include other human-readable files. Usually it is a symbolic link (alias) pointing at the same file which is named after the part number of the module and carrier board. You can copy those files to a new name, and edit to have your own custom flash target if you wish. From there you can find out what kernel and other content is copied into “rootfs/” before the image is generated. An example to flash on command line which also saves a log of the flash is this:
sudo ./flash.sh jetson-agx-orin-devkit mmcblk0p1 2>&1 | tee log_flash.txt

If you flash and save a log, then you can go over that log to see which files are copied from where prior to the rootfs being generated.

Of course, I have been assuming that you want to know how to create a rootfs image based on some modification of “rootfs/”, and not generating an entirely new rootfs. If you want something like the latter, then you will probably need to state your use-case (there won’t be many people who have used alternate rootfs other than minor changes, but some have made more extensive changes and could possibly help).

1 Like