sys-kernel/gentoo-kernel-bin: Rebuild host tooling

Rebuild host tooling from source when installing the binary kernel.
This ensures that it is compatible with the system libraries
and toolchain, in particular reducing the risk of gcc plugin version
collision.

Closes: https://bugs.gentoo.org/773376
Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
Michał Górny
2021-03-01 12:55:41 +01:00
parent 2d46e7f691
commit cbf649f3b2
4 changed files with 354 additions and 0 deletions
+9
View File
@@ -1,3 +1,9 @@
DIST genpatches-5.10-20.base.tar.xz 543060 BLAKE2B 9219d5463c51bc574984ab37795a2150deaecf861c0b2ec3c7c91eebacbd6d5e045da40acb09ac01a56e33e5329401e80d8804d1227869d5a856e8c11e2da70d SHA512 795e38b25e6c11a936e8366a3081a5f9d170bdb807296e3c0c58545b43b937ecd47e4a66fff521a0a554ff4142aaf4b4b5543427437f1458f672e57016de1f58
DIST genpatches-5.10-20.extras.tar.xz 1768 BLAKE2B 8579ab3ab97f6bc906a8e16d90e8bfde74bc6782323a0defc86e0099593431d54bc4457c2cf3bc64bcc623bfde74ba6387ca33af58e367062cc23b78057d0ec8 SHA512 7b658d488dfe372a5cd799042c9e6227fa35bf8cbd56ef505bf25344b052c2fa2db137bfb315d9a65b844c475a052e8845ba9d3b30e57fc6417aaab7c3886176
DIST genpatches-5.11-3.base.tar.xz 11280 BLAKE2B 83a975b07b3e04e19b008e5a5c4f08fa551b3558b68afb800cb3c886f782a21950d5ea1029b631a6caa2658f02e7ae819e8d8c137a076470120d94deab99e524 SHA512 0a8b19f888af853e6a12aff9d6675f7a9977fef92efa19e69c79a6325fc1626efe7aa9fec8c42ee65ba29f0757b166567679a54d0351f19ea502183e92a63ac5
DIST genpatches-5.11-3.extras.tar.xz 1772 BLAKE2B 165d5928e6afc65544392186737efd1df9e1179591ef7edd85a1868971ea76016161a38a615e9e692c4515fe7fc19424a0cfd01420b5ec57a60c8d1d2d223cb7 SHA512 c74015c4e1b824c61db9e9deca6b30a839ae9a8fb5747cb6c46e2af99a9221f11bb971099554107bbfc58ea5389d96e810f9cf8e55d0bcc16a093eef941c6ec8
DIST genpatches-5.4-102.base.tar.xz 3090460 BLAKE2B fa17228e7cfebb2c128b73682cc97f9e96a1a3c4936f98b021ae3f21a1f6a1167c357db2570902ca554b6facf27d507a0d258c4a9e9898cacde502762306c2ca SHA512 e3b7b0826115a7f7c92f5509eafe25803ea943733a8be8404a333d54ac93c607704f742ab20576517a7ac6e5467a7dfc9c2a54205a10f3fcf4af9b2557a5da0d
DIST genpatches-5.4-102.extras.tar.xz 1768 BLAKE2B e9bdc3e77e4cd6feb17c3b84b0b573f60b399262cfb5cf5893444afcda38b3017f41c5e00313fc5af30108d60fef2603dd3ce32cfd36b0e3644f85b782da0206 SHA512 bf88c37717a240a62f64cb7a04af13244ea3c5e531b160c649d39243184266de8e61e7c84f092b4b931760fa786dbe40523a0ed55eabc65824f63f0b330604d1
DIST gentoo-kernel-5.10.17-1.amd64.xpak 64346939 BLAKE2B 3387154f735f5f6f50df4fd236c65a1f7c0b4c2257f637bca75d6569c5ac2f3d841828ee94b0072e3edfad947487157d9c42c3add280e97786947fbd305e851d SHA512 7572525cedbbce2d5a2478ab50afac686b01a213af110a570d514c6a7c439e5f5957fcd95c643db3ce1201c50944f64bbbb9a10a38f803cfcf7d3de1368847c2
DIST gentoo-kernel-5.10.17-1.arm64.xpak 59606648 BLAKE2B 444e43a12a94310b00ed686d3225b61284207f93995bc75375d66435ba22cde42a1882fb1ff7479f1ed6ba369c509de11ba453a945f6608de83b1f121a5fb4e2 SHA512 998cc8342ab5e68f74a80ddf6f1fea68a618139492f5c078eb5c1619611f5635a0635ff362f9414c9518011868bd0f3bf12f110e5e5717e32c728e5f369a6b50
DIST gentoo-kernel-5.10.17-1.x86.xpak 57292329 BLAKE2B 824b77875aa1336fff7b9f054f837904462c429b625a5085296dcaeee156c2d794242fb35d2d0fd20fb6e8230895bcb5a8b334f04b86034c0818bc0b740f8b66 SHA512 bde8d238b592f7aacf63f3b4464790d3df5901bc772850ec991957c849b634790665a2b9affd0484107017d909a45eb6634a0c345b73bd77274c3101432bacee
@@ -25,3 +31,6 @@ DIST gentoo-kernel-5.4.97-1.x86.xpak 52892614 BLAKE2B 7faee99492c9b319b3bbbf4518
DIST gentoo-kernel-5.4.99-1.amd64.xpak 61077919 BLAKE2B 1d0bab84d8dba7b3c8495ef5fb2fde5cd5290579cad51e2e5c9714d02263b2b621f5c982d6c00285b469476595c540e7a93e2de8f6caf4a89b6a8e7cc123ad51 SHA512 74c92c49875e8d80e0afc2ea5198d613982d24afc300c9b9a4fdcb97689d1dd00fc5f9bdb795bc609dd12b8f1b671ddf4937860e4d94401da580e17090cd534a
DIST gentoo-kernel-5.4.99-1.arm64.xpak 56363608 BLAKE2B a082403950475a9b398c0f8fbadd371f81d2aa01160bc3656a104dfdd342f9a98979e3701ce5b7d6042c0a4ba7cf33b34de8c6bf7a98356694b33e78dd461bfe SHA512 562706e5f84240d631886ba677292aed84935deb13abbf8fd0ce023772008fffd0cdc9a965b61fc7c38fbd4235b8221c4d2af717ef7c690fbfec621d3c564134
DIST gentoo-kernel-5.4.99-1.x86.xpak 52893402 BLAKE2B 9964fb97580c87e15248c81e48352a4efecb6b278a3a087e0752484103ca87ccdb16c360d0c1db34a6874c3234fc0dd6502e012d601d381cb4ec402f92bffd55 SHA512 94d985d0b20fd0903539888308cb543d21374b523c5b4d95eecf0589a5a3998ac139b667056975431043efa9691d61755b11c902e4b2f8e9e4cc063b82192129
DIST linux-5.10.tar.xz 116606704 BLAKE2B b923d7b66309224f42f35f8a5fa219421b0a9362d2adacdadd8d96251f61f7230878ea297a269a7f3b3c56830f0b177e068691e1d7f88501a05653b0a13274d1 SHA512 95bc137d0cf9148da6a9d1f1a878698dc27b40f68e22c597544010a6c591ce1b256f083489d3ff45ff77753289b535135590194d88ef9f007d0ddab3d74de70e
DIST linux-5.11.tar.xz 117619104 BLAKE2B 81300c27bd5476387a83123aaeb4163c73eb61e9245806c23660cb5e6a4fa88ffc9def027031335fa0270fc4080506cd415990014364e3a98b9d2e8c58a29524 SHA512 a567ec133018bb5ec00c60281479b466c26e02137a93a9c690e83997947df02b6fd94e76e8df748f6d70ceb58a19bacc3b1467de10b7a1fad2763db32b3f1330
DIST linux-5.4.tar.xz 109441440 BLAKE2B 193bc4a3147e147d5529956164ec4912fad5d5c6fb07f909ff1056e57235834173194afc686993ccd785c1ff15804de0961b625f3008cca0e27493efc8f27b13 SHA512 9f60f77e8ab972b9438ac648bed17551c8491d6585a5e85f694b2eaa4c623fbc61eb18419b2656b6795eac5deec0edaa04547fc6723fbda52256bd7f3486898f
@@ -0,0 +1,115 @@
# Copyright 2020-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit kernel-install toolchain-funcs
MY_P=linux-${PV%.*}
GENPATCHES_P=genpatches-${PV%.*}-$(( ${PV##*.} + 1 ))
BINPKG=${P/-bin/}-1
DESCRIPTION="Pre-built Linux kernel with genpatches"
HOMEPAGE="https://www.kernel.org/"
SRC_URI+="
https://cdn.kernel.org/pub/linux/kernel/v$(ver_cut 1).x/${MY_P}.tar.xz
https://dev.gentoo.org/~alicef/dist/genpatches/${GENPATCHES_P}.base.tar.xz
https://dev.gentoo.org/~alicef/dist/genpatches/${GENPATCHES_P}.extras.tar.xz
amd64? (
https://dev.gentoo.org/~mgorny/binpkg/amd64/kernel/sys-kernel/gentoo-kernel/${BINPKG}.xpak
-> ${BINPKG}.amd64.xpak
)
x86? (
https://dev.gentoo.org/~mgorny/binpkg/x86/kernel/sys-kernel/gentoo-kernel/${BINPKG}.xpak
-> ${BINPKG}.x86.xpak
)"
S=${WORKDIR}
LICENSE="GPL-2"
KEYWORDS="~amd64 ~x86"
RDEPEND="
!sys-kernel/gentoo-kernel:${SLOT}
!sys-kernel/vanilla-kernel:${SLOT}
!sys-kernel/vanilla-kernel-bin:${SLOT}"
PDEPEND="
>=virtual/dist-kernel-${PV}"
BDEPEND="
sys-devel/flex
virtual/libelf
virtual/yacc"
QA_PREBUILT='*'
src_unpack() {
default
ebegin "Unpacking ${BINPKG}.${ARCH}.xpak"
tar -x < <(xz -c -d --single-stream "${DISTDIR}/${BINPKG}.${ARCH}.xpak")
eend ${?} || die "Unpacking ${BINPKG} failed"
}
src_prepare() {
local PATCHES=(
# meh, genpatches have no directory
"${WORKDIR}"/*.patch
)
cd "${MY_P}" || die
default
}
src_configure() {
# force ld.bfd if we can find it easily
local LD="$(tc-getLD)"
if type -P "${LD}.bfd" &>/dev/null; then
LD+=.bfd
fi
tc-export_build_env
local makeargs=(
V=1
HOSTCC="$(tc-getBUILD_CC)"
HOSTCXX="$(tc-getBUILD_CXX)"
HOSTCFLAGS="${BUILD_CFLAGS}"
HOSTLDFLAGS="${BUILD_LDFLAGS}"
CROSS_COMPILE=${CHOST}-
AS="$(tc-getAS)"
CC="$(tc-getCC)"
LD="${LD}"
AR="$(tc-getAR)"
NM="$(tc-getNM)"
STRIP=":"
OBJCOPY="$(tc-getOBJCOPY)"
OBJDUMP="$(tc-getOBJDUMP)"
# we need to pass it to override colliding Gentoo envvar
ARCH=$(tc-arch-kernel)
O="${WORKDIR}"/modprep
)
mkdir modprep || die
cp "usr/src/linux-${PV}/.config" modprep/ || die
emake -C "${MY_P}" "${makeargs[@]}" modules_prepare
}
src_test() {
kernel-install_test "${PV}" \
"usr/src/linux-${PV}/$(dist-kernel_get_image_path)" \
"lib/modules/${PV}"
}
src_install() {
mv lib usr "${ED}"/ || die
# strip out-of-source build stuffs from modprep
# and then copy built files
find modprep -type f '(' \
-name Makefile -o \
-name '*.[ao]' -o \
'(' -name '.*' -a -not -name '.config' ')' \
')' -delete || die
rm modprep/source || die
cp -p -R modprep/. "${ED}/usr/src/linux-${PV}"/ || die
}
@@ -0,0 +1,115 @@
# Copyright 2020-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit kernel-install toolchain-funcs
MY_P=linux-${PV%.*}
GENPATCHES_P=genpatches-${PV%.*}-$(( ${PV##*.} + 1 ))
BINPKG=${P/-bin/}-1
DESCRIPTION="Pre-built Linux kernel with genpatches"
HOMEPAGE="https://www.kernel.org/"
SRC_URI+="
https://cdn.kernel.org/pub/linux/kernel/v$(ver_cut 1).x/${MY_P}.tar.xz
https://dev.gentoo.org/~alicef/dist/genpatches/${GENPATCHES_P}.base.tar.xz
https://dev.gentoo.org/~alicef/dist/genpatches/${GENPATCHES_P}.extras.tar.xz
amd64? (
https://dev.gentoo.org/~mgorny/binpkg/amd64/kernel/sys-kernel/gentoo-kernel/${BINPKG}.xpak
-> ${BINPKG}.amd64.xpak
)
x86? (
https://dev.gentoo.org/~mgorny/binpkg/x86/kernel/sys-kernel/gentoo-kernel/${BINPKG}.xpak
-> ${BINPKG}.x86.xpak
)"
S=${WORKDIR}
LICENSE="GPL-2"
KEYWORDS="~amd64 ~x86"
RDEPEND="
!sys-kernel/gentoo-kernel:${SLOT}
!sys-kernel/vanilla-kernel:${SLOT}
!sys-kernel/vanilla-kernel-bin:${SLOT}"
PDEPEND="
>=virtual/dist-kernel-${PV}"
BDEPEND="
sys-devel/flex
virtual/libelf
virtual/yacc"
QA_PREBUILT='*'
src_unpack() {
default
ebegin "Unpacking ${BINPKG}.${ARCH}.xpak"
tar -x < <(xz -c -d --single-stream "${DISTDIR}/${BINPKG}.${ARCH}.xpak")
eend ${?} || die "Unpacking ${BINPKG} failed"
}
src_prepare() {
local PATCHES=(
# meh, genpatches have no directory
"${WORKDIR}"/*.patch
)
cd "${MY_P}" || die
default
}
src_configure() {
# force ld.bfd if we can find it easily
local LD="$(tc-getLD)"
if type -P "${LD}.bfd" &>/dev/null; then
LD+=.bfd
fi
tc-export_build_env
local makeargs=(
V=1
HOSTCC="$(tc-getBUILD_CC)"
HOSTCXX="$(tc-getBUILD_CXX)"
HOSTCFLAGS="${BUILD_CFLAGS}"
HOSTLDFLAGS="${BUILD_LDFLAGS}"
CROSS_COMPILE=${CHOST}-
AS="$(tc-getAS)"
CC="$(tc-getCC)"
LD="${LD}"
AR="$(tc-getAR)"
NM="$(tc-getNM)"
STRIP=":"
OBJCOPY="$(tc-getOBJCOPY)"
OBJDUMP="$(tc-getOBJDUMP)"
# we need to pass it to override colliding Gentoo envvar
ARCH=$(tc-arch-kernel)
O="${WORKDIR}"/modprep
)
mkdir modprep || die
cp "usr/src/linux-${PV}/.config" modprep/ || die
emake -C "${MY_P}" "${makeargs[@]}" modules_prepare
}
src_test() {
kernel-install_test "${PV}" \
"usr/src/linux-${PV}/$(dist-kernel_get_image_path)" \
"lib/modules/${PV}"
}
src_install() {
mv lib usr "${ED}"/ || die
# strip out-of-source build stuffs from modprep
# and then copy built files
find modprep -type f '(' \
-name Makefile -o \
-name '*.[ao]' -o \
'(' -name '.*' -a -not -name '.config' ')' \
')' -delete || die
rm modprep/source || die
cp -p -R modprep/. "${ED}/usr/src/linux-${PV}"/ || die
}
@@ -0,0 +1,115 @@
# Copyright 2020-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit kernel-install toolchain-funcs
MY_P=linux-${PV%.*}
GENPATCHES_P=genpatches-${PV%.*}-$(( ${PV##*.} + 1 ))
BINPKG=${P/-bin/}-1
DESCRIPTION="Pre-built Linux kernel with genpatches"
HOMEPAGE="https://www.kernel.org/"
SRC_URI+="
https://cdn.kernel.org/pub/linux/kernel/v$(ver_cut 1).x/${MY_P}.tar.xz
https://dev.gentoo.org/~mpagano/dist/genpatches/${GENPATCHES_P}.base.tar.xz
https://dev.gentoo.org/~mpagano/dist/genpatches/${GENPATCHES_P}.extras.tar.xz
amd64? (
https://dev.gentoo.org/~mgorny/binpkg/amd64/kernel/sys-kernel/gentoo-kernel/${BINPKG}.xpak
-> ${BINPKG}.amd64.xpak
)
x86? (
https://dev.gentoo.org/~mgorny/binpkg/x86/kernel/sys-kernel/gentoo-kernel/${BINPKG}.xpak
-> ${BINPKG}.x86.xpak
)"
S=${WORKDIR}
LICENSE="GPL-2"
KEYWORDS="~amd64 ~x86"
RDEPEND="
!sys-kernel/gentoo-kernel:${SLOT}
!sys-kernel/vanilla-kernel:${SLOT}
!sys-kernel/vanilla-kernel-bin:${SLOT}"
PDEPEND="
>=virtual/dist-kernel-${PV}"
BDEPEND="
sys-devel/flex
virtual/libelf
virtual/yacc"
QA_PREBUILT='*'
src_unpack() {
default
ebegin "Unpacking ${BINPKG}.${ARCH}.xpak"
tar -x < <(xz -c -d --single-stream "${DISTDIR}/${BINPKG}.${ARCH}.xpak")
eend ${?} || die "Unpacking ${BINPKG} failed"
}
src_prepare() {
local PATCHES=(
# meh, genpatches have no directory
"${WORKDIR}"/*.patch
)
cd "${MY_P}" || die
default
}
src_configure() {
# force ld.bfd if we can find it easily
local LD="$(tc-getLD)"
if type -P "${LD}.bfd" &>/dev/null; then
LD+=.bfd
fi
tc-export_build_env
local makeargs=(
V=1
HOSTCC="$(tc-getBUILD_CC)"
HOSTCXX="$(tc-getBUILD_CXX)"
HOSTCFLAGS="${BUILD_CFLAGS}"
HOSTLDFLAGS="${BUILD_LDFLAGS}"
CROSS_COMPILE=${CHOST}-
AS="$(tc-getAS)"
CC="$(tc-getCC)"
LD="${LD}"
AR="$(tc-getAR)"
NM="$(tc-getNM)"
STRIP=":"
OBJCOPY="$(tc-getOBJCOPY)"
OBJDUMP="$(tc-getOBJDUMP)"
# we need to pass it to override colliding Gentoo envvar
ARCH=$(tc-arch-kernel)
O="${WORKDIR}"/modprep
)
mkdir modprep || die
cp "usr/src/linux-${PV}/.config" modprep/ || die
emake -C "${MY_P}" "${makeargs[@]}" modules_prepare
}
src_test() {
kernel-install_test "${PV}" \
"usr/src/linux-${PV}/$(dist-kernel_get_image_path)" \
"lib/modules/${PV}"
}
src_install() {
mv lib usr "${ED}"/ || die
# strip out-of-source build stuffs from modprep
# and then copy built files
find modprep -type f '(' \
-name Makefile -o \
-name '*.[ao]' -o \
'(' -name '.*' -a -not -name '.config' ')' \
')' -delete || die
rm modprep/source || die
cp -p -R modprep/. "${ED}/usr/src/linux-${PV}"/ || die
}