[U-Boot] [PATCH v2] mx28evk, m28evk: sync extra environment content

Otavio Salvador otavio at ossystems.com.br
Fri May 11 22:39:14 CEST 2012


The environment has been based on mx53loco but keeping the possibility
to easy change the default console device as Freescale and mainline
kernels differ on the device name and inclusing m28evk update commands.

Signed-off-by: Otavio Salvador <otavio at ossystems.com.br>
Cc: Fabio Estevam <fabio.estevam at freescale.com>
Cc: Stefano Babic <sbabic at denx.de>
---
 include/configs/m28evk.h      |   57 +-----------------
 include/configs/mx28-common.h |  129 +++++++++++++++++++++++++++++++++++++++++
 include/configs/mx28evk.h     |   26 +--------
 3 files changed, 133 insertions(+), 79 deletions(-)
 create mode 100644 include/configs/mx28-common.h

diff --git a/include/configs/m28evk.h b/include/configs/m28evk.h
index ebf7e39..ed8166a 100644
--- a/include/configs/m28evk.h
+++ b/include/configs/m28evk.h
@@ -271,60 +271,7 @@
 #endif
 #endif
 
-/*
- * Boot Linux
- */
-#define	CONFIG_CMDLINE_TAG
-#define	CONFIG_SETUP_MEMORY_TAGS
-#define	CONFIG_BOOTDELAY	3
-#define	CONFIG_BOOTFILE		"uImage"
-#define	CONFIG_BOOTARGS		"console=ttyAM0,115200n8 "
-#define	CONFIG_BOOTCOMMAND	"run bootcmd_net"
-#define	CONFIG_LOADADDR		0x42000000
-#define	CONFIG_SYS_LOAD_ADDR	CONFIG_LOADADDR
-#define	CONFIG_OF_LIBFDT
-
-/*
- * Extra Environments
- */
-#define	CONFIG_EXTRA_ENV_SETTINGS					\
-	"update_nand_full_filename=u-boot.nand\0"			\
-	"update_nand_firmware_filename=u-boot.sb\0"			\
-	"update_sd_firmware_filename=u-boot.sd\0"			\
-	"update_nand_firmware_maxsz=0x100000\0"				\
-	"update_nand_stride=0x40\0"	/* MX28 datasheet ch. 12.12 */	\
-	"update_nand_count=0x4\0"	/* MX28 datasheet ch. 12.12 */	\
-	"update_nand_get_fcb_size="	/* Get size of FCB blocks */	\
-		"nand device 0 ; "					\
-		"nand info ; "						\
-		"setexpr fcb_sz ${update_nand_stride} * ${update_nand_count};" \
-		"setexpr update_nand_fcb ${fcb_sz} * ${nand_writesize}\0" \
-	"update_nand_full="		/* Update FCB, DBBT and FW */	\
-		"if tftp ${update_nand_full_filename} ; then "		\
-		"run update_nand_get_fcb_size ; "			\
-		"nand scrub -y 0x0 ${filesize} ; "			\
-		"nand write.raw ${loadaddr} 0x0 ${update_nand_fcb} ; "	\
-		"setexpr update_off ${loadaddr} + ${update_nand_fcb} ; " \
-		"setexpr update_sz ${filesize} - ${update_nand_fcb} ; " \
-		"nand write ${update_off} ${update_nand_fcb} ${update_sz} ; " \
-		"fi\0"							\
-	"update_nand_firmware="		/* Update only firmware */	\
-		"if tftp ${update_nand_firmware_filename} ; then "	\
-		"run update_nand_get_fcb_size ; "			\
-		"setexpr fcb_sz ${update_nand_fcb} * 2 ; " /* FCB + DBBT */ \
-		"setexpr fw_sz ${update_nand_firmware_maxsz} * 2 ; "	\
-		"setexpr fw_off ${fcb_sz} + ${update_nand_firmware_maxsz};" \
-		"nand erase ${fcb_sz} ${fw_sz} ; "			\
-		"nand write ${loadaddr} ${fcb_sz} ${filesize} ; "	\
-		"nand write ${loadaddr} ${fw_off} ${filesize} ; "	\
-		"fi\0"							\
-	"update_sd_firmware="		/* Update the SD firmware partition */ \
-		"if mmc rescan ; then "					\
-		"if tftp ${update_sd_firmware_filename} ; then "	\
-		"setexpr fw_sz ${filesize} / 0x200 ; "	/* SD block size */ \
-		"setexpr fw_sz ${fw_sz} + 1 ; "				\
-		"mmc write ${loadaddr} 0x800 ${fw_sz} ; "		\
-		"fi ; "							\
-		"fi\0"
+/* Boot configuration and environemnt */
+#include "mx28-common.h"
 
 #endif /* __M28_H__ */
