[U-Boot] Can I read env from RAM in uboot script?

John Stile
2013-01-29T17:33:38Z

On Tue, 2013-01-29 at 17:58 +0800, Bo Shen wrote:
>
> You should use at91sam9g20ek_2mmc_nandflash to configure the u-boot
>
> ------------------------------------------------
> diff --git a/board/atmel/at91sam9260ek/at91sam9260ek.c
> b/board/atmel/at91sam9260ek/at91sam9260ek.c
> index 2555672..ce475df 100644
> --- a/board/atmel/at91sam9260ek/at91sam9260ek.c
> +++ b/board/atmel/at91sam9260ek/at91sam9260ek.c
> @@ -157,6 +157,10 @@ int board_early_init_f(void)
>
> int board_init(void)
> {
> +#ifdef CONFIG_AT91SAM9G20EK_2MMC
> + /* arch number of AT91SAM9260EK-Board */
> + gd->bd->bi_arch_number = MACH_TYPE_AT91SAM9G20EK_2MMC;
> +#else
> #ifdef CONFIG_AT91SAM9G20EK
> /* arch number of AT91SAM9260EK-Board */
> gd->bd->bi_arch_number = MACH_TYPE_AT91SAM9G20EK;
> @@ -164,6 +168,7 @@ int board_init(void)
> /* arch number of AT91SAM9260EK-Board */
> gd->bd->bi_arch_number = MACH_TYPE_AT91SAM9260EK;
> #endif
> +#endif
> /* adress of boot parameters */
> gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
>
> diff --git a/boards.cfg b/boards.cfg
> index e4b0d44..fa863dc 100644
> --- a/boards.cfg
> +++ b/boards.cfg
> @@ -95,6 +95,7 @@ at91sam9g10ek_nandflash arm arm926ejs
> at91sam9261ek atmel
> at91sam9g20ek_dataflash_cs0 arm arm926ejs at91sam9260ek
> atmel at91
> at91sam9260ek:AT91SAM9G20,SYS_USE_DATAFLASH_CS0
> at91sam9g20ek_dataflash_cs1 arm arm926ejs at91sam9260ek
> atmel at91
> at91sam9260ek:AT91SAM9G20,SYS_USE_DATAFLASH_CS1
> at91sam9g20ek_nandflash arm arm926ejs at91sam9260ek
> atmel at91
> at91sam9260ek:AT91SAM9G20,SYS_USE_NANDFLASH
> +at91sam9g20ek_2mmc_nandflash arm arm926ejs at91sam9260ek
> atmel at91
> at91sam9260ek:AT91SAM9G20,AT91SAM9G20EK_2MMC,SYS_USE_NANDFLASH
> at91sam9m10g45ek_nandflash arm arm926ejs
> at91sam9m10g45ek
> atmel at91
> at91sam9m10g45ek:AT91SAM9M10G45,SYS_USE_NANDFLASH
> at91sam9rlek_dataflash arm arm926ejs at91sam9rlek
> atmel at91
> at91sam9rlek:AT91SAM9RL,SYS_USE_DATAFLASH
> at91sam9rlek_nandflash arm arm926ejs at91sam9rlek
> atmel at91
> at91sam9rlek:AT91SAM9RL,SYS_USE_NANDFLASH
> ---------------------------------------------------------------------------
>
>
That worked! Very nice! But, I had to apply the patches manually.
Email may have messed up the patch sets with new-lines and indentation.
Can this be added to the main stream? I am on to learning 'env import'.
Thank you.

If email messed it up once, I guess it could mess it up again, but I
generated patches using:
diff -Naur before/ after/ > diff.patch

--- board/atmel/at91sam9260ek/at91sam9260ek.c.orig 2013-01-29 09:09:35.000000000 -0800
+++ board/atmel/at91sam9260ek/at91sam9260ek.c 2013-01-29 09:10:46.000000000 -0800
@@ -157,6 +157,10 @@

int board_init(void)
{
+#ifdef CONFIG_AT91SAM9G20EK_2MMC
+ /* arch number of AT91SAM9260EK-Board */
+ gd->bd->bi_arch_number = MACH_TYPE_AT91SAM9G20EK_2MMC;
+#else
#ifdef CONFIG_AT91SAM9G20EK
/* arch number of AT91SAM9260EK-Board */
gd->bd->bi_arch_number = MACH_TYPE_AT91SAM9G20EK;
@@ -164,6 +168,7 @@
/* arch number of AT91SAM9260EK-Board */
gd->bd->bi_arch_number = MACH_TYPE_AT91SAM9260EK;
#endif
+#endif
/* adress of boot parameters */
gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;

--- boards.cfg.orig 2013-01-29 08:56:47.000000000 -0800
+++ boards.cfg 2013-01-29 08:58:21.000000000 -0800
@@ -94,6 +94,7 @@
at91sam9g10ek_nandflash arm arm926ejs at91sam9261ek atmel at91 at91sam9261ek:AT91SAM9G10,SYS_USE_NANDFLASH
at91sam9g20ek_dataflash_cs0 arm arm926ejs at91sam9260ek atmel at91 at91sam9260ek:AT91SAM9G20,SYS_USE_DATAFLASH_CS0
at91sam9g20ek_dataflash_cs1 arm arm926ejs at91sam9260ek atmel at91 at91sam9260ek:AT91SAM9G20,SYS_USE_DATAFLASH_CS1
+at91sam9g20ek_2mmc_nandflash arm arm926ejs at91sam9260ek atmel at91 at91sam9260ek:AT91SAM9G20,AT91SAM9G20EK_2MMC,SYS_USE_NANDFLASH
at91sam9g20ek_nandflash arm arm926ejs at91sam9260ek atmel at91 at91sam9260ek:AT91SAM9G20,SYS_USE_NANDFLASH
at91sam9m10g45ek_nandflash arm arm926ejs at91sam9m10g45ek atmel at91 at91sam9m10g45ek:AT91SAM9M10G45,SYS_USE_NANDFLASH
at91sam9rlek_dataflash arm arm926ejs at91sam9rlek atmel at91 at91sam9rlek:AT91SAM9RL,SYS_USE_DATAFLASH