mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/5] defaultenv: introduce CONFIG_DEFAULT_ENVIRONMENT_GENERIC to enable it
@ 2010-10-07 16:37 Jean-Christophe PLAGNIOL-VILLARD
  2010-10-07 16:37 ` [PATCH 2/5] commands/crc32: add compare 2 files crc Jean-Christophe PLAGNIOL-VILLARD
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-10-07 16:37 UTC (permalink / raw)
  To: barebox

this will we usefull to enable functionnality if used

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/configs/neso_defconfig   |    3 ++-
 arch/arm/configs/pca100_defconfig |    3 ++-
 arch/arm/configs/pcm037_defconfig |    3 ++-
 arch/arm/configs/pcm038_defconfig |    3 ++-
 arch/arm/configs/pcm043_defconfig |    3 ++-
 common/Kconfig                    |    7 +++++++
 common/Makefile                   |    4 ++++
 7 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/arch/arm/configs/neso_defconfig b/arch/arm/configs/neso_defconfig
index 9f6e3f4..24125f9 100644
--- a/arch/arm/configs/neso_defconfig
+++ b/arch/arm/configs/neso_defconfig
@@ -12,7 +12,8 @@ CONFIG_HUSH_FANCY_PROMPT=y
 CONFIG_CMDLINE_EDITING=y
 CONFIG_AUTO_COMPLETE=y
 CONFIG_PARTITION=y
-CONFIG_DEFAULT_ENVIRONMENT_PATH="defaultenv arch/arm/boards/guf-neso/env"
+CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y
+CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/guf-neso/env"
 CONFIG_CMD_EDIT=y
 CONFIG_CMD_SLEEP=y
 CONFIG_CMD_SAVEENV=y
diff --git a/arch/arm/configs/pca100_defconfig b/arch/arm/configs/pca100_defconfig
index d1708a6..8c72bdf 100644
--- a/arch/arm/configs/pca100_defconfig
+++ b/arch/arm/configs/pca100_defconfig
@@ -12,7 +12,8 @@ CONFIG_HUSH_FANCY_PROMPT=y
 CONFIG_CMDLINE_EDITING=y
 CONFIG_AUTO_COMPLETE=y
 CONFIG_PARTITION=y
-CONFIG_DEFAULT_ENVIRONMENT_PATH="defaultenv arch/arm/boards/phycard-i.MX27/env"
+CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y
+CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/phycard-i.MX27/env"
 CONFIG_CMD_EDIT=y
 CONFIG_CMD_SLEEP=y
 CONFIG_CMD_SAVEENV=y
diff --git a/arch/arm/configs/pcm037_defconfig b/arch/arm/configs/pcm037_defconfig
index 8e60b0a..e12f690 100644
--- a/arch/arm/configs/pcm037_defconfig
+++ b/arch/arm/configs/pcm037_defconfig
@@ -10,7 +10,8 @@ CONFIG_HUSH_FANCY_PROMPT=y
 CONFIG_CMDLINE_EDITING=y
 CONFIG_AUTO_COMPLETE=y
 CONFIG_PARTITION=y
-CONFIG_DEFAULT_ENVIRONMENT_PATH="defaultenv arch/arm/boards/pcm037/env"
+CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y
+CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/pcm037/env"
 CONFIG_CMD_EDIT=y
 CONFIG_CMD_SLEEP=y
 CONFIG_CMD_SAVEENV=y
diff --git a/arch/arm/configs/pcm038_defconfig b/arch/arm/configs/pcm038_defconfig
index eacbbc6..2038f14 100644
--- a/arch/arm/configs/pcm038_defconfig
+++ b/arch/arm/configs/pcm038_defconfig
@@ -13,7 +13,8 @@ CONFIG_HUSH_FANCY_PROMPT=y
 CONFIG_CMDLINE_EDITING=y
 CONFIG_AUTO_COMPLETE=y
 CONFIG_PARTITION=y
-CONFIG_DEFAULT_ENVIRONMENT_PATH="defaultenv arch/arm/boards/pcm038/env"
+CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y
+CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/pcm038/env"
 CONFIG_CMD_EDIT=y
 CONFIG_CMD_SLEEP=y
 CONFIG_CMD_SAVEENV=y
diff --git a/arch/arm/configs/pcm043_defconfig b/arch/arm/configs/pcm043_defconfig
index 51ca833..2dd711b 100644
--- a/arch/arm/configs/pcm043_defconfig
+++ b/arch/arm/configs/pcm043_defconfig
@@ -13,7 +13,8 @@ CONFIG_HUSH_FANCY_PROMPT=y
 CONFIG_CMDLINE_EDITING=y
 CONFIG_AUTO_COMPLETE=y
 CONFIG_PARTITION=y
-CONFIG_DEFAULT_ENVIRONMENT_PATH="defaultenv arch/arm/boards/pcm043/env"
+CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y
+CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/pcm043/env"
 CONFIG_CMD_EDIT=y
 CONFIG_CMD_SLEEP=y
 CONFIG_CMD_SAVEENV=y
diff --git a/common/Kconfig b/common/Kconfig
index ad70cde..485133e 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -382,6 +382,13 @@ config DEFAULT_ENVIRONMENT
 	  Enabling this option will give you a default environment when
 	  the environment found in the environment sector is invalid
 
+config DEFAULT_ENVIRONMENT_GENERIC
+	bool
+	depends on DEFAULT_ENVIRONMENT
+	prompt "Default environment generic"
+	help
+	  Generic barebox default env
+
 config DEFAULT_ENVIRONMENT_PATH
 	string
 	depends on DEFAULT_ENVIRONMENT
diff --git a/common/Makefile b/common/Makefile
index e56dbc2..b42ab7a 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -26,6 +26,10 @@ ifdef CONFIG_DEFAULT_ENVIRONMENT
 $(obj)/startup.o: include/generated/barebox_default_env.h
 $(obj)/env.o: include/generated/barebox_default_env.h
 
+ifeq ($(CONFIG_DEFAULT_ENVIRONMENT_GENERIC),y)
+CONFIG_DEFAULT_ENVIRONMENT_PATH += defaultenv
+endif
+
 ENV_FILES := $(shell cd $(srctree); for i in $(CONFIG_DEFAULT_ENVIRONMENT_PATH); do find $${i} -type f -exec readlink -f {} \;; done)
 
 endif # ifdef CONFIG_DEFAULT_ENVIRONMENT
-- 
1.7.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2/5] commands/crc32: add compare 2 files crc
  2010-10-07 16:37 [PATCH 1/5] defaultenv: introduce CONFIG_DEFAULT_ENVIRONMENT_GENERIC to enable it Jean-Christophe PLAGNIOL-VILLARD
@ 2010-10-07 16:37 ` Jean-Christophe PLAGNIOL-VILLARD
  2010-10-07 16:37 ` [PATCH 3/5] defaultenv: add xmodem support for update Jean-Christophe PLAGNIOL-VILLARD
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-10-07 16:37 UTC (permalink / raw)
  To: barebox

add -F options to compare to file crc

it's usefull to compare what you flash in a partition

it's selectable by CONFIG_CMD_CRC_CMP

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 commands/Kconfig |    5 ++
 commands/crc.c   |  111 ++++++++++++++++++++++++++++++++++++------------------
 2 files changed, 79 insertions(+), 37 deletions(-)

diff --git a/commands/Kconfig b/commands/Kconfig
index 0fc80aa..5416073 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -202,6 +202,11 @@ config CMD_CRC
 	select CRC32
 	prompt "crc"
 
+config CMD_CRC_CMP
+	tristate
+	depends on CMD_CRC
+	prompt "compare 2 files crc"
+
 config CMD_MTEST
 	tristate
 	prompt "mtest"
diff --git a/commands/crc.c b/commands/crc.c
index 4842cdc..d3e0865 100644
--- a/commands/crc.c
+++ b/commands/crc.c
@@ -30,20 +30,80 @@
 #include <malloc.h>
 #include <linux/ctype.h>
 
+static int file_crc(char* filename, ulong start, ulong size, ulong *crc,
+		    ulong *total)
+{
+	int fd, now;
+	int ret = 0;
+	char *buf;
+
+	*total = 0;
+	*crc = 0;
+
+	fd = open(filename, O_RDONLY);
+	if (fd < 0) {
+		printf("open %s: %s\n", filename, errno_str());
+		return fd;
+	}
+
+	if (start > 0) {
+		ret = lseek(fd, start, SEEK_SET);
+		if (ret == -1) {
+			perror("lseek");
+			goto out;
+		}
+	}
+
+	buf = xmalloc(4096);
+
+	while (size) {
+		now = min((ulong)4096, size);
+		now = read(fd, buf, now);
+		if (now < 0) {
+			ret = now;
+			perror("read");
+			goto out_free;
+		}
+		if (!now)
+			break;
+		*crc = crc32(*crc, buf, now);
+		size -= now;
+		*total += now;
+	}
+
+	printf ("CRC32 for %s 0x%08lx ... 0x%08lx ==> 0x%08lx",
+			filename, start, start + *total - 1, *crc);
+
+out_free:
+	free(buf);
+out:
+	close(fd);
+
+	return ret;
+}
+
 static int do_crc(struct command *cmdtp, int argc, char *argv[])
 {
 	ulong start = 0, size = ~0, total = 0;
 	ulong crc = 0, vcrc = 0;
 	char *filename = "/dev/mem";
-	char *buf;
-	int fd, opt, err = 0, filegiven = 0, verify = 0, now;
+#ifdef CONFIG_CMD_CRC_CMP
+	char *vfilename = NULL;
+#endif
+	int opt, err = 0, filegiven = 0, verify = 0;
 
-	while((opt = getopt(argc, argv, "f:v:")) > 0) {
+	while((opt = getopt(argc, argv, "f:F:v:")) > 0) {
 		switch(opt) {
 		case 'f':
 			filename = optarg;
 			filegiven = 1;
 			break;
+#ifdef CONFIG_CMD_CRC_CMP
+		case 'F':
+			verify = 1;
+			vfilename = optarg;
+			break;
+#endif
 		case 'v':
 			verify = 1;
 			vcrc = simple_strtoul(optarg, NULL, 0);
@@ -61,38 +121,17 @@ static int do_crc(struct command *cmdtp, int argc, char *argv[])
 		}
 	}
 
-	fd = open(filename, O_RDONLY);
-	if (fd < 0) {
-		printf("open %s: %s\n", filename, errno_str());
+	if (file_crc(filename, start, size, &crc, &total) < 0)
 		return 1;
-	}
 
-	if (start > 0) {
-		if (lseek(fd, start, SEEK_SET) == -1) {
-			perror("lseek");
-			err = 1;
-			goto out;
-		}
-	}
-
-	buf = xmalloc(4096);
-
-	while (size) {
-		now = min((ulong)4096, size);
-		now = read(fd, buf, now);
-		if (now < 0) {
-			perror("read");
-			goto out_free;
-		}
-		if (!now)
-			break;
-		crc = crc32(crc, buf, now);
-		size -= now;
-		total += now;
+#ifdef CONFIG_CMD_CRC_CMP
+	if (vfilename) {
+		size = total;
+		puts("\n");
+		if (file_crc(vfilename, start, size, &vcrc, &total) < 0)
+			return 1;
 	}
-
-	printf ("CRC32 for %s 0x%08lx ... 0x%08lx ==> 0x%08lx",
-			filename, start, start + total - 1, crc);
+#endif
 
 	if (verify && crc != vcrc) {
 		printf(" != 0x%08x ** ERROR **", vcrc);
@@ -101,11 +140,6 @@ static int do_crc(struct command *cmdtp, int argc, char *argv[])
 
 	printf("\n");
 
-out_free:
-	free(buf);
-out:
-	close(fd);
-
 	return err;
 }
 
@@ -114,6 +148,9 @@ static const __maybe_unused char cmd_crc_help[] =
 "Calculate a crc32 checksum of a memory area\n"
 "Options:\n"
 "  -f <file>   Use file instead of memory\n"
+#ifdef CONFIG_CMD_CRC_CMP
+"  -F <file>   Use file to compare\n"
+#endif
 "  -v <crc>    Verfify\n";
 
 BAREBOX_CMD_START(crc32)
-- 
1.7.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 3/5] defaultenv: add xmodem support for update
  2010-10-07 16:37 [PATCH 1/5] defaultenv: introduce CONFIG_DEFAULT_ENVIRONMENT_GENERIC to enable it Jean-Christophe PLAGNIOL-VILLARD
  2010-10-07 16:37 ` [PATCH 2/5] commands/crc32: add compare 2 files crc Jean-Christophe PLAGNIOL-VILLARD
