Skip to contentSkip to conversation

x86: efi: payload: Make efi payload build again

PATCH Superseded Bin Meng 2 participants 7 messages Aug 24, 2016 – Aug 25, 2016 x86

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH 1/3 x86: efi: payload: Make efi payload build again

Since commit 73c5c39 "Makefile: Drop unnecessary -dtb suffixes", EFI payload does not build anymore. This fixes the build.

---

 include/efi.h      | 2 +-
 lib/efi/efi_stub.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
include/efi.h +1 -1
index 1dbc3b7..21921f1 100644
@@ -278,7 +278,7 @@ struct efi_priv {
 extern char image_base[];
 
 /* Start and end of U-Boot image (for payload) */
-extern char _binary_u_boot_dtb_bin_start[], _binary_u_boot_dtb_bin_end[];
+extern char _binary_u_boot_bin_start[], _binary_u_boot_bin_end[];
 
 /**
  * efi_get_sys_table() - Get access to the main EFI system table
lib/efi/efi_stub.c +3 -3
index 8b4bb4e..1814960 100644
@@ -354,9 +354,9 @@ efi_status_t efi_main(efi_handle_t image, struct efi_system_table *sys_table)
 	/* The EFI UART won't work now, switch to a debug one */
 	use_uart = true;
 
-	memcpy((void *)CONFIG_SYS_TEXT_BASE, _binary_u_boot_dtb_bin_start,
-	       (ulong)_binary_u_boot_dtb_bin_end -
-	       (ulong)_binary_u_boot_dtb_bin_start);
+	memcpy((void *)CONFIG_SYS_TEXT_BASE, _binary_u_boot_bin_start,
+	       (ulong)_binary_u_boot_bin_end -
+	       (ulong)_binary_u_boot_bin_start);
 
 #ifdef DEBUG
 	puts("EFI table at ");
Signature · 1 line
2.9.2
author
#1 lore raw

PATCH 2/3 x86: efi: payload: Correct BITS_PER_LONG to 32

U-Boot itself as EFI payload is still running in 32-bit mode. So BITS_PER_LONG should still be 32. This fixes the warnings when building EFI 64-bit payload.

include/asm-generic/bitops/__fls.h:17:2:
warning: left shift count >= width of type

	if (!(word & (~0ul << 32))) {
			^

---

 arch/x86/include/asm/types.h | 4 ----
 lib/efi/efi_stub.c           | 1 -
 2 files changed, 5 deletions(-)
arch/x86/include/asm/types.h +0 -4
index 766617f..880dcb4 100644
@@ -44,11 +44,7 @@ typedef __INT64_TYPE__ s64;
 typedef __UINT64_TYPE__ u64;
 #endif
 
-#ifdef CONFIG_EFI_STUB_64BIT
-#define BITS_PER_LONG 64
-#else
 #define BITS_PER_LONG 32
-#endif
 /* Dma addresses are 32-bits wide.  */
 
 typedef u32 dma_addr_t;
lib/efi/efi_stub.c +0 -1
index 1814960..a02d06c 100644
@@ -297,7 +297,6 @@ efi_status_t efi_main(efi_handle_t image, struct efi_system_table *sys_table)
 	size = 0;
 	ret = boot->get_memory_map(&size, NULL, &key, &desc_size, &version);
 	if (ret != EFI_BUFFER_TOO_SMALL) {
-		printhex2(BITS_PER_LONG);
 		printhex2(ret);
 		puts(" No memory map\n");
 		return ret;
Signature · 1 line
2.9.2
#2 lore raw

PATCH 2/3 x86: efi: payload: Correct BITS_PER_LONG to 32

Quoted 9 lines · Bin Meng

U-Boot itself as EFI payload is still running in 32-bit mode. So BITS_PER_LONG should still be 32. This fixes the warnings when building EFI 64-bit payload.

include/asm-generic/bitops/__fls.h:17:2:
warning: left shift count >= width of type

        if (!(word & (~0ul << 32))) {
                        ^
Quoted 6 lines

---

 arch/x86/include/asm/types.h | 4 ----
 lib/efi/efi_stub.c           | 1 -
 2 files changed, 5 deletions(-)
author
#3 lore raw

PATCH 2/3 x86: efi: payload: Correct BITS_PER_LONG to 32

Quoted 10 lines · Simon Glass
Quoted 9 lines · Bin Meng

U-Boot itself as EFI payload is still running in 32-bit mode. So BITS_PER_LONG should still be 32. This fixes the warnings when building EFI 64-bit payload.

include/asm-generic/bitops/__fls.h:17:2:
warning: left shift count >= width of type

        if (!(word & (~0ul << 32))) {
                        ^
Quoted 8 lines
Quoted 6 lines

---

 arch/x86/include/asm/types.h | 4 ----
 lib/efi/efi_stub.c           | 1 -
 2 files changed, 5 deletions(-)

Sorry this patch needs rework as 64-bit payload does not boot. I will work on a v2.

Regards,
Bin

author
#4 lore raw

PATCH 3/3 x86: qemu: efi: Add two boards for EFI 32-bit and 64-bit payload

In reply to Bin Meng

This introduces two board defconfig files for generating EFI 32-bit and 64-bit payloads, to run on QEMU x86 target.

With these in place, hopefully buildman will catch any build error with EFI payload support on x86.

---

 configs/qemu-x86_efi_payload32_defconfig | 48 +++++++++++++++++++++++++++++++
 configs/qemu-x86_efi_payload64_defconfig | 49 ++++++++++++++++++++++++++++++++
 2 files changed, 97 insertions(+)
 create mode 100644 configs/qemu-x86_efi_payload32_defconfig
 create mode 100644 configs/qemu-x86_efi_payload64_defconfig
configs/qemu-x86_efi_payload32_defconfig new file +48 -0
new file mode 100644
index 0000000..eb9a110
@@ -0,0 +1,48 @@
+CONFIG_X86=y
+CONFIG_DEFAULT_DEVICE_TREE="qemu-x86_i440fx"
+CONFIG_SMP=y
+CONFIG_MAX_CPUS=2
+CONFIG_FIT=y
+CONFIG_BOOTSTAGE=y
+CONFIG_BOOTSTAGE_REPORT=y
+CONFIG_HUSH_PARSER=y
+CONFIG_CMD_CPU=y
+# CONFIG_CMD_IMLS is not set
+# CONFIG_CMD_FLASH is not set
+CONFIG_CMD_SF=y
+CONFIG_CMD_SPI=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_QFW=y
+CONFIG_CMD_BOOTSTAGE=y
+CONFIG_CMD_EXT2=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_OF_CONTROL=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
+CONFIG_CPU=y
+CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_GIGADEVICE=y
+CONFIG_SPI_FLASH_MACRONIX=y
+CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_DM_ETH=y
+CONFIG_E1000=y
+CONFIG_DM_PCI=y
+CONFIG_DM_RTC=y
+CONFIG_SYS_NS16550=y
+CONFIG_TIMER=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_VIDEO_VESA=y
+CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
+CONFIG_FRAMEBUFFER_VESA_MODE_111=y
+CONFIG_USE_PRIVATE_LIBGCC=y
+CONFIG_EFI=y
+CONFIG_EFI_STUB=y
configs/qemu-x86_efi_payload64_defconfig new file +49 -0

49 lines not on this page · raw message

Signature · 1 line
2.9.2
#5 lore raw

PATCH 3/3 x86: qemu: efi: Add two boards for EFI 32-bit and 64-bit payload

Quoted 8 lines · Bin Meng

This introduces two board defconfig files for generating EFI 32-bit and 64-bit payloads, to run on QEMU x86 target.

With these in place, hopefully buildman will catch any build error with EFI payload support on x86.

Quoted 7 lines

---

 configs/qemu-x86_efi_payload32_defconfig | 48 +++++++++++++++++++++++++++++++
 configs/qemu-x86_efi_payload64_defconfig | 49 ++++++++++++++++++++++++++++++++
 2 files changed, 97 insertions(+)
 create mode 100644 configs/qemu-x86_efi_payload32_defconfig
 create mode 100644 configs/qemu-x86_efi_payload64_defconfig

Great!

By the way I am working on initial 64-bit support and hope to have patches out in 2-3 weeks. I've run out of time for now unfortunately.

- Simon