Merge tag 'efi-2025-01-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request efi-2025-01-rc1 Documentation: * Move the generic memory-documentation to doc/ * Fix typo boormethod UEFI: * Delete rng-seed if having EFI RNG protocol * Don't call restart_uboot in EFI watchdog test * Simplify building EFI binaries in Makefile * Show FirmwareVendor and FirmwareRevision in helloworld * Add debug output for efi bootmeth Other: * CONFIG_CMD_CLK should depend on CONFIG_CLK * simplify clk command * enable clk command on the sandbox
This commit is contained in:
45
README
45
README
@@ -2516,51 +2516,6 @@ On RISC-V, the following registers are used:
|
||||
|
||||
==> U-Boot will use gp to hold a pointer to the global data
|
||||
|
||||
Memory Management:
|
||||
------------------
|
||||
|
||||
U-Boot runs in system state and uses physical addresses, i.e. the
|
||||
MMU is not used either for address mapping nor for memory protection.
|
||||
|
||||
The available memory is mapped to fixed addresses using the memory
|
||||
controller. In this process, a contiguous block is formed for each
|
||||
memory type (Flash, SDRAM, SRAM), even when it consists of several
|
||||
physical memory banks.
|
||||
|
||||
U-Boot is installed in the first 128 kB of the first Flash bank (on
|
||||
TQM8xxL modules this is the range 0x40000000 ... 0x4001FFFF). After
|
||||
booting and sizing and initializing DRAM, the code relocates itself
|
||||
to the upper end of DRAM. Immediately below the U-Boot code some
|
||||
memory is reserved for use by malloc() [see CONFIG_SYS_MALLOC_LEN
|
||||
configuration setting]. Below that, a structure with global Board
|
||||
Info data is placed, followed by the stack (growing downward).
|
||||
|
||||
Additionally, some exception handler code is copied to the low 8 kB
|
||||
of DRAM (0x00000000 ... 0x00001FFF).
|
||||
|
||||
So a typical memory configuration with 16 MB of DRAM could look like
|
||||
this:
|
||||
|
||||
0x0000 0000 Exception Vector code
|
||||
:
|
||||
0x0000 1FFF
|
||||
0x0000 2000 Free for Application Use
|
||||
:
|
||||
:
|
||||
|
||||
:
|
||||
:
|
||||
0x00FB FF20 Monitor Stack (Growing downward)
|
||||
0x00FB FFAC Board Info Data and permanent copy of global data
|
||||
0x00FC 0000 Malloc Arena
|
||||
:
|
||||
0x00FD FFFF
|
||||
0x00FE 0000 RAM Copy of Monitor Code
|
||||
... eventually: LCD or video framebuffer
|
||||
... eventually: pRAM (Protected RAM - unchanged by reset)
|
||||
0x00FF FFFF [End of RAM]
|
||||
|
||||
|
||||
System Initialization:
|
||||
----------------------
|
||||
|
||||
|
@@ -129,11 +129,3 @@ CFLAGS_REMOVE_$(EFI_CRT0) := $(CFLAGS_NON_EFI)
|
||||
|
||||
CFLAGS_$(EFI_RELOC) := $(CFLAGS_EFI)
|
||||
CFLAGS_REMOVE_$(EFI_RELOC) := $(CFLAGS_NON_EFI)
|
||||
|
||||
extra-$(CONFIG_CMD_BOOTEFI_HELLO_COMPILE) += $(EFI_CRT0) $(EFI_RELOC)
|
||||
# TODO: As of v2019.01 the relocation code for the EFI application cannot
|
||||
# be built on ARMv7-M.
|
||||
ifndef CONFIG_CPU_V7M
|
||||
#extra-$(CONFIG_CMD_BOOTEFI_SELFTEST) += $(EFI_CRT0) $(EFI_RELOC)
|
||||
endif
|
||||
extra-$(CONFIG_EFI) += $(EFI_CRT0) $(EFI_RELOC)
|
||||
|
@@ -36,10 +36,6 @@ CFLAGS_REMOVE_$(EFI_CRT0) := $(CFLAGS_NON_EFI)
|
||||
CFLAGS_$(EFI_RELOC) := $(CFLAGS_EFI)
|
||||
CFLAGS_REMOVE_$(EFI_RELOC) := $(CFLAGS_NON_EFI)
|
||||
|
||||
extra-$(CONFIG_CMD_BOOTEFI_HELLO_COMPILE) += $(EFI_CRT0) $(EFI_RELOC)
|
||||
extra-$(CONFIG_CMD_BOOTEFI_SELFTEST) += $(EFI_CRT0) $(EFI_RELOC)
|
||||
extra-$(CONFIG_EFI) += $(EFI_CRT0) $(EFI_RELOC)
|
||||
|
||||
obj-$(CONFIG_$(SPL_TPL_)USE_ARCH_MEMSET) += memset.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)USE_ARCH_MEMMOVE) += memmove.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)USE_ARCH_MEMCPY) += memcpy.o
|
||||
|
@@ -87,19 +87,3 @@ extra-$(CONFIG_EFI_STUB_32BIT) += crt0_ia32_efi.o reloc_ia32_efi.o
|
||||
extra-$(CONFIG_EFI_STUB_64BIT) += crt0_x86_64_efi.o reloc_x86_64_efi.o
|
||||
|
||||
endif
|
||||
|
||||
ifdef CONFIG_EFI_STUB
|
||||
|
||||
ifeq ($(CONFIG_$(SPL_)X86_64),)
|
||||
extra-y += $(EFI_CRT0) $(EFI_RELOC)
|
||||
endif
|
||||
|
||||
else
|
||||
|
||||
ifndef CONFIG_SPL_BUILD
|
||||
ifneq ($(CONFIG_CMD_BOOTEFI_SELFTEST)$(CONFIG_CMD_BOOTEFI_HELLO_COMPILE),)
|
||||
extra-y += $(EFI_CRT0) $(EFI_RELOC)
|
||||
endif
|
||||
endif
|
||||
|
||||
endif
|
||||
|
@@ -162,8 +162,10 @@ static int distro_efi_try_bootflow_files(struct udevice *dev,
|
||||
int ret, seq;
|
||||
|
||||
/* We require a partition table */
|
||||
if (!bflow->part)
|
||||
if (!bflow->part) {
|
||||
log_debug("no partitions\n");
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
strcpy(fname, EFI_DIRNAME);
|
||||
strcat(fname, BOOTEFI_NAME);
|
||||
@@ -171,8 +173,10 @@ static int distro_efi_try_bootflow_files(struct udevice *dev,
|
||||
if (bflow->blk)
|
||||
desc = dev_get_uclass_plat(bflow->blk);
|
||||
ret = bootmeth_try_file(bflow, desc, NULL, fname);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
log_debug("File '%s' not found\n", fname);
|
||||
return log_msg_ret("try", ret);
|
||||
}
|
||||
|
||||
/* Since we can access the file, let's call it ready */
|
||||
bflow->state = BOOTFLOWST_READY;
|
||||
@@ -307,6 +311,8 @@ static int distro_efi_read_bootflow(struct udevice *dev, struct bootflow *bflow)
|
||||
{
|
||||
int ret;
|
||||
|
||||
log_debug("dev='%s', part=%d\n", bflow->dev->name, bflow->part);
|
||||
|
||||
/*
|
||||
* bootmeth_efi doesn't allocate any buffer neither for blk nor net device
|
||||
* set flag to avoid freeing static buffer.
|
||||
@@ -332,6 +338,7 @@ static int distro_efi_boot(struct udevice *dev, struct bootflow *bflow)
|
||||
ulong kernel, fdt;
|
||||
int ret;
|
||||
|
||||
log_debug("distro EFI boot\n");
|
||||
kernel = env_get_hex("kernel_addr_r", 0);
|
||||
if (!bootmeth_uses_network(bflow)) {
|
||||
ret = efiload_read_file(bflow, kernel);
|
||||
|
@@ -122,7 +122,7 @@ static int bootstd_probe(struct udevice *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* For now, bind the boormethod device if none are found in the devicetree */
|
||||
/* For now, bind the bootmethod device if none are found in the devicetree */
|
||||
int dm_scan_other(bool pre_reloc_only)
|
||||
{
|
||||
struct driver *drv = ll_entry_start(struct driver, driver);
|
||||
|
23
cmd/Kconfig
23
cmd/Kconfig
@@ -438,21 +438,9 @@ config CMD_BOOTEFI_BOOTMGR
|
||||
This subcommand will allow you to select the UEFI binary to be booted
|
||||
via UEFI variables Boot####, BootOrder, and BootNext.
|
||||
|
||||
config CMD_BOOTEFI_HELLO_COMPILE
|
||||
bool "Compile a standard EFI hello world binary for testing"
|
||||
default y
|
||||
help
|
||||
This compiles a standard EFI hello world application with U-Boot so
|
||||
that it can be used with the test/py testing framework. This is useful
|
||||
for testing that EFI is working at a basic level, and for bringing
|
||||
up EFI support on a new architecture.
|
||||
|
||||
No additional space will be required in the resulting U-Boot binary
|
||||
when this option is enabled.
|
||||
|
||||
config CMD_BOOTEFI_HELLO
|
||||
bool "Allow booting a standard EFI hello world for testing"
|
||||
depends on CMD_BOOTEFI_BINARY && CMD_BOOTEFI_HELLO_COMPILE
|
||||
depends on CMD_BOOTEFI_BINARY && BOOTEFI_HELLO_COMPILE
|
||||
default y if CMD_BOOTEFI_SELFTEST
|
||||
help
|
||||
This adds a standard EFI hello world application to U-Boot so that
|
||||
@@ -1091,13 +1079,10 @@ config CMD_BIND
|
||||
gadget driver from the command line.
|
||||
|
||||
config CMD_CLK
|
||||
bool "clk - Show clock frequencies"
|
||||
bool "clk - Show and set clock frequencies"
|
||||
depends on CLK
|
||||
help
|
||||
(deprecated)
|
||||
Shows clock frequences by calling a sock_clk_dump() hook function.
|
||||
This is depreated in favour of using the CLK uclass and accessing
|
||||
clock values from associated drivers. However currently no command
|
||||
exists for this.
|
||||
Show and set clock frequencies managed by CLK uclass drivers.
|
||||
|
||||
config CMD_DEMO
|
||||
bool "demo - Demonstration commands for driver model"
|
||||
|
14
cmd/clk.c
14
cmd/clk.c
@@ -4,15 +4,12 @@
|
||||
*/
|
||||
#include <command.h>
|
||||
#include <clk.h>
|
||||
#if defined(CONFIG_DM) && defined(CONFIG_CLK)
|
||||
#include <dm.h>
|
||||
#include <dm/device.h>
|
||||
#include <dm/root.h>
|
||||
#include <dm/device-internal.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_DM) && defined(CONFIG_CLK)
|
||||
static void show_clks(struct udevice *dev, int depth, int last_flag)
|
||||
{
|
||||
int i, is_last;
|
||||
@@ -79,13 +76,6 @@ static int soc_clk_dump(void)
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
static int soc_clk_dump(void)
|
||||
{
|
||||
puts("Not implemented\n");
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int do_clk_dump(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
char *const argv[])
|
||||
@@ -101,7 +91,6 @@ static int do_clk_dump(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if CONFIG_IS_ENABLED(DM) && CONFIG_IS_ENABLED(CLK)
|
||||
static int do_clk_setfreq(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
char *const argv[])
|
||||
{
|
||||
@@ -131,13 +120,10 @@ static int do_clk_setfreq(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
printf("set_rate returns %u\n", freq);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static struct cmd_tbl cmd_clk_sub[] = {
|
||||
U_BOOT_CMD_MKENT(dump, 1, 1, do_clk_dump, "", ""),
|
||||
#if CONFIG_IS_ENABLED(DM) && CONFIG_IS_ENABLED(CLK)
|
||||
U_BOOT_CMD_MKENT(setfreq, 3, 1, do_clk_setfreq, "", ""),
|
||||
#endif
|
||||
};
|
||||
|
||||
static int do_clk(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
|
@@ -38,7 +38,7 @@ CONFIG_SYS_PBSIZE=1050
|
||||
CONFIG_BOARD_EARLY_INIT_R=y
|
||||
CONFIG_HUSH_PARSER=y
|
||||
CONFIG_SYS_PROMPT="Marvell> "
|
||||
# CONFIG_CMD_BOOTEFI_HELLO_COMPILE is not set
|
||||
# CONFIG_BOOTEFI_HELLO_COMPILE is not set
|
||||
CONFIG_CMD_MD5SUM=y
|
||||
CONFIG_MD5SUM_VERIFY=y
|
||||
CONFIG_CMD_MX_CYCLIC=y
|
||||
|
@@ -38,7 +38,7 @@ CONFIG_SYS_PBSIZE=1050
|
||||
CONFIG_BOARD_EARLY_INIT_R=y
|
||||
CONFIG_HUSH_PARSER=y
|
||||
CONFIG_SYS_PROMPT="Marvell> "
|
||||
# CONFIG_CMD_BOOTEFI_HELLO_COMPILE is not set
|
||||
# CONFIG_BOOTEFI_HELLO_COMPILE is not set
|
||||
CONFIG_CMD_MD5SUM=y
|
||||
CONFIG_MD5SUM_VERIFY=y
|
||||
CONFIG_CMD_MX_CYCLIC=y
|
||||
|
@@ -39,7 +39,7 @@ CONFIG_SYS_PBSIZE=1050
|
||||
CONFIG_BOARD_EARLY_INIT_R=y
|
||||
CONFIG_HUSH_PARSER=y
|
||||
CONFIG_SYS_PROMPT="Marvell> "
|
||||
# CONFIG_CMD_BOOTEFI_HELLO_COMPILE is not set
|
||||
# CONFIG_BOOTEFI_HELLO_COMPILE is not set
|
||||
CONFIG_CMD_MD5SUM=y
|
||||
CONFIG_MD5SUM_VERIFY=y
|
||||
CONFIG_CMD_MX_CYCLIC=y
|
||||
|
@@ -37,7 +37,7 @@ CONFIG_SYS_PBSIZE=1050
|
||||
CONFIG_BOARD_EARLY_INIT_R=y
|
||||
CONFIG_HUSH_PARSER=y
|
||||
CONFIG_SYS_PROMPT="Marvell> "
|
||||
# CONFIG_CMD_BOOTEFI_HELLO_COMPILE is not set
|
||||
# CONFIG_BOOTEFI_HELLO_COMPILE is not set
|
||||
CONFIG_CMD_MD5SUM=y
|
||||
CONFIG_MD5SUM_VERIFY=y
|
||||
CONFIG_CMD_MX_CYCLIC=y
|
||||
|
@@ -46,6 +46,7 @@ CONFIG_CMD_MD5SUM=y
|
||||
CONFIG_CMD_MEMINFO=y
|
||||
CONFIG_CMD_MX_CYCLIC=y
|
||||
CONFIG_CMD_MEMTEST=y
|
||||
CONFIG_CMD_CLK=y
|
||||
CONFIG_CMD_DEMO=y
|
||||
CONFIG_CMD_GPIO=y
|
||||
CONFIG_CMD_GPT=y
|
||||
|
@@ -75,6 +75,7 @@ CONFIG_CMD_MEMINFO=y
|
||||
CONFIG_CMD_MEM_SEARCH=y
|
||||
CONFIG_CMD_MX_CYCLIC=y
|
||||
CONFIG_CMD_MEMTEST=y
|
||||
CONFIG_CMD_CLK=y
|
||||
CONFIG_CMD_DEMO=y
|
||||
CONFIG_CMD_GPIO=y
|
||||
CONFIG_CMD_GPIO_READ=y
|
||||
|
@@ -44,6 +44,7 @@ CONFIG_CMD_MD5SUM=y
|
||||
CONFIG_CMD_MEMINFO=y
|
||||
CONFIG_CMD_MX_CYCLIC=y
|
||||
CONFIG_CMD_MEMTEST=y
|
||||
CONFIG_CMD_CLK=y
|
||||
CONFIG_CMD_DEMO=y
|
||||
CONFIG_CMD_GPIO=y
|
||||
CONFIG_CMD_GPT=y
|
||||
|
@@ -81,6 +81,7 @@ CONFIG_CMD_MD5SUM=y
|
||||
CONFIG_CMD_MEMINFO=y
|
||||
CONFIG_CMD_MX_CYCLIC=y
|
||||
CONFIG_CMD_MEMTEST=y
|
||||
CONFIG_CMD_CLK=y
|
||||
CONFIG_CMD_DEMO=y
|
||||
CONFIG_CMD_GPIO=y
|
||||
CONFIG_CMD_GPT=y
|
||||
|
@@ -60,6 +60,7 @@ CONFIG_CMD_MD5SUM=y
|
||||
CONFIG_CMD_MEMINFO=y
|
||||
CONFIG_CMD_MX_CYCLIC=y
|
||||
CONFIG_CMD_MEMTEST=y
|
||||
CONFIG_CMD_CLK=y
|
||||
CONFIG_CMD_DEMO=y
|
||||
CONFIG_CMD_GPIO=y
|
||||
CONFIG_CMD_GPT=y
|
||||
|
@@ -71,6 +71,7 @@ CONFIG_CMD_MD5SUM=y
|
||||
CONFIG_CMD_MEMINFO=y
|
||||
CONFIG_CMD_MX_CYCLIC=y
|
||||
CONFIG_CMD_MEMTEST=y
|
||||
CONFIG_CMD_CLK=y
|
||||
CONFIG_CMD_DEMO=y
|
||||
CONFIG_CMD_GPIO=y
|
||||
CONFIG_CMD_GPT=y
|
||||
|
@@ -13,6 +13,7 @@ General
|
||||
codingstyle
|
||||
designprinciples
|
||||
docstyle
|
||||
memory
|
||||
patman
|
||||
process
|
||||
release_cycle
|
||||
|
49
doc/develop/memory.rst
Normal file
49
doc/develop/memory.rst
Normal file
@@ -0,0 +1,49 @@
|
||||
.. SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
Memory Management
|
||||
-----------------
|
||||
|
||||
.. note::
|
||||
|
||||
This information is outdated and needs to be updated.
|
||||
|
||||
U-Boot runs in system state and uses physical addresses, i.e. the
|
||||
MMU is not used either for address mapping nor for memory protection.
|
||||
|
||||
The available memory is mapped to fixed addresses using the
|
||||
memory-controller. In this process, a contiguous block is formed for each
|
||||
memory type (Flash, SDRAM, SRAM), even when it consists of several
|
||||
physical-memory banks.
|
||||
|
||||
U-Boot is installed in XIP flash memory, or may be loaded into a lower region of
|
||||
RAM by a secondary program loader (SPL). After
|
||||
booting and sizing and initialising DRAM, the code relocates itself
|
||||
to the upper end of DRAM. Immediately below the U-Boot code some
|
||||
memory is reserved for use by malloc() [see CONFIG_SYS_MALLOC_LEN
|
||||
configuration setting]. Below that, a structure with global Board-Info
|
||||
data is placed, followed by the stack (growing downward).
|
||||
|
||||
Additionally, some exception handler code may be copied to the low 8 kB
|
||||
of DRAM (0x00000000 ... 0x00001fff).
|
||||
|
||||
So a typical memory configuration with 16 MB of DRAM could look like
|
||||
this::
|
||||
|
||||
0x0000 0000 Exception Vector code
|
||||
:
|
||||
0x0000 1fff
|
||||
0x0000 2000 Free for Application Use
|
||||
:
|
||||
:
|
||||
|
||||
:
|
||||
:
|
||||
0x00fb ff20 Monitor Stack (Growing downward)
|
||||
0x00fb ffac Board Info Data and permanent copy of global data
|
||||
0x00fc 0000 Malloc Arena
|
||||
:
|
||||
0x00fd ffff
|
||||
0x00fe 0000 RAM Copy of Monitor Code
|
||||
... eventually: LCD or video framebuffer
|
||||
... eventually: pRAM (Protected RAM - unchanged by reset)
|
||||
0x00ff ffff [End of RAM]
|
@@ -720,7 +720,7 @@ Executing the built in hello world application
|
||||
|
||||
A hello world UEFI application can be built with::
|
||||
|
||||
CONFIG_CMD_BOOTEFI_HELLO_COMPILE=y
|
||||
CONFIG_BOOTEFI_HELLO_COMPILE=y
|
||||
|
||||
It can be embedded into the U-Boot binary with::
|
||||
|
||||
|
@@ -567,7 +567,7 @@ efi_status_t EFIAPI efi_convert_pointer(efi_uintn_t debug_disposition,
|
||||
/* Carve out DT reserved memory ranges */
|
||||
void efi_carve_out_dt_rsv(void *fdt);
|
||||
/* Purge unused kaslr-seed */
|
||||
void efi_try_purge_kaslr_seed(void *fdt);
|
||||
void efi_try_purge_rng_seed(void *fdt);
|
||||
/* Called by bootefi to make console interface available */
|
||||
efi_status_t efi_console_register(void);
|
||||
/* Called by efi_init_obj_list() to proble all block devices */
|
||||
|
@@ -552,6 +552,18 @@ config EFI_HTTP_BOOT
|
||||
directly boot from network.
|
||||
endmenu
|
||||
|
||||
config BOOTEFI_HELLO_COMPILE
|
||||
bool "Compile a standard EFI hello world binary for testing"
|
||||
default y
|
||||
help
|
||||
This compiles a standard EFI hello world application with U-Boot so
|
||||
that it can be used with the test/py testing framework. This is useful
|
||||
for testing that EFI is working at a basic level, and for bringing
|
||||
up EFI support on a new architecture.
|
||||
|
||||
No additional space will be required in the resulting U-Boot binary
|
||||
when this option is enabled.
|
||||
|
||||
endif
|
||||
|
||||
source "lib/efi/Kconfig"
|
||||
|
@@ -11,40 +11,14 @@ asflags-y += -I.
|
||||
CFLAGS_efi_boottime.o += \
|
||||
-DFW_VERSION="0x$(VERSION)" \
|
||||
-DFW_PATCHLEVEL="0x$(PATCHLEVEL)"
|
||||
CFLAGS_boothart.o := $(CFLAGS_EFI) -Os -ffreestanding
|
||||
CFLAGS_REMOVE_boothart.o := $(CFLAGS_NON_EFI)
|
||||
CFLAGS_helloworld.o := $(CFLAGS_EFI) -Os -ffreestanding
|
||||
CFLAGS_REMOVE_helloworld.o := $(CFLAGS_NON_EFI)
|
||||
CFLAGS_smbiosdump.o := $(CFLAGS_EFI) -Os -ffreestanding
|
||||
CFLAGS_REMOVE_smbiosdump.o := $(CFLAGS_NON_EFI)
|
||||
CFLAGS_dtbdump.o := $(CFLAGS_EFI) -Os -ffreestanding
|
||||
CFLAGS_REMOVE_dtbdump.o := $(CFLAGS_NON_EFI)
|
||||
CFLAGS_initrddump.o := $(CFLAGS_EFI) -Os -ffreestanding
|
||||
CFLAGS_REMOVE_initrddump.o := $(CFLAGS_NON_EFI)
|
||||
|
||||
ifdef CONFIG_RISCV
|
||||
always += boothart.efi
|
||||
targets += boothart.o
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_CMD_BOOTEFI_HELLO_COMPILE),)
|
||||
always += helloworld.efi
|
||||
targets += helloworld.o
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_GENERATE_SMBIOS_TABLE),)
|
||||
always += smbiosdump.efi
|
||||
targets += smbiosdump.o
|
||||
endif
|
||||
|
||||
# These are the apps that are built
|
||||
apps-$(CONFIG_RISCV) += boothart
|
||||
apps-$(CONFIG_BOOTEFI_HELLO_COMPILE) += helloworld
|
||||
apps-$(CONFIG_GENERATE_SMBIOS_TABLE) += smbiosdump
|
||||
apps-$(CONFIG_EFI_LOAD_FILE2_INITRD) += initrddump
|
||||
ifeq ($(CONFIG_GENERATE_ACPI_TABLE),)
|
||||
always += dtbdump.efi
|
||||
targets += dtbdump.o
|
||||
endif
|
||||
|
||||
ifdef CONFIG_EFI_LOAD_FILE2_INITRD
|
||||
always += initrddump.efi
|
||||
targets += initrddump.o
|
||||
apps-y += dtbdump
|
||||
endif
|
||||
|
||||
obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o
|
||||
@@ -95,3 +69,11 @@ obj-$(CONFIG_EFI_ECPT) += efi_conformance.o
|
||||
|
||||
EFI_VAR_SEED_FILE := $(subst $\",,$(CONFIG_EFI_VAR_SEED_FILE))
|
||||
$(obj)/efi_var_seed.o: $(srctree)/$(EFI_VAR_SEED_FILE)
|
||||
|
||||
# Set the C flags to add and remove for each app
|
||||
$(foreach f,$(apps-y),\
|
||||
$(eval CFLAGS_$(f).o := $(CFLAGS_EFI) -Os -ffreestanding)\
|
||||
$(eval CFLAGS_REMOVE_$(f).o := $(CFLAGS_NON_EFI)))
|
||||
|
||||
always += $(foreach f,$(apps-y),$(f).efi)
|
||||
targets += $(foreach f,$(apps-y),$(f).o)
|
||||
|
@@ -41,7 +41,7 @@ static void efi_reserve_memory(u64 addr, u64 size, bool nomap)
|
||||
}
|
||||
|
||||
/**
|
||||
* efi_try_purge_kaslr_seed() - Remove unused kaslr-seed
|
||||
* efi_try_purge_rng_seed() - Remove unused kaslr-seed, rng-seed
|
||||
*
|
||||
* Kernel's EFI STUB only relies on EFI_RNG_PROTOCOL for randomization
|
||||
* and completely ignores the kaslr-seed for its own randomness needs
|
||||
@@ -51,8 +51,9 @@ static void efi_reserve_memory(u64 addr, u64 size, bool nomap)
|
||||
*
|
||||
* @fdt: Pointer to device tree
|
||||
*/
|
||||
void efi_try_purge_kaslr_seed(void *fdt)
|
||||
void efi_try_purge_rng_seed(void *fdt)
|
||||
{
|
||||
const char * const prop[] = {"kaslr-seed", "rng-seed"};
|
||||
const efi_guid_t efi_guid_rng_protocol = EFI_RNG_PROTOCOL_GUID;
|
||||
struct efi_handler *handler;
|
||||
efi_status_t ret;
|
||||
@@ -67,9 +68,13 @@ void efi_try_purge_kaslr_seed(void *fdt)
|
||||
if (nodeoff < 0)
|
||||
return;
|
||||
|
||||
err = fdt_delprop(fdt, nodeoff, "kaslr-seed");
|
||||
if (err < 0 && err != -FDT_ERR_NOTFOUND)
|
||||
log_err("Error deleting kaslr-seed\n");
|
||||
for (size_t i = 0; i < ARRAY_SIZE(prop); ++i) {
|
||||
err = fdt_delprop(fdt, nodeoff, prop[i]);
|
||||
if (err < 0 && err != -FDT_ERR_NOTFOUND)
|
||||
log_err("Error deleting %s\n", prop[i]);
|
||||
else
|
||||
log_debug("Deleted /chosen/%s\n", prop[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -522,7 +522,7 @@ efi_status_t efi_install_fdt(void *fdt)
|
||||
/* Create memory reservations as indicated by the device tree */
|
||||
efi_carve_out_dt_rsv(fdt);
|
||||
|
||||
efi_try_purge_kaslr_seed(fdt);
|
||||
efi_try_purge_rng_seed(fdt);
|
||||
|
||||
if (CONFIG_IS_ENABLED(EFI_TCG2_PROTOCOL_MEASURE_DTB)) {
|
||||
ret = efi_tcg2_measure_dtb(fdt);
|
||||
|
@@ -71,6 +71,33 @@ static void uint2dec(u32 value, u16 **buf)
|
||||
*buf = pos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print an unsigned 32bit value as hexadecimal number to an u16 string
|
||||
*
|
||||
* @value: value to be printed
|
||||
* @buf: pointer to buffer address
|
||||
* on return position of terminating zero word
|
||||
*/
|
||||
static void uint2hex(u32 value, u16 **buf)
|
||||
{
|
||||
u16 *pos = *buf;
|
||||
int i;
|
||||
u16 c;
|
||||
|
||||
for (i = 0; i < 8; ++i) {
|
||||
/* Write current digit */
|
||||
c = value >> 28;
|
||||
value <<= 4;
|
||||
if (c < 10)
|
||||
c += '0';
|
||||
else
|
||||
c += 'a' - 10;
|
||||
*pos++ = c;
|
||||
}
|
||||
*pos = 0;
|
||||
*buf = pos;
|
||||
}
|
||||
|
||||
/**
|
||||
* print_uefi_revision() - print UEFI revision number
|
||||
*/
|
||||
@@ -96,6 +123,16 @@ static void print_uefi_revision(void)
|
||||
con_out->output_string(con_out, u"Running on UEFI ");
|
||||
con_out->output_string(con_out, rev);
|
||||
con_out->output_string(con_out, u"\r\n");
|
||||
|
||||
con_out->output_string(con_out, u"Firmware vendor: ");
|
||||
con_out->output_string(con_out, systable->fw_vendor);
|
||||
con_out->output_string(con_out, u"\r\n");
|
||||
|
||||
buf = rev;
|
||||
uint2hex(systable->fw_revision, &buf);
|
||||
con_out->output_string(con_out, u"Firmware revision: ");
|
||||
con_out->output_string(con_out, rev);
|
||||
con_out->output_string(con_out, u"\r\n");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -119,7 +119,7 @@ FDT_DATA = '''
|
||||
'''
|
||||
|
||||
@pytest.mark.buildconfigspec('bootm_efi')
|
||||
@pytest.mark.buildconfigspec('cmd_bootefi_hello_compile')
|
||||
@pytest.mark.buildconfigspec('BOOTEFI_HELLO_COMPILE')
|
||||
@pytest.mark.buildconfigspec('fit')
|
||||
@pytest.mark.notbuildconfigspec('generate_acpi_table')
|
||||
@pytest.mark.requiredtool('dtc')
|
||||
|
@@ -170,7 +170,7 @@ def do_test_efi_helloworld_net(u_boot_console, proto):
|
||||
assert expected_text not in output
|
||||
|
||||
@pytest.mark.buildconfigspec('of_control')
|
||||
@pytest.mark.buildconfigspec('cmd_bootefi_hello_compile')
|
||||
@pytest.mark.buildconfigspec('bootefi_hello_compile')
|
||||
@pytest.mark.buildconfigspec('cmd_tftpboot')
|
||||
def test_efi_helloworld_net_tftp(u_boot_console):
|
||||
"""Run the helloworld.efi binary via TFTP.
|
||||
|
@@ -58,7 +58,7 @@ def test_efi_selftest_watchdog_reboot(u_boot_console):
|
||||
u_boot_console.run_command(cmd='bootefi selftest', wait_for_prompt=False)
|
||||
if u_boot_console.p.expect(['resetting', 'U-Boot']):
|
||||
raise Exception('Reset failed in \'watchdog reboot\' test')
|
||||
u_boot_console.restart_uboot()
|
||||
u_boot_console.run_command(cmd='', send_nl=False, wait_for_reboot=True)
|
||||
|
||||
@pytest.mark.buildconfigspec('cmd_bootefi_selftest')
|
||||
def test_efi_selftest_text_input(u_boot_console):
|
||||
|
Reference in New Issue
Block a user