blob: d0184547e481c90bb08a5ad6d764a8ea81ba7305 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
WANT_AUTOCONF=2.5
WANT_AUTOMAKE=1.9
inherit linux-info eutils autotools
DESCRIPTION="A kernel patch to change the voltage/frequency pairs of processors from userspace."
HOMEPAGE="https://www.dedigentoo.org/trac/linux-phc/"
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86"
IUSE=""
which_patch() {
if kernel_is 2 6 19
then
PATCH="kernel-patch/${P}-kernel-vanilla-2.6.19.patch"
elif kernel_is 2 6 18
then
PATCH="kernel-patch/${P}-kernel-vanilla-2.6.18.patch"
elif kernel_is 2 6 17
then
PATCH="kernel-patch/${P}-kernel-vanilla-2.6.17.patch"
elif kernel_is 2 6 16
then
PATCH="kernel-patch/${P}-kernel-vanilla-2.6.16.patch"
elif kernel_is 2 6 15
then
PATCH="kernel-patch/${P}-kernel-vanilla-2.6.15.patch"
else
die "No ${PN} patch for kernel version ${KV_FULL} -- sorry not supported"
fi
}
collision_check() {
if has collision_protect ${FEATURES}; then
ewarn "Collisions are expected as this patches kernel code. Disable"
ewarn "FEATURES=collision-protect before use"
die 'incompatible FEATURES=collision-protect'
fi
}
pkg_setup() {
linux-info_pkg_setup
collision_check
}
src_unpack() {
which_patch
if egrep -q 'linux-phc' \
${KV_DIR}/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
then
ewarn "already installed ${PN} for kernel ${KV_FULL}"
ewarn "If this is an upgrade attempt, reemerge your kernel sources"
ewarn "and try emerging this package again."
die
fi
unpack ${A}
cd "${S}"
local mydir="arch/i386/kernel/cpu/cpufreq"
mkdir -p "${S}/${mydir}"
cp -P "${KV_DIR}/${mydir}/Kconfig" "${S}/${mydir}/"
cp -P "${KV_DIR}/${mydir}/speedstep-centrino.c" "${S}/${mydir}/"
epatch "${S}/${PATCH}" || die "epatch failed"
}
src_compile() {
einfo 'Compiling measurefreq'
cd "${S}/utils/measurefreq"
eautoconf
eautomake
econf || die 'econf failed'
emake || die 'emake failed'
}
src_install() {
insinto "$(/bin/readlink -f ${KV_DIR})"
doins -r arch
dodoc README
doinitd gentoo/etc/init.d/undervolt
doconfd gentoo/etc/conf.d/undervolt
cd "${S}/utils/measurefreq"
emake DESTDIR="${D}" install || die "emake failed"
}
pkg_preinst() {
collision_check
}
pkg_postinst() {
elog "Please read https://www.dedigentoo.org/trac/linux-phc/#Documentation before using linux-phc"
elog "You can use the utility measurefreq to find appropriate voltage values."
ewarn "Edit /etc/conf.d/undervolt before using the initscript"
}
pkg_postrm() {
ewarn "Unmerging this ebuild won't revert the patches in your kernel"
ewarn "Reemerge your kernel if you want that."
}
|