2010-05-25 02:00:56 +08:00
|
|
|
#
|
|
|
|
# Chakra Packages for Chakra, part of chakra-project.org
|
|
|
|
#
|
|
|
|
# maintainer (i686): Phil Miller <philm[at]chakra-project[dog]org>
|
|
|
|
# maintainer (x86_64): Manuel Tortosa <manutortosa[at]chakra-project[dot]org>
|
|
|
|
|
|
|
|
# include global config
|
|
|
|
source ../_buildscripts/${current_repo}-${_arch}-cfg.conf
|
|
|
|
|
2010-08-08 18:57:30 +08:00
|
|
|
# Find the kernel name inside the chroot
|
|
|
|
_kernver=`pacman -Qf kernel26 | cut -c10-15 | sed 's/kernel26 //g'`-CHAKRA
|
|
|
|
|
2010-05-25 02:00:56 +08:00
|
|
|
pkgname=catalyst
|
2010-11-18 08:05:19 +08:00
|
|
|
pkgver=10.11
|
|
|
|
pkgrel=1
|
2010-10-27 08:36:46 +08:00
|
|
|
pkgdesc="AMD/ATI Catalyst drivers for kernel26. fglrx kernel module only"
|
2010-05-25 02:00:56 +08:00
|
|
|
arch=('i686' 'x86_64')
|
|
|
|
url="http://www.ati.amd.com"
|
|
|
|
license=('custom')
|
2010-10-27 08:36:46 +08:00
|
|
|
depends=('kernel26>=2.6.29' 'kernel26<2.6.37' 'kernel26-headers' "catalyst-utils=${pkgver}" 'gcc-libs' 'gcc>4.0.0' 'make')
|
|
|
|
conflicts=('catalyst-test' 'nvidia' 'xf86-video-ati' 'xf86-video-radeonhd' 'ati-dri')
|
|
|
|
install=${pkgname}.install
|
|
|
|
|
|
|
|
patch_file="fglrx-2.6.36.patch"
|
|
|
|
patch_md5="eb58dbf993dbf8d77924055cc8caaeb6"
|
|
|
|
patch_target="2.6.36"
|
|
|
|
|
|
|
|
source=(
|
|
|
|
http://www2.ati.com/drivers/linux/ati-driver-installer-${pkgver/./-}-x86.x86_64.run
|
|
|
|
makefile_compat.patch
|
|
|
|
${patch_file})
|
|
|
|
|
2010-11-18 08:05:19 +08:00
|
|
|
md5sums=('e2304b649b0894e3a904cd0c45bfbcc3'
|
2010-10-27 08:36:46 +08:00
|
|
|
'3e1b82bd69774ea808da69c983d6a43b'
|
|
|
|
${patch_md5})
|
|
|
|
|
|
|
|
|
2010-05-25 02:00:56 +08:00
|
|
|
|
|
|
|
build() {
|
2010-07-28 19:11:28 +08:00
|
|
|
|
2010-10-27 08:36:46 +08:00
|
|
|
## Unpack archive
|
|
|
|
msg "Unpacking archive ..."
|
|
|
|
/bin/sh ./ati-driver-installer-${pkgver/./-}-x86.x86_64.run --extract archive_files
|
2010-08-08 18:57:30 +08:00
|
|
|
|
2010-10-26 06:36:55 +08:00
|
|
|
|
2010-10-27 08:36:46 +08:00
|
|
|
if [ "${CARCH}" = "x86_64" ]; then
|
|
|
|
BUILDARCH=x86_64
|
|
|
|
_archdir=x86_64
|
|
|
|
fi
|
|
|
|
if [ "${CARCH}" = "i686" ]; then
|
|
|
|
BUILDARCH=i386
|
|
|
|
_archdir=x86
|
|
|
|
fi
|
2010-08-08 18:57:30 +08:00
|
|
|
|
2010-10-27 08:36:46 +08:00
|
|
|
cd "${srcdir}/archive_files/"
|
2010-10-26 06:36:55 +08:00
|
|
|
|
2010-10-27 08:36:46 +08:00
|
|
|
patch -Np1 -i ../makefile_compat.patch || return 1
|
2010-08-08 18:57:30 +08:00
|
|
|
|
2010-10-27 08:36:46 +08:00
|
|
|
patch -Np1 -i ../fglrx-2.6.36.patch || return 1
|
2010-10-20 06:00:11 +08:00
|
|
|
|
2010-08-08 18:57:30 +08:00
|
|
|
|
2010-10-27 08:36:46 +08:00
|
|
|
###--- cut ---### ati's code from their make.sh file
|
2010-08-08 18:57:30 +08:00
|
|
|
|
2010-10-27 08:36:46 +08:00
|
|
|
# Copyright 1999-2005 ATI Technologies Inc., Markham, Ontario, CANADA.
|
|
|
|
# All Rights Reserved.
|
|
|
|
# ==============================================================
|
|
|
|
# resolve if we are running a SMP enabled kernel
|
2010-08-08 18:57:30 +08:00
|
|
|
|
2010-10-27 08:36:46 +08:00
|
|
|
SMP=0
|
2010-08-08 18:57:30 +08:00
|
|
|
|
2010-10-27 08:36:46 +08:00
|
|
|
# 1
|
|
|
|
# grep in OsVersion string for SMP specific keywords
|
|
|
|
OsVersion=`uname -v`
|
2010-08-08 18:57:30 +08:00
|
|
|
|
2010-10-27 08:36:46 +08:00
|
|
|
if [ `echo $OsVersion | grep [sS][mM][pP] -c` -ne 0 ]; then
|
|
|
|
SMP=1
|
|
|
|
echo "OsVersion says: SMP=$SMP"
|
|
|
|
fi
|
2010-08-08 18:57:30 +08:00
|
|
|
|
2010-10-27 08:36:46 +08:00
|
|
|
# 2
|
|
|
|
# grep in /proc/ksyms for SMP specific kernel symbols
|
|
|
|
# use triggerlevel of 10 occurences
|
|
|
|
# (UP kernels might have 0-1, SMP kernels might have 32-45 or much more)
|
2010-08-08 18:57:30 +08:00
|
|
|
|
2010-10-27 08:36:46 +08:00
|
|
|
src_file=/proc/kallsyms
|
2010-08-08 18:57:30 +08:00
|
|
|
|
2010-10-27 08:36:46 +08:00
|
|
|
if [ -e $src_file ]; then
|
|
|
|
if [ `fgrep smp $src_file -c` -gt 10 ]; then
|
|
|
|
SMP=1
|
|
|
|
echo "file $src_file says: SMP=$SMP"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# 3
|
|
|
|
# linux/autoconf.h may contain this: #define CONFIG_SMP 1
|
2010-08-08 18:57:30 +08:00
|
|
|
|
2010-10-27 08:36:46 +08:00
|
|
|
# Before 2.6.33 autoconf.h is under linux/.
|
|
|
|
# For 2.6.33 and later autoconf.h is under generated/.
|
|
|
|
if [ -f /lib/modules/${_kernver}/build/include/generated/autoconf.h ]; then
|
|
|
|
autoconf_h=/lib/modules/${_kernver}/build/include/generated/autoconf.h
|
|
|
|
else
|
|
|
|
autoconf_h=/lib/modules/${_kernver}/build/include/linux/autoconf.h
|
|
|
|
fi
|
|
|
|
src_file=$autoconf_h
|
|
|
|
|
|
|
|
if [ ! -e $src_file ]; then
|
|
|
|
echo "Warning:"
|
|
|
|
echo "kernel includes at /lib/modules/${_kernver}/build/include not found or incomplete"
|
|
|
|
echo "file: $src_file"
|
|
|
|
echo ""
|
|
|
|
else
|
|
|
|
if [ `cat $src_file | grep "#undef" | grep "CONFIG_SMP" -c` = 0 ]; then
|
|
|
|
SMP=`cat $src_file | grep CONFIG_SMP | cut -d' ' -f3`
|
|
|
|
echo "file $src_file says: SMP=$SMP"
|
|
|
|
fi
|
|
|
|
fi
|
2010-08-08 18:57:30 +08:00
|
|
|
|
2010-10-27 08:36:46 +08:00
|
|
|
if [ "$SMP" = 0 ]; then
|
|
|
|
echo "assuming default: SMP=$SMP"
|
2010-08-08 18:57:30 +08:00
|
|
|
fi
|
|
|
|
|
2010-10-27 08:36:46 +08:00
|
|
|
# act on final result
|
|
|
|
if [ ! "$SMP" = 0 ]; then
|
|
|
|
smp="-SMP"
|
|
|
|
def_smp=-D__SMP__
|
2010-08-08 18:57:30 +08:00
|
|
|
fi
|
2010-10-27 08:36:46 +08:00
|
|
|
# ==============================================================
|
|
|
|
# resolve whether we need to set PAGE_ATTR_FIX
|
|
|
|
PAGE_ATTR_FIX=0
|
2010-08-08 18:57:30 +08:00
|
|
|
|
2010-10-27 08:36:46 +08:00
|
|
|
src_file=/proc/kallsyms
|
|
|
|
|
|
|
|
if [ -e $src_file ]; then
|
|
|
|
if [ `fgrep " change_page_attr\$" $src_file -c` -gt 0 ]; then
|
|
|
|
PAGE_ATTR_FIX=1
|
|
|
|
echo "file $src_file says: PAGE_ATTR_FIX=$PAGE_ATTR_FIX"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
# ==============================================================
|
|
|
|
# resolve if we are running a MODVERSIONS enabled kernel
|
|
|
|
|
|
|
|
MODVERSIONS=0
|
|
|
|
|
|
|
|
# autoconf.h may contain this: #define CONFIG_MODVERSIONS 1
|
|
|
|
src_file=$autoconf_h
|
|
|
|
if [ ! -e $src_file ];
|
|
|
|
then
|
|
|
|
echo "Warning:"
|
|
|
|
echo "kernel includes at /lib/modules/${_kernver}/build/include not found or incomplete"
|
|
|
|
echo "file: $src_file"
|
|
|
|
echo ""
|
|
|
|
else
|
|
|
|
if [ `cat $src_file | grep "#undef" | grep "CONFIG_MODVERSIONS" -c` = 0 ]
|
|
|
|
then
|
|
|
|
MODVERSIONS=`cat $src_file | grep CONFIG_MODVERSIONS | cut -d' ' -f3`
|
|
|
|
echo "file $src_file says: MODVERSIONS=$MODVERSIONS"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$MODVERSIONS" = 0 ]
|
|
|
|
then
|
|
|
|
echo "assuming default: MODVERSIONS=$MODVERSIONS"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# act on final result
|
|
|
|
if [ ! "$MODVERSIONS" = 0 ]
|
|
|
|
then
|
|
|
|
def_modversions="-DMODVERSIONS"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# ==============================================================
|
|
|
|
# resolve if we are building for a kernel with a fix for CVE-2010-3081
|
|
|
|
# On kernels with the fix, use arch_compat_alloc_user_space instead
|
|
|
|
# of compat_alloc_user_space since the latter is GPL-only
|
|
|
|
|
|
|
|
COMPAT_ALLOC_USER_SPACE=compat_alloc_user_space
|
|
|
|
|
|
|
|
src_file=/lib/modules/${_kernver}/build/arch/x86/include/asm/compat.h
|
|
|
|
if [ ! -e $src_file ];
|
|
|
|
then
|
|
|
|
echo "Warning:"
|
|
|
|
echo "kernel includes at /lib/modules/${_kernver}/build/include not found or incomplete"
|
|
|
|
echo "file: $src_file"
|
|
|
|
echo ""
|
|
|
|
else
|
|
|
|
if [ `cat $src_file | grep -c arch_compat_alloc_user_space` -gt 0 ]
|
|
|
|
then
|
|
|
|
COMPAT_ALLOC_USER_SPACE=arch_compat_alloc_user_space
|
|
|
|
fi
|
|
|
|
echo "file $src_file says: COMPAT_ALLOC_USER_SPACE=$COMPAT_ALLOC_USER_SPACE"
|
|
|
|
fi
|
|
|
|
# ==============================================================
|
|
|
|
|
|
|
|
###--- cut ---###
|
|
|
|
|
|
|
|
|
|
|
|
cd "${srcdir}/archive_files/common/lib/modules/fglrx/build_mod"
|
|
|
|
cp "${srcdir}/archive_files/arch/${_archdir}/lib/modules/fglrx/build_mod/libfglrx_ip.a.GCC4" . || return 1
|
|
|
|
cp 2.6.x/Makefile . || return 1
|
|
|
|
|
|
|
|
|
|
|
|
## Compiling module
|
|
|
|
make -C /lib/modules/${_kernver}/build SUBDIRS="`pwd`" ARCH=${BUILDARCH} \
|
|
|
|
MODFLAGS="-DMODULE -DATI -DFGL -DPAGE_ATTR_FIX=$PAGE_ATTR_FIX -DCOMPAT_ALLOC_USER_SPACE=$COMPAT_ALLOC_USER_SPACE $def_smp $def_modversions" \
|
|
|
|
PAGE_ATTR_FIX=$PAGE_ATTR_FIX COMPAT_ALLOC_USER_SPACE=$COMPAT_ALLOC_USER_SPACE modules || return 1
|
2010-08-08 18:57:30 +08:00
|
|
|
}
|
2010-10-27 08:36:46 +08:00
|
|
|
|
|
|
|
package() {
|
|
|
|
cd "${srcdir}/archive_files/common/lib/modules/fglrx/build_mod"
|
|
|
|
install -m755 -d "${pkgdir}/lib/modules/${_kernver}/video/" || return 1
|
|
|
|
install -m644 fglrx.ko "${pkgdir}/lib/modules/${_kernver}/video/" || return 1
|
|
|
|
install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
|
|
|
|
|
|
|
|
## License
|
|
|
|
install -m644 "${srcdir}/archive_files/ATI_LICENSE.TXT" "${pkgdir}/usr/share/licenses/${pkgname}/" || return 1
|
|
|
|
|
|
|
|
sed -i -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/" $startdir/*.install
|
|
|
|
}
|