mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/5] Calao dfu upload kernel or uImage and boot it
@ 2012-01-15  9:51 Jean-Christophe PLAGNIOL-VILLARD
  2012-01-15 10:00 ` [PATCH 1/5] dfu: add description how to specify the "description" to the long help Jean-Christophe PLAGNIOL-VILLARD
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-01-15  9:51 UTC (permalink / raw)
  To: barebox

HI,

	this patch serie add the support to boot a uImage or kernel over dfu
	on calao boards

	this also add the support to defaultenv/boot to specify via getopt the
	mode or kernel/rootfs and ip

The following changes since commit 87428167719cd9e28b61cc19fab4984f31750930:

  Merge branch 'pu/jean-codesize' into next (2012-01-13 09:33:36 +0100)

are available in the git repository at:

  git://uboot.jcrosoft.org/barebox.git calao-boot

Jean-Christophe PLAGNIOL-VILLARD (5):
      dfu: add description how to specify the "description" to the long help
      defaultenv/boot: add getopt option support to select boot mode
      defaultenv/boot: add boot the kernel from the mem
      filetype: add command support
      usb-926x: add dfu mem options support

 arch/arm/boards/usb-a926x/env/bin/init_board |   10 ++++++-
 arch/arm/configs/usb_a9260_defconfig         |    1 +
 arch/arm/configs/usb_a9263_128mib_defconfig  |    1 +
 arch/arm/configs/usb_a9263_defconfig         |    1 +
 arch/arm/configs/usb_a9g20_128mib_defconfig  |    1 +
 arch/arm/configs/usb_a9g20_defconfig         |    1 +
 commands/Kconfig                             |    5 +++
 commands/Makefile                            |    1 +
 commands/dfu.c                               |    4 ++
 commands/filetype.c                          |   39 ++++++++++++++++++++++++++
 defaultenv/bin/_boot_help                    |   18 ++++++++++++
 defaultenv/bin/boot                          |   30 ++++++++++++++++----
 12 files changed, 105 insertions(+), 7 deletions(-)
 create mode 100644 commands/filetype.c
 create mode 100644 defaultenv/bin/_boot_help

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

* [PATCH 1/5] dfu: add description how to specify the "description" to the long help
  2012-01-15  9:51 [PATCH 0/5] Calao dfu upload kernel or uImage and boot it Jean-Christophe PLAGNIOL-VILLARD
@ 2012-01-15 10:00 ` Jean-Christophe PLAGNIOL-VILLARD
  2012-01-15 10:00 ` [PATCH 2/5] defaultenv/boot: add getopt option support to select boot mode Jean-Christophe PLAGNIOL-VILLARD
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-01-15 10:00 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 commands/dfu.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/commands/dfu.c b/commands/dfu.c
index 385fd89..7f2dfed 100644
--- a/commands/dfu.c
+++ b/commands/dfu.c
@@ -169,6 +169,10 @@ BAREBOX_CMD_HELP_OPT  ("-m <str>",  "Manufacturer string (barebox)\n")
 BAREBOX_CMD_HELP_OPT  ("-p <str>",  "product string (" CONFIG_BOARDINFO ")\n")
 BAREBOX_CMD_HELP_OPT  ("-V <id>",   "vendor id\n")
 BAREBOX_CMD_HELP_OPT  ("-P <id>",   "product id\n")
+BAREBOX_CMD_HELP_OPT  ("<description>",
+	"device1(name1)[sr],device2(name2)[sr]\n"
+	"'s' means 'safe mode' (download the complete image before flashing) and\n"
+	"'r' that readback of the firmware is allowed.\n")
 BAREBOX_CMD_HELP_END
 
 /**
-- 
1.7.7


_______________________________________________
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] defaultenv/boot: add getopt option support to select boot mode
  2012-01-15  9:51 [PATCH 0/5] Calao dfu upload kernel or uImage and boot it Jean-Christophe PLAGNIOL-VILLARD
  2012-01-15 10:00 ` [PATCH 1/5] dfu: add description how to specify the "description" to the long help Jean-Christophe PLAGNIOL-VILLARD
