Gentoo Archives: gentoo-commits

From: "Robin H. Johnson (robbat2)" <robbat2@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in eclass: kernel-2.eclass
Date: Mon, 26 Apr 2010 07:15:07
Message-Id: 20100426071503.4B17C2C04C@corvid.gentoo.org
1 robbat2 10/04/26 07:15:03
2
3 Modified: kernel-2.eclass
4 Log:
5 Bug #266157: Deblob support for libre kernels.
6
7 Revision Changes Path
8 1.229 eclass/kernel-2.eclass
9
10 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/kernel-2.eclass?rev=1.229&view=markup
11 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/kernel-2.eclass?rev=1.229&content-type=text/plain
12 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/kernel-2.eclass?r1=1.228&r2=1.229
13
14 Index: kernel-2.eclass
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo-x86/eclass/kernel-2.eclass,v
17 retrieving revision 1.228
18 retrieving revision 1.229
19 diff -p -w -b -B -u -u -r1.228 -r1.229
20 --- kernel-2.eclass 26 Apr 2010 06:48:33 -0000 1.228
21 +++ kernel-2.eclass 26 Apr 2010 07:15:03 -0000 1.229
22 @@ -1,6 +1,6 @@
23 # Copyright 1999-2009 Gentoo Foundation
24 # Distributed under the terms of the GNU General Public License v2
25 -# $Header: /var/cvsroot/gentoo-x86/eclass/kernel-2.eclass,v 1.228 2010/04/26 06:48:33 robbat2 Exp $
26 +# $Header: /var/cvsroot/gentoo-x86/eclass/kernel-2.eclass,v 1.229 2010/04/26 07:15:03 robbat2 Exp $
27
28 # Description: kernel.eclass rewrite for a clean base regarding the 2.6
29 # series of kernel with back-compatibility for 2.4
30 @@ -74,9 +74,8 @@ if [[ ${CTARGET} == ${CHOST} && ${CATEGO
31 fi
32
33 HOMEPAGE="http://www.kernel.org/ http://www.gentoo.org/ ${HOMEPAGE}"
34 -# Reflect that kernels contain firmware blobs unless otherwise stripped
35 [[ -z ${LICENSE} ]] && \
36 - LICENSE="GPL-2 freedist"
37 + LICENSE="GPL-2"
38
39 # No need to run scanelf/strip on kernel sources/headers (bug #134453).
40 RESTRICT="binchecks strip"
41 @@ -300,6 +299,34 @@ if [[ ${ETYPE} == sources ]]; then
42 SLOT="${PVR}"
43 DESCRIPTION="Sources for the ${KV_MAJOR}.${KV_MINOR} linux kernel"
44 IUSE="symlink build"
45 +
46 + # Bug #266157, deblob for libre support
47 + if [[ -z ${KERNEL_DEBLOBBED} ]] ; then
48 + if kernel_is ge 2 6 27 ; then
49 + IUSE="${IUSE} deblob"
50 + # Reflect that kernels contain firmware blobs unless otherwise
51 + # stripped
52 + LICENSE="${LICENSE} !deblob? ( freedist )"
53 +
54 + # This to to avoid us triggering some QA warnings
55 + DEBLOB_AVAILABLE=1
56 +
57 + DEBLOB_PV="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
58 + DEBLOB_A="deblob-${DEBLOB_PV}"
59 + DEBLOB_HOMEPAGE="http://www.fsfla.org/svnwiki/selibre/linux-libre/"
60 + HOMEPAGE="${HOMEPAGE} ${DEBLOB_HOMEPAGE}"
61 +
62 + KERNEL_URI="${KERNEL_URI}
63 + deblob? (
64 + ${DEBLOB_HOMEPAGE}/download/releases/LATEST-${DEBLOB_PV}.N/${DEBLOB_A}
65 + )"
66 + else
67 + # We have no way to deblob older kernels, so just mark them as
68 + # tainted with non-libre materials.
69 + LICENSE="${LICENSE} freedist"
70 + fi
71 + fi
72 +
73 elif [[ ${ETYPE} == headers ]]; then
74 DESCRIPTION="Linux system headers"
75
76 @@ -626,6 +653,11 @@ postinst_sources() {
77 # if we have USE=symlink, then force K_SYMLINK=1
78 use symlink && K_SYMLINK=1
79
80 + # if we're using a deblobbed kernel, it's not supported
81 + [[ $DEBLOB_AVAILABLE == "1" ]] && \
82 + use deblob && \
83 + K_SECURITY_UNSUPPORTED=1
84 +
85 # if we are to forcably symlink, delete it if it already exists first.
86 if [[ ${K_SYMLINK} > 0 ]]; then
87 [[ -h ${ROOT}usr/src/linux ]] && rm ${ROOT}usr/src/linux
88 @@ -1066,11 +1098,22 @@ kernel-2_src_unpack() {
89 kernel_is 2 4 && unpack_2_4
90 kernel_is 2 6 && unpack_2_6
91 fi
92 +
93 + if [[ $DEBLOB_AVAILABLE == "1" ]] && use deblob ; then
94 + cp "${DISTDIR}/${DEBLOB_A}" "${T}"
95 + chmod +x "${T}/${DEBLOB_A}"
96 + fi
97 }
98
99 kernel-2_src_compile() {
100 cd "${S}"
101 [[ ${ETYPE} == headers ]] && compile_headers
102 +
103 + if [[ $DEBLOB_AVAILABLE == "1" ]] && use deblob ; then
104 + echo ">>> Running deblob script ..."
105 + sh "${T}/${DEBLOB_A}" --force || \
106 + die "Deblob script failed to run!!!"
107 + fi
108 }
109
110 kernel-2_pkg_preinst() {