Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH v3] meta/meta-selftest: add selftest-hello-mod recipe
@ 2025-06-21  7:31 Dixit Parmar
  2025-06-23 16:50 ` [OE-core] " Ross Burton
  0 siblings, 1 reply; 3+ messages in thread
From: Dixit Parmar @ 2025-06-21  7:31 UTC (permalink / raw)
  To: openembedded-core; +Cc: Dixit Parmar

Kernel module specific oe test cases requires a test kernel
module package to work with. Added selftest-hello-mod
derived from meta-skeleton/recipes-kernel/hello-mod.

Signed-off-by: Dixit Parmar <dixitparmar19@gmail.com>

---
Previous patch version: https://lists.openembedded.org/g/openembedded-core/topic/113550149
---
 .../selftest-hello-mod/files/Makefile         | 14 +++++++++++
 .../selftest-hello-mod/files/hello.c          | 24 +++++++++++++++++++
 .../selftest-hello-mod/hello-mod_0.1.bb       | 17 +++++++++++++
 3 files changed, 55 insertions(+)
 create mode 100644 meta-selftest/recipes-test/selftest-hello-mod/files/Makefile
 create mode 100644 meta-selftest/recipes-test/selftest-hello-mod/files/hello.c
 create mode 100644 meta-selftest/recipes-test/selftest-hello-mod/hello-mod_0.1.bb

diff --git a/meta-selftest/recipes-test/selftest-hello-mod/files/Makefile b/meta-selftest/recipes-test/selftest-hello-mod/files/Makefile
new file mode 100644
index 0000000000..4ded35fbc3
--- /dev/null
+++ b/meta-selftest/recipes-test/selftest-hello-mod/files/Makefile
@@ -0,0 +1,14 @@
+obj-m := hello.o
+
+SRC := $(shell pwd)
+
+all:
+	$(MAKE) -C $(KERNEL_SRC) M=$(SRC)
+
+modules_install:
+	$(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install
+
+clean:
+	rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c
+	rm -f Module.markers Module.symvers modules.order
+	rm -rf .tmp_versions Modules.symvers
diff --git a/meta-selftest/recipes-test/selftest-hello-mod/files/hello.c b/meta-selftest/recipes-test/selftest-hello-mod/files/hello.c
new file mode 100644
index 0000000000..4f73455d20
--- /dev/null
+++ b/meta-selftest/recipes-test/selftest-hello-mod/files/hello.c
@@ -0,0 +1,24 @@
+/******************************************************************************
+ *
+ *   Copyright (C) 2011  Intel Corporation. All rights reserved.
+ *
+ *   SPDX-License-Identifier: GPL-2.0-only
+ *
+ *****************************************************************************/
+
+#include <linux/module.h>
+
+static int __init hello_init(void)
+{
+	pr_info("Hello World!\n");
+	return 0;
+}
+
+static void __exit hello_exit(void)
+{
+	pr_info("Goodbye Cruel World!\n");
+}
+
+module_init(hello_init);
+module_exit(hello_exit);
+MODULE_LICENSE("GPL");
diff --git a/meta-selftest/recipes-test/selftest-hello-mod/hello-mod_0.1.bb b/meta-selftest/recipes-test/selftest-hello-mod/hello-mod_0.1.bb
new file mode 100644
index 0000000000..f7d5bc88a2
--- /dev/null
+++ b/meta-selftest/recipes-test/selftest-hello-mod/hello-mod_0.1.bb
@@ -0,0 +1,17 @@
+SUMMARY = "Example of how to build an external Linux kernel module -- selftest variant"
+DESCRIPTION = "${SUMMARY}"
+LICENSE = "GPL-2.0-only"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6"
+
+inherit module
+
+SRC_URI = "file://Makefile \
+           file://hello.c \
+          "
+
+S = "${UNPACKDIR}"
+
+# The inherit of module.bbclass will automatically name module packages with
+# "kernel-module-" prefix as required by the oe-core build environment.
+
+RPROVIDES:${PN} += "kernel-module-hello"
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [OE-core] [PATCH v3] meta/meta-selftest: add selftest-hello-mod recipe
  2025-06-21  7:31 [PATCH v3] meta/meta-selftest: add selftest-hello-mod recipe Dixit Parmar
@ 2025-06-23 16:50 ` Ross Burton
  2025-06-24  6:37   ` Dixit Parmar
  0 siblings, 1 reply; 3+ messages in thread
From: Ross Burton @ 2025-06-23 16:50 UTC (permalink / raw)
  To: dixitparmar19@gmail.com; +Cc: openembedded-core@lists.openembedded.org

On 21 Jun 2025, at 08:31, Dixit Parmar via lists.openembedded.org <dixitparmar19=gmail.com@lists.openembedded.org> wrote:
> 
> Kernel module specific oe test cases requires a test kernel
> module package to work with. Added selftest-hello-mod
> derived from meta-skeleton/recipes-kernel/hello-mod.

Is there meant to be an actual test case to follow this up?

There’s already a kernel module in oeqa under meta/lib/oeqa/runtime/files/hellomod.c, I’ve previously tried adding more test cases around them (for SDKs not selftest though):

https://git.yoctoproject.org/poky-contrib/log/?h=ross/module

Maybe instead of duplicating the kernel module more we move the source and Makefile into meta/lib/oeqa/files/kmodule/ and then the tests can easily use them, and the recipe could set SRC_URI to ${COREBASE}/lib/oeqa/files/kmodule/hellomod.c.

Cheers,
Ross

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] meta/meta-selftest: add selftest-hello-mod recipe
  2025-06-23 16:50 ` [OE-core] " Ross Burton
@ 2025-06-24  6:37   ` Dixit Parmar
  0 siblings, 0 replies; 3+ messages in thread
From: Dixit Parmar @ 2025-06-24  6:37 UTC (permalink / raw)
  To: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 1443 bytes --]

On Mon, Jun 23, 2025 at 10:20 PM, Ross Burton wrote:

> 
> On 21 Jun 2025, at 08:31, Dixit Parmar via lists.openembedded.org
> <dixitparmar19=gmail.com@lists.openembedded.org> wrote:
> 
>> Kernel module specific oe test cases requires a test kernel
>> module package to work with. Added selftest-hello-mod
>> derived from meta-skeleton/recipes-kernel/hello-mod.
> 
> Is there meant to be an actual test case to follow this up?

Yes, it's here https://lists.openembedded.org/g/openembedded-core/message/218013 - please review this too ;)

> 
> There’s already a kernel module in oeqa under
> meta/lib/oeqa/runtime/files/hellomod.c, I’ve previously tried adding more
> test cases around them (for SDKs not selftest though):
> 
> https://git.yoctoproject.org/poky-contrib/log/?h=ross/module
> 
> Maybe instead of duplicating the kernel module more we move the source and
> Makefile into meta/lib/oeqa/files/kmodule/ and then the tests can easily
> use them, and the recipe could set SRC_URI to
> ${COREBASE}/lib/oeqa/files/kmodule/hellomod.c.

I created a new recipe with the corresponding source files with the idea of having an independent self-test package for hello-mod. This is included in the meta-selftest so it can be used for other kernel module-related test cases in the future. I can modify it to point to the source and Makefile outside of the package if you recommend, though.

> 
> Cheers,
> Ross

[-- Attachment #2: Type: text/html, Size: 1771 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-06-24  6:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-21  7:31 [PATCH v3] meta/meta-selftest: add selftest-hello-mod recipe Dixit Parmar
2025-06-23 16:50 ` [OE-core] " Ross Burton
2025-06-24  6:37   ` Dixit Parmar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox