mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] defaultenv/boot: add support for oftree boot option support
@ 2012-04-08  9:27 Jean-Christophe PLAGNIOL-VILLARD
  2012-04-08  9:27 ` [PATCH 2/3] net: dhcp: add private extention 224 to pass the oftree file via dhcp Jean-Christophe PLAGNIOL-VILLARD
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-04-08  9:27 UTC (permalink / raw)
  To: barebox

you can now specify in the same way as it's done for the kernel where is
stored the oftree.

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

diff --git a/defaultenv/bin/_boot_help b/defaultenv/bin/_boot_help
index 7c96444..a07e4e0 100644
--- a/defaultenv/bin/_boot_help
+++ b/defaultenv/bin/_boot_help
@@ -1,9 +1,10 @@
 #!/bin/sh
 
-echo "boot: boot [-m <mode>] [-k <kernel_option>] [-r <rootfs_option>] [-i <ip_mode>]"
+echo "boot: boot [-m <mode>] [-k <kernel_option>] [-r <rootfs_option>] [-i <ip_mode>] [-o <oftree_option]"
 echo ""
 echo "options"
 echo " - kernel        nand, nor, nfs, tftp, disk"
+echo " - oftree        nand, nor, nfs, tftp, disk or empty"
 echo " - rootfs        nand, nor, net, disk"
 echo " - ip            dhcp, dhcp-barebox none, empty"
 echo ""
diff --git a/defaultenv/bin/boot b/defaultenv/bin/boot
index ba04373..5186aee 100644
--- a/defaultenv/bin/boot
+++ b/defaultenv/bin/boot
@@ -6,12 +6,14 @@ if [ x$kernel_loc = xnet ]; then
 	kernel_loc=tftp
 fi
 
-while getopt "hk:r:i:m:" Option
+while getopt "hk:r:i:m:o:" Option
 do
 if [ ${Option} = k ]; then
 	kernel_loc=${OPTARG}
 elif [ ${Option} = r ]; then
 	rootfs_loc=${OPTARG}
+elif [ ${Option} = o ]; then
+	oftree_loc=${OPTARG}
 elif [ ${Option} = i ]; then
 	ip=${OPTARG}
 elif [ ${Option} = m ]; then
@@ -114,6 +116,19 @@ else
 	exit 1
 fi
 
+if [ x$oftree_loc = xnfs -o x$oftree_loc = xtftp ]; then
+	odev=/oftree
+	$oftree_loc $oftreeimage $odev || exit 1
+elif [ x$oftree_loc = xnor ]; then
+	odev="/dev/nor0.oftree"
+elif [ x$oftree_loc = xnand ]; then
+	odev="/dev/nand0.oftree.bb"
+elif [ x$oftree_loc = xdisk ]; then
+	odev="/dev/$oftree_part"
+fi
+
+[ x$odev = x ] || bootm_opt="$bootm_opt -o $odev"
+
 echo "booting kernel from $kdev"
 
 bootm $bootm_opt $kdev
diff --git a/defaultenv/config b/defaultenv/config
index 63fc059..39a9c99 100644
--- a/defaultenv/config
+++ b/defaultenv/config
@@ -21,6 +21,8 @@ dhcp_vendor_id=barebox
 kernel_loc=tftp
 # can be either 'net', 'nand', 'nor', 'disk' or 'initrd'
 rootfs_loc=net
+# can be either 'tftp', 'nfs', 'nand', 'nor', 'disk' or none
+oftree_loc=tftp
 
 # for flash based rootfs: 'jffs2' or 'ubifs'
 # in case of disk any regular filesystem like 'ext2', 'ext3', 'reiserfs'
-- 
1.7.9.1


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

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

* [PATCH 2/3] net: dhcp: add private extention 224 to pass the oftree file via dhcp.
  2012-04-08  9:27 [PATCH 1/3] defaultenv/boot: add support for oftree boot option support Jean-Christophe PLAGNIOL-VILLARD
@ 2012-04-08  9:27 ` Jean-Christophe PLAGNIOL-VILLARD
  2012-04-08  9:27 ` [PATCH 3/3] defaultenv: add support of oftree file pass via dhcp (option 224) Jean-Christophe PLAGNIOL-VILLARD
  2012-04-10  7:55 ` [PATCH 1/3] defaultenv/boot: add support for oftree boot option support Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-04-08  9:27 UTC (permalink / raw)
  To: barebox

