cbfstool: Read XIP stage alignment requirements from ELF

On x86_64 romstage can contain page tables and a page table pointer
which have an larger alignment requirement of 4096. Instead of
hardcoding it, read if from the ELF phdrs.

Change-Id: I94e4a4209b7441ecb2966a1342c3d46625771bb8
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/82102
Reviewed-by: Shuo Liu <shuo.liu@intel.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jérémy Compostella <jeremy.compostella@intel.com>
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Arthur Heymans
2024-04-29 10:04:59 +02:00
committed by Julius Werner
parent 71c9010443
commit 6ed0ba1e93
4 changed files with 20 additions and 23 deletions

View File

@ -114,9 +114,9 @@ int elf_writer_add_rel(struct elf_writer *ew, const char *sym, Elf64_Addr addr);
int elf_writer_serialize(struct elf_writer *ew, struct buffer *out);
/*
* Calculate the loadable program's file size footprint. Returns < 0 on error,
* 0 on success.
* Calculate the loadable program's file size footprint and alignment requirements.
* Returns < 0 on error, 0 on success.
*/
int elf_program_file_size(const struct buffer *input, size_t *file_size);
int elf_program_file_size_align(const struct buffer *input, size_t *file_size, size_t *align);
#endif /* ELFPARSING_H */