cros_bundle_firmware: Allow a section to be hashed

Support a new 'add-hash' property to sections which indicates that the
section should have a hash value added. This is useful for the EC, where
we need to store a hash, but since there is only a single binary in the
section we would not normally do so.

BUG=chrome-os-partner:20138
BUG=chromium:249379
TEST=manual
Run 'vboot_test fmap' on pit and see that the EC hash is printed.

Peach # vboot_test fmap
ro:
   fmap: offset=0xc6000, length=0x1000
   gbb: offset=0xc7000, length=0xef000
   firmware_id: offset=0x1c6000, length=0x100
EC RO binary ro at 0xa19e0, length 0xbdcc
EC RW binary ro at 0x95d78, length 0xbc68
flash_base: 0
rw-a:
   boot: offset=0x202000, length=0xedf00
   vblock: offset=0x200000, length=0x2000
   firmware_id: offset=0x2eff00, length=0x100
block_offset: 4400
EC RW binary rw-a at 0x8fd78, length 0xbc68
EC Hash size 32:
00000000: a5 80 9f 8a 46 cc 33 b6 15 40 44 10 16 c5 48 ce    ....F.3..@D...H.
00000010: af 7c 9e 50 98 eb 2c 6d f2 2c 83 a0 29 1b 6a 19    .|.P..,m.,..).j.

rw-b:
   boot: offset=0x302000, length=0xedf00
   vblock: offset=0x300000, length=0x2000
   firmware_id: offset=0x3eff00, length=0x100
block_offset: 84400
EC RW binary rw-b at 0x8fd78, length 0xbc68
EC Hash size 32:
00000000: a5 80 9f 8a 46 cc 33 b6 15 40 44 10 16 c5 48 ce    ....F.3..@D...H.
00000010: af 7c 9e 50 98 eb 2c 6d f2 2c 83 a0 29 1b 6a 19    .|.P..,m.,..).j.

Firmware type: 0
Peach #

Run 'cros_test swsync rw' on pit in U-Boot. See that it finishes without
error (with an EC revert of commit b144a584a).

Change-Id: I8973505b54ad93ac477c4d87f3478d6bba08c570
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/58630
(cherry picked from commit 0b54e2210c911937197527fc466523aaa39b9e87)
Reviewed-on: https://gerrit.chromium.org/gerrit/59178
Commit-Queue: Katie Roberts-Hoffman <katierh@chromium.org>
Reviewed-by: Katie Roberts-Hoffman <katierh@chromium.org>
Tested-by: Katie Roberts-Hoffman <katierh@chromium.org>
1 file changed