Add coreboot support to cros_bundle_firmware

Needs:
http://gerrit.chromium.org/gerrit/#change,6105
http://gerrit.chromium.org/gerrit/#change,5856

BUG=chrome-os-partner:4563
TEST=emerge-x86-alex chromeos-bootimage

Change-Id: I398d604a96d1e696ae4d82455f88140c347ddbd7
Reviewed-on: http://gerrit.chromium.org/gerrit/6102
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Stefan Reinauer <reinauer@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
diff --git a/host/lib/bundle_firmware.py b/host/lib/bundle_firmware.py
index 8790f09..ab42047 100644
--- a/host/lib/bundle_firmware.py
+++ b/host/lib/bundle_firmware.py
@@ -93,6 +93,7 @@
     self.bct_fname = None       # Filename of our BCT file.
     self.fdt = None             # Our Fdt object.
     self.bmpblk_fname = None    # Filename of our Bitmap Block
+    self.coreboot_fname = None  # Filename of our coreboot binary.
 
   def SetDirs(self, keydir):
     """Set up directories required for Bundle.
@@ -102,7 +103,7 @@
     """
     self._keydir = keydir
 
-  def SetFiles(self, board, bct, uboot=None, bmpblk=None):
+  def SetFiles(self, board, bct, uboot=None, bmpblk=None, coreboot=None):
     """Set up files required for Bundle.
 
     Args:
@@ -110,11 +111,13 @@
       uboot: The filename of the u-boot.bin image to use.
       bct: The filename of the binary BCT file to use.
       bmpblk: The filename of bitmap block file to use.
+      coreboot: The filename of the coreboot image to use (on x86)
     """
     self._board = board
     self.uboot_fname = uboot
     self.bct_fname = bct
     self.bmpblk_fname = bmpblk
+    self.coreboot_fname = coreboot
 
   def SetOptions(self, small):
     """Set up options supported by Bundle.
@@ -327,8 +330,15 @@
     """
     self._out.Notice("Model: %s" % fdt.GetString('/model'))
 
-    # Create the boot stub, which is U-Boot plus an fdt and bct
-    bootstub, signed = self._CreateBootStub(self.uboot_fname, fdt)
+    if self.coreboot_fname:
+      # FIXME(reinauer) the names are not too great choices.
+      # signed gets packed into the bootstub, and bootstub gets
+      # packed into the RW sections.
+      signed = self.coreboot_fname
+      bootstub = self.uboot_fname
+    else:
+      # Create the boot stub, which is U-Boot plus an fdt and bct
+      bootstub, signed = self._CreateBootStub(self.uboot_fname, fdt)
 
     if gbb:
       pack = PackFirmware(self._tools, self._out)