You are not logged in.

#1 2024-04-26 06:18:19

ryanbarillos
Member
Registered: 2023-11-29
Posts: 27

Learning to Package a Kernel & Its DKMS Module -- in Need of Advice

I'm currently learning to package acer-wmi-battery and its DKMS version to publish to the AUR.

I'm following through the DKMS Packaging Guidelines from the wiki as a guide to build the PKGBUILD of the DKMS variant, but I'm in the dark on the following questions:

FOR BOTH
1. They don't have a structured file structure that I can just copy or move to the root directory, only commands to be executed. How should I go about incorporating these to the PKGBUILD?

FOR DKMS
1. It already has its own install & uninstall scripts to work with, is there anything to add to the PKGBUILD to work with these?
2. Unlike the original version, this doesn't have any version numbers. What should I put for its "pkgver" variable?
3. It currently doesn't have a binary release. Should I append this package "acer-wmi-battery-dkms" with a "-git" suffix?

Thanks in advance for your help.

Last edited by ryanbarillos (2024-04-26 06:20:02)

Offline

#2 2024-05-01 21:00:49

harre
Member
Registered: 2024-05-01
Posts: 1

Re: Learning to Package a Kernel & Its DKMS Module -- in Need of Advice

DKMS AUR packages are quite some magic, it took me quite a while to get one package up and running.

https://wiki.archlinux.org/title/DKMS_p … guidelines

the dkms.config file contains what commands it should use to build the package, for example:
https://github.com/hartmark/aura-gpu/bl … /dkms.conf

You can take a look on my package here
https://aur.archlinux.org/packages/aura-gpu-dkms-git

Offline

#3 2024-05-01 22:19:22

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

Re: Learning to Package a Kernel & Its DKMS Module -- in Need of Advice

Why are you using different repositories for the DKMS and none DKMS versions?  You can provide a dkms.conf for any kernel module you want to use with DKMS.

Last edited by loqs (2024-05-01 22:19:37)

Offline

#4 2024-05-02 04:55:12

ryanbarillos
Member
Registered: 2023-11-29
Posts: 27

Re: Learning to Package a Kernel & Its DKMS Module -- in Need of Advice

loqs wrote:

Why are you using different repositories for the DKMS and none DKMS versions?  You can provide a dkms.conf for any kernel module you want to use with DKMS.

Just my first time working with DKMS packages, do I didn't know any better.
And during the time of original posting—if I were to I have made a dkms.conf—another challenge I would have is how to transport files from the AUR package repo to the installation ZIP file (considering that those files aren't presend in either $srcdir or $pkgdir directories, but where the PKGBUILD, SRCINFO and other files locate).

Last edited by ryanbarillos (2024-05-02 04:55:59)

Offline

#5 2024-05-02 12:57:34

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

Re: Learning to Package a Kernel & Its DKMS Module -- in Need of Advice

PKGBUILD for none DKMS version using heredoc for acer-wmi-battery.conf (module compression not implemented)

_user="frederik-h"
_filetype="tar.gz" # Source code is also available in .zip file, so specify it

# Main info
pkgname="acer-wmi-battery"
pkgver=0.1.0
pkgrel=1
pkgdesc="For Acer laptops -- kernel module to set Battery Charge Limit to 80%."
arch=('x86_64')
url="https://github.com/${_user}/${pkgname}"
license=('GPL-2.0-or-later')
groups=('acer')
depends=('linux')
makedepends=('linux-headers')
conflicts=("$pkgname-dkms")

source=(
    "${url}/archive/v${pkgver}/${pkgname}-${pkgver}.${_filetype}"
    )
sha256sums=('eadee2d9daf257b34098d8b1f21b9be08270b89b6249725f701f1f790b6c76ba')

build() {
  local _kernver="$(</usr/src/linux/version)"

  cd $pkgname-$pkgver
  make -C /lib/modules/$_kernver/build M="$PWD" modules
}

package() {
  local _kernver="$(</usr/src/linux/version)"

  cd $pkgname-$pkgver
  install -Dt "${pkgdir}/usr/lib/modules/${_kernver}/extramodules" -m644 *.ko

  # Copy "acer-wmi-battery.conf" to "modules-load.d" directory
  install -Dm644 /dev/stdin "${pkgdir}"/usr/lib/modules-load.d/acer-wmi-battery.conf <<EOF
# Load Acer battery health driver
acer_wmi_battery
EOF
}

Offline

Board footer

Powered by FluxBB