Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 1/2] kernel-install.eclass: Add pkg_config() to reinstall
Date: Wed, 17 Jun 2020 10:27:24
Message-Id: 20200617102641.448098-1-mgorny@gentoo.org
1 Add a pkg_config() phase that can be used to rebuild the initramfs
2 and reinstall the kernel without rebuilding the whole package.
3
4 Signed-off-by: Michał Górny <mgorny@g.o>
5 ---
6 eclass/kernel-install.eclass | 23 +++++++++++++++++++++++
7 1 file changed, 23 insertions(+)
8
9 diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass
10 index efccd70608c0..b3ef186a74eb 100644
11 --- a/eclass/kernel-install.eclass
12 +++ b/eclass/kernel-install.eclass
13 @@ -330,7 +330,30 @@ kernel-install_pkg_postrm() {
14 fi
15 }
16
17 +# @FUNCTION: kernel-install_pkg_config
18 +# @DESCRIPTION:
19 +# Rebuild the initramfs and reinstall the kernel.
20 +kernel-install_pkg_config() {
21 + [[ -z ${ROOT} ]] || die "ROOT!=/ not supported currently"
22 +
23 + mount-boot_pkg_preinst
24 +
25 + local image_path=$(kernel-install_get_image_path)
26 + if use initramfs; then
27 + # putting it alongside kernel image as 'initrd' makes
28 + # kernel-install happier
29 + kernel-install_build_initramfs \
30 + "${EROOT}/usr/src/linux-${PV}/${image_path%/*}/initrd" \
31 + "${PV}"
32 + fi
33 +
34 + kernel-install_install_kernel "${PV}" \
35 + "${EROOT}/usr/src/linux-${PV}/${image_path}" \
36 + "${EROOT}/usr/src/linux-${PV}/System.map"
37 +}
38 +
39 _KERNEL_INSTALL_ECLASS=1
40 fi
41
42 EXPORT_FUNCTIONS src_test pkg_preinst pkg_postinst pkg_prerm pkg_postrm
43 +EXPORT_FUNCTIONS pkg_config
44 --
45 2.27.0

Replies