cros_bundle_firmware: Remove special case for default flashmap
Instead of passing the default flashmap as a special case to
PackFirmware.SelectFdt(), write the default flashmap to the FDT
directly. SelectFdt() will then do the right thing automatically.
One reason for this change is that we want to add other default
things to the device tree, not just the flashmap. For example, we
will soon implement values for the BL1 and BL2 addresses, and defaults
must be provided for booting upstream U-Boot.
Another reason is that we can remove all the special case code in
PackFirmware.SelectFdt().
BUG=chrome-os-partner:21115
TEST=FEATURES=test sudo -E emerge cros-devutils
manual:
See that all of these create images which boot on the respective boards.
This tests Chrome OS and upstream version of each board we support.
$ crosfw -b peach_pit -V
$ crosfw -b daisy
$ crosfw -b daisy -V
$ crosfw -b link
$ crosfw -b link -V
Change-Id: I942afd7972f9da098445eeaf0f78de127464ed5a
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62965
diff --git a/host/lib/bundle_firmware.py b/host/lib/bundle_firmware.py
index 1f51028..27f2d02 100644
--- a/host/lib/bundle_firmware.py
+++ b/host/lib/bundle_firmware.py
@@ -57,10 +57,16 @@
# Default flash maps for various boards we support.
# These are used when no fdt is provided (e.g. upstream U-Boot with no
# fdt. Each is a list of nodes.
+# Note: Use 'reg' instead of 'size' to fully specify the start and end of
+# each area, since there is no guarantee what order the nodes will appear
+# in the fdt, and if they are out of order the image will not boot.
default_flashmaps = {
'tegra' : [
{
- 'node' : 'ro-boot',
+ 'path' : '/flash',
+ 'reg' : [0, 0x400000],
+ }, {
+ 'path' : '/flash/ro-boot',
'label' : 'boot-stub',
'size' : 512 << 10,
'read-only' : True,
@@ -70,25 +76,28 @@
],
'daisy' : [
{
- 'node' : 'pre-boot',
+ 'path' : '/flash',
+ 'reg' : [0, 0x400000],
+ }, {
+ 'path' : '/flash/pre-boot',
'label' : "bl1 pre-boot",
- 'size' : 0x2000,
+ 'reg' : [0, 0x2000],
'read-only' : True,
'filename' : "e5250.nbl1.bin",
'type' : "blob exynos-bl1",
'required' : True,
}, {
- 'node' : 'spl',
+ 'path' : '/flash/spl',
'label' : "bl2 spl",
- 'size' : 0x4000,
+ 'reg' : [0x2000, 0x4000],
'read-only' : True,
'filename' : "bl2.bin",
'type' : "blob exynos-bl2 boot,dtb",
'required' : True,
}, {
- 'node' : 'ro-boot',
+ 'path' : '/flash/ro-boot',
'label' : "u-boot",
- 'size' : 0x9a000,
+ 'reg' : [0x6000, 0x9a000],
'read-only' : True,
'type' : "blob boot,dtb",
'required' : True,
@@ -96,15 +105,18 @@
],
'link' : [
{
- 'node' : 'si-all',
+ 'path' : '/flash',
+ 'reg' : [0, 0x800000],
+ }, {
+ 'path' : '/flash/si-all',
'label' : 'si-all',
- 'reg' : '%d %d' % (0x00000000, 0x00200000),
+ 'reg' : [0x00000000, 0x00200000],
'type' : 'ifd',
'required' : True,
}, {
- 'node' : 'ro-boot',
+ 'path' : '/flash/ro-boot',
'label' : 'boot-stub',
- 'reg' : '%d %d' % (0x00700000, 0x00100000),
+ 'reg' : [0x00700000, 0x00100000],
'read-only' : True,
'type' : 'blob coreboot',
'required' : True,
@@ -112,25 +124,28 @@
],
'peach' : [
{
- 'node' : 'pre-boot',
+ 'path' : '/flash',
+ 'reg' : [0, 0x400000],
+ }, {
+ 'path' : '/flash/pre-boot',
'label' : "bl1 pre-boot",
- 'size' : 0x2000,
+ 'reg' : [0, 0x2000],
'read-only' : True,
'filename' : "e5420.nbl1.bin",
'type' : "blob exynos-bl1",
'required' : True,
}, {
- 'node' : 'spl',
+ 'path' : '/flash/spl',
'label' : "bl2 spl",
- 'size' : 0x4000,
+ 'reg' : [0x2000, 0x8000],
'read-only' : True,
'filename' : "bl2.bin",
'type' : "blob exynos-bl2 boot,dtb",
'required' : True,
}, {
- 'node' : 'ro-boot',
+ 'path' : '/flash/ro-boot',
'label' : "u-boot",
- 'size' : 0x9a000,
+ 'reg' : [0xa000, 0x9a000],
'read-only' : True,
'type' : "blob boot,dtb",
'required' : True,
@@ -912,7 +927,10 @@
fdt.PutInteger('/flash/rw-a-vblock', 'preamble-flags', 0)
fdt.PutInteger('/flash/rw-b-vblock', 'preamble-flags', 0)
- pack.SelectFdt(fdt, self._board, default_flashmap)
+ if not fdt.GetProp('/flash', 'reg', ''):
+ fdt.InsertNodes(default_flashmap)
+
+ pack.SelectFdt(fdt, self._board)
# Get all our blobs ready
pack.AddProperty('boot', self.uboot_fname)