From: Jan Kiszka <jan.kiszka@siemens.com>
To: isar-users <isar-users@googlegroups.com>
Subject: [PATCH v2 8/8] Add exemplary kernel module
Date: Thu, 8 Feb 2018 18:22:59 +0100 [thread overview]
Message-ID: <56ae33540c2e73820fae6f5f4a9242170fc7de63.1518110579.git.jan.kiszka@siemens.com> (raw)
In-Reply-To: <cover.1518110579.git.jan.kiszka@siemens.com>
In-Reply-To: <cover.1518110579.git.jan.kiszka@siemens.com>
From: Jan Kiszka <jan.kiszka@siemens.com>
This demonstrates the usage of the new module.inc via a primitive
hello world module.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
meta-isar/conf/local.conf.sample | 2 +-
.../recipes-kernel/example-module/example-module.bb | 12 ++++++++++++
.../recipes-kernel/example-module/files/src/Makefile | 18 ++++++++++++++++++
.../example-module/files/src/example-module.c | 19 +++++++++++++++++++
4 files changed, 50 insertions(+), 1 deletion(-)
create mode 100644 meta-isar/recipes-kernel/example-module/example-module.bb
create mode 100644 meta-isar/recipes-kernel/example-module/files/src/Makefile
create mode 100644 meta-isar/recipes-kernel/example-module/files/src/example-module.c
diff --git a/meta-isar/conf/local.conf.sample b/meta-isar/conf/local.conf.sample
index 2ae43e7..92dea46 100644
--- a/meta-isar/conf/local.conf.sample
+++ b/meta-isar/conf/local.conf.sample
@@ -153,7 +153,7 @@ CONF_VERSION = "1"
#
# The default list of extra packages to be installed.
-IMAGE_INSTALL = "example-hello example-raw"
+IMAGE_INSTALL = "example-hello example-raw example-module"
#
# Default parallel jobs for bitbake:
diff --git a/meta-isar/recipes-kernel/example-module/example-module.bb b/meta-isar/recipes-kernel/example-module/example-module.bb
new file mode 100644
index 0000000..c7042cf
--- /dev/null
+++ b/meta-isar/recipes-kernel/example-module/example-module.bb
@@ -0,0 +1,12 @@
+# Example recipe for building a custom module
+#
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2018
+#
+# SPDX-License-Identifier: MIT
+
+include recipes-kernel/linux-module/module.inc
+
+SRC_URI += "file://src"
+
+S = "src"
diff --git a/meta-isar/recipes-kernel/example-module/files/src/Makefile b/meta-isar/recipes-kernel/example-module/files/src/Makefile
new file mode 100644
index 0000000..1625b28
--- /dev/null
+++ b/meta-isar/recipes-kernel/example-module/files/src/Makefile
@@ -0,0 +1,18 @@
+# Example module
+#
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2018
+#
+# SPDX-License-Identifier: GPL-2.0
+
+obj-m := example-module.o
+
+INSTALL_MOD_PATH ?= $(DESTDIR)
+export INSTALL_MOD_PATH
+
+modules modules_install clean:
+ $(MAKE) -C $(KDIR) M=$(PWD) $@
+
+install: modules_install
+
+.PHONY: modules modules_install install clean
diff --git a/meta-isar/recipes-kernel/example-module/files/src/example-module.c b/meta-isar/recipes-kernel/example-module/files/src/example-module.c
new file mode 100644
index 0000000..07cb214
--- /dev/null
+++ b/meta-isar/recipes-kernel/example-module/files/src/example-module.c
@@ -0,0 +1,19 @@
+/*
+ * Example modules
+ *
+ * Copyright (c) Siemens AG, 2018
+ *
+ * SPDX-License-Identifier: GPL-2.0
+ */
+
+#include <linux/module.h>
+
+static int __init example_module_init(void)
+{
+ printk("Just an example\n");
+ return -ENOANO;
+}
+
+module_init(example_module_init);
+
+MODULE_LICENSE("GPL");
--
2.13.6
prev parent reply other threads:[~2018-02-08 17:23 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-08 17:22 [PATCH v2 0/8] Provide infrastructure and examples for custom kernels and modules Jan Kiszka
2018-02-08 17:22 ` [PATCH v2 1/8] Forward proxy settings to dpkg build Jan Kiszka
2018-02-08 17:22 ` [PATCH v2 2/8] Prioritize isar-apt repo over all others Jan Kiszka
2018-02-09 16:46 ` Henning Schild
2018-02-09 16:52 ` Jan Kiszka
2018-02-09 17:15 ` Henning Schild
2018-02-08 17:22 ` [PATCH v2 3/8] Replace SRC_DIR with S Jan Kiszka
2018-02-08 17:22 ` [PATCH v2 4/8] Install kernel via replaceable recipe Jan Kiszka
2018-02-08 17:22 ` [PATCH v2 5/8] Provide include file for easy custom kernel builds Jan Kiszka
2018-02-09 16:59 ` Henning Schild
2018-02-09 17:24 ` Jan Kiszka
2018-02-09 17:31 ` Henning Schild
2018-02-09 17:30 ` Henning Schild
2018-02-09 17:54 ` Jan Kiszka
2018-02-09 19:04 ` Henning Schild
2018-02-11 15:16 ` Jan Kiszka
2018-02-09 17:57 ` [PATCH v3 " Jan Kiszka
2018-02-08 17:22 ` [PATCH v2 6/8] Add custom kernel examples Jan Kiszka
2018-02-09 17:01 ` Henning Schild
2018-02-08 17:22 ` [PATCH v2 7/8] Provide include file for easy custom module builds Jan Kiszka
2018-02-08 17:22 ` Jan Kiszka [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56ae33540c2e73820fae6f5f4a9242170fc7de63.1518110579.git.jan.kiszka@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=isar-users@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox