Fix to use kernel module with kernel release version
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Mon, 30 Mar 2020 06:11:34 +0000 (15:11 +0900)
committerKonrad Kuchciak <k.kuchciak@samsung.com>
Tue, 31 Mar 2020 11:08:46 +0000 (13:08 +0200)
Kernel module has its own kernel release version and at runtime.
`uname -r` will report the version. Fix to use kernel module with
the kernel release version.

Change-Id: Ifd26c29ce84591a9e9ba46a7d64361a3e20e4824
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Konrad Kuchciak <k.kuchciak@samsung.com>
config/stability-monitor.conf
packaging/stability-monitor-kmod-rpi3.spec

index f5834d8..63aa57c 100644 (file)
@@ -1 +1 @@
-install proc_tsm insmod /usr/lib/stability-monitor/proc-tsm.ko blacklist=System::TEF
+install proc_tsm insmod /usr/lib/stability-monitor/`/usr/bin/uname -r`/extra/proc-tsm.ko blacklist=System::TEF
index dda5751..68f96b3 100644 (file)
@@ -1,7 +1,8 @@
-%define KMOD_PATH %{_libdir}/stability-monitor/proc-tsm.ko
+%define KMOD_PATH %{_libdir}/stability-monitor
+%define TSM_PATH %{KMOD_PATH}/proc-tsm.ko
 
 Name:       stability-monitor-kmod-rpi3
-Version:    6.0.2
+Version:    6.1.1
 Release:    0
 License:    GPL-2.0+
 Source0:    %{name}-%{version}.tar.xz
@@ -9,8 +10,9 @@ Source1:    %{name}.manifest
 Summary:    Stability monitoring kernel module
 Group:      System/Monitoring
 ExclusiveArch: armv7l
+BuildRequires: module-init-tools
 BuildRequires: arm-rpi3-linux-kernel-devel
-Provides:   %{KMOD_PATH}
+Provides:   %{TSM_PATH}
 
 %description
 This package provides kernel module for stability monitoring daemon.
@@ -20,18 +22,24 @@ This package provides kernel module for stability monitoring daemon.
 cp %{SOURCE1} ./%{name}.manifest
 
 %build
-make -C kernel KMOD_PATH=%KMOD_PATH KERNELDIR=/boot/kernel/devel/kernel-devel-arm-rpi3/
+make -C kernel clean KERNELDIR=/boot/kernel/devel/kernel-devel-arm-rpi3
+make -C kernel KERNELDIR=/boot/kernel/devel/kernel-devel-arm-rpi3/
+make -C kernel modules_install KERNELDIR=/boot/kernel/devel/kernel-devel-arm-rpi3 INSTALL_MOD_STRIP=1
 
 %install
-install -D kernel/proc-tsm.ko %{buildroot}/%KMOD_PATH
+install -D kernel/proc-tsm.ko %{buildroot}/%TSM_PATH
+pushd lib/modules
+find -name "*.ko" -exec cp -a --parents {} %{buildroot}/%{KMOD_PATH}/ \;
+popd
 install -D config/stability-monitor.conf %{buildroot}/etc/modprobe.d/stability-monitor.conf
 
 %clean
 rm -rf %{buildroot}
 make -C kernel clean KERNELDIR=/boot/kernel/devel/kernel-devel-arm-rpi3
+rm -rf %{_builddir}/%{Name}-%{version}/lib
 
 %files
 %manifest %{name}.manifest
 %license COPYING
-%KMOD_PATH
+%{KMOD_PATH}/*
 /etc/modprobe.d/stability-monitor.conf