0

I am working with YOCTO dunfell and i have to use libubootenv for fw_printenv and fw_setenv. But iam unable to set variables using fw_setenv. Also the fw_printenv output is also not correct. But i can use the printenv setenv from the u-boot command line and it is working properly.We are using our custom board with AM335 TI Processor.

My u-boot env variables are stored in the spi flash and below is my fw_env.config(/etc/fw_env.config)

/dev/mtd2               0x0A0000        0x010000
/dev/mtd3               0x0B0000        0x010000

Also when i use fw_printenv/fw_setenv , Iam getting the error "Can not read from default". But its printing the variables which is in the u-boot-initial-env file.

I want to set and read using fw_printenv and fw_setenv from the userspace and it should change the variables in the spi flash.

Right now Iam not able to change the spi flash u-boot-env variables using fw_setenv and print using fw_printenv.

Please help with this issue. Any helps are appreciated. Iam pasting small part of board.h file here.

/*
* Default to using SPI for environment, etc.
* 0x000000 - 0x020000 : SPL (128KiB)
* 0x020000 - 0x0A0000 : U-Boot (512KiB)
* 0x0A0000 - 0x0BFFFF : First copy of U-Boot Environment 
(128KiB)
* 0x0C0000 - 0x0DFFFF : Second copy of U-Boot Environment 
(128KiB)
* 0x0E0000 - 0x442000 : Linux Kernel
* 0x442000 - 0x800000 : Userland
*/
/* SPI flash. */
#define CONFIG_SYS_SPI_ARGS_OFFS    (768 << 10)
#define CONFIG_SYS_SPI_ARGS_SIZE    SZ_128K
#define CONFIG_SYS_SPI_KERNEL_OFFS (CONFIG_SYS_SPI_ARGS_OFFS + 
CONFIG_SYS_SPI_ARGS_SIZE)

#if defined(CONFIG_SPI_BOOT)
/* SPL related */
#define CONFIG_SYS_SPI_U_BOOT_OFFS      0x20000

#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
#define CONFIG_ENV_SPI_MAX_HZ           CONFIG_SF_DEFAULT_SPEED
#define CONFIG_ENV_SECT_SIZE            (4 << 10) /* 4 KB 
sectors */
#define CONFIG_ENV_OFFSET               (768 << 10) /* 768 KiB 
in */
#define CONFIG_ENV_OFFSET_REDUND        (896 << 10) /* 896 KiB 
in */
sethu
  • 1
  • 1
  • This could use a bit more info. What version do you use? The current version of libubootenv has no error message like `Can not read from default`. Did you paste it correctly? Also, the exact commands you use and exact outputs could be beneficial. – skandigraun May 29 '23 at 15:12
  • Hi I am working on yocto dunfell and using libubootenv in the poky only, Iam just adding libubootenv-bin to the rootfs by adding it to IMAGE_INSTALL. Iam getting fw_printenv and fw_setenv in the /usr/bin folder . But it is not modifying the actual boot variables which we can set from u-boot command line. It is only reading and writing to a u-boot-initial-env file present in /etc/ folder. That too will get reset after every reboot. We are using our own custom - uboot. and libubootenv source is master branch only in the work folder. Am i following proper steps or anything wrong. – sethu May 30 '23 at 10:21
  • If your target has the **strace** command installed, then use it to find out from where **fw_printenv** is fetching data. – sawdust May 30 '23 at 20:36

0 Answers0