| 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.52 2005/09/22 14:13:36 johnm Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/linux-mod.eclass,v 1.53 2005/10/22 16:55:17 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. |
| … | |
… | |
| 91 | sys-apps/sed |
91 | sys-apps/sed |
| 92 | pcmcia? ( virtual/pcmcia )" |
92 | pcmcia? ( virtual/pcmcia )" |
| 93 | |
93 | |
| 94 | # eclass utilities |
94 | # eclass utilities |
| 95 | # ---------------------------------- |
95 | # ---------------------------------- |
|
|
96 | |
|
|
97 | check_vermagic() { |
|
|
98 | local curr_gcc_ver=$(gcc -dumpversion) |
|
|
99 | local tmpfile old_chost old_gcc_ver result=0 |
|
|
100 | |
|
|
101 | tmpfile=`find ${KV_DIR} -iname "*.o.cmd" -exec grep usr/lib/gcc {} \; -quit` |
|
|
102 | tmpfile=${tmpfile//*usr/lib} |
|
|
103 | tmpfile=${tmpfile//\/include*} |
|
|
104 | old_chost=${tmpfile//*gcc\/} |
|
|
105 | old_chost=${old_chost//\/*} |
|
|
106 | old_gcc_ver=${tmpfile//*\/} |
|
|
107 | |
|
|
108 | if [[ ${curr_gcc_ver} != ${old_gcc_ver} ]]; then |
|
|
109 | ewarn "" |
|
|
110 | ewarn "The version of GCC you are using (${curr_gcc_ver}) does" |
|
|
111 | ewarn "not match the version of GCC used to compile the" |
|
|
112 | ewarn "kernel (${old_gcc_ver})." |
|
|
113 | result=1 |
|
|
114 | elif [[ ${CHOST} != ${old_chost} ]]; then |
|
|
115 | ewarn "" |
|
|
116 | ewarn "The current CHOST (${CHOST}) does not match the chost" |
|
|
117 | ewarn "used when compiling the kernel (${old_chost})." |
|
|
118 | 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 |
|
|
124 | |
|
|
125 | if [[ ${result} -gt 0 ]]; then |
|
|
126 | ewarn "" |
|
|
127 | ewarn "Build will not continue, because you will experience problems." |
|
|
128 | ewarn "To fix this either change the version of GCC you wish to use" |
|
|
129 | ewarn "to match the kernel, or recompile the kernel first." |
|
|
130 | die "GCC Version Mismatch." |
|
|
131 | fi |
|
|
132 | } |
| 96 | |
133 | |
| 97 | unpack_pcmcia_sources() { |
134 | unpack_pcmcia_sources() { |
| 98 | # So while the two eclasses exist side-by-side and also the ebuilds inherit |
135 | # So while the two eclasses exist side-by-side and also the ebuilds inherit |
| 99 | # both we need to check for PCMCIA_SOURCE_DIR, and if we find it, then we |
136 | # both we need to check for PCMCIA_SOURCE_DIR, and if we find it, then we |
| 100 | # bail out and assume pcmcia.eclass is working on it. |
137 | # bail out and assume pcmcia.eclass is working on it. |
| … | |
… | |
| 420 | linux-mod_pkg_setup() { |
457 | linux-mod_pkg_setup() { |
| 421 | linux-info_pkg_setup; |
458 | linux-info_pkg_setup; |
| 422 | check_kernel_built; |
459 | check_kernel_built; |
| 423 | check_modules_supported; |
460 | check_modules_supported; |
| 424 | set_kvobj; |
461 | set_kvobj; |
|
|
462 | check_vermagic; |
| 425 | } |
463 | } |
| 426 | |
464 | |
| 427 | linux-mod_src_compile() { |
465 | linux-mod_src_compile() { |
| 428 | local modulename libdir srcdir objdir i n myARCH="${ARCH}" |
466 | local modulename libdir srcdir objdir i n myARCH="${ARCH}" |
| 429 | ARCH="$(tc-arch-kernel)" |
467 | ARCH="$(tc-arch-kernel)" |