mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 00:32:04 +02:00
bootstage: Copy bootstage strings post-relocation
Any pointers to name strings that were passed to bootstage_mark_name() pre-relocation should be copied post-relocation so that they don't get trashed as the original location of U-Boot is re-used for other purposes. This change introduces a new API call that should be called from board_init_r() after malloc has been initted on any board that uses bootstage. Signed-off-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
committed by
Simon Glass
parent
e802ee0f99
commit
150678a582
@@ -56,6 +56,21 @@ struct bootstage_hdr {
|
||||
uint32_t magic; /* Unused */
|
||||
};
|
||||
|
||||
int bootstage_relocate(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Duplicate all strings. They may point to an old location in the
|
||||
* program .text section that can eventually get trashed.
|
||||
*/
|
||||
for (i = 0; i < BOOTSTAGE_ID_COUNT; i++)
|
||||
if (record[i].name)
|
||||
record[i].name = strdup(record[i].name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
ulong bootstage_add_record(enum bootstage_id id, const char *name,
|
||||
int flags, ulong mark)
|
||||
{
|
||||
|
Reference in New Issue
Block a user