| 1 | # Copyright 1999-2004 Gentoo Foundation |
1 | # Copyright 1999-2004 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/linux-mod.eclass,v 1.53 2005/10/22 16:55:17 johnm Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/linux-mod.eclass,v 1.54 2005/10/22 17:35:39 johnm Exp $ |
| 4 | |
4 | |
| 5 | # Description: This eclass is used to interface with linux-info in such a way |
5 | # Description: This eclass is used to interface with linux-info in such a way |
| 6 | # to provide the functionality required and initial functions |
6 | # to provide the functionality required and initial functions |
| 7 | # required to install external modules against a kernel source |
7 | # required to install external modules against a kernel source |
| 8 | # tree. |
8 | # tree. |
| … | |
… | |
| 96 | |
96 | |
| 97 | check_vermagic() { |
97 | check_vermagic() { |
| 98 | local curr_gcc_ver=$(gcc -dumpversion) |
98 | local curr_gcc_ver=$(gcc -dumpversion) |
| 99 | local tmpfile old_chost old_gcc_ver result=0 |
99 | local tmpfile old_chost old_gcc_ver result=0 |
| 100 | |
100 | |
| 101 | tmpfile=`find ${KV_DIR} -iname "*.o.cmd" -exec grep usr/lib/gcc {} \; -quit` |
101 | tmpfile=`find ${KV_DIR}/ -iname "*.o.cmd" -exec grep usr/lib/gcc {} \; -quit` |
| 102 | tmpfile=${tmpfile//*usr/lib} |
102 | tmpfile=${tmpfile//*usr/lib} |
| 103 | tmpfile=${tmpfile//\/include*} |
103 | tmpfile=${tmpfile//\/include*} |
| 104 | old_chost=${tmpfile//*gcc\/} |
104 | old_chost=${tmpfile//*gcc\/} |
| 105 | old_chost=${old_chost//\/*} |
105 | old_chost=${old_chost//\/*} |
| 106 | old_gcc_ver=${tmpfile//*\/} |
106 | old_gcc_ver=${tmpfile//*\/} |
| 107 | |
107 | |
|
|
108 | if [[ -z ${old_gcc_ver} || -z ${old_chost} ]]; then |
|
|
109 | ewarn "" |
|
|
110 | ewarn "Unable to detect what version of GCC was used to compile" |
|
|
111 | ewarn "the kernel. Build will continue, but you may experience problems." |
| 108 | if [[ ${curr_gcc_ver} != ${old_gcc_ver} ]]; then |
112 | elif [[ ${curr_gcc_ver} != ${old_gcc_ver} ]]; then |
| 109 | ewarn "" |
113 | ewarn "" |
| 110 | ewarn "The version of GCC you are using (${curr_gcc_ver}) does" |
114 | ewarn "The version of GCC you are using (${curr_gcc_ver}) does" |
| 111 | ewarn "not match the version of GCC used to compile the" |
115 | ewarn "not match the version of GCC used to compile the" |
| 112 | ewarn "kernel (${old_gcc_ver})." |
116 | ewarn "kernel (${old_gcc_ver})." |
| 113 | result=1 |
117 | result=1 |
| 114 | elif [[ ${CHOST} != ${old_chost} ]]; then |
118 | elif [[ ${CHOST} != ${old_chost} ]]; then |
| 115 | ewarn "" |
119 | ewarn "" |
| 116 | ewarn "The current CHOST (${CHOST}) does not match the chost" |
120 | ewarn "The current CHOST (${CHOST}) does not match the chost" |
| 117 | ewarn "used when compiling the kernel (${old_chost})." |
121 | ewarn "used when compiling the kernel (${old_chost})." |
| 118 | result=1 |
122 | result=1 |
| 119 | elif [[ -z ${old_gcc_ver} || -z ${old_chost} ]]; then |
|
|
| 120 | ewarn "" |
|
|
| 121 | ewarn "Unable to detect what version of GCC was used to compile" |
|
|
| 122 | ewarn "the kernel. Build will continue, but you may experience problems." |
|
|
| 123 | fi |
123 | fi |
| 124 | |
124 | |
| 125 | if [[ ${result} -gt 0 ]]; then |
125 | if [[ ${result} -gt 0 ]]; then |
| 126 | ewarn "" |
126 | ewarn "" |
| 127 | ewarn "Build will not continue, because you will experience problems." |
127 | ewarn "Build will not continue, because you will experience problems." |
| … | |
… | |
| 275 | |
275 | |
| 276 | generate_modulesd() { |
276 | generate_modulesd() { |
| 277 | # This function will generate the neccessary modules.d file from the |
277 | # This function will generate the neccessary modules.d file from the |
| 278 | # information contained in the modules exported parms |
278 | # information contained in the modules exported parms |
| 279 | |
279 | |
| 280 | local currm_path currm t myIFS myVAR |
280 | local currm_path currm currm_t t myIFS myVAR |
| 281 | local module_docs module_enabled module_aliases \ |
281 | local module_docs module_enabled module_aliases \ |
| 282 | module_additions module_examples module_modinfo module_opts |
282 | module_additions module_examples module_modinfo module_opts |
| 283 | |
283 | |
| 284 | for currm_path in ${@} |
284 | for currm_path in ${@} |
| 285 | do |
285 | do |
| 286 | currm=${currm_path//*\/} |
286 | currm=${currm_path//*\/} |
| 287 | currm=$(echo ${currm} | tr '[:lower:]' '[:upper:]') |
287 | currm=$(echo ${currm} | tr '[:lower:]' '[:upper:]') |
|
|
288 | currm_t=${currm} |
|
|
289 | while [[ -z ${currm_t//*-*} ]]; do |
|
|
290 | currm_t=${currm_t/-/_} |
|
|
291 | done |
| 288 | |
292 | |
| 289 | module_docs="$(eval echo \${MODULESD_${currm}_DOCS})" |
293 | module_docs="$(eval echo \${MODULESD_${currm_t}_DOCS})" |
| 290 | module_enabled="$(eval echo \${MODULESD_${currm}_ENABLED})" |
294 | module_enabled="$(eval echo \${MODULESD_${currm_t}_ENABLED})" |
| 291 | module_aliases="$(eval echo \${#MODULESD_${currm/-/_}_ALIASES[*]})" |
295 | module_aliases="$(eval echo \${#MODULESD_${currm_t}_ALIASES[*]})" |
| 292 | module_additions="$(eval echo \${#MODULESD_${currm/-/_}_ADDITIONS[*]})" |
296 | module_additions="$(eval echo \${#MODULESD_${currm_t}_ADDITIONS[*]})" |
| 293 | module_examples="$(eval echo \${#MODULESD_${currm/-/_}_EXAMPLES[*]})" |
297 | module_examples="$(eval echo \${#MODULESD_${currm_t}_EXAMPLES[*]})" |
| 294 | |
298 | |
| 295 | [[ ${module_aliases} -eq 0 ]] && unset module_aliases |
299 | [[ ${module_aliases} -eq 0 ]] && unset module_aliases |
| 296 | [[ ${module_additions} -eq 0 ]] && unset module_additions |
300 | [[ ${module_additions} -eq 0 ]] && unset module_additions |
| 297 | [[ ${module_examples} -eq 0 ]] && unset module_examples |
301 | [[ ${module_examples} -eq 0 ]] && unset module_examples |
| 298 | |
302 | |