@ 2012-01-15 10:00 ` Jean-Christophe PLAGNIOL-VILLARD
  2012-02-09 14:46   ` Jean-Christophe PLAGNIOL-VILLARD
  2012-01-15 10:00 ` [PATCH 3/5] defaultenv/boot: add boot the kernel from the mem Jean-Christophe PLAGNIOL-VILLARD
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-01-15 10:00 UTC (permalink / raw)
  To: barebox

boot: boot [-m <mode>] [-k <kernel_option>] [-r <rootfs_option>] [-i <ip_mode>]

options
 - kernel        nand, nor, nfs, tftp, disk
 - rootfs        nand, nor, net, disk
 - ip            dhcp, none, empty

mode option
   mode       kernel      rootfs
   nand       nand        nand
   nor        nor         nor
   nfs        nfs         net
   tftp       fttp        net
   disk       disk        disk

default mode are used from the /env/config

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 defaultenv/bin/_boot_help |   18 ++++++++++++++++++
 defaultenv/bin/boot       |   26 +++++++++++++++++++++-----
 2 files changed, 39 insertions(+), 5 deletions(-)
 create mode 100644 defaultenv/bin/_boot_help

diff --git a/defaultenv/bin/_boot_help b/defaultenv/bin/_boot_help
new file mode 100644
index 0000000..e7f7f16
--- /dev/null
+++ b/defaultenv/bin/_boot_help
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+echo "boot: boot [-m <mode>] [-k <kernel_option>] [-r <rootfs_option>] [-i <ip_mode>]"
+echo ""
+echo "options"
+echo " - kernel        nand, nor, nfs, tftp, disk"
+echo " - rootfs        nand, nor, net, disk"
+echo " - ip            dhcp, none, empty"
+echo ""
+echo "mode option"
+echo "   mode       kernel      rootfs"
+echo "   nand       nand        nand"
+echo "   nor        nor         nor"
+echo "   nfs        nfs         net"
+echo "   tftp       fttp        net"
+echo "   disk       disk        disk"
+echo ""
+echo "default mode are used from the /env/config"
diff --git a/defaultenv/bin/boot b/defaultenv/bin/boot
index 1120757..d37eca8 100644
--- a/defaultenv/bin/boot
+++ b/defaultenv/bin/boot
@@ -6,19 +6,35 @@ if [ x$kernel_loc = xnet ]; then
 	kernel_loc=tftp
 fi
 
-if [ x$1 = xnand ]; then
+while getopt "hk:r:i:m:" Option
+do
+if [ ${Option} = k ]; then
+	kernel_loc=${OPTARG}
+elif [ ${Option} = r ]; then
+	rootfs_loc=${OPTARG}
+elif [ ${Option} = i ]; then
+	ip=${OPTARG}
+elif [ ${Option} = m ]; then
+	mode=${OPTARG}
+else
+	. /env/bin/_boot_help
+	exit 0
+fi
+done
+
+if [ x$mode = xnand ]; then
 	rootfs_loc=nand
 	kernel_loc=nand
-elif [ x$1 = xnor ]; then
+elif [ x$mode = xnor ]; then
 	rootfs_loc=nor
 	kernel_loc=nor
-elif [ x$1 = xnfs ]; then
+elif [ x$mode = xnfs ]; then
 	rootfs_loc=net
 	kernel_loc=nfs
-elif [ x$1 = xtftp ]; then
+elif [ x$mode = xtftp ]; then
 	rootfs_loc=net
 	kernel_loc=tftp
-elif [ x$1 = xdisk ]; then
+elif [ x$mode = xdisk ]; then
 	rootfs_loc=disk
 	kernel_loc=disk
 fi
-- 
1.7.7


_______________________________________________
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/boot: add boot the kernel from the mem
  2012-01-15  9:51 [PATCH 0/5] Calao dfu upload kernel or uImage and boot it Jean-Christophe PLAGNIOL-VILLARD
  2012-01-15 10:00 ` [PATCH 1/5] dfu: add description how to specify the "description" to the long help Jean-Christophe PLAGNIOL-VILLARD
  2012-01-15 10:00 ` [PATCH 2/5] defaultenv/boot: add getopt option support to select boot mode Jean-Christophe PLAGNIOL-VILLARD
@ 2012-01-15 10:00 ` Jean-Christophe PLAGNIOL-VILLARD
  2012-01-15 10:00 ` [PATCH 4/5] filetype: add command support Jean-Christophe PLAGNIOL-VILLARD
  2012-01-15 10:00 ` [PATCH 5/5] usb-926x: add dfu mem options support Jean-Christophe PLAGNIOL-VILLARD
  4 siblings, 0 replies; 9+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-01-15 10:00 UTC (permalink / raw)
  To: barebox

