All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-zephyr][PATCH v2 0/4] Fix efi generation and add x86 MACHINE confs (cover letter)
@ 2021-05-20 13:20 Naveen Saini
  2021-05-20 13:20 ` [meta-zephyr][PATCH v2 1/4] zephyr-kernel-src: fix efi generation failure for x86 boards Naveen Saini
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Naveen Saini @ 2021-05-20 13:20 UTC (permalink / raw)
  To: yocto

(1) zephyr-kernel-src: fix efi generation failure for x86 boards

With zephyr v2.5.0, EFI binary generation support has been added for x86 board (64-bit mode).
To achieve this, an python tool[1] has been added to convert zephyr EFL file
into an EFI appliable. But unfortunately at current this does not work with Yocto cross-compilation env.
This patch fix this issue and allow to build zephyr.efi for ehl_crb and up_squared boards.


(2)
Instead of creating machine configuration for each
supported boards, I would like to have common machine configurations for
supported boards. One for 64-bit (intel-x86-64.conf) and one for 32-bit
(intel-x86-32.conf).

User need to specify board value to ZEPHYR_BOARD in local.conf based on
targeted board i.e
    ZEPHYR_BOARD = "ehl_crb"

64-bit supported boards:
* up_squared
* ehl_crb_sbl
* ehl_crb (default)
* acrn
* acrn_ehl_crb

32-bit supported boards:
* up_squared_32
* minnowboard (default)

(3) Dropped acrn MACHINE configuration, which can be build with
MACHINE = "intel-x86-64"
ZEPHYR_BOARD = "acrn"

---
v2:
Fixed build for Zephyr 2.4.0
Dropped ACRN configuration

Naveen Saini (4):
  zephyr-kernel-src: fix efi generation failure for x86 boards
  intel-x86-64.conf: add common MACHINE for x86 (64-bit) BOARDS
  intel-x86-32.conf: add common MACHINE for x86 (32-bit) BOARDS
  acrn.conf: drop acrn machine configuration

 conf/machine/acrn.conf                        |  9 ---
 conf/machine/include/tune-core2-common.inc    |  6 ++
 conf/machine/include/tune-corei7-common.inc   |  3 +
 conf/machine/intel-x86-32.conf                | 12 +++
 conf/machine/intel-x86-64.conf                | 14 ++++
 ...ry-generation-issue-in-cross-compila.patch | 80 +++++++++++++++++++
 .../zephyr-kernel/zephyr-kernel-src-2.5.0.inc |  3 +
 .../zephyr-kernel/zephyr-kernel-src.inc       |  8 +-
 8 files changed, 122 insertions(+), 13 deletions(-)
 delete mode 100644 conf/machine/acrn.conf
 create mode 100644 conf/machine/include/tune-core2-common.inc
 create mode 100644 conf/machine/intel-x86-32.conf
 create mode 100644 conf/machine/intel-x86-64.conf
 create mode 100644 recipes-kernel/zephyr-kernel/files/0001-x86-fix-efi-binary-generation-issue-in-cross-compila.patch

-- 
2.17.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [meta-zephyr][PATCH v2 1/4] zephyr-kernel-src: fix efi generation failure for x86 boards
  2021-05-20 13:20 [meta-zephyr][PATCH v2 0/4] Fix efi generation and add x86 MACHINE confs (cover letter) Naveen Saini
@ 2021-05-20 13:20 ` Naveen Saini
  2021-05-20 13:20 ` [meta-zephyr][PATCH v2 2/4] intel-x86-64.conf: add common MACHINE for x86 (64-bit) BOARDS Naveen Saini
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Naveen Saini @ 2021-05-20 13:20 UTC (permalink / raw)
  To: yocto

With zephyr v2.5.0, EFI binary support has been added for x86 board (64-bit mode).

To achieve this, an python tool[1] has been added to convert zephyr ELF file
into an EFI appliable. But currently this does not work with Yocto
cross-compilation env.
This patch fix this issue and allow to build zephyr.efi

Ref:
[1]https://github.com/zephyrproject-rtos/zephyr/commit/928d31125f0b4eb28fe1cf3f3ad02b0ae071d7fd

Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
---
 ...ry-generation-issue-in-cross-compila.patch | 80 +++++++++++++++++++
 .../zephyr-kernel/zephyr-kernel-src-2.5.0.inc |  3 +
 .../zephyr-kernel/zephyr-kernel-src.inc       |  8 +-
 3 files changed, 87 insertions(+), 4 deletions(-)
 create mode 100644 recipes-kernel/zephyr-kernel/files/0001-x86-fix-efi-binary-generation-issue-in-cross-compila.patch

diff --git a/recipes-kernel/zephyr-kernel/files/0001-x86-fix-efi-binary-generation-issue-in-cross-compila.patch b/recipes-kernel/zephyr-kernel/files/0001-x86-fix-efi-binary-generation-issue-in-cross-compila.patch
new file mode 100644
index 0000000..fd6fc6b
--- /dev/null
+++ b/recipes-kernel/zephyr-kernel/files/0001-x86-fix-efi-binary-generation-issue-in-cross-compila.patch
@@ -0,0 +1,80 @@
+From cfde3b1018c3151b6cc1fbe3e9e163d0aaf16954 Mon Sep 17 00:00:00 2001
+From: Naveen Saini <naveen.kumar.saini@intel.com>
+Date: Tue, 11 May 2021 13:46:39 +0800
+Subject: [PATCH] x86: fix efi binary generation issue in cross compilation env
+
+Set root directory for headers.
+
+Upstream-Status: Inappropriate [Cross-compilation specific]
+
+Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
+---
+ arch/x86/zefi/zefi.py                | 6 +++++-
+ boards/x86/ehl_crb/CMakeLists.txt    | 1 +
+ boards/x86/qemu_x86/CMakeLists.txt   | 1 +
+ boards/x86/up_squared/CMakeLists.txt | 1 +
+ 4 files changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/arch/x86/zefi/zefi.py b/arch/x86/zefi/zefi.py
+index d3514391a8..b9eccbfa10 100755
+--- a/arch/x86/zefi/zefi.py
++++ b/arch/x86/zefi/zefi.py
+@@ -106,7 +106,10 @@ def build_elf(elf_file):
+     #  + We need pic to enforce that the linker adds no relocations
+     #  + UEFI can take interrupts on our stack, so no red zone
+     #  + UEFI API assumes 16-bit wchar_t
+-    cmd = [args.compiler, "-shared", "-Wall", "-Werror", "-I.",
++
++    #  Pass --sysroot path for cross compilation
++    sysrootarg = "--sysroot=" + args.sysroot
++    cmd = [args.compiler, "-shared", "-Wall", "-Werror", "-I.", sysrootarg,
+         "-fno-stack-protector", "-fpic", "-mno-red-zone", "-fshort-wchar",
+         "-Wl,-nostdlib", "-T", ldscript, "-o", "zefi.elf", cfile]
+     verbose(" ".join(cmd))
+@@ -145,6 +148,7 @@ def parse_args():
+     parser.add_argument("-o", "--objcopy", required=True, help="objcopy to be used")
+     parser.add_argument("-f", "--elf-file", required=True, help="Input file")
+     parser.add_argument("-v", "--verbose", action="store_true", help="Verbose output")
++    parser.add_argument("-s", "--sysroot", required=True, help="Cross compilation --sysroot=path")
+ 
+     return parser.parse_args()
+ 
+diff --git a/boards/x86/ehl_crb/CMakeLists.txt b/boards/x86/ehl_crb/CMakeLists.txt
+index 0d572eff30..6a228107dc 100644
+--- a/boards/x86/ehl_crb/CMakeLists.txt
++++ b/boards/x86/ehl_crb/CMakeLists.txt
+@@ -5,6 +5,7 @@ set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
+   -c ${CMAKE_C_COMPILER}
+   -o ${CMAKE_OBJCOPY}
+   -f ${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.elf
++  -s ${SYSROOT_DIR}
+   $<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose>
+   WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
+ )
+diff --git a/boards/x86/qemu_x86/CMakeLists.txt b/boards/x86/qemu_x86/CMakeLists.txt
+index 1131a5c7ce..489f17192b 100644
+--- a/boards/x86/qemu_x86/CMakeLists.txt
++++ b/boards/x86/qemu_x86/CMakeLists.txt
+@@ -4,6 +4,7 @@ set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
+   -c ${CMAKE_C_COMPILER}
+   -o ${CMAKE_OBJCOPY}
+   -f ${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.elf
++  -s ${SYSROOT_DIR}
+   $<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose>
+   WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
+ )
+diff --git a/boards/x86/up_squared/CMakeLists.txt b/boards/x86/up_squared/CMakeLists.txt
+index 0eaa9753fc..2e8ce7cfbc 100644
+--- a/boards/x86/up_squared/CMakeLists.txt
++++ b/boards/x86/up_squared/CMakeLists.txt
+@@ -5,6 +5,7 @@ set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
+   -c ${CMAKE_C_COMPILER}
+   -o ${CMAKE_OBJCOPY}
+   -f ${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.elf
++  -s ${SYSROOT_DIR}
+   $<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose>
+   WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
+ )
+-- 
+2.17.1
+
diff --git a/recipes-kernel/zephyr-kernel/zephyr-kernel-src-2.5.0.inc b/recipes-kernel/zephyr-kernel/zephyr-kernel-src-2.5.0.inc
index 6350d86..5d66f0f 100644
--- a/recipes-kernel/zephyr-kernel/zephyr-kernel-src-2.5.0.inc
+++ b/recipes-kernel/zephyr-kernel/zephyr-kernel-src-2.5.0.inc
@@ -8,3 +8,6 @@ SRCREV_libmetal = "9d4ee2c3cfd5f49861939447990f3b7d7bf9bf94"
 SRCREV_tinycrypt = "3e9a49d2672ec01435ffbf0d788db6d95ef28de0"
 
 PV = "2.5.0+git${SRCPV}"
+
+SRC_URI_append = " file://0001-x86-fix-efi-binary-generation-issue-in-cross-compila.patch \
+            "
diff --git a/recipes-kernel/zephyr-kernel/zephyr-kernel-src.inc b/recipes-kernel/zephyr-kernel/zephyr-kernel-src.inc
index 5ee40d4..b3b9565 100644
--- a/recipes-kernel/zephyr-kernel/zephyr-kernel-src.inc
+++ b/recipes-kernel/zephyr-kernel/zephyr-kernel-src.inc
@@ -1,10 +1,6 @@
 LICENSE = "Apache-2.0"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=fa818a259cbed7ce8bc2a22d35a464fc"
 
-# Default to a stable version
-PREFERRED_VERSION_zephyr-kernel ??= "2.5.0"
-include zephyr-kernel-src-${PREFERRED_VERSION_zephyr-kernel}.inc
-
 inherit cmake
 
 # This file might be included from other places (like other layers) and not
@@ -23,3 +19,7 @@ SRC_URI = "\
     file://0001-cmake-add-yocto-toolchain.patch \
     "
 S = "${WORKDIR}/git"
+
+# Default to a stable version
+PREFERRED_VERSION_zephyr-kernel ??= "2.5.0"
+include zephyr-kernel-src-${PREFERRED_VERSION_zephyr-kernel}.inc
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [meta-zephyr][PATCH v2 2/4] intel-x86-64.conf: add common MACHINE for x86 (64-bit) BOARDS
  2021-05-20 13:20 [meta-zephyr][PATCH v2 0/4] Fix efi generation and add x86 MACHINE confs (cover letter) Naveen Saini
  2021-05-20 13:20 ` [meta-zephyr][PATCH v2 1/4] zephyr-kernel-src: fix efi generation failure for x86 boards Naveen Saini