@ 2010-10-07 16:37 ` Jean-Christophe PLAGNIOL-VILLARD
  2010-10-08 12:27   ` Sascha Hauer
  2010-10-07 16:37 ` [PATCH 4/5] defaultenv: add update_barebox to update barebox easly for tftp or xmodem Jean-Christophe PLAGNIOL-VILLARD
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-10-07 16:37 UTC (permalink / raw)
  To: barebox

this is add as last parameter to do not change the default behavior

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 defaultenv/bin/_update       |   26 +++++++++++++++++---------
 defaultenv/bin/init          |    5 +++--
 defaultenv/bin/update_kernel |    7 ++++++-
 defaultenv/bin/update_rootfs |    7 ++++++-
 4 files changed, 32 insertions(+), 13 deletions(-)

diff --git a/defaultenv/bin/_update b/defaultenv/bin/_update
index ddd6b84..c60ff88 100644
--- a/defaultenv/bin/_update
+++ b/defaultenv/bin/_update
@@ -14,14 +14,16 @@ if [ $# = 1 ]; then
 	image=$1
 fi
 
-if [ x$ip = xdhcp ]; then
-	dhcp
-fi
-
-ping $eth0.serverip
-if [ $? -ne 0 ] ; then
-	echo "Server did not reply! Update aborted."
-	exit 1
+if [ x$mode = xnet ]; then
+	if [ x$ip = xdhcp ]; then
+		dhcp
+	fi
+
+	ping $eth0.serverip
+	if [ $? -ne 0 ] ; then
+		echo "Server did not reply! Update aborted."
+		exit 1
+	fi
 fi
 
 unprotect $part
@@ -34,6 +36,12 @@ erase $part
 echo
 echo "flashing $image to $part"
 echo
-tftp $image $part
+
+if [ x$mode = xnet ]; then
+	tftp $image $part
+else
+	loadb -f $image -c
+	cp $image $part
+fi
 
 protect $part
diff --git a/defaultenv/bin/init b/defaultenv/bin/init
index a55e8e6..db2b525 100644
--- a/defaultenv/bin/init
+++ b/defaultenv/bin/init
@@ -25,8 +25,9 @@ echo -n "Hit any key to stop autoboot: "
 timeout -a $autoboot_timeout
 if [ $? != 0 ]; then
 	echo
-	echo "type update_kernel nand|nor [<imagename>] to update kernel into flash"
-	echo "type update_rootfs nand|nor [<imagename>] to update rootfs into flash"
+	echo "default mode is net"
+	echo "type update_kernel nand|nor [<imagename>] [net|xmodem] to update kernel into flash"
+	echo "type update_rootfs nand|nor [<imagename>] [net|xmodem] to update rootfs into flash"
 	echo
 	exit
 fi
diff --git a/defaultenv/bin/update_kernel b/defaultenv/bin/update_kernel
index 1d35ed9..b29927f 100644
--- a/defaultenv/bin/update_kernel
+++ b/defaultenv/bin/update_kernel
@@ -2,14 +2,19 @@
 
 . /env/config
 image=$kernelimage
+mode=net
 
 if [ x$1 = xnand ]; then
 	part=/dev/nand0.kernel.bb
 elif [ x$1 = xnor ]; then
 	part=/dev/nor0.kernel
 else
-	echo "usage: $0 nor|nand [imagename]"
+	echo "usage: $0 nor|nand [imagename] [net|xmodem]"
 	exit 1
 fi
 
+if [ x$3 != x ]; then
+	mode=$3
+fi
+
 . /env/bin/_update $2
diff --git a/defaultenv/bin/update_rootfs b/defaultenv/bin/update_rootfs
index 6366315..bac74ca 100644
--- a/defaultenv/bin/update_rootfs
+++ b/defaultenv/bin/update_rootfs
@@ -3,14 +3,19 @@
 . /env/config
 
 image=$rootfsimage
+mode=net
 
 if [ x$1 = xnand ]; then
 	part=/dev/nand0.root.bb
 elif [ x$1 = xnor ]; then
 	part=/dev/nor0.root
 else
-	echo "usage: $0 nor|nand [imagename]"
+	echo "usage: $0 nor|nand [imagename] [net|xmodem]"
 	exit 1
 fi
 
+if [ x$3 != x ]; then
+	mode=$3
+fi
+
 . /env/bin/_update $2
-- 
1.7.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 4/5] defaultenv: add update_barebox to update barebox easly for tftp or xmodem
  2010-10-07 16:37 [PATCH 1/5] defaultenv: introduce CONFIG_DEFAULT_ENVIRONMENT_GENERIC to enable it Jean-Christophe PLAGNIOL-VILLARD
  2010-10-07 16:37 ` [PATCH 2/5] commands/crc32: add compare 2 files crc Jean-Christophe PLAGNIOL-VILLARD
  2010-10-07 16:37 ` [PATCH 3/5] defaultenv: add xmodem support for update Jean-Christophe PLAGNIOL-VILLARD
@ 2010-10-07 16:37 ` Jean-Christophe PLAGNIOL-VILLARD
  2010-10-07 16:37 ` [PATCH 5/5] nhk8815: use defaultenv Jean-Christophe PLAGNIOL-VILLARD
  2010-10-08  6:59 ` [PATCH 1/5] defaultenv: introduce CONFIG_DEFAULT_ENVIRONMENT_GENERIC to enable it Sascha Hauer
  4 siblings, 0 replies; 9+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-10-07 16:37 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 commands/Kconfig              |    1 +
 defaultenv/bin/init           |    1 +
 defaultenv/bin/update_barebox |   21 +++++++++++++++++++++
 3 files changed, 23 insertions(+), 0 deletions(-)
 create mode 100644 defaultenv/bin/update_barebox

