Add Calculating the version id beforehand

The version id can now be calculated beforehand, add that
to the code-update.md.

Change-Id: I245e277e0a922121e371664f11719bec2e4fd20a
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/code-update.md b/code-update.md
index 30c1646..8b1e581 100644
--- a/code-update.md
+++ b/code-update.md
@@ -221,10 +221,10 @@
         https://bmc/xyz/openbmc_project/software/action/DownloadViaTFTP
       ```
 
-3. Note the version id generated for that image file, which is a hash value of 8
-hexadecimal numbers generated by the C++ function std::hash using the version
-string contained in the image (TODO: the hash algorithm may change to allow users
-to calculate it externally openbmc/openbmc#2274) via one of the following methods:
+3. Note the version id generated for that image file. The version id is a hash
+value of 8 hexadecimal numbers, generated by SHA-512 hashing the version
+string contained in the image and taking the first 8 characters. Get the
+version id via one of the following methods:
 
   * Method 1: From the BMC command line, note the most recent directory name
     created under `/tmp/images/`, in this example it'd be `2a1022fe`:
@@ -236,8 +236,9 @@
       drwx------    2 root     root            80 Aug 22 07:53 488449a2
       ```
 
-  * Method 2: Using the REST API, note the object that has its Activation
-    property set to Ready, in this example it'd be `2a1022fe`:
+  * Method 2: This method *only* works if there are no `Ready` images at the
+    start of transferring the image. Using the REST API, note the object that
+    has its Activation property set to Ready, in this example it'd be `2a1022fe`:
 
       ```
       $ curl -b cjar -k https://bmc/xyz/openbmc_project/software/enumerate
@@ -247,6 +248,12 @@
             "Activation": "xyz.openbmc_project.Software.Activation.Activations.Ready",
       ```
 
+  * Method 3: Calculate the version id beforehand from the image with:
+
+      ```
+      tar xfO <squashfs image tar> MANIFEST | sed -ne '/version=/ {s/version=//;p}' | head -n1 | tr -d '\n' | sha512sum | cut -b 1-8
+      ```
+
 4. To initiate the update, set the `RequestedActivation` property of the desired
 image to `Active`, substitute ``<id>`` with the hash value noted on the previous
 step, this will write the contents of the image to a UBI volume in the PNOR chip