[U-Boot] Bug in saveenv handling?

Frank Wunderlich frank-w at public-files.de
Wed Apr 10 08:00:45 UTC 2019


please stay on list...i'm no expert in fat-environment, only have some experience on out-of-partition environment-storage (env on mmc). This seems not your case...

i don't know if env_offset is used on fat (makes no sense in my eyes) and env_is_on_mmc is disabled

where did your fat-partition start? if it starts after 1M offset uboot should not overwrite itself with saveenv.

following your dd starts at 8k-offset and have which size (typically <1M)? your erase before cleans first 1M (except first 1k where partitiontable is located). why do you think the target-file should be hidden? imho it is a normal file on mmc 0 and maybe first fat-partition (auto-flag) named "uboot.env". you found the file on /?? this should not be a fat-partition. linux imho needs a partiton with permission-options (extx,reiser,...). i guess you mean additional fat-partition, maybe mounted to /boot.

maybe you can add some debug-messages in saveenv for fat (env/fat.c env_fat_save, fs/fat/fat_write.c file_fat_write)

regards Frank


> Gesendet: Dienstag, 09. April 2019 um 23:21 Uhr
> Von: "U.Mutlu" <for-gmane at mutluit.com>
> $ ls -l u-boot-sunxi-with-spl.bin
> -rw-r--r-- 1 xy xy 479836 Apr  9 17:55 u-boot-sunxi-with-spl.bin
>
> I used the following to write u-boot to the SD card (/dev/sdb):
>
> # dd if=/dev/zero of=/dev/sdb bs=1k count=1023 seek=1
> # dd if=u-boot-sunxi-with-spl.bin of=/dev/sdb bs=1024 seek=8

> > $ grep -i ENV_ .config
> > CONFIG_ENV_SIZE=0x20000
> > CONFIG_ENV_OFFSET=0x88000
> > CONFIG_ENV_VARS_UBOOT_CONFIG=y
> > # CONFIG_SYS_CONSOLE_ENV_OVERWRITE is not set
> > # CONFIG_SPL_ENV_SUPPORT is not set
> > CONFIG_CMD_ENV_EXISTS=y
> > # CONFIG_CMD_ENV_CALLBACK is not set
> > # CONFIG_CMD_ENV_FLAGS is not set
> > # CONFIG_ENV_IS_IN_EEPROM is not set
> > CONFIG_ENV_IS_IN_FAT=y
> > # CONFIG_ENV_IS_IN_EXT4 is not set
> > # CONFIG_ENV_IS_IN_FLASH is not set
> > # CONFIG_ENV_IS_IN_MMC is not set
> > # CONFIG_ENV_IS_IN_NAND is not set
> > # CONFIG_ENV_IS_IN_NVRAM is not set
> > # CONFIG_ENV_IS_IN_ONENAND is not set
> > # CONFIG_ENV_IS_IN_REMOTE is not set
> > # CONFIG_ENV_IS_IN_SPI_FLASH is not set
> > # CONFIG_ENV_IS_IN_UBI is not set
> > CONFIG_ENV_FAT_INTERFACE="mmc"
> > CONFIG_ENV_FAT_DEVICE_AND_PART="0:auto"
> > CONFIG_ENV_FAT_FILE="uboot.env"
> > # CONFIG_USE_DEFAULT_ENV_FILE is not set
> > # CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG is not set
> >
> >> $ grep ENV_FAT .config
> >> CONFIG_ENV_FAT_INTERFACE="mmc"
> >> CONFIG_ENV_FAT_DEVICE_AND_PART="0:auto"
> >> CONFIG_ENV_FAT_FILE="uboot.env"
> >>
> >> I guess the uboot.env is a hidden file, but occassionally (esp. after
> >> saveenv & reboot) I see this file as a normal file in /, not hidden.
> >>
> >> I used "Lamobo_R1_defconfig" as basis and made just a few
> >> irrelevant minor changes in make menuconfig.
> >> It's actually a Banana Pi R1 board.
> >> CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-lamobo-r1"


More information about the U-Boot mailing list