Skip to contentSkip to conversation

kernel: classes: Extract savedefconfig to a class

PATCH In review Alex Kiernan 5 participants 9 messages Oct 12, 2022 – Nov 1, 2022

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 kernel: classes: Extract savedefconfig to a class

Move savedefconfig task to a class so we can reuse it in other recipes which support it.

---
 meta/classes-recipe/cml1-savedefconfig.bbclass | 12 ++++++++++++
 meta/classes-recipe/kernel.bbclass             |  9 +--------
 2 files changed, 13 insertions(+), 8 deletions(-)
 create mode 100644 meta/classes-recipe/cml1-savedefconfig.bbclass
meta/classes-recipe/cml1-savedefconfig.bbclass new file +12 -0
new file mode 100644
index 000000000000..c340aac11204
@@ -0,0 +1,12 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
+do_savedefconfig() {
+	bbplain "Saving defconfig to:\n${B}/defconfig"
+	oe_runmake -C ${B} savedefconfig
+}
+do_savedefconfig[nostamp] = "1"
+addtask savedefconfig after do_configure
meta/classes-recipe/kernel.bbclass +1 -8
index e4e69e076375..eae7b2f78a9e 100644
@@ -634,14 +634,7 @@ kernel_do_configure() {
 	${KERNEL_CONFIG_COMMAND}
 }
 
-do_savedefconfig() {
-	bbplain "Saving defconfig to:\n${B}/defconfig"
-	oe_runmake -C ${B} savedefconfig
-}
-do_savedefconfig[nostamp] = "1"
-addtask savedefconfig after do_configure
-
-inherit cml1
+inherit cml1 cml1-savedefconfig
 
 # Need LD, HOSTLDFLAGS and more for config operations
 KCONFIG_CONFIG_COMMAND:append = " ${EXTRA_OEMAKE}"
Signature · 1 line
2.35.1
#1 lore raw

PATCH v2 2/3 u-boot: Remove duplicate inherit of cml1

Splitting u-boot-configure.inc out of the base left duplicate cml1.bbclass in the base include.

Fixes fc9a17ad386c ("u-boot: Split do_configure logic into separate file")
---
 meta/recipes-bsp/u-boot/u-boot.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-bsp/u-boot/u-boot.inc +1 -1
index f022aed732ce..b2f33e382664 100644
@@ -5,7 +5,7 @@ PACKAGE_ARCH = "${MACHINE_ARCH}"
 
 DEPENDS += "${@bb.utils.contains('UBOOT_ENV_SUFFIX', 'scr', 'u-boot-mkimage-native', '', d)}"
 
-inherit uboot-config uboot-extlinux-config uboot-sign deploy cml1 python3native kernel-arch
+inherit uboot-config uboot-extlinux-config uboot-sign deploy python3native kernel-arch
 
 DEPENDS += "swig-native"
 
Signature · 1 line
2.35.1
#2 lore raw

PATCH v2 3/3 u-boot: Add savedefconfig task

In reply to Alex Kiernan

Add savedefconfig task which U-Boot supports (unfortunately not all consumers of cml1 support this).

---
 meta/recipes-bsp/u-boot/u-boot.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-bsp/u-boot/u-boot.inc +1 -1
index b2f33e382664..046e842289fa 100644
@@ -5,7 +5,7 @@ PACKAGE_ARCH = "${MACHINE_ARCH}"
 
 DEPENDS += "${@bb.utils.contains('UBOOT_ENV_SUFFIX', 'scr', 'u-boot-mkimage-native', '', d)}"
 
-inherit uboot-config uboot-extlinux-config uboot-sign deploy python3native kernel-arch
+inherit uboot-config uboot-extlinux-config uboot-sign deploy python3native kernel-arch cml1-savedefconfig
 
 DEPENDS += "swig-native"
 
Signature · 1 line
2.35.1
#3 lore raw
In reply to Alex Kiernan
Quoted 3 lines · Alex Kiernan via lists.openembedded.org

Move savedefconfig task to a class so we can reuse it in other recipes which support it.

There are three users of cml1 in oe-core: kernel, uboot, and busybox. Does busybox support savedefconfig?

I’m thinking to avoid tiny classes we can just add this to cml1.bbclass and make it print a decent error message if it doesn’t work.

Ross

#4 lore raw
Quoted 12 lines · Ross Burton
Quoted 3 lines · Alex Kiernan via lists.openembedded.org

Move savedefconfig task to a class so we can reuse it in other recipes which support it.

There are three users of cml1 in oe-core: kernel, uboot, and busybox. Does busybox support savedefconfig?

I’m thinking to avoid tiny classes we can just add this to cml1.bbclass and make it print a decent error message if it doesn’t work.

I agree I think it should be there for all kconfig users and they can strub it in recipe if needed

Quoted 13 lines