diff --git a/commands/Kconfig b/commands/Kconfig
index 5416073..151758b 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -204,6 +204,7 @@ config CMD_CRC
 
 config CMD_CRC_CMP
 	tristate
+	default y if DEFAULT_ENVIRONMENT_GENERIC
 	depends on CMD_CRC
 	prompt "compare 2 files crc"
 
diff --git a/defaultenv/bin/init b/defaultenv/bin/init
index db2b525..18a0c95 100644
--- a/defaultenv/bin/init
+++ b/defaultenv/bin/init
@@ -28,6 +28,7 @@ if [ $? != 0 ]; then
 	echo "default mode is net"
 	echo "type update_kernel nand|nor [<imagename>] [net|xmodem] to update kernel into flash"
 	echo "type update_rootfs nand|nor [<imagename>] [net|xmodem] to update rootfs into flash"
+	echo "type update_barebox nand|nor [<imagename>] [net|xmodem] to update barebox into flash"
 	echo
 	exit
 fi
diff --git a/defaultenv/bin/update_barebox b/defaultenv/bin/update_barebox
new file mode 100644
index 0000000..2f3b1d9
--- /dev/null
+++ b/defaultenv/bin/update_barebox
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+. /env/config
+image=barebox.bin
+mode=net
+
+if [ x$1 = xnand ]; then
+	part=/dev/nand0.barebox.bb
+elif [ x$1 = xnor ]; then
+	part=/dev/nor0.barebox
+else
+	echo "usage: $0 nor|nand [imagename] [net|xmodem]"
+	exit 1
+fi
+
+if [ x$3 != x ]; then
+	mode=$3
+fi
+
+. /env/bin/_update $2
+crc32 -f $image -F $part
-- 
1.7.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 5/5] nhk8815: use defaultenv
  2010-10-07 16:37 [PATCH 1/5] defaultenv: introduce CONFIG_DEFAULT_ENVIRONMENT_GENERIC to enable it Jean-Christophe PLAGNIOL-VILLARD
                   ` (2 preceding siblings ...)
  2010-10-07 16:37 ` [PATCH 4/5] defaultenv: add update_barebox to update barebox easly for tftp or xmodem Jean-Christophe PLAGNIOL-VILLARD
