mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 1/4] defaultenv/boot: switch to getopt
Date: Fri,  8 Apr 2011 15:40:05 +0200	[thread overview]
Message-ID: <1302270008-21346-1-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <20110408133713.GC13978@game.jcrosoft.org>

this will allow to add more option to overwrite the boot type
as today can only choose mode {nfs, tftp, nand, nor} and can not specify
where is each component the kernel, the rootfs and the rootfs type

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 defaultenv/bin/boot      |   20 ++++++++++++++++----
 defaultenv/bin/boot_help |   29 +++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 4 deletions(-)
 create mode 100644 defaultenv/bin/boot_help

diff --git a/defaultenv/bin/boot b/defaultenv/bin/boot
index de4fa24..4289b29 100644
--- a/defaultenv/bin/boot
+++ b/defaultenv/bin/boot
@@ -2,16 +2,28 @@
 
 . /env/config
 
-if [ x$1 = xnand ]; then
+opt_mode=""
+
+while getopt "hm:" Option
+do
+if [ ${Option} = m ]; then
+	opt_mode=${OPTARG}
+else
+	. /env/bin/boot_help
+	exit 0
+fi
+done
+
+if [ x${opt_mode} = xnand ]; then
 	rootfs_loc=nand
 	kernel_loc=nand
-elif [ x$1 = xnor ]; then
+elif [ x${opt_mode} = xnor ]; then
 	rootfs_loc=nor
 	kernel_loc=nor
-elif [ x$1 = xnfs ]; then
+elif [ x${opt_mode} = xnfs ]; then
 	rootfs_loc=net
 	kernel_loc=nfs
-elif [ x$1 = xtftp ]; then
+elif [ x${opt_mode} = xtftp ]; then
 	rootfs_loc=net
 	kernel_loc=tftp
 fi
diff --git a/defaultenv/bin/boot_help b/defaultenv/bin/boot_help
new file mode 100644
index 0000000..425c718
--- /dev/null
+++ b/defaultenv/bin/boot_help
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+echo "usage: boot [-m <mode>]"
+echo "boot."
+echo ""
+echo "options"
+echo " -m     boot mode will select kernel_loc and rootfs_loc"
+echo "         mode      kernel_loc rootfs_loc"
+echo "         nfs       nfs        nfs"
+echo "         tftp      tftp       nfs"
+echo "         nor       nor        nor"
+echo "         nand      nand       nand"
+echo ""
+echo "default is"
+echo -n "kernel_loc        "
+echo ${kernel_loc}
+echo -n "kernelimage_type  "
+echo ${kernelimage_type}
+echo -n "rootfs_loc        "
+echo ${rootfs_loc}
+echo -n "rootfs_type       "
+echo ${rootfs_type}
+echo -n "ip                "
+if [ x${ip} = x ]
+then
+	echo "static"
+else
+	echo ${ip}
+fi
-- 
1.7.4.1


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

  reply	other threads:[~2011-04-08 13:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-08 13:37 [PATCH 0/4] defaultenv boot updates Jean-Christophe PLAGNIOL-VILLARD
2011-04-08 13:40 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2011-04-08 13:40 ` [PATCH 2/4] defaultenv/boot: add -k and -t option to specify the kernel location and image type Jean-Christophe PLAGNIOL-VILLARD
2011-04-08 13:40 ` [PATCH 3/4] defaultenv/boot: add -r and -T option to select rootfs location and type Jean-Christophe PLAGNIOL-VILLARD
2011-04-08 13:40 ` [PATCH 4/4] defaultenv/boot: add -i option to select the ip mode Jean-Christophe PLAGNIOL-VILLARD
2011-04-11 10:16 ` [PATCH 0/4] defaultenv boot updates Sascha Hauer
2011-04-11 10:17   ` Jean-Christophe PLAGNIOL-VILLARD
2011-04-11 10:55     ` Sascha Hauer
2011-04-23  2:16       ` Jean-Christophe PLAGNIOL-VILLARD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1302270008-21346-1-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox