public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] Bug in saveenv handling?
@ 2019-04-09 19:05 U.Mutlu
  2019-04-09 19:39 ` Frank Wunderlich
  0 siblings, 1 reply; 9+ messages in thread
From: U.Mutlu @ 2019-04-09 19:05 UTC (permalink / raw)
  To: u-boot

I just made this unpleasant observation while playing with u-boot:

On the u-boot CLI I changed an envvar and saved the env:
   setenv bootdelay 5 ; saveenv

Then I issued, just for fun, the command "scsi scan", but it crashed
and rebooted the device. But this time on the display only the tuxx logo
and the very first u-boot line is displayed, nothing else happens.

It seems u-boot has overwritten parts of itself on the storage medium (uSD
with FAT boot partition).

I had this experience some more times in the past; after writing u-boot anew
to the uSD it continued working again.
Btw, I once even had the case where saveenv overwrote boot.cmd (but nothing 
else) with garbage (IIRC it was filled full with the char @ ).

I mention this just because it seems that there's maybe a bug in u-boot's
saveenv handling (maybe data was not completely flushed, file handle
was not closed, or maybe the fat write routine is buggy?...).



=> setenv bootdelay 5 ; saveenv
Saving Environment to FAT... OK
=> printenv bootdelay
bootdelay=5

=> scsi scan
scanning bus for devices...
data abort
pc : [<7ef94f8e>]          lr : [<7ef911a1>]
reloc pc : [<4a01af8e>]    lr : [<4a0171a1>]
sp : 7af51bf8  ip : 0000001c     fp : 000000c0
r10: 00000000  r9 : 7af59ed8     r8 : 00000000
r7 : 7af51e78  r6 : 7efd3f54     r5 : 7efdb9b8  r4 : 7efdb9b8
r3 : 00000000  r2 : 00000000     r1 : ea000016  r0 : 7efdb9b8
Flags: nZcv  IRQs off  FIQs off  Mode SVC_32
Code: e92dbd10 f8d045f0 b0858080 1000f8d8 (f8d14604)
Resetting CPU ...

resetting ...

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] Bug in saveenv handling?
  2019-04-09 19:05 [U-Boot] Bug in saveenv handling? U.Mutlu
@ 2019-04-09 19:39 ` Frank Wunderlich
  2019-04-09 20:53   ` U.Mutlu
  0 siblings, 1 reply; 9+ messages in thread
From: Frank Wunderlich @ 2019-04-09 19:39 UTC (permalink / raw)
  To: u-boot

this looks for me like the CONFIG_ENV_OFFSET+CONFIG_ENV_SIZE is overlapping uboots code

can you post these values and position of uboot and its size for your device?

which env-storage do you use (EMV_IN_MMC or ENV_FAT)?

regards Frank

> Gesendet: Dienstag, 09. April 2019 um 21:05 Uhr
> Von: "U.Mutlu" <for-gmane@mutluit.com>

> It seems u-boot has overwritten parts of itself on the storage medium (uSD
> with FAT boot partition).

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] Bug in saveenv handling?
  2019-04-09 19:39 ` Frank Wunderlich
@ 2019-04-09 20:53   ` U.Mutlu
  2019-04-09 21:01     ` U.Mutlu
  2019-04-09 21:09     ` Tom Rini
  0 siblings, 2 replies; 9+ messages in thread
From: U.Mutlu @ 2019-04-09 20:53 UTC (permalink / raw)
  To: u-boot

Frank Wunderlich wrote on 04/09/2019 09:39 PM:
> this looks for me like the CONFIG_ENV_OFFSET+CONFIG_ENV_SIZE is overlapping uboots code
>
> can you post these values and position of uboot and its size for your device?
>
> which env-storage do you use (EMV_IN_MMC or ENV_FAT)?

I looked up in the .config file:

# U-Boot 2019.04-rc4 Configuration


$ grep CONFIG_ENV_OFFSET .config
CONFIG_ENV_OFFSET=0x88000

$ grep CONFIG_ENV_SIZE .config
CONFIG_ENV_SIZE=0x20000

$ grep EMV_IN_MMC .config

$ 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"

Thx

>> Gesendet: Dienstag, 09. April 2019 um 21:05 Uhr
>> Von: "U.Mutlu" <for-gmane@mutluit.com>
>
>> It seems u-boot has overwritten parts of itself on the storage medium (uSD
>> with FAT boot partition).

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] Bug in saveenv handling?
  2019-04-09 20:53   ` U.Mutlu
