You are not logged in.

#1 2007-05-28 12:32:01

hacosta
Member
From: Mexico
Registered: 2006-10-22
Posts: 423

PKGBUILD for modules compiled against a custom kernel

i usually run stock kernels but i was a bit bored so i compiled my own today, i was thinking, it would be nice if i could still use pacman to get my modules so i came up with this, it basically abuses the .install file


PKGBUILD:

# Maintainer: hector acosta <hector.acosta@gmail.com> ||
_kernver=`uname -r`
pkgname=ipw3945-custom
pkgver=1.2.1
pkgrel=3
pkgdesc="Driver for the Intel PRO/Wireless 3945ABG. Compiled at install time against running kernel."
arch=(i686 x86_64)
url="http://ipw3945.sourceforge.net"
license="GPL"
depends=('wireless_tools' 'ipw3945-ucode' 'ipw3945d')
install=ipw3945.install
source=(http://dl.sourceforge.net/sourceforge/ipw3945/ipw3945-$pkgver.tgz)

build() {
  touch $startdir/src/dummy
  install -D -m 644 $startdir/src/dummy $startdir/pkg/lib/modules/${_kernver}/kernel/drivers/net/wireless/ipw3945.ko
  cp -rf $startdir/src/ipw3945-$pkgver /tmp  &>/dev/null #not perfect i know.. suggestions?
}

md5sums=('9d6b2116122beb33a0d1d923ea49065c')

ipw3945.install

# arg 1:  the new package version
post_install() {
  cd /tmp/ipw3945-1.2.1

  echo " ==> compiling! "
  make &> /dev/null && \
  make install &>/dev/null && \
  echo "==> success! " || \
  echo "install failed, please remove this package"

  rm -r /tmp/ipw3945-1.2.1
}

post_upgrade(){
  post_install $1
}

op=$1
shift
$op $*

disadvantages:
-> a bit hackish
-> it can fail for many reasons (wrong kernel options, old kernel, other compiler)
-> it is unsafe (unsafe as in, it writes directly to filesystem)

advantages:
-> i think it's simple
-> provides an easy way for people with custom kernel to get their modules
-> most importantly, an initscript which checks if you are still running a kernel and updates the module accordingly is trivial (maybe i can work on it tomorrow)

ideas? suggestions?

Offline

Board footer

Powered by FluxBB