@ 2010-10-07 16:37 ` Jean-Christophe PLAGNIOL-VILLARD
  2010-10-08  6:59 ` [PATCH 1/5] defaultenv: introduce CONFIG_DEFAULT_ENVIRONMENT_GENERIC to enable it Sascha Hauer
  4 siblings, 0 replies; 9+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-10-07 16:37 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/boards/nhk8815/env/bin/_update            |   36 ----------------
 arch/arm/boards/nhk8815/env/bin/boot               |   38 -----------------
 arch/arm/boards/nhk8815/env/bin/init               |   28 ------------
 .../boards/nhk8815/env/bin/update_barebox_xmodem   |   19 --------
 arch/arm/boards/nhk8815/env/bin/update_kernel      |    8 ----
 arch/arm/boards/nhk8815/env/bin/update_root        |    8 ----
 arch/arm/boards/nhk8815/env/config                 |   44 +++++++++++++------
 arch/arm/configs/nhk8815_defconfig                 |    1 +
 8 files changed, 31 insertions(+), 151 deletions(-)
 delete mode 100644 arch/arm/boards/nhk8815/env/bin/_update
 delete mode 100644 arch/arm/boards/nhk8815/env/bin/boot
 delete mode 100644 arch/arm/boards/nhk8815/env/bin/init
 delete mode 100644 arch/arm/boards/nhk8815/env/bin/update_barebox_xmodem
 delete mode 100644 arch/arm/boards/nhk8815/env/bin/update_kernel
 delete mode 100644 arch/arm/boards/nhk8815/env/bin/update_root

