Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Opinion of packaging 3rd party kernel modules
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
maxf130
n00b
n00b


Joined: 04 Apr 2015
Posts: 8
Location: UK

PostPosted: Fri Feb 15, 2019 11:32 am    Post subject: Opinion of packaging 3rd party kernel modules Reply with quote

Hi All,

TL;DR: What is the communities opinion on packaging of 3rd party, out of tree kernel modules?

Should there be ebuilds in the main repository?
Should there be ebuilds in an overlay? Just posted in the forums?
Should we just copy the sources to /usr/src and use DKMS?

Background

I have an inexpensive usb WiFi adapter. Like most of these things it uses a Realtek chipset that is not supported by the mainline kernel (or that realtek does not provide linux support for). There are however a largish number of (3rd party?) drivers on github that support it just fine. It is trivial enough to clone, compile and install one of these drivers. This is however not elegant. It would be good if the module could be recompiled automatically when a new kernel is installed. It would also be good if portage were aware of it's existance.

I've written an ebuild for this driver.

Actual Question

I would like this ebuild to be easily available for other people to install as this chipset seems to be fairly common in cheap wifi adapters. The question is: What is the best way to achieve this?

I would just submit a PR/Bug Report with the new ebuild but I'm not sure it would be accepted. There are some 3rd party kernel modules in the main repository, for example wireguard and the VirtualBox module. However these modules are necessary for software with a large userbase or written by people with a reputation in Linux development and are likely to be around for the foreeable future. This WiFi driver is written by some developer on github with no guarantee that it will still be around tomorrow.

Should something like this go in the repository? The obvious alternative is an overlay.

As an aside, what category should this go in? net-wireless?

Thanks for you input

PS. This question is meant to be generic, ie not specific to the particular kernel module/driver. For the sake of completeness I have included the ebuild in question below:

Code:

# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6

MODULES_OPTIONAL_USE="module"
inherit linux-mod bash-completion-r1

DESCRIPTION="Driver module for Realtek 8811, 8812, 8814 and 8821 chipsets. From aircrack-ng"
HOMEPAGE="https://github.com/aircrack-ng/rtl8812au.git"

if [[ ${PV} == 9999 ]]; then
   inherit git-r3
   EGIT_REPO_URI="https://github.com/aircrack-ng/rtl8812au"
   KEYWORDS=""
else
   die "Only support building directly from git for now"
fi

LICENSE="GPL-2"
SLOT="0"
IUSE="+module module-src"

MODULE_NAMES="88XXau(kernel/drivers/net/wireless)"
BUILD_TARGETS="modules"
CONFIG_CHECK=""

pkg_setup() {
   if use module; then
      linux-mod_pkg_setup
      kernel_is -lt 3 10 0 && die "This version of ${PN} requires Linux >= 3.10"
   fi
}

src_compile() {
   BUILD_PARAMS="KERNELDIR=${KERNEL_DIR}"
   use module && linux-mod_src_compile
}

src_install() {
   use module && linux-mod_src_install
   use module-src && dodir /usr/src && cp -r "${S}" "${ED}/usr/src/${PN}"
}

pkg_postinst() {
   if use module-src && ! use module; then
      einfo
      einfo "You have enabled the module-src USE flag without the module USE"
      einfo "flag. This means that sources are installed to"
      einfo "${ROOT}usr/src/88XXau instead of having the"
      einfo "kernel module compiled. You will need to compile the module"
      einfo "yourself. Most likely, you don't want this USE flag, and should"
      einfo "rather use USE=module"
      einfo
   fi
   use module && linux-mod_pkg_postinst

   if use module; then
      local old new
      if [[ $(uname -r) != "${KV_FULL}" ]]; then
         ewarn
         ewarn "You have just built the rtl8812AU driver for kernel ${KV_FULL}, yet the currently running"
         ewarn "kernel is $(uname -r). If you intend to use this driver module on the currently"
         ewarn "running machine, you will first need to reboot it into the kernel ${KV_FULL}, for"
         ewarn "which this module was built."
         ewarn
      elif [[ -f /sys/module/88XXau/version ]] && \
           old="$(< /sys/module/88XXau/version)" && \
           new="$(modinfo -F version "${ROOT}/lib/modules/${KV_FULL}/net/wireless/88XXau.ko" 2>/dev/null)" && \
           [[ $old != "$new" ]]; then
         ewarn
         ewarn "You appear to have just upgraded rtl8812AU from version v$old to v$new."
         ewarn "However, the old version is still running on your system. In order to use the"
         ewarn "new version, you will need to remove the old module and load the new one. As"
         ewarn "root, you can accomplish this with the following commands:"
         ewarn
         ewarn "    # rmmod 88XXau"
         ewarn "    # modprobe 88XXau"
         ewarn
      fi
   fi
}


Note that this ebuild is based on the ebuild for wireguard
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 6051
Location: Removed by Neddy

PostPosted: Fri Feb 15, 2019 7:13 pm    Post subject: Reply with quote

I would always aim to make an ebuild as it means the removal and upgrade is controlled.
Likewise there then exists the minimum needed for it to be an official package.

Whether it should be in gentoo's official tree, some community overlay or your private overlay is a different discussion. If there is a wider need then centrally carried by gentoo would make sense.
_________________
Quote:
Removed by Chiitoo
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum