summaryrefslogtreecommitdiffstats
path: root/debian/patches
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches')
-rw-r--r--debian/patches/add_debian_readme.patch14
-rw-r--r--debian/patches/coldreboot.patch88
-rw-r--r--debian/patches/debianize.patch21
-rw-r--r--debian/patches/distclean_fix.patch11
-rw-r--r--debian/patches/linker-option.patch11
-rw-r--r--debian/patches/powerpcspe_support.patch11
-rw-r--r--debian/patches/series9
-rw-r--r--debian/patches/static_binary_warning.patch20
-rw-r--r--debian/patches/systemd-support.patch171
-rw-r--r--debian/patches/vmcore-dmesg_man_page_fix.patch11
10 files changed, 367 insertions, 0 deletions
diff --git a/debian/patches/add_debian_readme.patch b/debian/patches/add_debian_readme.patch
new file mode 100644
index 0000000..a50765f
--- /dev/null
+++ b/debian/patches/add_debian_readme.patch
@@ -0,0 +1,14 @@
+--- /dev/null
++++ b/README.debian
+@@ -0,0 +1,11 @@
++This kexec-tools package was built from kexec-tools git repository at
++<git://git.kernel.org/pub/scm/linux/kernel/git/horms/kexec-tools.git>.
++
++Installing this package also installs two init scripts under /etc/init.d -
++kexec-load and kexec. kexec-load is called upon reboot to load a new kexec
++kernel if kexec is enabled in /etc/default/kexec. kexec script is called
++just before reboot script. It checks if kexec is enabled and a
++kexec'able kernel is loaded. If yes, it kexecs a new kernel instead of
++reboot. As a result, kexec is automatically enabled upon installation of
++kexec-tools package if kexec is enabled in /etc/default/kexec through debconf
++option.
diff --git a/debian/patches/coldreboot.patch b/debian/patches/coldreboot.patch
new file mode 100644
index 0000000..8408116
--- /dev/null
+++ b/debian/patches/coldreboot.patch
@@ -0,0 +1,88 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -183,9 +183,11 @@
+ PGSRCS:=$(foreach s, $(GENERATED_SRCS), $(PACKAGE_NAME)-$(PACKAGE_VERSION)/$(s))
+
+ MAN_PAGES:=$(KEXEC_MANPAGE) $(VMCORE_DMESG_MANPAGE)
++MAN_PAGES+=$(MANDIR)/man8/coldreboot.8
+ BINARIES_i386:=$(KEXEC_TEST)
+ BINARIES_x86_64:=$(KEXEC_TEST)
+ BINARIES:=$(KEXEC) $(VMCORE_DMESG) $(BINARIES_$(ARCH))
++SCRIPTS:=$(SBINDIR)/coldreboot
+
+ UNINSTALL_KDUMP = $(sbindir)/kdump
+ UNINSTALL_KDUMP_MANPAGE = $(mandir)/man8/kdump.8
+@@ -195,7 +197,7 @@
+ UNINSTALL_VMCORE_DMESG = $(sbindir)/vmcore-dmesg
+ UNINSTALL_VMCORE_DMESG_MANPAGE = $(mandir)/man8/vmcore-dmesg.8
+
+-TARGETS:=$(BINARIES) $(MAN_PAGES)
++TARGETS:=$(BINARIES) $(MAN_PAGES) $(SCRIPTS)
+ targets: $(TARGETS)
+
+ UNINSTALL_TARGETS_i386:=$(UNINSTALL_KEXEC_TEST)
+--- a/kexec/Makefile
++++ b/kexec/Makefile
+@@ -105,6 +105,8 @@
+
+ KEXEC = $(SBINDIR)/kexec
+ KEXEC_MANPAGE = $(MANDIR)/man8/kexec.8
++KEXEC_COLDREBOOT=$(SBINDIR)/coldreboot
++KEXEC_COLDREBOOT_MANPAGE=$(MANDIR)/man8/coldreboot.8
+
+ -include $(KEXEC_DEPS)
+
+@@ -119,6 +121,16 @@
+ $(KEXEC_MANPAGE): kexec/kexec.8
+ @$(MKDIR) -p $(MANDIR)/man8
+ cp $^ $(KEXEC_MANPAGE)
++
++$(KEXEC_COLDREBOOT): kexec/coldreboot
++ @$(MKDIR) -p $(@D)
++ cp kexec/coldreboot $(KEXEC_COLDREBOOT)
++ /bin/chmod 755 $(KEXEC_COLDREBOOT)
++
++$(KEXEC_COLDREBOOT_MANPAGE): kexec/coldreboot.8
++ @$(MKDIR) -p $(MANDIR)/man8
++ cp kexec/coldreboot.8 $(KEXEC_COLDREBOOT_MANPAGE)
++
+ echo::
+ @echo "KEXEC_SRCS $(KEXEC_SRCS)"
+ @echo "KEXEC_DEPS $(KEXEC_DEPS)"
+--- /dev/null
++++ b/kexec/coldreboot
+@@ -0,0 +1,6 @@
++#!/bin/sh
++NOKEXECFILE=/no-kexec-reboot
++
++/bin/rm -f $NOKEXECFILE
++touch $NOKEXECFILE
++/sbin/reboot $*
+--- /dev/null
++++ b/kexec/coldreboot.8
+@@ -0,0 +1,25 @@
++.\" Process this file with
++.\" groff -man -Tascii coldreboot.8
++.\"
++.TH kexec 8 "April 2006" Linux "User Manuals"
++.SH NAME
++coldreboot \- Force a cold reboot bypassing kexec-tools default
++.SH SYNOPSIS
++.B /sbin/coldreboot
++.B [reboot options]
++
++.SH DESCRIPTION
++.B coldreboot
++is a script that forces a cold reboot regardless of whether kexec is enabled
++or not in /etc/default/kexec.
++.B coldreboot
++takes the same arguments as /sbin/reboot and passes them on to /sbin/reboot
++later.
++
++.SH NOTES
++.PP
++.B coldreboot
++prevents a kexec kernel from being loaded automatically and thus
++forces a cold reboot. If the user loads a kexec kernel by hand,
++.B coldreboot
++will still result in a kexec reboot.
diff --git a/debian/patches/debianize.patch b/debian/patches/debianize.patch
new file mode 100644
index 0000000..f6bd5dc
--- /dev/null
+++ b/debian/patches/debianize.patch
@@ -0,0 +1,21 @@
+Description: Fix up upstream files to be Denian compliant
+ Upstream installs files in locations not compliant with debian
+ standard. This patch fixes upstream Makefile to make it
+ compliant.
+Author: Khalid Aziz <khalid@debian.org>
+Origin: other
+Bug: https://bugs.debiab.org
+Last-Update: 2023-09-28
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -93,7 +93,7 @@ SHAREDSTATEDIR=$(BUILD_PREFIX)/com
+ LOCALSTATEDIR=$(BUILD_PREFIX)/var
+ LIBDIR=$(BUILD_PREFIX)/lib
+ INFODIR=$(BUILD_PREFIX)/info
+-MANDIR=$(BUILD_PREFIX)/man
++MANDIR=$(BUILD_PREFIX)/share/man
+ MAN1DIR=$(MANDIR)/man1
+ MAN2DIR=$(MANDIR)/man2
+ MAN3DIR=$(MANDIR)/man3
diff --git a/debian/patches/distclean_fix.patch b/debian/patches/distclean_fix.patch
new file mode 100644
index 0000000..b0146f4
--- /dev/null
+++ b/debian/patches/distclean_fix.patch
@@ -0,0 +1,11 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -255,7 +255,7 @@ clean:
+ distclean: dist-clean
+
+ dist-clean: clean
+- $(RM) -f config.log config.status config.cache Makefile include/config.h
++ $(RM) -f config.log config.status config.cache Makefile include/config.h include/stamp-h*
+ $(RM) -f include/config.h.in configure $(SPEC)
+ $(RM) -rf autom4te.cache
+
diff --git a/debian/patches/linker-option.patch b/debian/patches/linker-option.patch
new file mode 100644
index 0000000..96883dc
--- /dev/null
+++ b/debian/patches/linker-option.patch
@@ -0,0 +1,11 @@
+--- a/purgatory/Makefile
++++ b/purgatory/Makefile
+@@ -67,7 +67,7 @@
+ $(PURGATORY): $(PURGATORY_OBJS)
+ $(MKDIR) -p $(@D)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@.sym $^
+-# $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) --no-undefined -e purgatory_start -r -o $@ $(PURGATORY_OBJS) $(UTIL_LIB)
++# $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -Wl,--no-undefined -e purgatory_start -r -o $@ $(PURGATORY_OBJS) $(UTIL_LIB)
+ $(STRIP) --strip-debug -o $@ $@.sym
+
+ echo::
diff --git a/debian/patches/powerpcspe_support.patch b/debian/patches/powerpcspe_support.patch
new file mode 100644
index 0000000..89c2cb3
--- /dev/null
+++ b/debian/patches/powerpcspe_support.patch
@@ -0,0 +1,11 @@
+--- a/kexec/arch/ppc/ppc-setup-dol.S
++++ b/kexec/arch/ppc/ppc-setup-dol.S
+@@ -80,7 +80,7 @@ setup_dol_start:
+ isync
+
+ /* AFAIK, this is not strictly needed, although seems sane */
+-#if 1
++#ifndef __NO_FPRS__
+ li r9, 0
+
+ /* page table pointer */
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..cea08c4
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,9 @@
+debianize.patch
+static_binary_warning.patch
+distclean_fix.patch
+add_debian_readme.patch
+coldreboot.patch
+linker-option.patch
+powerpcspe_support.patch
+vmcore-dmesg_man_page_fix.patch
+systemd-support.patch
diff --git a/debian/patches/static_binary_warning.patch b/debian/patches/static_binary_warning.patch
new file mode 100644
index 0000000..cabc937
--- /dev/null
+++ b/debian/patches/static_binary_warning.patch
@@ -0,0 +1,20 @@
+Index: kexec-tools-2.0.3/kexec_test/Makefile
+===================================================================
+--- kexec-tools-2.0.3.orig/kexec_test/Makefile 2012-01-24 14:10:44.383816036 -0700
++++ kexec-tools-2.0.3/kexec_test/Makefile 2012-01-31 08:44:23.235020166 -0700
+@@ -20,7 +20,7 @@
+ KEXEC_TEST_OBJS = $(call objify, $(KEXEC_TEST_SRCS))
+ KEXEC_TEST_DEPS = $(call depify, $(KEXEC_TEST_OBJS))
+
+-KEXEC_TEST = $(PKGLIBDIR)/kexec_test
++KEXEC_TEST = $(PKGLIBDIR)/kexec_test.static
+
+ clean += $(KEXEC_TEST_OBJS) $(KEXEC_TEST_DEPS) $(KEXEC_TEST)
+
+@@ -36,5 +36,6 @@
+ $(KEXEC_TEST): $(KEXEC_TEST_OBJS)
+ mkdir -p $(@D)
+ $(TARGET_LD) $(LDFLAGS) -o $@ $^
++ strip $@
+
+ endif
diff --git a/debian/patches/systemd-support.patch b/debian/patches/systemd-support.patch
new file mode 100644
index 0000000..06868eb
--- /dev/null
+++ b/debian/patches/systemd-support.patch
@@ -0,0 +1,171 @@
+Description: Add scripts to support kexec rebots with systemd
+ systemd supports kexec reboots natively. To perform kexec
+ reboot, one can rely upon systemctl loading the kexec kernel
+ image or one must load a kexec kernel image before reboot.
+ systemctl supports loading kexec image only on systems that
+ support boot loader spec. This patch adds a script that can
+ determine the right kernel to load and load it in memory ready
+ for kexec.
+Author: Khalid Aziz <khalid@debian.org>
+Origin: other, Debian addition
+Bug: https://bugs.debian.org
+Last-Update: 2023-09-28
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -184,10 +184,11 @@
+
+ MAN_PAGES:=$(KEXEC_MANPAGE) $(VMCORE_DMESG_MANPAGE)
+ MAN_PAGES+=$(MANDIR)/man8/coldreboot.8
++MAN_PAGES+=$(MANDIR)/man8/kexec-load-kernel.8
+ BINARIES_i386:=$(KEXEC_TEST)
+ BINARIES_x86_64:=$(KEXEC_TEST)
+ BINARIES:=$(KEXEC) $(VMCORE_DMESG) $(BINARIES_$(ARCH))
+-SCRIPTS:=$(SBINDIR)/coldreboot
++SCRIPTS:=$(SBINDIR)/coldreboot $(SBINDIR)/kexec-load-kernel
+
+ UNINSTALL_KDUMP = $(sbindir)/kdump
+ UNINSTALL_KDUMP_MANPAGE = $(mandir)/man8/kdump.8
+--- a/kexec/Makefile
++++ b/kexec/Makefile
+@@ -107,6 +107,8 @@
+ KEXEC_MANPAGE = $(MANDIR)/man8/kexec.8
+ KEXEC_COLDREBOOT=$(SBINDIR)/coldreboot
+ KEXEC_COLDREBOOT_MANPAGE=$(MANDIR)/man8/coldreboot.8
++KEXEC_LOADKERNEL=$(SBINDIR)/kexec-load-kernel
++KEXEC_LOADKERNEL_MANPAGE=$(MANDIR)/man8/kexec-load-kernel.8
+
+ -include $(KEXEC_DEPS)
+
+@@ -131,6 +133,15 @@
+ @$(MKDIR) -p $(MANDIR)/man8
+ cp kexec/coldreboot.8 $(KEXEC_COLDREBOOT_MANPAGE)
+
++$(KEXEC_LOADKERNEL): kexec/kexec-load-kernel
++ @$(MKDIR) -p $(@D)
++ cp kexec/kexec-load-kernel $(KEXEC_LOADKERNEL)
++ /bin/chmod 755 $(KEXEC_LOADKERNEL)
++
++$(KEXEC_LOADKERNEL_MANPAGE): kexec/kexec-load-kernel.8
++ @$(MKDIR) -p $(MANDIR)/man8
++ cp kexec/kexec-load-kernel.8 $(KEXEC_LOADKERNEL_MANPAGE)
++
+ echo::
+ @echo "KEXEC_SRCS $(KEXEC_SRCS)"
+ @echo "KEXEC_DEPS $(KEXEC_DEPS)"
+--- /dev/null
++++ b/kexec/kexec-load-kernel
+@@ -0,0 +1,90 @@
++#! /bin/sh
++
++PATH=/sbin:/bin:/usr/sbin:/usr/bin
++NOKEXECFILE=/no-kexec-reboot
++
++. /lib/lsb/init-functions
++
++test -r /etc/default/kexec && . /etc/default/kexec
++if [ -d /etc/default/kexec.d ] ; then
++ for snippet in $(run-parts --list /etc/default/kexec.d) ; do
++ . "$snippet"
++ done
++fi
++
++process_grub_entry() {
++ initrd_image=
++ while read command args; do
++ if [ "$command" = "linux" ]; then
++ echo "$args" | while read kernel append; do
++ echo KERNEL_IMAGE=\"${prefix}${kernel}\"
++ echo APPEND=\"${append}\"
++ done
++ elif [ "$command" = "initrd" ]; then
++ initrd_image=${prefix}${args}
++ fi
++ done
++ echo INITRD=\"$initrd_image\"
++}
++
++get_grub_kernel() {
++ test -f /boot/grub/grub.cfg || return
++ local prefix
++ mountpoint -q /boot && prefix=/boot || prefix=
++ data=$(cat /boot/grub/grub.cfg)
++
++ default=$(echo "$data" | awk '/set default/ {print $2}' | cut -d'"' -f2 | tail -1)
++ if [ "$default" = '${saved_entry}' ]; then
++ default=$(sed -ne 's/^saved_entry=//p' /boot/grub/grubenv)
++ fi
++ if [ -z "$default" ]; then
++ default=0
++ fi
++ start_offset=$((default + 1))
++ end_offset=$((default + 2))
++
++ # grub entries start with "menuentry" commands. Get the line
++ # numbers that surround the first entry
++ offsets=$(echo "$data" | grep -n '^[[:space:]]*menuentry[[:space:]]' | cut -d: -f1)
++ begin=$(echo "$offsets" | tail -n+$start_offset | head -n1)
++ end=$(echo "$offsets" | tail -n+$end_offset | head -n1)
++
++ # If this is the last entry, we need to read to the end of the file
++ # or to the end of boot entry section
++ if [ -z "$end" ]; then
++ numlines=$(echo "$data" | tail --lines=+$begin | grep -n "^### END" | head -1 | cut -d: -f1)
++ end=$((begin + numlines - 1))
++ fi
++
++ length=$((end - begin))
++ entry=$(echo "$data" | tail -n+$begin | head -n$length)
++ eval $(echo "$entry" | process_grub_entry)
++}
++
++load_kernel () {
++ test -x /sbin/kexec || exit 0
++ test "x`cat /sys/kernel/kexec_loaded`y" = "x1y" && exit 0
++
++ if [ -f $NOKEXECFILE ]
++ then
++ /bin/rm -f $NOKEXECFILE
++ exit 0
++ fi
++
++ test "$USE_GRUB_CONFIG" = "true" && get_grub_kernel
++
++ REAL_APPEND="$APPEND"
++
++ test -z "$REAL_APPEND" && REAL_APPEND="`cat /proc/cmdline`"
++ echo "Loading new kernel image into memory"
++ if [ -z "$INITRD" ]
++ then
++ /sbin/kexec -l "$KERNEL_IMAGE" --append="$REAL_APPEND"
++ else
++ /sbin/kexec -l "$KERNEL_IMAGE" --initrd="$INITRD" --append="$REAL_APPEND"
++ fi
++ echo "kexec kernel loaded"
++}
++
++load_kernel
++exit 0
+--- /dev/null
++++ b/kexec/kexec-load-kernel.8
+@@ -0,0 +1,19 @@
++.\" Process this file with
++.\" groff -man -Tascii kexec-load-kernel.8
++.\"
++.TH kexec 8 "April 2006" Linux "User Manuals"
++.SH NAME
++kexec-load-kernel \- Load the default grub kernel into kexec buffer
++.SH SYNOPSIS
++.B /sbin/kexec-load-kernel
++
++.SH DESCRIPTION
++.B kexec-load-kernel
++parses grub configuration file to determine the default grub kernel and
++loads it in kexec buffer if kexec reboot is enabled.
++
++.SH NOTES
++.PP
++.B kexec-load-kernel
++is run just before a kexec reboot to load the new kernel in memory. The
++subsequent call to kexec will result in this kernel to be kexec'd.
diff --git a/debian/patches/vmcore-dmesg_man_page_fix.patch b/debian/patches/vmcore-dmesg_man_page_fix.patch
new file mode 100644
index 0000000..1230ebd
--- /dev/null
+++ b/debian/patches/vmcore-dmesg_man_page_fix.patch
@@ -0,0 +1,11 @@
+--- a/vmcore-dmesg/vmcore-dmesg.8
++++ b/vmcore-dmesg/vmcore-dmesg.8
+@@ -16,7 +16,7 @@
+ .\" .sp <n> insert n+1 empty lines
+ .\" for manpage-specific macros, see man(7)
+ .SH NAME
+-vmcore-dmesg
++vmcore-dmesg \- extract the dmesg from a vmcore
+ .SH SYNOPSIS
+ .B vmcore-dmesg
+ .RI " vmcore"