sys-kernel/libre-kernel: add linux-libre site as fallback for gpg keys
This commit is contained in:
parent
0ae5f901b7
commit
2664a2dc46
|
@ -0,0 +1,148 @@
|
||||||
|
# Copyright 2020-2023 Gentoo Authors, projectmoon
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
EAPI=8
|
||||||
|
|
||||||
|
inherit kernel-build verify-sig
|
||||||
|
|
||||||
|
BASE_VER="$(ver_cut 1).$(ver_cut 2).$(ver_cut 3)"
|
||||||
|
RESTRICT="mirror"
|
||||||
|
|
||||||
|
GENPATCHES_P=genpatches-${PV%.*}-$(( ${PV##*.} + 5 ))
|
||||||
|
CONFIG_VER=5.15.19
|
||||||
|
CONFIG_HASH=ec69da7a42b5b7c3da91572ef22097b069ddbd01
|
||||||
|
GENTOO_CONFIG_VER=g7
|
||||||
|
|
||||||
|
DESCRIPTION="GNU Linux-libre kernel built from upstream sources"
|
||||||
|
HOMEPAGE="https://www.fsfla.org/ikiwiki/selibre/linux-libre/"
|
||||||
|
SRC_URI+="
|
||||||
|
https://git.agnos.is/projectmoon/projectmoon-overlay-files/media/branch/main/sys-kernel/libre-kernel/linux-libre-${BASE_VER}-gnu.tar.xz
|
||||||
|
https://linux-libre.fsfla.org/pub/linux-libre/releases/${BASE_VER}-gnu/linux-libre-${BASE_VER}-gnu.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
|
||||||
|
https://github.com/projg2/gentoo-kernel-config/archive/${GENTOO_CONFIG_VER}.tar.gz
|
||||||
|
-> gentoo-kernel-config-${GENTOO_CONFIG_VER}.tar.gz
|
||||||
|
verify-sig? (
|
||||||
|
https://git.agnos.is/projectmoon/projectmoon-overlay-files/media/branch/main/sys-kernel/libre-kernel/linux-libre-${BASE_VER}-gnu.tar.xz.sign
|
||||||
|
https://linux-libre.fsfla.org/pub/linux-libre/releases/${BASE_VER}-gnu/linux-libre-${BASE_VER}-gnu.tar.xz.sign
|
||||||
|
)
|
||||||
|
amd64? (
|
||||||
|
https://raw.githubusercontent.com/projg2/fedora-kernel-config-for-gentoo/${CONFIG_VER}/kernel-x86_64-fedora.config
|
||||||
|
-> kernel-x86_64-fedora.config.${CONFIG_VER}
|
||||||
|
)
|
||||||
|
"
|
||||||
|
|
||||||
|
# Workdir is named linux-PV.
|
||||||
|
MY_P=linux-${PV}
|
||||||
|
S=${WORKDIR}/${MY_P}
|
||||||
|
|
||||||
|
LICENSE="GPL-2"
|
||||||
|
KEYWORDS="amd64"
|
||||||
|
IUSE="debug +gentoo"
|
||||||
|
|
||||||
|
BDEPEND="
|
||||||
|
debug? ( dev-util/pahole )
|
||||||
|
verify-sig? ( sec-keys/openpgp-keys-linux-libre )
|
||||||
|
"
|
||||||
|
PDEPEND="
|
||||||
|
>=virtual/dist-kernel-${PV}
|
||||||
|
"
|
||||||
|
|
||||||
|
VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/linux-libre.asc
|
||||||
|
|
||||||
|
pkg_pretend() {
|
||||||
|
if has_version -d sys-kernel/linux-firmware[redistributable]; then
|
||||||
|
ewarn "sys-kernel/linux-firmware was found installed on your system,"
|
||||||
|
ewarn "but it is configured to install non-Free firmware files."
|
||||||
|
ewarn "The non-Free firmware files may be required for some hardware"
|
||||||
|
ewarn "work. The Linux-libre kernel cannot load non-Free firmware."
|
||||||
|
ewarn "To install only the Free firmware, set the -redistributable"
|
||||||
|
ewarn "USE flag on sys-kernel/linux-firmware."
|
||||||
|
|
||||||
|
if use initramfs; then
|
||||||
|
elog
|
||||||
|
elog "If you decide to change or remove linux-firmware later, you"
|
||||||
|
elog "can rebuild the initramfs via issuing a command equivalent to:"
|
||||||
|
elog
|
||||||
|
elog " emerge --config ${CATEGORY}/${PN}:${SLOT}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if ! has_version -d sys-kernel/linux-firmware; then
|
||||||
|
ewarn "sys-kernel/linux-firmware[-redistributable] not found installed"
|
||||||
|
ewarn "on your system. This package provides various firmware files that"
|
||||||
|
ewarn "may be needed for your hardware to work. If in doubt, it is recommended"
|
||||||
|
ewarn "to pause or abort the build process and install it before"
|
||||||
|
ewarn "resuming."
|
||||||
|
|
||||||
|
if use initramfs; then
|
||||||
|
elog
|
||||||
|
elog "If you decide to install linux-firmware later, you can rebuild"
|
||||||
|
elog "the initramfs via issuing a command equivalent to:"
|
||||||
|
elog
|
||||||
|
elog " emerge --config ${CATEGORY}/${PN}:${SLOT}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
src_unpack() {
|
||||||
|
if use verify-sig; then
|
||||||
|
FILE="${DISTDIR}"/linux-libre-${PV}-gnu.tar.xz
|
||||||
|
SIGFILE="${DISTDIR}"/linux-libre-${PV}-gnu.tar.xz.sign
|
||||||
|
verify-sig_verify_detached $FILE $SIGFILE
|
||||||
|
fi
|
||||||
|
|
||||||
|
default
|
||||||
|
}
|
||||||
|
|
||||||
|
src_prepare() {
|
||||||
|
local PATCHES
|
||||||
|
if use gentoo; then
|
||||||
|
# Fiters out the kernel incremenetal version upgrade patches,
|
||||||
|
# leaving only the Gentoo bug fix/functionality changes. The
|
||||||
|
# regex removes any patches starting with 10XX to 14XX.
|
||||||
|
MY_PATCHES=$(find "${WORKDIR}"/*.patch -printf "%f\n" | grep -v -E -e '^1[01234][[:digit:]][[:digit:]]_.+.patch')
|
||||||
|
PATCHES=$(echo "$MY_PATCHES" | sed 's|^|'"${WORKDIR}/"'|g')
|
||||||
|
else
|
||||||
|
# If no patches are to be applied, apply only the config changes
|
||||||
|
# for a Gentoo installation, as this does not change any actual
|
||||||
|
# Kernel functionality.
|
||||||
|
PATCHES="${WORKDIR}/4567_distro-Gentoo-Kconfig.patch"
|
||||||
|
fi
|
||||||
|
|
||||||
|
default
|
||||||
|
|
||||||
|
local biendian=false
|
||||||
|
|
||||||
|
# prepare the default config
|
||||||
|
case ${ARCH} in
|
||||||
|
amd64)
|
||||||
|
cp "${DISTDIR}/kernel-x86_64-fedora.config.${CONFIG_VER}" .config || die
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
die "Unsupported arch ${ARCH}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
sed -i 's/EXTRAVERSION = -gnu/EXTRAVERSION = /' "${S}"/Makefile || \
|
||||||
|
die 'could not remove EXTRAVERSION'
|
||||||
|
|
||||||
|
local myversion="-gnu-dist"
|
||||||
|
echo "CONFIG_LOCALVERSION=\"${myversion}\"" > "${T}"/version.config || die
|
||||||
|
local dist_conf_path="${WORKDIR}/gentoo-kernel-config-${GENTOO_CONFIG_VER}"
|
||||||
|
|
||||||
|
local merge_configs=(
|
||||||
|
"${T}"/version.config
|
||||||
|
"${dist_conf_path}"/base.config
|
||||||
|
)
|
||||||
|
use debug || merge_configs+=(
|
||||||
|
"${dist_conf_path}"/no-debug.config
|
||||||
|
)
|
||||||
|
|
||||||
|
# this covers ppc64 and aarch64_be only for now
|
||||||
|
if [[ ${biendian} == true && $(tc-endian) == big ]]; then
|
||||||
|
merge_configs+=( "${dist_conf_path}/big-endian.config" )
|
||||||
|
fi
|
||||||
|
|
||||||
|
kernel-build_merge_configs "${merge_configs[@]}"
|
||||||
|
}
|
Loading…
Reference in New Issue