summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Mills <gmills@us.ibm.com>2017-10-23 11:05:03 -0500
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2017-11-06 18:07:58 +0000
commit6a3e4e459ac61fa5ca915f6063be5ee01524422c (patch)
tree303742165fb2e13e42206003da989a448d3bb3d4
parent29414359f4e446c36afb502927c5858ba627b7a2 (diff)
downloadopenpower-pnor-code-mgmt-6a3e4e459ac61fa5ca915f6063be5ee01524422c.tar.gz
openpower-pnor-code-mgmt-6a3e4e459ac61fa5ca915f6063be5ee01524422c.zip
Basic generate-ubi script.
The generate-ubi script generates a UBI, Unsorted Block Images, PNOR image from a PNOR SquashFS Tarball. The PNOR SquashFS Tarball is generated from the generate-squashfs script. This commit is help text and taking arguments. More to come. Change-Id: I645e8292624d1663393035dc041415b378ac9386 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
-rwxr-xr-xgenerate-ubi52
1 files changed, 52 insertions, 0 deletions
diff --git a/generate-ubi b/generate-ubi
new file mode 100755
index 000000000..3f839f115
--- /dev/null
+++ b/generate-ubi
@@ -0,0 +1,52 @@
+#!/bin/bash
+set -eo pipefail
+
+help=$'Generate PNOR UBI image from a PNOR SquashFS Tarball
+
+Generates a UBI, Unsorted Block Images, PNOR image from a PNOR SquashFS Tarball.
+The PNOR SquashFS Tarball is generated from the generate-squashfs script.
+
+usage: generate-ubi [OPTION] <PNOR SquashFS Tarball>...
+
+Options:
+ -f, --file <file> Specify destination file. Defaults to
+ `pwd`/<PNOR Tarball FILE, removing .squashfs.tar>.ubi.mtd
+ (For example, "generate-ubi my.pnor.squashfs.tar"
+ would generate `pwd`/my.pnor.ubi.mtd output.)
+ -h, --help Display this help text and exit.
+'
+
+while [[ $# -gt 0 ]]; do
+ key="$1"
+ case $key in
+ -f|--file)
+ outfile="$2"
+ shift 2
+ ;;
+ -h|--help)
+ echo "$help"
+ exit
+ ;;
+ *)
+ tarball="$1"
+ shift 1
+ ;;
+ esac
+done
+
+if [ ! -f "${tarball}" ]; then
+ echo "Please enter a PNOR SquashFS Tarball."
+ echo "To generate PNOR SquashFS Tarball see generate-squashfs"
+ echo "$help"
+ exit 1
+fi
+
+if [[ -z $outfile ]]; then
+ # Remove .squashfs.tar from end if present and add .ubi.mtd
+ outfile=`pwd`/${tarball%".squashfs.tar"}.ubi.mtd
+else
+ if [[ $outfile != /* ]]; then
+ outfile=`pwd`/$outfile
+ fi
+fi
+
OpenPOWER on IntegriCloud