You are not logged in.
I got bored, and thought of this ages ago. I have no use for it now, but i'm sure someone else will.
run:
abs-module $modulename $kernel
$modulename is any kernel module that's available in /var/abs, so if you have some that arent in a default abs, put em in /var/abs/local and they will be spotted by this.
$kernel is the name of the kernel that you want to compile for. this can be found with 'uname -r'. If $kernel is not specified, then it will default to what you are running now.
this will only work for module packages that have a variable called _kernver which sets the kernel it will be compiled for. I know all the winmodems, ATi and drivers I maintain do, not sure about some of the others. nvidia won't work.
#! /bin/bash
# Set the variables up
module="$1"
kernel="$2"
pacman="1"
current="`uname -r`"
# Check things
if [ -z "$module" ]; then
echo "No module specified"
return 1
fi
if [ -z "$kernel" ]; then
echo "No kernel specified, building for: $current"
kernel="$current"
fi
if [ ! -e "/lib/modules/$kernel/build" ]; then
echo "Specified kernel is not installed"
return 1
fi
# Check if module exists
origdir="`find /var/abs -type d -name $module`"
if [ -z "$origdir" ]; then
echo "Specified module does not exist"
return 1
fi
# Prepare to build
newdir="/var/abs/local/$module-$kernel"
if [ -d "$newdir" ]; then
rm -rf "$newdir"
fi
cp -R $origdir $newdir
cd $newdir
source PKGBUILD
if [ -z "$_kernver" ]; then
echo "PKGBUILD does not have $_kernver."
return 1
fi
sed "s/$_kernver/$kernel/g" -i PKGBUILD
sed "s/pkgname=$pkgname/pkgname=$pkgname-$kernel/g" -i PKGBUILD
# Build!
makepkg
# Post build messages/install
if [ $? = 0 ]; then
package="`find $newdir -name *pkg.tar.gz`"
# variable is at top
if [ "$pacman" = "1" ]; then
pacman -U $package
else
echo "Package is ready to install: $package"
fi
else
echo "Build failed"
fi
sorry if there's any stupid bash in there, i'm tired. and yeah, I know it's a tad verbose and spacy, but it seems to works fine.
James
Offline
Iphitus > I'm looking 4 something like your script that will allow me to load spca5xx when running my custom kernelbeyond
Unfortunetely spca5xx seems not to be manageable by your abs-module script, as its PKGBUILD doesn't have a variable called _kernver.
Log :
/usr/bin/abs-make-module spca5xx
No kernel specified, building for: 2.6.17-beyond-LLEWELLYN
PKGBUILD does not have .
/usr/bin/abs-make-module: line 52: return: can only `return' from a function or sourced script
sed: -e expression #1, char 0: no previous regular expression
==> Making package: spca5xx-2.6.17-beyond-LLEWELLYN 0.60.00-2 (Sun Jul 23 11:44:52 CEST 2006)(...)
==> Validating source files with MD5sums
spca5xx-20060501.tar.gz ... Passed
==> Extracting Sources...
==> tar --use-compress-program=gzip -xf spca5xx-20060501.tar.gz
tar: spca5xx-20060501/drivers: implausibly old time stamp 1970-01-01 01:00:00
==> Starting build()...
./PKGBUILD: line 13: cd: /var/abs/local/spca5xx-2.6.17-beyond-LLEWELLYN/src/spca5xx-2.6.17-beyond-LLEWELLYN-20060501: No such file or directory
make: *** No targets specified and no makefile found. Stop.
==> ERROR: Build Failed. Aborting...
Build failed
Seeded last month: Arch 50 gig, derivatives 1 gig
Desktop @3.3GHz 8 gig RAM, linux-ck
laptop #1 Atom 2 gig RAM, Arch linux stock i686 (6H w/ 6yrs old battery ) #2: ARM Tegra K1, 4 gig RAM, ChrOS
Atom Z520 2 gig RAM, OMV (Debian 7) kernel 3.16 bpo on SDHC | PGP Key: 0xFF0157D9
Offline
By default, spca5xx uses `uname -r` to build the module for the running kernel, so I'd say you'd be better off getting the PKGBUILD and install files from abs and just building it with makepkg.
Incidentally, _kernver could be implemented for this module as follows:
- in the variables section of the PKGBUILD, set
_kernver=<your_kernel_version>
- in the build() function, change
make || return 1
to
make KINCLUDE=/usr/src/linux-${_kernver}/include || return 1
If it bothers you a lot, suggest it in a comment.
Offline