Ross
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#171669):
https://lists.openembedded.org/g/openembedded-core/message/171669
Mute This Topic: https://lists.openembedded.org/mt/94276340/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#5 lore raw
In reply to Ross Burton
Quoted 8 lines · Ross Burton
Quoted 3 lines · Alex Kiernan via lists.openembedded.org

Move savedefconfig task to a class so we can reuse it in other recipes which support it.

There are three users of cml1 in oe-core: kernel, uboot, and busybox. Does busybox support savedefconfig?

It doesn't and fairly obviously goes boom...

ERROR: busybox-1.35.0-r0 do_savedefconfig: oe_runmake failed
ERROR: busybox-1.35.0-r0 do_savedefconfig:
ExecutionError('/home/alexk/poky/build/tmp/work/core2-64-poky-linux/busybox/1.35.0-r0/temp/run.do_savedefconfig.12421', 1, None, None)
ERROR: Logfile of failure stored in:
/home/alexk/poky/build/tmp/work/core2-64-poky-linux/busybox/1.35.0-r0/temp/log.do_savedefconfig.12421 Log data follows:

| DEBUG: Executing shell function do_savedefconfig
| Saving defconfig to:
| /home/alexk/poky/build/tmp/work/core2-64-poky-linux/busybox/1.35.0-r0/busybox-1.35.0/defconfig
| NOTE: make CC=x86_64-poky-linux-gcc  -m64 -march=core2 -mtune=core2

-msse3 -mfpmath=sse -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 --sysroot=/home/alexk/poky/build/tmp/work/core2-64-poky-linux/busybox/1.35.0-r0/recipe-sysroot LD=x86_64-poky-linux-gcc -m64 -march=core2 -mtune=core2 -msse3
-mfpmath=sse -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 --sysroot=/home/alexk/poky/build/tmp/work/core2-64-poky-linux/busybox/1.35.0-r0/recipe-sysroot V=1 ARCH=x86_64 CROSS_COMPILE=x86_64-poky-linux- SKIP_STRIP=y
HOSTCC=gcc HOSTCPP=gcc -E -C /home/alexk/poky/build/tmp/work/core2-64-poky-linux/busybox/1.35.0-r0/busybox-1.35.0 savedefconfig
| make: Entering directory '/home/alexk/poky/build/tmp/work/core2-64-poky-linux/busybox/1.35.0-r0/busybox-1.35.0'
| make -f scripts/Makefile.build obj=scripts/basic
| /home/alexk/poky/build/tmp/work/core2-64-poky-linux/busybox/1.35.0-r0/busybox-1.35.0/scripts/gen_build_files.sh /home/alexk/poky/build/tmp/work/core2-64-poky-linux/busybox/1.35.0-r0/busybox-1.35.0 /home/alexk/poky/build/tmp/work/core2-64-poky-linux/busybox/1.35.0-r0/busybox-1.35.0

| mkdir -p include
| make -f scripts/Makefile.build obj=scripts/kconfig savedefconfig
| make[1]: *** No rule to make target 'savedefconfig'.  Stop.
| make: *** [Makefile:444: savedefconfig] Error 2
| make: Leaving directory

'/home/alexk/poky/build/tmp/work/core2-64-poky-linux/busybox/1.35.0-r0/busybox-1.35.0' | ERROR: oe_runmake failed

Quoted 2 lines

I’m thinking to avoid tiny classes we can just add this to cml1.bbclass and make it print a decent error message if it doesn’t work.