@ 2019-04-09 21:01     ` U.Mutlu
  2019-04-09 21:21       ` U.Mutlu
  2019-04-09 21:09     ` Tom Rini
  1 sibling, 1 reply; 9+ messages in thread
From: U.Mutlu @ 2019-04-09 21:01 UTC (permalink / raw)
  To: u-boot

U.Mutlu wrote on 04/09/2019 10:53 PM:
> Frank Wunderlich wrote on 04/09/2019 09:39 PM:
>> this looks for me like the CONFIG_ENV_OFFSET+CONFIG_ENV_SIZE is overlapping
>> uboots code
>>
>> can you post these values and position of uboot and its size for your device?
>>
>> which env-storage do you use (EMV_IN_MMC or ENV_FAT)?
>
> I looked up in the .config file:
>
> # U-Boot 2019.04-rc4 Configuration
>
>
> $ grep CONFIG_ENV_OFFSET .config
> CONFIG_ENV_OFFSET=0x88000
>
> $ grep CONFIG_ENV_SIZE .config
> CONFIG_ENV_SIZE=0x20000
>
> $ grep EMV_IN_MMC .config

Maybe EMV_ is a typo and should rather be ENV_ ?
$ grep -i EMV_ .config

$ 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"
>
> Thx
>
>>> Gesendet: Dienstag, 09. April 2019 um 21:05 Uhr
>>> Von: "U.Mutlu" <for-gmane@mutluit.com>
>>
>>> It seems u-boot has overwritten parts of itself on the storage medium (uSD
>>> with FAT boot partition).

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] Bug in saveenv handling?
  2019-04-09 20:53   ` U.Mutlu
  2019-04-09 21:01     ` U.Mutlu
@ 2019-04-09 21:09     ` Tom Rini
  2019-04-09 23:10       ` U.Mutlu
  1 sibling, 1 reply; 9+ messages in thread
From: Tom Rini @ 2019-04-09 21:09 UTC (permalink / raw)
  To: u-boot

On Tue, Apr 09, 2019 at 10:53:36PM +0200, U.Mutlu wrote:
> Frank Wunderlich wrote on 04/09/2019 09:39 PM:
> >this looks for me like the CONFIG_ENV_OFFSET+CONFIG_ENV_SIZE is overlapping uboots code
> >
> >can you post these values and position of uboot and its size for your device?
> >
> >which env-storage do you use (EMV_IN_MMC or ENV_FAT)?
> 
> I looked up in the .config file:
> 
> # U-Boot 2019.04-rc4 Configuration
> 
> 
> $ grep CONFIG_ENV_OFFSET .config
> CONFIG_ENV_OFFSET=0x88000
> 
> $ grep CONFIG_ENV_SIZE .config
> CONFIG_ENV_SIZE=0x20000
> 
> $ grep EMV_IN_MMC .config
> 
> $ 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

So, -rc4 has a bug that the final release does not, on this platform.
Please try the v2019.04 release first and then if you see the problem
still, continue reporting and also make sure to Cc Jagan, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190409/1d4faf7d/attachment.sig>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] Bug in saveenv handling?
  2019-04-09 21:01     ` U.Mutlu
@ 2019-04-09 21:21       ` U.Mutlu
  2019-04-10  8:00         ` Frank Wunderlich
  0 siblings, 1 reply; 9+ messages in thread
From: U.Mutlu @ 2019-04-09 21:21 UTC (permalink / raw)
  To: u-boot