@ 2021-05-20 13:20 ` Naveen Saini
  2021-05-20 13:20 ` [meta-zephyr][PATCH v2 3/4] intel-x86-32.conf: add common MACHINE for x86 (32-bit) BOARDS Naveen Saini
  2021-05-20 13:20 ` [meta-zephyr][PATCH v2 4/4] acrn.conf: drop acrn machine configuration Naveen Saini
  3 siblings, 0 replies; 5+ messages in thread
From: Naveen Saini @ 2021-05-20 13:20 UTC (permalink / raw)
  To: yocto

User need to specify board value to ZEPHYR_BOARD in local.conf
ZEPHYR_BOARD = "ehl_crb"

By default it set to Elkhart Lake CRB 'ehl_crb'

Currently 64-bit supported boards:
* up_squared
* ehl_crb_sbl
* ehl_crb
* acrn
* acrn_ehl_crb

Ref:
https://docs.zephyrproject.org/latest/boards/x86/index.html

Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
---
 conf/machine/include/tune-corei7-common.inc |  3 +++
 conf/machine/intel-x86-64.conf              | 14 ++++++++++++++
 2 files changed, 17 insertions(+)
 create mode 100644 conf/machine/intel-x86-64.conf

diff --git a/conf/machine/include/tune-corei7-common.inc b/conf/machine/include/tune-corei7-common.inc
index 7ad9516..509d190 100644
--- a/conf/machine/include/tune-corei7-common.inc
+++ b/conf/machine/include/tune-corei7-common.inc
@@ -1,3 +1,6 @@
 DEFAULTTUNE ?= "corei7-64"
 require conf/machine/include/tune-corei7.inc
 require conf/machine/include/x86-base.inc
+
+# Add x86 to MACHINEOVERRIDE
+MACHINEOVERRIDES =. "x86:"
diff --git a/conf/machine/intel-x86-64.conf b/conf/machine/intel-x86-64.conf
new file mode 100644
index 0000000..2935cff
--- /dev/null
+++ b/conf/machine/intel-x86-64.conf
@@ -0,0 +1,14 @@
+#@TYPE: Machine
+#@NAME: intel-x86-64
+#@DESCRIPTION: common MACHINE for 64-bit x86 boards. User must set ${ZEPHYR_BOARD}. By default is set to 'ech_crb' board.
+
+require conf/machine/include/tune-corei7-common.inc
+
+ARCH_intel-x86-64 = "x86"
+
+# Supported Boards:
+# ZEPHYR_BOARD ?= "acrn"
+# ZEPHYR_BOARD ?= "acrn_ehl_crb"
+# ZEPHYR_BOARD ?= "up_squared"
+# ZEPHYR_BOARD ?= "ehl_crb_sbl"
+ZEPHYR_BOARD ?= "ehl_crb"
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [meta-zephyr][PATCH v2 3/4] intel-x86-32.conf: add common MACHINE for x86 (32-bit) BOARDS
  2021-05-20 13:20 [meta-zephyr][PATCH v2 0/4] Fix efi generation and add x86 MACHINE confs (cover letter) Naveen Saini
  2021-05-20 13:20 ` [meta-zephyr][PATCH v2 1/4] zephyr-kernel-src: fix efi generation failure for x86 boards Naveen Saini
  2021-05-20 13:20 ` [meta-zephyr][PATCH v2 2/4] intel-x86-64.conf: add common MACHINE for x86 (64-bit) BOARDS Naveen Saini
@ 2021-05-20 13:20 ` Naveen Saini
  2021-05-20 13:20 ` [meta-zephyr][PATCH v2 4/4] acrn.conf: drop acrn machine configuration Naveen Saini
  3 siblings, 0 replies; 5+ messages in thread
From: Naveen Saini @ 2021-05-20 13:20 UTC (permalink / raw)
  To: yocto

User need to specify board value to ZEPHYR_BOARD in local.conf
ZEPHYR_BOARD = "minnowboard"

By default it set to MinnowBoard Max 'minnowboard'

Currently 32-bit supported boards:
* up_squared_32
* minnowboard

Ref:
https://docs.zephyrproject.org/latest/boards/x86/index.html

Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
---
 conf/machine/include/tune-core2-common.inc |  6 ++++++
 conf/machine/intel-x86-32.conf             | 12 ++++++++++++
 2 files changed, 18 insertions(+)
 create mode 100644 conf/machine/include/tune-core2-common.inc
 create mode 100644 conf/machine/intel-x86-32.conf

diff --git a/conf/machine/include/tune-core2-common.inc b/conf/machine/include/tune-core2-common.inc
new file mode 100644
index 0000000..012f078
--- /dev/null
+++ b/conf/machine/include/tune-core2-common.inc
@@ -0,0 +1,6 @@
+DEFAULTTUNE ?= "core2-32"
+require conf/machine/include/tune-core2.inc
+require conf/machine/include/x86-base.inc
+
+# Add x86 to MACHINEOVERRIDES
+MACHINEOVERRIDES =. "x86:"
diff --git a/conf/machine/intel-x86-32.conf b/conf/machine/intel-x86-32.conf
new file mode 100644
index 0000000..06f6da5
--- /dev/null
+++ b/conf/machine/intel-x86-32.conf
@@ -0,0 +1,12 @@
+#@TYPE: Machine
+#@NAME: intel-x86-32
+#@DESCRIPTION: common MACHINE for 32-bit x86 boards. User must set ${ZEPHYR_BOARD}. By default is set to 'minnowboard' board.
+
+require conf/machine/include/tune-core2-common.inc
+
+ARCH_intel-x86-32 = "x86"
+
+# Supported Boards:
+# ZEPHYR_BOARD ?= "minnowboard"
+# ZEPHYR_BOARD ?= "up_squared_32"
+ZEPHYR_BOARD ?= "minnowboard"
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [meta-zephyr][PATCH v2 4/4] acrn.conf: drop acrn machine configuration
  2021-05-20 13:20 [meta-zephyr][PATCH v2 0/4] Fix efi generation and add x86 MACHINE confs (cover letter) Naveen Saini
                   ` (2 preceding siblings ...)
  2021-05-20 13:20 ` [meta-zephyr][PATCH v2 3/4] intel-x86-32.conf: add common MACHINE for x86 (32-bit) BOARDS Naveen Saini
@ 2021-05-20 13:20 ` Naveen Saini
  3 siblings, 0 replies; 5+ messages in thread