as example uploaded via dfu

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 defaultenv/bin/_boot_help |    2 +-
 defaultenv/bin/boot       |    4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/defaultenv/bin/_boot_help b/defaultenv/bin/_boot_help
index e7f7f16..660dbf4 100644
--- a/defaultenv/bin/_boot_help
+++ b/defaultenv/bin/_boot_help
@@ -3,7 +3,7 @@
 echo "boot: boot [-m <mode>] [-k <kernel_option>] [-r <rootfs_option>] [-i <ip_mode>]"
 echo ""
 echo "options"
-echo " - kernel        nand, nor, nfs, tftp, disk"
+echo " - kernel        nand, nor, nfs, tftp, disk, mem"
 echo " - rootfs        nand, nor, net, disk"
 echo " - ip            dhcp, none, empty"
 echo ""
diff --git a/defaultenv/bin/boot b/defaultenv/bin/boot
index d37eca8..538f506 100644
--- a/defaultenv/bin/boot
+++ b/defaultenv/bin/boot
@@ -94,6 +94,8 @@ if [ x$kernel_loc = xnfs -o x$kernel_loc = xtftp ]; then
 	fi
 	kdev=/image
 	$kernel_loc $kernelimage $kdev || exit 1
+elif [ x$kernel_loc = xmem ]; then
+	kdev="/dev/ram0.kernel"
 elif [ x$kernel_loc = xnor ]; then
 	kdev="/dev/nor0.kernel"
 elif [ x$kernel_loc = xnand ]; then
@@ -101,7 +103,7 @@ elif [ x$kernel_loc = xnand ]; then
 elif [ x$kernel_loc = xdisk ]; then
 	kdev="/dev/$kernel_part"
 else
-	echo "error: set kernel_loc to one of 'tftp', 'nfs', 'nand', 'nor' or 'disk'"
+	echo "error: set kernel_loc to one of 'tftp', 'nfs', 'nand', 'nor' , 'mem' or 'disk'"
 	exit 1
 fi
 
-- 
1.7.7


_______________________________________________
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] filetype: add command support
  2012-01-15  9:51 [PATCH 0/5] Calao dfu upload kernel or uImage and boot it Jean-Christophe PLAGNIOL-VILLARD
                   ` (2 preceding siblings ...)
  2012-01-15 10:00 ` [PATCH 3/5] defaultenv/boot: add boot the kernel from the mem Jean-Christophe PLAGNIOL-VILLARD
