From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 2/5] defaultenv/boot: add getopt option support to select boot mode
Date: Sun, 15 Jan 2012 11:00:18 +0100 [thread overview]
Message-ID: <1326621621-11484-2-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <20120115095156.GH5002@game.jcrosoft.org>
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
next prev parent reply other threads:[~2012-01-15 10:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2012-02-09 14:46 ` [PATCH 2/5] defaultenv/boot: add getopt option support to select boot mode 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
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=1326621621-11484-2-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