diff options
Diffstat (limited to 'abs/extra/kexec-tools')
-rw-r--r-- | abs/extra/kexec-tools/PKGBUILD | 33 | ||||
-rwxr-xr-x | abs/extra/kexec-tools/kexec | 45 | ||||
-rw-r--r-- | abs/extra/kexec-tools/kexec-vesafb.diff | 78 | ||||
-rw-r--r-- | abs/extra/kexec-tools/kexec.conf.d | 16 |
4 files changed, 172 insertions, 0 deletions
diff --git a/abs/extra/kexec-tools/PKGBUILD b/abs/extra/kexec-tools/PKGBUILD new file mode 100644 index 0000000..6054381 --- /dev/null +++ b/abs/extra/kexec-tools/PKGBUILD @@ -0,0 +1,33 @@ +# Contributor: Camille Moncelier <pix@devlife.org>, simo <simo@archlinux.org> +# Maintainer: Tobias Powalowski <tpowa@archlinux.org> + +pkgname=kexec-tools +pkgver=2.0.20 +pkgrel=2 +pkgdesc="Load another kernel from the currently executing Linux kernel" +arch=('x86_64') +url="https://kernel.org/pub/linux/utils/kernel/kexec/" +source=("git://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git#tag=v${pkgver}") +makedepends=('git') +depends=('zlib' 'xz') +license=('GPL2') + +prepare() { + cd $pkgname + ./bootstrap +} + +build() { + cd $pkgname + CFLAGS+=' -fcommon' # https://wiki.gentoo.org/wiki/Gcc_10_porting_notes/fno_common + ./configure --prefix=/usr --sbindir=/usr/bin --without-lzma + make +} + +package() { + cd $pkgname + make DESTDIR="$pkgdir" install + install -D -m644 kexec/kexec.8 "$pkgdir"/usr/share/man/man8/kexec.8 +} + +md5sums=('SKIP') diff --git a/abs/extra/kexec-tools/kexec b/abs/extra/kexec-tools/kexec new file mode 100755 index 0000000..c2e9a78 --- /dev/null +++ b/abs/extra/kexec-tools/kexec @@ -0,0 +1,45 @@ +#!/bin/bash + +[ -f /etc/conf.d/kexec ] && . /etc/conf.d/kexec + +. /etc/rc.conf +. /etc/rc.d/functions + +case "$1" in + start) + stat_busy "Enabling kexec on reboot" + add_daemon kexec + stat_done + ;; + + stop|load) + if [ "$RUNLEVEL" = "6" -o "$1" = "load" ]; then + stat_busy "Loading kexec kernel" + [ -f "$KPATH" ] || stat_fail + [ -f "$INITRD" ] && _INITRD="--initrd=$INITRD" + /sbin/kexec -l $KPATH --append="root=$ROOTPART $KPARAM" $_INITRD > /dev/null 2>&1 + else + stat_busy "Disabling kexec on reboot" + fi + if [ $? -eq 0 ] ; then + rm_daemon kexec + stat_done + else + stat_fail + fi + ;; + + unload) + stat_busy "Unloading kexec kernel" + /sbin/kexec -u + if [ $? -eq 0 ] ; then + stat_done + else + stat_fail + fi + ;; + + *) + echo "usage: $0 {start|stop|load|unload}" +esac +exit 0 diff --git a/abs/extra/kexec-tools/kexec-vesafb.diff b/abs/extra/kexec-tools/kexec-vesafb.diff new file mode 100644 index 0000000..ec16422 --- /dev/null +++ b/abs/extra/kexec-tools/kexec-vesafb.diff @@ -0,0 +1,78 @@ +Index: kexec-tools-1.101/kexec/arch/i386/x86-linux-setup.c +=================================================================== +--- kexec-tools-1.101.orig/kexec/arch/i386/x86-linux-setup.c 2006-03-03 10:51:31.000000000 +0100 ++++ kexec-tools-1.101/kexec/arch/i386/x86-linux-setup.c 2006-03-10 14:02:20.000000000 +0100 +@@ -24,6 +24,8 @@ + #include <sys/stat.h> + #include <sys/mman.h> + #include <fcntl.h> ++#include <sys/ioctl.h> ++#include <linux/fb.h> + #include <unistd.h> + #include <x86/x86-linux.h> + #include "../../kexec.h" +@@ -94,6 +96,56 @@ void setup_linux_bootloader_parameters( + cmdline_ptr[cmdline_len - 1] = '\0'; + } + ++int setup_linux_vesafb(struct x86_linux_param_header *real_mode) ++{ ++ struct fb_fix_screeninfo fix; ++ struct fb_var_screeninfo var; ++ int fd; ++ ++ fd = open("/dev/fb0", O_RDONLY); ++ if (-1 == fd) ++ return -1; ++ ++ if (-1 == ioctl(fd, FBIOGET_FSCREENINFO, &fix)) ++ goto out; ++ if (-1 == ioctl(fd, FBIOGET_VSCREENINFO, &var)) ++ goto out; ++ if (0 != strcmp(fix.id, "VESA VGA")) ++ goto out; ++ close(fd); ++ ++ real_mode->orig_video_isVGA = 0x23 /* VIDEO_TYPE_VLFB */; ++ real_mode->lfb_width = var.xres; ++ real_mode->lfb_height = var.yres; ++ real_mode->lfb_depth = var.bits_per_pixel; ++ real_mode->lfb_base = fix.smem_start; ++ real_mode->lfb_linelength = fix.line_length; ++ real_mode->vesapm_seg = 0; ++ ++ /* fixme: better get size from /proc/iomem */ ++ real_mode->lfb_size = (fix.smem_len + 65535) / 65536; ++ real_mode->pages = (fix.smem_len + 4095) / 4096; ++ ++ if (var.bits_per_pixel > 8) { ++ real_mode->red_pos = var.red.offset; ++ real_mode->red_size = var.red.length; ++ real_mode->green_pos = var.green.offset; ++ real_mode->green_size = var.green.length; ++ real_mode->blue_pos = var.blue.offset; ++ real_mode->blue_size = var.blue.length; ++ real_mode->rsvd_pos = var.transp.offset; ++ real_mode->rsvd_size = var.transp.length; ++ } ++ fprintf(stderr, "%s: %dx%dx%d @ %lx +%lx\n", __FUNCTION__, ++ var.xres, var.yres, var.bits_per_pixel, ++ fix.smem_start, fix.smem_len); ++ return 0; ++ ++ out: ++ close(fd); ++ return -1; ++} ++ + void setup_linux_system_parameters(struct x86_linux_param_header *real_mode) + { + /* Fill in information the BIOS would usually provide */ +@@ -111,6 +163,7 @@ void setup_linux_system_parameters(struc + real_mode->orig_video_ega_bx = 0; + real_mode->orig_video_isVGA = 1; + real_mode->orig_video_points = 16; ++ setup_linux_vesafb(real_mode); + + /* Fill in the memsize later */ + real_mode->ext_mem_k = 0; diff --git a/abs/extra/kexec-tools/kexec.conf.d b/abs/extra/kexec-tools/kexec.conf.d new file mode 100644 index 0000000..991a7a2 --- /dev/null +++ b/abs/extra/kexec-tools/kexec.conf.d @@ -0,0 +1,16 @@ +# +# Configuration for Kexec +# + +# Path to kernel, default to stock arch kernel +KPATH="/boot/vmlinuz-linux" + +# Root partition +# The default attempts to autodetect +ROOTPART="$(awk '/^[ \t]*[^#]/ { if ($2 == "/") { print $1; }}' /etc/fstab)" + +# Additional kernel parameters +KPARAM="ro" + +# Path to initrd image, default to stock arch kernel +INITRD="/boot/initramfs-linux.img" |