[PATCH 1/4] defaultenv/boot: switch to getopt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox


[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux