You are not logged in.

#1 2010-08-07 02:57:58

lowie82ph
Member
Registered: 2008-08-10
Posts: 22

phc-k8 PKGBUILD

Hi,

Is it possible to modify the PKGBUILD of phc-k8 in AUR so that the module will be built for all installed kernel? If yes, how?

Thank you.

Offline

#2 2010-08-07 06:39:50

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: phc-k8 PKGBUILD

Have a look at nvidia-all in the AUR - it builds modules for multiple kernels, so you can adapt the phc build accordingly.

Offline

#3 2010-08-07 12:50:29

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,362

Re: phc-k8 PKGBUILD

I did something similar for phc-intel (nvidia-all is actually a clone of my nvidia-beta-all package). It works, generally. You can modify to suit yourself of course. Here's the PKGBUILD and phc-intel.install. Modify as you wish.

# Maintainer: fs4000 <matthias_dienstbier[at]yahoo[dot]de>
# Maintainer: trapanator <trap[at]trapanator[dot]com>
# Maintainer: tomprogrammer <Thomas-Bahn[at]gmx[dot]net>

pkgname=phc-intel
pkgver=0.3.2
pkgrel=12
_pkgrel=$pkgrel-1
pkgdesc="frequency driver for Intel CPUs with undervolting feature"
url="http://www.linux-phc.org"
arch=('i686' 'x86_64')
license=('GPL')
depends=('kernel26>=2.6.33' 'kernel26<2.6.35')
makedepends=('kernel26-headers>=2.6.33' 'kernel26-headers<2.6.35')
provides=('linux-phc')
[ "$pkgname" = "phc-intel" ] && backup=(etc/modprobe.d/phc-intel.conf)
options=(!makeflags)
install=phc-intel.install
source=(phc-intel-$pkgver-$_pkgrel.tar.gz::$url/forum/download/file.php?id=94)
md5sums=('0f55f583f9b62b0f6812a3cd2fd24680')

build() {
#    sed "s/depmod.*/depmod `uname -r`/" -i ../$install
    cd phc-intel-$pkgver-$_pkgrel
for KERNEL in `file /boot/* | grep 'Linux kernel.*boot executable' | sed 's/.*version \([^ ]\+\).*/\1/'`;
do
echo Building module for $KERNEL
sed -i 's/`uname -r`/'$KERNEL'/' Makefile
    sed -i 's| /etc/modprobe.d/phc-intel.conf| ${DESTDIR}/etc/modprobe.d/phc-intel.conf|' Makefile
    sed -i 's|^\tdepmod $(KERNELVERSION) -a|#\tdepmod $(KERNELVERSION) -a|' Makefile
    make || return 1
    install -d "$pkgdir/etc/modprobe.d"
    make DESTDIR="$pkgdir" install || return 1
sed -i 's/'$KERNEL'/`uname -r`/' Makefile
done
    # delete the config if we build for another kernel
    [ "$pkgname" = "phc-intel" ] || rm -r "$pkgdir/etc"
}
post_install()
{
  updmoddep
}

post_upgrade()
{
  updmoddep
}

post_remove()
{
  updmoddep
}

updmoddep()
{
  echo Updating Module Dependencies...
for KERNEL in `file /boot/* | grep 'Linux kernel.*boot executable' | sed 's/.*version \([^ ]\+\).*/\1/'`;
  do
  depmod $KERNEL
done
}

Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#4 2010-08-15 02:50:45

lowie82ph
Member
Registered: 2008-08-10
Posts: 22

Re: phc-k8 PKGBUILD

I tried modifying the phc-k8 PKGBUILD based on ngoonee's PKGBUILD, and I came up with this:

# Contributor: fs4000 <matthias_dienstbier[at]yahoo[dot]de>

pkgname=phc-k8
pkgver=0.4.2
pkgrel=4
pkgdesc="frequency driver for AMD K8 with undervolting feature"
url="http://www.linux-phc.org"
arch=('i686' 'x86_64')
license=('GPL')
makedepends=('kernel26-headers')
provides=('linux-phc')
[ "$pkgname" = "phc-k8" ] && backup=(etc/modprobe.d/phc-k8.conf)
install=phc-k8.install
source=(phc-k8-$pkgver.tar.gz::$url/forum/download/file.php?id=83)
md5sums=('41c63322ed041467433cc6abdd6e5bf2')

build() {
    cd phc-k8_v$pkgver
    for KERNEL in `file /boot/* | grep 'Linux kernel.*boot executable' | sed 's/.*version \([^ ]\+\).*/\1/'`;
    do
        echo Building module for $KERNEL
        sed -i 's|\([^=]\) /lib/modules/|\1 ${DESTDIR}/lib/modules/|' Makefile
    sed -i 's|^\tdepmod $(KERNELVERSION) -a|#\tdepmod $(KERNELVERSION) -a|' Makefile
        # Fix kernels 2.6.33 and later
    [ `$KERNEL | head -c6 | tail -c2` -ge 33 ] && sed -i 's|/include/linux/utsrelease.h|/include/generated/utsrelease.h|' Makefile
        make || return 1
        install -d "$pkgdir/etc/modprobe.d"
        make DESTDIR="$pkgdir" install || return 1
        #sed -i 's/'$KERNEL'/`uname -r`/' Makefile
    done
    # delete the config if we build for another kernel
    if [ "$pkgname" = "phc-k8" ]; then
      install -d "$pkgdir/usr/share/doc/phc-k8/"
      install -m644 {Changelog,README} "$pkgdir/usr/share/doc/phc-k8/"
    else
      # delete the config if we build for another kernel
      rm -r "$pkgdir/etc"
    fi
}

However, it returned these errors:

lowie ~/builds/phc-k8  $  makepkg 
==> Making package: phc-k8 0.4.2-4 (Sun Aug 15 10:57:11 PHT 2010)
==> Checking Runtime Dependencies...
==> Checking Buildtime Dependencies...
==> Retrieving Sources...
  -> Found phc-k8-0.4.2.tar.gz
==> Validating source files with md5sums...
    phc-k8-0.4.2.tar.gz ... Passed
==> Extracting Sources...
  -> Extracting phc-k8-0.4.2.tar.gz with bsdtar
==> Removing existing pkg/ directory...
==> Entering fakeroot environment...
==> Starting build()...
Building module for 2.6.34-ARCH
/home/lowie/builds/phc-k8/PKGBUILD: line 25: 2.6.34-ARCH: command not found
/home/lowie/builds/phc-k8/PKGBUILD: line 25: [: -ge: unary operator expected
awk: (FILENAME=/lib/modules/2.6.34-zen2-ARCH-20100727-stable-06672-g3819da9/build/include/linux/version.h FNR=2) fatal: cannot open file `/lib/modules/2.6.34-zen2-ARCH-20100727-stable-06672-g3819da9/build/include/linux/utsrelease.h' for reading (No such file or directory)
Makefile:18: *** Kernel version not found, maybe you need to install appropriate kernel-headers or run make with KERNELSRC parameter, e.g.: make KERNELSRC=/usr/src/linux.  Stop.
    Aborting..

Please tell me what's wrong in the PKGBUILD.

Thank you

Last edited by lowie82ph (2010-08-15 02:58:50)

Offline

#5 2010-08-15 02:55:47

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,362

Re: phc-k8 PKGBUILD

You need to do some sleuthing, basically run the commands line by line and see if the output is as expected. Just copy-pasting would not give you a functional PKGBUILD I'm sure, since there are sure to be differences in the build systems.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

Board footer

Powered by FluxBB