Skip to content

Commit

Permalink
zephyr-kernel: Add support for v3.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
saininav committed Jun 22, 2023
1 parent 00ae4c1 commit 5e75142
Show file tree
Hide file tree
Showing 3 changed files with 380 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
From f314ca637eb2eb5ed1cda7320ab2448d6487aed8 Mon Sep 17 00:00:00 2001
From: Naveen Saini <[email protected]>
Date: Thu, 22 Jun 2023 16:21:50 +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 <[email protected]>
---
arch/x86/zefi/zefi.py | 5 ++++-
boards/x86/ehl_crb/CMakeLists.txt | 1 +
boards/x86/qemu_x86/CMakeLists.txt | 1 +
boards/x86/rpl_crb/CMakeLists.txt | 1 +
boards/x86/up_squared/CMakeLists.txt | 1 +
5 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/x86/zefi/zefi.py b/arch/x86/zefi/zefi.py
index 99c188ecd0..1cd86a21cd 100755
--- a/arch/x86/zefi/zefi.py
+++ b/arch/x86/zefi/zefi.py
@@ -109,8 +109,10 @@ def build_elf(elf_file, include_dirs):
includes = []
for include_dir in include_dirs:
includes.extend(["-I", include_dir])
+ # Pass --sysroot path for cross compilation
+ sysrootarg = "--sysroot=" + args.sysroot
cmd = ([args.compiler, "-shared", "-Wall", "-Werror", "-I."] + includes +
- ["-fno-stack-protector", "-fpic", "-mno-red-zone", "-fshort-wchar",
+ ["-fno-stack-protector", "-fpic", "-mno-red-zone", "-fshort-wchar", sysrootarg,
"-Wl,-nostdlib", "-T", ldscript, "-o", "zefi.elf", cfile])
verbose(" ".join(cmd))
subprocess.run(cmd, check = True)
@@ -150,6 +152,7 @@ def parse_args():
parser.add_argument("-v", "--verbose", action="store_true", help="Verbose output")
parser.add_argument("-i", "--includes", required=True, nargs="+",
help="Zephyr base include directories")
+ 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 06bbb2dce1..60aa1496e8 100644
--- a/boards/x86/ehl_crb/CMakeLists.txt
+++ b/boards/x86/ehl_crb/CMakeLists.txt
@@ -6,6 +6,7 @@ set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
-o ${CMAKE_OBJCOPY}
-i ${ZEPHYR_BASE}/include
-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 de31c25a82..2910fa0192 100644
--- a/boards/x86/qemu_x86/CMakeLists.txt
+++ b/boards/x86/qemu_x86/CMakeLists.txt
@@ -5,6 +5,7 @@ set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
-i ${ZEPHYR_BASE}/include
-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/rpl_crb/CMakeLists.txt b/boards/x86/rpl_crb/CMakeLists.txt
index 7db36d8d7c..700f51bf01 100644
--- a/boards/x86/rpl_crb/CMakeLists.txt
+++ b/boards/x86/rpl_crb/CMakeLists.txt
@@ -6,6 +6,7 @@ set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
-o ${CMAKE_OBJCOPY}
-i ${ZEPHYR_BASE}/include
-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 57eef4eabe..ad90969fa9 100644
--- a/boards/x86/up_squared/CMakeLists.txt
+++ b/boards/x86/up_squared/CMakeLists.txt
@@ -6,6 +6,7 @@ set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
-o ${CMAKE_OBJCOPY}
-i ${ZEPHYR_BASE}/include
-f ${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.elf
+ -s ${SYSROOT_DIR}
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose>
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
)
--
2.34.1

Loading

0 comments on commit 5e75142

Please sign in to comment.