bundle_firmware: Add step to include rootkey hash in final image

BUG=chrome-os-partner:42248
BRANCH=None
TEST=Compiles successfully and root key hash in included in final image

Change-Id: Ifc7ea9f4e54e33e889b5c566a9e646c88fe40c4b
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/294307
Trybot-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Commit-Queue: Furquan Shaikh <furquan@chromium.org>
diff --git a/host/lib/bundle_firmware.py b/host/lib/bundle_firmware.py
index bf17a16..3eddf90 100644
--- a/host/lib/bundle_firmware.py
+++ b/host/lib/bundle_firmware.py
@@ -1004,6 +1004,13 @@
 
     image = pack.GetProperty('image')
     self._tools.OutputSize('Final image', image)
+
+    # Call gbb_utility with -s <root_key> on final image to add rootkey hash
+    keydir = self._tools.Filename(self._keydir)
+    gbb_set_command = ['-s',
+                       '--rootkey=%s/root_key.vbpubk' % keydir,
+                       image]
+    self._tools.Run('gbb_utility', gbb_set_command)
     return image, pack
 
   def SelectFdt(self, fdt_fname, use_defaults):