diff --git a/arch/arm/boards/nhk8815/env/bin/_update b/arch/arm/boards/nhk8815/env/bin/_update
deleted file mode 100644
index fb7cbe8..0000000
--- a/arch/arm/boards/nhk8815/env/bin/_update
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/sh
-
-if [ -z "$part" -o -z "$image" ]; then
-	echo "define \$part and \$image"
-	exit 1
-fi
-
-if [ \! -e "$part" ]; then
-	echo "Partition $part does not exist"
-	exit 1
-fi
-
-if [ $# = 1 ]; then
-	image=$1
-fi
-
-if [ x$ip = xdhcp ]; then
-	dhcp
-fi
-
-ping $eth0.serverip
-if [ $? -ne 0 ] ; then
-	echo "update aborted"
-	exit 1
-fi
-
-unprotect $part
-
-echo
-echo "erasing partition $part"
-erase $part
-
-echo
-echo "flashing $image to $part"
-echo
-tftp $image $part
diff --git a/arch/arm/boards/nhk8815/env/bin/boot b/arch/arm/boards/nhk8815/env/bin/boot
deleted file mode 100644
index fd8d957..0000000
--- a/arch/arm/boards/nhk8815/env/bin/boot
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/sh
-
-. /env/config
-
-if [ x$1 = xflash ]; then
-	root=flash
-	kernel=flash
-fi
-
-if [ x$1 = xnet ]; then
-	root=net
-	kernel=net
-fi
-
-if [ x$ip = xdhcp ]; then
-	bootargs="$bootargs ip=dhcp"
-else
-	bootargs="$bootargs ip=$eth0.ipaddr:$eth0.serverip:$eth0.gateway:$eth0.netmask:::"
-fi
-
-if [ x$root = xflash ]; then
-	bootargs="$bootargs root=$rootpart rootfstype=jffs2"
-else
-	bootargs="$bootargs root=/dev/nfs nfsroot=192.168.23.111:$nfsroot"
-fi
-
-bootargs="$bootargs"
-
-if [ $kernel = net ]; then
-	if [ x$ip = xdhcp ]; then
-		dhcp
-	fi
-	tftp $uimage uImage
-	bootm uImage
-else
-	bootm /dev/nor0.kernel
-fi
-
diff --git a/arch/arm/boards/nhk8815/env/bin/init b/arch/arm/boards/nhk8815/env/bin/init
deleted file mode 100644
index 5b45a70..0000000
--- a/arch/arm/boards/nhk8815/env/bin/init
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/sh
-
-PATH=/env/bin
-export PATH
-
-. /env/config
-
-if [ -e /dev/nand0 ]; then
-	addpart /dev/nand0 $nand_parts
-
-	# Uh, oh, hush first expands wildcards and then starts executing
-	# commands. What a bug!
-	source /env/bin/hush_hack
-fi
-
-echo
-echo -n "Hit any key to stop autoboot: "
-timeout -a $autoboot_timeout
-if [ $? != 0 ]; then
-	echo
-	echo "type update_kernel [<imagename>] to update kernel into flash"
-	echo "type udate_root [<imagename>] to update rootfs into flash"
-	echo "type update_barebox_xmodem nor to update barebox into flash"
-	echo
-	exit
-fi
-
-boot
diff --git a/arch/arm/boards/nhk8815/env/bin/update_barebox_xmodem b/arch/arm/boards/nhk8815/env/bin/update_barebox_xmodem
deleted file mode 100644
index 40f4ad3..0000000
--- a/arch/arm/boards/nhk8815/env/bin/update_barebox_xmodem
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-. /env/config
-
-part=/dev/nand0.barebox
-
-loadb -f barebox.bin -c
-
-unprotect $part
-echo
-echo "erasing partition $part"
-erase $part
-
-echo
-echo "flashing barebox.bin to $part"
-echo
-cp barebox.bin $part
-crc32 -f barebox.bin
-crc32 -f $part
diff --git a/arch/arm/boards/nhk8815/env/bin/update_kernel b/arch/arm/boards/nhk8815/env/bin/update_kernel
deleted file mode 100644
index db0f4c2..0000000
--- a/arch/arm/boards/nhk8815/env/bin/update_kernel
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-. /env/config
-
-image=$uimage
-part=/dev/nand0.kernel
-
-. /env/bin/_update $1
diff --git a/arch/arm/boards/nhk8815/env/bin/update_root b/arch/arm/boards/nhk8815/env/bin/update_root
deleted file mode 100644
index 9530e84..0000000
--- a/arch/arm/boards/nhk8815/env/bin/update_root
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-. /env/config
-
-image=$jffs2
-part=/dev/nand0.rootfs
-
-. /env/bin/_update $1
diff --git a/arch/arm/boards/nhk8815/env/config b/arch/arm/boards/nhk8815/env/config
index 7e7fc45..e657a76 100644
--- a/arch/arm/boards/nhk8815/env/config
+++ b/arch/arm/boards/nhk8815/env/config
@@ -1,16 +1,33 @@
 #!/bin/sh
 
-# can be either 'net' or 'flash'
-kernel=net
-root=net
-
-# use 'dhcp' todo dhcp in uboot and in kernel
+# use 'dhcp' to do dhcp in barebox and in kernel
+# use 'none' if you want to skip kernel ip autoconfiguration
 ip=dhcp
 
-#
-# setup default ethernet address
-#
-#eth0.serverip=192.168.23.108
+# or set your networking parameters here
+#eth0.ipaddr=a.b.c.d
+#eth0.netmask=a.b.c.d
+#eth0.gateway=a.b.c.d
+#eth0.serverip=a.b.c.d
+
+# can be either 'net' or 'nand'
+kernel_loc=net
+# can be either 'net', 'nand' or 'initrd'
+rootfs_loc=net
+
+# can be either 'jffs2' or 'ubifs'
+rootfs_type=ubifs
+rootfsimage=root.$rootfs_type
+
+# The image type of the kernel. Can be uimage, zimage, raw, or raw_lzo
+#kernelimage_type=zimage
+#kernelimage=zImage
+kernelimage_type=uimage
+kernelimage=uImage
+#kernelimage_type=raw
+#kernelimage=Image
+#kernelimage_type=raw_lzo
+#kernelimage=Image.lzo
 
 # Partition			Size	Start
 # XloaderTOC + X-Loader		256KB	0x00000000
@@ -22,11 +39,10 @@ ip=dhcp
 
 nand_parts="256k(xloader)ro,256k(meminit),2M(barebox),3M(kernel),22M(rootfs),100M(userfs),384k(free),128k(bareboxenv)"
 
-uimage=uImage-nhk15
-
-# use 'dhcp' to do dhcp in uboot and in kernel
-ip=dhcp
-
 autoboot_timeout=3
 
 bootargs="root=/dev/ram0 console=ttyAMA1,115200n8 init=linuxrc"
+
+# set a fancy prompt (if support is compiled in)
+PS1="\e[1;32mbarebox@\e[1;31m\h:\w\e[0m "
+
diff --git a/arch/arm/configs/nhk8815_defconfig b/arch/arm/configs/nhk8815_defconfig
index e3f4102..5e03d05 100644
--- a/arch/arm/configs/nhk8815_defconfig
+++ b/arch/arm/configs/nhk8815_defconfig
@@ -10,6 +10,7 @@ CONFIG_AUTO_COMPLETE=y
 CONFIG_MENU=y
 CONFIG_PASSWD_SUM_SHA1=y
 CONFIG_PARTITION=y
+CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y
 CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/nhk8815/env"
 CONFIG_CMD_EDIT=y
 CONFIG_CMD_SLEEP=y
-- 
1.7.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/5] defaultenv: introduce CONFIG_DEFAULT_ENVIRONMENT_GENERIC to enable it
  2010-10-07 16:37 [PATCH 1/5] defaultenv: introduce CONFIG_DEFAULT_ENVIRONMENT_GENERIC to enable it Jean-Christophe PLAGNIOL-VILLARD
                   ` (3 preceding siblings ...)
  2010-10-07 16:37 ` [PATCH 5/5] nhk8815: use defaultenv Jean-Christophe PLAGNIOL-VILLARD
