1 # Copyright 1999-2006 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 inherit linux-info eutils autotools
9 DESCRIPTION="linux-phc is a kernel patch to change the voltage/frequency pairs of processors from userspace."
10 HOMEPAGE="https://www.dedigentoo.org/trac/linux-phc/"
11 SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
19 if kernel_is ge 2 6 19
21 PATCH="kernel-patch/${P}-kernel-vanilla-2.6.19.patch"
22 elif kernel_is ge 2 6 18
24 PATCH="kernel-patch/${P}-kernel-vanilla-2.6.18.patch"
25 elif kernel_is ge 2 6 17
27 PATCH="kernel-patch/${P}-kernel-vanilla-2.6.17.patch"
28 elif kernel_is ge 2 6 16
30 PATCH="kernel-patch/${P}-kernel-vanilla-2.6.16.patch"
31 elif kernel_is ge 2 6 15
33 PATCH="kernel-patch/${P}-kernel-vanilla-2.6.15.patch"
35 die "No ${PN} patch for kernel version ${KV_FULL} - sorry not supported"
40 if has collision_protect ${FEATURES}; then
41 ewarn "Collisions are expected as this patches kernel code. Disable"
42 ewarn "FEATURES=collision-protect before use"
43 die 'incompatible FEATURES=collision-protect'
55 if egrep -q 'linux-phc' \
56 ${KV_DIR}/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
58 ewarn "already installed ${PN} for kernel ${KV_FULL}"
59 ewarn "If this is an upgrade attempt, reemerge your kernel sources"
60 ewarn "and try emerging this package again."
67 local mydir="arch/i386/kernel/cpu/cpufreq"
68 mkdir -p "${S}/${mydir}"
70 cp -P "${KV_DIR}/${mydir}/Kconfig" "${S}/${mydir}/"
71 cp -P "${KV_DIR}/${mydir}/speedstep-centrino.c" "${S}/${mydir}/"
73 epatch "${S}/${PATCH}" || die "epatch failed"
77 einfo 'Compiling measurefreq'
78 cd "${S}/utils/measurefreq"
81 econf || die 'econf failed'
82 emake || die 'emake failed'
86 insinto "$(/bin/readlink -f ${KV_DIR})"
89 doinitd gentoo/etc/init.d/undervolt
90 doconfd gentoo/etc/conf.d/undervolt
91 cd "${S}/utils/measurefreq"
92 emake DESTDIR="${D}" install || die "emake failed"
100 elog "Please read https://www.dedigentoo.org/trac/linux-phc/#Documentation before using linux-phc"
101 elog "You can use the utility measurefreq to find appropriate voltage values."
102 ewarn "Edit /etc/conf.d/undervolt before using the initscript"
106 ewarn "Unmerging this ebuild won't revert the patches in your kernel"
107 ewarn "Reemerge your kernel if you want that."