/[gentoo-x86]/eclass/kernel-2.eclass
Gentoo

Diff of /eclass/kernel-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.216 Revision 1.227
1# Copyright 1999-2005 Gentoo Foundation 1# Copyright 1999-2009 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/kernel-2.eclass,v 1.216 2008/11/13 23:50:55 mpagano Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/kernel-2.eclass,v 1.227 2010/04/26 06:46:25 robbat2 Exp $
4 4
5# Description: kernel.eclass rewrite for a clean base regarding the 2.6 5# Description: kernel.eclass rewrite for a clean base regarding the 2.6
6# series of kernel with back-compatibility for 2.4 6# series of kernel with back-compatibility for 2.4
7# 7#
8# Original author: John Mylchreest <johnm@gentoo.org> 8# Original author: John Mylchreest <johnm@gentoo.org>
72if [[ ${CTARGET} == ${CHOST} && ${CATEGORY/cross-} != ${CATEGORY} ]]; then 72if [[ ${CTARGET} == ${CHOST} && ${CATEGORY/cross-} != ${CATEGORY} ]]; then
73 export CTARGET=${CATEGORY/cross-} 73 export CTARGET=${CATEGORY/cross-}
74fi 74fi
75 75
76HOMEPAGE="http://www.kernel.org/ http://www.gentoo.org/ ${HOMEPAGE}" 76HOMEPAGE="http://www.kernel.org/ http://www.gentoo.org/ ${HOMEPAGE}"
77# Reflect that kernels contain firmware blobs unless otherwise stripped
78[[ -z ${LICENSE} ]] && \
77LICENSE="GPL-2" 79 LICENSE="GPL-2 freedist"
78 80
79# No need to run scanelf/strip on kernel sources/headers (bug #134453). 81# No need to run scanelf/strip on kernel sources/headers (bug #134453).
80RESTRICT="binchecks strip" 82RESTRICT="binchecks strip"
81 83
82# set LINUX_HOSTCFLAGS if not already set 84# set LINUX_HOSTCFLAGS if not already set
92 debug-print "PVR: ${PVR}" 94 debug-print "PVR: ${PVR}"
93 debug-print "CKV: ${CKV}" 95 debug-print "CKV: ${CKV}"
94 debug-print "OKV: ${OKV}" 96 debug-print "OKV: ${OKV}"
95 debug-print "KV: ${KV}" 97 debug-print "KV: ${KV}"
96 debug-print "KV_FULL: ${KV_FULL}" 98 debug-print "KV_FULL: ${KV_FULL}"
99 debug-print "KV_MAJOR: ${KV_MAJOR}"
100 debug-print "KV_MINOR: ${KV_MINOR}"
101 debug-print "KV_PATCH: ${KV_PATCH}"
97 debug-print "RELEASETYPE: ${RELEASETYPE}" 102 debug-print "RELEASETYPE: ${RELEASETYPE}"
98 debug-print "RELEASE: ${RELEASE}" 103 debug-print "RELEASE: ${RELEASE}"
99 debug-print "UNIPATCH_LIST_DEFAULT: ${UNIPATCH_LIST_DEFAULT} " 104 debug-print "UNIPATCH_LIST_DEFAULT: ${UNIPATCH_LIST_DEFAULT} "
100 debug-print "UNIPATCH_LIST_GENPATCHES: ${UNIPATCH_LIST_GENPATCHES} " 105 debug-print "UNIPATCH_LIST_GENPATCHES: ${UNIPATCH_LIST_GENPATCHES} "
101 debug-print "UNIPATCH_LIST: ${UNIPATCH_LIST}" 106 debug-print "UNIPATCH_LIST: ${UNIPATCH_LIST}"
105 110
106#Eclass functions only from here onwards ... 111#Eclass functions only from here onwards ...
107#============================================================== 112#==============================================================
108handle_genpatches() { 113handle_genpatches() {
109 local tarball 114 local tarball
110 [[ -z ${K_WANT_GENPATCHES} || -z ${K_GENPATCHES_VER} ]] && return -1 115 [[ -z ${K_WANT_GENPATCHES} || -z ${K_GENPATCHES_VER} ]] && return 1
111 116
112 for i in ${K_WANT_GENPATCHES} ; do 117 for i in ${K_WANT_GENPATCHES} ; do
113 tarball="genpatches-${OKV}-${K_GENPATCHES_VER}.${i}.tar.bz2" 118 tarball="genpatches-${OKV}-${K_GENPATCHES_VER}.${i}.tar.bz2"
114 GENPATCHES_URI="${GENPATCHES_URI} mirror://gentoo/${tarball}" 119 GENPATCHES_URI="${GENPATCHES_URI} mirror://gentoo/${tarball}"
115 UNIPATCH_LIST_GENPATCHES="${UNIPATCH_LIST_GENPATCHES} ${DISTDIR}/${tarball}" 120 UNIPATCH_LIST_GENPATCHES="${UNIPATCH_LIST_GENPATCHES} ${DISTDIR}/${tarball}"
243 248
244 handle_genpatches 249 handle_genpatches
245} 250}
246 251
247kernel_is() { 252kernel_is() {
253 # ALL of these should be set before we can safely continue this function.
254 # some of the sources have in the past had only one set.
255 local v n=0
256 for v in OKV KV_{MAJOR,MINOR,PATCH} ; do [[ -z ${!v} ]] && n=1 ; done
248 [[ -z ${OKV} ]] && detect_version 257 [[ $n -eq 1 ]] && detect_version
258 unset v n
259
260 # Now we can continue
249 local operator test value x=0 y=0 z=0 261 local operator test value x=0 y=0 z=0
250 262
251 case ${1} in 263 case ${1} in
252 lt) operator="-lt"; shift;; 264 lt) operator="-lt"; shift;;
253 gt) operator="-gt"; shift;; 265 gt) operator="-gt"; shift;;
287# Capture the sources type and set DEPENDs 299# Capture the sources type and set DEPENDs
288if [[ ${ETYPE} == sources ]]; then 300if [[ ${ETYPE} == sources ]]; then
289 DEPEND="!build? ( sys-apps/sed 301 DEPEND="!build? ( sys-apps/sed
290 >=sys-devel/binutils-2.11.90.0.31 )" 302 >=sys-devel/binutils-2.11.90.0.31 )"
291 RDEPEND="!build? ( >=sys-libs/ncurses-5.2 303 RDEPEND="!build? ( >=sys-libs/ncurses-5.2
292 sys-devel/make ) 304 sys-devel/make )"
293 virtual/dev-manager" 305 PDEPEND="!build? ( virtual/dev-manager )"
294 306
295 PROVIDE="virtual/linux-sources" 307 PROVIDE="virtual/linux-sources"
296 kernel_is gt 2 4 && PROVIDE="${PROVIDE} virtual/alsa" 308 kernel_is gt 2 4 && PROVIDE="${PROVIDE} virtual/alsa"
297 309
298 SLOT="${PVR}" 310 SLOT="${PVR}"
375 || die "make include/linux/version.h failed" 387 || die "make include/linux/version.h failed"
376 rm -f .config >/dev/null 388 rm -f .config >/dev/null
377} 389}
378 390
379universal_unpack() { 391universal_unpack() {
380 cd ${WORKDIR} 392 cd "${WORKDIR}"
381 unpack linux-${OKV}.tar.bz2 393 unpack linux-${OKV}.tar.bz2
382 if [[ -d "linux" ]]; then 394 if [[ -d "linux" ]]; then
383 mv linux linux-${KV_FULL} \ 395 mv linux linux-${KV_FULL} \
384 || die "Unable to move source tree to ${KV_FULL}." 396 || die "Unable to move source tree to ${KV_FULL}."
385 elif [[ "${OKV}" != "${KV_FULL}" ]]; then 397 elif [[ "${OKV}" != "${KV_FULL}" ]]; then
489 501
490# install functions 502# install functions
491#============================================================== 503#==============================================================
492install_universal() { 504install_universal() {
493 #fix silly permissions in tarball 505 #fix silly permissions in tarball
494 cd ${WORKDIR} 506 cd "${WORKDIR}"
495 chown -R root:0 * 507 chown -R root:0 * >& /dev/null
496 chmod -R a+r-w+X,u+w * 508 chmod -R a+r-w+X,u+w *
497 cd ${OLDPWD} 509 cd ${OLDPWD}
498} 510}
499 511
500install_headers() { 512install_headers() {
544 [[ ! -e ${D}/${ddir}/asm/arch ]] && ln -sf arch-ebsa285 "${D}"/${ddir}/asm/arch 556 [[ ! -e ${D}/${ddir}/asm/arch ]] && ln -sf arch-ebsa285 "${D}"/${ddir}/asm/arch
545 [[ ! -e ${D}/${ddir}/asm/proc ]] && ln -sf proc-armv "${D}"/${ddir}/asm/proc 557 [[ ! -e ${D}/${ddir}/asm/proc ]] && ln -sf proc-armv "${D}"/${ddir}/asm/proc
546 ;; 558 ;;
547 powerpc) 559 powerpc)
548 dodir ${ddir}/asm 560 dodir ${ddir}/asm
549 cp -pPR "${S}"/include/asm/* ${D}/${ddir}/asm 561 cp -pPR "${S}"/include/asm/* "${D}"/${ddir}/asm
550 if [[ -e "${S}"/include/asm-ppc ]] ; then 562 if [[ -e "${S}"/include/asm-ppc ]] ; then
551 dodir ${ddir}/asm-ppc 563 dodir ${ddir}/asm-ppc
552 cp -pPR "${S}"/include/asm-ppc/* ${D}/${ddir}/asm-ppc 564 cp -pPR "${S}"/include/asm-ppc/* "${D}"/${ddir}/asm-ppc
553 fi 565 fi
554 ;; 566 ;;
555 *) 567 *)
556 dodir ${ddir}/asm 568 dodir ${ddir}/asm
557 cp -pPR "${S}"/include/asm/* ${D}/${ddir}/asm 569 cp -pPR "${S}"/include/asm/* "${D}"/${ddir}/asm
558 ;; 570 ;;
559 esac 571 esac
560 if [[ -n ${multi_dirs} ]] ; then 572 if [[ -n ${multi_dirs} ]] ; then
561 local d ml_inc="" 573 local d ml_inc=""
562 for d in ${multi_dirs} ; do 574 for d in ${multi_dirs} ; do
563 dodir ${ddir}/asm-${d} 575 dodir ${ddir}/asm-${d}
564 cp -pPR "${S}"/include/asm-${d}/* ${D}/${ddir}/asm-${d}/ || die "cp asm-${d} failed" 576 cp -pPR "${S}"/include/asm-${d}/* "${D}"/${ddir}/asm-${d}/ || die "cp asm-${d} failed"
565 577
566 ml_inc="${ml_inc} ${multi_defs%% *}:${ddir}/asm-${d}" 578 ml_inc="${ml_inc} ${multi_defs%% *}:${ddir}/asm-${d}"
567 multi_defs=${multi_defs#* } 579 multi_defs=${multi_defs#* }
568 done 580 done
569 create_ml_includes ${ddir}/asm ${ml_inc} 581 create_ml_includes ${ddir}/asm ${ml_inc}
570 fi 582 fi
571 583
572 if kernel_is 2 6; then 584 if kernel_is 2 6; then
573 dodir ${ddir}/asm-generic 585 dodir ${ddir}/asm-generic
574 cp -pPR "${S}"/include/asm-generic/* ${D}/${ddir}/asm-generic 586 cp -pPR "${S}"/include/asm-generic/* "${D}"/${ddir}/asm-generic
575 fi 587 fi
576 588
577 # clean up 589 # clean up
578 find "${D}" -name '*.orig' -exec rm -f {} \; 590 find "${D}" -name '*.orig' -exec rm -f {} \;
579 591
603 [[ -f ${FILESDIR}/../ChangeLog ]] && \ 615 [[ -f ${FILESDIR}/../ChangeLog ]] && \
604 echo "Please check the ebuild ChangeLog for more details." \ 616 echo "Please check the ebuild ChangeLog for more details." \
605 > "${S}"/patches.txt 617 > "${S}"/patches.txt
606 fi 618 fi
607 619
608 mv ${WORKDIR}/linux* ${D}/usr/src 620 mv ${WORKDIR}/linux* "${D}"/usr/src
609} 621}
610 622
611# pkg_preinst functions 623# pkg_preinst functions
612#============================================================== 624#==============================================================
613preinst_headers() { 625preinst_headers() {
632 644
633 # if the link doesnt exist, lets create it 645 # if the link doesnt exist, lets create it
634 [[ ! -h ${ROOT}usr/src/linux ]] && MAKELINK=1 646 [[ ! -h ${ROOT}usr/src/linux ]] && MAKELINK=1
635 647
636 if [[ ${MAKELINK} == 1 ]]; then 648 if [[ ${MAKELINK} == 1 ]]; then
637 cd ${ROOT}usr/src 649 cd "${ROOT}"usr/src
638 ln -sf linux-${KV_FULL} linux 650 ln -sf linux-${KV_FULL} linux
639 cd ${OLDPWD} 651 cd ${OLDPWD}
640 fi 652 fi
641 653
642 # Don't forget to make directory for sysfs 654 # Don't forget to make directory for sysfs
816 x=${KPATCH_DIR} 828 x=${KPATCH_DIR}
817 KPATCH_DIR="" 829 KPATCH_DIR=""
818 for i in $(find ${x} -type d | sort -n); do 830 for i in $(find ${x} -type d | sort -n); do
819 KPATCH_DIR="${KPATCH_DIR} ${i}" 831 KPATCH_DIR="${KPATCH_DIR} ${i}"
820 done 832 done
833
834 # do not apply fbcondecor patch to sparc/sparc64 as it breaks boot
835 # bug #272676
836 if [[ "$(tc-arch)" = "sparc" || "$(tc-arch)" = "sparc64" ]]; then
837 if [[ ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} > 2.6.28 ]]; then
838 UNIPATCH_DROP="${UNIPATCH_DROP} *_fbcondecor-0.9.6.patch"
839 echo
840 ewarn "fbcondecor currently prevents sparc/sparc64 from booting"
841 ewarn "for kernel versions >= 2.6.29. Removing fbcondecor patch."
842 ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=272676 for details"
843 echo
844 fi
845 fi
821 846
822 #so now lets get rid of the patchno's we want to exclude 847 #so now lets get rid of the patchno's we want to exclude
823 UNIPATCH_DROP="${UNIPATCH_EXCLUDE} ${UNIPATCH_DROP}" 848 UNIPATCH_DROP="${UNIPATCH_EXCLUDE} ${UNIPATCH_DROP}"
824 for i in ${UNIPATCH_DROP}; do 849 for i in ${UNIPATCH_DROP}; do
825 ebegin "Excluding Patch #${i}" 850 ebegin "Excluding Patch #${i}"
873 # sit in KPATCH_DIR's. This is handled properly in the unipatch rewrite, 898 # sit in KPATCH_DIR's. This is handled properly in the unipatch rewrite,
874 # which is why I'm not taking too much time over this. 899 # which is why I'm not taking too much time over this.
875 local tmp 900 local tmp
876 for i in ${UNIPATCH_DOCS}; do 901 for i in ${UNIPATCH_DOCS}; do
877 tmp="${tmp} ${i//*\/}" 902 tmp="${tmp} ${i//*\/}"
878 cp -f ${i} ${T}/ 903 cp -f ${i} "${T}"/
879 done 904 done
880 UNIPATCH_DOCS="${tmp}" 905 UNIPATCH_DOCS="${tmp}"
881 906
882 # clean up KPATCH_DIR's - fixes bug #53610 907 # clean up KPATCH_DIR's - fixes bug #53610
883 for x in ${KPATCH_DIR}; do rm -Rf ${x}; done 908 for x in ${KPATCH_DIR}; do rm -Rf ${x}; done
1028 debug-print "Doing premake" 1053 debug-print "Doing premake"
1029 1054
1030 # allow ebuilds to massage the source tree after patching but before 1055 # allow ebuilds to massage the source tree after patching but before
1031 # we run misc `make` functions below 1056 # we run misc `make` functions below
1032 [[ $(type -t kernel-2_hook_premake) == "function" ]] && kernel-2_hook_premake 1057 [[ $(type -t kernel-2_hook_premake) == "function" ]] && kernel-2_hook_premake
1058
1059 debug-print "Doing epatch_user"
1060 epatch_user
1033 1061
1034 debug-print "Doing unpack_set_extraversion" 1062 debug-print "Doing unpack_set_extraversion"
1035 1063
1036 [[ -z ${K_NOSETEXTRAVERSION} ]] && unpack_set_extraversion 1064 [[ -z ${K_NOSETEXTRAVERSION} ]] && unpack_set_extraversion
1037 unpack_fix_install_path 1065 unpack_fix_install_path

Legend:
Removed from v.1.216  
changed lines
  Added in v.1.227

  ViewVC Help
Powered by ViewVC 1.1.20