How to update uboot and kernel in the running time

hello rd1,

you’re not doing right, it’s kernel image and also u-boot binary included in the LNX partition.
please also check developer guide, U-Boot Customization chapter for reference.

The kernel is installed into the filesystem alongside the boot configuration file. The kernel (LNX) partition contains U-Boot.

you may perform flash scripts to flash a specific partition instead of flashing the whole device.
please also include --no-flash options to performs all steps except physically flashing the board, in order to generate sign and encrypt files.
for example, $ sudo ./flash.sh --no-flash -k LNX jetson-nano-devkit mmcblk0p1
after that, you may use dd commands to overwrite LNX partition.
thanks

Hi:
I used $ sudo ./flash.sh --no-flash -k LNX jetson-nano-emmc-smpsq mmcblk0p1
it is error:
###############################################################################

L4T BSP Information:

R32 , REVISION: 4.2

###############################################################################
Board ID() version() sku() product_id(smpsq)
Error: missing dtbfile (/home/scala/work/NVT210_03_04/bsp/kernel/dtb/smpsq-tegra210-p3448-0000-p3449-0000-a00.dtb).

our dtb is /home/scala/work/NVT210_03_04/bsp/kernel/dtb/smpsq-tegra210-p3448-0000-p3449-0000-b00.dtb, not *-a00.dtb

what should we do?

hello rd1,

are you having board customization?
since it’s board info detection during flash process, you might update the flash config or using offline approach to assign board info to the flash command-line.
thanks

Hello JerryChange:
we used sudo BOARDID=3448 BOARDSKU=0002 FAB=400 FUSELEVEL=fuselevel_production ./nvmassflashgen.sh jetson-nano-emmc-smpsq mmcblk0p1 to generate the final image.
after I used this command ,I try to generate u-boot upadte bin.
I try to modify the p3448-0000.conf.common to pass the error, but it will fail at other error.

###############################################################################

L4T BSP Information:

R32 , REVISION: 4.2

###############################################################################
Board ID() version() sku() product_id(smpsq)
copying bctfile(/home/scala/work/NVT210_03_04/bsp/bootloader/t210ref/BCT/P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.cfg)… done.
copying bootloader(/home/scala/work/NVT210_03_04/bsp/bootloader/t210ref/cboot.bin)… done.
copying initrd(/home/scala/work/NVT210_03_04/bsp/bootloader/l4t_initrd.img)… done.
populating kernel to rootfs… done.
populating initrd to rootfs… done.
populating /home/scala/work/NVT210_03_04/bsp/kernel/dtb/smpsq-tegra210-p3448-0002-p3449-0000-b00.dtb to rootfs… done.
Making Boot image… done.
Existing sosfile(/home/scala/work/NVT210_03_04/bsp/bootloader/nvtboot_recovery.bin) reused.
copying tegraboot(/home/scala/work/NVT210_03_04/bsp/bootloader/t210ref/nvtboot.bin)… done.
copying cpu_bootloader(/home/scala/work/NVT210_03_04/bsp/bootloader/t210ref/cboot.bin)… done.
copying bpffile(/home/scala/work/NVT210_03_04/bsp/bootloader/t210ref/sc7entry-firmware.bin)… done.
Existing badpagefile(/home/scala/work/NVT210_03_04/bsp/bootloader/badpage.bin) reused.
copying wb0boot(/home/scala/work/NVT210_03_04/bsp/bootloader/t210ref/warmboot.bin)… done.
Existing tosfile(/home/scala/work/NVT210_03_04/bsp/bootloader/tos-mon-only.img) reused.
Existing eksfile(/home/scala/work/NVT210_03_04/bsp/bootloader/eks.img) reused.
copying dtbfile(/home/scala/work/NVT210_03_04/bsp/kernel/dtb/smpsq-tegra210-p3448-0002-p3449-0000-b00.dtb)… done.
Copying nv_boot_control.conf to rootfs
Existing tbcfile(/home/scala/work/NVT210_03_04/bsp/bootloader/nvtboot_cpu.bin) reused.
copying tbcdtbfile(/home/scala/work/NVT210_03_04/bsp/kernel/dtb/smpsq-tegra210-p3448-0002-p3449-0000-b00.dtb)… done.
copying cfgfile(/home/scala/work/NVT210_03_04/bsp/bootloader/t210ref/cfg/flash_l4t_t210_emmc_p3448.xml) to flash.xml… done.
copying flasher(/home/scala/work/NVT210_03_04/bsp/bootloader/t210ref/cboot.bin)… done.
Existing flashapp(/home/scala/work/NVT210_03_04/bsp/bootloader/tegraflash.py) reused.
*** Signing boot.img ***
./tegraflash.py --chip 0x21 --cmd “sign ./signed/boot.img.encrypt”
Welcome to Tegra Flash
version 1.0.0
Type ? or help for help and q or quit to exit
Use ! to execute system commands

