1

I want to package a simple kernel module, acpi_call, for Fedora. For this I have followed the kmods2 instructions on RPM Fusion and got the following SPEC file:

# Copyright © 2016 Martin Ueding <dev@martin-ueding.de>

# A lot of boilerplate taken from
# http://rpmfusion.org/Packaging/KernelModules/Kmods2

#define buildforkernels newest
#define buildforkernels current
%define buildforkernels akmod

%define kmod_name acpi_call

%global debug_package %{nil}

Name:           %{kmod_name}
Version:        1.1.0
Release:        1%{?dist}
Summary:        Call ACPI methods by writing to /proc

License:        GPL3+
Source0:        https://github.com/mkottman/acpi_call/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz

BuildRequires:  %{_bindir}/kmodtool

Requires: %{name}-kmod >= %{version}
Provides: %{name}-kmod-common = %{version}

# needed for plague to make sure it builds for i586 and i686
ExclusiveArch:  i586 i686 x86_64 ppc ppc64

# get the proper build-sysbuild package from the repo, which
# tracks in all the kernel-devel packages
BuildRequires:  %{_bindir}/kmodtool

%{!?kernels:BuildRequires: buildsys-build-rpmfusion-kerneldevpkgs-%{?buildforkernels:%{buildforkernels}}%{!?buildforkernels:current}-%{_target_cpu} }

# kmodtool does its magic here
%{expand:%(kmodtool --target %{_target_cpu} --repo rpmfusion --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null) }

%description

A kernel simple module that enables you to call ACPI methods by writing the
method name followed by arguments to /proc/acpi/call.

This module is to be considered a proof-of-concept and has been superseeded by
projects like bbswitch. It allows you to tamper with your system and should be
used with caution.

%prep

# error out if there was something wrong with kmodtool
%{?kmodtool_check}

%autosetup -n %{kmod_name}-%{version}

# print kmodtool output for debugging purposes:
kmodtool  --target %{_target_cpu}  --repo %{repo} --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null

for kernel_version in %{?kernel_versions} ; do
    cp -a foo-%{version} _kmod_build_${kernel_version%%___*}
done

%build

for kernel_version in %{?kernel_versions}; do
    make %{?_smp_mflags} -C "${kernel_version##*___}" SUBDIRS=${PWD}/_kmod_build_${kernel_version%%___*} modules
done

%install

rm -rf ${RPM_BUILD_ROOT}

for kernel_version in %{?kernel_versions}; do
    make install DESTDIR=${RPM_BUILD_ROOT} KMODPATH=%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}
    # install -D -m 755 _kmod_build_${kernel_version%%___*}/foo/foo.ko  ${RPM_BUILD_ROOT}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/foo.ko
done
%{?akmod_install}

%clean

rm -rf $RPM_BUILD_ROOT

%changelog

* Sat Jul 23 2016 Martin Ueding <dev@martin-ueding.de> 1.1.0-1
- Initial packaging

See this paste for a version with syntax highlighting.

It does compile with rpmbuild -ba acpi_call.spec and I do get two files:

  • akmod-acpi_call-1.1.0-1.fc24.x86_64.rpm
  • kmod-acpi_call-1.1.0-1.fc24.x86_64.rpm

When I try to install them with dnf, I cannot because the -common package is missing:

# dnf install akmod-acpi_call-1.1.0-1.fc24.x86_64.rpm kmod-acpi_call-1.1.0-1.fc24.x86_64.rpm 
Last metadata expiration check: 0:47:46 ago on Sat Jul 23 11:03:54 2016.
Error: nothing provides acpi_call-kmod-common >= 1.1.0 needed by akmod-acpi_call-1.1.0-1.fc24.x86_64.
nothing provides acpi_call-kmod-common >= 1.1.0 needed by akmod-acpi_call-1.1.0-1.fc24.x86_64
(try to add '--allowerasing' to command line to replace conflicting packages)

I am now stuck here. No -common package is created and installing those packages with dnf does not seem to work either.

How can I get this into a package?

  • did you try rpm -i *.rpm and get the same error? – meuh Jul 23 '16 at 18:49
  • I pretty much get the same error: acpi_call-kmod-common >= 1.1.0 is needed by akmod-acpi_call-1.1.0-1.fc24.x86_64. – Martin Ueding Jul 29 '16 at 6:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.