cros_bundle_firmware: Move adding the payload earlier
That way it's also in cb_with_fmap.
BUG=chromium:595715
BRANCH=none
TEST=none
Change-Id: Ic4aeef1a8085dc0461884d4f66cd9bf67629f143
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://chromium-review.googlesource.com/397621
Commit-Ready: Patrick Georgi <pgeorgi@chromium.org>
Tested-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
diff --git a/host/lib/bundle_firmware.py b/host/lib/bundle_firmware.py
index acf599d..650f910 100644
--- a/host/lib/bundle_firmware.py
+++ b/host/lib/bundle_firmware.py
@@ -630,6 +630,38 @@
if self.rocbfs_files:
self._AddCbfsFiles(bootstub, self.rocbfs_files)
+ # Make a copy of the fdt for the bootstub
+ fdt_data = self._tools.ReadFile(self.fdt.fname)
+ # Fix up the coreboot image here, since we can't do this until we have
+ # a final device tree binary.
+ fdt = self.fdt.Copy(os.path.join(self._tools.outdir, 'bootstub.dtb'))
+ if self.coreboot_elf:
+ self._tools.Run('cbfstool', [bootstub, 'add-payload', '-f',
+ self.coreboot_elf, '-n', 'fallback/payload', '-c', 'lzma'])
+ elif self.uboot_fname:
+ uboot_data = self._tools.ReadFile(self.uboot_fname)
+ uboot_copy = os.path.join(self._tools.outdir, 'u-boot.bin')
+ self._tools.WriteFile(uboot_copy, uboot_data)
+
+ uboot_dtb = os.path.join(self._tools.outdir, 'u-boot-dtb.bin')
+ self._tools.WriteFile(uboot_dtb, uboot_data + fdt_data)
+
+ text_base = 0x1110000
+
+ # This is the the 'movw $GD_FLG_COLD_BOOT, %bx' instruction
+ # 1110015: 66 bb 00 01 mov $0x100,%bx
+ marker = struct.pack('<L', 0x0100bb66)
+ pos = uboot_data.find(marker)
+ if pos == -1 or pos > 0x100:
+ raise ValueError('Cannot find U-Boot cold boot entry point')
+ entry = text_base + pos
+ self._out.Notice('U-Boot entry point %#08x' % entry)
+ self._tools.Run('cbfstool', [bootstub, 'add-flat-binary', '-f',
+ uboot_dtb, '-n', 'fallback/payload', '-c', 'lzma',
+ '-l', '%#x' % text_base, '-e', '%#x' % entry])
+ self._tools.Run('cbfstool', [bootstub, 'add', '-f', fdt.fname,
+ '-n', 'u-boot.dtb', '-t', '0xac'])
+
# Create a coreboot copy to use as a scratch pad.
cb_copy = os.path.abspath(os.path.join(self._tools.outdir, 'cb_with_fmap'))
self._tools.WriteFile(cb_copy, self._tools.ReadFile(bootstub))
@@ -953,38 +985,7 @@
pack.CheckProperties()
- # Make a copy of the fdt for the bootstub
- fdt_data = self._tools.ReadFile(fdt.fname)
- # Fix up the coreboot image here, since we can't do this until we have
- # a final device tree binary.
bootstub = pack.GetProperty('coreboot')
- fdt = fdt.Copy(os.path.join(self._tools.outdir, 'bootstub.dtb'))
- if self.coreboot_elf:
- self._tools.Run('cbfstool', [bootstub, 'add-payload', '-f',
- self.coreboot_elf, '-n', 'fallback/payload', '-c', 'lzma'])
- elif self.uboot_fname:
- uboot_data = self._tools.ReadFile(self.uboot_fname)
- uboot_copy = os.path.join(self._tools.outdir, 'u-boot.bin')
- self._tools.WriteFile(uboot_copy, uboot_data)
-
- uboot_dtb = os.path.join(self._tools.outdir, 'u-boot-dtb.bin')
- self._tools.WriteFile(uboot_dtb, uboot_data + fdt_data)
-
- text_base = 0x1110000
-
- # This is the the 'movw $GD_FLG_COLD_BOOT, %bx' instruction
- # 1110015: 66 bb 00 01 mov $0x100,%bx
- marker = struct.pack('<L', 0x0100bb66)
- pos = uboot_data.find(marker)
- if pos == -1 or pos > 0x100:
- raise ValueError('Cannot find U-Boot cold boot entry point')
- entry = text_base + pos
- self._out.Notice('U-Boot entry point %#08x' % entry)
- self._tools.Run('cbfstool', [bootstub, 'add-flat-binary', '-f',
- uboot_dtb, '-n', 'fallback/payload', '-c', 'lzma',
- '-l', '%#x' % text_base, '-e', '%#x' % entry])
- self._tools.Run('cbfstool', [bootstub, 'add', '-f', fdt.fname,
- '-n', 'u-boot.dtb', '-t', '0xac'])
data = self._tools.ReadFile(bootstub)
bootstub_copy = os.path.join(self._tools.outdir, 'coreboot-8mb.rom')
self._tools.WriteFile(bootstub_copy, data)