[ 0.0020 ] Generating signature
Error: Not supported
Failed to flash/read t210ref.

please apply below patch to your l4t_bup_gen.func under Linux_for_Tegra/bootloader.

--- a/t186/BUP/l4t_bup_gen.func
+++ b/t186/BUP/l4t_bup_gen.func
@@ -1,4 +1,4 @@
-# Copyright (c) 2017-2020, NVIDIA CORPORATION.  All rights reserved.
+# Copyright (c) 2017-2021, NVIDIA CORPORATION.  All rights reserved.
 #
 # NVIDIA CORPORATION and its licensors retain all intellectual property
 # and proprietary rights in and to this software, related documentation
@@ -147,9 +147,6 @@
 		'part_name=RP4; part_type=xusb; part_spec=${_common_spec};    part_file=$(ls rp4.blob 2> /dev/null || echo "")'
 	)
 
-	# For Jetson TX1, must use bl_update_payload to update bootloader.
-	local partitions_jetson_tx1=()
-
 	# For Jetson Nano QSPI SD, we can use all payloads to update corresponding partitions.
 	local _nano_qspi_sd="jetson-nano-devkit-mmcblk0p1"
 	local partitions_jetson_nano_qspi_sd=(
@@ -174,15 +171,12 @@
 		'part_name=RP4; part_type=nano_qspi_bl; part_spec=${_common_spec};    part_file=$(ls rp4.blob 2> /dev/null || echo "")'
 	)
 
-	# For Jetson Nano eMMC, it's same as TX1, must use bl_update_payload to update bootloader.
-	local partitions_jetson_nano_emmc=()
+	local partitions_t210ref=("${partitions_t210ref_common[@]}")
 
-	local partitions_t210ref=(
-		"${partitions_t210ref_common[@]}"
-		"${partitions_jetson_tx1[@]}"
-		"${partitions_jetson_nano_qspi_sd[@]}"
-		"${partitions_jetson_nano_emmc[@]}"
-	)
+	# Only nano-devkit uses "partitions_jetson_nano_qspi_sd"
+	if [[ "${_sw_spec}" == *"${_nano_qspi_sd}" ]]; then
+		partitions_t210ref+=("${partitions_jetson_nano_qspi_sd[@]}")
+	fi
 
 	# for binary common for different operating mode, op_mode = 0
 	# for binary different for different operating mode:

do I need some other commands? after modify the l4t_bup_gen.func,then do
sudo ./flash.sh --no-flash -k LNX jetson-nano-emmc-smpsq mmcblk0p1 .the same error:
*** Signing boot.img ***
./tegraflash.py --chip 0x21 --cmd “sign ./signed/boot.img.encrypt”
Welcome to Tegra Flash
version 1.0.0
Type ? or help for help and q or quit to exit
Use ! to execute system commands

[ 0.0025 ] Generating signature
Error: Not supported
Failed to flash/read t210ref.

Oh… we are talking about different issue. What I am saying is the issue in

Hi WayneWWW::
Thank you, the commamd pass, BUP gernerate succse,I will try it !
Does must place the BUP file in the target system under this directory /opt/ota_package/ ?

Hi JerryChang:
what should we do?
$ sudo ./flash.sh --no-flash -k LNX jetson-nano-emmc-smpsq mmcblk0p1 cann’t compile ok.

