[PATCH 3/3] binman: x86: Write skip-at-start when end-at-4gb is used

Simon Glass sjg at chromium.org
Sun Feb 16 03:02:37 CET 2025


The end-at-4gb property implies a value for skip-at-start so add it into
the output FDT so that U-Boot can read it.

Now that skip-at-start is implemented, we can drop the workarounds used
in the x86 code to obtain the correct image-pos value.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 arch/x86/cpu/intel_common/intel_opregion.c | 1 -
 arch/x86/lib/fsp2/fsp_init.c               | 3 +--
 tools/binman/etype/section.py              | 6 +++++-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/x86/cpu/intel_common/intel_opregion.c b/arch/x86/cpu/intel_common/intel_opregion.c
index 4a2717b3584..78caff0dc12 100644
--- a/arch/x86/cpu/intel_common/intel_opregion.c
+++ b/arch/x86/cpu/intel_common/intel_opregion.c
@@ -31,7 +31,6 @@ static int locate_vbt(char **vbtp, int *sizep)
 	size = vbt.size;
 	if (size > sizeof(vbt_data))
 		return log_msg_ret("vbt", -E2BIG);
-	vbt.image_pos += CONFIG_ROM_SIZE;
 	ret = spi_flash_read_dm(dev, vbt.image_pos, size, vbt_data);
 	if (ret)
 		return log_msg_ret("read", ret);
diff --git a/arch/x86/lib/fsp2/fsp_init.c b/arch/x86/lib/fsp2/fsp_init.c
index e4a87d8b2e1..4b5f9889655 100644
--- a/arch/x86/lib/fsp2/fsp_init.c
+++ b/arch/x86/lib/fsp2/fsp_init.c
@@ -107,7 +107,6 @@ int fsp_locate_fsp(enum fsp_type_t type, struct binman_entry *entry,
 		   bool use_spi_flash, struct udevice **devp,
 		   struct fsp_header **hdrp, ulong *rom_offsetp)
 {
-	ulong mask = CONFIG_ROM_SIZE - 1;
 	struct udevice *dev;
 	ulong rom_offset = 0;
 	uint map_size;
@@ -141,7 +140,7 @@ int fsp_locate_fsp(enum fsp_type_t type, struct binman_entry *entry,
 		if (ret)
 			return log_msg_ret("binman entry", ret);
 		if (!use_spi_flash)
-			rom_offset = map_base + CONFIG_ROM_SIZE;
+			rom_offset = map_base;
 	} else {
 		ret = -ENOENT;
 		if (false)
diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py
index 5e11cf58d28..5c371397ffb 100644
--- a/tools/binman/etype/section.py
+++ b/tools/binman/etype/section.py
@@ -189,7 +189,7 @@ class Entry_section(Entry):
         self._sort = fdt_util.GetBool(self._node, 'sort-by-offset')
         self._end_at_4gb = fdt_util.GetBool(self._node, 'end-at-4gb')
         self._skip_at_start = fdt_util.GetInt(self._node, 'skip-at-start')
-        if self._end_at_4gb:
+        if self._end_at_4gb and self.GetImage().copy_to_orig:
             if not self.size:
                 self.Raise("Section size must be provided when using end-at-4gb")
             if self._skip_at_start is not None:
@@ -263,6 +263,8 @@ class Entry_section(Entry):
         super().AddMissingProperties(have_image_pos)
         if self.compress != 'none':
             have_image_pos = False
+        if self._end_at_4gb:
+            state.AddZeroProp(self._node, 'skip-at-start')
         for entry in self._entries.values():
             entry.AddMissingProperties(have_image_pos)
 
@@ -505,6 +507,8 @@ class Entry_section(Entry):
 
     def SetCalculatedProperties(self):
         super().SetCalculatedProperties()
+        if self._end_at_4gb:
+            state.SetInt(self._node, 'skip-at-start', self._skip_at_start)
         for entry in self._entries.values():
             entry.SetCalculatedProperties()
 
-- 
2.43.0



More information about the U-Boot mailing list