Patchwork [05/16] Add SD-Card boot with environment support to u-boot-2009.11

login
register
mail settings
Submitter Ulf Samuelsson
Date Jan. 31, 2011, 8:58 p.m.
Message ID <1296507499-5245-6-git-send-email-ulf.samuelsson@atmel.com>
Download mbox | patch
Permalink /patch/432/
State Superseded
Headers show

Comments

Ulf Samuelsson - Jan. 31, 2011, 8:58 p.m.
Signed-off-by: Ulf Samuelsson <ulf.samuelsson@atmel.com>
---
 .../at91/0016-SupportEnv-load-from-SD-Card.patch   |  126 ++++++++++++++++++++
 recipes/u-boot/u-boot_2009.11.bb                   |    3 +-
 2 files changed, 128 insertions(+), 1 deletions(-)
 create mode 100644 recipes/u-boot/u-boot-2009.11/at91/0016-SupportEnv-load-from-SD-Card.patch

Patch

diff --git a/recipes/u-boot/u-boot-2009.11/at91/0016-SupportEnv-load-from-SD-Card.patch b/recipes/u-boot/u-boot-2009.11/at91/0016-SupportEnv-load-from-SD-Card.patch
new file mode 100644
index 0000000..a5e9ddf
--- /dev/null
+++ b/recipes/u-boot/u-boot-2009.11/at91/0016-SupportEnv-load-from-SD-Card.patch
@@ -0,0 +1,126 @@ 
+diff -urN u-boot-2009.11/common/cmd_factory.c u-boot-2009.11-OK/common/cmd_factory.c
+--- u-boot-2009.11/common/cmd_factory.c	1970-01-01 01:00:00.000000000 +0100
++++ u-boot-2009.11-OK/common/cmd_factory.c	2010-09-26 21:39:09.000000000 +0200
+@@ -0,0 +1,46 @@
++/*
++ * (C) Copyright 2010
++ * Ulf Samuelsson <ulf.samuelsson@atmel.com>
++ *
++ * See file CREDITS for list of people who contributed to this
++ * project.
++ *
++ * 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
++ */
++
++#include <common.h>
++#include <command.h>
++#include <debug.h>
++
++#undef	DEBUG
++#if	defined(DEBUG)
++#define pr_debug(fmt, args...) 		printf(fmt, ##args)
++#else
++#define pr_debug(...) do { } while(0)
++#endif
++
++extern set_default_env(void);
++int do_factory (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
++{
++	set_default_env();	
++	return 0;
++}
++
++U_BOOT_CMD(
++	factory, 1, 0, do_factory,
++	"factory\t- set factory default environment\n",
++	"\n"
++);
+diff -urN u-boot-2009.11/common/Makefile u-boot-2009.11-OK/common/Makefile
+--- u-boot-2009.11/common/Makefile	2011-01-26 01:26:46.000000000 +0100
++++ u-boot-2009.11-OK/common/Makefile	2010-09-26 21:27:30.000000000 +0200
+@@ -88,6 +88,7 @@
+ COBJS-$(CONFIG_CMD_EEPROM) += cmd_eeprom.o
+ COBJS-$(CONFIG_CMD_ELF) += cmd_elf.o
+ COBJS-$(CONFIG_CMD_EXT2) += cmd_ext2.o
++COBJS-$(CONFIG_CMD_FACTORY) += cmd_factory.o
+ COBJS-$(CONFIG_CMD_FAT) += cmd_fat.o
+ COBJS-$(CONFIG_CMD_FDC)$(CONFIG_CMD_FDOS) += cmd_fdc.o
+ COBJS-$(CONFIG_OF_LIBFDT) += cmd_fdt.o fdt_support.o
+diff -urN u-boot-2009.11/include/configs/at91sam9m10g45ek.h u-boot-2009.11-OK/include/configs/at91sam9m10g45ek.h
+--- u-boot-2009.11/include/configs/at91sam9m10g45ek.h	2011-01-26 01:26:46.000000000 +0100
++++ u-boot-2009.11-OK/include/configs/at91sam9m10g45ek.h	2011-01-15 23:18:18.000000000 +0100
+@@ -28,6 +28,7 @@
+ #define __CONFIG_H
+ #define	CONFIG_CMD_DEBUG	1
+ #define	CONFIG_SYS_ROOTFS_SD	1
++#define	CONFIG_CMD_FACTORY	1
+ /* ARM asynchronous clock */
+ #define AT91_MAIN_CLOCK		12000000	/* from 12 MHz crystal */
+ #define CONFIG_SYS_HZ		1000
+@@ -105,6 +106,8 @@
+ #define CONFIG_CMD_FAT
+ #undef CONFIG_CMD_JFFS2
+ #define CONFIG_CMD_MMC
++#define CONFIG_CMD_AUTOSCRIPT
++
+ #define CONFIG_CMD_PING		1
+ #define CONFIG_CMD_DHCP		1
+ #define CONFIG_CMD_NAND		1
+@@ -219,9 +222,19 @@
+ #endif
+ 
+ #ifdef	CONFIG_SYS_ROOTFS_SD
+-#define CONFIG_BOOTCOMMAND	"mmc init; fatload mmc 1:1 0x72000000 uImage; bootm 0x72000000"
+-#define CONFIG_BOOTARGS		"console=ttyS0,115200 " \
+-				"root=/dev/mmcblk1p2 " \
++#define CONFIG_EXTRA_ENV_SETTINGS	\
++	"load_env=fatload mmc 0:1 0x70000000 u-boot.env ; source 0x70000000 \0"	\
++	"load_kernel=fatload mmc 0:1 0x72000000 uimage\0"	\
++	"at91sam9m10ekes=9cd\0"	\
++	"at91sam9g45ekes=8a4\0"	\
++	"at91sam9m10g45ek=726\0"	\
++	"machid=726\0"
++
++
++#define CONFIG_BOOTCOMMAND	"mmc init; run load_env ; run load_kernel ; bootm 0x72000000"
++#define CONFIG_BOOTARGS		"mem=128M "	\
++				"console=ttyS0,115200 " \
++				"root=/dev/mmcblk0p2 " \
+ 				"rootdelay=2 "\
+ 				"rootfstype=rootfs rw"
+ #endif
+diff -urN u-boot-2009.11/Makefile u-boot-2009.11-OK/Makefile
+--- u-boot-2009.11/Makefile	2011-01-26 01:26:46.000000000 +0100
++++ u-boot-2009.11-OK/Makefile	2010-09-26 21:46:35.000000000 +0200
+@@ -295,7 +295,7 @@
+ #########################################################################
+ 
+ # Always append ALL so that arch config.mk's can add custom ones
+-ALL += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map $(U_BOOT_NAND) $(U_BOOT_ONENAND)
++ALL += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)U-BOOT.BIN $(obj)System.map $(U_BOOT_NAND) $(U_BOOT_ONENAND)
+ 
+ all:		$(ALL)
+ 
+@@ -308,6 +308,9 @@
+ $(obj)u-boot.bin:	$(obj)u-boot
+ 		$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
+ 
++$(obj)U-BOOT.BIN:	$(obj)u-boot
++		$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
++
+ $(obj)u-boot.ldr:	$(obj)u-boot
+ 		$(obj)tools/envcrc --binary > $(obj)env-ldr.o
+ 		$(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS)
diff --git a/recipes/u-boot/u-boot_2009.11.bb b/recipes/u-boot/u-boot_2009.11.bb
index 90a9089..05f82b5 100644
--- a/recipes/u-boot/u-boot_2009.11.bb
+++ b/recipes/u-boot/u-boot_2009.11.bb
@@ -1,4 +1,4 @@ 
-PR = "r1"
+PR = "r2"
 require u-boot.inc
 
 DEFAULT_PREFERENCE = "-1"
@@ -28,6 +28,7 @@  SRC_URI_append_at91 = "\
 	file://at91/0013-atmel_dataflash.c-Status-printout-depend-on-DEBUG.patch \
 	file://at91/0014-AT91-MCI-Add-support-for-SD-Card.patch \
 	file://at91/0015-sam9m10g45ek-Add-configuration-file.patch \
+	file://at91/0016-SupportEnv-load-from-SD-Card.patch \
 	"
 
 SRC_URI_append_adb4000 = "\