cmd: load: add load command for memory mapped

cp.b is used a lot as a way to load binaries to memory and execute
them, however we may need to integrate this with the efi subsystem to
set it up as a bootdev.

So, introduce a loadm command that will be consistent with the other
loadX commands and will call the efi API's.

ex: loadm $kernel_addr $kernel_addr_r $kernel_size

with this a kernel with CONFIG_EFI_STUB enabled will be loaded and
then subsequently booted with bootefi command.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
Rui Miguel Silva 2022-05-11 10:55:40 +01:00 committed by Tom Rini
parent a47ce34403
commit bfef72e4dd
14 changed files with 209 additions and 0 deletions

View file

@ -1158,6 +1158,8 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr,
{
struct blk_desc *desc = NULL;
struct disk_partition fs_partition;
size_t image_size;
void *image_addr;
int part = 0;
char *filename;
char *s;
@ -1173,6 +1175,13 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr,
} else if (!strcmp(dev, "Uart")) {
if (device)
*device = efi_dp_from_uart();
} else if (!strcmp(dev, "Mem")) {
efi_get_image_parameters(&image_addr, &image_size);
if (device)
*device = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE,
(uintptr_t)image_addr,
image_size);
} else {
part = blk_get_device_part_str(dev, devnr, &desc, &fs_partition,
1);