From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6520199916203016192 X-Received: by 10.46.69.131 with SMTP id s125mr138114lja.41.1518621692313; Wed, 14 Feb 2018 07:21:32 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 10.25.221.210 with SMTP id w79ls842435lfi.12.gmail; Wed, 14 Feb 2018 07:21:31 -0800 (PST) X-Google-Smtp-Source: AH8x2258hAM4X44By4EE3bpZs4O6gfQiqRy1EMOEOP3BOY5xGKCGVZIba5bSTHtR9RGsDdQ+KHTg X-Received: by 10.25.208.132 with SMTP id h126mr411014lfg.33.1518621691518; Wed, 14 Feb 2018 07:21:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518621691; cv=none; d=google.com; s=arc-20160816; b=eJ5qmMuQugTde5U1w+2F6ftiRrofaRLPMnc6UDCZsOUJkAsTDHD0PGkYhoc3k2Otms 0uR/6ty5kpmlr2hrtvpp1QCN+ZuyLy3XkvwYzUhKIh6YT3gW9SobqMAuay2nOMiZ0OTa FFDQAmfeCdYki/EbZKD5CHQReXvM6mg2zwpilFF6x6wjRHiieitiy0vmNrKP+/x/9Dx7 WcqizI0bHDqWmBXndFT4e0Q2f4u/trFqfJX8mmx4KHUaFG0Kel03VPCiDu0w80l055W4 Xs+rqjF1Tuy+FWvgDytZc3wyra/+WJSWmU1UzBgG1QmeKwhut76v1iz1uyxTqw8FxMMS 84ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:references:to:from:subject :arc-authentication-results; bh=9AKI9+d4oZBFtBtXar8VSbij1Zj9Ge+ukAA4rKKhVRw=; b=Bea9K92b2Jay+96dbGKqOd28Ftdg7wfjrn2BHjZfDkwotgeKw5F4UAJfAgWvd9PGbs QB39Sj4acFhGQmDAubkd/m7jKXb5l85R7TY8yAhIOHRdg7uo/Kk1DhIeV2dx63QU62Oi lnVGH/7kfSE0lFnVVGtEj/DLNEh1kCSxSfcdj3lPHWs7Zu270bEfnwmdQm3zIdDjkPmO XOl7fE3D15jHgQczm1FeS5edsQvjuLGsa6InGoP6Atd+NBIYBAYy+FO9qTza/PxVOc96 KRvw3Q332Uro1WbZyNGtau490jeGjwUBMXZcYwxLAb8MFZEzAc96HZCTOQXzofq3MtbX +89Q== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com Return-Path: Received: from thoth.sbs.de (thoth.sbs.de. [192.35.17.2]) by gmr-mx.google.com with ESMTPS id k82si20499lfe.1.2018.02.14.07.21.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Feb 2018 07:21:31 -0800 (PST) Received-SPF: pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.2 as permitted sender) client-ip=192.35.17.2; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com Received: from mail3.siemens.de (mail3.siemens.de [139.25.208.14]) by thoth.sbs.de (8.15.2/8.15.2) with ESMTPS id w1EFLUYj000807 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 14 Feb 2018 16:21:30 +0100 Received: from [139.25.68.37] (md1q0hnc.ad001.siemens.net [139.25.68.37] (may be forged)) by mail3.siemens.de (8.15.2/8.15.2) with ESMTP id w1EFLUCp020518 for ; Wed, 14 Feb 2018 16:21:30 +0100 Subject: [PATCH v6 5/5] Add exemplary kernel module From: Jan Kiszka To: isar-users References: <4e502291374cbbdfd24827ad4f039517d4297e96.1518599595.git.jan.kiszka@siemens.com> Message-ID: Date: Wed, 14 Feb 2018 16:21:30 +0100 User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 In-Reply-To: <4e502291374cbbdfd24827ad4f039517d4297e96.1518599595.git.jan.kiszka@siemens.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TUID: FnGz5FThoSZa From: Jan Kiszka This demonstrates the usage of the new module.inc via a primitive hello world module. For wheezy:vexpress, module builds unfortunately fail with /usr/bin/ld: unrecognized option '-Wl,-z,relro' So disable the example on in the related multiconfig. Signed-off-by: Jan Kiszka --- Changes in v6: - wheezy:vexpress exception meta-isar/conf/local.conf.sample | 2 +- meta-isar/conf/multiconfig/qemuarm-wheezy.conf | 3 +++ .../recipes-kernel/example-module/example-module.bb | 12 ++++++++++++ .../recipes-kernel/example-module/files/src/Makefile | 18 ++++++++++++++++++ .../example-module/files/src/example-module.c | 19 +++++++++++++++++++ 5 files changed, 53 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/conf/multiconfig/qemuarm-wheezy.conf b/meta-isar/conf/multiconfig/qemuarm-wheezy.conf index 11355a4..90e337a 100644 --- a/meta-isar/conf/multiconfig/qemuarm-wheezy.conf +++ b/meta-isar/conf/multiconfig/qemuarm-wheezy.conf @@ -21,3 +21,6 @@ QEMU_ARCH ?= "arm" QEMU_MACHINE ?= "vexpress-a9" QEMU_CPU ?= "" QEMU_ROOTFS_DEV ?= "-sd ##ROOTFS_IMAGE##" + +# module build does not work on wheezy for vexpress +IMAGE_INSTALL_remove = "example-module" 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 + +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