summaryrefslogtreecommitdiff
path: root/eclass/kernel-install.eclass
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-07-16 12:27:58 +0100
committerV3n3RiX <venerix@koprulu.sector>2024-07-16 12:27:58 +0100
commitb6fa31c964a602f8461a77d5b83355e8750c12eb (patch)
tree323fa7af31640b3ea8bb57fa7a927713f3d64769 /eclass/kernel-install.eclass
parent868fd5dc8aab84930cfaa5252b8be06b35552765 (diff)
gentoo auto-resync : 16:07:2024 - 12:27:58
Diffstat (limited to 'eclass/kernel-install.eclass')
-rw-r--r--eclass/kernel-install.eclass100
1 files changed, 62 insertions, 38 deletions
diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass
index 77570a905ce1..e6f0b404dcaa 100644
--- a/eclass/kernel-install.eclass
+++ b/eclass/kernel-install.eclass
@@ -26,6 +26,15 @@
# If set to a non-null value, adds IUSE=generic-uki and required
# logic to install a generic unified kernel image.
+# @ECLASS_VARIABLE: KV_FULL
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# A string containing the full kernel release version, e.g.
+# '6.9.6-gentoo-dist'. Defaults to ${PV}${KV_LOCALVERSION},
+# but can be set by the ebuild when this default value does
+# not match the kernel release. kernel-build.eclass sets this
+# to whatever is in the built kernel's kernel.release file.
+
# @ECLASS_VARIABLE: KV_LOCALVERSION
# @DEFAULT_UNSET
# @DESCRIPTION:
@@ -63,7 +72,10 @@ _IDEPEND_BASE="
>=sys-kernel/installkernel-14
)
initramfs? (
- >=sys-kernel/installkernel-14[dracut(-)]
+ || (
+ >=sys-kernel/installkernel-14[dracut(-)]
+ >=sys-kernel/installkernel-14[ugrd(-)]
+ )
)
"
@@ -190,7 +202,7 @@ if [[ ${KERNEL_IUSE_GENERIC_UKI} ]]; then
"
IDEPEND="
generic-uki? (
- >=sys-kernel/installkernel-14[-dracut(-),-ukify(-)]
+ >=sys-kernel/installkernel-14[-dracut(-),-ugrd(-),-ukify(-)]
)
!generic-uki? (
${_IDEPEND_BASE}
@@ -543,16 +555,26 @@ kernel-install_pkg_pretend() {
if ! use initramfs && ! has_version "${CATEGORY}/${PN}[-initramfs]"; then
ewarn
- ewarn "WARNING: The standard configuration of the Gentoo distribution"
- ewarn "kernels requires an initramfs! You have disabled the initramfs"
- ewarn "USE flag and as a result dracut was not pulled in as a dependency."
- ewarn "Please ensure that you are either overriding the standard"
- ewarn "configuration or that an alternative initramfs generation plugin"
- ewarn "is installed for your installkernel implementation!"
- ewarn
- ewarn "This is an advanced use case, you are on your own to ensure"
- ewarn "that your system is bootable!"
+ ewarn "WARNING: The default distribution kernel configuration is designed"
+ ewarn "to be used with an initramfs! Although possible, there is no guarantee"
+ ewarn "that distribution kernels will boot without an initramfs."
ewarn
+ ewarn "You have disabled the initramfs USE flag, and as a result the package manager"
+ ewarn "will not enforce the configuration of an initramfs generator in"
+ ewarn "sys-kernel/installkernel."
+ ewarn
+ ewarn "If you wish to use a custom initramfs generator, then please ensure that"
+ ewarn "/sbin/installkernel is capable of calling it via a kernel installation hook,"
+ ewarn "and is also configured to use it via /etc/kernel/install.conf."
+ ewarn
+ ewarn "If you wish to boot without an initramfs, then please ensure that"
+ ewarn "all kernel drivers required to boot your system are built into the"
+ ewarn "kernel by modifying the default distribution kernel configuration"
+ ewarn "using /etc/kernel/config.d"
+ ewarn
+ ewarn "Please refer to the installkernel and distribution kernel documentation:"
+ ewarn " https://wiki.gentoo.org/wiki/Installkernel"
+ ewarn " https://wiki.gentoo.org/wiki/Project:Distribution_Kernel"
fi
}
@@ -571,40 +593,40 @@ kernel-install_src_test() {
kernel-install_pkg_preinst() {
debug-print-function ${FUNCNAME} "${@}"
- local dir_ver=${PV}${KV_LOCALVERSION}
- local kernel_dir=${ED}/usr/src/linux-${dir_ver}
- local relfile=${kernel_dir}/include/config/kernel.release
+ # Set KV_FULL to ${PV}${KV_LOCALVERSION} if it hasn't
+ # been set elsewhere for backward compatibility with existing
+ # bin-kernel packages
+ if [[ -z ${KV_FULL} ]]; then
+ KV_FULL=${PV}${KV_LOCALVERSION}
+ fi
+
+ local kernel_dir=${ED}/usr/src/linux-${KV_FULL}
local image_path=$(dist-kernel_get_image_path)
[[ ! -d ${kernel_dir} ]] &&
die "Kernel directory ${kernel_dir} not installed!"
- [[ ! -f ${relfile} ]] &&
- die "Release file ${relfile} not installed!"
- local release
- release="$(<"${relfile}")" || die
- DIST_KERNEL_RELEASE="${release}"
# perform the version check for release ebuilds only
if [[ ${PV} != *9999 ]]; then
local expected_ver=$(dist-kernel_PV_to_KV "${PV}")
- if [[ ${release} != ${expected_ver}* ]]; then
- eerror "Kernel release mismatch!"
- eerror " expected (PV): ${expected_ver}*"
- eerror " found: ${release}"
- eerror "Please verify that you are applying the correct patches."
- die "Kernel release mismatch (${release} instead of ${expected_ver}*)"
+ if [[ ${KV_FULL} != ${expected_ver}* ]]; then
+ eerror "Kernel version does not match PV!"
+ eerror "Source version: ${KV_FULL}"
+ eerror "Expected (PV*): ${expected_ver}*"
+ eerror "Please ensure you are applying the correct patchset."
+ die "Kernel version mismatch: got ${KV_FULL}, expected ${expected_ver}*"
fi
fi
if [[ -L ${EROOT}/lib && ${EROOT}/lib -ef ${EROOT}/usr/lib ]]; then
# Adjust symlinks for merged-usr.
- rm "${ED}/lib/modules/${release}"/{build,source} || die
- dosym "../../../src/linux-${dir_ver}" "/usr/lib/modules/${release}/build"
- dosym "../../../src/linux-${dir_ver}" "/usr/lib/modules/${release}/source"
+ rm "${ED}/lib/modules/${KV_FULL}"/{build,source} || die
+ dosym "../../../src/linux-${KV_FULL}" "/usr/lib/modules/${KV_FULL}/build"
+ dosym "../../../src/linux-${KV_FULL}" "/usr/lib/modules/${KV_FULL}/source"
for file in vmlinux vmlinuz; do
- if [[ -L "${ED}/lib/modules/${release}/${file}" ]]; then
- rm "${ED}/lib/modules/${release}/${file}" || die
- dosym "../../../src/linux-${dir_ver}/${image_path}" "/usr/lib/modules/${release}/${file}"
+ if [[ -L "${ED}/lib/modules/${KV_FULL}/${file}" ]]; then
+ rm "${ED}/lib/modules/${KV_FULL}/${file}" || die
+ dosym "../../../src/linux-${KV_FULL}/${image_path}" "/usr/lib/modules/${KV_FULL}/${file}"
fi
done
fi
@@ -678,13 +700,12 @@ kernel-install_install_all() {
kernel-install_pkg_postinst() {
debug-print-function ${FUNCNAME} "${@}"
- local dir_ver=${PV}${KV_LOCALVERSION}
- kernel-install_update_symlink "${EROOT}/usr/src/linux" "${dir_ver}"
+ kernel-install_update_symlink "${EROOT}/usr/src/linux" "${KV_FULL}"
dist-kernel_compressed_module_cleanup \
- "${EROOT}/lib/modules/${DIST_KERNEL_RELEASE}"
+ "${EROOT}/lib/modules/${KV_FULL}"
if [[ -z ${ROOT} ]]; then
- kernel-install_install_all "${dir_ver}"
+ kernel-install_install_all "${KV_FULL}"
fi
if [[ ${KERNEL_IUSE_GENERIC_UKI} ]] && use generic-uki; then
@@ -708,8 +729,7 @@ kernel-install_pkg_postrm() {
debug-print-function ${FUNCNAME} "${@}"
if [[ -z ${ROOT} && ! ${KERNEL_IUSE_GENERIC_UKI} ]]; then
- local dir_ver=${PV}${KV_LOCALVERSION}
- local kernel_dir=${EROOT}/usr/src/linux-${dir_ver}
+ local kernel_dir=${EROOT}/usr/src/linux-${KV_FULL}
local image_path=$(dist-kernel_get_image_path)
ebegin "Removing initramfs"
rm -f "${kernel_dir}/${image_path%/*}"/{initrd,uki.efi} &&
@@ -724,7 +744,11 @@ kernel-install_pkg_postrm() {
kernel-install_pkg_config() {
[[ -z ${ROOT} ]] || die "ROOT!=/ not supported currently"
- kernel-install_install_all "${PV}${KV_LOCALVERSION}"
+ if [[ -z ${KV_FULL} ]]; then
+ KV_FULL=${PV}${KV_LOCALVERSION}
+ fi
+
+ kernel-install_install_all "${KV_FULL}"
}
# @FUNCTION: kernel-install_compress_modules