Page 1 of 1

Example specfile to build a DKMS package?

PostPosted: Jul 31st, '20, 17:08
by srowe
Could someone point me at an example of a specfile that builds one or more kernel modules using DKMS? The one I've been using for multiple older releases has stopped working on mga7

Code: Select all
Running Generic preparation routine
make mrproper
Makefile:1384: *** insufficient number of arguments (1) to function 'addprefix'.  Stop.
(bad exit status: 2)

Re: Example specfile to build a DKMS package?

PostPosted: Jul 31st, '20, 17:47
by doktor5000
Could you post the relevant sections from your specfile ?

For your question, I'd go with one of the more recent dkms packages, pick one from http://svnweb.mageia.org/packages/cauld ... start=1300
E.g. this one: http://svnweb.mageia.org/packages/cauld ... iew=markup

You may also want to take a look at https://wiki.mageia.org/en/DKMS_packaging_policy
If you spot an error, feel free to bring that up and I can fix it, if you don't have edit permissions on that wiki page.

Re: Example specfile to build a DKMS package?

PostPosted: Jul 31st, '20, 17:56
by srowe
I think this is the relevant section

Code: Select all
%install
%__mkdir_p %{buildroot}%{_usrsrc}/%{modname}-%{version}-%{release}
%__cp -a %{modname}-%{version}/* %{buildroot}%{_usrsrc}/%{modname}-%{version}-%{release}
%__cat > %{buildroot}%{_usrsrc}/%{modname}-%{version}-%{release}/dkms.conf <<EOF

PACKAGE_VERSION="%{version}-%{release}"

# Items below here should not have to change with each driver version
PACKAGE_NAME="%{modname}"
MAKE[0]="make -C \${kernel_source_dir} SUBDIRS=\${dkms_tree}/\${PACKAGE_NAME}/\${PACKAGE_VERSION}/build modules"
CLEAN="make -C \${kernel_source_dir} SUBDIRS=\${dkms_tree}/\${PACKAGE_NAME}/\${PACKAGE_VERSION}/build clean"
BUILT_MODULE_NAME[0]="mei-pci"
DEST_MODULE_LOCATION[0]="/kernel/3rdparty"
BUILT_MODULE_NAME[1]="qst-hwmon"
DEST_MODULE_LOCATION[1]="/kernel/3rdparty"
BUILT_MODULE_NAME[2]="intel-mei"
DEST_MODULE_LOCATION[2]="/kernel/3rdparty"
REMAKE_INITRD="no"
AUTOINSTALL="YES"
EOF


I don't remember what I based it on, it goes back to mga5.

Re: Example specfile to build a DKMS package?

PostPosted: Jul 31st, '20, 18:31
by doktor5000
Not really, the relevant sections on what is actually happening when you install the package in this case are %post and maybe %preun ( for the uninstall part ).
%install is only what's happening during the build of the package, but it's not relevant for when you're installing the package.

Also for your actual error message you would need to take a look inside your dkms.conf and inside the Makefile.
FWIW, what you ship inside that dkms package, is that from your git repo https://eden.mose.org.uk/gitweb/?p=mei.git;a=summary ?

Re: Example specfile to build a DKMS package?

PostPosted: Jul 31st, '20, 18:50
by srowe
doktor5000 wrote:Not really, the relevant sections on what is actually happening when you install the package in this case are %post and maybe %preun ( for the uninstall part ).


The scriptlets are as follows

Code: Select all
%post
/usr/sbin/dkms add -m %{modname} -v %{version}-%{release} --rpm_safe_upgrade
/usr/sbin/dkms build -m %{modname} -v %{version}-%{release} --rpm_safe_upgrade
/usr/sbin/dkms install -m %{modname} -v %{version}-%{release} --rpm_safe_upgrade


%preun
/usr/sbin/dkms remove -m %{modname} -v %{version}-%{release} --rpm_safe_upgrade --all


Also for your actual error message you would need to take a look inside your dkms.conf and inside the Makefile.


That's autogenerated in the specfile. I've copied the MAKE and CLEAN from http://svnweb.mageia.org/packages/cauldron/dkms-fsam7400/current/SPECS/dkms-fsam7400.spec?view=markup but it still fails.

FWIW, what you ship inside that dkms package, is that from your git repo https://eden.mose.org.uk/gitweb/?p=mei.git;a=summary ?


Yes, I've just had to push a code fix, the modules now build on 5.6

Re: Example specfile to build a DKMS package?

PostPosted: Jul 31st, '20, 19:05
by srowe

Re: Example specfile to build a DKMS package?

PostPosted: Jul 31st, '20, 19:19
by doktor5000
srowe wrote:It could be related to https://patchwork.kernel.org/patch/10690487/

Thanks for the pointer. So fix is basically more or less to replace SUBDIRS= with M= or so it seems.

Re: Example specfile to build a DKMS package?

PostPosted: Jul 31st, '20, 19:42
by srowe
Confirmed, the modules now build and load properly.