persistent environment

Simon Glass sjg at chromium.org
Thu Sep 12 03:01:44 CEST 2024


Hi Vincent,

On Sun, 8 Sept 2024 at 22:38, Vincent Legoll <vincent.legoll at gmail.com> wrote:
>
> Hello,
>
> I'm struggling to setup u-boot to be able to save the environment.
>
> The board is Pine64 QuartzPro64.
>
> ATF is collabora's:
> https://gitlab.collabora.com/hardware-enablement/rockchip-3588/trusted-firmware-a.git
> collabora-enablement-tfa/master
> 44418fce30938ee483fbfc79cc32fde33753d1aa
>
> rkbin is
> https://github.com/rockchip-linux/rkbin.git
> master
> a2a0b89b6c8c612dca5ed9ed8a68db8a07f68bc0
>
> U-boot is:
> https://source.denx.de/u-boot/u-boot.git
> master
> 1630ff26cc960439b5949b80cfc604a2c8aa47dd
>
> export BL31=../trusted-firmware-a/build/rk3588/release/bl31/bl31.elf
> export ROCKCHIP_TPL=../rkbin/bin/rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_eyescan_v1.11.bin
> make quartzpro64-rk3588_defconfig
> make CROSS_COMPILE=aarch64-linux-gnu-
>
> SD card is GPT partitionned:
> Device           Start     End Sectors  Size Type
> /dev/mmcblk1p1      64   16383   16320    8M Linux filesystem
> /dev/mmcblk1p2   16384   32767   16384    8M Linux filesystem
> /dev/mmcblk1p3   32768   65535   32768   16M Linux filesystem
> /dev/mmcblk1p4   65536 1114111 1048576  512M EFI System
> /dev/mmcblk1p5 1114112 8388607 7274496  3.5G Linux filesystem
>
> I put on:
> * mmcblk1p1: idbloader.img
> * mmcblk1p2: u-boot.itb
>
> environment should be on : mmcblk1p3
>
> I tried to use:
> CONFIG_ENV_IS_IN_MMC=y
> CONFIG_SYS_MMC_ENV_DEV=1
> CONFIG_SYS_MMC_ENV_PART=3
> CONFIG_ENV_SIZE=0x1f000
> CONFIG_ENV_OFFSET=0x3f8000
>
> I tried to add:
> * USE_ENV_MMC_PARTITION
>
> I tried to change ENV_OFFSET to 0x0
>
> I'm getting:
>
> Loading Environment from MMC... MMC partition switch failed
> *** Warning - MMC partition switch failed, using default environment
> [...]
> => env info
> env_valid = valid
> env_ready = true
> env_use_default = true
> => env erase
> Erasing Environment on MMC... MMC partition switch failed
> MMC partition switch failed
> Failed (1)
> => env select MMC
> Select Environment on MMC: OK
> => env select MMC 1:3
> Select Environment on MMC: OK
> => env erase
> Erasing Environment on MMC... MMC partition switch failed
> MMC partition switch failed
> Failed (1)
>
> I've attached the config and a more complete serial console log.
>
> I'm probably doing something wrong, but I can't see it.
>
> I'd like some hints about how to get further.
> Thanks

Looking at env_erase()
It calls drv->erase() which for mmc is:
.erase = ENV_ERASE_PTR(env_mmc_erase)

I see this:

if (IS_ENABLED(CONFIG_SYS_REDUNDAND_ENVIRONMENT)) {
   copy = 1;

   if (IS_ENABLED(ENV_MMC_HWPART_REDUND)) {
      ret = mmc_set_env_part(mmc, copy + 1);
      if (ret)
         goto fini;
   }

which suggests that perhaps it is failing there as mmc_set_env_part()
has that error message "MMC partition switch failed". Do you want a
redundant environment?

Regards,
Simon


More information about the U-Boot mailing list