summaryrefslogtreecommitdiff
path: root/tools/binman/etype
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-09-14 04:57:34 -0600
committerSimon Glass <sjg@chromium.org>2018-09-29 11:49:35 -0600
commitf8f8df6eb870b53e025aa447f8d40cd2ce2a77f6 (patch)
tree855c9fc502d44854dd969a1ea671088c09f089a9 /tools/binman/etype
parent08723a7abbc7e28b22d18684faf5142fc6f155e8 (diff)
binman: Correct fmap output on x86
Normally x86 platforms use the end-at-4gb option. This currently produces an FMAP with positions which have a large offset. The use of end-at-4gb is a useful convenience within binman, but we don't really want to export a map with these offsets. Fix this by subtracting the 'skip at start' parameter. Also put the code which convers names to fmap format, for clarity. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/etype')
-rw-r--r--tools/binman/etype/fmap.py11
-rw-r--r--tools/binman/etype/u_boot_with_ucode_ptr.py12
2 files changed, 13 insertions, 10 deletions
diff --git a/tools/binman/etype/fmap.py b/tools/binman/etype/fmap.py
index f1dd81ec49..bf35a5bbf4 100644
--- a/tools/binman/etype/fmap.py
+++ b/tools/binman/etype/fmap.py
@@ -42,14 +42,17 @@ class Entry_fmap(Entry):
for subentry in entries.values():
_AddEntries(areas, subentry)
else:
- areas.append(fmap_util.FmapArea(entry.image_pos or 0,
- entry.size or 0, entry.name, 0))
+ pos = entry.image_pos
+ if pos is not None:
+ pos -= entry.section.GetRootSkipAtStart()
+ areas.append(fmap_util.FmapArea(pos or 0, entry.size or 0,
+ entry.name, 0))
- entries = self.section.GetEntries()
+ entries = self.section._image.GetEntries()
areas = []
for entry in entries.values():
_AddEntries(areas, entry)
- return fmap_util.EncodeFmap(self.section.GetSize() or 0, self.name,
+ return fmap_util.EncodeFmap(self.section.GetImageSize() or 0, self.name,
areas)
def ObtainContents(self):
diff --git a/tools/binman/etype/u_boot_with_ucode_ptr.py b/tools/binman/etype/u_boot_with_ucode_ptr.py
index 01f3513e7d..da0e12417b 100644
--- a/tools/binman/etype/u_boot_with_ucode_ptr.py
+++ b/tools/binman/etype/u_boot_with_ucode_ptr.py
@@ -66,11 +66,11 @@ class Entry_u_boot_with_ucode_ptr(Entry_blob):
# the U-Boot region must start at offset 7MB in the section. In this
# case the ROM starts at 0xff800000, so the offset of the first
# entry in the section corresponds to that.
- if (self.target_offset < self.offset or
- self.target_offset >= self.offset + self.size):
- self.Raise('Microcode pointer _dt_ucode_base_size at %08x is '
- 'outside the section ranging from %08x to %08x' %
- (self.target_offset, self.offset, self.offset + self.size))
+ if (self.target_offset < self.image_pos or
+ self.target_offset >= self.image_pos + self.size):
+ self.Raise('Microcode pointer _dt_ucode_base_size at %08x is outside the section ranging from %08x to %08x' %
+ (self.target_offset, self.image_pos,
+ self.image_pos + self.size))
# Get the microcode, either from u-boot-ucode or u-boot-dtb-with-ucode.
# If we have left the microcode in the device tree, then it will be
@@ -90,7 +90,7 @@ class Entry_u_boot_with_ucode_ptr(Entry_blob):
# Write the microcode offset and size into the entry
offset_and_size = struct.pack('<2L', offset, size)
- self.target_offset -= self.offset
+ self.target_offset -= self.image_pos
self.ProcessContentsUpdate(self.data[:self.target_offset] +
offset_and_size +
self.data[self.target_offset + 8:])