[U-Boot] Bug in saveenv handling?
U.Mutlu
for-gmane at mutluit.com
Wed Apr 10 18:32:14 UTC 2019
Hi Frank,
as said, the error happened in the last -rc4 version,
but does not happen in the current release version (2019.04).
/dev/mmcblk0p1 on the SD card is my boot partition (FAT16 LBA)
and uses default settings. Hope the following info answers your questions.
(yes, the SD card capacity is 16GB, but intentionally only the 1st 1.4GB or so
is in use yet; this is to keep the .img size small).
Regarding the environment file (uboot.env): I can't say whether
it should be a hidden file or not as I saw it only recently pop-up
in the /, after I used saveenv.
root at xy:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 465.8G 0 disk
└─sda1 8:1 0 457.8G 0 part /
mmcblk0 179:0 0 14.5G 0 disk
├─mmcblk0p2 179:2 0 1.4G 0 part
└─mmcblk0p1 179:1 0 32M 0 part /boot
root at xy:~# fdisk -l /dev/mmcblk0
Disk /dev/mmcblk0: 14.5 GiB, 15523119104 bytes, 30318592 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xdccc2266
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 * 2048 67583 65536 32M e W95 FAT16 (LBA)
/dev/mmcblk0p2 67584 3071999 3004416 1.4G 83 Linux
root at xy:~# fdisk -l /dev/mmcblk0p1
Disk /dev/mmcblk0p1: 32 MiB, 33554432 bytes, 65536 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000
root at xy:~# minfo -i /dev/mmcblk0p1 ::
device information:
===================
filename="/dev/mmcblk0p1"
sectors per track: 32
heads: 64
cylinders: 32
mformat command line: mformat -t 32 -i /dev/mmcblk0p1 -h 64 -s 32 -H 2048 ::
bootsector information
======================
banner:"mkfs.fat"
sector size: 512 bytes
cluster size: 4 sectors
reserved (boot) sectors: 1
fats: 2
max available root directory slots: 512
small size: 0 sectors
media descriptor byte: 0xf8
sectors per fat: 64
sectors per track: 32
heads: 64
hidden sectors: 2048
big size: 65536 sectors
physical drive id: 0x80
reserved=0x0
dos4=0x29
serial number: F7D2F904
disk label="NO NAME "
disk type="FAT16 "
Frank Wunderlich wrote on 04/10/2019 10:00 AM:
> 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