@ 2012-01-15 10:00 ` Jean-Christophe PLAGNIOL-VILLARD
  2012-01-17 10:35   ` Sascha Hauer
  2012-01-15 10:00 ` [PATCH 5/5] usb-926x: add dfu mem options support Jean-Christophe PLAGNIOL-VILLARD
  4 siblings, 1 reply; 9+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-01-15 10:00 UTC (permalink / raw)
  To: barebox

this will allow to detect the filetype of a file and export it as filetype

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 commands/Kconfig    |    5 +++++
 commands/Makefile   |    1 +
 commands/filetype.c |   39 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 45 insertions(+), 0 deletions(-)
 create mode 100644 commands/filetype.c

diff --git a/commands/Kconfig b/commands/Kconfig
index 766428c..c613e22 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -181,6 +181,11 @@ config CMD_NANDTEST
 	select PARTITION_NEED_MTD
 	prompt "nandtest"
 
+config CMD_FILETYPE
+	tristate
+	depends on FILETYPE
+	prompt "filetype"
+
 endmenu
 
 menu "console                       "
diff --git a/commands/Makefile b/commands/Makefile
index 31442b5..a91eed2 100644
--- a/commands/Makefile
+++ b/commands/Makefile
@@ -64,3 +64,4 @@ obj-$(CONFIG_CMD_OFTREE)	+= oftree.o
 obj-$(CONFIG_CMD_MAGICVAR)	+= magicvar.o
 obj-$(CONFIG_CMD_IOMEM)		+= iomem.o
 obj-$(CONFIG_CMD_LINUX_EXEC)	+= linux_exec.o
+obj-$(CONFIG_CMD_FILETYPE)	+= filetype.o
diff --git a/commands/filetype.c b/commands/filetype.c
new file mode 100644
index 0000000..7c5e907
--- /dev/null
+++ b/commands/filetype.c
@@ -0,0 +1,39 @@
+/*
+ * (C) Copyright 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+ *
+ * Under GPLv2 Only
+ */
+
+#include <common.h>
+#include <command.h>
+#include <fs.h>
+#include <filetype.h>
+#include <environment.h>
+
+static int do_filetype(struct command *cmdtp, int argc, char *argv[])
+{
+	enum filetype type;
+
+	if (argc < 2)
+		return COMMAND_ERROR_USAGE;
+
+	type = file_name_detect_type(argv[1]);
+
+	printf("%s: %s detected\n", argv[1], file_type_to_string(type));
+
+	export_env_ull("filetype" , type);
+
+	return 0;
+}
+
+BAREBOX_CMD_HELP_START(filetype)
+BAREBOX_CMD_HELP_USAGE("filetype file\n")
+BAREBOX_CMD_HELP_USAGE("export filetype\n")
+BAREBOX_CMD_HELP_SHORT("detect file type\n")
+BAREBOX_CMD_HELP_END
+
+BAREBOX_CMD_START(filetype)
+	.cmd		= do_filetype,
+	.usage		= "detect file type",
+	BAREBOX_CMD_HELP(cmd_filetype_help)
+BAREBOX_CMD_END
-- 
1.7.7


_______________________________________________
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] usb-926x: add dfu mem options support
  2012-01-15  9:51 [PATCH 0/5] Calao dfu upload kernel or uImage and boot it Jean-Christophe PLAGNIOL-VILLARD
                   ` (3 preceding siblings ...)
  2012-01-15 10:00 ` [PATCH 4/5] filetype: add command support Jean-Christophe PLAGNIOL-VILLARD
@ 2012-01-15 10:00 ` Jean-Christophe PLAGNIOL-VILLARD
  2012-01-17 10:29   ` Sascha Hauer
  4 siblings, 1 reply; 9+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-01-15 10:00 UTC (permalink / raw)
  To: barebox

this will allow to upload a bootable image in memory and boot it
boot with the rootfs via nfs

the image will must be 16MiB max

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/boards/usb-a926x/env/bin/init_board |   10 +++++++++-
 arch/arm/configs/usb_a9260_defconfig         |    1 +
 arch/arm/configs/usb_a9263_128mib_defconfig  |    1 +
 arch/arm/configs/usb_a9263_defconfig         |    1 +
 arch/arm/configs/usb_a9g20_128mib_defconfig  |    1 +
 arch/arm/configs/usb_a9g20_defconfig         |    1 +
 6 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/arch/arm/boards/usb-a926x/env/bin/init_board b/arch/arm/boards/usb-a926x/env/bin/init_board
index 0a6baf7..4c906f0 100644
--- a/arch/arm/boards/usb-a926x/env/bin/init_board
+++ b/arch/arm/boards/usb-a926x/env/bin/init_board
@@ -6,7 +6,7 @@ button_wait=5
 product_id=0x1234
 vendor_id=0x4321
 
-dfu_config="/dev/nand0.barebox.bb(barebox)sr,/dev/nand0.kernel.bb(kernel)r,/dev/nand0.rootfs.bb(rootfs)r"
+dfu_config="/dev/nand0.barebox.bb(barebox)sr,/dev/nand0.kernel.bb(kernel)r,/dev/nand0.rootfs.bb(rootfs)r,/dev/ram0.kernel(mem)r"
 
 if [ $at91_udc0.vbus != 1 ]
 then
@@ -46,4 +46,12 @@ echo ""
 echo "Start DFU Mode"
 echo ""
 
+addpart /dev/ram0 16M@8M(kernel)
 dfu ${dfu_config} -P ${product_id} -V ${vendor_id}
+
+filetype /dev/ram0.kernel
+
+if [ $filetype -eq 1 -o $filetype -eq 3 -o $filetype -eq 4 ]
+then
+	boot -k mem -r net
+fi
diff --git a/arch/arm/configs/usb_a9260_defconfig b/arch/arm/configs/usb_a9260_defconfig
index 9073d04..861c62d 100644
--- a/arch/arm/configs/usb_a9260_defconfig
+++ b/arch/arm/configs/usb_a9260_defconfig
@@ -27,6 +27,7 @@ CONFIG_CMD_READLINE=y
 CONFIG_CMD_MENU=y
 CONFIG_CMD_MENU_MANAGEMENT=y
 CONFIG_CMD_PASSWD=y
+CONFIG_CMD_FILETYPE=y
 CONFIG_CMD_ECHO_E=y
 CONFIG_CMD_LOADB=y
 CONFIG_CMD_MEMINFO=y
diff --git a/arch/arm/configs/usb_a9263_128mib_defconfig b/arch/arm/configs/usb_a9263_128mib_defconfig
index 457b25c..2c54743 100644
--- a/arch/arm/configs/usb_a9263_128mib_defconfig
+++ b/arch/arm/configs/usb_a9263_128mib_defconfig
@@ -28,6 +28,7 @@ CONFIG_CMD_READLINE=y
 CONFIG_CMD_MENU=y
 CONFIG_CMD_MENU_MANAGEMENT=y
 CONFIG_CMD_PASSWD=y
+CONFIG_CMD_FILETYPE=y
 CONFIG_CMD_ECHO_E=y
 CONFIG_CMD_LOADB=y
 CONFIG_CMD_MEMINFO=y
diff --git a/arch/arm/configs/usb_a9263_defconfig b/arch/arm/configs/usb_a9263_defconfig
index 6a7ded7..eb9ad9a 100644
--- a/arch/arm/configs/usb_a9263_defconfig
+++ b/arch/arm/configs/usb_a9263_defconfig
@@ -27,6 +27,7 @@ CONFIG_CMD_READLINE=y
 CONFIG_CMD_MENU=y
 CONFIG_CMD_MENU_MANAGEMENT=y
 CONFIG_CMD_PASSWD=y
+CONFIG_CMD_FILETYPE=y
 CONFIG_CMD_ECHO_E=y
 CONFIG_CMD_LOADB=y
 CONFIG_CMD_MEMINFO=y
diff --git a/arch/arm/configs/usb_a9g20_128mib_defconfig b/arch/arm/configs/usb_a9g20_128mib_defconfig
index 3d44f39..cb17d71 100644
--- a/arch/arm/configs/usb_a9g20_128mib_defconfig
+++ b/arch/arm/configs/usb_a9g20_128mib_defconfig
@@ -28,6 +28,7 @@ CONFIG_CMD_READLINE=y
 CONFIG_CMD_MENU=y
 CONFIG_CMD_MENU_MANAGEMENT=y
 CONFIG_CMD_PASSWD=y
+CONFIG_CMD_FILETYPE=y
 CONFIG_CMD_ECHO_E=y
 CONFIG_CMD_LOADB=y
 CONFIG_CMD_MEMINFO=y
diff --git a/arch/arm/configs/usb_a9g20_defconfig b/arch/arm/configs/usb_a9g20_defconfig
index 7abcd95..edce2cf 100644
--- a/arch/arm/configs/usb_a9g20_defconfig
+++ b/arch/arm/configs/usb_a9g20_defconfig
@@ -27,6 +27,7 @@ CONFIG_CMD_READLINE=y
 CONFIG_CMD_MENU=y
 CONFIG_CMD_MENU_MANAGEMENT=y
 CONFIG_CMD_PASSWD=y
+CONFIG_CMD_FILETYPE=y
 CONFIG_CMD_ECHO_E=y
 CONFIG_CMD_LOADB=y
 CONFIG_CMD_MEMINFO=y
-- 
1.7.7


_______________________________________________
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 5/5] usb-926x: add dfu mem options support
  2012-01-15 10:00 ` [PATCH 5/5] usb-926x: add dfu mem options support Jean-Christophe PLAGNIOL-VILLARD
