You are not logged in.

#1 2018-06-11 00:19:17

deu439
Member
Registered: 2015-03-12
Posts: 8

[SOLVED] Problems with DKMS

Hi all,
I am trying to create a PKGBUILD for a usb wifi dongle driver with the use of DKMS. But I am apparently having some problems with the dkms configuration.

After installation of my package the output of "dkms status" is:

$ dkms status
rtl8188eu-v4.1.8_9499-dkms-git, 1.0.r653.0b659bd, 4.16.13-2-ARCH, x86_64: installed (WARNING! Diff between built and installed module!)

After removal of the package I get:

$ dkms status
Error! Could not locate dkms.conf file.
File: /var/lib/dkms/rtl8188eu-v4.1.8_9499-dkms-git/1.0.r653.0b659bd/source/dkms.conf does not exist.

Appearently not everything seem to be removed. How can I solve this?

My PKGBUILD:

_pkgname=rtl8188eu
_branch=v4.1.8_9499
_pkgver=1.0
pkgname=${_pkgname}-${_branch}-dkms-git
pkgver=${_pkgver}.r653.0b659bd
pkgrel=1
pkgdesc="Stand-alone RTL8188EU driver from the lwfinger's repository. \
         This uses the currently active branch v4.1.8_9499."
arch=('i686' 'x86_64')
url="https://github.com/lwfinger/rtl8188eu"
license=('GPL2')
makedepends=('linux-headers>=4.12' 'linux>=4.12')
depends=('dkms' 'linux>=4.12')
provides=("${_pkgname}")
conflicts=("${_pkgname}" '8188eu')
source=("${pkgname}-${pkgver}::git+${url}#branch=${_branch}")
md5sums=('SKIP')
_kver="$(uname -r)"
_modloc="/kernel/drivers/net/wireless"

pkgver() {
	cd "$srcdir/${pkgname}-${pkgver}"
	printf "%s.r%s.%s" "${_pkgver}" "$(git rev-list --count HEAD)" \
	"$(git rev-parse --short HEAD)"
}

prepare() {
	cd "$srcdir/${pkgname}-${pkgver}"
	
    # Set name and version for dkms.conf
	sed -e "s/PACKAGE_NAME=\".*\"/PACKAGE_NAME=${_pkgname}/" \
		-e "s/PACKAGE_VERSION=\"1.0\"/PACKAGE_VERSION=${pkgver}/" \
		-e "s:DEST_MODULE_LOCATION=\".*\":DEST_MODULE_LOCATION=\"${_modloc}\":" \
		-i dkms.conf
}

build() {
	cd "$srcdir/${pkgname}-${pkgver}"
	make all
}

package() {
	cd "$srcdir/${pkgname}-${pkgver}"

	# Install driver
	install -Dm644 8188eu.ko "${pkgdir}/usr/lib/modules/${_kver}${_modloc}/8188eu.ko"
	
	# Install sources for dkms
	local source_dir="${pkgdir}/usr/src/${pkgname}-${pkgver}"

	# Copy dkms.conf
	install -Dm644 "$srcdir/${pkgname}-${pkgver}/dkms.conf" "${source_dir}/dkms.conf"

	# Copy sources
	cd "$srcdir/${pkgname}-${pkgver}"

	for d in $(find . -type d); do
        install -dm755 "${source_dir}/$d";
        done
	for f in $(find . -name "*.[ch]" -type f); do
        install -m644 "$f" "${source_dir}/$f";
        done
	install -m644 Makefile "${source_dir}/Makefile"
}

The modified dkms.conf is:

PACKAGE_NAME=rtl8188eu
PACKAGE_VERSION=1.0.r653.0b659bd
BUILT_MODULE_NAME="8188eu"
DEST_MODULE_LOCATION="/kernel/drivers/net/wireless"
REMAKE_INITRD="yes"
AUTOINSTALL="yes"
MAKE="'make' all"
CLEAN="'make' clean"

Last edited by deu439 (2018-06-11 12:09:02)

Offline

#2 2018-06-11 00:37:11

loqs
Member
Registered: 2014-03-06
Posts: 17,321

Re: [SOLVED] Problems with DKMS

You want to create a package for just the DKMS half of this split package https://aur.archlinux.org/packages/rtl8188eu-dkms-git/ ?
Why do this for a DKMS package?

build() {
	cd "$srcdir/${pkgname}-${pkgver}"
	make all
}

