3 |
3 |
|
4 |
4 |
EAPI=8
|
5 |
5 |
|
6 |
|
inherit git-r3 kernel-build
|
|
6 |
inherit kernel-build toolchain-funcs verify-sig
|
7 |
7 |
|
|
8 |
MY_P=linux-${PV}
|
8 |
9 |
# https://koji.fedoraproject.org/koji/packageinfo?packageID=8
|
9 |
|
CONFIG_VER=5.4.21
|
10 |
|
CONFIG_HASH=2809b7faa6a8cb232cd825096c146b7bdc1e08ea
|
11 |
|
GENTOO_CONFIG_VER=g7
|
|
10 |
CONFIG_VER=5.10.12
|
|
11 |
CONFIG_HASH=836165dd2dff34e4f2c47ca8f9c803002c1e6530
|
|
12 |
GENTOO_CONFIG_VER=g9
|
12 |
13 |
|
13 |
14 |
DESCRIPTION="Linux kernel built from vanilla upstream sources"
|
14 |
15 |
HOMEPAGE="
|
... | ... | |
16 |
17 |
https://www.kernel.org/
|
17 |
18 |
"
|
18 |
19 |
SRC_URI+="
|
|
20 |
https://cdn.kernel.org/pub/linux/kernel/v$(ver_cut 1).x/${MY_P}.tar.xz
|
19 |
21 |
https://github.com/projg2/gentoo-kernel-config/archive/${GENTOO_CONFIG_VER}.tar.gz
|
20 |
22 |
-> gentoo-kernel-config-${GENTOO_CONFIG_VER}.tar.gz
|
|
23 |
verify-sig? (
|
|
24 |
https://cdn.kernel.org/pub/linux/kernel/v$(ver_cut 1).x/${MY_P}.tar.sign
|
|
25 |
)
|
21 |
26 |
amd64? (
|
22 |
|
https://src.fedoraproject.org/rpms/kernel/raw/${CONFIG_HASH}/f/kernel-x86_64.config
|
23 |
|
-> kernel-x86_64.config.${CONFIG_VER}
|
|
27 |
https://src.fedoraproject.org/rpms/kernel/raw/${CONFIG_HASH}/f/kernel-x86_64-fedora.config
|
|
28 |
-> kernel-x86_64-fedora.config.${CONFIG_VER}
|
24 |
29 |
)
|
25 |
30 |
arm64? (
|
26 |
|
https://src.fedoraproject.org/rpms/kernel/raw/${CONFIG_HASH}/f/kernel-aarch64.config
|
27 |
|
-> kernel-aarch64.config.${CONFIG_VER}
|
|
31 |
https://src.fedoraproject.org/rpms/kernel/raw/${CONFIG_HASH}/f/kernel-aarch64-fedora.config
|
|
32 |
-> kernel-aarch64-fedora.config.${CONFIG_VER}
|
28 |
33 |
)
|
29 |
34 |
ppc64? (
|
30 |
|
https://src.fedoraproject.org/rpms/kernel/raw/${CONFIG_HASH}/f/kernel-ppc64le.config
|
31 |
|
-> kernel-ppc64le.config.${CONFIG_VER}
|
|
35 |
https://src.fedoraproject.org/rpms/kernel/raw/${CONFIG_HASH}/f/kernel-ppc64le-fedora.config
|
|
36 |
-> kernel-ppc64le-fedora.config.${CONFIG_VER}
|
32 |
37 |
)
|
33 |
38 |
x86? (
|
34 |
|
https://src.fedoraproject.org/rpms/kernel/raw/${CONFIG_HASH}/f/kernel-i686.config
|
35 |
|
-> kernel-i686.config.${CONFIG_VER}
|
|
39 |
https://src.fedoraproject.org/rpms/kernel/raw/${CONFIG_HASH}/f/kernel-i686-fedora.config
|
|
40 |
-> kernel-i686-fedora.config.${CONFIG_VER}
|
36 |
41 |
)
|
37 |
42 |
"
|
38 |
|
|
39 |
|
EGIT_REPO_URI=(
|
40 |
|
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
|
41 |
|
https://github.com/gregkh/linux/
|
42 |
|
)
|
43 |
|
EGIT_BRANCH="linux-${PV/.9999/.y}"
|
|
43 |
S=${WORKDIR}/${MY_P}
|
44 |
44 |
|
45 |
45 |
LICENSE="GPL-2"
|
46 |
|
KEYWORDS=""
|
47 |
|
IUSE="debug"
|
|
46 |
KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~x86"
|
|
47 |
IUSE="debug hardened"
|
48 |
48 |
REQUIRED_USE="arm? ( savedconfig )"
|
49 |
49 |
|
50 |
50 |
BDEPEND="
|
51 |
51 |
debug? ( dev-util/pahole )
|
|
52 |
verify-sig? ( sec-keys/openpgp-keys-kernel )
|
52 |
53 |
"
|
53 |
54 |
PDEPEND="
|
54 |
|
>=virtual/dist-kernel-$(ver_cut 1-2)
|
|
55 |
>=virtual/dist-kernel-${PV}
|
55 |
56 |
"
|
56 |
57 |
|
|
58 |
VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/kernel.org.asc
|
|
59 |
|
57 |
60 |
src_unpack() {
|
58 |
|
git-r3_src_unpack
|
59 |
|
default
|
|
61 |
if use verify-sig; then
|
|
62 |
einfo "Unpacking linux-${PV}.tar.xz ..."
|
|
63 |
verify-sig_verify_detached - "${DISTDIR}"/linux-${PV}.tar.sign \
|
|
64 |
< <(xz -cd "${DISTDIR}"/linux-${PV}.tar.xz | tee >(tar -x))
|
|
65 |
assert "Unpack failed"
|
|
66 |
unpack "gentoo-kernel-config-${GENTOO_CONFIG_VER}.tar.gz"
|
|
67 |
else
|
|
68 |
default
|
|
69 |
fi
|
60 |
70 |
}
|
61 |
71 |
|
62 |
72 |
src_prepare() {
|
63 |
73 |
default
|
64 |
74 |
|
|
75 |
local biendian=false
|
|
76 |
|
65 |
77 |
# prepare the default config
|
66 |
78 |
case ${ARCH} in
|
67 |
79 |
amd64)
|
68 |
|
cp "${DISTDIR}/kernel-x86_64.config.${CONFIG_VER}" .config || die
|
|
80 |
cp "${DISTDIR}/kernel-x86_64-fedora.config.${CONFIG_VER}" .config || die
|
|
81 |
;;
|
|
82 |
arm)
|
|
83 |
return
|
69 |
84 |
;;
|
70 |
85 |
arm64)
|
71 |
|
cp "${DISTDIR}/kernel-aarch64.config.${CONFIG_VER}" .config || die
|
|
86 |
cp "${DISTDIR}/kernel-aarch64-fedora.config.${CONFIG_VER}" .config || die
|
|
87 |
biendian=true
|
|
88 |
;;
|
|
89 |
hppa)
|
|
90 |
return
|
72 |
91 |
;;
|
73 |
92 |
ppc)
|
74 |
93 |
# assume powermac/powerbook defconfig
|
... | ... | |
76 |
95 |
cp "${WORKDIR}/${MY_P}/arch/powerpc/configs/pmac32_defconfig" .config || die
|
77 |
96 |
;;
|
78 |
97 |
ppc64)
|
79 |
|
cp "${DISTDIR}/kernel-ppc64le.config.${CONFIG_VER}" .config || die
|
|
98 |
cp "${DISTDIR}/kernel-ppc64le-fedora.config.${CONFIG_VER}" .config || die
|
|
99 |
biendian=true
|
80 |
100 |
;;
|
81 |
101 |
x86)
|
82 |
|
cp "${DISTDIR}/kernel-i686.config.${CONFIG_VER}" .config || die
|
|
102 |
cp "${DISTDIR}/kernel-i686-fedora.config.${CONFIG_VER}" .config || die
|
83 |
103 |
;;
|
84 |
104 |
*)
|
85 |
105 |
die "Unsupported arch ${ARCH}"
|
86 |
106 |
;;
|
87 |
107 |
esac
|
88 |
108 |
|
89 |
|
echo 'CONFIG_LOCALVERSION="-dist"' > "${T}"/version.config || die
|
|
109 |
local myversion="-dist"
|
|
110 |
use hardened && myversion+="-hardened"
|
|
111 |
echo "CONFIG_LOCALVERSION=\"${myversion}\"" > "${T}"/version.config || die
|
|
112 |
local dist_conf_path="${WORKDIR}/gentoo-kernel-config-${GENTOO_CONFIG_VER}"
|
|
113 |
|
90 |
114 |
local merge_configs=(
|
91 |
115 |
"${T}"/version.config
|
92 |
|
"${WORKDIR}/gentoo-kernel-config-${GENTOO_CONFIG_VER}"/base.config
|
|
116 |
"${dist_conf_path}"/base.config
|
93 |
117 |
)
|
94 |
118 |
use debug || merge_configs+=(
|
95 |
|
"${WORKDIR}/gentoo-kernel-config-${GENTOO_CONFIG_VER}"/no-debug.config
|
96 |
|
)
|
97 |
|
[[ ${ARCH} == x86 ]] && merge_configs+=(
|
98 |
|
"${WORKDIR}/gentoo-kernel-config-${GENTOO_CONFIG_VER}"/32-bit.config
|
|
119 |
"${dist_conf_path}"/no-debug.config
|
99 |
120 |
)
|
|
121 |
if use hardened; then
|
|
122 |
merge_configs+=( "${dist_conf_path}"/hardened-base.config )
|
|
123 |
|
|
124 |
tc-is-gcc && merge_configs+=( "${dist_conf_path}"/hardened-gcc-plugins.config )
|
|
125 |
|
|
126 |
if [[ -f "${dist_conf_path}/hardened-${ARCH}.config" ]]; then
|
|
127 |
merge_configs+=( "${dist_conf_path}/hardened-${ARCH}.config" )
|
|
128 |
fi
|
|
129 |
fi
|
|
130 |
|
|
131 |
# this covers ppc64 and aarch64_be only for now
|
|
132 |
if [[ ${biendian} == true && $(tc-endian) == big ]]; then
|
|
133 |
merge_configs+=( "${dist_conf_path}/big-endian.config" )
|
|
134 |
fi
|
100 |
135 |
|
101 |
136 |
kernel-build_merge_configs "${merge_configs[@]}"
|
102 |
137 |
}
|