Patchwork [U-Boot,04/13] tricorder: add configuration for a flashcard u-boot

login
register
mail settings
Submitter Andreas Bießmann
Date Sept. 6, 2013, 1:04 p.m.
Message ID <1378472698-18557-4-git-send-email-andreas.devel@googlemail.com>
Download mbox | patch
Permalink /patch/273179/
State Accepted
Delegated to: Tom Rini
Headers show

Comments

Andreas Bießmann - Sept. 6, 2013, 1:04 p.m.
From: Andreas Bießmann <andreas.biessmann@corscience.de>

The 'flashcard' u-boot configuration has a readonly environment and boots a
bare kernel/initrd to program the device from an clean environment.

Signed-off-by: Andreas Bießmann <andreas.biessmann@corscience.de>
---
 boards.cfg                  |    1 +
 include/configs/tricorder.h |   71 ++++++++++++++++++++++++++++++++++---------
 2 files changed, 57 insertions(+), 15 deletions(-)
Wolfgang Denk - Sept. 10, 2013, 10:45 p.m.
Dear Andreas Bießmann,

In message <1378472698-18557-4-git-send-email-andreas.devel@googlemail.com> you wrote:
> 
> The 'flashcard' u-boot configuration has a readonly environment and boots a
> bare kernel/initrd to program the device from an clean environment.

What exactly is a 'flashcard' ?

> +/* environment placement (for NAND), is different for FLASHCARD but does not
> + * harm there */

Incorrect multiline comment style.

>  /* the loadaddr is the same as CONFIG_SYS_LOAD_ADDR, unfortunately the defiend
>   * value can not be used here! */

Ditto.  Please fix globally.

> +/* specific environment settings for different use cases
> + * FLASHCARD: used to run a rdimage from sdcard to program the device
> + * 'NORMAL': used to boot kernel from sdcard, nand, ...

And again...

Best regards,

Wolfgang Denk
Andreas Bießmann - Sept. 11, 2013, 7:08 a.m.
Dear Wolfgang Denk,

On 09/11/2013 12:45 AM, Wolfgang Denk wrote:
> Dear Andreas Bießmann,
> 
> In message <1378472698-18557-4-git-send-email-andreas.devel@googlemail.com> you wrote:
>>
>> The 'flashcard' u-boot configuration has a readonly environment and boots a
>> bare kernel/initrd to program the device from an clean environment.
> 
> What exactly is a 'flashcard' ?

a specific u-boot variant with compiled in environment. So it ignores
environment on devices while upgrading.

>> +/* environment placement (for NAND), is different for FLASHCARD but does not
>> + * harm there */
> 
> Incorrect multiline comment style.
> 
>>  /* the loadaddr is the same as CONFIG_SYS_LOAD_ADDR, unfortunately the defiend
>>   * value can not be used here! */
> 
> Ditto.  Please fix globally.

Will do.

Best regards

Andreas Bießmann

Patch

diff --git a/boards.cfg b/boards.cfg
index be810c7..b219f5d 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -315,6 +315,7 @@  omap3_sdp3430                arm         armv7       sdp3430             ti
 devkit8000                   arm         armv7       devkit8000          timll          omap3
 mcx                          arm         armv7       mcx                 htkw           omap3
 tricorder                    arm         armv7       tricorder           corscience     omap3
+tricorder_flashcard          arm         armv7       tricorder           corscience     omap3   tricorder:FLASHCARD
 twister                      arm         armv7       twister             technexion     omap3
 nokia_rx51                   arm         armv7       rx51                nokia          omap3
 omap4_panda                  arm         armv7       panda               ti             omap4
diff --git a/include/configs/tricorder.h b/include/configs/tricorder.h
index 249ee72..220dbdc 100644
--- a/include/configs/tricorder.h
+++ b/include/configs/tricorder.h
@@ -139,39 +139,86 @@ 
 #define CONFIG_MTD_DEVICE       /* needed for mtdparts commands */
 #define CONFIG_MTD_PARTITIONS
 
-/* Environment information */
-#define CONFIG_ENV_OVERWRITE /* allow to overwrite serial and ethaddr */
+/* Environment information (this is the common part) */
 
 #define CONFIG_BOOTDELAY		3
 
+/* environment placement (for NAND), is different for FLASHCARD but does not
+ * harm there */
+#define CONFIG_ENV_OFFSET		0x120000    /* env start */
+#define CONFIG_ENV_OFFSET_REDUND	0x2A0000    /* redundant env start */
+#define CONFIG_ENV_SIZE			(16 << 10)  /* use 16KiB for env */
+#define CONFIG_ENV_RANGE		(384 << 10) /* allow badblocks in env */
+
 /* the loadaddr is the same as CONFIG_SYS_LOAD_ADDR, unfortunately the defiend
  * value can not be used here! */
 #define CONFIG_LOADADDR		0x82000000
 