U.Mutlu wrote on 04/09/2019 11:01 PM:
> U.Mutlu wrote on 04/09/2019 10:53 PM:
>> Frank Wunderlich wrote on 04/09/2019 09:39 PM:
>>> this looks for me like the CONFIG_ENV_OFFSET+CONFIG_ENV_SIZE is overlapping
>>> uboots code
>>>
>>> can you post these values and position of uboot and its size for your device?

$ 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

If you need more data let me know pls.

>>> which env-storage do you use (EMV_IN_MMC or ENV_FAT)?
>>
>> I looked up in the .config file:
>>
>> # U-Boot 2019.04-rc4 Configuration
>>
>>
>> $ grep CONFIG_ENV_OFFSET .config
>> CONFIG_ENV_OFFSET=0x88000
>>
>> $ grep CONFIG_ENV_SIZE .config
>> CONFIG_ENV_SIZE=0x20000
>>
>> $ grep EMV_IN_MMC .config
>
> Maybe EMV_ is a typo and should rather be ENV_ ?
> $ grep -i EMV_ .config
>
> $ 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"
>>
>> Thx
>>
>>>> Gesendet: Dienstag, 09. April 2019 um 21:05 Uhr
>>>> Von: "U.Mutlu" <for-gmane@mutluit.com>
>>>
>>>> It seems u-boot has overwritten parts of itself on the storage medium (uSD
>>>> with FAT boot partition).

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] Bug in saveenv handling?
  2019-04-09 21:09     ` Tom Rini
@ 2019-04-09 23:10       ` U.Mutlu
  0 siblings, 0 replies; 9+ messages in thread
From: U.Mutlu @ 2019-04-09 23:10 UTC (permalink / raw)
  To: u-boot

Tom Rini wrote on 04/09/2019 11:09 PM:
> On Tue, Apr 09, 2019 at 10:53:36PM +0200, U.Mutlu wrote:
>> Frank Wunderlich wrote on 04/09/2019 09:39 PM:
>>> this looks for me like the CONFIG_ENV_OFFSET+CONFIG_ENV_SIZE is overlapping uboots code
>>>
>>> can you post these values and position of uboot and its size for your device?
>>>
>>> which env-storage do you use (EMV_IN_MMC or ENV_FAT)?
>>
>> I looked up in the .config file:
>>
>> # U-Boot 2019.04-rc4 Configuration
>>
> So, -rc4 has a bug that the final release does not, on this platform.
> Please try the v2019.04 release first and then if you see the problem
> still, continue reporting and also make sure to Cc Jagan, thanks!

# U-Boot 2019.04 Configuration

Yes, I too can confirm now that the problem of saveenv overwriting u-boot
doesn't happen in the 2019.04 release version.

But the said crash when issuing the command "scsi scan" is still present,
but this maybe has some other reasons.

Thx.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] Bug in saveenv handling?
  2019-04-09 21:21       ` U.Mutlu
@ 2019-04-10  8:00         ` Frank Wunderlich
  2019-04-10 18:32           ` U.Mutlu
  0 siblings, 1 reply; 9+ messages in thread
From: Frank Wunderlich @ 2019-04-10  8:00 UTC (permalink / raw)
  To: u-boot

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@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"

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] Bug in saveenv handling?
  2019-04-10  8:00         ` Frank Wunderlich
@ 2019-04-10 18:32           ` U.Mutlu
  0 siblings, 0 replies; 9+ messages in thread
From: U.Mutlu @ 2019-04-10 18:32 UTC (permalink / raw)
  To: u-boot

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@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"

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-04-10 18:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-09 19:05 [U-Boot] Bug in saveenv handling? U.Mutlu
2019-04-09 19:39 ` Frank Wunderlich
2019-04-09 20:53   ` U.Mutlu
2019-04-09 21:01     ` U.Mutlu
2019-04-09 21:21       ` U.Mutlu
2019-04-10  8:00         ` Frank Wunderlich
2019-04-10 18:32           ` U.Mutlu
2019-04-09 21:09     ` Tom Rini
2019-04-09 23:10       ` U.Mutlu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox