sys-apps/kexec-tools: fix building against GCC 10
authorThomas Deutschmann <whissi@gentoo.org>
Sun, 3 May 2020 18:46:41 +0000 (20:46 +0200)
committerThomas Deutschmann <whissi@gentoo.org>
Sun, 3 May 2020 19:01:09 +0000 (21:01 +0200)
Closes: https://bugs.gentoo.org/707132
Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
sys-apps/kexec-tools/files/kexec-tools-2.0.20-remove-duplicated-variable-declarations.patch [new file with mode: 0644]
sys-apps/kexec-tools/kexec-tools-2.0.20-r1.ebuild [new file with mode: 0644]

diff --git a/sys-apps/kexec-tools/files/kexec-tools-2.0.20-remove-duplicated-variable-declarations.patch b/sys-apps/kexec-tools/files/kexec-tools-2.0.20-remove-duplicated-variable-declarations.patch
new file mode 100644 (file)
index 0000000..d71e76b
--- /dev/null
@@ -0,0 +1,99 @@
+From cc087b11462af9f971a2c090d07e8d780a867b50 Mon Sep 17 00:00:00 2001
+From: Kairui Song <kasong@redhat.com>
+Date: Wed, 29 Jan 2020 13:38:19 +0800
+Subject: kexec-tools: Remove duplicated variable declarations
+
+When building kexec-tools for Fedora 32, following error is observed:
+
+/usr/bin/ld: kexec/arch/x86_64/kexec-bzImage64.o:(.bss+0x0): multiple definition of `bzImage_support_efi_boot';
+kexec/arch/i386/kexec-bzImage.o:(.bss+0x0): first defined here
+
+/builddir/build/BUILD/kexec-tools-2.0.20/kexec/arch/arm/../../fs2dt.h:33: multiple definition of `my_debug';
+kexec/fs2dt.o:/builddir/build/BUILD/kexec-tools-2.0.20/kexec/fs2dt.h:33: first defined here
+
+/builddir/build/BUILD/kexec-tools-2.0.20/kexec/arch/arm64/kexec-arm64.h:68: multiple definition of `arm64_mem';
+kexec/fs2dt.o:/builddir/build/BUILD/kexec-tools-2.0.20/././kexec/arch/arm64/kexec-arm64.h:68: first defined here
+
+/builddir/build/BUILD/kexec-tools-2.0.20/kexec/arch/arm64/kexec-arm64.h:54: multiple definition of `initrd_size';
+kexec/fs2dt.o:/builddir/build/BUILD/kexec-tools-2.0.20/././kexec/arch/arm64/kexec-arm64.h:54: first defined here
+
+/builddir/build/BUILD/kexec-tools-2.0.20/kexec/arch/arm64/kexec-arm64.h:53: multiple definition of `initrd_base';
+kexec/fs2dt.o:/builddir/build/BUILD/kexec-tools-2.0.20/././kexec/arch/arm64/kexec-arm64.h:53: first defined here
+
+And apparently, these variables are wrongly declared multiple times. So
+remove duplicated declaration.
+
+Signed-off-by: Kairui Song <kasong@redhat.com>
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ kexec/arch/arm64/kexec-arm64.h      | 6 +++---
+ kexec/arch/ppc64/kexec-elf-ppc64.c  | 2 --
+ kexec/arch/x86_64/kexec-bzImage64.c | 1 -
+ kexec/fs2dt.h                       | 2 +-
+ 4 files changed, 4 insertions(+), 7 deletions(-)
+
+diff --git a/kexec/arch/arm64/kexec-arm64.h b/kexec/arch/arm64/kexec-arm64.h
+index 628de79..ed447ac 100644
+--- a/kexec/arch/arm64/kexec-arm64.h
++++ b/kexec/arch/arm64/kexec-arm64.h
+@@ -50,8 +50,8 @@ int zImage_arm64_load(int argc, char **argv, const char *kernel_buf,
+ void zImage_arm64_usage(void);
+-off_t initrd_base;
+-off_t initrd_size;
++extern off_t initrd_base;
++extern off_t initrd_size;
+ /**
+  * struct arm64_mem - Memory layout info.
+@@ -65,7 +65,7 @@ struct arm64_mem {
+ };
+ #define arm64_mem_ngv UINT64_MAX
+-struct arm64_mem arm64_mem;
++extern struct arm64_mem arm64_mem;
+ uint64_t get_phys_offset(void);
+ uint64_t get_vp_offset(void);
+diff --git a/kexec/arch/ppc64/kexec-elf-ppc64.c b/kexec/arch/ppc64/kexec-elf-ppc64.c
+index 3510b70..695b8b0 100644
+--- a/kexec/arch/ppc64/kexec-elf-ppc64.c
++++ b/kexec/arch/ppc64/kexec-elf-ppc64.c
+@@ -44,8 +44,6 @@
+ uint64_t initrd_base, initrd_size;
+ unsigned char reuse_initrd = 0;
+ const char *ramdisk;
+-/* Used for enabling printing message from purgatory code */
+-int my_debug = 0;
+ int elf_ppc64_probe(const char *buf, off_t len)
+ {
+diff --git a/kexec/arch/x86_64/kexec-bzImage64.c b/kexec/arch/x86_64/kexec-bzImage64.c
+index 8edb3e4..ba8dc48 100644
+--- a/kexec/arch/x86_64/kexec-bzImage64.c
++++ b/kexec/arch/x86_64/kexec-bzImage64.c
+@@ -42,7 +42,6 @@
+ #include <arch/options.h>
+ static const int probe_debug = 0;
+-int bzImage_support_efi_boot;
+ int bzImage64_probe(const char *buf, off_t len)
+ {
+diff --git a/kexec/fs2dt.h b/kexec/fs2dt.h
+index 7633273..fe24931 100644
+--- a/kexec/fs2dt.h
++++ b/kexec/fs2dt.h
+@@ -30,7 +30,7 @@ extern struct bootblock bb[1];
+ /* Used for enabling printing message from purgatory code
+  * Only has implemented for PPC64 */
+-int my_debug;
++extern int my_debug;
+ extern int dt_no_old_root;
+ void reserve(unsigned long long where, unsigned long long length);
+-- 
+cgit 1.2-0.3.lf.el7
+
diff --git a/sys-apps/kexec-tools/kexec-tools-2.0.20-r1.ebuild b/sys-apps/kexec-tools/kexec-tools-2.0.20-r1.ebuild
new file mode 100644 (file)
index 0000000..7fd2e6f
--- /dev/null
@@ -0,0 +1,89 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit flag-o-matic libtool linux-info systemd
+
+if [[ ${PV} == "9999" ]] ; then
+       inherit git-r3 autotools
+       EGIT_REPO_URI="https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git"
+else
+       SRC_URI="https://www.kernel.org/pub/linux/utils/kernel/kexec/${P/_/-}.tar.xz"
+       [[ "${PV}" == *_rc* ]] || \
+       KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86"
+fi
+
+DESCRIPTION="Load another kernel from the currently executing Linux kernel"
+HOMEPAGE="https://kernel.org/pub/linux/utils/kernel/kexec/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="booke lzma xen zlib"
+
+REQUIRED_USE="lzma? ( zlib )"
+
+DEPEND="
+       lzma? ( app-arch/xz-utils )
+       zlib? ( sys-libs/zlib )"
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}/${P/_/-}"
+
+CONFIG_CHECK="~KEXEC"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-2.0.4-disable-kexec-test.patch
+       "${FILESDIR}"/${PN}-2.0.4-out-of-source.patch
+       "${FILESDIR}"/${P}-remove-duplicated-variable-declarations.patch
+)
+
+pkg_setup() {
+       # GNU Make's $(COMPILE.S) passes ASFLAGS to $(CCAS), CCAS=$(CC)
+       export ASFLAGS="${CCASFLAGS}"
+}
+
+src_prepare() {
+       default
+       if [[ "${PV}" == 9999 ]] ; then
+               eautoreconf
+       else
+               elibtoolize
+       fi
+       filter-flags '-mindirect-branch=thunk*'
+}
+
+src_configure() {
+       local myeconfargs=(
+               $(use_with booke)
+               $(use_with lzma)
+               $(use_with xen)
+               $(use_with zlib)
+       )
+       econf "${myeconfargs[@]}"
+}
+
+src_install() {
+       default
+
+       dodoc "${FILESDIR}"/README.Gentoo
+
+       newinitd "${FILESDIR}"/kexec.init-2.0.13-r1 kexec
+       newconfd "${FILESDIR}"/kexec.conf-2.0.4 kexec
+
+       insinto /etc
+       doins "${FILESDIR}"/kexec.conf
+
+       insinto /etc/kernel/postinst.d
+       doins "${FILESDIR}"/90_kexec
+
+       systemd_dounit "${FILESDIR}"/kexec.service
+}
+
+pkg_postinst() {
+       if systemd_is_booted || has_version sys-apps/systemd; then
+               elog "For systemd support the new config file is"
+               elog "   /etc/kexec.conf"
+               elog "Please adopt it to your needs as there is no autoconfig anymore"
+       fi
+}