Switch to using PNOR file
Change-Id: I3e6ec256b88a58a8c56ae2df3127a3af3ab99d6f
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/generate-squashfs b/generate-squashfs
index e4c71ba..f9d9d6d 100755
--- a/generate-squashfs
+++ b/generate-squashfs
@@ -4,7 +4,7 @@
Generates a SquashFS image from the PNOR image
-usage: generate-squashfs [OPTION]
+usage: generate-squashfs [OPTION] <PNOR FILE>...
Options:
-f, --file <file> Specify destination file. Defaults to
@@ -28,12 +28,18 @@
exit
;;
*)
- echo "Unknown option $1. Display available options with -h or --help"
- exit
+ pnorfile="$1"
+ shift 1
;;
esac
done
+if [ ! -f "${pnorfile}" ]; then
+ echo "Please enter a valid PNOR file."
+ echo "$help"
+ exit 1
+fi
+
scratch_dir=`mktemp -d` || exit 1
echo "Parsing PNOR TOC..."
@@ -56,12 +62,13 @@
# Save the partition name
partitions+=(${fields[1]})
fi
- done < <(pflash --info)
+ done < <(pflash --info -F ${pnorfile})
} > ${scratch_dir}/${tocfile}
for partition in "${partitions[@]}"; do
echo "Reading ${partition}..."
- pflash_cmd="pflash --partition=${partition} --read=${scratch_dir}/${partition}"
+ pflash_cmd="pflash --partition=${partition} --read=${scratch_dir}/${partition}
+ -F ${pnorfile}"
${pflash_cmd} || exit 1
done