Compare commits

...

3 Commits
secb ... ci-fix

Author SHA1 Message Date
Simon Glass
93c8221610 binman: x86: Write skip-at-start when end-at-4gb is used
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.

Series-to: u-boot
Signed-off-by: Simon Glass <sjg@chromium.org>

Cover-letter:
binman: x86: Tidy up skip-at-start settings
A recent series [1] adjusted how Binman handles the skip-at-start
property.

This first patch in this series fixes a bug in coral due to this change.
The remaining two patches remove work-arounds which are no-longer needed
on x86

[1] https://patchwork.ozlabs.org/project/uboot/list/?series=441782
END
2025-02-15 19:02:28 -07:00
Simon Glass
d6b24eb35b binman: Read the skip-at-start value on startup
This value provides an offset for all image-pos values in the image.
Read it on startup so that we can take account of it when calculating
positions.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-15 19:02:28 -07:00
Simon Glass
8742dcd694 x86: Stop working around skip-at-start
With a recent Binman change, the skip-at-start property is now honoured,
meaning that all image-pos values in the affected section start from
the skip-at-start value.

The x86 code works around the old behaviour at present, so update it.

This fixes booting on coral

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-15 19:02:02 -07:00
3 changed files with 20 additions and 5 deletions

View File

@@ -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 & mask) - CONFIG_ROM_SIZE;
rom_offset = map_base;
} else {
ret = -ENOENT;
if (false)

View File

@@ -16,12 +16,15 @@
* struct binman_info - Information needed by the binman library
*
* @image: Node describing the image we are running from
* @skip_at_start: Number of bytes skipped at the start of the image. This is
* the value of the skip-at-start property for the image
* @rom_offset: Offset from an image_pos to the memory-mapped address, or
* ROM_OFFSET_NONE if the ROM is not memory-mapped. Can be positive or
* negative
*/
struct binman_info {
ofnode image;
uint skip_at_start;
int rom_offset;
};
@@ -80,7 +83,14 @@ static int binman_entry_find_internal(ofnode node, const char *name,
int binman_entry_find(const char *name, struct binman_entry *entry)
{
return binman_entry_find_internal(binman->image, name, entry);
int ret;
ret = binman_entry_find_internal(binman->image, name, entry);
if (ret)
return log_msg_ret("bef", ret);
entry->image_pos -= binman->skip_at_start;
return 0;
}
int binman_entry_map(ofnode parent, const char *name, void **bufp, int *sizep)
@@ -107,7 +117,7 @@ ofnode binman_section_find_node(const char *name)
void binman_set_rom_offset(int rom_offset)
{
binman->rom_offset = rom_offset;
binman->rom_offset = rom_offset - binman->skip_at_start;
}
int binman_get_rom_offset(void)
@@ -140,10 +150,12 @@ int binman_init(void)
binman = malloc(sizeof(struct binman_info));
if (!binman)
return log_msg_ret("space for binman", -ENOMEM);
memset(binman, '\0', sizeof(struct binman_info));
ret = find_image_node(&binman->image);
if (ret)
return log_msg_ret("node", -ENOENT);
binman_set_rom_offset(ROM_OFFSET_NONE);
ofnode_read_u32(binman->image, "skip-at-start", &binman->skip_at_start);
log_debug("binman: Selected image node '%s'\n",
ofnode_get_name(binman->image));

View File

@@ -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()