Bad CRC in fw_peintenv on TX2 SDK 32.4.3

i am trying to read uboot env variable using fw_printenv but iam getting below error.

root@localhost:/home/ubuntu# fw_printenv
Warning: Bad CRC, using default environment
bootcmd=run primary_image
bootdelay=0
baudrate=115200
loadaddr=0x80080000
arch=arm
cpu=armv8
board=ntdi_p2371-2180
board_name=ntdi_p2371-2180
vendor=nvidia
soc=tegra210
stdin=serial
stdout=serial
stderr=serial
scriptaddr=0x90000000
pxefile_addr_r=0x90100000
kernel_addr_r=0x80080000
fdt_addr_r=0x82000000
ramdisk_addr_r=0x83200000
fdt_del_prop_paths=/pinmux@700008d4/pinctrl-names
fdt_high=ffffffffffffffff

root@localhost:/home/ubuntu# fw_setenv modem_reset_mask 0
Warning: Bad CRC, using default environment
Seek error on /dev/mmcblk0boot1: Invalid argument
Error: can’t write fw_env to flash

fw_setenv is also not working

my fw_env.cfg contain below information:

/dev/mmcblk0boot1 0x7FE000 0x2000

i tried with 0x7fd000 0x8000 also that is mention in flash.xml file for uboot env.

can you please specify what value should we use here in SDK 32.4.3.

hello anupam.kumar,

when the system is flashed, the region of eMMC that could/does hold the U-Boot environment is not written.
this is why U-Boot prints “Warning: Bad CRC, using default environment”.

because of this, U-Boot uses a default environment that’s built into the U-Boot binary;
this will also cause fw_printenv to fail to read the environment from eMMC, since there is none stored there.

please try below if you want to write the environment to eMMC,

  1. Power on/reboot the system
  2. Wait for U-Boot to run
  3. Interrupt the U-Boot boot process
  4. In U-Boot, run “env default -f -a; saveenv”

after that,
the environment will be saved in eMMC, so (1) U-Boot will read the environment from eMMC when booting instead of using its built-in default copy, (2) fw_printenv should be able to read the environment from eMMC.

please also check similar discussion threads, Topic 49828, and Topic 63238 for reference,
thanks

I will try that.

can you just confirm,what will be the address i have to mention in fw_env.cfg for uboot ENV variable read for Tx2 SDK32.4.3.

is is 0x7fd000 to size 0x8000 or something else

I tried you above steps but still i am getting CRC error…

root@localhost:/home/ubuntu# fw_setenv modem_reset_mask 1
Warning: Bad CRC, using default environment
Seek error on /dev/mmcblk0boot1: Invalid argument
Error: can’t write fw_env to flash

can you please help here.

hello anupam.kumar,

are you working with TX1 or TX2?
your messages shows it is TX1 series.
for example,

# board=ntdi_p2371-2180
board_name=ntdi_p2371-2180
vendor=nvidia
soc=tegra210

please check the L4T sources for the u-boot config file, there’s OFFSET_OF_UBOOT_ENV for environment size.
for example,
TX1: $L4T_Sources/r32.4.4/Linux_for_Tegra/source/public/u-boot/include/configs/p2371-2180.h
TX2: $L4T_Sources/r32.4.4/Linux_for_Tegra/source/public/u-boot/include/configs/p2771-0000.h

we are using TX2 4GB module.

when i print uboot ENV on uboot i am getting

Tegra186 (P2771-0000-500) #
Tegra186 (P2771-0000-500) # printenv
active_boot_partition=0
arch=arm
baudrate=115200
board=p2771-0000_ntdi
board_name=p2771-0000_ntdi
boot_a_script=load {devtype} {devnum}:{distro_bootpart} {scriptaddr} {prefix}{script}; source {scriptaddr} boot_efi_binary=load {devtype} {devnum}:{distro_bootpart} {kernel_addr_r} efi/boot/bootaa64.efi; if fdt addr {fdt_addr_r}; then bootefi i boot_extlinux=sysboot {devtype} {devnum}:{distro_bootpart} any {scriptaddr} {prefix}extlinux/extlinux.conf
boot_net_pci_enum=pci enum
boot_net_usb_start=usb start
boot_prefixes=/ /boot/
boot_script_dhcp=boot.scr.uimg
boot_scripts=boot.scr.uimg boot.scr
boot_status_flag=0
boot_targets=mmc1 mmc0 usb0 pxe dhcp
bootcmd=run primary_image
bootcmd_dhcp=run boot_net_usb_start; run boot_net_pci_enum; if dhcp {scriptaddr} {boot_script_dhcp}; then source {scriptaddr}; fi;setenv ef; bootcmd_mmc0=setenv devnum 0; run mmc_boot bootcmd_mmc1=setenv devnum 1; run mmc_boot bootcmd_pxe=run boot_net_usb_start; run boot_net_pci_enum; dhcp; if pxe get; then pxe boot; fi bootcmd_usb0=setenv devnum 0; run usb_boot bootcount=1 bootdelay=5 bootlimit=3 calculated_vars=kernel_addr_r fdt_addr_r scriptaddr pxefile_addr_r ramdisk_addr_r cbootargs=console=ttyS0,115200 androidboot.presilicon=true firmware_class.path=/etc/firmware root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 c1 cpu=armv8 crash_count=1 crash_limit=5 defaultdevplist=1 distro_bootcmd=for target in {boot_targets}; do run bootcmd_{target}; done efi_dtb_prefixes=/ /dtb/ /dtb/current/ enter_shutdown=0x00 ethaddr=00:04:4b:cc:42:f0 fdt_addr=80000000 fdt_addr_r=88400000 fdt_addr_r_align=00200000 fdt_addr_r_offset=00000000 fdt_addr_r_size=00200000 fdt_copy_node_paths=/chosen/plugin-manager:/chosen/reset:/memory@80000000 fdt_copy_prop_paths=/bpmp/carveout-start:/bpmp/carveout-size:/chosen/nvidia,bluetooth-mac:/chosen/nvidia,ether-mac:/chosen/nvidia,wifi-mac:/chs fdt_copy_src_addr=80000000 fdt_del_copy_node_paths=/reserved-memory/ramoops_carveout:/reserved-memory/vpr-carveout fdt_high=ffffffffffffffff fdtcontroladdr=ffb2d218 initrd_high=ffffffffffffffff kernel_addr_r=80280000 kernel_addr_r_aliases=loadaddr kernel_addr_r_align=00200000 kernel_addr_r_offset=00080000 kernel_addr_r_size=08000000 load_efi_dtb=load {devtype} {devnum}:{distro_bootpart} {fdt_addr_r} {prefix}{efi_fdtfile} loadaddr=80280000 mmc_boot=if mmc dev {devnum}; then setenv devtype mmc; run scan_dev_for_boot_part; fi
one_time_override=0
overall_prev_reboot_status=5
p_crash_count=1
p_max_crash_count=5
p_prev_boot_status=1
prev_reboot_status=0
primary_image=setenv fdt_high ffffffffffffffff;setenv initrd_high ffffffffffffffff;setenv devtype mmc; setenv devnum 0;setenv bootpart 1;sysbot
pxefile_addr_r=88800000
pxefile_addr_r_align=00200000
pxefile_addr_r_offset=00000000
pxefile_addr_r_size=00200000
r_crash_count=0
r_max_crash_count=5
r_prev_boot_status=0
ramdisk_addr_r=88a00000
ramdisk_addr_r_align=00200000
ramdisk_addr_r_offset=00000000
ramdisk_addr_r_size=02000000
recovery_image=setenv fdt_high ffffffffffffffff;setenv initrd_high ffffffffffffffff;setenv devtype mmc; setenv devnum 0;setenv bootpart 21;syst
reset_override=0
scan_dev_for_boot=echo Scanning {devtype} {devnum}:{distro_bootpart}...; for prefix in {boot_prefixes}; do run scan_dev_for_extlinux; run ;
scan_dev_for_boot_part=part list {devtype} {devnum} -bootable devplist; env exists devplist || setenv devplist defaultdevplist; for distro_e scan_dev_for_efi=setenv efi_fdtfile {fdtfile}; for prefix in {efi_dtb_prefixes}; do if test -e {devtype} {devnum}:{distro_bootpart} {pree scan_dev_for_extlinux=if test -e {devtype} {devnum}:{distro_bootpart} {prefix}extlinux/extlinux.conf; then echo Found {prefix}extlinux/exi
scan_dev_for_scripts=for script in {boot_scripts}; do if test -e {devtype} {devnum}:{distro_bootpart} {prefix}{script}; then echo Found e
scriptaddr=88600000
scriptaddr_align=00200000
scriptaddr_offset=00000000
scriptaddr_size=00200000
security_key=4864
soc=tegra186
stderr=serial
stdin=serial
stdout=serial
upgrade_firm_ver=0
usb_boot=usb start; if usb dev ${devnum}; then setenv devtype usb; run scan_dev_for_boot_part; fi
vendor=nvidia
ver=U-Boot 2016.07 (Jan 24 2021 - 22:43:34 +0530)Version:1.3.0.0

=====================================
but when i am priniting uboot Enviornment from linux prompt using fw_printenv,i am getting Tx1 uboot envioremnet print…

========================
OFFSET_OF_UBOOT_ENV for environment size. …what will be start address for Tx2…it will be 0x7fd000 or 0x7fe000

This i am using ====write now but it is reading Tx1 parameter…
/dev/mmcblk0boot1 0x7d8000 0x8000

hello anupam.kumar,

could you please check developer guide, you may refer to U-Boot Customization for more details.
thanks

just want to confirm…do i need to genrate fw_printenv and fw_setenv for TX2 board also after changing fw_env.config…i have fw_printen and fw_setenv binary for TX1 ,will it work for Tx2 also after changing fw_env.config file.

Please suggest…also let me know starting address of Uboot ENV for Tx2 SDk32.4.3…is is 0x7fe000 or 0x7fd000

hello anupam.kumar,

please check the uboot sources. it’s located at the end of the 2nd boot partition,
for example,

/* Environment in eMMC, at the end of 2nd "boot sector" */
#define CONFIG_ENV_IS_IN_MMC
#define CONFIG_SYS_MMC_ENV_DEV          0
#define CONFIG_SYS_MMC_ENV_PART         2
#define CONFIG_ENV_OFFSET               (-OFFSET_OF_UBOOT_ENV)

you may also check this thread for reference, fw_printenv and fw_setenv in TX2 - #13 by thomas.preston.
thanks

Hi Jerry,
I check all the thread.
i added print in uboot for env offset and found that.

CONFIG_ENV_OFFSET=400000 - OFFSET_OF_UBOOT_ENV
= 400000 - 0x28000
= 0x3d8000
also ENV_SIZE is 0x2000

but in flash.xml uboot offset defined in 0x7d8000 and size is 0x8000.

when i taking uboot env offset 0x3d8000 i am able to read and write uboot env variable but when i am doing ota update of bootloader it is failing…can you please confirm,is this uboot env offset is fine?

hello anupam.kumar,

what’s the failure you seen there, could you please also share logs for reference,
thanks

hello anupam.kumar,

the two boot partitions on eMMC (boot0 and boot1) are combined logically into one ‘boot’ partition. The 2ndary GPT info is stored at the end of that area (end of boot1). U-Boot usually stores its env info at the end of boot1.
In our layout file, we define the UBENV at 0x7D8000 (8M-160K).

FYI,
there’re some fixes check-in for r32.5 release; suggest you moving to the latest JetPack release for confirmation.
thanks