###############################################################################
Board ID() version() sku() product_id(smpsq)
copying bctfile(/home/scala/work/NVT210_03_04/bsp/bootloader/t210ref/BCT/P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.cfg)… done.
copying bootloader(/home/scala/work/NVT210_03_04/bsp/bootloader/t210ref/cboot.bin)… done.
copying initrd(/home/scala/work/NVT210_03_04/bsp/bootloader/l4t_initrd.img)… done.
populating kernel to rootfs… done.
populating initrd to rootfs… done.
populating /home/scala/work/NVT210_03_04/bsp/kernel/dtb/smpsq-tegra210-p3448-0002-p3449-0000-b00.dtb to rootfs… done.
Making Boot image… done.
Existing sosfile(/home/scala/work/NVT210_03_04/bsp/bootloader/nvtboot_recovery.bin) reused.
copying tegraboot(/home/scala/work/NVT210_03_04/bsp/bootloader/t210ref/nvtboot.bin)… done.
copying cpu_bootloader(/home/scala/work/NVT210_03_04/bsp/bootloader/t210ref/cboot.bin)… done.
copying bpffile(/home/scala/work/NVT210_03_04/bsp/bootloader/t210ref/sc7entry-firmware.bin)… done.
Existing badpagefile(/home/scala/work/NVT210_03_04/bsp/bootloader/badpage.bin) reused.
copying wb0boot(/home/scala/work/NVT210_03_04/bsp/bootloader/t210ref/warmboot.bin)… done.
Existing tosfile(/home/scala/work/NVT210_03_04/bsp/bootloader/tos-mon-only.img) reused.
Existing eksfile(/home/scala/work/NVT210_03_04/bsp/bootloader/eks.img) reused.
copying dtbfile(/home/scala/work/NVT210_03_04/bsp/kernel/dtb/smpsq-tegra210-p3448-0002-p3449-0000-b00.dtb)… done.
Copying nv_boot_control.conf to rootfs
Existing tbcfile(/home/scala/work/NVT210_03_04/bsp/bootloader/nvtboot_cpu.bin) reused.
copying tbcdtbfile(/home/scala/work/NVT210_03_04/bsp/kernel/dtb/smpsq-tegra210-p3448-0002-p3449-0000-b00.dtb)… done.
copying cfgfile(/home/scala/work/NVT210_03_04/bsp/bootloader/t210ref/cfg/flash_l4t_t210_emmc_p3448.xml) to flash.xml… done.
copying flasher(/home/scala/work/NVT210_03_04/bsp/bootloader/t210ref/cboot.bin)… done.
Existing flashapp(/home/scala/work/NVT210_03_04/bsp/bootloader/tegraflash.py) reused.
*** Signing boot.img ***
./tegraflash.py --chip 0x21 --cmd “sign ./signed/boot.img.encrypt”
Welcome to Tegra Flash
version 1.0.0
Type ? or help for help and q or quit to exit
Use ! to execute system commands

[ 0.0020 ] Generating signature
Error: Not supported
Failed to flash/read t210ref.

hello rd1,

it turns out this is not supported according to internal flash script file, tegraflash_internal.py
for example,

def tegraflash_encrypt_sign_binary(exports, args):
...
    if int(values['--chip'], 0) == 0x21:
         raise tegraflash_exception("Not supported")

tegraflash_internal.py (138.7 KB)

It is our tegraflash_internal.py, help to check.

hello rd1,

could you please try below,
I’m able to generate boot.img.encrypt as following,
for example,

$ sudo ./tegraflash.py --bct P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.cfg --bl cboot.bin --cfg flash.xml --chip 0x21 --applet nvtboot_recovery.bin --cmd "sign"

this will assuming zero to filled SBK key,
it will copying signed file to $OUT/Linux_for_Tegra/bootloader/signed/
thanks

sudo ./tegraflash.py --bct P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.cfg --bl cboot.bin --cfg flash.xml --chip 0x21 --applet nvtboot_recovery.bin --cmd “sign”
this command is OK .

Hi JerryChang::
I used boot.img.encrypt ,dd to my target system ,reboot,but failed again.

hello rd1,

could you please setup serial console to share the errors for reference,

BTW,
since you’re having board customization,
you should also check you’re using correct cfg files in the python scripts to generate encrypt binaries.
you may perform a full-flash, check the flash messages for reference.
thanks

reboot_failed.txt (6.3 KB)

hello rd1,

those error show kernel partition is not found.

[0000.651] Using BFS PT to query partitions 
[0000.655] PT: Partition LNX NOT found ! 
[0001.258] *** Failing over to KFS2.

you may review python pipeline to assign correct configuration files to generate encrypt binaries.
thanks

Hello JerryChang:
I will check it. I have some questions:
1.is BUP just for Bootloader? if I just modify kernel dtb ,used BUP update DTB , is it ok?
2.for kernel, its incluse Image,DTB and many ko files, you said Image can replaced,
DTB used dd refer LNX, for many ko ,is also used replace? do you have better methods?

hello rd1,

DTB and LNX are two different partitions for device tree blob and kernel images,
please check the flash configuration file for the partition layouts.
for example, flash_l4t_t210_emmc_p3448.xml
thanks