@ 2010-10-08  6:59 ` Sascha Hauer
  2010-10-08 12:39   ` Jean-Christophe PLAGNIOL-VILLARD
  4 siblings, 1 reply; 9+ messages in thread
From: Sascha Hauer @ 2010-10-08  6:59 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Thu, Oct 07, 2010 at 06:37:34PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> this will we usefull to enable functionnality if used
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  arch/arm/configs/neso_defconfig   |    3 ++-
>  arch/arm/configs/pca100_defconfig |    3 ++-
>  arch/arm/configs/pcm037_defconfig |    3 ++-
>  arch/arm/configs/pcm038_defconfig |    3 ++-
>  arch/arm/configs/pcm043_defconfig |    3 ++-
>  common/Kconfig                    |    7 +++++++
>  common/Makefile                   |    4 ++++
>  7 files changed, 21 insertions(+), 5 deletions(-)
> 
>  
> +config DEFAULT_ENVIRONMENT_GENERIC
> +	bool
> +	depends on DEFAULT_ENVIRONMENT
> +	prompt "Default environment generic"
> +	help
> +	  Generic barebox default env

How about a bit more verbosity:

	prompt "Add generic default environment"
	help
	  With this option barebox will use the generic default
	  environment found under defaultenv/ in the src tree.
	  The Directory given with DEFAULT_ENVIRONMENT_PATH
	  will be added to the default environment. This should
	  at least contain a /env/config file.

> +
>  config DEFAULT_ENVIRONMENT_PATH
>  	string
>  	depends on DEFAULT_ENVIRONMENT
> diff --git a/common/Makefile b/common/Makefile
> index e56dbc2..b42ab7a 100644
> --- a/common/Makefile
> +++ b/common/Makefile
> @@ -26,6 +26,10 @@ ifdef CONFIG_DEFAULT_ENVIRONMENT
>  $(obj)/startup.o: include/generated/barebox_default_env.h
>  $(obj)/env.o: include/generated/barebox_default_env.h
>  
> +ifeq ($(CONFIG_DEFAULT_ENVIRONMENT_GENERIC),y)
> +CONFIG_DEFAULT_ENVIRONMENT_PATH += defaultenv
> +endif

