| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Many platforms have DRAM starting at address 0, which clashes with
barebox placing kernel images there, as barebox does that before
shutting down and turning off the MMU.
The <zero_page.h> header allows temporarily disabling the faulting
zero page and is already used for boot other types of kernel images,
so use it for ELF images as well.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20230913125715.2142524-2-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For a program header, the value of 'p_filesz' may be less than the one
of 'p_memsz', in which case the leftover amount of space should be
filled with zeroes. This is done correctly when loading elf to memory.
However, when we are requesting memory beforehand we do pass the value
of 'p_filesz', instead of 'p_memsz', to 'request_sdram_region',
resulting in potentially smaller amount of memory to be reserved.
As 'p_memsz' is always greater or equal to 'p_filesz', use only the
former for checking memory requirements in 'request_elf_segment'.
Signed-off-by: Denis Orlov <denorl2009@gmail.com>
Link: https://lore.barebox.org/20230315101126.4101087-1-denorl2009@gmail.com
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
| |
Both errno_str() and printf("%m" end up calling strerror(). %m is
more convenient to use, so switch over all instances to it.
No functional change.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20221010061122.2084009-3-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
| |
In order to load elf from a binary buffer, add elf_load_binary. This
will be used by FIT support to allow loading an elf from FIT.
Signed-off-by: Clement Leger <clement.leger@bootlin.com>
Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>
Link: https://lore.barebox.org/20220117221917.26970-5-jmaselbas@kalray.eu
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
| |
In order to integrate elf loading into bootm command, split elf opening
from elf loading.
Signed-off-by: Clement Leger <cleger@kalray.eu>
Tested-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, elf file must be loaded into a buffer and then passed to
elf_load_image. This requires to copy the whole elf file before booting
it. This commit allows to pass the filename directly and will allocate
data only for the elf header (elf header + program headers). This will
then be used to load the elf data from the file without copying it in an
intermediate buffer. Elf segments are first parsed into a list and are
then loaded from the file in a second time.
Signed-off-by: Clement Leger <cleger@kalray.eu>
Tested-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
| |
An elf file without program headers should not be loaded. Add a check
for such cases.
Signed-off-by: Clement Leger <cleger@kalray.eu>
Tested-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
| |
This failure can be handled grecefully, use standard calloc.
Signed-off-by: Clement Leger <cleger@kalray.eu>
Tested-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
| |
When pointers are 32 bits wide and we cast a potentially 64 bits
value in it, the compiler will yield an error. Cast that value first
into a phys_addr_t to match the architecture pointer size and then
in a void *.
Signed-off-by: Clement Leger <cleger@kalray.eu>
Tested-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
| |
In order to correctly load an initrd or a device tree after an elf file,
we need to know its boundaries. This commit adds support for that and
allow the bootm implementations to use it for memory loading.
Signed-off-by: Clement Leger <cleger@kalray.eu>
Tested-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch add elf64 loading support to the elf loader. Since
elf32 and elf64 uses completely different types, to avoid copying all
the code and simply replace elf32 with elf64, use a macro which will
return the appropriate field for each type of header. This macro
generates getter for elf structures according to the class of the loaded
elf.
All direct elf struct dereference are then replaced by call to generated
functions. This allows to keep a common loader code even if types are
different.
Tested-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Clement Leger <cleger@kalray.eu>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
This parser is needed for kernel boot support on MIPS
and can potentially reused on other platforms.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|