Flash Error on TX2 with R32.1

I used the flash.sh helper script to flash just kernel to internal eMMC, with the commad as follow:

sudo ./flash.sh -k kernel -K kernel/Image jetson-tx2 mmcblk0p1

When I specified the kernel image extracted from the Linux_for_Tegra.tbz2, both the kernel and the filesystem started successfully,

But when I specified the kernel image compiled by myself, the kernel started successfully, while the desktop cannot be displayed.

I didn’t modify the codes extracted from JAX-TX2-public_sources.tbz2, and compiled the kernel image by referring the official documents.

On a system with a non-modified kernel I recommend saving a copy of “/proc/config.gz” for reference. Start with this as your initial configuration, adjust CONFIG_LOCALVERSION (usually CONFIG_LOCALVERSION=“-tegra” if you want to reuse existing modules), and then edit any config. You are guaranteed starting with an exact match to the existing system and modules currently installed if you do this, whereas the _defconfigs do not guarantee this.

What was your original base configuration and what were your edits to kernel config? What was your “CONFIG_LOCALVERSION”?

Thank you for replying.

I copied “/proc/config.gz” from official system, and compared it with “$TEGRA_KERNEL_OUT/.config” compiled via the command as follow:

make ARCH=arm64 O=$TEGRA_KERNEL_OUT tegra_defconfig

The result is the two files are identical, with the contents about “CONFIG_LOCALVERSION” as follows:

#
# General setup
#
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_CROSS_COMPILE=""
# CONFIG_COMPILE_TEST is not set
CONFIG_LOCALVERSION=""
# CONFIG_LOCALVERSION_AUTO is not set
CONFIG_DEFAULT_HOSTNAME="(none)"
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_POSIX_MQUEUE=y
CONFIG_POSIX_MQUEUE_SYSCTL=y
CONFIG_CROSS_MEMORY_ATTACH=y
CONFIG_FHANDLE=y
# CONFIG_USELIB is not set
CONFIG_AUDIT=y
CONFIG_HAVE_ARCH_AUDITSYSCALL=y
CONFIG_AUDITSYSCALL=y
CONFIG_AUDIT_WATCH=y
CONFIG_AUDIT_TREE=y

#
# Tegra BPMP Driver
#
CONFIG_ARCH_TEGRA_18x_SOC=y
CONFIG_ARCH_TEGRA_19x_SOC=y
CONFIG_ARCH_TEGRA_23x_SOC=y

Is there any error in the above config? Thanks in advance.

By the way, I used “gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu” as the compiler and compiled the kernel on Ubuntu-18.04.

Moreover, in the log of the offical kernel startup, I found some messages about uboot as follow:

U-Boot 2016.07-g0eb73f4 (Mar 13 2019 - 00:20:34 -0700)

TEGRA186
Model: NVIDIA P2771-0000-500
DRAM:  7.8 GiB
MC:   Tegra SD/MMC: 0, Tegra SD/MMC: 1
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   eth0: ethernet@2490000
Hit any key to stop autoboot:  0 
MMC: no card present
switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:1...
Found /boot/extlinux/extlinux.conf
Retrieving file: /boot/extlinux/extlinux.conf
213 bytes read in 103 ms (2 KiB/s)
p2771-0000 eMMC boot options
1:	primary kernel
Enter choice: 1:	primary kernel
Retrieving file: /boot/Image
34048008 bytes read in 854 ms (38 MiB/s)
append: root=/dev/mmcblk0p1 rw rootwait console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 video=tegrafb no_console_suspend=1 earlycon=uart8250,mmio32,0x3100000 nvdumper_reserved=0x2772e0000 gpt tegra_fbmem2=0x800000@0x9607b000 lut_mem2=0x2008@0x96078000 usbcore.old_scheme_first=1 tegraid=18.1.2.0.0 maxcpus=6 boot.slot_suffix= boot.ratchetvalues=0.983055.1 bl_prof_dataptr=0x10000@0x275840000 sdhci_tegra.en_boot_part_access=1 root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4
## Flattened Device Tree blob at 80000000
   Booting using the fdt blob at 0x80000000
   reserving fdt memory region: addr=80000000 size=10000
   Using Device Tree in place at 0000000080000000, end 0000000080058d62

But I didn’t find the above messages in the failed kernel (compiled by myself) startup.

Jetson TX2 uses U-Boot. The kernel partition contains the U-Boot binary rather than the kernel on this platform (same for TX1 in recent L4T releases). You should write any updated kernel to the /boot directory in the filesystem, rather than using flash.sh. IIRC, if the kernel DTB changed, you will need to use flash.sh to update the kernel-dtb partition. Updated kernel modules need to be written to the correct location in /lib/modules/…

Early on the Image file was used in “/boot”, but later this became part of a partition. I have not yet been able to work with R32.x (working on an Ubuntu laptop which ran out of battery power during upgrade…didn’t go well), but is the Image file in R32.x back in “/boot”? That would be good news.

For Jetson TX1 and TX2, the kernel has always been in /boot as far as I can recall. The location varies depending on board generation; for Jetson AGX Xavier, the kernel is always loaded from a partition.

EDIT: My bad: I forgot that we did indeed modify U-Boot to pass the DTB from cboot to the kernel rather than loading a fresh DTB from disk. I think the DTB is still copied into /boot even so, but that copy is simply not used. Sorry for the confusion.

Thanks for replying.

Hi linuxdev,

I‘ve solved the initial problem according to #2.

I found the cause of my mistake was kmod.service couldn’t start if CONFIG_LOCALVERSION not being set.
Thanks again.