DHCP option 224 to 254 are for private use, so use one.

Export it via env dhcp_oftree_file.

E.g. the ISC dhcp server can be configured with

   | option oftree-path code 224 = string
   | class "at91sam9x5ek" {
   | match if substring (option vendor-class-identifier,0,20) = "barebox-at91sam9x5ek";
   |
   | filename "/tftpboot/atmel/at91sam9x5/sam9x5ek/zImage";
   | option tftp-server-name "192.168.200.98";
   | option root-path "192.168.200.98:/opt/work/buildroot/build/sam9x5/target";
   | option oftree-path "/tftpboot/atmel/at91sam9x5/sam9x5ek/sam9g25ek/dtb";
   | }

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

diff --git a/net/dhcp.c b/net/dhcp.c
index ad32b53..0116ba4 100644
--- a/net/dhcp.c
+++ b/net/dhcp.c
@@ -201,6 +201,10 @@ struct dhcp_opt dhcp_options[] = {
 		.option = 67,
 		.handle = bootfile_vendorex_handle,
 		.barebox_var_name = "bootfile",
+	}, {
+		.option = 224,
+		.handle = env_str_handle,
+		.barebox_var_name = "dhcp_oftree_file",
 	},
 };
 
@@ -702,3 +706,4 @@ BAREBOX_MAGICVAR(dhcp_client_uuid, "cliend uuid to send to the DHCP server");
 BAREBOX_MAGICVAR(dhcp_client_id, "cliend id to send to the DHCP server");
 BAREBOX_MAGICVAR(dhcp_user_class, "user class to send to the DHCP server");
 BAREBOX_MAGICVAR(dhcp_tftp_server_name, "TFTP server Name returned from DHCP request");
+BAREBOX_MAGICVAR(dhcp_oftree_file, "OF tree returned from DHCP request (option 224)");
-- 
1.7.9.1


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

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

* [PATCH 3/3] defaultenv: add support of oftree file pass via dhcp (option 224)
  2012-04-08  9:27 [PATCH 1/3] defaultenv/boot: add support for oftree boot option support Jean-Christophe PLAGNIOL-VILLARD
  2012-04-08  9:27 ` [PATCH 2/3] net: dhcp: add private extention 224 to pass the oftree file via dhcp Jean-Christophe PLAGNIOL-VILLARD
@ 2012-04-08  9:27 ` Jean-Christophe PLAGNIOL-VILLARD
  2012-04-10  7:55 ` [PATCH 1/3] defaultenv/boot: add support for oftree boot option support Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-04-08  9:27 UTC (permalink / raw)
  To: barebox

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

diff --git a/defaultenv/bin/boot b/defaultenv/bin/boot
index 5186aee..b54ea6b 100644
--- a/defaultenv/bin/boot
+++ b/defaultenv/bin/boot
@@ -50,6 +50,9 @@ if [ x$ip = xdhcp -o x$ip = "xdhcp-barebox" ]; then
 		if [ x$bootfile != x ]; then
 			kernelimage=$bootfile
 		fi
+		if [ x$dhcp_oftree_file != x ]; then
+			oftreeimage=$dhcp_oftree_file
+		fi
 	fi
 fi
 
-- 
1.7.9.1


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

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

* Re: [PATCH 1/3] defaultenv/boot: add support for oftree boot option support
  2012-04-08  9:27 [PATCH 1/3] defaultenv/boot: add support for oftree boot option support Jean-Christophe PLAGNIOL-VILLARD
  2012-04-08  9:27 ` [PATCH 2/3] net: dhcp: add private extention 224 to pass the oftree file via dhcp Jean-Christophe PLAGNIOL-VILLARD
  2012-04-08  9:27 ` [PATCH 3/3] defaultenv: add support of oftree file pass via dhcp (option 224) Jean-Christophe PLAGNIOL-VILLARD
@ 2012-04-10  7:55 ` Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2012-04-10  7:55 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Sun, Apr 08, 2012 at 11:27:20AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> you can now specify in the same way as it's done for the kernel where is
> stored the oftree.

Applied, thanks

Sascha

> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  defaultenv/bin/_boot_help |    3 ++-
>  defaultenv/bin/boot       |   17 ++++++++++++++++-
>  defaultenv/config         |    2 ++
>  3 files changed, 20 insertions(+), 2 deletions(-)
> 
> diff --git a/defaultenv/bin/_boot_help b/defaultenv/bin/_boot_help
> index 7c96444..a07e4e0 100644
> --- a/defaultenv/bin/_boot_help
> +++ b/defaultenv/bin/_boot_help
> @@ -1,9 +1,10 @@
>  #!/bin/sh
>  
> -echo "boot: boot [-m <mode>] [-k <kernel_option>] [-r <rootfs_option>] [-i <ip_mode>]"
> +echo "boot: boot [-m <mode>] [-k <kernel_option>] [-r <rootfs_option>] [-i <ip_mode>] [-o <oftree_option]"
>  echo ""
>  echo "options"
>  echo " - kernel        nand, nor, nfs, tftp, disk"
> +echo " - oftree        nand, nor, nfs, tftp, disk or empty"
>  echo " - rootfs        nand, nor, net, disk"
>  echo " - ip            dhcp, dhcp-barebox none, empty"
>  echo ""
> diff --git a/defaultenv/bin/boot b/defaultenv/bin/boot
> index ba04373..5186aee 100644
> --- a/defaultenv/bin/boot
> +++ b/defaultenv/bin/boot
> @@ -6,12 +6,14 @@ if [ x$kernel_loc = xnet ]; then
>  	kernel_loc=tftp
>  fi
>  
> -while getopt "hk:r:i:m:" Option
> +while getopt "hk:r:i:m:o:" Option
>  do
>  if [ ${Option} = k ]; then
>  	kernel_loc=${OPTARG}
>  elif [ ${Option} = r ]; then
>  	rootfs_loc=${OPTARG}
> +elif [ ${Option} = o ]; then
> +	oftree_loc=${OPTARG}
>  elif [ ${Option} = i ]; then
>  	ip=${OPTARG}
>  elif [ ${Option} = m ]; then
> @@ -114,6 +116,19 @@ else
>  	exit 1
>  fi
>  
> +if [ x$oftree_loc = xnfs -o x$oftree_loc = xtftp ]; then
> +	odev=/oftree
> +	$oftree_loc $oftreeimage $odev || exit 1
> +elif [ x$oftree_loc = xnor ]; then
> +	odev="/dev/nor0.oftree"
> +elif [ x$oftree_loc = xnand ]; then
> +	odev="/dev/nand0.oftree.bb"
> +elif [ x$oftree_loc = xdisk ]; then
> +	odev="/dev/$oftree_part"
> +fi
> +
> +[ x$odev = x ] || bootm_opt="$bootm_opt -o $odev"
> +
>  echo "booting kernel from $kdev"
>  
>  bootm $bootm_opt $kdev
> diff --git a/defaultenv/config b/defaultenv/config
> index 63fc059..39a9c99 100644
> --- a/defaultenv/config
> +++ b/defaultenv/config
> @@ -21,6 +21,8 @@ dhcp_vendor_id=barebox
>  kernel_loc=tftp
>  # can be either 'net', 'nand', 'nor', 'disk' or 'initrd'
>  rootfs_loc=net
> +# can be either 'tftp', 'nfs', 'nand', 'nor', 'disk' or none
> +oftree_loc=tftp
>  
>  # for flash based rootfs: 'jffs2' or 'ubifs'
>  # in case of disk any regular filesystem like 'ext2', 'ext3', 'reiserfs'
> -- 
> 1.7.9.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
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] 4+ messages in thread

end of thread, other threads:[~2012-04-10  7:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-08  9:27 [PATCH 1/3] defaultenv/boot: add support for oftree boot option support Jean-Christophe PLAGNIOL-VILLARD
2012-04-08  9:27 ` [PATCH 2/3] net: dhcp: add private extention 224 to pass the oftree file via dhcp Jean-Christophe PLAGNIOL-VILLARD
2012-04-08  9:27 ` [PATCH 3/3] defaultenv: add support of oftree file pass via dhcp (option 224) Jean-Christophe PLAGNIOL-VILLARD
2012-04-10  7:55 ` [PATCH 1/3] defaultenv/boot: add support for oftree boot option support Sascha Hauer

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