This reverses the order the different environment directories are
parsed. Now the files from defaultenv will overwrite the ones
from DEFAULT_ENVIRONMENT_PATH. I made it intentionally the other
way round.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/5] defaultenv: add xmodem support for update
  2010-10-07 16:37 ` [PATCH 3/5] defaultenv: add xmodem support for update Jean-Christophe PLAGNIOL-VILLARD
@ 2010-10-08 12:27   ` Sascha Hauer
  2010-10-11  5:11     ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 9+ messages in thread
From: Sascha Hauer @ 2010-10-08 12:27 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Thu, Oct 07, 2010 at 06:37:36PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> this is add as last parameter to do not change the default behavior
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  defaultenv/bin/_update       |   26 +++++++++++++++++---------
>  defaultenv/bin/init          |    5 +++--
>  defaultenv/bin/update_kernel |    7 ++++++-
>  defaultenv/bin/update_rootfs |    7 ++++++-
>  4 files changed, 32 insertions(+), 13 deletions(-)
> 
> diff --git a/defaultenv/bin/_update b/defaultenv/bin/_update
> index ddd6b84..c60ff88 100644
> --- a/defaultenv/bin/_update
> +++ b/defaultenv/bin/_update
> @@ -14,14 +14,16 @@ if [ $# = 1 ]; then
>  	image=$1
>  fi
>  
> -if [ x$ip = xdhcp ]; then
> -	dhcp
> -fi
> -
> -ping $eth0.serverip
> -if [ $? -ne 0 ] ; then
> -	echo "Server did not reply! Update aborted."
> -	exit 1
> +if [ x$mode = xnet ]; then
> +	if [ x$ip = xdhcp ]; then
> +		dhcp
> +	fi
> +
> +	ping $eth0.serverip
> +	if [ $? -ne 0 ] ; then
> +		echo "Server did not reply! Update aborted."
> +		exit 1
> +	fi
>  fi
>  
>  unprotect $part
> @@ -34,6 +36,12 @@ erase $part
>  echo
>  echo "flashing $image to $part"
>  echo
> -tftp $image $part
> +
> +if [ x$mode = xnet ]; then
> +	tftp $image $part
> +else
> +	loadb -f $image -c
> +	cp $image $part
> +fi
>  
>  protect $part
> diff --git a/defaultenv/bin/init b/defaultenv/bin/init
> index a55e8e6..db2b525 100644
> --- a/defaultenv/bin/init
> +++ b/defaultenv/bin/init
> @@ -25,8 +25,9 @@ echo -n "Hit any key to stop autoboot: "
>  timeout -a $autoboot_timeout
>  if [ $? != 0 ]; then
>  	echo
> -	echo "type update_kernel nand|nor [<imagename>] to update kernel into flash"
> -	echo "type update_rootfs nand|nor [<imagename>] to update rootfs into flash"
> +	echo "default mode is net"
> +	echo "type update_kernel nand|nor [<imagename>] [net|xmodem] to update kernel into flash"
> +	echo "type update_rootfs nand|nor [<imagename>] [net|xmodem] to update rootfs into flash"
>  	echo
>  	exit
>  fi
> diff --git a/defaultenv/bin/update_kernel b/defaultenv/bin/update_kernel
> index 1d35ed9..b29927f 100644
> --- a/defaultenv/bin/update_kernel
> +++ b/defaultenv/bin/update_kernel
> @@ -2,14 +2,19 @@
>  
>  . /env/config
>  image=$kernelimage
> +mode=net
>  
>  if [ x$1 = xnand ]; then
>  	part=/dev/nand0.kernel.bb
>  elif [ x$1 = xnor ]; then
>  	part=/dev/nor0.kernel
>  else
> -	echo "usage: $0 nor|nand [imagename]"
> +	echo "usage: $0 nor|nand [imagename] [net|xmodem]"
>  	exit 1
>  fi
>  
> +if [ x$3 != x ]; then
> +	mode=$3
> +fi
> +
>  . /env/bin/_update $2
> diff --git a/defaultenv/bin/update_rootfs b/defaultenv/bin/update_rootfs
> index 6366315..bac74ca 100644
> --- a/defaultenv/bin/update_rootfs
> +++ b/defaultenv/bin/update_rootfs
> @@ -3,14 +3,19 @@
>  . /env/config
>  
>  image=$rootfsimage
> +mode=net
>  
>  if [ x$1 = xnand ]; then
>  	part=/dev/nand0.root.bb
>  elif [ x$1 = xnor ]; then
>  	part=/dev/nor0.root
>  else
> -	echo "usage: $0 nor|nand [imagename]"
> +	echo "usage: $0 nor|nand [imagename] [net|xmodem]"

I'm not really happy with this patch. We have 3 positional parameters
now and with xmodem it makes no sense to supply an image name,
nontheless we have to supply it because otherwise we do not have three
arguments.
I just posted a patch adding a getopt command to hush. Maybe this could
improve the situation here?

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/5] defaultenv: introduce CONFIG_DEFAULT_ENVIRONMENT_GENERIC to enable it
  2010-10-08  6:59 ` [PATCH 1/5] defaultenv: introduce CONFIG_DEFAULT_ENVIRONMENT_GENERIC to enable it Sascha Hauer
@ 2010-10-08 12:39   ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 9+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-10-08 12:39 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 08:59 Fri 08 Oct     , Sascha Hauer wrote:
> On Thu, Oct 07, 2010 at 06:37:34PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > this will we usefull to enable functionnality if used
> > 
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> >  arch/arm/configs/neso_defconfig   |    3 ++-
> >  arch/arm/configs/pca100_defconfig |    3 ++-
> >  arch/arm/configs/pcm037_defconfig |    3 ++-
> >  arch/arm/configs/pcm038_defconfig |    3 ++-
> >  arch/arm/configs/pcm043_defconfig |    3 ++-
> >  common/Kconfig                    |    7 +++++++
> >  common/Makefile                   |    4 ++++
> >  7 files changed, 21 insertions(+), 5 deletions(-)
> > 
> >  
> > +config DEFAULT_ENVIRONMENT_GENERIC
> > +	bool
> > +	depends on DEFAULT_ENVIRONMENT
> > +	prompt "Default environment generic"
> > +	help
> > +	  Generic barebox default env
> 
> How about a bit more verbosity:
> 
> 	prompt "Add generic default environment"
> 	help
> 	  With this option barebox will use the generic default
> 	  environment found under defaultenv/ in the src tree.
> 	  The Directory given with DEFAULT_ENVIRONMENT_PATH
> 	  will be added to the default environment. This should
> 	  at least contain a /env/config file.
> 
> > +
> >  config DEFAULT_ENVIRONMENT_PATH
> >  	string
> >  	depends on DEFAULT_ENVIRONMENT
> > diff --git a/common/Makefile b/common/Makefile
> > index e56dbc2..b42ab7a 100644
> > --- a/common/Makefile
> > +++ b/common/Makefile
> > @@ -26,6 +26,10 @@ ifdef CONFIG_DEFAULT_ENVIRONMENT
> >  $(obj)/startup.o: include/generated/barebox_default_env.h
> >  $(obj)/env.o: include/generated/barebox_default_env.h
> >  
> > +ifeq ($(CONFIG_DEFAULT_ENVIRONMENT_GENERIC),y)
> > +CONFIG_DEFAULT_ENVIRONMENT_PATH += defaultenv
> > +endif
> 
> This reverses the order the different environment directories are
> parsed. Now the files from defaultenv will overwrite the ones
> from DEFAULT_ENVIRONMENT_PATH. I made it intentionally the other
> way round.
so we need to specify it in the Kconfig

Best Regards,
J.

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/5] defaultenv: add xmodem support for update
  2010-10-08 12:27   ` Sascha Hauer
