ati_unfree: Cleanup whitespace in builder.sh
This commit is contained in:
parent
6ae760b311
commit
61e29cff68
|
@ -27,111 +27,110 @@ case "$system" in
|
||||||
*) exit 1;;
|
*) exit 1;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Handle/Build the kernel module.
|
||||||
if test -z "$libsOnly"; then
|
if test -z "$libsOnly"; then
|
||||||
kernelVersion=$(cd ${kernel}/lib/modules && ls)
|
|
||||||
kernelBuild=$(echo ${kernel}/lib/modules/$kernelVersion/build)
|
|
||||||
linuxsources=$(echo ${kernel}/lib/modules/$kernelVersion/source)
|
|
||||||
|
|
||||||
|
kernelVersion=$(cd ${kernel}/lib/modules && ls)
|
||||||
|
kernelBuild=$(echo ${kernel}/lib/modules/$kernelVersion/build)
|
||||||
|
linuxsources=$(echo ${kernel}/lib/modules/$kernelVersion/source)
|
||||||
|
|
||||||
# note: maybe the .config file should be used to determine this ?
|
# note: maybe the .config file should be used to determine this ?
|
||||||
# current kbuild infrastructure allows using CONFIG_* defines
|
# current kbuild infrastructure allows using CONFIG_* defines
|
||||||
# but ati sources don't use them yet..
|
# but ati sources don't use them yet..
|
||||||
# copy paste from make.sh
|
# copy paste from make.sh
|
||||||
setSMP(){
|
setSMP(){
|
||||||
|
|
||||||
linuxincludes=$kernelBuild/include
|
linuxincludes=$kernelBuild/include
|
||||||
|
|
||||||
# copied and stripped. source: make.sh:
|
# copied and stripped. source: make.sh:
|
||||||
|
# 3
|
||||||
|
# linux/autoconf.h may contain this: #define CONFIG_SMP 1
|
||||||
|
|
||||||
# 3
|
# Before 2.6.33 autoconf.h is under linux/.
|
||||||
# linux/autoconf.h may contain this: #define CONFIG_SMP 1
|
# For 2.6.33 and later autoconf.h is under generated/.
|
||||||
|
if [ -f $linuxincludes/generated/autoconf.h ]; then
|
||||||
|
autoconf_h=$linuxincludes/generated/autoconf.h
|
||||||
|
else
|
||||||
|
autoconf_h=$linuxincludes/linux/autoconf.h
|
||||||
|
fi
|
||||||
|
src_file=$autoconf_h
|
||||||
|
|
||||||
# Before 2.6.33 autoconf.h is under linux/.
|
[ -e $src_file ] || die "$src_file not found"
|
||||||
# For 2.6.33 and later autoconf.h is under generated/.
|
|
||||||
if [ -f $linuxincludes/generated/autoconf.h ]; then
|
|
||||||
autoconf_h=$linuxincludes/generated/autoconf.h
|
|
||||||
else
|
|
||||||
autoconf_h=$linuxincludes/linux/autoconf.h
|
|
||||||
fi
|
|
||||||
src_file=$autoconf_h
|
|
||||||
|
|
||||||
[ -e $src_file ] || die "$src_file not found"
|
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
|
||||||
|
|
||||||
if [ `cat $src_file | grep "#undef" | grep "CONFIG_SMP" -c` = 0 ]; then
|
if [ "$SMP" = 0 ]; then
|
||||||
SMP=`cat $src_file | grep CONFIG_SMP | cut -d' ' -f3`
|
echo "assuming default: SMP=$SMP"
|
||||||
echo "file $src_file says: SMP=$SMP"
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$SMP" = 0 ]; then
|
# act on final result
|
||||||
echo "assuming default: SMP=$SMP"
|
if [ ! "$SMP" = 0 ]; then
|
||||||
fi
|
smp="-SMP"
|
||||||
|
def_smp=-D__SMP__
|
||||||
|
fi
|
||||||
|
|
||||||
# act on final result
|
}
|
||||||
if [ ! "$SMP" = 0 ]; then
|
|
||||||
smp="-SMP"
|
|
||||||
def_smp=-D__SMP__
|
|
||||||
fi
|
|
||||||
|
|
||||||
}
|
setModVersions(){
|
||||||
|
! grep CONFIG_MODVERSIONS=y $kernelBuild/.config ||
|
||||||
|
def_modversions="-DMODVERSIONS"
|
||||||
|
# make.sh contains much more code to determine this whether its enabled
|
||||||
|
}
|
||||||
|
|
||||||
setModVersions(){
|
# ==============================================================
|
||||||
! grep CONFIG_MODVERSIONS=y $kernelBuild/.config ||
|
# resolve if we are building for a kernel with a fix for CVE-2010-3081
|
||||||
def_modversions="-DMODVERSIONS"
|
# On kernels with the fix, use arch_compat_alloc_user_space instead
|
||||||
# make.sh contains much more code to determine this whether its enabled
|
# of compat_alloc_user_space since the latter is GPL-only
|
||||||
}
|
|
||||||
|
|
||||||
# ==============================================================
|
COMPAT_ALLOC_USER_SPACE=arch_compat_alloc_user_space
|
||||||
# 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=arch_compat_alloc_user_space
|
for src_file in \
|
||||||
|
|
||||||
for src_file in \
|
|
||||||
$kernelBuild/arch/x86/include/asm/compat.h \
|
$kernelBuild/arch/x86/include/asm/compat.h \
|
||||||
$linuxsources/arch/x86/include/asm/compat.h \
|
$linuxsources/arch/x86/include/asm/compat.h \
|
||||||
$kernelBuild/include/asm-x86_64/compat.h \
|
$kernelBuild/include/asm-x86_64/compat.h \
|
||||||
$linuxsources/include/asm-x86_64/compat.h \
|
$linuxsources/include/asm-x86_64/compat.h \
|
||||||
$kernelBuild/include/asm/compat.h;
|
$kernelBuild/include/asm/compat.h;
|
||||||
do
|
do
|
||||||
if [ -e $src_file ];
|
if [ -e $src_file ];
|
||||||
then
|
then
|
||||||
break
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ ! -e $src_file ];
|
||||||
|
then
|
||||||
|
echo "Warning: x86 compat.h not found in kernel headers"
|
||||||
|
echo "neither arch/x86/include/asm/compat.h nor include/asm-x86_64/compat.h"
|
||||||
|
echo "could be found in $kernelBuild or $linuxsources"
|
||||||
|
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
|
fi
|
||||||
done
|
|
||||||
if [ ! -e $src_file ];
|
|
||||||
then
|
|
||||||
echo "Warning: x86 compat.h not found in kernel headers"
|
|
||||||
echo "neither arch/x86/include/asm/compat.h nor include/asm-x86_64/compat.h"
|
|
||||||
echo "could be found in $kernelBuild or $linuxsources"
|
|
||||||
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
|
|
||||||
|
|
||||||
|
# make.sh contains some code figuring out whether to use these or not..
|
||||||
|
PAGE_ATTR_FIX=0
|
||||||
|
setSMP
|
||||||
|
setModVersions
|
||||||
|
CC=gcc
|
||||||
|
MODULE=fglrx
|
||||||
|
LIBIP_PREFIX=$TMP/arch/$arch/lib/modules/fglrx/build_mod
|
||||||
|
[ -d $LIBIP_PREFIX ]
|
||||||
|
GCC_MAJOR="`gcc --version | grep -o -e ") ." | head -1 | cut -d " " -f 2`"
|
||||||
|
|
||||||
# make.sh contains some code figuring out whether to use these or not..
|
{ # build .ko module
|
||||||
PAGE_ATTR_FIX=0
|
cd ./common/lib/modules/fglrx/build_mod/2.6.x
|
||||||
setSMP
|
echo .lib${MODULE}_ip.a.GCC${GCC_MAJOR}.cmd
|
||||||
setModVersions
|
echo 'This is a dummy file created to suppress this warning: could not find /lib/modules/fglrx/build_mod/2.6.x/.libfglrx_ip.a.GCC4.cmd for /lib/modules/fglrx/build_mod/2.6.x/libfglrx_ip.a.GCC4' > lib${MODULE}_ip.a.GCC${GCC_MAJOR}.cmd
|
||||||
CC=gcc
|
|
||||||
MODULE=fglrx
|
|
||||||
LIBIP_PREFIX=$TMP/arch/$arch/lib/modules/fglrx/build_mod
|
|
||||||
[ -d $LIBIP_PREFIX ]
|
|
||||||
GCC_MAJOR="`gcc --version | grep -o -e ") ." | head -1 | cut -d " " -f 2`"
|
|
||||||
|
|
||||||
{ # build .ko module
|
sed -i -e "s@COMPAT_ALLOC_USER_SPACE@$COMPAT_ALLOC_USER_SPACE@" ../kcl_ioctl.c
|
||||||
cd ./common/lib/modules/fglrx/build_mod/2.6.x
|
|
||||||
echo .lib${MODULE}_ip.a.GCC${GCC_MAJOR}.cmd
|
|
||||||
echo 'This is a dummy file created to suppress this warning: could not find /lib/modules/fglrx/build_mod/2.6.x/.libfglrx_ip.a.GCC4.cmd for /lib/modules/fglrx/build_mod/2.6.x/libfglrx_ip.a.GCC4' > lib${MODULE}_ip.a.GCC${GCC_MAJOR}.cmd
|
|
||||||
|
|
||||||
sed -i -e "s@COMPAT_ALLOC_USER_SPACE@$COMPAT_ALLOC_USER_SPACE@" ../kcl_ioctl.c
|
make CC=${CC} \
|
||||||
|
|
||||||
make CC=${CC} \
|
|
||||||
LIBIP_PREFIX=$(echo "$LIBIP_PREFIX" | sed -e 's|^\([^/]\)|../\1|') \
|
LIBIP_PREFIX=$(echo "$LIBIP_PREFIX" | sed -e 's|^\([^/]\)|../\1|') \
|
||||||
MODFLAGS="-DMODULE -DATI -DFGL -DPAGE_ATTR_FIX=$PAGE_ATTR_FIX -DCOMPAT_ALLOC_USER_SPACE=$COMPAT_ALLOC_USER_SPACE $def_smp $def_modversions" \
|
MODFLAGS="-DMODULE -DATI -DFGL -DPAGE_ATTR_FIX=$PAGE_ATTR_FIX -DCOMPAT_ALLOC_USER_SPACE=$COMPAT_ALLOC_USER_SPACE $def_smp $def_modversions" \
|
||||||
KVER=$kernelVersion \
|
KVER=$kernelVersion \
|
||||||
|
@ -139,8 +138,8 @@ GCC_MAJOR="`gcc --version | grep -o -e ") ." | head -1 | cut -d " " -f 2`"
|
||||||
PAGE_ATTR_FIX=$PAGE_ATTR_FIX \
|
PAGE_ATTR_FIX=$PAGE_ATTR_FIX \
|
||||||
-j4
|
-j4
|
||||||
|
|
||||||
cd $TMP
|
cd $TMP
|
||||||
}
|
}
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -162,10 +161,10 @@ fi
|
||||||
|
|
||||||
# install kernel module
|
# install kernel module
|
||||||
if test -z "$libsOnly"; then
|
if test -z "$libsOnly"; then
|
||||||
t=$out/lib/modules/${kernelVersion}/kernel/drivers/misc
|
t=$out/lib/modules/${kernelVersion}/kernel/drivers/misc
|
||||||
mkdir -p $t
|
mkdir -p $t
|
||||||
|
|
||||||
cp ./common/lib/modules/fglrx/build_mod/2.6.x/fglrx.ko $t
|
cp ./common/lib/modules/fglrx/build_mod/2.6.x/fglrx.ko $t
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# should this be installed at all?
|
# should this be installed at all?
|
||||||
|
|
Loading…
Reference in New Issue