2 ### Vi0L0: it is ati's code from their make.sh file, modified a bit to fit our arch linux system, used inside catalyst_build_module script
4 # Copyright 1999-2005 ATI Technologies Inc., Markham, Ontario, CANADA.
7 # Your use and or redistribution of this software in source and \ or
8 # binary form, with or without modification, is subject to: (i) your
9 # ongoing acceptance of and compliance with the terms and conditions of
10 # the ATI Technologies Inc. software End User License Agreement; and (ii)
11 # your inclusion of this notice in any version of this software that you
12 # use or redistribute. A copy of the ATI Technologies Inc. software End
13 # User License Agreement is included with this software and is also
14 # available by contacting ATI Technologies Inc. at http://www.ati.com
19 # ==============================================================
20 # resolve if we are running a SMP enabled kernel
25 # grep in OsVersion string for SMP specific keywords
28 if [ `echo $OsVersion | grep [sS][mM][pP] -c` -ne 0 ]; then
30 echo "OsVersion says: SMP=$SMP"
34 # grep in /proc/ksyms for SMP specific kernel symbols
35 # use triggerlevel of 10 occurences
36 # (UP kernels might have 0-1, SMP kernels might have 32-45 or much more)
38 src_file
=/proc
/kallsyms
40 if [ -e $src_file ]; then
41 if [ `fgrep smp $src_file -c` -gt 10 ]; then
43 echo "file $src_file says: SMP=$SMP"
48 # linux/autoconf.h may contain this: #define CONFIG_SMP 1
50 # Before 2.6.33 autoconf.h is under linux/.
51 # For 2.6.33 and later autoconf.h is under generated/.
52 if [ -f /lib
/modules
/${kernver}/build
/include
/generated
/autoconf.h
]; then
53 autoconf_h
=/lib
/modules
/${kernver}/build
/include
/generated
/autoconf.h
55 autoconf_h
=/lib
/modules
/${kernver}/build
/include
/linux
/autoconf.h
59 if [ ! -e $src_file ]; then
61 echo "kernel includes at /lib/modules/${kernver}/build/include not found or incomplete"
62 echo "file: $src_file"
65 if [ `cat $src_file | grep "#undef" | grep "CONFIG_SMP" -c` = 0 ]; then
66 SMP
=`cat $src_file | grep CONFIG_SMP | cut -d' ' -f3`
67 echo "file $src_file says: SMP=$SMP"
71 if [ "$SMP" = 0 ]; then
72 echo "assuming default: SMP=$SMP"
76 if [ ! "$SMP" = 0 ]; then
80 # ==============================================================
81 # resolve whether we need to set PAGE_ATTR_FIX
84 src_file
=/proc
/kallsyms
86 if [ -e $src_file ]; then
87 if [ `fgrep " change_page_attr\$" $src_file -c` -gt 0 ]; then
89 echo "file $src_file says: PAGE_ATTR_FIX=$PAGE_ATTR_FIX"
92 # ==============================================================
93 # resolve if we are running a MODVERSIONS enabled kernel
97 # autoconf.h may contain this: #define CONFIG_MODVERSIONS 1
99 if [ ! -e $src_file ];
102 echo "kernel includes at /lib/modules/${kernver}/build/include not found or incomplete"
103 echo "file: $src_file"
106 if [ `cat $src_file | grep "#undef" | grep "CONFIG_MODVERSIONS" -c` = 0 ]
108 MODVERSIONS
=`cat $src_file | grep CONFIG_MODVERSIONS | cut -d' ' -f3`
109 echo "file $src_file says: MODVERSIONS=$MODVERSIONS"
113 if [ "$MODVERSIONS" = 0 ]
115 echo "assuming default: MODVERSIONS=$MODVERSIONS"
118 # act on final result
119 if [ ! "$MODVERSIONS" = 0 ]
121 def_modversions
="-DMODVERSIONS"
124 # ==============================================================
125 # resolve if we are building for a kernel with a fix for CVE-2010-3081
126 # On kernels with the fix, use arch_compat_alloc_user_space instead
127 # of compat_alloc_user_space since the latter is GPL-only
129 COMPAT_ALLOC_USER_SPACE
=compat_alloc_user_space
131 src_file
=/lib
/modules
/${kernver}/build
/arch
/x86
/include
/asm
/compat.h
132 if [ ! -e $src_file ];
135 echo "kernel includes at /lib/modules/${kernver}/build/include not found or incomplete"
136 echo "file: $src_file"
139 if [ `cat $src_file | grep -c arch_compat_alloc_user_space` -gt 0 ]
141 COMPAT_ALLOC_USER_SPACE
=arch_compat_alloc_user_space
143 echo "file $src_file says: COMPAT_ALLOC_USER_SPACE=$COMPAT_ALLOC_USER_SPACE"