diff mbox series

[meta-zephyr,3/3] zephyr-kernel: Checkout zephyr in subdir to match West usage

Message ID 20220808074256.3081464-3-peter.hoyes@arm.com
State New
Headers show
Series [meta-zephyr,1/3] zephyr-kernel: Remove redundant ZEPHYR_BASE definitions | expand

Commit Message

Peter Hoyes Aug. 8, 2022, 7:42 a.m. UTC
From: Peter Hoyes <Peter.Hoyes@arm.com>

When using West, Zephyr is checked out in a "zephyr" subdirectory of the
working directory. At the moment Zephyr is checked out at the root,
meaning a workaround is required to extract the module information.

In order to remove the workaround, change the Zephyr destsuffix in
SRC_URI and ZEPHYR_BASE. As a result of this change, modify patchdir for
the patches and the path to the LICENSE file.

Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com>
---
 meta-zephyr-core/classes/zephyr.bbclass                   | 8 +-------
 .../recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc | 2 +-
 .../zephyr-kernel/zephyr-kernel-src-2.7.2.inc             | 6 +++---
 .../zephyr-kernel/zephyr-kernel-src-3.1.0.inc             | 4 ++--
 .../recipes-kernel/zephyr-kernel/zephyr-kernel-src.inc    | 4 ++--
 5 files changed, 9 insertions(+), 15 deletions(-)
diff mbox series

Patch

diff --git a/meta-zephyr-core/classes/zephyr.bbclass b/meta-zephyr-core/classes/zephyr.bbclass
index f3d16b7..8030456 100644
--- a/meta-zephyr-core/classes/zephyr.bbclass
+++ b/meta-zephyr-core/classes/zephyr.bbclass
@@ -34,16 +34,10 @@  do_get_zmods() {
     rm -rf .west; mkdir .west
     cat << EOF >> ${S}/.west/config
 [manifest]
-path = .
+path = zephyr
 file = west.yml
 EOF
 
-    # Because of how we structure things, we need to either structure this more like a west workspace or just tweak
-    # the manifest in order to get access to the west extentions like build and whatnot. Tweaking the manifest is the
-    # easier path here and minimizes the amount of breakage that might occur.
-    
-    sed -i 's/path: zephyr/path: ./' west.yml
-
     # Get all available modules and add them to ZEPHYR_MODULES
     for i in $(west list|awk 'NR>1 {print $2}'); do
         ZEPHYR_MODULES="${S}/$i\;${ZEPHYR_MODULES}"
diff --git a/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc b/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc
index 1c80fe0..a970abf 100644
--- a/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc
+++ b/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc
@@ -30,7 +30,7 @@  ZEPHYR_EXTRA_MODULES = ""
 
 EXTRA_OECMAKE:append = "  -DZEPHYR_EXTRA_MODULES=${ZEPHYR_EXTRA_MODULES}"
 
-export ZEPHYR_BASE="${S}"
+export ZEPHYR_BASE="${S}/zephyr"
 
 DEPENDS += "gperf-native"
 
diff --git a/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-src-2.7.2.inc b/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-src-2.7.2.inc
index 537a565..cbe761f 100644
--- a/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-src-2.7.2.inc
+++ b/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-src-2.7.2.inc
@@ -63,8 +63,8 @@  ZEPHYR_BRANCH = "v2.7-branch"
 PV = "2.7.2+git${SRCPV}"
 
 SRC_URI:append = " \
-    file://dtc.patch \
-    file://0001-x86-fix-efi-binary-generation-issue-in-cross-compila.patch \
-    file://0001-2.7-cmake-add-yocto-toolchain.patch \
+    file://dtc.patch;patchdir=zephyr \
+    file://0001-x86-fix-efi-binary-generation-issue-in-cross-compila.patch;patchdir=zephyr \
+    file://0001-2.7-cmake-add-yocto-toolchain.patch;patchdir=zephyr \
     git://github.com/zephyrproject-rtos/hal_cypress.git;protocol=https;nobranch=1;destsuffix=git/modules/hal/cypress;name=cypress \
 "
diff --git a/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-src-3.1.0.inc b/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-src-3.1.0.inc
index 612cfd7..c0fe5f2 100644
--- a/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-src-3.1.0.inc
+++ b/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-src-3.1.0.inc
@@ -72,6 +72,6 @@  ZEPHYR_BRANCH = "v3.1-branch"
 PV = "3.1.0+git${SRCPV}"
 
 SRC_URI += " \
-    file://0001-3.1-cmake-add-yocto-toolchain.patch \
-    file://0001-3.1-x86-fix-efi-binary-generation-issue-in-cross-compila.patch \
+    file://0001-3.1-cmake-add-yocto-toolchain.patch;patchdir=zephyr \
+    file://0001-3.1-x86-fix-efi-binary-generation-issue-in-cross-compila.patch;patchdir=zephyr \
 "
diff --git a/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-src.inc b/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-src.inc
index e9b35c9..a4bab22 100644
--- a/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-src.inc
+++ b/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-src.inc
@@ -1,5 +1,5 @@ 
 LICENSE = "Apache-2.0"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=fa818a259cbed7ce8bc2a22d35a464fc"
+LIC_FILES_CHKSUM = "file://zephyr/LICENSE;md5=fa818a259cbed7ce8bc2a22d35a464fc"
 
 CVE_PRODUCT = "zephyr"
 
@@ -11,7 +11,7 @@  inherit cmake
 FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
 
 SRC_URI = "\
-    git://github.com/zephyrproject-rtos/zephyr.git;protocol=https;branch=${ZEPHYR_BRANCH};name=default \
+    git://github.com/zephyrproject-rtos/zephyr.git;protocol=https;branch=${ZEPHYR_BRANCH};name=default;destsuffix=git/zephyr \
     git://github.com/zephyrproject-rtos/canopennode.git;protocol=https;nobranch=1;destsuffix=git/modules/lib/canopennode;name=canopennode \
     git://github.com/zephyrproject-rtos/civetweb.git;protocol=https;nobranch=1;destsuffix=git/modules/lib/civetweb;name=civetweb \
     git://github.com/zephyrproject-rtos/cmsis.git;protocol=https;nobranch=1;destsuffix=git/modules/hal/cmsis;name=cmsis \