@ 2012-01-17 10:29   ` Sascha Hauer
  0 siblings, 0 replies; 9+ messages in thread
From: Sascha Hauer @ 2012-01-17 10:29 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Sun, Jan 15, 2012 at 11:00:21AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> this will allow to upload a bootable image in memory and boot it
> boot with the rootfs via nfs
> 
> the image will must be 16MiB max
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  arch/arm/boards/usb-a926x/env/bin/init_board |   10 +++++++++-
>  arch/arm/configs/usb_a9260_defconfig         |    1 +
>  arch/arm/configs/usb_a9263_128mib_defconfig  |    1 +
>  arch/arm/configs/usb_a9263_defconfig         |    1 +
>  arch/arm/configs/usb_a9g20_128mib_defconfig  |    1 +
>  arch/arm/configs/usb_a9g20_defconfig         |    1 +
>  6 files changed, 14 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/boards/usb-a926x/env/bin/init_board b/arch/arm/boards/usb-a926x/env/bin/init_board
> index 0a6baf7..4c906f0 100644
> --- a/arch/arm/boards/usb-a926x/env/bin/init_board
> +++ b/arch/arm/boards/usb-a926x/env/bin/init_board
> @@ -6,7 +6,7 @@ button_wait=5
>  product_id=0x1234
>  vendor_id=0x4321
>  
> -dfu_config="/dev/nand0.barebox.bb(barebox)sr,/dev/nand0.kernel.bb(kernel)r,/dev/nand0.rootfs.bb(rootfs)r"
> +dfu_config="/dev/nand0.barebox.bb(barebox)sr,/dev/nand0.kernel.bb(kernel)r,/dev/nand0.rootfs.bb(rootfs)r,/dev/ram0.kernel(mem)r"

I really want to discourage usage of /dev/ram0 for 'official' use. Can't
you use a regular file instead? From what I see only the O_CREAT flag is
missing in the dfu driver.

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 4/5] filetype: add command support
  2012-01-15 10:00 ` [PATCH 4/5] filetype: add command support Jean-Christophe PLAGNIOL-VILLARD
