Example specfile to build a DKMS package?

This forum is dedicated to packaging and translating :

On those activities rely the making of Mageia Linux Distribution.

Post all questions and information about packaging and translating : feedbacks, discussion about guidelines, packaging practices...

Example specfile to build a DKMS package?

Postby srowe » Jul 31st, '20, 17:08

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)
srowe
 
Posts: 17
Joined: Aug 7th, '15, 08:54

Re: Example specfile to build a DKMS package?

Postby doktor5000 » Jul 31st, '20, 17:47

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.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17630
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Example specfile to build a DKMS package?

Postby srowe » Jul 31st, '20, 17:56

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.
srowe
 
Posts: 17
Joined: Aug 7th, '15, 08:54

Re: Example specfile to build a DKMS package?

Postby doktor5000 » Jul 31st, '20, 18:31

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 ?
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17630
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Example specfile to build a DKMS package?

Postby srowe » Jul 31st, '20, 18:50

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
srowe
 
Posts: 17
Joined: Aug 7th, '15, 08:54

Re: Example specfile to build a DKMS package?

Postby srowe » Jul 31st, '20, 19:05

srowe
 
Posts: 17
Joined: Aug 7th, '15, 08:54

Re: Example specfile to build a DKMS package?

Postby doktor5000 » Jul 31st, '20, 19:19

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.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17630
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Example specfile to build a DKMS package?

Postby srowe » Jul 31st, '20, 19:42

Confirmed, the modules now build and load properly.
srowe
 
Posts: 17
Joined: Aug 7th, '15, 08:54


Return to Packaging and translating for Mageia

Who is online

Users browsing this forum: No registered users and 1 guest

cron