x86: Add generic EFI payload support
It is possible to create a generic EFI payload for all x86 boards. The payload is configured to include as many generic drivers as possible. All stuff that touches low-level initialization are not allowed as such is the EFI BIOS's responsibility. Platform specific drivers (like gpio, spi, etc) are not included. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
3773c6a20a
commit
32151d4017
@ -11,6 +11,7 @@ dtb-y += bayleybay.dtb \
|
|||||||
dfi-bt700-q7x-151.dtb \
|
dfi-bt700-q7x-151.dtb \
|
||||||
edison.dtb \
|
edison.dtb \
|
||||||
efi.dtb \
|
efi.dtb \
|
||||||
|
efi-x86_payload.dtb \
|
||||||
galileo.dtb \
|
galileo.dtb \
|
||||||
minnowmax.dtb \
|
minnowmax.dtb \
|
||||||
qemu-x86_i440fx.dtb \
|
qemu-x86_i440fx.dtb \
|
||||||
|
36
arch/x86/dts/efi-x86_payload.dts
Normal file
36
arch/x86/dts/efi-x86_payload.dts
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0+
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com>
|
||||||
|
*
|
||||||
|
* Generic EFI payload device tree for x86 targets
|
||||||
|
*/
|
||||||
|
|
||||||
|
/dts-v1/;
|
||||||
|
|
||||||
|
/include/ "skeleton.dtsi"
|
||||||
|
/include/ "serial.dtsi"
|
||||||
|
/include/ "keyboard.dtsi"
|
||||||
|
/include/ "rtc.dtsi"
|
||||||
|
/include/ "tsc_timer.dtsi"
|
||||||
|
|
||||||
|
/ {
|
||||||
|
model = "EFI x86 Payload";
|
||||||
|
compatible = "efi,x86-payload";
|
||||||
|
|
||||||
|
aliases {
|
||||||
|
serial0 = &serial;
|
||||||
|
};
|
||||||
|
|
||||||
|
config {
|
||||||
|
silent_console = <0>;
|
||||||
|
};
|
||||||
|
|
||||||
|
chosen {
|
||||||
|
stdout-path = "/serial";
|
||||||
|
};
|
||||||
|
|
||||||
|
pci {
|
||||||
|
compatible = "pci-x86";
|
||||||
|
u-boot,dm-pre-reloc;
|
||||||
|
};
|
||||||
|
};
|
@ -12,8 +12,17 @@ config TARGET_EFI
|
|||||||
takes over once the RAM, video and CPU are fully running.
|
takes over once the RAM, video and CPU are fully running.
|
||||||
U-Boot is loaded as an application from EFI.
|
U-Boot is loaded as an application from EFI.
|
||||||
|
|
||||||
|
config TARGET_EFI_PAYLOAD
|
||||||
|
bool "efi payload"
|
||||||
|
help
|
||||||
|
This target is used for running U-Boot on top of EFI. In
|
||||||
|
this case EFI does the early initialisation, and U-Boot
|
||||||
|
takes over once the RAM, video and CPU are fully running.
|
||||||
|
U-Boot is loaded as a payload from EFI.
|
||||||
|
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
source "board/efi/efi-x86/Kconfig"
|
source "board/efi/efi-x86/Kconfig"
|
||||||
|
source "board/efi/efi-x86_payload/Kconfig"
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
38
board/efi/efi-x86_payload/Kconfig
Normal file
38
board/efi/efi-x86_payload/Kconfig
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
if TARGET_EFI_PAYLOAD
|
||||||
|
|
||||||
|
config SYS_BOARD
|
||||||
|
default "efi-x86_payload"
|
||||||
|
|
||||||
|
config SYS_VENDOR
|
||||||
|
default "efi"
|
||||||
|
|
||||||
|
config SYS_SOC
|
||||||
|
default "efi"
|
||||||
|
|
||||||
|
config SYS_CONFIG_NAME
|
||||||
|
default "efi-x86_payload"
|
||||||
|
|
||||||
|
config SYS_TEXT_BASE
|
||||||
|
default 0x00200000
|
||||||
|
|
||||||
|
config BOARD_SPECIFIC_OPTIONS # dummy
|
||||||
|
def_bool y
|
||||||
|
imply SYS_NS16550
|
||||||
|
imply SCSI
|
||||||
|
imply SCSI_AHCI
|
||||||
|
imply AHCI_PCI
|
||||||
|
imply MMC
|
||||||
|
imply MMC_PCI
|
||||||
|
imply MMC_SDHCI
|
||||||
|
imply MMC_SDHCI_SDMA
|
||||||
|
imply USB
|
||||||
|
imply USB_EHCI_HCD
|
||||||
|
imply USB_XHCI_HCD
|
||||||
|
imply USB_STORAGE
|
||||||
|
imply USB_KEYBOARD
|
||||||
|
imply E1000
|
||||||
|
imply ETH_DESIGNWARE
|
||||||
|
imply PCH_GBE
|
||||||
|
imply RTL8169
|
||||||
|
|
||||||
|
endif
|
7
board/efi/efi-x86_payload/MAINTAINERS
Normal file
7
board/efi/efi-x86_payload/MAINTAINERS
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
EFI-X86_PAYLOAD BOARD
|
||||||
|
M: Bin Meng <bmeng.cn@gmail.com>
|
||||||
|
S: Maintained
|
||||||
|
F: board/efi/efi-x86_payload/
|
||||||
|
F: include/configs/efi-x86_payload.h
|
||||||
|
F: configs/efi-x86_payload32_defconfig
|
||||||
|
F: configs/efi-x86_payload64_defconfig
|
5
board/efi/efi-x86_payload/Makefile
Normal file
5
board/efi/efi-x86_payload/Makefile
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# SPDX-License-Identifier: GPL-2.0+
|
||||||
|
#
|
||||||
|
# Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com>
|
||||||
|
|
||||||
|
obj-y += start.o
|
8
board/efi/efi-x86_payload/start.S
Normal file
8
board/efi/efi-x86_payload/start.S
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
.globl early_board_init
|
||||||
|
early_board_init:
|
||||||
|
jmp early_board_init_ret
|
35
configs/efi-x86_payload32_defconfig
Normal file
35
configs/efi-x86_payload32_defconfig
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
CONFIG_X86=y
|
||||||
|
CONFIG_VENDOR_EFI=y
|
||||||
|
CONFIG_DEFAULT_DEVICE_TREE="efi-x86_payload"
|
||||||
|
CONFIG_TARGET_EFI_PAYLOAD=y
|
||||||
|
CONFIG_FIT=y
|
||||||
|
CONFIG_FIT_SIGNATURE=y
|
||||||
|
CONFIG_USE_BOOTARGS=y
|
||||||
|
CONFIG_BOOTARGS="root=/dev/sdb3 init=/sbin/init rootwait ro"
|
||||||
|
CONFIG_SYS_CONSOLE_INFO_QUIET=y
|
||||||
|
CONFIG_DISPLAY_BOARDINFO_LATE=y
|
||||||
|
CONFIG_LAST_STAGE_INIT=y
|
||||||
|
CONFIG_HUSH_PARSER=y
|
||||||
|
# CONFIG_CMD_FLASH is not set
|
||||||
|
CONFIG_CMD_IDE=y
|
||||||
|
CONFIG_CMD_MMC=y
|
||||||
|
CONFIG_CMD_PART=y
|
||||||
|
CONFIG_CMD_USB=y
|
||||||
|
# CONFIG_CMD_SETEXPR is not set
|
||||||
|
CONFIG_CMD_DHCP=y
|
||||||
|
# CONFIG_CMD_NFS is not set
|
||||||
|
CONFIG_CMD_PING=y
|
||||||
|
CONFIG_CMD_TIME=y
|
||||||
|
CONFIG_CMD_EXT2=y
|
||||||
|
CONFIG_CMD_EXT4=y
|
||||||
|
CONFIG_CMD_EXT4_WRITE=y
|
||||||
|
CONFIG_CMD_FAT=y
|
||||||
|
CONFIG_CMD_FS_GENERIC=y
|
||||||
|
CONFIG_MAC_PARTITION=y
|
||||||
|
CONFIG_ISO_PARTITION=y
|
||||||
|
CONFIG_EFI_PARTITION=y
|
||||||
|
CONFIG_REGMAP=y
|
||||||
|
CONFIG_SYSCON=y
|
||||||
|
# CONFIG_PCI_PNP is not set
|
||||||
|
CONFIG_EFI=y
|
||||||
|
CONFIG_EFI_STUB=y
|
36
configs/efi-x86_payload64_defconfig
Normal file
36
configs/efi-x86_payload64_defconfig
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
CONFIG_X86=y
|
||||||
|
CONFIG_VENDOR_EFI=y
|
||||||
|
CONFIG_DEFAULT_DEVICE_TREE="efi-x86_payload"
|
||||||
|
CONFIG_TARGET_EFI_PAYLOAD=y
|
||||||
|
CONFIG_FIT=y
|
||||||
|
CONFIG_FIT_SIGNATURE=y
|
||||||
|
CONFIG_USE_BOOTARGS=y
|
||||||
|
CONFIG_BOOTARGS="root=/dev/sdb3 init=/sbin/init rootwait ro"
|
||||||
|
CONFIG_SYS_CONSOLE_INFO_QUIET=y
|
||||||
|
CONFIG_DISPLAY_BOARDINFO_LATE=y
|
||||||
|
CONFIG_LAST_STAGE_INIT=y
|
||||||
|
CONFIG_HUSH_PARSER=y
|
||||||
|
# CONFIG_CMD_FLASH is not set
|
||||||
|
CONFIG_CMD_IDE=y
|
||||||
|
CONFIG_CMD_MMC=y
|
||||||
|
CONFIG_CMD_PART=y
|
||||||
|
CONFIG_CMD_USB=y
|
||||||
|
# CONFIG_CMD_SETEXPR is not set
|
||||||
|
CONFIG_CMD_DHCP=y
|
||||||
|
# CONFIG_CMD_NFS is not set
|
||||||
|
CONFIG_CMD_PING=y
|
||||||
|
CONFIG_CMD_TIME=y
|
||||||
|
CONFIG_CMD_EXT2=y
|
||||||
|
CONFIG_CMD_EXT4=y
|
||||||
|
CONFIG_CMD_EXT4_WRITE=y
|
||||||
|
CONFIG_CMD_FAT=y
|
||||||
|
CONFIG_CMD_FS_GENERIC=y
|
||||||
|
CONFIG_MAC_PARTITION=y
|
||||||
|
CONFIG_ISO_PARTITION=y
|
||||||
|
CONFIG_EFI_PARTITION=y
|
||||||
|
CONFIG_REGMAP=y
|
||||||
|
CONFIG_SYSCON=y
|
||||||
|
# CONFIG_PCI_PNP is not set
|
||||||
|
CONFIG_EFI=y
|
||||||
|
CONFIG_EFI_STUB=y
|
||||||
|
CONFIG_EFI_STUB_64BIT=y
|
@ -71,12 +71,13 @@ Just build U-Boot as normal, e.g.
|
|||||||
make efi-x86_defconfig
|
make efi-x86_defconfig
|
||||||
make
|
make
|
||||||
|
|
||||||
To build U-Boot as an EFI payload (32-bit or 64-bit EFI can be used), adjust an
|
To build U-Boot as an EFI payload (32-bit or 64-bit EFI can be used), enable
|
||||||
existing config (like qemu-x86_defconfig) to enable CONFIG_EFI, CONFIG_EFI_STUB
|
CONFIG_EFI, CONFIG_EFI_STUB, and select either CONFIG_EFI_STUB_32BIT or
|
||||||
and either CONFIG_EFI_STUB_32BIT or CONFIG_EFI_STUB_64BIT. All of these are
|
CONFIG_EFI_STUB_64BIT. The efi-x86_payload configs (efi-x86_payload32_defconfig
|
||||||
boolean Kconfig options. Then build U-Boot as normal, e.g.
|
and efi-x86_payload32_defconfig) are set up for this. Then build U-Boot as
|
||||||
|
normal, e.g.
|
||||||
|
|
||||||
make qemu-x86_defconfig
|
make efi-x86_payload32_defconfig (or efi-x86_payload64_defconfig)
|
||||||
make
|
make
|
||||||
|
|
||||||
You will end up with one of these files depending on what you build for:
|
You will end up with one of these files depending on what you build for:
|
||||||
@ -211,11 +212,6 @@ Future work
|
|||||||
-----------
|
-----------
|
||||||
This work could be extended in a number of ways:
|
This work could be extended in a number of ways:
|
||||||
|
|
||||||
- Add a generic x86 EFI payload configuration. At present you need to modify
|
|
||||||
an existing one, but mostly the low-level x86 code is disabled when booting
|
|
||||||
on EFI anyway, so a generic 'EFI' board could be created with a suitable set
|
|
||||||
of drivers enabled.
|
|
||||||
|
|
||||||
- Add ARM support
|
- Add ARM support
|
||||||
|
|
||||||
- Add 64-bit application support
|
- Add 64-bit application support
|
||||||
@ -241,6 +237,9 @@ arch/x86/cpu/efi
|
|||||||
board/efi/efi-x86/efi.c
|
board/efi/efi-x86/efi.c
|
||||||
x86 board code for running as an EFI application
|
x86 board code for running as an EFI application
|
||||||
|
|
||||||
|
board/efi/efi-x86_payload
|
||||||
|
generic x86 EFI payload board support code
|
||||||
|
|
||||||
common/cmd_efi.c
|
common/cmd_efi.c
|
||||||
the 'efi' command
|
the 'efi' command
|
||||||
|
|
||||||
|
32
include/configs/efi-x86_payload.h
Normal file
32
include/configs/efi-x86_payload.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* board/config.h - configuration options, board specific
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __CONFIG_H
|
||||||
|
#define __CONFIG_H
|
||||||
|
|
||||||
|
#include <configs/x86-common.h>
|
||||||
|
|
||||||
|
#define CONFIG_SYS_MONITOR_LEN (1 << 20)
|
||||||
|
|
||||||
|
#define CONFIG_STD_DEVICES_SETTINGS "stdin=serial,i8042-kbd\0" \
|
||||||
|
"stdout=serial,vidconsole\0" \
|
||||||
|
"stderr=serial,vidconsole\0"
|
||||||
|
|
||||||
|
/* ATA/IDE support */
|
||||||
|
#define CONFIG_SYS_IDE_MAXBUS 2
|
||||||
|
#define CONFIG_SYS_IDE_MAXDEVICE 4
|
||||||
|
#define CONFIG_SYS_ATA_BASE_ADDR 0
|
||||||
|
#define CONFIG_SYS_ATA_DATA_OFFSET 0
|
||||||
|
#define CONFIG_SYS_ATA_REG_OFFSET 0
|
||||||
|
#define CONFIG_SYS_ATA_ALT_OFFSET 0
|
||||||
|
#define CONFIG_SYS_ATA_IDE0_OFFSET 0x1f0
|
||||||
|
#define CONFIG_SYS_ATA_IDE1_OFFSET 0x170
|
||||||
|
#define CONFIG_ATAPI
|
||||||
|
|
||||||
|
#endif /* __CONFIG_H */
|
Loading…
Reference in New Issue
Block a user