[U-Boot] [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.
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
include/efi.h | 2 +- lib/efi/efi_stub.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/efi.h b/include/efi.h index 1dbc3b7..21921f1 100644 --- a/include/efi.h +++ b/include/efi.h @@ -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 diff --git a/lib/efi/efi_stub.c b/lib/efi/efi_stub.c index 8b4bb4e..1814960 100644 --- a/lib/efi/efi_stub.c +++ b/lib/efi/efi_stub.c @@ -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 ");

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))) { ^
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
arch/x86/include/asm/types.h | 4 ---- lib/efi/efi_stub.c | 1 - 2 files changed, 5 deletions(-)
diff --git a/arch/x86/include/asm/types.h b/arch/x86/include/asm/types.h index 766617f..880dcb4 100644 --- a/arch/x86/include/asm/types.h +++ b/arch/x86/include/asm/types.h @@ -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; diff --git a/lib/efi/efi_stub.c b/lib/efi/efi_stub.c index 1814960..a02d06c 100644 --- a/lib/efi/efi_stub.c +++ b/lib/efi/efi_stub.c @@ -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;

On 24 August 2016 at 03:31, Bin Meng bmeng.cn@gmail.com wrote:
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))) { ^
Signed-off-by: Bin Meng bmeng.cn@gmail.com
arch/x86/include/asm/types.h | 4 ---- lib/efi/efi_stub.c | 1 - 2 files changed, 5 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Wed, Aug 24, 2016 at 8:53 PM, Simon Glass sjg@chromium.org wrote:
On 24 August 2016 at 03:31, Bin Meng bmeng.cn@gmail.com wrote:
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))) { ^
Signed-off-by: Bin Meng bmeng.cn@gmail.com
arch/x86/include/asm/types.h | 4 ---- lib/efi/efi_stub.c | 1 - 2 files changed, 5 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
Sorry this patch needs rework as 64-bit payload does not boot. I will work on a v2.
Regards, Bin

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.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
---
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
diff --git a/configs/qemu-x86_efi_payload32_defconfig b/configs/qemu-x86_efi_payload32_defconfig new file mode 100644 index 0000000..eb9a110 --- /dev/null +++ b/configs/qemu-x86_efi_payload32_defconfig @@ -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 diff --git a/configs/qemu-x86_efi_payload64_defconfig b/configs/qemu-x86_efi_payload64_defconfig new file mode 100644 index 0000000..be3c913 --- /dev/null +++ b/configs/qemu-x86_efi_payload64_defconfig @@ -0,0 +1,49 @@ +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 +CONFIG_EFI_STUB_64BIT=y

On 24 August 2016 at 03:31, Bin Meng bmeng.cn@gmail.com wrote:
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.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
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!
Reviewed-by: Simon Glass sjg@chromium.org
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

On 24 August 2016 at 03:31, Bin Meng bmeng.cn@gmail.com wrote:
Since commit 73c5c39 "Makefile: Drop unnecessary -dtb suffixes", EFI payload does not build anymore. This fixes the build.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
include/efi.h | 2 +- lib/efi/efi_stub.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
participants (2)
-
Bin Meng
-
Simon Glass