/[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.228
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.228 2010/04/26 06:48:33 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
87#============================================================== 89#==============================================================
88# this function exists only to help debug kernel-2.eclass 90# this function exists only to help debug kernel-2.eclass
89# if you are adding new functionality in, put a call to it 91# if you are adding new functionality in, put a call to it
90# at the start of src_unpack, or during SRC_URI/dep generation. 92# at the start of src_unpack, or during SRC_URI/dep generation.
91debug-print-kernel2-variables() { 93debug-print-kernel2-variables() {
92 debug-print "PVR: ${PVR}" 94 for v in PVR CKV OKV KV KV_FULL KV_MAJOR KV_MINOR KV_PATCH RELEASETYPE \
93 debug-print "CKV: ${CKV}" 95 RELEASE UNIPATCH_LIST_DEFAULT UNIPATCH_LIST_GENPATCHES \
94 debug-print "OKV: ${OKV}" 96 UNIPATCH_LIST S KERNEL_URI ; do
95 debug-print "KV: ${KV}" 97 debug-print "${v}: ${!v}"
96 debug-print "KV_FULL: ${KV_FULL}" 98 done
97 debug-print "RELEASETYPE: ${RELEASETYPE}"
98 debug-print "RELEASE: ${RELEASE}"
99 debug-print "UNIPATCH_LIST_DEFAULT: ${UNIPATCH_LIST_DEFAULT} "
100 debug-print "UNIPATCH_LIST_GENPATCHES: ${UNIPATCH_LIST_GENPATCHES} "
101 debug-print "UNIPATCH_LIST: ${UNIPATCH_LIST}"
102 debug-print "S: ${S}"
103 debug-print "KERNEL_URI: ${KERNEL_URI}"
104} 99}
105 100
106#Eclass functions only from here onwards ... 101#Eclass functions only from here onwards ...
107#============================================================== 102#==============================================================
108handle_genpatches() { 103handle_genpatches() {
109 local tarball 104 local tarball
110 [[ -z ${K_WANT_GENPATCHES} || -z ${K_GENPATCHES_VER} ]] && return -1 105 [[ -z ${K_WANT_GENPATCHES} || -z ${K_GENPATCHES_VER} ]] && return 1
111 106
112 for i in ${K_WANT_GENPATCHES} ; do 107 for i in ${K_WANT_GENPATCHES} ; do
113 tarball="genpatches-${OKV}-${K_GENPATCHES_VER}.${i}.tar.bz2" 108 tarball="genpatches-${OKV}-${K_GENPATCHES_VER}.${i}.tar.bz2"
114 GENPATCHES_URI="${GENPATCHES_URI} mirror://gentoo/${tarball}" 109 GENPATCHES_URI="${GENPATCHES_URI} mirror://gentoo/${tarball}"
115 UNIPATCH_LIST_GENPATCHES="${UNIPATCH_LIST_GENPATCHES} ${DISTDIR}/${tarball}" 110 UNIPATCH_LIST_GENPATCHES="${UNIPATCH_LIST_GENPATCHES} ${DISTDIR}/${tarball}"
243 238
244 handle_genpatches 239 handle_genpatches
245} 240}
246 241
247kernel_is() { 242kernel_is() {
243 # ALL of these should be set before we can safely continue this function.
244 # some of the sources have in the past had only one set.
245 local v n=0
246 for v in OKV KV_{MAJOR,MINOR,PATCH} ; do [[ -z ${!v} ]] && n=1 ; done
248 [[ -z ${OKV} ]] && detect_version 247 [[ $n -eq 1 ]] && detect_version
248 unset v n
249
250 # Now we can continue
249 local operator test value x=0 y=0 z=0 251 local operator test value x=0 y=0 z=0
250 252
251 case ${1} in 253 case ${1} in
252 lt) operator="-lt"; shift;; 254 lt) operator="-lt"; shift;;
253 gt) operator="-gt"; shift;; 255 gt) operator="-gt"; shift;;
287# Capture the sources type and set DEPENDs 289# Capture the sources type and set DEPENDs
288if [[ ${ETYPE} == sources ]]; then 290if [[ ${ETYPE} == sources ]]; then
289 DEPEND="!build? ( sys-apps/sed 291 DEPEND="!build? ( sys-apps/sed
290 >=sys-devel/binutils-2.11.90.0.31 )" 292 >=sys-devel/binutils-2.11.90.0.31 )"
291 RDEPEND="!build? ( >=sys-libs/ncurses-5.2 293 RDEPEND="!build? ( >=sys-libs/ncurses-5.2
292 sys-devel/make ) 294 sys-devel/make )"
293 virtual/dev-manager" 295 PDEPEND="!build? ( virtual/dev-manager )"
294 296
295 PROVIDE="virtual/linux-sources" 297 PROVIDE="virtual/linux-sources"
296 kernel_is gt 2 4 && PROVIDE="${PROVIDE} virtual/alsa" 298 kernel_is gt 2 4 && PROVIDE="${PROVIDE} virtual/alsa"
297 299
298 SLOT="${PVR}" 300 SLOT="${PVR}"
375 || die "make include/linux/version.h failed" 377 || die "make include/linux/version.h failed"
376 rm -f .config >/dev/null 378 rm -f .config >/dev/null
377} 379}
378 380
379universal_unpack() { 381universal_unpack() {
380 cd ${WORKDIR} 382 cd "${WORKDIR}"
381 unpack linux-${OKV}.tar.bz2 383 unpack linux-${OKV}.tar.bz2
382 if [[ -d "linux" ]]; then 384 if [[ -d "linux" ]]; then
383 mv linux linux-${KV_FULL} \ 385 mv linux linux-${KV_FULL} \
384 || die "Unable to move source tree to ${KV_FULL}." 386 || die "Unable to move source tree to ${KV_FULL}."
385 elif [[ "${OKV}" != "${KV_FULL}" ]]; then 387 elif [[ "${OKV}" != "${KV_FULL}" ]]; then
489 491
490# install functions 492# install functions
491#============================================================== 493#==============================================================
492install_universal() { 494install_universal() {
493 #fix silly permissions in tarball 495 #fix silly permissions in tarball
494 cd ${WORKDIR} 496 cd "${WORKDIR}"
495 chown -R root:0 * 497 chown -R root:0 * >& /dev/null
496 chmod -R a+r-w+X,u+w * 498 chmod -R a+r-w+X,u+w *
497 cd ${OLDPWD} 499 cd ${OLDPWD}
498} 500}
499 501
500install_headers() { 502install_headers() {
544 [[ ! -e ${D}/${ddir}/asm/arch ]] && ln -sf arch-ebsa285 "${D}"/${ddir}/asm/arch 546 [[ ! -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 547 [[ ! -e ${D}/${ddir}/asm/proc ]] && ln -sf proc-armv "${D}"/${ddir}/asm/proc
546 ;; 548 ;;
547 powerpc) 549 powerpc)
548 dodir ${ddir}/asm 550 dodir ${ddir}/asm
549 cp -pPR "${S}"/include/asm/* ${D}/${ddir}/asm 551 cp -pPR "${S}"/include/asm/* "${D}"/${ddir}/asm
550 if [[ -e "${S}"/include/asm-ppc ]] ; then 552 if [[ -e "${S}"/include/asm-ppc ]] ; then
551 dodir ${ddir}/asm-ppc 553 dodir ${ddir}/asm-ppc
552 cp -pPR "${S}"/include/asm-ppc/* ${D}/${ddir}/asm-ppc 554 cp -pPR "${S}"/include/asm-ppc/* "${D}"/${ddir}/asm-ppc
553 fi 555 fi
554 ;; 556 ;;
555 *) 557 *)
556 dodir ${ddir}/asm 558 dodir ${ddir}/asm
557 cp -pPR "${S}"/include/asm/* ${D}/${ddir}/asm 559 cp -pPR "${S}"/include/asm/* "${D}"/${ddir}/asm
558 ;; 560 ;;
559 esac 561 esac
560 if [[ -n ${multi_dirs} ]] ; then 562 if [[ -n ${multi_dirs} ]] ; then
561 local d ml_inc="" 563 local d ml_inc=""
562 for d in ${multi_dirs} ; do 564 for d in ${multi_dirs} ; do
563 dodir ${ddir}/asm-${d} 565 dodir ${ddir}/asm-${d}
564 cp -pPR "${S}"/include/asm-${d}/* ${D}/${ddir}/asm-${d}/ || die "cp asm-${d} failed" 566 cp -pPR "${S}"/include/asm-${d}/* "${D}"/${ddir}/asm-${d}/ || die "cp asm-${d} failed"
565 567
566 ml_inc="${ml_inc} ${multi_defs%% *}:${ddir}/asm-${d}" 568 ml_inc="${ml_inc} ${multi_defs%% *}:${ddir}/asm-${d}"
567 multi_defs=${multi_defs#* } 569 multi_defs=${multi_defs#* }
568 done 570 done
569 create_ml_includes ${ddir}/asm ${ml_inc} 571 create_ml_includes ${ddir}/asm ${ml_inc}
570 fi 572 fi
571 573
572 if kernel_is 2 6; then 574 if kernel_is 2 6; then
573 dodir ${ddir}/asm-generic 575 dodir ${ddir}/asm-generic
574 cp -pPR "${S}"/include/asm-generic/* ${D}/${ddir}/asm-generic 576 cp -pPR "${S}"/include/asm-generic/* "${D}"/${ddir}/asm-generic
575 fi 577 fi
576 578
577 # clean up 579 # clean up
578 find "${D}" -name '*.orig' -exec rm -f {} \; 580 find "${D}" -name '*.orig' -exec rm -f {} \;
579 581
603 [[ -f ${FILESDIR}/../ChangeLog ]] && \ 605 [[ -f ${FILESDIR}/../ChangeLog ]] && \
604 echo "Please check the ebuild ChangeLog for more details." \ 606 echo "Please check the ebuild ChangeLog for more details." \
605 > "${S}"/patches.txt 607 > "${S}"/patches.txt
606 fi 608 fi
607 609
608 mv ${WORKDIR}/linux* ${D}/usr/src 610 mv ${WORKDIR}/linux* "${D}"/usr/src
609} 611}
610 612
611# pkg_preinst functions 613# pkg_preinst functions
612#============================================================== 614#==============================================================
613preinst_headers() { 615preinst_headers() {
632 634
633 # if the link doesnt exist, lets create it 635 # if the link doesnt exist, lets create it
634 [[ ! -h ${ROOT}usr/src/linux ]] && MAKELINK=1 636 [[ ! -h ${ROOT}usr/src/linux ]] && MAKELINK=1
635 637
636 if [[ ${MAKELINK} == 1 ]]; then 638 if [[ ${MAKELINK} == 1 ]]; then
637 cd ${ROOT}usr/src 639 cd "${ROOT}"usr/src
638 ln -sf linux-${KV_FULL} linux 640 ln -sf linux-${KV_FULL} linux
639 cd ${OLDPWD} 641 cd ${OLDPWD}
640 fi 642 fi
641 643
642 # Don't forget to make directory for sysfs 644 # Don't forget to make directory for sysfs
816 x=${KPATCH_DIR} 818 x=${KPATCH_DIR}
817 KPATCH_DIR="" 819 KPATCH_DIR=""
818 for i in $(find ${x} -type d | sort -n); do 820 for i in $(find ${x} -type d | sort -n); do
819 KPATCH_DIR="${KPATCH_DIR} ${i}" 821 KPATCH_DIR="${KPATCH_DIR} ${i}"
820 done 822 done
823
824 # do not apply fbcondecor patch to sparc/sparc64 as it breaks boot
825 # bug #272676
826 if [[ "$(tc-arch)" = "sparc" || "$(tc-arch)" = "sparc64" ]]; then
827 if [[ ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} > 2.6.28 ]]; then
828 UNIPATCH_DROP="${UNIPATCH_DROP} *_fbcondecor-0.9.6.patch"
829 echo
830 ewarn "fbcondecor currently prevents sparc/sparc64 from booting"
831 ewarn "for kernel versions >= 2.6.29. Removing fbcondecor patch."
832 ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=272676 for details"
833 echo
834 fi
835 fi
821 836
822 #so now lets get rid of the patchno's we want to exclude 837 #so now lets get rid of the patchno's we want to exclude
823 UNIPATCH_DROP="${UNIPATCH_EXCLUDE} ${UNIPATCH_DROP}" 838 UNIPATCH_DROP="${UNIPATCH_EXCLUDE} ${UNIPATCH_DROP}"
824 for i in ${UNIPATCH_DROP}; do 839 for i in ${UNIPATCH_DROP}; do
825 ebegin "Excluding Patch #${i}" 840 ebegin "Excluding Patch #${i}"
873 # sit in KPATCH_DIR's. This is handled properly in the unipatch rewrite, 888 # 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. 889 # which is why I'm not taking too much time over this.
875 local tmp 890 local tmp
876 for i in ${UNIPATCH_DOCS}; do 891 for i in ${UNIPATCH_DOCS}; do
877 tmp="${tmp} ${i//*\/}" 892 tmp="${tmp} ${i//*\/}"
878 cp -f ${i} ${T}/ 893 cp -f ${i} "${T}"/
879 done 894 done
880 UNIPATCH_DOCS="${tmp}" 895 UNIPATCH_DOCS="${tmp}"
881 896
882 # clean up KPATCH_DIR's - fixes bug #53610 897 # clean up KPATCH_DIR's - fixes bug #53610
883 for x in ${KPATCH_DIR}; do rm -Rf ${x}; done 898 for x in ${KPATCH_DIR}; do rm -Rf ${x}; done
1028 debug-print "Doing premake" 1043 debug-print "Doing premake"
1029 1044
1030 # allow ebuilds to massage the source tree after patching but before 1045 # allow ebuilds to massage the source tree after patching but before
1031 # we run misc `make` functions below 1046 # we run misc `make` functions below
1032 [[ $(type -t kernel-2_hook_premake) == "function" ]] && kernel-2_hook_premake 1047 [[ $(type -t kernel-2_hook_premake) == "function" ]] && kernel-2_hook_premake
1048
1049 debug-print "Doing epatch_user"
1050 epatch_user
1033 1051
1034 debug-print "Doing unpack_set_extraversion" 1052 debug-print "Doing unpack_set_extraversion"
1035 1053
1036 [[ -z ${K_NOSETEXTRAVERSION} ]] && unpack_set_extraversion 1054 [[ -z ${K_NOSETEXTRAVERSION} ]] && unpack_set_extraversion
1037 unpack_fix_install_path 1055 unpack_fix_install_path

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

  ViewVC Help
Powered by ViewVC 1.1.20