* [PATCH v5 1/5] Make distro kernel replaceable
2018-02-14 9:13 [PATCH v5 0/5] Provide infrastructure and examples for custom kernels and modules Jan Kiszka
@ 2018-02-14 9:13 ` Jan Kiszka
2018-02-14 9:13 ` [PATCH v5 2/5] Provide include for easy custom kernel builds Jan Kiszka
` (5 subsequent siblings)
6 siblings, 0 replies; 20+ messages in thread
From: Jan Kiszka @ 2018-02-14 9:13 UTC (permalink / raw)
To: isar-users
From: Jan Kiszka <jan.kiszka@siemens.com>
Introduce the configuration variable KERNEL_NAME, typically to be
defined by the machine, that selected the kernel that is installed and
can also be depended on / built against.
Create a shadow recipe linux-disto.bb that simply PROVIDES to the
bitbake world distro kernel targets that exist in package form in either
Debian or Raspian.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
meta-isar/conf/distro/debian-jessie.conf | 4 ++++
meta-isar/conf/distro/debian-stretch.conf | 3 +++
meta-isar/conf/distro/debian-wheezy.conf | 2 ++
meta-isar/conf/distro/raspbian-jessie.conf | 1 +
meta-isar/conf/multiconfig/qemuamd64-jessie.conf | 2 +-
meta-isar/conf/multiconfig/qemuamd64-stretch.conf | 7 +++----
meta-isar/conf/multiconfig/qemuarm-jessie.conf | 2 +-
meta-isar/conf/multiconfig/qemuarm-stretch.conf | 7 +++----
meta-isar/conf/multiconfig/qemuarm-wheezy.conf | 2 +-
meta-isar/conf/multiconfig/qemui386-jessie.conf | 2 +-
meta-isar/conf/multiconfig/qemui386-stretch.conf | 7 +++----
meta-isar/conf/multiconfig/rpi-jessie.conf | 3 ++-
meta-isar/recipes-core/images/isar-image-base.bb | 2 ++
meta/recipes-kernel/linux/linux-distro.bb | 13 +++++++++++++
14 files changed, 40 insertions(+), 17 deletions(-)
create mode 100644 meta/recipes-kernel/linux/linux-distro.bb
diff --git a/meta-isar/conf/distro/debian-jessie.conf b/meta-isar/conf/distro/debian-jessie.conf
index d4bc4b1..3e62b14 100644
--- a/meta-isar/conf/distro/debian-jessie.conf
+++ b/meta-isar/conf/distro/debian-jessie.conf
@@ -10,3 +10,7 @@ DISTRO_APT_SOURCE_SEC ?= "http://security.debian.org/debian-security"
DISTRO_CONFIG_SCRIPT ?= "debian-configscript.sh"
DISTRO_MULTICONF_BOOTSTRAP ?= "base updates security"
DISTRO_MULTICONF_APTSOURCES ?= "${DISTRO_MULTICONF_BOOTSTRAP}"
+DISTRO_KERNELS ?= "486 4kc-malta 586 5kc-malta 686-pae amd64 arm64 armmp \
+ armmp-lpae ixp4xx kirkwood loongson-2e loongson-2f loongson-3 octeon \
+ orion5x powerpc powerpc-smp powerpc64 powerpc64le r4k-ip22 r5k-ip32 \
+ s390x sb1-bcm91250a versatile"
diff --git a/meta-isar/conf/distro/debian-stretch.conf b/meta-isar/conf/distro/debian-stretch.conf
index 74177fd..5a85d52 100644
--- a/meta-isar/conf/distro/debian-stretch.conf
+++ b/meta-isar/conf/distro/debian-stretch.conf
@@ -8,3 +8,6 @@ DISTRO_APT_SOURCE_SEC ?= "http://security.debian.org/debian-security"
DISTRO_CONFIG_SCRIPT ?= "debian-configscript.sh"
DISTRO_MULTICONF_BOOTSTRAP ?= "base updates security"
DISTRO_MULTICONF_APTSOURCES ?= "${DISTRO_MULTICONF_BOOTSTRAP}"
+DISTRO_KERNELS ?= "4kc-malta 586 5kc-malta 686 686-pae amd64 arm64 armmp \
+ armmp-lpae kirkwood loongson-3 marvell octeon orion5x powerpc64le \
+ rt-686-pae rt-amd64 s390x"
diff --git a/meta-isar/conf/distro/debian-wheezy.conf b/meta-isar/conf/distro/debian-wheezy.conf
index 017316e..f5ab6eb 100644
--- a/meta-isar/conf/distro/debian-wheezy.conf
+++ b/meta-isar/conf/distro/debian-wheezy.conf
@@ -10,3 +10,5 @@ DISTRO_APT_SOURCE_SEC ?= "http://security.debian.org/debian-security"
DISTRO_CONFIG_SCRIPT ?= "debian-configscript.sh"
DISTRO_MULTICONF_BOOTSTRAP ?= "base updates security"
DISTRO_MULTICONF_APTSOURCES ?= "${DISTRO_MULTICONF_BOOTSTRAP}"
+DISTRO_KERNELS ?= "486 686-pae amd64 rt-686-pae rt-amd64 versatile vexpress \
+ iop32x ixp4xx kirkwood mv78xx0 mx5 omap orion5x"
diff --git a/meta-isar/conf/distro/raspbian-jessie.conf b/meta-isar/conf/distro/raspbian-jessie.conf
index bd3c280..c2a867d 100644
--- a/meta-isar/conf/distro/raspbian-jessie.conf
+++ b/meta-isar/conf/distro/raspbian-jessie.conf
@@ -10,3 +10,4 @@ DISTRO_APT_SOURCE_SEC ?= ""
DISTRO_CONFIG_SCRIPT ?= "raspbian-configscript.sh"
DISTRO_MULTICONF_BOOTSTRAP ?= "base"
DISTRO_MULTICONF_APTSOURCES ?= "${DISTRO_MULTICONF_BOOTSTRAP}"
+DISTRO_KERNELS ?= "rpi rpi2 rpi-rpfv rpi2-rpfv"
diff --git a/meta-isar/conf/multiconfig/qemuamd64-jessie.conf b/meta-isar/conf/multiconfig/qemuamd64-jessie.conf
index 51d39b6..b422008 100644
--- a/meta-isar/conf/multiconfig/qemuamd64-jessie.conf
+++ b/meta-isar/conf/multiconfig/qemuamd64-jessie.conf
@@ -6,7 +6,7 @@ MACHINE ?= "qemuamd64"
DISTRO ?= "debian-jessie"
DISTRO_ARCH ?= "amd64"
-IMAGE_PREINSTALL += "linux-image-amd64"
+KERNEL_NAME ?= "amd64"
ROOTFS_DEV ?= "sda"
diff --git a/meta-isar/conf/multiconfig/qemuamd64-stretch.conf b/meta-isar/conf/multiconfig/qemuamd64-stretch.conf
index c59876a..64a62a1 100644
--- a/meta-isar/conf/multiconfig/qemuamd64-stretch.conf
+++ b/meta-isar/conf/multiconfig/qemuamd64-stretch.conf
@@ -6,10 +6,9 @@ MACHINE ?= "qemuamd64"
DISTRO ?= "debian-stretch"
DISTRO_ARCH ?= "amd64"
-IMAGE_PREINSTALL += " \
- init \
- linux-image-amd64 \
-"
+KERNEL_NAME ?= "amd64"
+
+IMAGE_PREINSTALL += "init"
ROOTFS_DEV ?= "sda"
diff --git a/meta-isar/conf/multiconfig/qemuarm-jessie.conf b/meta-isar/conf/multiconfig/qemuarm-jessie.conf
index ed84c6c..74fb7d9 100644
--- a/meta-isar/conf/multiconfig/qemuarm-jessie.conf
+++ b/meta-isar/conf/multiconfig/qemuarm-jessie.conf
@@ -13,7 +13,7 @@ MACHINE ?= "qemuarm"
DISTRO ?= "debian-jessie"
DISTRO_ARCH ?= "armhf"
-IMAGE_PREINSTALL += "linux-image-armmp"
+KERNEL_NAME ?= "armmp"
ROOTFS_DEV ?= "vda"
diff --git a/meta-isar/conf/multiconfig/qemuarm-stretch.conf b/meta-isar/conf/multiconfig/qemuarm-stretch.conf
index 1cce97a..00cdaa0 100644
--- a/meta-isar/conf/multiconfig/qemuarm-stretch.conf
+++ b/meta-isar/conf/multiconfig/qemuarm-stretch.conf
@@ -6,10 +6,9 @@ MACHINE ?= "qemuarm"
DISTRO ?= "debian-stretch"
DISTRO_ARCH ?= "armhf"
-IMAGE_PREINSTALL += " \
- init \
- linux-image-armmp \
-"
+KERNEL_NAME ?= "armmp"
+
+IMAGE_PREINSTALL += "init"
ROOTFS_DEV ?= "vda"
diff --git a/meta-isar/conf/multiconfig/qemuarm-wheezy.conf b/meta-isar/conf/multiconfig/qemuarm-wheezy.conf
index 38ea191..11355a4 100644
--- a/meta-isar/conf/multiconfig/qemuarm-wheezy.conf
+++ b/meta-isar/conf/multiconfig/qemuarm-wheezy.conf
@@ -13,7 +13,7 @@ MACHINE ?= "qemuarm"
DISTRO ?= "debian-wheezy"
DISTRO_ARCH ?= "armhf"
-IMAGE_PREINSTALL += "linux-image-vexpress"
+KERNEL_NAME ?= "vexpress"
ROOTFS_DEV ?= "mmcblk0"
diff --git a/meta-isar/conf/multiconfig/qemui386-jessie.conf b/meta-isar/conf/multiconfig/qemui386-jessie.conf
index d589661..e8c81fb 100644
--- a/meta-isar/conf/multiconfig/qemui386-jessie.conf
+++ b/meta-isar/conf/multiconfig/qemui386-jessie.conf
@@ -6,7 +6,7 @@ MACHINE ?= "qemui386"
DISTRO ?= "debian-jessie"
DISTRO_ARCH ?= "i386"
-IMAGE_PREINSTALL += "linux-image-686-pae"
+KERNEL_NAME ?= "686-pae"
ROOTFS_DEV ?= "sda"
diff --git a/meta-isar/conf/multiconfig/qemui386-stretch.conf b/meta-isar/conf/multiconfig/qemui386-stretch.conf
index 40239e4..0ba7c5b 100644
--- a/meta-isar/conf/multiconfig/qemui386-stretch.conf
+++ b/meta-isar/conf/multiconfig/qemui386-stretch.conf
@@ -6,10 +6,9 @@ MACHINE ?= "qemui386"
DISTRO ?= "debian-stretch"
DISTRO_ARCH ?= "i386"
-IMAGE_PREINSTALL += " \
- init \
- linux-image-686-pae \
-"
+KERNEL_NAME ?= "686-pae"
+
+IMAGE_PREINSTALL += "init"
ROOTFS_DEV ?= "sda"
diff --git a/meta-isar/conf/multiconfig/rpi-jessie.conf b/meta-isar/conf/multiconfig/rpi-jessie.conf
index d1dd9d9..3f33731 100644
--- a/meta-isar/conf/multiconfig/rpi-jessie.conf
+++ b/meta-isar/conf/multiconfig/rpi-jessie.conf
@@ -13,13 +13,14 @@ MACHINE ?= "rpi"
DISTRO ?= "raspbian-jessie"
DISTRO_ARCH ?= "armhf"
+KERNEL_NAME ?= "rpi-rpfv"
+
IMAGE_PREINSTALL += " \
bind9-host \
dnsutils \
iproute2 \
iputils-ping \
isc-dhcp-client \
- linux-image-rpi-rpfv \
lrzsz \
net-tools \
netcat-openbsd \
diff --git a/meta-isar/recipes-core/images/isar-image-base.bb b/meta-isar/recipes-core/images/isar-image-base.bb
index 8678b51..b444258 100644
--- a/meta-isar/recipes-core/images/isar-image-base.bb
+++ b/meta-isar/recipes-core/images/isar-image-base.bb
@@ -18,6 +18,8 @@ PV = "1.0"
inherit image
+IMAGE_INSTALL += "linux-image-${KERNEL_NAME}"
+
DEPENDS += "${IMAGE_INSTALL}"
IMAGE_PREINSTALL += "apt \
diff --git a/meta/recipes-kernel/linux/linux-distro.bb b/meta/recipes-kernel/linux/linux-distro.bb
new file mode 100644
index 0000000..2a248f8
--- /dev/null
+++ b/meta/recipes-kernel/linux/linux-distro.bb
@@ -0,0 +1,13 @@
+# Distro kernel dummy package
+#
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2018
+#
+# SPDX-License-Identifier: MIT
+
+python() {
+ distro_kernels = d.getVar('DISTRO_KERNELS', True) or ""
+ for kernel in distro_kernels.split():
+ d.appendVar('PROVIDES', ' linux-image-' + kernel)
+ d.appendVar('PROVIDES', ' linux-headers-' + kernel)
+}
--
2.13.6
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v5 2/5] Provide include for easy custom kernel builds
2018-02-14 9:13 [PATCH v5 0/5] Provide infrastructure and examples for custom kernels and modules Jan Kiszka
2018-02-14 9:13 ` [PATCH v5 1/5] Make distro kernel replaceable Jan Kiszka
@ 2018-02-14 9:13 ` Jan Kiszka
2018-02-14 19:35 ` [PATCH v6 " Jan Kiszka
2018-02-14 9:13 ` [PATCH v5 3/5] Add custom kernel examples Jan Kiszka
` (4 subsequent siblings)
6 siblings, 1 reply; 20+ messages in thread
From: Jan Kiszka @ 2018-02-14 9:13 UTC (permalink / raw)
To: isar-users
From: Jan Kiszka <jan.kiszka@siemens.com>
With this include, it becomes almost trivial to replace the distro
kernel with a custom build. You just need to include linux-custom.inc,
specify the source URI, define via S where the source is unpacked to and
provide a defconfig.
To switch to a custom kernel recipe, KERNEL_NAME has to be adjusted in
local.conf or the machine configuration.
Unless explicitly stated via KERNEL_FLAVOR, this tag is derived from
the including recipe name which then needs to follow the scheme
"linux-<flavor>[_version].bb".
The different kernel defconfig file name can be specified via the
KERNEL_DEFCONFIG variable so that also machine-specific defconfigs can
be set in the same recipe (KERNEL_DEFCONFIG_my-machine = "...").
The approach works internally by first running "make deb-pkg" on the
kernel and the repackages the output to make the binary linux-image and
linux-header debs act as proper replacement of a distro kernel. This
results in a suboptimal technical implementation which may eventually be
replaced by an isar-implemented deb-pkg build process. However, this is
not expected to affect the user-visible interface of this class.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
meta/recipes-kernel/linux/files/build-kernel.sh | 75 +++++++++++++++++++++++++
meta/recipes-kernel/linux/linux-custom.inc | 47 ++++++++++++++++
2 files changed, 122 insertions(+)
create mode 100644 meta/recipes-kernel/linux/files/build-kernel.sh
create mode 100644 meta/recipes-kernel/linux/linux-custom.inc
diff --git a/meta/recipes-kernel/linux/files/build-kernel.sh b/meta/recipes-kernel/linux/files/build-kernel.sh
new file mode 100644
index 0000000..e64ab7b
--- /dev/null
+++ b/meta/recipes-kernel/linux/files/build-kernel.sh
@@ -0,0 +1,75 @@
+#!/bin/sh
+set -e
+
+REPACK_DIR="$1/../repack"
+REPACK_LINUX_IMAGE_DIR="${REPACK_DIR}/linux-image"
+REPACK_LINUX_HEADERS_DIR="${REPACK_DIR}/linux-headers"
+
+apt-get install -y -o Debug::pkgProblemResolver=yes --no-install-recommends \
+ ${KBUILD_DEPENDS}
+
+cd $1
+make olddefconfig
+
+rm -f .version
+make -j $(($(nproc) * 2)) deb-pkg
+
+rm -rf ${REPACK_DIR}
+mkdir -p ${REPACK_DIR}
+mkdir -p ${REPACK_LINUX_IMAGE_DIR}
+mkdir -p ${REPACK_LINUX_HEADERS_DIR}
+
+cd ..
+tar xzf linux-${PV}_${PV}-1.debian.tar.gz -C ${REPACK_DIR}
+dpkg-deb -R linux-image-${PV}_${PV}-1_*.deb ${REPACK_LINUX_IMAGE_DIR}
+dpkg-deb -R linux-headers-${PV}_${PV}-1_*.deb ${REPACK_LINUX_HEADERS_DIR}
+
+dpkg-gencontrol -crepack/debian/control \
+ -lrepack/debian/changelog \
+ -frepack/debian/files \
+ -plinux-image-${PV} \
+ -P${REPACK_LINUX_IMAGE_DIR} \
+ -DPackage="linux-image-${KERNEL_NAME}" \
+ -DSection=kernel \
+ -DPriority=required \
+ -DDepends="${KERNEL_DEBIAN_DEPENDS}"
+
+# Add Debian-like link installation to postinst
+touch ${REPACK_LINUX_IMAGE_DIR}/lib/modules/${PV}/.fresh-install
+sed -i ${REPACK_LINUX_IMAGE_DIR}/DEBIAN/postinst \
+ -e "/^set -e$/a\\
+\\
+if [ -f /lib/modules/${PV}/.fresh-install ]; then\\
+ change=install\\
+else\\
+ change=upgrade\\
+fi\\
+linux-update-symlinks \$change ${PV} /boot/vmlinuz-${PV}\\
+rm -f /lib/modules/${PV}/.fresh-install"
+
+# Add Debian-like link removal to postrm
+sed -i ${REPACK_LINUX_IMAGE_DIR}/DEBIAN/postrm \
+ -e "/^set -e$/a\\
+\\
+rm -f /lib/modules/${PV}/.fresh-install\\
+\\
+if [ \"\$1\" != upgrade ] && command -v linux-update-symlinks >/dev/null; then\\
+ linux-update-symlinks remove ${PV} /boot/vmlinuz-${PV}\\
+fi"
+
+dpkg-gencontrol -crepack/debian/control \
+ -lrepack/debian/changelog \
+ -frepack/debian/files \
+ -plinux-headers-${PV} \
+ -P${REPACK_LINUX_HEADERS_DIR} \
+ -Vkernel:debarch="${KERNEL_NAME}" \
+ -DPackage="linux-headers-${KERNEL_NAME}" \
+ -DSection=kernel \
+ -DDepends="${KERNEL_HEADERS_DEBIAN_DEPENDS}"
+
+dpkg-deb -b ${REPACK_LINUX_IMAGE_DIR} \
+ linux-image-${KERNEL_NAME}_${PV}-1_${KERNEL_NAME}.deb
+rm -f linux-image-${PV}_${PV}-1_*.deb
+dpkg-deb -b ${REPACK_LINUX_HEADERS_DIR} \
+ linux-headers-${KERNEL_NAME}_${PV}-1_${KERNEL_NAME}.deb
+rm -f linux-headers-${PV}_${PV}-1_*.deb
diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
new file mode 100644
index 0000000..0498dfa
--- /dev/null
+++ b/meta/recipes-kernel/linux/linux-custom.inc
@@ -0,0 +1,47 @@
+# Custom kernel build
+#
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2018
+#
+# SPDX-License-Identifier: MIT
+
+FILESPATH =. "${LAYERDIR_core}/recipes-kernel/linux/files:"
+
+DESCRIPTION ?= "Custom kernel"
+
+KERNEL_FLAVOR ?= "${@ d.getVar('PN', True).partition('linux-')[2]}"
+KERNEL_DEFCONFIG ?= "defconfig"
+
+python() {
+ kernel = d.getVar("KERNEL_NAME", True)
+ flavor = d.getVar("KERNEL_FLAVOR", True)
+ if kernel and flavor and kernel.startswith(flavor + "-"):
+ d.setVar('PROVIDES', 'linux-image-' + kernel + ' ' + \
+ 'linux-headers-' + kernel)
+}
+
+inherit dpkg-base
+
+SRC_URI += "file://build-kernel.sh"
+
+KBUILD_DEPENDS ?= "libssl-dev libelf-dev bc"
+KERNEL_DEBIAN_DEPENDS ?= "initramfs-tools | linux-initramfs-tool, kmod, linux-base (>= 4.3~)"
+KERNEL_HEADERS_DEBIAN_DEPENDS ?= "libc6, libssl1.1, gcc"
+
+dpkg_runbuild() {
+ # Install package builder script
+ sudo install -m 755 ${WORKDIR}/build-kernel.sh ${BUILDCHROOT_DIR}
+
+ sudo cp ${WORKDIR}/${KERNEL_DEFCONFIG} ${WORKDIR}/${S}/.config
+
+ E="${@ bb.utils.export_proxies(d)}"
+
+ export PV=${PV}
+ export KERNEL_NAME=${KERNEL_NAME}
+
+ export KBUILD_DEPENDS="${KBUILD_DEPENDS}"
+ export KERNEL_DEBIAN_DEPENDS="${KERNEL_DEBIAN_DEPENDS}"
+ export KERNEL_HEADERS_DEBIAN_DEPENDS="${KERNEL_HEADERS_DEBIAN_DEPENDS}"
+
+ sudo -E chroot ${BUILDCHROOT_DIR} /build-kernel.sh ${PP}/${S}
+}
--
2.13.6
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v6 2/5] Provide include for easy custom kernel builds
2018-02-14 9:13 ` [PATCH v5 2/5] Provide include for easy custom kernel builds Jan Kiszka
@ 2018-02-14 19:35 ` Jan Kiszka
0 siblings, 0 replies; 20+ messages in thread
From: Jan Kiszka @ 2018-02-14 19:35 UTC (permalink / raw)
To: isar-users
From: Jan Kiszka <jan.kiszka@siemens.com>
With this include, it becomes almost trivial to replace the distro
kernel with a custom build. You just need to include linux-custom.inc,
specify the source URI, define via S where the source is unpacked to and
provide a defconfig.
To switch to a custom kernel recipe, KERNEL_NAME has to be adjusted in
local.conf or the machine configuration.
Unless explicitly stated via KERNEL_FLAVOR, this tag is derived from
the including recipe name which then needs to follow the scheme
"linux-<flavor>[_version].bb".
The different kernel defconfig file name can be specified via the
KERNEL_DEFCONFIG variable so that also machine-specific defconfigs can
be set in the same recipe (KERNEL_DEFCONFIG_my-machine = "...").
The approach works internally by first running "make deb-pkg" on the
kernel and the repackages the output to make the binary linux-image and
linux-header debs act as proper replacement of a distro kernel. This
results in a suboptimal technical implementation which may eventually be
replaced by an isar-implemented deb-pkg build process. However, this is
not expected to affect the user-visible interface of this class.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
Changes in v6:
- added copyright header to kernel-build.sh
meta/recipes-kernel/linux/files/build-kernel.sh | 83 +++++++++++++++++++++++++
meta/recipes-kernel/linux/linux-custom.inc | 47 ++++++++++++++
2 files changed, 130 insertions(+)
create mode 100644 meta/recipes-kernel/linux/files/build-kernel.sh
create mode 100644 meta/recipes-kernel/linux/linux-custom.inc
diff --git a/meta/recipes-kernel/linux/files/build-kernel.sh b/meta/recipes-kernel/linux/files/build-kernel.sh
new file mode 100644
index 0000000..5a454ae
--- /dev/null
+++ b/meta/recipes-kernel/linux/files/build-kernel.sh
@@ -0,0 +1,83 @@
+#!/bin/sh
+
+# Custom kernel build
+#
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2018
+#
+# SPDX-License-Identifier: MIT
+
+set -e
+
+REPACK_DIR="$1/../repack"
+REPACK_LINUX_IMAGE_DIR="${REPACK_DIR}/linux-image"
+REPACK_LINUX_HEADERS_DIR="${REPACK_DIR}/linux-headers"
+
+apt-get install -y -o Debug::pkgProblemResolver=yes --no-install-recommends \
+ ${KBUILD_DEPENDS}
+
+cd $1
+make olddefconfig
+
+rm -f .version
+make -j $(($(nproc) * 2)) deb-pkg
+
+rm -rf ${REPACK_DIR}
+mkdir -p ${REPACK_DIR}
+mkdir -p ${REPACK_LINUX_IMAGE_DIR}
+mkdir -p ${REPACK_LINUX_HEADERS_DIR}
+
+cd ..
+tar xzf linux-${PV}_${PV}-1.debian.tar.gz -C ${REPACK_DIR}
+dpkg-deb -R linux-image-${PV}_${PV}-1_*.deb ${REPACK_LINUX_IMAGE_DIR}
+dpkg-deb -R linux-headers-${PV}_${PV}-1_*.deb ${REPACK_LINUX_HEADERS_DIR}
+
+dpkg-gencontrol -crepack/debian/control \
+ -lrepack/debian/changelog \
+ -frepack/debian/files \
+ -plinux-image-${PV} \
+ -P${REPACK_LINUX_IMAGE_DIR} \
+ -DPackage="linux-image-${KERNEL_NAME}" \
+ -DSection=kernel \
+ -DPriority=required \
+ -DDepends="${KERNEL_DEBIAN_DEPENDS}"
+
+# Add Debian-like link installation to postinst
+touch ${REPACK_LINUX_IMAGE_DIR}/lib/modules/${PV}/.fresh-install
+sed -i ${REPACK_LINUX_IMAGE_DIR}/DEBIAN/postinst \
+ -e "/^set -e$/a\\
+\\
+if [ -f /lib/modules/${PV}/.fresh-install ]; then\\
+ change=install\\
+else\\
+ change=upgrade\\
+fi\\
+linux-update-symlinks \$change ${PV} /boot/vmlinuz-${PV}\\
+rm -f /lib/modules/${PV}/.fresh-install"
+
+# Add Debian-like link removal to postrm
+sed -i ${REPACK_LINUX_IMAGE_DIR}/DEBIAN/postrm \
+ -e "/^set -e$/a\\
+\\
+rm -f /lib/modules/${PV}/.fresh-install\\
+\\
+if [ \"\$1\" != upgrade ] && command -v linux-update-symlinks >/dev/null; then\\
+ linux-update-symlinks remove ${PV} /boot/vmlinuz-${PV}\\
+fi"
+
+dpkg-gencontrol -crepack/debian/control \
+ -lrepack/debian/changelog \
+ -frepack/debian/files \
+ -plinux-headers-${PV} \
+ -P${REPACK_LINUX_HEADERS_DIR} \
+ -Vkernel:debarch="${KERNEL_NAME}" \
+ -DPackage="linux-headers-${KERNEL_NAME}" \
+ -DSection=kernel \
+ -DDepends="${KERNEL_HEADERS_DEBIAN_DEPENDS}"
+
+dpkg-deb -b ${REPACK_LINUX_IMAGE_DIR} \
+ linux-image-${KERNEL_NAME}_${PV}-1_${KERNEL_NAME}.deb
+rm -f linux-image-${PV}_${PV}-1_*.deb
+dpkg-deb -b ${REPACK_LINUX_HEADERS_DIR} \
+ linux-headers-${KERNEL_NAME}_${PV}-1_${KERNEL_NAME}.deb
+rm -f linux-headers-${PV}_${PV}-1_*.deb
diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
new file mode 100644
index 0000000..0498dfa
--- /dev/null
+++ b/meta/recipes-kernel/linux/linux-custom.inc
@@ -0,0 +1,47 @@
+# Custom kernel build
+#
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2018
+#
+# SPDX-License-Identifier: MIT
+
+FILESPATH =. "${LAYERDIR_core}/recipes-kernel/linux/files:"
+
+DESCRIPTION ?= "Custom kernel"
+
+KERNEL_FLAVOR ?= "${@ d.getVar('PN', True).partition('linux-')[2]}"
+KERNEL_DEFCONFIG ?= "defconfig"
+
+python() {
+ kernel = d.getVar("KERNEL_NAME", True)
+ flavor = d.getVar("KERNEL_FLAVOR", True)
+ if kernel and flavor and kernel.startswith(flavor + "-"):
+ d.setVar('PROVIDES', 'linux-image-' + kernel + ' ' + \
+ 'linux-headers-' + kernel)
+}
+
+inherit dpkg-base
+
+SRC_URI += "file://build-kernel.sh"
+
+KBUILD_DEPENDS ?= "libssl-dev libelf-dev bc"
+KERNEL_DEBIAN_DEPENDS ?= "initramfs-tools | linux-initramfs-tool, kmod, linux-base (>= 4.3~)"
+KERNEL_HEADERS_DEBIAN_DEPENDS ?= "libc6, libssl1.1, gcc"
+
+dpkg_runbuild() {
+ # Install package builder script
+ sudo install -m 755 ${WORKDIR}/build-kernel.sh ${BUILDCHROOT_DIR}
+
+ sudo cp ${WORKDIR}/${KERNEL_DEFCONFIG} ${WORKDIR}/${S}/.config
+
+ E="${@ bb.utils.export_proxies(d)}"
+
+ export PV=${PV}
+ export KERNEL_NAME=${KERNEL_NAME}
+
+ export KBUILD_DEPENDS="${KBUILD_DEPENDS}"
+ export KERNEL_DEBIAN_DEPENDS="${KERNEL_DEBIAN_DEPENDS}"
+ export KERNEL_HEADERS_DEBIAN_DEPENDS="${KERNEL_HEADERS_DEBIAN_DEPENDS}"
+
+ sudo -E chroot ${BUILDCHROOT_DIR} /build-kernel.sh ${PP}/${S}
+}
--
2.13.6
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v5 3/5] Add custom kernel examples
2018-02-14 9:13 [PATCH v5 0/5] Provide infrastructure and examples for custom kernels and modules Jan Kiszka
2018-02-14 9:13 ` [PATCH v5 1/5] Make distro kernel replaceable Jan Kiszka
2018-02-14 9:13 ` [PATCH v5 2/5] Provide include for easy custom kernel builds Jan Kiszka
@ 2018-02-14 9:13 ` Jan Kiszka
2018-02-14 9:13 ` [PATCH v5 4/5] Provide include file for easy custom module builds Jan Kiszka
` (3 subsequent siblings)
6 siblings, 0 replies; 20+ messages in thread
From: Jan Kiszka @ 2018-02-14 9:13 UTC (permalink / raw)
To: isar-users
From: Jan Kiszka <jan.kiszka@siemens.com>
Provide two examples for describing custom kernel builds. Both are for
x86_64, simply using upstream x86_64_defconfig to define the required
defconfig. One example is demoing a build from a tarball, the other
pulling from git.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
.../recipes-kernel/linux/files/x86_64_defconfig | 310 +++++++++++++++++++++
meta-isar/recipes-kernel/linux/linux-cip_4.4.bb | 19 ++
.../recipes-kernel/linux/linux-mainline_4.14.18.bb | 17 ++
3 files changed, 346 insertions(+)
create mode 100644 meta-isar/recipes-kernel/linux/files/x86_64_defconfig
create mode 100644 meta-isar/recipes-kernel/linux/linux-cip_4.4.bb
create mode 100644 meta-isar/recipes-kernel/linux/linux-mainline_4.14.18.bb
diff --git a/meta-isar/recipes-kernel/linux/files/x86_64_defconfig b/meta-isar/recipes-kernel/linux/files/x86_64_defconfig
new file mode 100644
index 0000000..f3bafe0
--- /dev/null
+++ b/meta-isar/recipes-kernel/linux/files/x86_64_defconfig
@@ -0,0 +1,310 @@
+# Copy of linux/arch/x86/configs/x86_64_defconfig for demonstration purposes
+
+# CONFIG_LOCALVERSION_AUTO is not set
+CONFIG_SYSVIPC=y
+CONFIG_POSIX_MQUEUE=y
+CONFIG_BSD_PROCESS_ACCT=y
+CONFIG_TASKSTATS=y
+CONFIG_TASK_DELAY_ACCT=y
+CONFIG_TASK_XACCT=y
+CONFIG_TASK_IO_ACCOUNTING=y
+CONFIG_FHANDLE=y
+CONFIG_AUDIT=y
+CONFIG_NO_HZ=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_LOG_BUF_SHIFT=18
+CONFIG_CGROUPS=y
+CONFIG_CGROUP_FREEZER=y
+CONFIG_CPUSETS=y
+CONFIG_CGROUP_CPUACCT=y
+CONFIG_CGROUP_SCHED=y
+CONFIG_BLK_DEV_INITRD=y
+# CONFIG_COMPAT_BRK is not set
+CONFIG_PROFILING=y
+CONFIG_KPROBES=y
+CONFIG_JUMP_LABEL=y
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+CONFIG_MODULE_FORCE_UNLOAD=y
+CONFIG_PARTITION_ADVANCED=y
+CONFIG_OSF_PARTITION=y
+CONFIG_AMIGA_PARTITION=y
+CONFIG_MAC_PARTITION=y
+CONFIG_BSD_DISKLABEL=y
+CONFIG_MINIX_SUBPARTITION=y
+CONFIG_SOLARIS_X86_PARTITION=y
+CONFIG_UNIXWARE_DISKLABEL=y
+CONFIG_SGI_PARTITION=y
+CONFIG_SUN_PARTITION=y
+CONFIG_KARMA_PARTITION=y
+CONFIG_EFI_PARTITION=y
+CONFIG_SMP=y
+CONFIG_CALGARY_IOMMU=y
+CONFIG_NR_CPUS=64
+CONFIG_SCHED_SMT=y
+CONFIG_PREEMPT_VOLUNTARY=y
+CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS=y
+CONFIG_X86_MCE=y
+CONFIG_MICROCODE=y
+CONFIG_MICROCODE_AMD=y
+CONFIG_X86_MSR=y
+CONFIG_X86_CPUID=y
+CONFIG_NUMA=y
+CONFIG_X86_CHECK_BIOS_CORRUPTION=y
+# CONFIG_MTRR_SANITIZER is not set
+CONFIG_EFI=y
+CONFIG_HZ_1000=y
+CONFIG_KEXEC=y
+CONFIG_CRASH_DUMP=y
+CONFIG_RANDOMIZE_BASE=y
+CONFIG_RANDOMIZE_MEMORY=y
+# CONFIG_COMPAT_VDSO is not set
+CONFIG_HIBERNATION=y
+CONFIG_PM_DEBUG=y
+CONFIG_PM_TRACE_RTC=y
+CONFIG_ACPI_DOCK=y
+CONFIG_CPU_FREQ=y
+# CONFIG_CPU_FREQ_STAT is not set
+CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
+CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
+CONFIG_CPU_FREQ_GOV_ONDEMAND=y
+CONFIG_X86_ACPI_CPUFREQ=y
+CONFIG_PCI_MMCONFIG=y
+CONFIG_PCIEPORTBUS=y
+CONFIG_PCCARD=y
+CONFIG_YENTA=y
+CONFIG_HOTPLUG_PCI=y
+CONFIG_BINFMT_MISC=y
+CONFIG_IA32_EMULATION=y
+CONFIG_NET=y
+CONFIG_PACKET=y
+CONFIG_UNIX=y
+CONFIG_XFRM_USER=y
+CONFIG_INET=y
+CONFIG_IP_MULTICAST=y
+CONFIG_IP_ADVANCED_ROUTER=y
+CONFIG_IP_MULTIPLE_TABLES=y
+CONFIG_IP_ROUTE_MULTIPATH=y
+CONFIG_IP_ROUTE_VERBOSE=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+CONFIG_IP_PNP_BOOTP=y
+CONFIG_IP_PNP_RARP=y
+CONFIG_IP_MROUTE=y
+CONFIG_IP_PIMSM_V1=y
+CONFIG_IP_PIMSM_V2=y
+CONFIG_SYN_COOKIES=y
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+# CONFIG_INET_DIAG is not set
+CONFIG_TCP_CONG_ADVANCED=y
+# CONFIG_TCP_CONG_BIC is not set
+# CONFIG_TCP_CONG_WESTWOOD is not set
+# CONFIG_TCP_CONG_HTCP is not set
+CONFIG_TCP_MD5SIG=y
+CONFIG_IPV6=y
+CONFIG_INET6_AH=y
+CONFIG_INET6_ESP=y
+CONFIG_NETLABEL=y
+CONFIG_NETFILTER=y
+# CONFIG_NETFILTER_ADVANCED is not set
+CONFIG_NF_CONNTRACK=y
+CONFIG_NF_CONNTRACK_FTP=y
+CONFIG_NF_CONNTRACK_IRC=y
+CONFIG_NF_CONNTRACK_SIP=y
+CONFIG_NF_CT_NETLINK=y
+CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=y
+CONFIG_NETFILTER_XT_TARGET_NFLOG=y
+CONFIG_NETFILTER_XT_TARGET_SECMARK=y
+CONFIG_NETFILTER_XT_TARGET_TCPMSS=y
+CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
+CONFIG_NETFILTER_XT_MATCH_POLICY=y
+CONFIG_NETFILTER_XT_MATCH_STATE=y
+CONFIG_NF_CONNTRACK_IPV4=y
+CONFIG_IP_NF_IPTABLES=y
+CONFIG_IP_NF_FILTER=y
+CONFIG_IP_NF_TARGET_REJECT=y
+CONFIG_NF_NAT=y
+CONFIG_IP_NF_TARGET_MASQUERADE=y
+CONFIG_IP_NF_MANGLE=y
+CONFIG_NF_CONNTRACK_IPV6=y
+CONFIG_IP6_NF_IPTABLES=y
+CONFIG_IP6_NF_MATCH_IPV6HEADER=y
+CONFIG_IP6_NF_FILTER=y
+CONFIG_IP6_NF_TARGET_REJECT=y
+CONFIG_IP6_NF_MANGLE=y
+CONFIG_NET_SCHED=y
+CONFIG_NET_EMATCH=y
+CONFIG_NET_CLS_ACT=y
+CONFIG_HAMRADIO=y
+CONFIG_CFG80211=y
+CONFIG_MAC80211=y
+CONFIG_MAC80211_LEDS=y
+CONFIG_RFKILL=y
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+CONFIG_DEVTMPFS=y
+CONFIG_DEVTMPFS_MOUNT=y
+CONFIG_DEBUG_DEVRES=y
+CONFIG_CONNECTOR=y
+CONFIG_BLK_DEV_LOOP=y
+CONFIG_BLK_DEV_SD=y
+CONFIG_BLK_DEV_SR=y
+CONFIG_BLK_DEV_SR_VENDOR=y
+CONFIG_CHR_DEV_SG=y
+CONFIG_SCSI_CONSTANTS=y
+CONFIG_SCSI_SPI_ATTRS=y
+# CONFIG_SCSI_LOWLEVEL is not set
+CONFIG_ATA=y
+CONFIG_SATA_AHCI=y
+CONFIG_ATA_PIIX=y
+CONFIG_PATA_AMD=y
+CONFIG_PATA_OLDPIIX=y
+CONFIG_PATA_SCH=y
+CONFIG_MD=y
+CONFIG_BLK_DEV_MD=y
+CONFIG_BLK_DEV_DM=y
+CONFIG_DM_MIRROR=y
+CONFIG_DM_ZERO=y
+CONFIG_MACINTOSH_DRIVERS=y
+CONFIG_MAC_EMUMOUSEBTN=y
+CONFIG_NETDEVICES=y
+CONFIG_NETCONSOLE=y
+CONFIG_TIGON3=y
+CONFIG_NET_TULIP=y
+CONFIG_E100=y
+CONFIG_E1000=y
+CONFIG_E1000E=y
+CONFIG_SKY2=y
+CONFIG_FORCEDETH=y
+CONFIG_8139TOO=y
+CONFIG_R8169=y
+CONFIG_FDDI=y
+CONFIG_INPUT_POLLDEV=y
+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
+CONFIG_INPUT_EVDEV=y
+CONFIG_INPUT_JOYSTICK=y
+CONFIG_INPUT_TABLET=y
+CONFIG_INPUT_TOUCHSCREEN=y
+CONFIG_INPUT_MISC=y
+CONFIG_VT_HW_CONSOLE_BINDING=y
+# CONFIG_LEGACY_PTYS is not set
+CONFIG_SERIAL_NONSTANDARD=y
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_8250_NR_UARTS=32
+CONFIG_SERIAL_8250_EXTENDED=y
+CONFIG_SERIAL_8250_MANY_PORTS=y
+CONFIG_SERIAL_8250_SHARE_IRQ=y
+CONFIG_SERIAL_8250_DETECT_IRQ=y
+CONFIG_SERIAL_8250_RSA=y
+CONFIG_HW_RANDOM=y
+# CONFIG_HW_RANDOM_INTEL is not set
+# CONFIG_HW_RANDOM_AMD is not set
+CONFIG_NVRAM=y
+CONFIG_HPET=y
+# CONFIG_HPET_MMAP is not set
+CONFIG_I2C_I801=y
+CONFIG_WATCHDOG=y
+CONFIG_AGP=y
+CONFIG_AGP_AMD64=y
+CONFIG_AGP_INTEL=y
+CONFIG_DRM=y
+CONFIG_DRM_I915=y
+CONFIG_FB_MODE_HELPERS=y
+CONFIG_FB_TILEBLITTING=y
+CONFIG_FB_EFI=y
+# CONFIG_LCD_CLASS_DEVICE is not set
+CONFIG_VGACON_SOFT_SCROLLBACK=y
+CONFIG_LOGO=y
+# CONFIG_LOGO_LINUX_MONO is not set
+# CONFIG_LOGO_LINUX_VGA16 is not set
+CONFIG_SOUND=y
+CONFIG_SND=y
+CONFIG_SND_SEQUENCER=y
+CONFIG_SND_SEQ_DUMMY=y
+CONFIG_SND_MIXER_OSS=y
+CONFIG_SND_PCM_OSS=y
+CONFIG_SND_SEQUENCER_OSS=y
+CONFIG_SND_HRTIMER=y
+CONFIG_SND_HDA_INTEL=y
+CONFIG_SND_HDA_HWDEP=y
+CONFIG_HIDRAW=y
+CONFIG_HID_GYRATION=y
+CONFIG_LOGITECH_FF=y
+CONFIG_HID_NTRIG=y
+CONFIG_HID_PANTHERLORD=y
+CONFIG_PANTHERLORD_FF=y
+CONFIG_HID_PETALYNX=y
+CONFIG_HID_SAMSUNG=y
+CONFIG_HID_SONY=y
+CONFIG_HID_SUNPLUS=y
+CONFIG_HID_TOPSEED=y
+CONFIG_HID_PID=y
+CONFIG_USB_HIDDEV=y
+CONFIG_USB=y
+CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
+CONFIG_USB_MON=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_TT_NEWSCHED=y
+CONFIG_USB_OHCI_HCD=y
+CONFIG_USB_UHCI_HCD=y
+CONFIG_USB_PRINTER=y
+CONFIG_USB_STORAGE=y
+CONFIG_EDAC=y
+CONFIG_RTC_CLASS=y
+# CONFIG_RTC_HCTOSYS is not set
+CONFIG_DMADEVICES=y
+CONFIG_EEEPC_LAPTOP=y
+CONFIG_AMD_IOMMU=y
+CONFIG_INTEL_IOMMU=y
+# CONFIG_INTEL_IOMMU_DEFAULT_ON is not set
+CONFIG_EFI_VARS=y
+CONFIG_EXT4_FS=y
+CONFIG_EXT4_FS_POSIX_ACL=y
+CONFIG_EXT4_FS_SECURITY=y
+CONFIG_QUOTA=y
+CONFIG_QUOTA_NETLINK_INTERFACE=y
+# CONFIG_PRINT_QUOTA_WARNING is not set
+CONFIG_QFMT_V2=y
+CONFIG_AUTOFS4_FS=y
+CONFIG_ISO9660_FS=y
+CONFIG_JOLIET=y
+CONFIG_ZISOFS=y
+CONFIG_MSDOS_FS=y
+CONFIG_VFAT_FS=y
+CONFIG_PROC_KCORE=y
+CONFIG_TMPFS_POSIX_ACL=y
+CONFIG_HUGETLBFS=y
+CONFIG_NFS_FS=y
+CONFIG_NFS_V3_ACL=y
+CONFIG_NFS_V4=y
+CONFIG_ROOT_NFS=y
+CONFIG_NLS_DEFAULT="utf8"
+CONFIG_NLS_CODEPAGE_437=y
+CONFIG_NLS_ASCII=y
+CONFIG_NLS_ISO8859_1=y
+CONFIG_NLS_UTF8=y
+CONFIG_PRINTK_TIME=y
+# CONFIG_ENABLE_WARN_DEPRECATED is not set
+CONFIG_MAGIC_SYSRQ=y
+# CONFIG_UNUSED_SYMBOLS is not set
+CONFIG_DEBUG_KERNEL=y
+# CONFIG_SCHED_DEBUG is not set
+CONFIG_SCHEDSTATS=y
+CONFIG_TIMER_STATS=y
+CONFIG_DEBUG_STACK_USAGE=y
+CONFIG_BLK_DEV_IO_TRACE=y
+CONFIG_PROVIDE_OHCI1394_DMA_INIT=y
+CONFIG_EARLY_PRINTK_DBGP=y
+CONFIG_DEBUG_STACKOVERFLOW=y
+# CONFIG_DEBUG_RODATA_TEST is not set
+CONFIG_DEBUG_BOOT_PARAMS=y
+CONFIG_OPTIMIZE_INLINING=y
+CONFIG_UNWINDER_ORC=y
+CONFIG_SECURITY=y
+CONFIG_SECURITY_NETWORK=y
+CONFIG_SECURITY_SELINUX=y
+CONFIG_SECURITY_SELINUX_BOOTPARAM=y
+CONFIG_SECURITY_SELINUX_DISABLE=y
+# CONFIG_CRYPTO_ANSI_CPRNG is not set
diff --git a/meta-isar/recipes-kernel/linux/linux-cip_4.4.bb b/meta-isar/recipes-kernel/linux/linux-cip_4.4.bb
new file mode 100644
index 0000000..7502f70
--- /dev/null
+++ b/meta-isar/recipes-kernel/linux/linux-cip_4.4.bb
@@ -0,0 +1,19 @@
+# Example recipe for building the CIP 4.4 kernel
+#
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2018
+#
+# SPDX-License-Identifier: MIT
+
+require recipes-kernel/linux/linux-custom.inc
+
+SRC_URI += " \
+ git://git.kernel.org/pub/scm/linux/kernel/git/bwh/linux-cip.git;branch=linux-4.4.y-cip \
+ file://x86_64_defconfig"
+
+SRCREV = "4e52cc5f668c4666e31a8485725b5f4e897b3baf"
+PV = "4.4.112-cip18"
+
+S = "git"
+
+KERNEL_DEFCONFIG_qemuamd64 = "x86_64_defconfig"
diff --git a/meta-isar/recipes-kernel/linux/linux-mainline_4.14.18.bb b/meta-isar/recipes-kernel/linux/linux-mainline_4.14.18.bb
new file mode 100644
index 0000000..2c93d40
--- /dev/null
+++ b/meta-isar/recipes-kernel/linux/linux-mainline_4.14.18.bb
@@ -0,0 +1,17 @@
+# Example recipe for building the mainline kernel
+#
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2018
+#
+# SPDX-License-Identifier: MIT
+
+require recipes-kernel/linux/linux-custom.inc
+
+SRC_URI += " \
+ https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-${PV}.tar.xz \
+ file://x86_64_defconfig"
+SRC_URI[sha256sum] = "866a94c1c38d923ae18e74b683d7a8a79b674ebdfe7f40f1a3be9a27d39fe354"
+
+S = "linux-${PV}"
+
+KERNEL_DEFCONFIG_qemuamd64 = "x86_64_defconfig"
--
2.13.6
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v5 4/5] Provide include file for easy custom module builds
2018-02-14 9:13 [PATCH v5 0/5] Provide infrastructure and examples for custom kernels and modules Jan Kiszka
` (2 preceding siblings ...)
2018-02-14 9:13 ` [PATCH v5 3/5] Add custom kernel examples Jan Kiszka
@ 2018-02-14 9:13 ` Jan Kiszka
2018-02-14 9:13 ` [PATCH v5 5/5] Add exemplary kernel module Jan Kiszka
` (2 subsequent siblings)
6 siblings, 0 replies; 20+ messages in thread
From: Jan Kiszka @ 2018-02-14 9:13 UTC (permalink / raw)
To: isar-users
From: Jan Kiszka <jan.kiszka@siemens.com>
This provides an include for custom kernel modules. We choose an include
over a class as we carry a couple of files to debianize the module. The
user just needs to specify the module SRC_URI, and those sources must be
then reside in a separate directory which is - as usual - defined via S.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
.../linux-module/files/debian/changelog | 5 +++++
.../linux-module/files/debian/compat | 1 +
.../linux-module/files/debian/control | 11 ++++++++++
.../recipes-kernel/linux-module/files/debian/rules | 15 ++++++++++++++
meta/recipes-kernel/linux-module/module.inc | 24 ++++++++++++++++++++++
5 files changed, 56 insertions(+)
create mode 100644 meta/recipes-kernel/linux-module/files/debian/changelog
create mode 100644 meta/recipes-kernel/linux-module/files/debian/compat
create mode 100644 meta/recipes-kernel/linux-module/files/debian/control
create mode 100755 meta/recipes-kernel/linux-module/files/debian/rules
create mode 100644 meta/recipes-kernel/linux-module/module.inc
diff --git a/meta/recipes-kernel/linux-module/files/debian/changelog b/meta/recipes-kernel/linux-module/files/debian/changelog
new file mode 100644
index 0000000..c1c3516
--- /dev/null
+++ b/meta/recipes-kernel/linux-module/files/debian/changelog
@@ -0,0 +1,5 @@
+@PN@ (@PV@) unstable; urgency=low
+
+ * Generated package.
+
+ -- ISAR project <isar-users@googlegroups.com> Tue, 6 Feb 2018 00:00:00 +0000
diff --git a/meta/recipes-kernel/linux-module/files/debian/compat b/meta/recipes-kernel/linux-module/files/debian/compat
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/meta/recipes-kernel/linux-module/files/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/meta/recipes-kernel/linux-module/files/debian/control b/meta/recipes-kernel/linux-module/files/debian/control
new file mode 100644
index 0000000..707f857
--- /dev/null
+++ b/meta/recipes-kernel/linux-module/files/debian/control
@@ -0,0 +1,11 @@
+Source: @PN@
+Section: kernel
+Priority: optional
+Standards-Version: 3.9.6
+Build-Depends: linux-headers-@KERNEL_NAME@
+Maintainer: ISAR project <isar-users@googlegroups.com>
+
+Package: @PN@
+Architecture: any
+Depends: linux-image-@KERNEL_NAME@
+Description: @DESCRIPTION@
diff --git a/meta/recipes-kernel/linux-module/files/debian/rules b/meta/recipes-kernel/linux-module/files/debian/rules
new file mode 100755
index 0000000..4723cd8
--- /dev/null
+++ b/meta/recipes-kernel/linux-module/files/debian/rules
@@ -0,0 +1,15 @@
+#!/usr/bin/make -f
+
+# Debian rules for custom kernel module build
+#
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2018
+#
+# SPDX-License-Identifier: MIT
+
+export KDIR=$(shell ls -d /lib/modules/*/build)
+
+export DEB_BUILD_OPTIONS=parallel=$(shell nproc)
+
+%:
+ dh $@ --parallel
diff --git a/meta/recipes-kernel/linux-module/module.inc b/meta/recipes-kernel/linux-module/module.inc
new file mode 100644
index 0000000..aa232f7
--- /dev/null
+++ b/meta/recipes-kernel/linux-module/module.inc
@@ -0,0 +1,24 @@
+# Custom kernel module recipe include
+#
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2018
+#
+# SPDX-License-Identifier: MIT
+
+FILESPATH =. "${LAYERDIR_core}/recipes-kernel/linux-module/files:"
+
+DESCRIPTION ?= "Custom kernel module ${PN}"
+
+DEPENDS += "linux-headers-${KERNEL_NAME}"
+
+SRC_URI += "file://debian/"
+
+inherit dpkg
+
+dpkg_runbuild_prepend() {
+ cp -r ${WORKDIR}/debian ${WORKDIR}/${S}/
+ sed -i -e 's/@PN@/${PN}/g' -e 's/@PV@/${PV}/g' \
+ -e 's/@KERNEL_NAME@/${KERNEL_NAME}/g' \
+ -e 's/@DESCRIPTION@/${DESCRIPTION}/g' \
+ ${WORKDIR}/${S}/debian/changelog ${WORKDIR}/${S}/debian/control
+}
--
2.13.6
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v5 5/5] Add exemplary kernel module
2018-02-14 9:13 [PATCH v5 0/5] Provide infrastructure and examples for custom kernels and modules Jan Kiszka
` (3 preceding siblings ...)
2018-02-14 9:13 ` [PATCH v5 4/5] Provide include file for easy custom module builds Jan Kiszka
@ 2018-02-14 9:13 ` Jan Kiszka
2018-02-14 15:21 ` [PATCH v6 " Jan Kiszka
2018-02-15 11:24 ` [PATCH v5 0/5] Provide infrastructure and examples for custom kernels and modules Alexander Smirnov
2018-02-15 14:43 ` Alexander Smirnov
6 siblings, 1 reply; 20+ messages in thread
From: Jan Kiszka @ 2018-02-14 9:13 UTC (permalink / raw)
To: isar-users
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
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v6 5/5] Add exemplary kernel module
2018-02-14 9:13 ` [PATCH v5 5/5] Add exemplary kernel module Jan Kiszka
@ 2018-02-14 15:21 ` Jan Kiszka
2018-02-15 7:15 ` Alexander Smirnov
0 siblings, 1 reply; 20+ messages in thread
From: Jan Kiszka @ 2018-02-14 15:21 UTC (permalink / raw)
To: isar-users
From: Jan Kiszka <jan.kiszka@siemens.com>
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 <jan.kiszka@siemens.com>
---
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 <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
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v6 5/5] Add exemplary kernel module
2018-02-14 15:21 ` [PATCH v6 " Jan Kiszka
@ 2018-02-15 7:15 ` Alexander Smirnov
2018-02-15 7:35 ` [PATCH v6 4/5] Provide include file for easy custom module builds Jan Kiszka
0 siblings, 1 reply; 20+ messages in thread
From: Alexander Smirnov @ 2018-02-15 7:15 UTC (permalink / raw)
To: Jan Kiszka, isar-users
On 02/14/2018 06:21 PM, Jan Kiszka wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> 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.
>
Any plans to fix this?
Alex
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>
> 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 <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");
>
--
With best regards,
Alexander Smirnov
ilbers GmbH
Baierbrunner Str. 28c
D-81379 Munich
+49 (89) 122 67 24-0
http://ilbers.de/
Commercial register Munich, HRB 214197
General manager: Baurzhan Ismagulov
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v6 4/5] Provide include file for easy custom module builds
2018-02-15 7:15 ` Alexander Smirnov
@ 2018-02-15 7:35 ` Jan Kiszka
2018-02-15 7:54 ` Alexander Smirnov
0 siblings, 1 reply; 20+ messages in thread
From: Jan Kiszka @ 2018-02-15 7:35 UTC (permalink / raw)
To: Alexander Smirnov, isar-users
From: Jan Kiszka <jan.kiszka@siemens.com>
This provides an include for custom kernel modules. We choose an include
over a class as we carry a couple of files to debianize the module. The
user just needs to specify the module SRC_URI, and those sources must be
then reside in a separate directory which is - as usual - defined via S.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
Changes in v6:
- fix module build on wheezy-arm and (upcoming) stretch-arm64
This allows to keep v5 of patch 5. Sorry for the mess, but I initially
thought it was an issue with old wheezy on special ARM hardware only.
But when it also popped up on stretch-arm64, I finally analyzed it.
.../linux-module/files/debian/changelog | 5 +++++
.../linux-module/files/debian/compat | 1 +
.../linux-module/files/debian/control | 11 ++++++++++
.../recipes-kernel/linux-module/files/debian/rules | 15 ++++++++++++++
meta/recipes-kernel/linux-module/module.inc | 24 ++++++++++++++++++++++
5 files changed, 56 insertions(+)
create mode 100644 meta/recipes-kernel/linux-module/files/debian/changelog
create mode 100644 meta/recipes-kernel/linux-module/files/debian/compat
create mode 100644 meta/recipes-kernel/linux-module/files/debian/control
create mode 100755 meta/recipes-kernel/linux-module/files/debian/rules
create mode 100644 meta/recipes-kernel/linux-module/module.inc
diff --git a/meta/recipes-kernel/linux-module/files/debian/changelog b/meta/recipes-kernel/linux-module/files/debian/changelog
new file mode 100644
index 0000000..c1c3516
--- /dev/null
+++ b/meta/recipes-kernel/linux-module/files/debian/changelog
@@ -0,0 +1,5 @@
+@PN@ (@PV@) unstable; urgency=low
+
+ * Generated package.
+
+ -- ISAR project <isar-users@googlegroups.com> Tue, 6 Feb 2018 00:00:00 +0000
diff --git a/meta/recipes-kernel/linux-module/files/debian/compat b/meta/recipes-kernel/linux-module/files/debian/compat
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/meta/recipes-kernel/linux-module/files/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/meta/recipes-kernel/linux-module/files/debian/control b/meta/recipes-kernel/linux-module/files/debian/control
new file mode 100644
index 0000000..707f857
--- /dev/null
+++ b/meta/recipes-kernel/linux-module/files/debian/control
@@ -0,0 +1,11 @@
+Source: @PN@
+Section: kernel
+Priority: optional
+Standards-Version: 3.9.6
+Build-Depends: linux-headers-@KERNEL_NAME@
+Maintainer: ISAR project <isar-users@googlegroups.com>
+
+Package: @PN@
+Architecture: any
+Depends: linux-image-@KERNEL_NAME@
+Description: @DESCRIPTION@
diff --git a/meta/recipes-kernel/linux-module/files/debian/rules b/meta/recipes-kernel/linux-module/files/debian/rules
new file mode 100755
index 0000000..46cf977
--- /dev/null
+++ b/meta/recipes-kernel/linux-module/files/debian/rules
@@ -0,0 +1,15 @@
+#!/usr/bin/make -f
+
+# Debian rules for custom kernel module build
+#
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2018
+#
+# SPDX-License-Identifier: MIT
+
+export KDIR=$(shell ls -d /lib/modules/*/build)
+
+export DEB_BUILD_OPTIONS=parallel=$(shell nproc)
+
+%:
+ CFLAGS= LDFLAGS= dh $@ --parallel
diff --git a/meta/recipes-kernel/linux-module/module.inc b/meta/recipes-kernel/linux-module/module.inc
new file mode 100644
index 0000000..aa232f7
--- /dev/null
+++ b/meta/recipes-kernel/linux-module/module.inc
@@ -0,0 +1,24 @@
+# Custom kernel module recipe include
+#
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2018
+#
+# SPDX-License-Identifier: MIT
+
+FILESPATH =. "${LAYERDIR_core}/recipes-kernel/linux-module/files:"
+
+DESCRIPTION ?= "Custom kernel module ${PN}"
+
+DEPENDS += "linux-headers-${KERNEL_NAME}"
+
+SRC_URI += "file://debian/"
+
+inherit dpkg
+
+dpkg_runbuild_prepend() {
+ cp -r ${WORKDIR}/debian ${WORKDIR}/${S}/
+ sed -i -e 's/@PN@/${PN}/g' -e 's/@PV@/${PV}/g' \
+ -e 's/@KERNEL_NAME@/${KERNEL_NAME}/g' \
+ -e 's/@DESCRIPTION@/${DESCRIPTION}/g' \
+ ${WORKDIR}/${S}/debian/changelog ${WORKDIR}/${S}/debian/control
+}
--
2.13.6
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v6 4/5] Provide include file for easy custom module builds
2018-02-15 7:35 ` [PATCH v6 4/5] Provide include file for easy custom module builds Jan Kiszka
@ 2018-02-15 7:54 ` Alexander Smirnov
2018-02-15 7:54 ` Jan Kiszka
0 siblings, 1 reply; 20+ messages in thread
From: Alexander Smirnov @ 2018-02-15 7:54 UTC (permalink / raw)
To: Jan Kiszka, isar-users
On 02/15/2018 10:35 AM, Jan Kiszka wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> This provides an include for custom kernel modules. We choose an include
> over a class as we carry a couple of files to debianize the module. The
> user just needs to specify the module SRC_URI, and those sources must be
> then reside in a separate directory which is - as usual - defined via S.
>
Should I take then [v5 5/5]?
Alex
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>
> Changes in v6:
> - fix module build on wheezy-arm and (upcoming) stretch-arm64
>
> This allows to keep v5 of patch 5. Sorry for the mess, but I initially
> thought it was an issue with old wheezy on special ARM hardware only.
> But when it also popped up on stretch-arm64, I finally analyzed it.
>
> .../linux-module/files/debian/changelog | 5 +++++
> .../linux-module/files/debian/compat | 1 +
> .../linux-module/files/debian/control | 11 ++++++++++
> .../recipes-kernel/linux-module/files/debian/rules | 15 ++++++++++++++
> meta/recipes-kernel/linux-module/module.inc | 24 ++++++++++++++++++++++
> 5 files changed, 56 insertions(+)
> create mode 100644 meta/recipes-kernel/linux-module/files/debian/changelog
> create mode 100644 meta/recipes-kernel/linux-module/files/debian/compat
> create mode 100644 meta/recipes-kernel/linux-module/files/debian/control
> create mode 100755 meta/recipes-kernel/linux-module/files/debian/rules
> create mode 100644 meta/recipes-kernel/linux-module/module.inc
>
> diff --git a/meta/recipes-kernel/linux-module/files/debian/changelog b/meta/recipes-kernel/linux-module/files/debian/changelog
> new file mode 100644
> index 0000000..c1c3516
> --- /dev/null
> +++ b/meta/recipes-kernel/linux-module/files/debian/changelog
> @@ -0,0 +1,5 @@
> +@PN@ (@PV@) unstable; urgency=low
> +
> + * Generated package.
> +
> + -- ISAR project <isar-users@googlegroups.com> Tue, 6 Feb 2018 00:00:00 +0000
> diff --git a/meta/recipes-kernel/linux-module/files/debian/compat b/meta/recipes-kernel/linux-module/files/debian/compat
> new file mode 100644
> index 0000000..ec63514
> --- /dev/null
> +++ b/meta/recipes-kernel/linux-module/files/debian/compat
> @@ -0,0 +1 @@
> +9
> diff --git a/meta/recipes-kernel/linux-module/files/debian/control b/meta/recipes-kernel/linux-module/files/debian/control
> new file mode 100644
> index 0000000..707f857
> --- /dev/null
> +++ b/meta/recipes-kernel/linux-module/files/debian/control
> @@ -0,0 +1,11 @@
> +Source: @PN@
> +Section: kernel
> +Priority: optional
> +Standards-Version: 3.9.6
> +Build-Depends: linux-headers-@KERNEL_NAME@
> +Maintainer: ISAR project <isar-users@googlegroups.com>
> +
> +Package: @PN@
> +Architecture: any
> +Depends: linux-image-@KERNEL_NAME@
> +Description: @DESCRIPTION@
> diff --git a/meta/recipes-kernel/linux-module/files/debian/rules b/meta/recipes-kernel/linux-module/files/debian/rules
> new file mode 100755
> index 0000000..46cf977
> --- /dev/null
> +++ b/meta/recipes-kernel/linux-module/files/debian/rules
> @@ -0,0 +1,15 @@
> +#!/usr/bin/make -f
> +
> +# Debian rules for custom kernel module build
> +#
> +# This software is a part of ISAR.
> +# Copyright (c) Siemens AG, 2018
> +#
> +# SPDX-License-Identifier: MIT
> +
> +export KDIR=$(shell ls -d /lib/modules/*/build)
> +
> +export DEB_BUILD_OPTIONS=parallel=$(shell nproc)
> +
> +%:
> + CFLAGS= LDFLAGS= dh $@ --parallel
> diff --git a/meta/recipes-kernel/linux-module/module.inc b/meta/recipes-kernel/linux-module/module.inc
> new file mode 100644
> index 0000000..aa232f7
> --- /dev/null
> +++ b/meta/recipes-kernel/linux-module/module.inc
> @@ -0,0 +1,24 @@
> +# Custom kernel module recipe include
> +#
> +# This software is a part of ISAR.
> +# Copyright (c) Siemens AG, 2018
> +#
> +# SPDX-License-Identifier: MIT
> +
> +FILESPATH =. "${LAYERDIR_core}/recipes-kernel/linux-module/files:"
> +
> +DESCRIPTION ?= "Custom kernel module ${PN}"
> +
> +DEPENDS += "linux-headers-${KERNEL_NAME}"
> +
> +SRC_URI += "file://debian/"
> +
> +inherit dpkg
> +
> +dpkg_runbuild_prepend() {
> + cp -r ${WORKDIR}/debian ${WORKDIR}/${S}/
> + sed -i -e 's/@PN@/${PN}/g' -e 's/@PV@/${PV}/g' \
> + -e 's/@KERNEL_NAME@/${KERNEL_NAME}/g' \
> + -e 's/@DESCRIPTION@/${DESCRIPTION}/g' \
> + ${WORKDIR}/${S}/debian/changelog ${WORKDIR}/${S}/debian/control
> +}
>
--
With best regards,
Alexander Smirnov
ilbers GmbH
Baierbrunner Str. 28c
D-81379 Munich
+49 (89) 122 67 24-0
http://ilbers.de/
Commercial register Munich, HRB 214197
General manager: Baurzhan Ismagulov
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v6 4/5] Provide include file for easy custom module builds
2018-02-15 7:54 ` Alexander Smirnov
@ 2018-02-15 7:54 ` Jan Kiszka
2018-02-15 8:01 ` Alexander Smirnov
0 siblings, 1 reply; 20+ messages in thread
From: Jan Kiszka @ 2018-02-15 7:54 UTC (permalink / raw)
To: Alexander Smirnov, isar-users
On 2018-02-15 08:54, Alexander Smirnov wrote:
>
> On 02/15/2018 10:35 AM, Jan Kiszka wrote:
>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>
>> This provides an include for custom kernel modules. We choose an include
>> over a class as we carry a couple of files to debianize the module. The
>> user just needs to specify the module SRC_URI, and those sources must be
>> then reside in a separate directory which is - as usual - defined via S.
>>
>
> Should I take then [v5 5/5]?
Yes, that's what I meant below.
Jan
>
> Alex
>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>> ---
>>
>> Changes in v6:
>> - fix module build on wheezy-arm and (upcoming) stretch-arm64
>>
>> This allows to keep v5 of patch 5. Sorry for the mess, but I initially
>> thought it was an issue with old wheezy on special ARM hardware only.
>> But when it also popped up on stretch-arm64, I finally analyzed it.
>>
>> .../linux-module/files/debian/changelog | 5 +++++
>> .../linux-module/files/debian/compat | 1 +
>> .../linux-module/files/debian/control | 11 ++++++++++
>> .../recipes-kernel/linux-module/files/debian/rules | 15 ++++++++++++++
>> meta/recipes-kernel/linux-module/module.inc | 24
>> ++++++++++++++++++++++
>> 5 files changed, 56 insertions(+)
>> create mode 100644
>> meta/recipes-kernel/linux-module/files/debian/changelog
>> create mode 100644 meta/recipes-kernel/linux-module/files/debian/compat
>> create mode 100644
>> meta/recipes-kernel/linux-module/files/debian/control
>> create mode 100755 meta/recipes-kernel/linux-module/files/debian/rules
>> create mode 100644 meta/recipes-kernel/linux-module/module.inc
>>
>> diff --git a/meta/recipes-kernel/linux-module/files/debian/changelog
>> b/meta/recipes-kernel/linux-module/files/debian/changelog
>> new file mode 100644
>> index 0000000..c1c3516
>> --- /dev/null
>> +++ b/meta/recipes-kernel/linux-module/files/debian/changelog
>> @@ -0,0 +1,5 @@
>> +@PN@ (@PV@) unstable; urgency=low
>> +
>> + * Generated package.
>> +
>> + -- ISAR project <isar-users@googlegroups.com> Tue, 6 Feb 2018
>> 00:00:00 +0000
>> diff --git a/meta/recipes-kernel/linux-module/files/debian/compat
>> b/meta/recipes-kernel/linux-module/files/debian/compat
>> new file mode 100644
>> index 0000000..ec63514
>> --- /dev/null
>> +++ b/meta/recipes-kernel/linux-module/files/debian/compat
>> @@ -0,0 +1 @@
>> +9
>> diff --git a/meta/recipes-kernel/linux-module/files/debian/control
>> b/meta/recipes-kernel/linux-module/files/debian/control
>> new file mode 100644
>> index 0000000..707f857
>> --- /dev/null
>> +++ b/meta/recipes-kernel/linux-module/files/debian/control
>> @@ -0,0 +1,11 @@
>> +Source: @PN@
>> +Section: kernel
>> +Priority: optional
>> +Standards-Version: 3.9.6
>> +Build-Depends: linux-headers-@KERNEL_NAME@
>> +Maintainer: ISAR project <isar-users@googlegroups.com>
>> +
>> +Package: @PN@
>> +Architecture: any
>> +Depends: linux-image-@KERNEL_NAME@
>> +Description: @DESCRIPTION@
>> diff --git a/meta/recipes-kernel/linux-module/files/debian/rules
>> b/meta/recipes-kernel/linux-module/files/debian/rules
>> new file mode 100755
>> index 0000000..46cf977
>> --- /dev/null
>> +++ b/meta/recipes-kernel/linux-module/files/debian/rules
>> @@ -0,0 +1,15 @@
>> +#!/usr/bin/make -f
>> +
>> +# Debian rules for custom kernel module build
>> +#
>> +# This software is a part of ISAR.
>> +# Copyright (c) Siemens AG, 2018
>> +#
>> +# SPDX-License-Identifier: MIT
>> +
>> +export KDIR=$(shell ls -d /lib/modules/*/build)
>> +
>> +export DEB_BUILD_OPTIONS=parallel=$(shell nproc)
>> +
>> +%:
>> + CFLAGS= LDFLAGS= dh $@ --parallel
>> diff --git a/meta/recipes-kernel/linux-module/module.inc
>> b/meta/recipes-kernel/linux-module/module.inc
>> new file mode 100644
>> index 0000000..aa232f7
>> --- /dev/null
>> +++ b/meta/recipes-kernel/linux-module/module.inc
>> @@ -0,0 +1,24 @@
>> +# Custom kernel module recipe include
>> +#
>> +# This software is a part of ISAR.
>> +# Copyright (c) Siemens AG, 2018
>> +#
>> +# SPDX-License-Identifier: MIT
>> +
>> +FILESPATH =. "${LAYERDIR_core}/recipes-kernel/linux-module/files:"
>> +
>> +DESCRIPTION ?= "Custom kernel module ${PN}"
>> +
>> +DEPENDS += "linux-headers-${KERNEL_NAME}"
>> +
>> +SRC_URI += "file://debian/"
>> +
>> +inherit dpkg
>> +
>> +dpkg_runbuild_prepend() {
>> + cp -r ${WORKDIR}/debian ${WORKDIR}/${S}/
>> + sed -i -e 's/@PN@/${PN}/g' -e 's/@PV@/${PV}/g' \
>> + -e 's/@KERNEL_NAME@/${KERNEL_NAME}/g' \
>> + -e 's/@DESCRIPTION@/${DESCRIPTION}/g' \
>> + ${WORKDIR}/${S}/debian/changelog ${WORKDIR}/${S}/debian/control
>> +}
>>
>
--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v6 4/5] Provide include file for easy custom module builds
2018-02-15 7:54 ` Jan Kiszka
@ 2018-02-15 8:01 ` Alexander Smirnov
0 siblings, 0 replies; 20+ messages in thread
From: Alexander Smirnov @ 2018-02-15 8:01 UTC (permalink / raw)
To: Jan Kiszka, isar-users
On 02/15/2018 10:54 AM, Jan Kiszka wrote:
> On 2018-02-15 08:54, Alexander Smirnov wrote:
>>
>> On 02/15/2018 10:35 AM, Jan Kiszka wrote:
>>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>>
>>> This provides an include for custom kernel modules. We choose an include
>>> over a class as we carry a couple of files to debianize the module. The
>>> user just needs to specify the module SRC_URI, and those sources must be
>>> then reside in a separate directory which is - as usual - defined via S.
>>>
>>
>> Should I take then [v5 5/5]?
>
> Yes, that's what I meant below.
>
Damn, sorry, thanks :-)
Alex
> Jan
>
>>
>> Alex
>>
>>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>>> ---
>>>
>>> Changes in v6:
>>> - fix module build on wheezy-arm and (upcoming) stretch-arm64
>>>
>>> This allows to keep v5 of patch 5. Sorry for the mess, but I initially
>>> thought it was an issue with old wheezy on special ARM hardware only.
>>> But when it also popped up on stretch-arm64, I finally analyzed it.
>>>
>>> .../linux-module/files/debian/changelog | 5 +++++
>>> .../linux-module/files/debian/compat | 1 +
>>> .../linux-module/files/debian/control | 11 ++++++++++
>>> .../recipes-kernel/linux-module/files/debian/rules | 15 ++++++++++++++
>>> meta/recipes-kernel/linux-module/module.inc | 24
>>> ++++++++++++++++++++++
>>> 5 files changed, 56 insertions(+)
>>> create mode 100644
>>> meta/recipes-kernel/linux-module/files/debian/changelog
>>> create mode 100644 meta/recipes-kernel/linux-module/files/debian/compat
>>> create mode 100644
>>> meta/recipes-kernel/linux-module/files/debian/control
>>> create mode 100755 meta/recipes-kernel/linux-module/files/debian/rules
>>> create mode 100644 meta/recipes-kernel/linux-module/module.inc
>>>
>>> diff --git a/meta/recipes-kernel/linux-module/files/debian/changelog
>>> b/meta/recipes-kernel/linux-module/files/debian/changelog
>>> new file mode 100644
>>> index 0000000..c1c3516
>>> --- /dev/null
>>> +++ b/meta/recipes-kernel/linux-module/files/debian/changelog
>>> @@ -0,0 +1,5 @@
>>> +@PN@ (@PV@) unstable; urgency=low
>>> +
>>> + * Generated package.
>>> +
>>> + -- ISAR project <isar-users@googlegroups.com> Tue, 6 Feb 2018
>>> 00:00:00 +0000
>>> diff --git a/meta/recipes-kernel/linux-module/files/debian/compat
>>> b/meta/recipes-kernel/linux-module/files/debian/compat
>>> new file mode 100644
>>> index 0000000..ec63514
>>> --- /dev/null
>>> +++ b/meta/recipes-kernel/linux-module/files/debian/compat
>>> @@ -0,0 +1 @@
>>> +9
>>> diff --git a/meta/recipes-kernel/linux-module/files/debian/control
>>> b/meta/recipes-kernel/linux-module/files/debian/control
>>> new file mode 100644
>>> index 0000000..707f857
>>> --- /dev/null
>>> +++ b/meta/recipes-kernel/linux-module/files/debian/control
>>> @@ -0,0 +1,11 @@
>>> +Source: @PN@
>>> +Section: kernel
>>> +Priority: optional
>>> +Standards-Version: 3.9.6
>>> +Build-Depends: linux-headers-@KERNEL_NAME@
>>> +Maintainer: ISAR project <isar-users@googlegroups.com>
>>> +
>>> +Package: @PN@
>>> +Architecture: any
>>> +Depends: linux-image-@KERNEL_NAME@
>>> +Description: @DESCRIPTION@
>>> diff --git a/meta/recipes-kernel/linux-module/files/debian/rules
>>> b/meta/recipes-kernel/linux-module/files/debian/rules
>>> new file mode 100755
>>> index 0000000..46cf977
>>> --- /dev/null
>>> +++ b/meta/recipes-kernel/linux-module/files/debian/rules
>>> @@ -0,0 +1,15 @@
>>> +#!/usr/bin/make -f
>>> +
>>> +# Debian rules for custom kernel module build
>>> +#
>>> +# This software is a part of ISAR.
>>> +# Copyright (c) Siemens AG, 2018
>>> +#
>>> +# SPDX-License-Identifier: MIT
>>> +
>>> +export KDIR=$(shell ls -d /lib/modules/*/build)
>>> +
>>> +export DEB_BUILD_OPTIONS=parallel=$(shell nproc)
>>> +
>>> +%:
>>> + CFLAGS= LDFLAGS= dh $@ --parallel
>>> diff --git a/meta/recipes-kernel/linux-module/module.inc
>>> b/meta/recipes-kernel/linux-module/module.inc
>>> new file mode 100644
>>> index 0000000..aa232f7
>>> --- /dev/null
>>> +++ b/meta/recipes-kernel/linux-module/module.inc
>>> @@ -0,0 +1,24 @@
>>> +# Custom kernel module recipe include
>>> +#
>>> +# This software is a part of ISAR.
>>> +# Copyright (c) Siemens AG, 2018
>>> +#
>>> +# SPDX-License-Identifier: MIT
>>> +
>>> +FILESPATH =. "${LAYERDIR_core}/recipes-kernel/linux-module/files:"
>>> +
>>> +DESCRIPTION ?= "Custom kernel module ${PN}"
>>> +
>>> +DEPENDS += "linux-headers-${KERNEL_NAME}"
>>> +
>>> +SRC_URI += "file://debian/"
>>> +
>>> +inherit dpkg
>>> +
>>> +dpkg_runbuild_prepend() {
>>> + cp -r ${WORKDIR}/debian ${WORKDIR}/${S}/
>>> + sed -i -e 's/@PN@/${PN}/g' -e 's/@PV@/${PV}/g' \
>>> + -e 's/@KERNEL_NAME@/${KERNEL_NAME}/g' \
>>> + -e 's/@DESCRIPTION@/${DESCRIPTION}/g' \
>>> + ${WORKDIR}/${S}/debian/changelog ${WORKDIR}/${S}/debian/control
>>> +}
>>>
>>
>
>
--
With best regards,
Alexander Smirnov
ilbers GmbH
Baierbrunner Str. 28c
D-81379 Munich
+49 (89) 122 67 24-0
http://ilbers.de/
Commercial register Munich, HRB 214197
General manager: Baurzhan Ismagulov
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v5 0/5] Provide infrastructure and examples for custom kernels and modules
2018-02-14 9:13 [PATCH v5 0/5] Provide infrastructure and examples for custom kernels and modules Jan Kiszka
` (4 preceding siblings ...)
2018-02-14 9:13 ` [PATCH v5 5/5] Add exemplary kernel module Jan Kiszka
@ 2018-02-15 11:24 ` Alexander Smirnov
2018-02-15 15:14 ` Jan Kiszka
2018-02-15 14:43 ` Alexander Smirnov
6 siblings, 1 reply; 20+ messages in thread
From: Alexander Smirnov @ 2018-02-15 11:24 UTC (permalink / raw)
To: Jan Kiszka, isar-users
On 02/14/2018 12:13 PM, Jan Kiszka wrote:
> This is now finally the promised patches to provide simple patterns for
> building custom kernels for Isar images that replace the distro kernels.
> It also provids the same pattern for custom out-of-tree kernel modules.
>
> Changes in v5:
> - dropped merged patches
> - reworked kernel packages naming and selection mechanism to use
> flavor/arch rather them overwriting upstream names
> - fixed rebuilds of the kernel (.version was causing problems)
> - moved kernel build into script - and switched back to include pattern
> - provided note on origin of exemplary defconfig
> - add KERNEL_DEFCONFIG variable
>
Looks good to me, applied to next. Should I wait documentation for this
feature?
One small issue: you use @XYZ@ pattern for substitution, while ##XYZ##
is used in multistrap configs. I'm with unified style in Isar. I'd
prefer your variant, so just as TODO for somebody - replace remaining
##XYZ## patterns in Isar to @XYZ@.
Alex
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v5 0/5] Provide infrastructure and examples for custom kernels and modules
2018-02-15 11:24 ` [PATCH v5 0/5] Provide infrastructure and examples for custom kernels and modules Alexander Smirnov
@ 2018-02-15 15:14 ` Jan Kiszka
0 siblings, 0 replies; 20+ messages in thread
From: Jan Kiszka @ 2018-02-15 15:14 UTC (permalink / raw)
To: Alexander Smirnov, isar-users
On 2018-02-15 12:24, Alexander Smirnov wrote:
> On 02/14/2018 12:13 PM, Jan Kiszka wrote:
>> This is now finally the promised patches to provide simple patterns for
>> building custom kernels for Isar images that replace the distro kernels.
>> It also provids the same pattern for custom out-of-tree kernel modules.
>>
>> Changes in v5:
>> - dropped merged patches
>> - reworked kernel packages naming and selection mechanism to use
>> flavor/arch rather them overwriting upstream names
>> - fixed rebuilds of the kernel (.version was causing problems)
>> - moved kernel build into script - and switched back to include pattern
>> - provided note on origin of exemplary defconfig
>> - add KERNEL_DEFCONFIG variable
>>
>
> Looks good to me, applied to next. Should I wait documentation for this
> feature?
>
> One small issue: you use @XYZ@ pattern for substitution, while ##XYZ##
> is used in multistrap configs. I'm with unified style in Isar. I'd
> prefer your variant, so just as TODO for somebody - replace remaining
> ##XYZ## patterns in Isar to @XYZ@.
If the multistrap cases will go anyway, this consolidation would come
for free.
Jan
--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v5 0/5] Provide infrastructure and examples for custom kernels and modules
2018-02-14 9:13 [PATCH v5 0/5] Provide infrastructure and examples for custom kernels and modules Jan Kiszka
` (5 preceding siblings ...)
2018-02-15 11:24 ` [PATCH v5 0/5] Provide infrastructure and examples for custom kernels and modules Alexander Smirnov
@ 2018-02-15 14:43 ` Alexander Smirnov
2018-02-15 15:00 ` Jan Kiszka
6 siblings, 1 reply; 20+ messages in thread
From: Alexander Smirnov @ 2018-02-15 14:43 UTC (permalink / raw)
To: Jan Kiszka, isar-users
On 02/14/2018 12:13 PM, Jan Kiszka wrote:
> This is now finally the promised patches to provide simple patterns for
> building custom kernels for Isar images that replace the distro kernels.
> It also provids the same pattern for custom out-of-tree kernel modules.
>
> Changes in v5:
> - dropped merged patches
> - reworked kernel packages naming and selection mechanism to use
> flavor/arch rather them overwriting upstream names
> - fixed rebuilds of the kernel (.version was causing problems)
> - moved kernel build into script - and switched back to include pattern
> - provided note on origin of exemplary defconfig
> - add KERNEL_DEFCONFIG variable
>
> Jan
$ start_vm -a arm -d jessie
...
root@isar:~# modprobe example-module
[ 110.444107] Just an example
modprobe: ERROR: could not insert 'example_module': No anode
The same for amd64:
root@isar:~# modprobe example-module
[ 38.343926] example_module: loading out-of-tree module taints kernel.
[ 38.353140] Just an example
modprobe: ERROR: could not insert 'example_module': No anode
Please take a look.
Alex
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v5 0/5] Provide infrastructure and examples for custom kernels and modules
2018-02-15 14:43 ` Alexander Smirnov
@ 2018-02-15 15:00 ` Jan Kiszka
2018-02-15 15:04 ` Alexander Smirnov
0 siblings, 1 reply; 20+ messages in thread
From: Jan Kiszka @ 2018-02-15 15:00 UTC (permalink / raw)
To: Alexander Smirnov, isar-users
On 2018-02-15 15:43, Alexander Smirnov wrote:
> On 02/14/2018 12:13 PM, Jan Kiszka wrote:
>> This is now finally the promised patches to provide simple patterns for
>> building custom kernels for Isar images that replace the distro kernels.
>> It also provids the same pattern for custom out-of-tree kernel modules.
>>
>> Changes in v5:
>> - dropped merged patches
>> - reworked kernel packages naming and selection mechanism to use
>> flavor/arch rather them overwriting upstream names
>> - fixed rebuilds of the kernel (.version was causing problems)
>> - moved kernel build into script - and switched back to include pattern
>> - provided note on origin of exemplary defconfig
>> - add KERNEL_DEFCONFIG variable
>>
>> Jan
>
> $ start_vm -a arm -d jessie
>
> ...
>
> root@isar:~# modprobe example-module
> [ 110.444107] Just an example
> modprobe: ERROR: could not insert 'example_module': No anode
>
>
> The same for amd64:
>
>
> root@isar:~# modprobe example-module
> [ 38.343926] example_module: loading out-of-tree module taints kernel.
> [ 38.353140] Just an example
> modprobe: ERROR: could not insert 'example_module': No anode
>
> Please take a look.
>
static int __init example_module_init(void)
{
printk("Just an example\n");
return -ENOANO;
}
module_init(example_module_init);
:)
Jan
--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v5 0/5] Provide infrastructure and examples for custom kernels and modules
2018-02-15 15:00 ` Jan Kiszka
@ 2018-02-15 15:04 ` Alexander Smirnov
2018-02-15 15:13 ` Jan Kiszka
0 siblings, 1 reply; 20+ messages in thread
From: Alexander Smirnov @ 2018-02-15 15:04 UTC (permalink / raw)
To: Jan Kiszka, isar-users
On 02/15/2018 06:00 PM, Jan Kiszka wrote:
> On 2018-02-15 15:43, Alexander Smirnov wrote:
>> On 02/14/2018 12:13 PM, Jan Kiszka wrote:
>>> This is now finally the promised patches to provide simple patterns for
>>> building custom kernels for Isar images that replace the distro kernels.
>>> It also provids the same pattern for custom out-of-tree kernel modules.
>>>
>>> Changes in v5:
>>> - dropped merged patches
>>> - reworked kernel packages naming and selection mechanism to use
>>> flavor/arch rather them overwriting upstream names
>>> - fixed rebuilds of the kernel (.version was causing problems)
>>> - moved kernel build into script - and switched back to include pattern
>>> - provided note on origin of exemplary defconfig
>>> - add KERNEL_DEFCONFIG variable
>>>
>>> Jan
>>
>> $ start_vm -a arm -d jessie
>>
>> ...
>>
>> root@isar:~# modprobe example-module
>> [ 110.444107] Just an example
>> modprobe: ERROR: could not insert 'example_module': No anode
>>
>>
>> The same for amd64:
>>
>>
>> root@isar:~# modprobe example-module
>> [ 38.343926] example_module: loading out-of-tree module taints kernel.
>> [ 38.353140] Just an example
>> modprobe: ERROR: could not insert 'example_module': No anode
>>
>> Please take a look.
>>
>
> static int __init example_module_init(void)
> {
> printk("Just an example\n");
> return -ENOANO;
> }
>
> module_init(example_module_init);
>
> :)
>
Ouch, didn't notice this. :-(
Do you have any specific reason to have module_init failed? Could we
have zero return code to test its probe-ability and loading-by-default
for CI?
Alex
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v5 0/5] Provide infrastructure and examples for custom kernels and modules
2018-02-15 15:04 ` Alexander Smirnov
@ 2018-02-15 15:13 ` Jan Kiszka
2018-02-15 15:27 ` Alexander Smirnov
0 siblings, 1 reply; 20+ messages in thread
From: Jan Kiszka @ 2018-02-15 15:13 UTC (permalink / raw)
To: Alexander Smirnov, isar-users
On 2018-02-15 16:04, Alexander Smirnov wrote:
>
>
> On 02/15/2018 06:00 PM, Jan Kiszka wrote:
>> On 2018-02-15 15:43, Alexander Smirnov wrote:
>>> On 02/14/2018 12:13 PM, Jan Kiszka wrote:
>>>> This is now finally the promised patches to provide simple patterns for
>>>> building custom kernels for Isar images that replace the distro
>>>> kernels.
>>>> It also provids the same pattern for custom out-of-tree kernel modules.
>>>>
>>>> Changes in v5:
>>>> - dropped merged patches
>>>> - reworked kernel packages naming and selection mechanism to use
>>>> flavor/arch rather them overwriting upstream names
>>>> - fixed rebuilds of the kernel (.version was causing problems)
>>>> - moved kernel build into script - and switched back to include
>>>> pattern
>>>> - provided note on origin of exemplary defconfig
>>>> - add KERNEL_DEFCONFIG variable
>>>>
>>>> Jan
>>>
>>> $ start_vm -a arm -d jessie
>>>
>>> ...
>>>
>>> root@isar:~# modprobe example-module
>>> [ 110.444107] Just an example
>>> modprobe: ERROR: could not insert 'example_module': No anode
>>>
>>>
>>> The same for amd64:
>>>
>>>
>>> root@isar:~# modprobe example-module
>>> [ 38.343926] example_module: loading out-of-tree module taints kernel.
>>> [ 38.353140] Just an example
>>> modprobe: ERROR: could not insert 'example_module': No anode
>>>
>>> Please take a look.
>>>
>>
>> static int __init example_module_init(void)
>> {
>> printk("Just an example\n");
>> return -ENOANO;
>> }
>>
>> module_init(example_module_init);
>>
>> :)
>>
>
> Ouch, didn't notice this. :-(
>
> Do you have any specific reason to have module_init failed? Could we
> have zero return code to test its probe-ability and loading-by-default
> for CI?
I didn't think of CI for this module yet, but that may make more sense
then. Do you plan to write some CI script for that? Then just change the
module code to your needs. It's "just an example". :)
Jan
--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v5 0/5] Provide infrastructure and examples for custom kernels and modules
2018-02-15 15:13 ` Jan Kiszka
@ 2018-02-15 15:27 ` Alexander Smirnov
0 siblings, 0 replies; 20+ messages in thread
From: Alexander Smirnov @ 2018-02-15 15:27 UTC (permalink / raw)
To: Jan Kiszka, isar-users
On 02/15/2018 06:13 PM, Jan Kiszka wrote:
> On 2018-02-15 16:04, Alexander Smirnov wrote:
>>
>>
>> On 02/15/2018 06:00 PM, Jan Kiszka wrote:
>>> On 2018-02-15 15:43, Alexander Smirnov wrote:
>>>> On 02/14/2018 12:13 PM, Jan Kiszka wrote:
>>>>> This is now finally the promised patches to provide simple patterns for
>>>>> building custom kernels for Isar images that replace the distro
>>>>> kernels.
>>>>> It also provids the same pattern for custom out-of-tree kernel modules.
>>>>>
>>>>> Changes in v5:
>>>>> - dropped merged patches
>>>>> - reworked kernel packages naming and selection mechanism to use
>>>>> flavor/arch rather them overwriting upstream names
>>>>> - fixed rebuilds of the kernel (.version was causing problems)
>>>>> - moved kernel build into script - and switched back to include
>>>>> pattern
>>>>> - provided note on origin of exemplary defconfig
>>>>> - add KERNEL_DEFCONFIG variable
>>>>>
>>>>> Jan
>>>>
>>>> $ start_vm -a arm -d jessie
>>>>
>>>> ...
>>>>
>>>> root@isar:~# modprobe example-module
>>>> [ 110.444107] Just an example
>>>> modprobe: ERROR: could not insert 'example_module': No anode
>>>>
>>>>
>>>> The same for amd64:
>>>>
>>>>
>>>> root@isar:~# modprobe example-module
>>>> [ 38.343926] example_module: loading out-of-tree module taints kernel.
>>>> [ 38.353140] Just an example
>>>> modprobe: ERROR: could not insert 'example_module': No anode
>>>>
>>>> Please take a look.
>>>>
>>>
>>> static int __init example_module_init(void)
>>> {
>>> printk("Just an example\n");
>>> return -ENOANO;
>>> }
>>>
>>> module_init(example_module_init);
>>>
>>> :)
>>>
>>
>> Ouch, didn't notice this. :-(
>>
>> Do you have any specific reason to have module_init failed? Could we
>> have zero return code to test its probe-ability and loading-by-default
>> for CI?
>
> I didn't think of CI for this module yet, but that may make more sense
> then. Do you plan to write some CI script for that? Then just change the
> module code to your needs. It's "just an example". :)
Ok, thanks!
Now there is simple automated which checks that each virtual machine has
reached login prompt. You could see this in the bottom of console output:
http://isar-build.org:8080/job/isar_next/105/console
To be honest, I don't want to check this manually after each merge, so
I'm thinking about test automation for everything new appears in Isar :-)
Alex
^ permalink raw reply [flat|nested] 20+ messages in thread