Skip to contentSkip to conversation

Make kernel-yocto bbclass usable without linux-yocto.inc

PATCH In review Paul Barker 2 participants 7 messages Jan 15, 2020 – Jan 24, 2020

lore
Share & tools
lore
#0 lore raw

cover Make kernel-yocto bbclass usable without linux-yocto.inc

Patch 1 allows the kernel-yocto bbclass to be inherited directly in a recipe without needing to use linux-yocto.inc. I can then use kconfig fragments in my kernel recipe without pulling in the whole of linux-yocto.inc (which includes some things I don't want like KERNEL_FEATURES changes and the LINUX_VERSION_EXTENSION default).

Patches 2 & 3 fix some minor issues I spotted while working on this.

I've tested that linux-yocto can still be built for qemux86 after these changes.

Paul Barker (3):
kernel-yocto: Move defaults and tasks from linux-yocto.inc into
bbclass
kernel-yocto: Drop setting of unused variables in do_kernel_metadata
kernel-yocto: Only override CONFIG_LOCALVERSION if
LINUX_VERSION_EXTENSION is set

 meta/classes/kernel-yocto.bbclass         | 34 +++++++++++++++++------
 meta/recipes-kernel/linux/linux-yocto.inc | 21 --------------
 2 files changed, 25 insertions(+), 30 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/3 kernel-yocto: Move defaults and tasks from linux-yocto.inc into bbclass

This allows the kernel-yocto bbclass to be inherited in a recipe without needing to include linux-yocto.inc. The bbclass should stand on its own and linux-yocto.inc does a few things which may not be desired in other kernel recipes (such as modifying KERNEL_FEATURES).

The LINUX_VERSION_EXTENSION default is not moved as other kernel recipes may not want this setting in place.

---
 meta/classes/kernel-yocto.bbclass         | 21 +++++++++++++++++++++
 meta/recipes-kernel/linux/linux-yocto.inc | 21 ---------------------
 2 files changed, 21 insertions(+), 21 deletions(-)
meta/classes/kernel-yocto.bbclass +21 -0
index 87c681f1c3..8b22c34243 100644
@@ -3,6 +3,22 @@ SRCTREECOVEREDTASKS += "do_kernel_configme do_validate_branches do_kernel_config
 PATCH_GIT_USER_EMAIL ?= "kernel-yocto@oe"
 PATCH_GIT_USER_NAME ?= "OpenEmbedded"
 
+# The distro or local.conf should set this, but if nobody cares...
+LINUX_KERNEL_TYPE ??= "standard"
+
+# KMETA ?= ""
+KBRANCH ?= "master"
+KMACHINE ?= "${MACHINE}"
+SRCREV_FORMAT ?= "meta_machine"
+
+# LEVELS:
+#   0: no reporting
+#   1: report options that are specified, but not in the final config
+#   2: report options that are not hardware related, but set by a BSP
+KCONF_AUDIT_LEVEL ?= "1"
+KCONF_BSP_AUDIT_LEVEL ?= "0"
+KMETA_AUDIT ?= "yes"
+
 # returns local (absolute) path names for all valid patches in the
 # src_uri
 def find_patches(d,subdir):
@@ -474,3 +490,8 @@ python () {
     if 'do_diffconfig' in d:
         bb.build.addtask('do_diffconfig', None, 'do_kernel_configme', d)
 }
+
+# extra tasks
+addtask kernel_version_sanity_check after do_kernel_metadata do_kernel_checkout before do_compile
+addtask validate_branches before do_patch after do_kernel_checkout
+addtask kernel_configcheck after do_configure before do_compile
meta/recipes-kernel/linux/linux-yocto.inc +0 -21
index f191946f2a..91df9c1cd5 100644
@@ -39,22 +39,6 @@ KERNEL_FEATURES_append = " ${@bb.utils.contains('MACHINE_FEATURES', 'numa', 'fea
 # and it can be specific to the machine or shared
 # KMACHINE = "UNDEFINED"
 
-# The distro or local.conf should set this, but if nobody cares...
-LINUX_KERNEL_TYPE ??= "standard"
-
-# KMETA ?= ""
-KBRANCH ?= "master"
-KMACHINE ?= "${MACHINE}"
-SRCREV_FORMAT ?= "meta_machine" 
-
-# LEVELS:
-#   0: no reporting
-#   1: report options that are specified, but not in the final config
-#   2: report options that are not hardware related, but set by a BSP
-KCONF_AUDIT_LEVEL ?= "1"
-KCONF_BSP_AUDIT_LEVEL ?= "0"
-KMETA_AUDIT ?= "yes"
-
 LINUX_VERSION_EXTENSION ??= "-yocto-${LINUX_KERNEL_TYPE}"
 
 # Pick up shared functions
@@ -69,10 +53,5 @@ do_install_append(){
 	fi
 }
 
-# extra tasks
-addtask kernel_version_sanity_check after do_kernel_metadata do_kernel_checkout before do_compile
-addtask validate_branches before do_patch after do_kernel_checkout
-addtask kernel_configcheck after do_configure before do_compile
-
 # enable kernel-sample for oeqa/runtime/cases's ksample.py test
 KERNEL_FEATURES_append_qemuall=" features/kernel-sample/kernel-sample.scc"
Signature · 1 line
2.20.1
#2 lore raw

PATCH 2/3 kernel-yocto: Drop setting of unused variables in do_kernel_metadata

In reply to Paul Barker

The machine_branch and machine_srcrev variables were set but not used in do_kernel_metadata.

---
 meta/classes/kernel-yocto.bbclass | 7 -------
 1 file changed, 7 deletions(-)
meta/classes/kernel-yocto.bbclass +0 -7
index 8b22c34243..70e131101e 100644
@@ -99,13 +99,6 @@ do_kernel_metadata() {
 		fi
 	fi
 
-	machine_branch="${@ get_machine_branch(d, "${KBRANCH}" )}"
-	machine_srcrev="${SRCREV_machine}"
-	if [ -z "${machine_srcrev}" ]; then
-		# fallback to SRCREV if a non machine_meta tree is being built
-		machine_srcrev="${SRCREV}"
-	fi
-
 	# In a similar manner to the kernel itself:
 	#
 	#   defconfig: $(obj)/conf
Signature · 1 line
2.20.1
#3 lore raw

PATCH 3/3 kernel-yocto: Only override CONFIG_LOCALVERSION if LINUX_VERSION_EXTENSION is set

In reply to Paul Barker

CONFIG_LOCALVERSION may already be set in a defconfig or config fragment and this should not be unconditionally overridden.

---
 meta/classes/kernel-yocto.bbclass | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
meta/classes/kernel-yocto.bbclass +4 -2
index 70e131101e..597abe7727 100644
@@ -359,8 +359,10 @@ do_kernel_configme() {
 		bbfatal_log "Could not configure ${KMACHINE}-${LINUX_KERNEL_TYPE}"
 	fi
 
-	echo "# Global settings from linux recipe" >> ${B}/.config
-	echo "CONFIG_LOCALVERSION="\"${LINUX_VERSION_EXTENSION}\" >> ${B}/.config
+	if [ ! -z "${LINUX_VERSION_EXTENSION}" ]; then
+		echo "# Global settings from linux recipe" >> ${B}/.config
+		echo "CONFIG_LOCALVERSION="\"${LINUX_VERSION_EXTENSION}\" >> ${B}/.config
+	fi
 }
 
 addtask kernel_configme before do_configure after do_patch
Signature · 1 line
2.20.1
#4 lore raw
In reply to Paul Barker

I already have an entire queue in development for this.

So hold onto this series. I'll publish my branch later this week, or early next.

Bruce

Quoted 26 lines · Paul Barker

Patch 1 allows the kernel-yocto bbclass to be inherited directly in a recipe without needing to use linux-yocto.inc. I can then use kconfig fragments in my kernel recipe without pulling in the whole of linux-yocto.inc (which includes some things I don't want like KERNEL_FEATURES changes and the LINUX_VERSION_EXTENSION default).

Patches 2 & 3 fix some minor issues I spotted while working on this.

I've tested that linux-yocto can still be built for qemux86 after these changes.

Paul Barker (3):
kernel-yocto: Move defaults and tasks from linux-yocto.inc into
bbclass
kernel-yocto: Drop setting of unused variables in do_kernel_metadata
kernel-yocto: Only override CONFIG_LOCALVERSION if
LINUX_VERSION_EXTENSION is set

 meta/classes/kernel-yocto.bbclass         | 34 +++++++++++++++++------
 meta/recipes-kernel/linux/linux-yocto.inc | 21 --------------
 2 files changed, 25 insertions(+), 30 deletions(-)

--
2.20.1

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
#5 lore raw
Quoted 4 lines · Bruce Ashfield

I already have an entire queue in development for this.

So hold onto this series. I'll publish my branch later this week, or early next.

Actually, I'll see how it stacks on top of my changes and send a unified branch to try out. That's probably the easiest way to get them all working together.

Patches 2/3 look good, but I'd rather wait until we have the whole series ready to go before Acking.

Cheers,

Bruce

Quoted 32 lines

Bruce

Quoted 19 lines · Paul Barker

Patch 1 allows the kernel-yocto bbclass to be inherited directly in a recipe without needing to use linux-yocto.inc. I can then use kconfig fragments in my kernel recipe without pulling in the whole of linux-yocto.inc (which includes some things I don't want like KERNEL_FEATURES changes and the LINUX_VERSION_EXTENSION default).

Patches 2 & 3 fix some minor issues I spotted while working on this.

I've tested that linux-yocto can still be built for qemux86 after these changes.

Paul Barker (3):
kernel-yocto: Move defaults and tasks from linux-yocto.inc into
bbclass
kernel-yocto: Drop setting of unused variables in do_kernel_metadata
kernel-yocto: Only override CONFIG_LOCALVERSION if
LINUX_VERSION_EXTENSION is set

Quoted 7 lines
 meta/classes/kernel-yocto.bbclass         | 34 +++++++++++++++++------
 meta/recipes-kernel/linux/linux-yocto.inc | 21 --------------
 2 files changed, 25 insertions(+), 30 deletions(-)

--
2.20.1

Quoted 4 lines

--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

#6 lore raw
Quoted 5 lines · Bruce Ashfield
Quoted 3 lines · Bruce Ashfield

I already have an entire queue in development for this.

Quoted 8 lines
Quoted 1 line

So hold onto this series. I'll publish my branch later this week, or early next.

Actually, I'll see how it stacks on top of my changes and send a unified branch to try out. That's probably the easiest way to get them all working together.

Patches 2/3 look good, but I'd rather wait until we have the whole series ready to go before Acking.

I haven't forgotten about this, but the issues with 5.4 as the reference/LTS kernel popped back up and I didn't get a chance to stack this and test with my other kernel-yocto changes. I will get to it shortly though.

Bruce

Quoted 48 lines

Cheers,

Bruce

Quoted 32 lines

Bruce

Quoted 19 lines · Paul Barker

Patch 1 allows the kernel-yocto bbclass to be inherited directly in a recipe without needing to use linux-yocto.inc. I can then use kconfig fragments in my kernel recipe without pulling in the whole of linux-yocto.inc (which includes some things I don't want like KERNEL_FEATURES changes and the LINUX_VERSION_EXTENSION default).

Patches 2 & 3 fix some minor issues I spotted while working on this.

I've tested that linux-yocto can still be built for qemux86 after these changes.

Paul Barker (3):
kernel-yocto: Move defaults and tasks from linux-yocto.inc into
bbclass
kernel-yocto: Drop setting of unused variables in do_kernel_metadata
kernel-yocto: Only override CONFIG_LOCALVERSION if
LINUX_VERSION_EXTENSION is set

Quoted 7 lines
 meta/classes/kernel-yocto.bbclass         | 34 +++++++++++++++++------
 meta/recipes-kernel/linux/linux-yocto.inc | 21 --------------
 2 files changed, 25 insertions(+), 30 deletions(-)

--
2.20.1

Quoted 4 lines

--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II