Skip to contentSkip to conversation

at91sam9x5: mmc: save environment as a file in FAT partition.

PATCH New Josh Wu 3 participants 5 messages Jan 22, 2013 – Mar 11, 2013 Arm/Microchip (AT91) SoC support

lore
Share & tools
lore

Josh Wu

author
#0 lore raw

PATCH 1/1 at91sam9x5: mmc: save environment as a file in FAT partition.

This patch will save U-Boot environment as a file: uboot.env, in FAT partition instead of saving it in raw sector of SD card.
Since saving environment in raw sector has risk of corrupting the SD card and only can use very small size.
Save as a FAT file has no above limitation.

---
this patch is based on v2013.01.

 include/configs/at91sam9x5ek.h |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
include/configs/at91sam9x5ek.h +7 -5
index 6fac5ac..b01bb30 100644
@@ -217,11 +217,13 @@
 				"bootm 0x22000000"
 #else /* CONFIG_SYS_USE_MMC */
 /* bootstrap + u-boot + env + linux in mmc */
-#define CONFIG_ENV_IS_IN_MMC
-/* For FAT system, most cases it should be in the reserved sector */
-#define CONFIG_ENV_OFFSET	0x2000
-#define CONFIG_ENV_SIZE		0x1000
-#define CONFIG_SYS_MMC_ENV_DEV	0
+#define CONFIG_ENV_IS_IN_FAT
+#define CONFIG_FAT_WRITE
+#define FAT_ENV_INTERFACE	"mmc"
+#define FAT_ENV_FILE		"uboot.env"
+#define FAT_ENV_DEVICE		0
+#define FAT_ENV_PART		1
+#define CONFIG_ENV_SIZE		0x4000
 #endif
 
 #ifdef CONFIG_SYS_USE_MMC
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 at91sam9x5: mmc: save environment as a file in FAT partition.

Hi Josh,

Quoted 6 lines · Josh Wu

This patch will save U-Boot environment as a file: uboot.env, in FAT partition instead of saving it in raw sector of SD card.
Since saving environment in raw sector has risk of corrupting the SD card and only can use very small size.
Save as a FAT file has no above limitation.

Quoted 6 lines

---
this patch is based on v2013.01.

  include/configs/at91sam9x5ek.h |   12 +++++++-----
  1 file changed, 7 insertions(+), 5 deletions(-)

When I test this on at91sam9g35ek board, execute "saveenv", it will report following information, any information for this?
----------------------------
U-Boot 2013.01-00001-g4ab0497 (Jan 23 2013 - 17:12:28)

CPU: AT91SAM9G35
Crystal frequency:       12 MHz
CPU clock        :      400 MHz
Master clock     :  133.333 MHz
DRAM:  128 MiB
WARNING: Caches not enabled
NAND:  No NAND device found!!!
atmel_nand: Fail to initialize #0 chip0 MiB
MMC:   mci: 0
mci: setting clock 260416 Hz, block size 512
mci: setting clock 260416 Hz, block size 512
mci: setting clock 260416 Hz, block size 512
mci: setting clock 260416 Hz, block size 512
mci: setting clock 22222222 Hz, block size 512

** Partition 1 not valid on device 0 ** Failed to register mmc0:1
Using default environment

In:    serial
Out:   serial
Err:   serial
Net:   macb0
Warning: failed to set MAC address

U-Boot> saveenv
Saving Environment to FAT...
mci: setting clock 260416 Hz, block size 512
mci: setting clock 22222222 Hz, block size 512
mci: setting clock 260416 Hz, block size 512
mci: setting clock 260416 Hz, block size 512
mci: setting clock 22222222 Hz, block size 512 ** Partition 1 not valid on device 0 ** Failed to register mmc0:1
------------------------------------------------

Best Regards,
Bo Shen

author
#2 lore raw

PATCH 1/1 at91sam9x5: mmc: save environment as a file in FAT partition.

Hi, Bo Shen

Sorry for the late reply. I am taken over by other stuff. check my comments below.

Quoted 15 lines · Bo Shen

Hi Josh,

Quoted 12 lines · Josh Wu

This patch will save U-Boot environment as a file: uboot.env, in FAT partition
instead of saving it in raw sector of SD card.
Since saving environment in raw sector has risk of corrupting the SD card and
only can use very small size.
Save as a FAT file has no above limitation.

---
this patch is based on v2013.01.

Quoted 5 lines
Quoted 2 lines
  include/configs/at91sam9x5ek.h |   12 +++++++-----
  1 file changed, 7 insertions(+), 5 deletions(-)

When I test this on at91sam9g35ek board, execute "saveenv", it will report following information, any information for this?

I also tested some sd card, and I meet this issue you met too. In such situation, the command "mmc part" will report a unknow partition error.
I suspect the issue is caused by either mmc driver or FAT partition part of code.
And I will continue digging this issue. Thanks for report the errors.

Best Regards,
Josh Wu

Quoted 40 lines

----------------------------
U-Boot 2013.01-00001-g4ab0497 (Jan 23 2013 - 17:12:28)

CPU: AT91SAM9G35
Crystal frequency:       12 MHz
CPU clock        :      400 MHz
Master clock     :  133.333 MHz
DRAM:  128 MiB
WARNING: Caches not enabled
NAND:  No NAND device found!!!
atmel_nand: Fail to initialize #0 chip0 MiB
MMC:   mci: 0
mci: setting clock 260416 Hz, block size 512
mci: setting clock 260416 Hz, block size 512
mci: setting clock 260416 Hz, block size 512
mci: setting clock 260416 Hz, block size 512
mci: setting clock 22222222 Hz, block size 512

** Partition 1 not valid on device 0 ** Failed to register mmc0:1
Using default environment

In:    serial
Out:   serial
Err:   serial
Net:   macb0
Warning: failed to set MAC address

U-Boot> saveenv
Saving Environment to FAT...
mci: setting clock 260416 Hz, block size 512
mci: setting clock 22222222 Hz, block size 512
mci: setting clock 260416 Hz, block size 512
mci: setting clock 260416 Hz, block size 512
mci: setting clock 22222222 Hz, block size 512 ** Partition 1 not valid on device 0 ** Failed to register mmc0:1
------------------------------------------------

Best Regards,
Bo Shen

#3 lore raw

PATCH 1/1 at91sam9x5: mmc: save environment as a file in FAT partition.

Dear Josh Wu,

Quoted 27 lines · Josh Wu

Hi, Bo Shen

Sorry for the late reply. I am taken over by other stuff. check my comments below.

Quoted 15 lines · Bo Shen

Hi Josh,

Quoted 12 lines · Josh Wu

This patch will save U-Boot environment as a file: uboot.env, in FAT partition
instead of saving it in raw sector of SD card.
Since saving environment in raw sector has risk of corrupting the SD card and
only can use very small size.
Save as a FAT file has no above limitation.

---
this patch is based on v2013.01.

Quoted 5 lines
Quoted 2 lines
  include/configs/at91sam9x5ek.h |   12 +++++++-----
  1 file changed, 7 insertions(+), 5 deletions(-)

When I test this on at91sam9g35ek board, execute "saveenv", it will report following information, any information for this?

Quoted 6 lines

I also tested some sd card, and I meet this issue you met too. In such situation, the command "mmc part" will report a unknow partition error.
I suspect the issue is caused by either mmc driver or FAT partition part of code.
And I will continue digging this issue. Thanks for report the errors.

Have you an updated version of this patch?

Best regards

Andreas Bie?mann

author
#4 lore raw

PATCH 1/1 at91sam9x5: mmc: save environment as a file in FAT partition.

On 3/10/2013 11:55 PM, Andreas Bie?mann wrote:

Hi, Andreas

Quoted 30 lines

Dear Josh Wu,

Quoted 27 lines · Josh Wu

Hi, Bo Shen

Sorry for the late reply. I am taken over by other stuff. check my comments below.

Quoted 20 lines · Bo Shen

Hi Josh,

Quoted 8 lines · Josh Wu

This patch will save U-Boot environment as a file: uboot.env, in FAT partition
instead of saving it in raw sector of SD card.
Since saving environment in raw sector has risk of corrupting the SD card and
only can use very small size.
Save as a FAT file has no above limitation.

Quoted 6 lines

---
this patch is based on v2013.01.

  include/configs/at91sam9x5ek.h |   12 +++++++-----
  1 file changed, 7 insertions(+), 5 deletions(-)

When I test this on at91sam9g35ek board, execute "saveenv", it will report following information, any information for this?

Quoted 8 lines
Quoted 6 lines

I also tested some sd card, and I meet this issue you met too. In such situation, the command "mmc part" will report a unknow partition error.
I suspect the issue is caused by either mmc driver or FAT partition part of code.
And I will continue digging this issue. Thanks for report the errors.

Have you an updated version of this patch?

Sorry, I didn't follow up this issue yet. So no update so far. I will continue work on it when I have time.

Best Regards,
Josh Wu

Quoted 4 lines

Best regards

Andreas Bie?mann