TX1 Flashing Kernel without flashing Rootfs

Hi all.

I flash Tx1 a lot for kernel/dt modifications. And I use the command

sudo ./flash.sh jetson-tx1 mmcblk0p1

But everytime I want to flash Kernel, it flashes the whole rootfs, and because of this it takes a lot of time.

Is there anything I can do to reduce this time?
Thank you.

hello hburaksaruhan,

  1. may I know which JetPack release you’re working with.
  2. please refer to [Release 28.2 Development Guide]-> Flash Script Usage, you could enable -k options and specify the partition-ID to have partial update.
    for example,
$ sudo ./flash.sh -r -k LNX jetson-tx1 mmcblk0p1

1)We’re working with JetPack 3.3 and L4T 28.2
2)I use a bash script to flash my TegraTx1, and the script is;


export DEVDIR=/home/burak/JetPack/64_TX1/Linux_for_Tegra
export CROSS_COMPILE=/usr/local/gcc-linaro-5.3-2016.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- 
export CROSS32CC=/usr/local/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc 
export KERNEL_MODULES_OUT=$DEVDIR/images/modules
export ARCH=arm64

cd $DEVDIR/sources/kernel/kernel-4.4
make mrproper
make O=$TEGRA_KERNEL_OUT tegra21_defconfig -j6
make O=$TEGRA_KERNEL_OUT menuconfig -j6
sleep 5
make O=$TEGRA_KERNEL_OUT zImage -j6
make O=$TEGRA_KERNEL_OUT dtbs -j6
make O=$TEGRA_KERNEL_OUT modules -j6
export KERNEL_MODULES_NAME=4.4.38+ 
cd $DEVDIR/images/modules/lib/modules/$KERNEL_MODULES_NAME
rm build source
cd $DEVDIR/images/modules/
tar -cjf kernel_supplements.tbz2 *
mv kernel_supplements.tbz2 $DEVDIR/images/packages
cd $DEVDIR/kernel
tar -xf kernel_headers.tbz2
tar -cjf kernel_headers_custom.tbz2 linux-headers-$KERNEL_MODULES_NAME
mv kernel_headers_custom.tbz2 $DEVDIR/images/packages
sudo rm -rf linux-headers-$KERNEL_MODULES_NAME 
cp $DEVDIR/images/arch/arm64/boot/dts/tegra210-jetson-tx1-p2597-2180-a01-devkit.dtb $DEVDIR/kernel/dtb
cd $DEVDIR/images
cp -rf arch/arm64/boot/Image arch/arm64/boot/zImage packages/kernel_supplements.tbz2 $DEVDIR/kernel/
cp -rf packages/kernel_headers_custom.tbz2 $DEVDIR/kernel/kernel_headers.tbz2
sudo ./apply_binaries.sh 

//Up to here, it's the same. I dont touch it.
//I uncomment one of these to choose the flashing what I want. 
#sudo ./flash.sh jetson-tx1 mmcblk0p1        //Choose this if you want to flash Kernel+DT
./flash.sh -r -k LNX jetson-tx1 mmcblk0p1    //Choose this if you want to flash only kernel
#./flash.sh -r -k DTB jetson-tx1 mmcblk0p1   //Choose this if you want to flash only DTB

It works like a charm when flashing Kernel+DT. It works when flashing only DT. But it doesnt work when I try to flash only the kernel image.

hello hburaksaruhan,

could you please have an alternative way to replace /boot/Image with your customize kernel image.
you should also perform warm-reboot to check if the change works.

Do you mean I should copy Image manually? Didn’t really understand your suggestion.
Tried the warm-reboot, still, the error persists.

(Using a pr_info, and changing the date to see the difference, on an initialized driver to check if kernel flashing is successfull)

hello hburaksaruhan,

since TX1 uses u-boot, kernel-image can be updated by replacing /boot/Image
for example,

$ scp $OUT/Image ubuntu@
$ cp /tmp/Image /boot/Image
$ sudo reboot

It is not Image, but zImage right?

hello hburaksaruhan,

it is Image, please also refer to Kernel Customization chapter.

Yes it worked successfully.

But what about zImage, kernel_supplements.tbz2, kernel_headers.tbz2, linux-headers? Will I ever need to make changes / copy them as well?

Can’t I just flash with the script over micro-usb in recovery mode without flashing rootfs?

Because sometimes the kernel just crashes, and I won’t be able to copy the Image file to /boot/ then. What can I do when the kernel crashes, and Ubuntu fails to boot? I will not be able to replace kernel that way.

So this method will not be benefical for me that much, although works.

Basically, I need this to work, but I failed to make it work.
Eventhough the script tells that the [LNX] flash is succesfull, I can’t see the changes I make, so in reality it’s not succesfull.

If possible you might want to flash just the kernel as you have done, but save a log and post the log. Example:

sudo ./flash.sh -r -k LNX jetson-tx1 mmcblk0p1 2>&1 | tee lnx_flash_log.txt

The log should name exactly where any kernel image is copied from/to.

Here it is I believe.
lnx_flash_log.txt (10.9 KB)

Is this R28.2 (see “head -n 1 /etc/nv_tegra_release”)?

Can you verify that on the Jetson the sha1sum of “/boot/Image” on the TX1 matches that of the Image you compiled? Can you verify this same checksum on the host at the “Linux_for_Tegra/rootfs/boot/Image” location?

hi all,

since U‑Boot is required for Jetson-TX1, and it’s also a default bootloader for Jetson TX2.
the image flashed to the kernel partition (LNX) is actually a U‑Boot image.
in addition, U‑Boot loads the Linux kernel from /boot/Image in root file system.
hence, that’s why “‑k kernel” options not works as expect.

you may update /boot/Image to takes effect, shown two methods as below for your reference.

  1. Modify /boot/extlinux/extlinux.conf to add a new boot entry.
  2. Connect the Jetson device’s recovery USB port to your host. enter below command at the U‑Boot command prompt: ums 0 mmc 1
    this connects eMMC to the host as a set of USB mass storage devices. you then can copy your custom kernel to /boot/Image directly.

Can I do the same thing with dtb as well? Which file is dtb and which folder should I copy the dtb into?

Device tree is now a signed partition and not a file. Boot stages prior to U-Boot required the device tree, and those stages cannot read ext4. There is an exception for older releases.

hello hburaksaruhan,

sine you’re working with l4t-r28.2, which has enable encrypt process in the bootloader.
cboot would add some key entries before passing to u-boot.

you’re still able to remote update the device tree partition if you had signed the dtb files locally.
you might also refer to Topic 1042852 for the discussion of device tree partition need an signed DTB.