So where I started, was adding it to u-boot.inc (which isn't a class, I guess an artefact of history), because tiny classes felt like a poor choice. I can add it to cml1 instead, at which point I've tried all three options, maybe that's the best option and if you have a consumer that doesn't do it, you just get a fail as above.

Are there are other users of cml1 other than these three? My suspicion is there isn't (though I've only looked at layers I've got checked out).

Signature · 1 line
Alex Kiernan
#6 lore raw
Quoted 57 lines · Alex Kiernan
Quoted 8 lines · Ross Burton
Quoted 3 lines · Alex Kiernan via lists.openembedded.org

Move savedefconfig task to a class so we can reuse it in other recipes which support it.

There are three users of cml1 in oe-core: kernel, uboot, and busybox. Does busybox support savedefconfig?

It doesn't and fairly obviously goes boom...

ERROR: busybox-1.35.0-r0 do_savedefconfig: oe_runmake failed
ERROR: busybox-1.35.0-r0 do_savedefconfig:
ExecutionError('/home/alexk/poky/build/tmp/work/core2-64-poky-linux/busybox/1.35.0-r0/temp/run.do_savedefconfig.12421', 1, None, None)
ERROR: Logfile of failure stored in:
/home/alexk/poky/build/tmp/work/core2-64-poky-linux/busybox/1.35.0-r0/temp/log.do_savedefconfig.12421 Log data follows:

| DEBUG: Executing shell function do_savedefconfig
| Saving defconfig to:
| /home/alexk/poky/build/tmp/work/core2-64-poky-linux/busybox/1.35.0-r0/busybox-1.35.0/defconfig
| NOTE: make CC=x86_64-poky-linux-gcc  -m64 -march=core2 -mtune=core2

-msse3 -mfpmath=sse -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 --sysroot=/home/alexk/poky/build/tmp/work/core2-64-poky-linux/busybox/1.35.0-r0/recipe-sysroot LD=x86_64-poky-linux-gcc -m64 -march=core2 -mtune=core2 -msse3
-mfpmath=sse -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 --sysroot=/home/alexk/poky/build/tmp/work/core2-64-poky-linux/busybox/1.35.0-r0/recipe-sysroot V=1 ARCH=x86_64 CROSS_COMPILE=x86_64-poky-linux- SKIP_STRIP=y
HOSTCC=gcc HOSTCPP=gcc -E -C /home/alexk/poky/build/tmp/work/core2-64-poky-linux/busybox/1.35.0-r0/busybox-1.35.0 savedefconfig
| make: Entering directory '/home/alexk/poky/build/tmp/work/core2-64-poky-linux/busybox/1.35.0-r0/busybox-1.35.0'
| make -f scripts/Makefile.build obj=scripts/basic
| /home/alexk/poky/build/tmp/work/core2-64-poky-linux/busybox/1.35.0-r0/busybox-1.35.0/scripts/gen_build_files.sh /home/alexk/poky/build/tmp/work/core2-64-poky-linux/busybox/1.35.0-r0/busybox-1.35.0 /home/alexk/poky/build/tmp/work/core2-64-poky-linux/busybox/1.35.0-r0/busybox-1.35.0

| mkdir -p include
| make -f scripts/Makefile.build obj=scripts/kconfig savedefconfig
| make[1]: *** No rule to make target 'savedefconfig'.  Stop.
| make: *** [Makefile:444: savedefconfig] Error 2
| make: Leaving directory

'/home/alexk/poky/build/tmp/work/core2-64-poky-linux/busybox/1.35.0-r0/busybox-1.35.0' | ERROR: oe_runmake failed

Quoted 4 lines

I’m thinking to avoid tiny classes we can just add this to cml1.bbclass and make it print a decent error message if it doesn’t work.

So where I started, was adding it to u-boot.inc (which isn't a class, I guess an artefact of history), because tiny classes felt like a poor choice. I can add it to cml1 instead, at which point I've tried all three options, maybe that's the best option and if you have a consumer that doesn't do it, you just get a fail as above.

Quoted 3 lines

Are there are other users of cml1 other than these three? My suspicion is there isn't (though I've only looked at layers I've got checked out).

There is the barebox bootloader which supports 'savedefconfig', whose recipe in meta-ptx uses cml1 via [2] and which would benefit from this change.

Best regards
Ulrich

[1] https://barebox.org/
[2] https://github.com/pengutronix/meta-ptx/blob/master/recipes-bsp/barebox/barebox.inc#L12

Signature · 4 lines
Pengutronix e.K.                           | Ulrich Ölmann               |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#7 lore raw
In reply to Alex Kiernan
Quoted 5 lines · Alex Kiernan via lists.openembedded.org
Quoted 3 lines · Ross Burton
Quoted 1 line · Alex Kiernan via lists.openembedded.org
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Move savedefconfig task to a class so we can reuse it in other recipes which support it.

There are three users of cml1 in oe-core: kernel, uboot, and busybox. Does busybox support savedefconfig?

It doesn't and fairly obviously goes boom…

If you really keen you could see if savedefconfig is a valid target somehow (search make -p for savedefconfig?), but to be honest given Ulrich’s reply I’m fine with the cml1 class supporting a function that most implementations, if not all, support.

It seems preferable to a class which is just "oe_runmake savedefconfig”, at least.

Ross

#8 lore raw
Quoted 9 lines · Ross Burton
Quoted 8 lines · Alex Kiernan via lists.openembedded.org
Quoted 6 lines · Ross Burton
Quoted 3 lines · Alex Kiernan via lists.openembedded.org

Move savedefconfig task to a class so we can reuse it in other recipes which support it.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

There are three users of cml1 in oe-core: kernel, uboot, and busybox. Does busybox support savedefconfig?

It doesn't and fairly obviously goes boom…

If you really keen you could see if savedefconfig is a valid target somehow (search make -p for savedefconfig?), but to be honest given Ulrich’s reply I’m fine with the cml1 class supporting a function that most implementations, if not all, support.

It seems preferable to a class which is just "oe_runmake savedefconfig”, at least.

The other "trick" that could work here is to put most of the definition in the class but put the addtask in the recipe/inc file. That way most is command and shared but only the valid users enable it with what is a single line.

Cheers,

Richard