summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Mills <gmills@us.ibm.com>2017-10-25 11:24:39 -0500
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2017-11-06 18:08:29 +0000
commit8f618671364e4dc88c58446b4dd96ec06dbd8e2f (patch)
treee5fe83edec6e6a116856f1537f7fd48b152a3beb
parent927ac0fa3a08c9f4a89e9b466cebe5495fc89160 (diff)
downloadopenpower-pnor-code-mgmt-8f618671364e4dc88c58446b4dd96ec06dbd8e2f.tar.gz
openpower-pnor-code-mgmt-8f618671364e4dc88c58446b4dd96ec06dbd8e2f.zip
Pass in the size of the UBI image
Allow user to pass in the size of the PNOR UBI image. Default is 128. Change-Id: Ifbd7ff0e9185e4d445f39be144f07eb907f0051e Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
-rwxr-xr-xgenerate-ubi16
1 files changed, 12 insertions, 4 deletions
diff --git a/generate-ubi b/generate-ubi
index 2633500c3..511edcb7b 100755
--- a/generate-ubi
+++ b/generate-ubi
@@ -13,8 +13,12 @@ Options:
`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.)
+ -s, --size <MiB> Specify the size of the PNOR UBI image in MiBs.
+ Defaults to 128.
-h, --help Display this help text and exit.
'
+# 128MiB is the default image size
+image_size="128"
while [[ $# -gt 0 ]]; do
key="$1"
@@ -23,6 +27,10 @@ while [[ $# -gt 0 ]]; do
outfile="$2"
shift 2
;;
+ -s|--size)
+ image_size="$2"
+ shift 2
+ ;;
-h|--help)
echo "$help"
exit
@@ -81,9 +89,9 @@ fi
FLASH_PAGE_SIZE="1"
# kibibyte(KiB)
FLASH_PEB_SIZE="64"
-# Future enhancement would be to allow this to be passed in
-# 128MiB (128 * 1024)
-FLASH_SIZE="131072"
+
+# Convert image size from MiB to KiB
+image_size=$((${image_size} * 1024))
# Create UBI volume
add_volume()
@@ -133,7 +141,7 @@ add_volume $config_file 2 dynamic pnor-rw-${version_id} "" 16MiB
# Build the UBI image
ubinize -p ${FLASH_PEB_SIZE}KiB -m ${FLASH_PAGE_SIZE} -o ${tmpfile} $config_file
-mk_nor_image ${outfile} ${FLASH_SIZE}
+mk_nor_image ${outfile} ${image_size}
dd bs=1k conv=notrunc seek=0 if=${tmpfile} of=${outfile}
echo "PNOR UBI image at ${outfile}"
OpenPOWER on IntegriCloud