@ 2012-01-17 10:35   ` Sascha Hauer
  0 siblings, 0 replies; 9+ messages in thread
From: Sascha Hauer @ 2012-01-17 10:35 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Sun, Jan 15, 2012 at 11:00:20AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> this will allow to detect the filetype of a file and export it as filetype
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  commands/Kconfig    |    5 +++++
>  commands/Makefile   |    1 +
>  commands/filetype.c |   39 +++++++++++++++++++++++++++++++++++++++
>  3 files changed, 45 insertions(+), 0 deletions(-)
>  create mode 100644 commands/filetype.c
> 
> diff --git a/commands/Kconfig b/commands/Kconfig
> index 766428c..c613e22 100644
> --- a/commands/Kconfig
> +++ b/commands/Kconfig
> @@ -181,6 +181,11 @@ config CMD_NANDTEST
>  	select PARTITION_NEED_MTD
>  	prompt "nandtest"
>  
> +config CMD_FILETYPE
> +	tristate
> +	depends on FILETYPE
> +	prompt "filetype"
> +
>  endmenu
>  
>  menu "console                       "
> diff --git a/commands/Makefile b/commands/Makefile
> index 31442b5..a91eed2 100644
> --- a/commands/Makefile
> +++ b/commands/Makefile
> @@ -64,3 +64,4 @@ obj-$(CONFIG_CMD_OFTREE)	+= oftree.o
>  obj-$(CONFIG_CMD_MAGICVAR)	+= magicvar.o
>  obj-$(CONFIG_CMD_IOMEM)		+= iomem.o
>  obj-$(CONFIG_CMD_LINUX_EXEC)	+= linux_exec.o
> +obj-$(CONFIG_CMD_FILETYPE)	+= filetype.o
> diff --git a/commands/filetype.c b/commands/filetype.c
> new file mode 100644
> index 0000000..7c5e907
> --- /dev/null
> +++ b/commands/filetype.c
> @@ -0,0 +1,39 @@
> +/*
> + * (C) Copyright 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> + *
> + * Under GPLv2 Only
> + */
> +
> +#include <common.h>
> +#include <command.h>
> +#include <fs.h>
> +#include <filetype.h>
> +#include <environment.h>
> +
> +static int do_filetype(struct command *cmdtp, int argc, char *argv[])
> +{
> +	enum filetype type;
> +
> +	if (argc < 2)
> +		return COMMAND_ERROR_USAGE;
> +
> +	type = file_name_detect_type(argv[1]);
> +
> +	printf("%s: %s detected\n", argv[1], file_type_to_string(type));

As this is likely to be used in scripts it's probably useful to be able
to suppress this output.

> +
> +	export_env_ull("filetype" , type);

magicvar description?

Also, with exporting the filetype as integer we export the numbers
currently only known in sourcecode. We should add a switch to this
command to dump the number <-> string relationship.

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 2/5] defaultenv/boot: add getopt option support to select boot mode
  2012-01-15 10:00 ` [PATCH 2/5] defaultenv/boot: add getopt option support to select boot mode Jean-Christophe PLAGNIOL-VILLARD
