Re: [isar-cip-core][PATCH] linux: Fix warning if USE_CIP_KERNEL_CONFIG is not defined


Jan Kiszka
 

On 29.01.21 13:22, Gylstorff Quirin wrote:


On 1/28/21 3:13 PM, Jan Kiszka wrote:
On 25.01.21 19:23, Gylstorff Quirin wrote:


On 1/25/21 6:28 PM, Bezdeka, Florian (T RDA IOT SES-DE) wrote:
USE_CIP_KERNEL_CONFIG may not be defined in all layers using the
isar-cip-core layer, so we end up with the following warnings:

WARNING:
/work/cip-core/recipes-kernel/linux/linux-cip_4.19.140-cip33.bb:
Unable to get checksum for linux-cip SRC_URI entry
${MACHINE}_defconfig: file could not be found
WARNING:
/work/cip-core/recipes-kernel/linux/linux-cip-rt_4.4.231-cip47-rt30.bb:
Unable
to get checksum for linux-cip-rt SRC_URI entry ${MACHINE}_defconfig:
file could not be found
WARNING:
/work/cip-core/recipes-kernel/linux/linux-cip_4.4.230-cip47.bb: Unable
to get checksum for linux-cip SRC_URI entry ${MACHINE}_defconfig: file
could not be found
WARNING:
/work/cip-core/recipes-kernel/linux/linux-cip-rt_4.19.135-cip31-rt13.bb:

Unable to get checksum for linux-cip-rt SRC_URI entry
${MACHINE}_defconfig: file could not be found

${MACHINE}_defconfig needs to be added to SRC_URI only if
USE_CIP_KERNEL_CONFIG is set to "1".

There is one in-tree machine definition (the bbb) that does not set
USE_CIP_KERNEL_CONFIG to "1" but still needs the defconfig added.
A machine specific SRC_URI was set to take care of that.

Closes #7.

Signed-off-by: Florian Bezdeka <florian.bezdeka@...>
---

Some additional notes:
    - That's my first contribution, so review carefully ;-)
    - Both branches (master, next) are affected
    - The gitlab MR: [1]
    - The gitlab issue: [2]

    [1]
https://gitlab.com/cip-project/cip-core/isar-cip-core/-/merge_requests/10


    [2]
https://gitlab.com/cip-project/cip-core/isar-cip-core/-/issues/7



   recipes-kernel/linux/linux-cip-common.inc | 15 ++++++---------
   1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/recipes-kernel/linux/linux-cip-common.inc
b/recipes-kernel/linux/linux-cip-common.inc
index 6db1d1d..9aca9af 100644
--- a/recipes-kernel/linux/linux-cip-common.inc
+++ b/recipes-kernel/linux/linux-cip-common.inc
@@ -11,21 +11,18 @@

   KERNEL_DEFCONFIG ?= "${MACHINE}_defconfig"

-def conditional(variable, checkvalue, truevalue, falsevalue, d):
-    if d.getVar(variable) == checkvalue:
-        return truevalue
-    else:
-        return falsevalue
-
   require recipes-kernel/linux/linux-custom.inc

   SRC_URI += " \
      https://gitlab.com/cip-project/cip-kernel/linux-cip/-/archive/v$
\
       "

-SRC_URI_append = " ${@conditional("USE_CIP_KERNEL_CONFIG", "1", \
-
"git://gitlab.com/cip-project/cip-kernel/cip-kernel-config.git;protocol=https;destsuffix=cip-kernel-config;name=cip-kernel-config",

\
-    "file://${KERNEL_DEFCONFIG}",d)}"
The easier way would have been to delete file://${KERNEL_DEFCONFIG}
instead of create the logic anew. The conditional function should allow
an empty string.
I'm not yet sure which string should be empty and would break with the
new version. Can you elaborate?

Jan

I will skip the url.
You could have written

SRC_URI_append =  "${@conditional("USE_CIP_KERNEL_CONFIG",
"1","git://...","",d)"

instead of

SRC_URI_append = "${@ "git://..." if d.getVar('USE_CIP_KERNEL_CONFIG')
== '1' else ''}"

The result is the same. The second method saves some code in form of a
function.
Means you are fine with Florian's patch? If there are no downsides, I
would prefer that pattern as well.

Jan


Quirin

+SRC_URI_append = "${@
"git://gitlab.com/cip-project/cip-kernel/cip-kernel-config.git;protocol=https;destsuffix=cip-kernel-config;name=cip-kernel-config"

\
+    if d.getVar('USE_CIP_KERNEL_CONFIG') == '1' else '' \
+    }"
+
+SRC_URI_append_bbb = "file://${KERNEL_DEFCONFIG}"
+
   SRCREV_cip-kernel-config ?=
"7f2930b9667372f94f2edb42ca9cf6fc6c0aed50"

   S = "${WORKDIR}/linux-cip-v${PV}"
-- 
2.29.2
Quirin
--
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux

Join cip-dev@lists.cip-project.org to automatically receive all group messages.