From: Naveen Saini @ 2021-05-20 13:20 UTC (permalink / raw)
  To: yocto

zephyr can be build for 'acrn' with following configuration:

MACHINE = "intel-x86-64"
ZEPHYR_BOARD = "acrn"

Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
---
 conf/machine/acrn.conf | 9 ---------
 1 file changed, 9 deletions(-)
 delete mode 100644 conf/machine/acrn.conf

diff --git a/conf/machine/acrn.conf b/conf/machine/acrn.conf
deleted file mode 100644
index c044933..0000000
--- a/conf/machine/acrn.conf
+++ /dev/null
@@ -1,9 +0,0 @@
-#@TYPE: Machine
-#@NAME: acrn
-#@DESCRIPTION: Machine for Zephyr BOARD acrn
-
-require conf/machine/include/qemu.inc
-require conf/machine/include/tune-corei7-common.inc
-ZEPHYR_INHERIT_CLASSES += "zephyr-qemuboot"
-
-ARCH_acrn = "x86"
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-05-20 13:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-20 13:20 [meta-zephyr][PATCH v2 0/4] Fix efi generation and add x86 MACHINE confs (cover letter) Naveen Saini
2021-05-20 13:20 ` [meta-zephyr][PATCH v2 1/4] zephyr-kernel-src: fix efi generation failure for x86 boards Naveen Saini
2021-05-20 13:20 ` [meta-zephyr][PATCH v2 2/4] intel-x86-64.conf: add common MACHINE for x86 (64-bit) BOARDS Naveen Saini
2021-05-20 13:20 ` [meta-zephyr][PATCH v2 3/4] intel-x86-32.conf: add common MACHINE for x86 (32-bit) BOARDS Naveen Saini
2021-05-20 13:20 ` [meta-zephyr][PATCH v2 4/4] acrn.conf: drop acrn machine configuration Naveen Saini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.