package() {
	cd "$srcdir/${pkgname}-${pkgver}"

	# Install driver
	install -Dm644 8188eu.ko "${pkgdir}/usr/lib/modules/${_kver}${_modloc}/8188eu.ko"

Offline

#3 2018-06-11 09:58:20

deu439
Member
Registered: 2015-03-12
Posts: 8

Re: [SOLVED] Problems with DKMS

Thank you for your response,
In fact I used the rtl8188eu-dkms-git package's PKGBUILD as a template. But this package package uses a different branch of the repository. Next thing is that this package is out of date because it requires an old kernel (4.12) and does some unnecessary actions that are not needed with current version of pacman (running the depmod in an install script).

Now why I do the make all and install - if you look at rtl8188eu-dkms-git's PKGBUILD they do exactly the same. So what is the correct approach to build a DKMS package within a PKGBUILD?

Offline

#4 2018-06-11 10:32:48

loqs
Member
Registered: 2014-03-06
Posts: 17,321

Re: [SOLVED] Problems with DKMS

Drop the build function the split package has the build for package_rtl8188eu-git() to install package_rtl8188eu-dkms-git() does not install the built module as DKMS will build it.
Did you try removing rtl8188eu-dkms-git makedepends on the older kernel and see if it then built?

Offline

#5 2018-06-11 11:46:37

deu439
Member
Registered: 2015-03-12
Posts: 8

Re: [SOLVED] Problems with DKMS

Aha, I am sorry I was a little confused with the build() function. Also in the arch wiki https://wiki.archlinux.org/index.php/Dy … le_Support there is an example PKGBUILD which actually runs 'make install' in the package function - is this not needed today?
After making some modifications in the PKGBUILD of rtl8188eu-dkms-git I managed to build it with my prefered branch (see the PKGBUILD below).
However ... do you think there is a reason for dkms module getting installed into '/usr/lib/modules/kernel/drivers/net/wireless/' whereas the non-dkms module getting installed into '/usr/lib/modules/extramodules-4.16-ARCH/' ?

Thank  you a lot for your help!

The final working PKGBUILD (using the branch v4.1.8_9499) looks like this:

# Maintainer: Tom Nguyen <tom81094@gmail.com>
# Contributor: Masanori Ohgita <mp_aur[at]ohgita[dot]info>

pkgbase=rtl8188eu-git
pkgname=(rtl8188eu-git rtl8188eu-dkms-git)
_pkgname=rtl8188eu
_pkgver=1.0
_extramodules=extramodules-4.16-ARCH
_branch=v4.1.8_9499
pkgver=1.0.0b659bd
pkgrel=1
pkgdesc="Standalone RTL8188EU driver"
url="https://github.com/lwfinger/rtl8188eu"
arch=('i686' 'x86_64')
license=('GPL2')
makedepends=('linux-headers>=4.12' 'linux>=4.12')
source=("$pkgbase-$pkgver::git+${url}#branch=${_branch}")
sha256sums=('SKIP')

pkgver() {
	cd "${pkgbase}-${pkgver}"

	#git describe --long | sed -E 's/^v//;s/([^-]*-g)/r\1/;s/-/./g;s/\.rc/rc/'
	echo $(echo ${_pkgver}. && git rev-parse --short HEAD) | sed -E 's/^v//;s/([^-]*-g)/r\1/;s/-/./g;s/\.rc/rc/;s/ //g'
}

prepare() {
	cd "${pkgbase}-${pkgver}"

	# Set name and version for dkms.conf
	sed -e "s/PACKAGE_NAME=\"8188eu\"/PACKAGE_NAME=${_pkgname}/" \
		-e "s/PACKAGE_VERSION=\"1.0\"/PACKAGE_VERSION=${pkgver}/" \
		-i dkms.conf
}

build() {
	cd "${pkgbase}-${pkgver}"

	_kernver="$(cat /usr/lib/modules/${_extramodules}/version)"
	make all ${MAKEFLAGS} KSRC=/lib/modules/${_kernver}/build
}

package_rtl8188eu-git() {
	depends=('linux>=4.12' 'linux<4.13')
	conflicts=('8188eu' "${_pkgname}")
	provides=('8188eu' "${_pkgname}")
	install=rtl8188eu.install

	cd "${pkgbase}-${pkgver}"

	install -Dm644 8188eu.ko "${pkgdir}/usr/lib/modules/${_extramodules}/8188eu.ko"
	gzip "${pkgdir}/usr/lib/modules/${_extramodules}/8188eu.ko"
}

package_rtl8188eu-dkms-git() {
	depends=('dkms')
	conflicts=('8188eu' "${_pkgname}")
	provides=('8188eu' "${_pkgname}")

	# dkms build reference and credit to:
	# - Arpan "rpn" Kapoor	<k.arpan26@gmail.com>
	# - Runnytu		<runnytu@gmail.com>

	local install_dir="${pkgdir}/usr/src/${pkgbase}-${pkgver}"

	# Copy dkms.conf
	install -Dm644 "${pkgbase}-${pkgver}/dkms.conf" "${install_dir}/dkms.conf"

	# Copy sources
	cd "${pkgbase}-${pkgver}"

	for d in $(find . -type d); do install -dm755 "${install_dir}/$d"; done
	for f in $(find . -type f); do install -m644 "$f" "${install_dir}/$f"; done
}

Offline

#6 2018-06-11 11:54:54

loqs
Member
Registered: 2014-03-06
Posts: 17,321

Re: [SOLVED] Problems with DKMS

I think the different install location is because DKMS rebuilds the module on every kernel version change even if the ABI is still compatible.
Modules in extramodules only need rebuilding when there is an ABI change.

Offline

#7 2018-06-11 12:07:47

deu439
Member
Registered: 2015-03-12
Posts: 8

Re: [SOLVED] Problems with DKMS

Ok thank you for the info, I mark this thread as solved.

Offline

Board footer

Powered by FluxBB