uboot saveenv not working

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

uboot saveenv not working

3,804 Views
rakesh3
Contributor V

Hi team,

I am using the imx6qsabresd board, and using the UUU tool to flash the image into that. I am using uboot version U-Boot 2021.04.

But uboot 'saveenv' command is not working .Giving below error.

Saving Environment to MMC... 
No block device
Failed (1)

I have turned on below configuration in uboot then also its giving same error.

CONFIG_CMD_SAVEENV=y
CONFIG_CMD_ERASEENV=y
CONFIG_CMD_ENV_EXISTS=y

Please help me on this issue.

Regards,

Rk

 

Labels (2)
Tags (2)
0 Kudos
Reply
10 Replies

3,779 Views
ramprakash08
Contributor IV

Hi,

It look like you're having trouble with the 'saveenv' command in U-Boot on your imx6qsabresd board. The error message you're seeing suggests that U-Boot can't find the block device where it's supposed to save the environment variables.

One possible reason for this could be that the MMC device isn't properly configured in U-Boot. You might need to set the 'mmcdev' environment variable to the correct MMC device number. 

Regards

0 Kudos
Reply

3,777 Views
rakesh3
Contributor V

Thanks Ramprakash for reply,

I am using UUU tool to flash the image into device with below uboot config. I am using the below uboot configuration to set the mmcdev. But in uboot terminal when i looked for mmcdev , its not availalble.

# }

# use uboot burn bootloader to eMMC
# becaue difference chip, offset is difference
# you can use kernel to do that for specific boards
FB: ucmd setenv fastboot_dev mmc3
FB: ucmd setenv mmcdev ${emmc_dev}

FB: flash bootloader u-boot-dtb.imx

FB: ucmd if env exists emmc_ack; then ; else setenv emmc_ack 0; fi;

FB: ucmd setenv emmc_cmd mmc partconf ${emmc_dev} ${emmc_ack} 1 0

#flashing the kernel image

U-Boot > printenv mmcdev
## Error: "mmcdev" not defined

But I am not using saveenv command in UUU script . Could it be the possible reason?

 

Regards,

Rk

0 Kudos
Reply

3,744 Views
jackie2
Contributor III

Maybe you can check the following discussion. 

 

Re: saveenv is not working from uuu script - NXP Community

 

0 Kudos
Reply

3,749 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @rakesh3 

I hope you are doing well
 
Please refer to the below document for Flashing Linux BSP using UUU. 
 
 
Thanks & Regards
Dhruvit Vasavada
0 Kudos
Reply

3,666 Views
rakesh3
Contributor V

Thanks Dhruvit for your respond,

I think, I am using the same configuration in the UUU script. Below is my UUU script for loading the uboot.

uuu_version 1.5.21

# This command will be run when i.MX6/7 i.MX8MM, i.MX8MQ
SDP: boot -f u-boot-dtb.imx

# This command will be run when ROM support stream mode
# i.MX8QXP, i.MX8QM
SDPS: boot -f u-boot-dtb.imx

# These commands will be run when use SPL and will be skipped if no spl
# SDPU will be deprecated. please use SDPV instead of SDPU
# {
SDPU: delay 1000
SDPU: write -f u-boot-dtb.imx -offset 0x57c00
SDPU: jump
# }

# These commands will be run when use SPL and will be skipped if no spl
# if (SPL support SDPV)
# {
SDPV: delay 1000
SDPV: write -f u-boot-dtb.imx -skipspl
SDPV: jump
# }

# use uboot burn bootloader to eMMC
# becaue difference chip, offset is difference
# you can use kernel to do that for specific boards
FB: ucmd setenv fastboot_dev mmc3
FB: ucmd setenv mmcdev ${emmc_dev}

FB: ucmd mmc dev ${emmc_dev}

I using the below uboot config 

CONFIG_ENV_SUPPORT=y
CONFIG_SAVEENV=y
CONFIG_CMD_SAVEENV =y

CONFIG_ENV_OFFSET=0xE0000

# CONFIG_CMD_ERASEENV is not set
CONFIG_CMD_TFTPBOOT=y
# CONFIG_ENV_IS_NOWHERE is not set
CONFIG_ENV_IS_IN_MMC=y
CONFIG_SYS_MMC_ENV_DEV=2
CONFIG_SYS_MMC_ENV_PART=0

# CONFIG_SUPPORT_EMMC_BOOT is not set

 

But on flashing the board with UUU tools using above UUU script then its showing the below o/p.

flash target is MMC:3

But after flashing the board when Its reboot its changing the MMC and showing below o/p.

flash target is MMC:2 

and on using the ">saveenv " command its giving 

No block device
Failed (1)

Please have a look into this script and help me if any thing seems misconfigure in this.

0 Kudos
Reply

3,618 Views
jackie2
Contributor III

Untitled2.pngUntitled1.pngUntitled3.png

0 Kudos
Reply

3,614 Views
rakesh3
Contributor V

Hi jackie, thanks for reply,

I am also using the same 

uuu_version 1.5.21

# This command will be run when i.MX6/7 i.MX8MM, i.MX8MQ
SDP: boot -f u-boot-dtb.imx

# This command will be run when ROM support stream mode
# i.MX8QXP, i.MX8QM
SDPS: boot -f u-boot-dtb.imx

# These commands will be run when use SPL and will be skipped if no spl
# SDPU will be deprecated. please use SDPV instead of SDPU
# {
SDPU: delay 1000
SDPU: write -f u-boot-dtb.imx -offset 0x57c00
SDPU: jump
# }

# These commands will be run when use SPL and will be skipped if no spl
# if (SPL support SDPV)
# {
SDPV: delay 1000
SDPV: write -f u-boot-dtb.imx -skipspl
SDPV: jump
# }