diff --git a/include/configs/mx28-common.h b/include/configs/mx28-common.h
new file mode 100644
index 0000000..2fd436c
--- /dev/null
+++ b/include/configs/mx28-common.h
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2012 Otavio Salvador <otavio at ossystems.com.br>
+ * on behalf of O.S. Systems Software LTDA.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+#ifndef __MX28_COMMON_H__
+#define __MX28_COMMON_H__
+
+/*
+ * Boot Linux
+ */
+#define CONFIG_CMDLINE_TAG
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_BOOTDELAY	3
+#define CONFIG_BOOTFILE	"uImage"
+
+#define CONFIG_LOADADDR	0x42000000
+#define CONFIG_SYS_LOAD_ADDR	CONFIG_LOADADDR
+#define CONFIG_OF_LIBFDT
+
+/*
+ * Extra Environments
+ */
+#define	CONFIG_EXTRA_ENV_SETTINGS					\
+	/* Update NAND command set */	\
+	"update_nand_full_filename=u-boot.nand\0"			\
+	"update_nand_firmware_filename=u-boot.sb\0"			\
+	"update_nand_firmware_maxsz=0x100000\0"				\
+	"update_nand_stride=0x40\0"	/* MX28 datasheet ch. 12.12 */	\
+	"update_nand_count=0x4\0"	/* MX28 datasheet ch. 12.12 */	\
+	"update_nand_get_fcb_size="	/* Get size of FCB blocks */	\
+		"nand device 0 ; "					\
+		"nand info ; "						\
+		"setexpr fcb_sz ${update_nand_stride} * ${update_nand_count};" \
+		"setexpr update_nand_fcb ${fcb_sz} * ${nand_writesize}\0" \
+	"update_nand_full="		/* Update FCB, DBBT and FW */	\
+		"if tftp ${update_nand_full_filename} ; then "		\
+		"run update_nand_get_fcb_size ; "			\
+		"nand scrub -y 0x0 ${filesize} ; "			\
+		"nand write.raw ${loadaddr} 0x0 ${update_nand_fcb} ; "	\
+		"setexpr update_off ${loadaddr} + ${update_nand_fcb} ; " \
+		"setexpr update_sz ${filesize} - ${update_nand_fcb} ; " \
+		"nand write ${update_off} ${update_nand_fcb} ${update_sz} ; " \
+		"fi\0"							\
+	"update_nand_firmware="		/* Update only firmware */	\
+		"if tftp ${update_nand_firmware_filename} ; then "	\
+		"run update_nand_get_fcb_size ; "			\
+		"setexpr fcb_sz ${update_nand_fcb} * 2 ; " /* FCB + DBBT */ \
+		"setexpr fw_sz ${update_nand_firmware_maxsz} * 2 ; "	\
+		"setexpr fw_off ${fcb_sz} + ${update_nand_firmware_maxsz};" \
+		"nand erase ${fcb_sz} ${fw_sz} ; "			\
+		"nand write ${loadaddr} ${fcb_sz} ${filesize} ; "	\
+		"nand write ${loadaddr} ${fw_off} ${filesize} ; "	\
+		"fi\0"							\
+	/* Update SDCard command set */ \
+	"update_sd_firmware_filename=u-boot.sd\0"			\
+	"update_sd_firmware="		/* Update the SD firmware partition */ \
+		"if mmc rescan ; then "					\
+		"if tftp ${update_sd_firmware_filename} ; then "	\
+		"setexpr fw_sz ${filesize} / 0x200 ; "	/* SD block size */ \
+		"setexpr fw_sz ${fw_sz} + 1 ; "				\
+		"mmc write ${loadaddr} 0x800 ${fw_sz} ; "		\
+		"fi ; "							\
+		"fi\0" \
+	/* General command set */	\
+	"script=boot.scr\0" \
+	"uimage=uImage\0" \
+	"console_fsl=ttyAM0\0" \
+	"console_mainline=ttyAMA0\0" \
+	"console=${console_mainline}\0" \
+	"baudrate=115200\0" \
+	"mmcdev=0\0" \
+	"mmcpart=2\0" \
+	"mmcroot=/dev/mmcblk0p3 rw\0" \
+	"mmcrootfstype=ext3 rootwait\0" \
+	"mmcargs="	\
+		"setenv bootargs console=${console},${baudrate} "	\
+		"root=${mmcroot} " \
+		"rootfstype=${mmcrootfstype}\0" \
+	"loadbootscript="	\
+		"fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
+	"bootscript="	\
+		"echo Running bootscript from mmc ...; " \
+		"source\0" \
+	"loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \
+	"mmcboot="	\
+		"echo Booting from mmc ...; " \
+		"run mmcargs; " \
+		"bootm\0" \
+	"netargs="	\
+		"setenv bootargs console=${console},${baudrate} " \
+		"root=/dev/nfs " \
+		"ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
+	"netboot="	\
+		"echo Booting from net ...; " \
+		"run netargs; " \
+		"dhcp ${uimage}; bootm\0"
+
+/*
+ * Default Boot command
+ */
+#define CONFIG_BOOTCOMMAND \
+	"if mmc rescan ${mmcdev}; then " \
+		"if run loadbootscript; then " \
+			"run bootscript; " \
+		"else " \
+			"if run loaduimage; then " \
+				"run mmcboot; " \
+			"else run netboot; " \
+			"fi; " \
+		"fi; " \
+	"else run netboot; fi"
+
+
+#endif /* __MX28_COMMON_H__ */
diff --git a/include/configs/mx28evk.h b/include/configs/mx28evk.h
index 5ccfe70..5b51d26 100644
--- a/include/configs/mx28evk.h
+++ b/include/configs/mx28evk.h
@@ -227,29 +227,7 @@
 #endif
 #endif
 
-/*
- * Boot Linux
- */
-#define CONFIG_CMDLINE_TAG
-#define CONFIG_SETUP_MEMORY_TAGS
-#define CONFIG_BOOTDELAY	3
-#define CONFIG_BOOTFILE	"uImage"
-#define CONFIG_BOOTCOMMAND	"run bootcmd_net"
-#define CONFIG_LOADADDR	0x42000000
-#define CONFIG_SYS_LOAD_ADDR	CONFIG_LOADADDR
-#define CONFIG_OF_LIBFDT
-
-/*
- * Extra Environments
- */
-#define CONFIG_EXTRA_ENV_SETTINGS \
-	"console_fsl=console=ttyAM0" \
-	"console_mainline=console=ttyAMA0" \
-	"netargs=setenv bootargs console=${console_mainline}" \
-		"root=/dev/nfs " \
-		"ip=dhcp nfsroot=${serverip}:${nfsroot}\0" \
-	"bootcmd_net=echo Booting from net ...; " \
-		"run netargs; " \
-		"dhcp ${uimage}; bootm\0" \
+/* Boot configuration and environemnt */
+#include "mx28-common.h"
 
 #endif /* __CONFIG_H */
-- 
1.7.10



More information about the U-Boot mailing list