@ 2010-10-11  5:11     ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 9+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-10-11  5:11 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

> >  	exit 1
> >  fi
> >  
> > +if [ x$3 != x ]; then
> > +	mode=$3
> > +fi
> > +
> >  . /env/bin/_update $2
> > diff --git a/defaultenv/bin/update_rootfs b/defaultenv/bin/update_rootfs
> > index 6366315..bac74ca 100644
> > --- a/defaultenv/bin/update_rootfs
> > +++ b/defaultenv/bin/update_rootfs
> > @@ -3,14 +3,19 @@
> >  . /env/config
> >  
> >  image=$rootfsimage
> > +mode=net
> >  
> >  if [ x$1 = xnand ]; then
> >  	part=/dev/nand0.root.bb
> >  elif [ x$1 = xnor ]; then
> >  	part=/dev/nor0.root
> >  else
> > -	echo "usage: $0 nor|nand [imagename]"
> > +	echo "usage: $0 nor|nand [imagename] [net|xmodem]"
> 
> I'm not really happy with this patch. We have 3 positional parameters
> now and with xmodem it makes no sense to supply an image name,
> nontheless we have to supply it because otherwise we do not have three
> arguments.
> I just posted a patch adding a getopt command to hush. Maybe this could
> improve the situation here?
I get exactly the same idea

Best Regards,
J.

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-10-11  5:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-07 16:37 [PATCH 1/5] defaultenv: introduce CONFIG_DEFAULT_ENVIRONMENT_GENERIC to enable it Jean-Christophe PLAGNIOL-VILLARD
2010-10-07 16:37 ` [PATCH 2/5] commands/crc32: add compare 2 files crc Jean-Christophe PLAGNIOL-VILLARD
2010-10-07 16:37 ` [PATCH 3/5] defaultenv: add xmodem support for update Jean-Christophe PLAGNIOL-VILLARD
2010-10-08 12:27   ` Sascha Hauer
2010-10-11  5:11     ` Jean-Christophe PLAGNIOL-VILLARD
2010-10-07 16:37 ` [PATCH 4/5] defaultenv: add update_barebox to update barebox easly for tftp or xmodem Jean-Christophe PLAGNIOL-VILLARD
2010-10-07 16:37 ` [PATCH 5/5] nhk8815: use defaultenv Jean-Christophe PLAGNIOL-VILLARD
2010-10-08  6:59 ` [PATCH 1/5] defaultenv: introduce CONFIG_DEFAULT_ENVIRONMENT_GENERIC to enable it Sascha Hauer
2010-10-08 12:39   ` Jean-Christophe PLAGNIOL-VILLARD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox