[yocto] [meta-zephyr][PATCH 2/7] zephyr-kernel: refactor common code

Juro Bystricky juro.bystricky at intel.com
Sat Jan 14 11:01:48 PST 2017


Several changes to simplify recipes by refactoring
common code. The code common to all Zephyr builds is
now in the file "zephyr-kernel-common.inc".

Signed-off-by: Juro Bystricky <juro.bystricky at intel.com>
---
 recipes-kernel/zephyr-kernel/zephyr-image.inc      | 21 +----------------
 .../zephyr-kernel/zephyr-kernel-common.inc         | 27 ++++++++++++++++++++++
 recipes-kernel/zephyr-kernel/zephyr-kernel.inc     |  4 ----
 .../zephyr-kernel/zephyr-philosophers.bb           | 25 +-------------------
 .../zephyr-getchar/zephyr-getchar_git.bb           | 16 +++----------
 5 files changed, 32 insertions(+), 61 deletions(-)
 create mode 100644 recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc

diff --git a/recipes-kernel/zephyr-kernel/zephyr-image.inc b/recipes-kernel/zephyr-kernel/zephyr-image.inc
index 1e630e5..d365c9c 100644
--- a/recipes-kernel/zephyr-kernel/zephyr-image.inc
+++ b/recipes-kernel/zephyr-kernel/zephyr-image.inc
@@ -1,33 +1,14 @@
 require zephyr-kernel.inc
+require zephyr-kernel-common.inc
 
 inherit testimage
 inherit deploy
 
-INHIBIT_DEFAULT_DEPS = "1"
-DEPENDS += "gcc-cross-${TARGET_ARCH} libgcc"
-
-CROSS_COMPILE = "${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}"
 QEMU_BIN_PATH = "${STAGING_BINDIR_NATIVE}"
 
 OE_TERMINAL_EXPORTS += "CROSS_COMPILE"
 OE_TERMINAL_EXPORTS += "BOARD"
 
-# oe_runmake isn't used because of the make -e causing issues with some
-# make variables.
-MAKE_COMMAND = "make -j V=1 BOARD=${BOARD} CROSS_COMPILE=${CROSS_COMPILE}"
-
-do_configure[noexec] = "1"
-
-# The makefiles are explicit about the flags they want, so don't unset
-# them so zephyr flags actually get used.
-# This is done here rather than in the task so that things still work
-# in devshell.
-python () {
-    d.delVar('CFLAGS')
-    d.delVar('CXXFLAGS')
-    d.delVar('LDFLAGS')
-}
-
 do_compile () {
     cd ${S}
     export ZEPHYR_BASE=${S}
diff --git a/recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc b/recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc
new file mode 100644
index 0000000..6fe44b5
--- /dev/null
+++ b/recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc
@@ -0,0 +1,27 @@
+# Common settings for all Zephyr recipes
+
+# There shouldn't be a manifest for zephyr kernels since there is no root
+# filesystem.
+IMAGE_NO_MANIFEST = "1"
+
+# oe_runmake isn't used because of the make -e causing issues with some
+# make variables.
+MAKE_COMMAND = "make -j V=1 BOARD=${BOARD} CROSS_COMPILE=${CROSS_COMPILE}"
+
+# We always need a toolchain to cross-compile.
+INHIBIT_DEFAULT_DEPS = "1"
+DEPENDS += "gcc-cross-${TARGET_ARCH} libgcc"
+CROSS_COMPILE = "${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}"
+
+do_configure[noexec] = "1"
+
+# The makefiles are explicit about the flags they want, so don't unset
+# them so zephyr flags actually get used.
+# This is done here rather than in the task so that things still work
+# in devshell.
+
+python () {
+    d.delVar('CFLAGS')
+    d.delVar('CXXFLAGS')
+    d.delVar('LDFLAGS')
+}
diff --git a/recipes-kernel/zephyr-kernel/zephyr-kernel.inc b/recipes-kernel/zephyr-kernel/zephyr-kernel.inc
index aa450ca..71c7a29 100644
--- a/recipes-kernel/zephyr-kernel/zephyr-kernel.inc
+++ b/recipes-kernel/zephyr-kernel/zephyr-kernel.inc
@@ -10,10 +10,6 @@ PV = "1.6.0"
 
 S = "${WORKDIR}/git"
 
-# There shouldn't be a manifest for zephyr kernels since there is no root
-# filesystem.
-IMAGE_NO_MANIFEST = "1"
-
 do_compile_prepend() {
     cp ${WORKDIR}/Makefile.toolchain.yocto ${S}/scripts
 }
diff --git a/recipes-kernel/zephyr-kernel/zephyr-philosophers.bb b/recipes-kernel/zephyr-kernel/zephyr-philosophers.bb
index ac0b2a7..f9e9282 100644
--- a/recipes-kernel/zephyr-kernel/zephyr-philosophers.bb
+++ b/recipes-kernel/zephyr-kernel/zephyr-philosophers.bb
@@ -1,30 +1,7 @@
 require zephyr-kernel.inc
-
+require zephyr-kernel-common.inc
 inherit deploy
 
-INHIBIT_DEFAULT_DEPS = "1"
-
-DEPENDS += "gcc-cross-${TARGET_ARCH} libgcc"
-
-# The makefiles are explicit about the flags they want, so don't unset
-# them so zephyr flags actually get used.
-# This is done here rather than in the task so that things still work
-# in devshell.
-python () {
-    d.delVar('CFLAGS')
-    d.delVar('CXXFLAGS')
-    d.delVar('LDFLAGS')
-}
-
-do_configure[noexec] = "1"
-
-CROSS_COMPILE="${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}"
-
-# oe_runmake isn't used because of the make -e causing issues with some
-# make variables.
-
-MAKE_COMMAND = "make -j V=1 BOARD=${BOARD} CROSS_COMPILE=${CROSS_COMPILE}"
-
 do_compile () {
     cd ${S}
     export ZEPHYR_BASE=${S}
diff --git a/recipes-zephyr/zephyr-getchar/zephyr-getchar_git.bb b/recipes-zephyr/zephyr-getchar/zephyr-getchar_git.bb
index e616e75..d795151 100644
--- a/recipes-zephyr/zephyr-getchar/zephyr-getchar_git.bb
+++ b/recipes-zephyr/zephyr-getchar/zephyr-getchar_git.bb
@@ -3,23 +3,13 @@ LICENSE="Apache-2.0"
 LIC_FILES_CHKSUM = "file://src/zephyr_getchar.c;beginline=1;endline=15;md5=d78a817213b11b6bcd9fe41669a2fd4a"
 inherit deploy
 
+require recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc
+
 SRCREV="b8d511be4d2b9e05c6adb413a33d6ea510aa0c6a"
 SRC_URI = "git://github.com/pfalcon/zephyr_console_helpers.git;protocol=https"
 S = "${WORKDIR}/git/zephyr_getchar"
 
-INHIBIT_DEFAULT_DEPS = "1"
-
-DEPENDS += "gcc-cross-${TARGET_ARCH} libgcc zephyr-kernel-src"
-
-python () {
-    d.delVar('CFLAGS')
-    d.delVar('CXXFLAGS')
-    d.delVar('LDFLAGS')
-}
-
-do_configure[noexec] = "1"
-
-CROSS_COMPILE="${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}"
+DEPENDS += " zephyr-kernel-src"
 
 do_compile () {
     cd ${S}
-- 
2.7.4




More information about the yocto mailing list