@ 2012-02-09 14:46   ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 9+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-02-09 14:46 UTC (permalink / raw)
  To: barebox

On 11:00 Sun 15 Jan     , Jean-Christophe PLAGNIOL-VILLARD wrote:
> boot: boot [-m <mode>] [-k <kernel_option>] [-r <rootfs_option>] [-i <ip_mode>]
> 
> options
>  - kernel        nand, nor, nfs, tftp, disk
>  - rootfs        nand, nor, net, disk
>  - ip            dhcp, none, empty
> 
> mode option
>    mode       kernel      rootfs
>    nand       nand        nand
>    nor        nor         nor
>    nfs        nfs         net
>    tftp       fttp        net
>    disk       disk        disk
> 
> default mode are used from the /env/config
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
can we have patch 1 and 2 applied

Best Regards,
J.
> ---
>  defaultenv/bin/_boot_help |   18 ++++++++++++++++++
>  defaultenv/bin/boot       |   26 +++++++++++++++++++++-----
>  2 files changed, 39 insertions(+), 5 deletions(-)
>  create mode 100644 defaultenv/bin/_boot_help
> 
> diff --git a/defaultenv/bin/_boot_help b/defaultenv/bin/_boot_help
> new file mode 100644
> index 0000000..e7f7f16
> --- /dev/null
> +++ b/defaultenv/bin/_boot_help
> @@ -0,0 +1,18 @@
> +#!/bin/sh
> +
> +echo "boot: boot [-m <mode>] [-k <kernel_option>] [-r <rootfs_option>] [-i <ip_mode>]"
> +echo ""
> +echo "options"
> +echo " - kernel        nand, nor, nfs, tftp, disk"
> +echo " - rootfs        nand, nor, net, disk"
> +echo " - ip            dhcp, none, empty"
> +echo ""
> +echo "mode option"
> +echo "   mode       kernel      rootfs"
> +echo "   nand       nand        nand"
> +echo "   nor        nor         nor"
> +echo "   nfs        nfs         net"
> +echo "   tftp       fttp        net"
> +echo "   disk       disk        disk"
> +echo ""
> +echo "default mode are used from the /env/config"
> diff --git a/defaultenv/bin/boot b/defaultenv/bin/boot
> index 1120757..d37eca8 100644
> --- a/defaultenv/bin/boot
> +++ b/defaultenv/bin/boot
> @@ -6,19 +6,35 @@ if [ x$kernel_loc = xnet ]; then
>  	kernel_loc=tftp
>  fi
>  
> -if [ x$1 = xnand ]; then
> +while getopt "hk:r:i:m:" Option
> +do
> +if [ ${Option} = k ]; then
> +	kernel_loc=${OPTARG}
> +elif [ ${Option} = r ]; then
> +	rootfs_loc=${OPTARG}
> +elif [ ${Option} = i ]; then
> +	ip=${OPTARG}
> +elif [ ${Option} = m ]; then
> +	mode=${OPTARG}
> +else
> +	. /env/bin/_boot_help
> +	exit 0
> +fi
> +done
> +
> +if [ x$mode = xnand ]; then
>  	rootfs_loc=nand
>  	kernel_loc=nand
> -elif [ x$1 = xnor ]; then
> +elif [ x$mode = xnor ]; then
>  	rootfs_loc=nor
>  	kernel_loc=nor
> -elif [ x$1 = xnfs ]; then
> +elif [ x$mode = xnfs ]; then
>  	rootfs_loc=net
>  	kernel_loc=nfs
> -elif [ x$1 = xtftp ]; then
> +elif [ x$mode = xtftp ]; then
>  	rootfs_loc=net
>  	kernel_loc=tftp
> -elif [ x$1 = xdisk ]; then
> +elif [ x$mode = xdisk ]; then
>  	rootfs_loc=disk
>  	kernel_loc=disk
>  fi
> -- 
> 1.7.7

_______________________________________________
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:[~2012-02-09 14:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-15  9:51 [PATCH 0/5] Calao dfu upload kernel or uImage and boot it Jean-Christophe PLAGNIOL-VILLARD
2012-01-15 10:00 ` [PATCH 1/5] dfu: add description how to specify the "description" to the long help Jean-Christophe PLAGNIOL-VILLARD
2012-01-15 10:00 ` [PATCH 2/5] defaultenv/boot: add getopt option support to select boot mode Jean-Christophe PLAGNIOL-VILLARD
2012-02-09 14:46   ` Jean-Christophe PLAGNIOL-VILLARD
2012-01-15 10:00 ` [PATCH 3/5] defaultenv/boot: add boot the kernel from the mem Jean-Christophe PLAGNIOL-VILLARD
2012-01-15 10:00 ` [PATCH 4/5] filetype: add command support Jean-Christophe PLAGNIOL-VILLARD
2012-01-17 10:35   ` Sascha Hauer
2012-01-15 10:00 ` [PATCH 5/5] usb-926x: add dfu mem options support Jean-Christophe PLAGNIOL-VILLARD
2012-01-17 10:29   ` Sascha Hauer

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