-#define CONFIG_EXTRA_ENV_SETTINGS \
+#define CONFIG_COMMON_ENV_SETTINGS \
 	"console=ttyO2,115200n8\0" \
 	"mmcdev=0\0" \
 	"vram=3M\0" \
 	"defaultdisplay=lcd\0" \
-	"kernelopts=rw rootwait\0" \
+	"kernelopts=mtdoops.mtddev=3\0" \
 	"commonargs=" \
 		"setenv bootargs console=${console} " \
 		"${mtdparts} " \
+		"${kernelopts} " \
+		"vt.global_cursor_default=0 " \
 		"vram=${vram} " \
-		"omapdss.def_disp=${defaultdisplay}\0" \
+		"omapdss.def_disp=${defaultdisplay}\0"
+
+#define CONFIG_BOOTCOMMAND "run autoboot"
+
+/* specific environment settings for different use cases
+ * FLASHCARD: used to run a rdimage from sdcard to program the device
+ * 'NORMAL': used to boot kernel from sdcard, nand, ...
+ *
+ * The main aim for the FLASHCARD skin is to have an embedded environment
+ * which will not be influenced by any data already on the device.
+ */
+#ifdef CONFIG_FLASHCARD
+
+#define CONFIG_ENV_IS_NOWHERE
+
+/* the rdaddr is 16 MiB before the loadaddr */
+#define CONFIG_ENV_RDADDR	"rdaddr=0x81000000\0"
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+	CONFIG_COMMON_ENV_SETTINGS \
+	CONFIG_ENV_RDADDR \
+	"autoboot=" \
+	"mtdparts default; " \
+	"run commonargs; " \
+	"setenv bootargs ${bootargs} " \
+		"flashy_updateimg=/dev/mmcblk0p1:corscience_update.img " \
+		"rdinit=/sbin/init; " \
+	"mmc dev ${mmcdev}; mmc rescan; " \
+	"fatload mmc ${mmcdev} ${loadaddr} uImage; " \
+	"fatload mmc ${mmcdev} ${rdaddr} uRamdisk; " \
+	"bootm ${loadaddr} ${rdaddr}\0"
+
+#else /* CONFIG_FLASHCARD */
+
+#define CONFIG_ENV_OVERWRITE /* allow to overwrite serial and ethaddr */
+
+#define CONFIG_ENV_IS_IN_NAND
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+	CONFIG_COMMON_ENV_SETTINGS \
 	"mmcargs=" \
 		"run commonargs; " \
 		"setenv bootargs ${bootargs} " \
 		"root=/dev/mmcblk0p2 " \
-		"${kernelopts}\0" \
+		"rootwait " \
+		"rw\0" \
 	"nandargs=" \
 		"run commonargs; " \
 		"setenv bootargs ${bootargs} " \
-		"omapdss.def_disp=${defaultdisplay} " \
 		"root=ubi0:root " \
 		"ubi.mtd=7 " \
 		"rootfstype=ubifs " \
-		"${kernelopts}\0" \
+		"ro\0" \
 	"loadbootscript=fatload mmc ${mmcdev} ${loadaddr} boot.scr\0" \
 	"bootscript=echo Running bootscript from mmc ...; " \
 		"source ${loadaddr}\0" \
@@ -199,7 +246,7 @@ 
 			"fi; " \
 		"else run nandboot; fi\0"
 
-#define CONFIG_BOOTCOMMAND "run autoboot"
+#endif /* CONFIG_FLASHCARD */
 
 /* Miscellaneous configurable options */
 #define CONFIG_SYS_LONGHELP		/* undef to save memory */
@@ -240,12 +287,6 @@ 
 
 #define CONFIG_SYS_MONITOR_LEN		(256 << 10)	/* Reserve 2 sectors */
 
-#define CONFIG_ENV_IS_IN_NAND
-#define CONFIG_ENV_OFFSET		0x120000    /* env start */
-#define CONFIG_ENV_OFFSET_REDUND	0x2A0000    /* redundant env start */
-#define CONFIG_ENV_SIZE			(16 << 10)  /* use 16KiB for env */
-#define CONFIG_ENV_RANGE		(384 << 10) /* allow badblocks in env */
-
 #define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM_1
 #define CONFIG_SYS_INIT_RAM_ADDR	0x4020f800
 #define CONFIG_SYS_INIT_RAM_SIZE	0x800