# use uboot burn bootloader to eMMC
# becaue difference chip, offset is difference
# you can use kernel to do that for specific boards
FB: ucmd setenv fastboot_dev mmc3
FB: ucmd setenv mmcdev ${emmc_dev}

FB: ucmd mmc dev ${emmc_dev}
FB: ucmd saveenv

FB: flash bootloader u-boot-dtb.imx

#FB: ucmd if env exists emmc_ack; then ; else setenv emmc_ack 0; fi;

#FB: ucmd setenv emmc_cmd mmc partconf ${emmc_dev} ${emmc_ack} 1 0
#FB: ucmd saveenv

FBK: DONE

But I am getting below error on using the saveenv command in UUU .

New USB Device Attached at 2:8
2:8>Start Cmd:SDP: boot -f u-boot-dtb.imx
100%2:8>Okay (1.399s)
New USB Device Attached at 2:8
New USB Device Attached at 1:9
1:9>Start Cmd:SDP: boot -f u-boot-dtb.imx
100%1:9>Okay (1.283s)
New USB Device Attached at 1:9
1:9>Start Cmd:FB: ucmd setenv fastboot_dev mmc3
1:9>Okay (0.001s)
1:9>Start Cmd:FB: ucmd setenv mmcdev ${emmc_dev}
1:9>Okay (0s)
1:9>Start Cmd:FB: ucmd saveenv
1:9>Fail Bulk(R):LIBUSB_ERROR_IO(0.148s)
1:9>Start Cmd:FB: flash bootloader u-boot-dtb.imx
0x400000001:9>Okay (0.18s)
1:9>Start Cmd:FB: ucmd if env exists emmc_ack; then ; else setenv emmc_ack 0; fi;
1:9>Okay (0.001s)
1:9>Start Cmd:FB: ucmd setenv emmc_cmd mmc partconf ${emmc_dev} ${emmc_ack} 1 0
1:9>Okay (0s)

and on terminal , I am getting below.

U-Boot 2021.04-00007-g7ea82d90df-dirty (Feb 28 2023 - 18:09:37 +0530)

CPU: i.MX6D rev1.6 at 792MHz
CPU: Industrial temperature grade (-40C to 105C) at 36C
Reset cause: POR
Model: Freescale i.MX6 Quad SABRE Smart Device Board
DRAM: 1 GiB
PMIC: PFUZE100! DEV_ID=0x10 REV_ID=0x21
MMC: FSL_SDHC: 1, FSL_SDHC: 2, FSL_SDHC: 3
In: serial
Out: serial
Err: serial
flash target is MMC:2
Card did not respond to voltage select! : -110
MMC card init failed!
Card did not respond to voltage select! : -110
** Block device MMC 2 not supported
Net: FEC [PRIME]
Fastboot: Normal
Normal Boot
Hit any key to stop autoboot: 0
MX6 U-Boot >
MX6 U-Boot >
MX6U-Boot > saveenv
Saving Environment to MMC... Card did not respond to voltage select! : -110
No block device
Failed (1)
MX6 U-Boot >

I am getting "LIBUSB_ERROR_IO(0.148s)" error while using the saveenv cmd in UUU.

But on reboot its "falsh target is getting to MMC:2 " and then all issue starts.

flash target is MMC:2
Card did not respond to voltage select! : -110
MMC card init failed!
Card did not respond to voltage select! : -110
** Block device MMC 2 not supported

Is this line correct ? Not mentioning the mmc dev in fastboot_dev any thing ? 

Below is my u-boot fast boot configuration for emmc_dev 3.

+CONFIG_CMD_FASTBOOT=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_UUU_SUPPORT=y
+CONFIG_FASTBOOT=y
+CONFIG_FASTBOOT_BUF_ADDR=0x12000000
+CONFIG_FASTBOOT_BUF_SIZE=0x40000000
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=3
+CONFIG_EFI_PARTITION=y
+CONFIG_DISTRO_DEFAULTS=y
+CONFIG_USB_GADGET_MANUFACTURER="FSL"
+CONFIG_USB_GADGET_VENDOR_NUM=0x0525
+CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5

Please suggest on this error . 

0 Kudos
Reply

3,590 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @rakesh3,

I hope you are doing well
 
Please confirm if the value of CONFIG_SYS_MMC_ENV_DEV, CONFIG_ENV_OFFSET, and CONFIG_ENV_SIZE matches with the /etc/fw_env.config.
 
If you are using the EVK, kindly try to flash the demo images from the Embedded Linux for i.MX Applications Processors using UUU utility and share the results.
 
Thanks & Regards,
Dhruvit Vasavada

0 Kudos
Reply

3,567 Views
rakesh3
Contributor V

Sorry , I dont have that file in my rootfs.

/etc# ls -l fw_env.config
ls: cannot access 'fw_env.config': No such file or directory

 

How to get that file or enable any config for this ?

Do we need the fastboot configuration to use below in UUU.

FB: ucmd setenv fastboot_dev mmc3
FB: ucmd setenv mmcdev ${emmc_dev}

FB: ucmd saveenv

Sorry ,I am not using the EVK board here, I am using the custom board based on imx6dsabresd.

Please help on this.

Regards,

Rk

0 Kudos
Reply

3,493 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @rakesh3,

I hope you are doing well.
 

=> For the Uboot config-related information please refer to section 10 Uboot config requirement from UUU.pdf

For the query regarding fw_env.config, please refer to this fw_env.config file. You can modify it according to your custom board and put it in /etc and check whether the environment variable can be accessed from Linux or not.
 
Please check the below Document for more information.
 
For the Porting U-boot, it is recommended to refer to the BSP Porting Guide corresponding to your BSP version provided on the NXP official website.
 
Thanks & Regards,
Dhruvit Vasavada

0 Kudos
Reply