summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/kmod
diff options
context:
space:
mode:
authorAdrian Dudau <adrian.dudau@enea.com>2013-12-12 13:38:32 +0100
committerAdrian Dudau <adrian.dudau@enea.com>2013-12-12 13:50:20 +0100
commite2e6f6fe07049f33cb6348780fa975162752e421 (patch)
treeb1813295411235d1297a0ed642b1346b24fdfb12 /meta/recipes-kernel/kmod
downloadpoky-e2e6f6fe07049f33cb6348780fa975162752e421.tar.gz
initial commit of Enea Linux 3.1
Migrated from the internal git server on the dora-enea branch Signed-off-by: Adrian Dudau <adrian.dudau@enea.com>
Diffstat (limited to 'meta/recipes-kernel/kmod')
-rw-r--r--meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb47
-rw-r--r--meta/recipes-kernel/kmod/kmod-native_git.bb16
-rw-r--r--meta/recipes-kernel/kmod/kmod.inc36
-rw-r--r--meta/recipes-kernel/kmod/kmod/0001-Fix-build-with-older-gcc-4.6.patch44
-rw-r--r--meta/recipes-kernel/kmod/kmod/depmod-search.conf6
-rw-r--r--meta/recipes-kernel/kmod/kmod/fix-undefined-O_CLOEXEC.patch17
-rw-r--r--meta/recipes-kernel/kmod/kmod/ptest.patch25
-rw-r--r--meta/recipes-kernel/kmod/kmod/remove_parallel_tests.patch18
-rwxr-xr-xmeta/recipes-kernel/kmod/kmod/run-ptest3
-rw-r--r--meta/recipes-kernel/kmod/kmod_git.bb70
10 files changed, 282 insertions, 0 deletions
diff --git a/meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb b/meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb
new file mode 100644
index 0000000000..305107865d
--- /dev/null
+++ b/meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb
@@ -0,0 +1,47 @@
1DESCRIPTION = "Depmod wrapper script"
2LICENSE = "MIT"
3PR = "r0"
4LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
5
6INHIBIT_DEFAULT_DEPS = "1"
7# The kernel and the staging dir for it is machine specific
8PACKAGE_ARCH = "${MACHINE_ARCH}"
9
10# We need the following for the sstate code to process the wrapper
11SSTATE_SCAN_FILES += "depmodwrapper"
12
13do_install() {
14 install -d ${D}${bindir_crossscripts}/
15
16 cat > ${D}${bindir_crossscripts}/depmodwrapper << EOF
17#!/bin/sh
18# Expected to be called as: depmodwrapper -a KERNEL_VERSION
19if [ "\$1" != "-a" -o "\$2" != "-b" ]; then
20 echo "Usage: depmodwrapper -a -b rootfs KERNEL_VERSION" >&2
21 exit 1
22fi
23if [ ! -r ${STAGING_KERNEL_DIR}/kernel-abiversion ]; then
24 echo "Unable to read: ${STAGING_KERNEL_DIR}/kernel-abiversion" >&2
25else
26 kernelabi=\$(cat ${STAGING_KERNEL_DIR}/kernel-abiversion)
27 if [ "\$kernelabi" != "\$4" ]; then
28 echo "Error: Kernel version \$4 does not match kernel-abiversion (\$kernelabi)" >&2
29 exit 1
30 fi
31fi
32
33if [ ! -r ${STAGING_KERNEL_DIR}/System.map-\$4 ]; then
34 echo "Unable to read: ${STAGING_KERNEL_DIR}/System.map-\$4" >&2
35 exec env depmod "\$1" "\$2" "\$3" "\$4"
36else
37 exec env depmod "\$1" "\$2" "\$3" -F "${STAGING_KERNEL_DIR}/System.map-\$4" "\$4"
38fi
39EOF
40 chmod +x ${D}${bindir_crossscripts}/depmodwrapper
41}
42
43SYSROOT_PREPROCESS_FUNCS += "depmodwrapper_sysroot_preprocess"
44
45depmodwrapper_sysroot_preprocess () {
46 sysroot_stage_dir ${D}${bindir_crossscripts} ${SYSROOT_DESTDIR}${bindir_crossscripts}
47}
diff --git a/meta/recipes-kernel/kmod/kmod-native_git.bb b/meta/recipes-kernel/kmod/kmod-native_git.bb
new file mode 100644
index 0000000000..f22efc0615
--- /dev/null
+++ b/meta/recipes-kernel/kmod/kmod-native_git.bb
@@ -0,0 +1,16 @@
1# Copyright (C) 2012 Khem Raj <raj.khem@gmail.com>
2# Released under the MIT license (see COPYING.MIT for the terms)
3
4require kmod.inc
5inherit native
6
7SRC_URI += "file://fix-undefined-O_CLOEXEC.patch \
8 file://0001-Fix-build-with-older-gcc-4.6.patch \
9 "
10
11do_install_append (){
12 for tool in depmod insmod lsmod modinfo modprobe rmmod
13 do
14 ln -s kmod ${D}${bindir}/$tool
15 done
16}
diff --git a/meta/recipes-kernel/kmod/kmod.inc b/meta/recipes-kernel/kmod/kmod.inc
new file mode 100644
index 0000000000..633258b05e
--- /dev/null
+++ b/meta/recipes-kernel/kmod/kmod.inc
@@ -0,0 +1,36 @@
1# Copyright (C) 2012 Khem Raj <raj.khem@gmail.com>
2# Released under the MIT license (see COPYING.MIT for the terms)
3
4DESCRIPTION = "kmod is a set of tools to handle common tasks with Linux kernel modules like \
5 insert, remove, list, check properties, resolve dependencies and aliases."
6HOMEPAGE = "http://packages.profusion.mobi/kmod/"
7LICENSE = "GPL-2.0+ & LGPL-2.1+"
8LICENSE_libkmod = "LGPL-2.1+"
9SECTION = "base"
10
11DEPENDS += "pkgconfig-native"
12
13LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
14 file://libkmod/COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343 \
15 "
16inherit autotools gtk-doc ptest
17
18SRC_URI = "git://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git \
19 file://depmod-search.conf \
20 file://run-ptest \
21 file://ptest.patch \
22 file://remove_parallel_tests.patch \
23 "
24
25SRCREV = "3b38c7fcb58be4ddc34f90454c5f5dc3693d2d85"
26# Lookout for PV bump too when SRCREV is changed
27PV = "14"
28
29S = "${WORKDIR}/git"
30
31EXTRA_AUTORECONF += "--install --symlink"
32EXTRA_OECONF +="--enable-debug --enable-logging --enable-tools --disable-manpages"
33
34do_configure_prepend () {
35 gtkdocize --docdir ${S}/libkmod/docs || touch ${S}/libkmod/docs/gtk-doc.make
36}
diff --git a/meta/recipes-kernel/kmod/kmod/0001-Fix-build-with-older-gcc-4.6.patch b/meta/recipes-kernel/kmod/kmod/0001-Fix-build-with-older-gcc-4.6.patch
new file mode 100644
index 0000000000..f8ff103087
--- /dev/null
+++ b/meta/recipes-kernel/kmod/kmod/0001-Fix-build-with-older-gcc-4.6.patch
@@ -0,0 +1,44 @@
1Upstream-Status: Inappropriate [kmod is new]
2
3From 30e1839a46b0b9449f272765193a0da61bf85997 Mon Sep 17 00:00:00 2001
4From: Khem Raj <raj.khem@gmail.com>
5Date: Mon, 26 Aug 2013 15:32:36 -0700
6Subject: [PATCH] Fix build with older gcc < 4.6
7
8Static_assert is new feature in C11 standards and older than gcc 4.6
9does not support it. So define it to make the old gcc happy
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 libkmod/macro.h | 14 ++++++++++++--
14 1 file changed, 12 insertions(+), 2 deletions(-)
15
16diff --git a/libkmod/macro.h b/libkmod/macro.h
17index c6ba855..5032f54 100644
18--- a/libkmod/macro.h
19+++ b/libkmod/macro.h
20@@ -20,9 +20,19 @@
21 #pragma once
22
23 #include <stddef.h>
24-
25-#define assert_cc(expr) \
26+#if defined(__GNUC__)
27+/* Determine which version of GNU C we're using */
28+#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
29+#endif
30+#if (GCC_VERSION >= 40600)
31+# define assert_cc(expr) \
32 _Static_assert((expr), #expr)
33+#else
34+# define STATIC_ASSERT_GLUE1(x, y) x##y
35+# define STATIC_ASSERT_GLUE(x, y) STATIC_ASSERT_GLUE1(x, y)
36+# define assert_cc(expr) \
37+extern void STATIC_ASSERT_GLUE(static_assert, __LINE__)(int arg[(expr) ? 1 : -1]) __attribute__((unused))
38+#endif
39
40 #if HAVE_TYPEOF
41 #define check_types_match(expr1, expr2) \
42--
431.8.3.4
44
diff --git a/meta/recipes-kernel/kmod/kmod/depmod-search.conf b/meta/recipes-kernel/kmod/kmod/depmod-search.conf
new file mode 100644
index 0000000000..527c0bb6ee
--- /dev/null
+++ b/meta/recipes-kernel/kmod/kmod/depmod-search.conf
@@ -0,0 +1,6 @@
1#
2# /etc/depmod.d/depmod.conf
3#
4
5search updates extramodules built-in
6
diff --git a/meta/recipes-kernel/kmod/kmod/fix-undefined-O_CLOEXEC.patch b/meta/recipes-kernel/kmod/kmod/fix-undefined-O_CLOEXEC.patch
new file mode 100644
index 0000000000..0268216230
--- /dev/null
+++ b/meta/recipes-kernel/kmod/kmod/fix-undefined-O_CLOEXEC.patch
@@ -0,0 +1,17 @@
1Upstream-Status: Not applicable
2
3Index: git/libkmod/libkmod-private.h
4===================================================================
5--- git.orig/libkmod/libkmod-private.h 2013-08-21 10:07:51.000000000 -0700
6+++ git/libkmod/libkmod-private.h 2013-08-21 14:34:04.558278849 -0700
7@@ -9,6 +9,10 @@
8 #include "macro.h"
9 #include "libkmod.h"
10
11+#ifndef O_CLOEXEC
12+# define O_CLOEXEC 0
13+#endif
14+
15 static _always_inline_ _printf_format_(2, 3) void
16 kmod_log_null(struct kmod_ctx *ctx, const char *format, ...) {}
17
diff --git a/meta/recipes-kernel/kmod/kmod/ptest.patch b/meta/recipes-kernel/kmod/kmod/ptest.patch
new file mode 100644
index 0000000000..831dbcb909
--- /dev/null
+++ b/meta/recipes-kernel/kmod/kmod/ptest.patch
@@ -0,0 +1,25 @@
1Add 'install-ptest' rule.
2
3Signed-off-by: Tudor Florea <tudor.florea@enea.com>
4Upstream-Status: Pending
5
6diff -ruN a/Makefile.am b/Makefile.am
7--- a/Makefile.am 2013-07-12 17:11:05.278331557 +0200
8+++ b/Makefile.am 2013-07-12 17:14:27.033788016 +0200
9@@ -204,6 +204,16 @@
10
11 distclean-local: $(DISTCLEAN_LOCAL_HOOKS)
12
13+install-ptest:
14+ @$(MKDIR_P) $(DESTDIR)/testsuite
15+ @for file in $(TESTSUITE); do \
16+ install $$file $(DESTDIR)/testsuite; \
17+ done;
18+ @sed -e 's/^Makefile/_Makefile/' < Makefile > $(DESTDIR)/Makefile
19+ @$(MKDIR_P) $(DESTDIR)/tools
20+ @cp $(noinst_SCRIPTS) $(noinst_PROGRAMS) $(DESTDIR)/tools
21+ @cp -r testsuite/rootfs testsuite/.libs $(DESTDIR)/testsuite
22+
23 # ------------------------------------------------------------------------------
24 # custom release helpers
25 # ------------------------------------------------------------------------------
diff --git a/meta/recipes-kernel/kmod/kmod/remove_parallel_tests.patch b/meta/recipes-kernel/kmod/kmod/remove_parallel_tests.patch
new file mode 100644
index 0000000000..ee1942806b
--- /dev/null
+++ b/meta/recipes-kernel/kmod/kmod/remove_parallel_tests.patch
@@ -0,0 +1,18 @@
1Avoid parallel-tests as it remove
2buildtest-TESTS and runtest-TESTS targets
3
4Signed-off-by: Tudor Florea <tudor.florea@enea.com>
5Upstream-Status: Inappropriate (disable feature incompatible with ptest)
6
7diff -ruN a/configure.ac b/configure.ac
8--- a/configure.ac 2013-09-02 15:05:18.662366800 +0200
9+++ b/configure.ac 2013-09-02 15:05:49.557066764 +0200
10@@ -8,7 +8,7 @@
11 AC_CONFIG_SRCDIR([libkmod/libkmod.c])
12 AC_CONFIG_AUX_DIR([build-aux])
13 AM_INIT_AUTOMAKE([check-news foreign 1.11 silent-rules
14- tar-pax no-dist-gzip dist-xz subdir-objects color-tests parallel-tests])
15+ tar-pax no-dist-gzip dist-xz subdir-objects color-tests])
16 AC_PROG_CC_STDC
17 AC_USE_SYSTEM_EXTENSIONS
18 AC_SYS_LARGEFILE
diff --git a/meta/recipes-kernel/kmod/kmod/run-ptest b/meta/recipes-kernel/kmod/kmod/run-ptest
new file mode 100755
index 0000000000..37adec3d2f
--- /dev/null
+++ b/meta/recipes-kernel/kmod/kmod/run-ptest
@@ -0,0 +1,3 @@
1#!/bin/sh
2touch testsuite/stamp-rootfs
3make -k runtest-TESTS 2>/dev/null| grep -e ^PASS -e ^FAIL
diff --git a/meta/recipes-kernel/kmod/kmod_git.bb b/meta/recipes-kernel/kmod/kmod_git.bb
new file mode 100644
index 0000000000..ebecbcc82e
--- /dev/null
+++ b/meta/recipes-kernel/kmod/kmod_git.bb
@@ -0,0 +1,70 @@
1# Copyright (C) 2012 Khem Raj <raj.khem@gmail.com>
2# Released under the MIT license (see COPYING.MIT for the terms)
3
4require kmod.inc
5
6PV_append = "+git${SRCPV}"
7
8PROVIDES += "module-init-tools-insmod-static module-init-tools-depmod module-init-tools"
9RPROVIDES_${PN} += "module-init-tools-insmod-static module-init-tools-depmod module-init-tools"
10RCONFLICTS_${PN} += "module-init-tools-insmod-static module-init-tools-depmod module-init-tools"
11RREPLACES_${PN} += "module-init-tools-insmod-static module-init-tools-depmod module-init-tools"
12
13# to force user to remove old module-init-tools and replace them with kmod variants
14RCONFLICTS_libkmod2 += "module-init-tools-insmod-static module-init-tools-depmod module-init-tools"
15
16# autotools set prefix to /usr, however we want them in /bin and /sbin
17bindir = "${base_bindir}"
18sbindir = "${base_sbindir}"
19# libdir = "${base_libdir}"
20
21do_install_append () {
22 install -dm755 ${D}${base_bindir}
23 install -dm755 ${D}${base_sbindir}
24 # add symlinks to kmod
25 ln -s ..${base_bindir}/kmod ${D}${base_bindir}/lsmod
26 for tool in insmod rmmod depmod modinfo modprobe; do
27 ln -s ..${base_bindir}/kmod ${D}${base_sbindir}/${tool}
28 done
29 # configuration directories
30 install -dm755 ${D}${base_libdir}/depmod.d
31 install -dm755 ${D}${base_libdir}/modprobe.d
32 install -dm755 ${D}${sysconfdir}/depmod.d
33 install -dm755 ${D}${sysconfdir}/modprobe.d
34
35 # install depmod.d file for search/ dir
36 install -Dm644 "${WORKDIR}/depmod-search.conf" "${D}${base_libdir}/depmod.d/search.conf"
37}
38
39do_compile_prepend() {
40 sed -i 's/ac_pwd=/#ac_pwd=/' config.status ; sed -i "/#ac_pwd=/a\ac_pwd='.'" config.status
41}
42
43do_compile_ptest () {
44 oe_runmake buildtest-TESTS rootfs
45}
46
47INHIBIT_PACKAGE_STRIP = "${@base_contains("DISTRO_FEATURES", "ptest", "1", "0", d)}"
48INSANE_SKIP_${PN}-ptest = "arch"
49
50inherit update-alternatives
51
52ALTERNATIVE_PRIORITY = "60"
53
54ALTERNATIVE_kmod = "insmod modprobe rmmod modinfo bin-lsmod lsmod depmod"
55
56ALTERNATIVE_LINK_NAME[insmod] = "${base_sbindir}/insmod"
57ALTERNATIVE_LINK_NAME[modprobe] = "${base_sbindir}/modprobe"
58ALTERNATIVE_LINK_NAME[rmmod] = "${base_sbindir}/rmmod"
59ALTERNATIVE_LINK_NAME[modinfo] = "${base_sbindir}/modinfo"
60ALTERNATIVE_LINK_NAME[bin-lsmod] = "${base_bindir}/lsmod"
61
62ALTERNATIVE_LINK_NAME[lsmod] = "${base_sbindir}/lsmod"
63ALTERNATIVE_TARGET[lsmod] = "${base_bindir}/lsmod.${BPN}"
64
65ALTERNATIVE_LINK_NAME[depmod] = "${base_sbindir}/depmod"
66
67PACKAGES =+ "libkmod"
68
69FILES_libkmod = "${base_libdir}/libkmod*${SOLIBS} ${libdir}/libkmod*${SOLIBS}"
70FILES_${PN} += "${base_libdir}/depmod.d ${base_libdir}/modprobe.d"