This commit is contained in:
parent
e00ff5aac2
commit
c1d20ee5b3
@ -1,8 +0,0 @@
|
||||
Update note
|
||||
-----------
|
||||
|
||||
This file formerly documented Kdump. Started with SLES10 SP2 and openSUSE 11.0,
|
||||
kdump scripts have been moved to an extra package, called "kdump". You now can
|
||||
find the documentation in /usr/share/doc/packages/kdump/README.
|
||||
|
||||
And remember to have a lot of fun ...
|
3
kexec-tools-2.0.0-rc1.tar.bz2
Normal file
3
kexec-tools-2.0.0-rc1.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e3a5cc833b1bfad227169ada0d4863fe830b4cab065549ff01397a4587f0a031
|
||||
size 265663
|
@ -1,163 +0,0 @@
|
||||
From: Sachin Sant <sachinp@in.ibm.com>
|
||||
Subject: [PATCH] Fix PPC32 kexec binary to boot kdump kernel on PPC64
|
||||
References: 405015
|
||||
|
||||
Allow 32 bit kexec binary to boot kdump kernel on ppc64 architecture.
|
||||
|
||||
|
||||
Signed-off-by : Sachin Sant <sachinp@in.ibm.com>
|
||||
Acked-by: Bernhard Walle <bwalle@suse.de>
|
||||
|
||||
---
|
||||
kexec/arch/ppc64/crashdump-ppc64.c | 13 +++++++------
|
||||
kexec/arch/ppc64/crashdump-ppc64.h | 2 +-
|
||||
kexec/arch/ppc64/fs2dt.c | 12 ++++++------
|
||||
kexec/arch/ppc64/kexec-elf-ppc64.c | 2 +-
|
||||
kexec/arch/ppc64/kexec-ppc64.c | 18 +++++++++---------
|
||||
5 files changed, 24 insertions(+), 23 deletions(-)
|
||||
|
||||
--- a/kexec/arch/ppc64/crashdump-ppc64.c
|
||||
+++ b/kexec/arch/ppc64/crashdump-ppc64.c
|
||||
@@ -82,7 +82,7 @@ mem_rgns_t usablemem_rgns = {0, NULL};
|
||||
* we can determine the RAM size unless parsing the device-tree/memoy@/reg
|
||||
* property in the kernel.
|
||||
*/
|
||||
-unsigned long saved_max_mem = 0;
|
||||
+uint64_t saved_max_mem = 0;
|
||||
|
||||
/* Reads the appropriate file and retrieves the SYSTEM RAM regions for whom to
|
||||
* create Elf headers. Keeping it separate from get_memory_ranges() as
|
||||
@@ -250,7 +250,7 @@ err:
|
||||
}
|
||||
|
||||
/* Converts unsigned long to ascii string. */
|
||||
-static void ultoa(unsigned long i, char *str)
|
||||
+static void ultoa(uint64_t i, char *str)
|
||||
{
|
||||
int j = 0, k;
|
||||
char tmp;
|
||||
@@ -268,8 +268,8 @@ static void ultoa(unsigned long i, char
|
||||
}
|
||||
}
|
||||
|
||||
-static int add_cmdline_param(char *cmdline, unsigned long addr,
|
||||
- char *cmdstr, char *byte)
|
||||
+static int add_cmdline_param(char *cmdline, uint64_t addr, char *cmdstr,
|
||||
+ char *byte)
|
||||
{
|
||||
int cmdlen, len, align = 1024;
|
||||
char str[COMMAND_LINE_SIZE], *ptr;
|
||||
@@ -306,10 +306,11 @@ static int add_cmdline_param(char *cmdli
|
||||
* for crash memory image.
|
||||
*/
|
||||
int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
|
||||
- unsigned long max_addr, unsigned long min_base)
|
||||
+ uint64_t max_addr, unsigned long min_base)
|
||||
{
|
||||
void *tmp;
|
||||
- unsigned long sz, elfcorehdr;
|
||||
+ unsigned long sz;
|
||||
+ uint64_t elfcorehdr;
|
||||
int nr_ranges, align = 1024, i;
|
||||
unsigned long long end;
|
||||
struct memory_range *mem_range;
|
||||
--- a/kexec/arch/ppc64/crashdump-ppc64.h
|
||||
+++ b/kexec/arch/ppc64/crashdump-ppc64.h
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
struct kexec_info;
|
||||
int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline,
|
||||
- unsigned long max_addr, unsigned long min_base);
|
||||
+ uint64_t max_addr, unsigned long min_base);
|
||||
void add_usable_mem_rgns(unsigned long long base, unsigned long long size);
|
||||
|
||||
#define PAGE_OFFSET 0xC000000000000000ULL
|
||||
--- a/kexec/arch/ppc64/fs2dt.c
|
||||
+++ b/kexec/arch/ppc64/fs2dt.c
|
||||
@@ -125,9 +125,9 @@ static unsigned propnum(const char *name
|
||||
static void add_usable_mem_property(int fd, int len)
|
||||
{
|
||||
char fname[MAXPATH], *bname;
|
||||
- unsigned long long buf[2];
|
||||
- unsigned long ranges[2*MAX_MEMORY_RANGES];
|
||||
- unsigned long long base, end, loc_base, loc_end;
|
||||
+ uint64_t buf[2];
|
||||
+ uint64_t ranges[2*MAX_MEMORY_RANGES];
|
||||
+ uint64_t base, end, loc_base, loc_end;
|
||||
int range, rlen = 0;
|
||||
|
||||
strcpy(fname, pathname);
|
||||
@@ -137,9 +137,9 @@ static void add_usable_mem_property(int
|
||||
if (strncmp(bname, "/memory@", 8))
|
||||
return;
|
||||
|
||||
- if (len < 2 * sizeof(unsigned long long))
|
||||
+ if (len < 2 * sizeof(uint64_t))
|
||||
die("unrecoverable error: not enough data for mem property\n");
|
||||
- len = 2 * sizeof(unsigned long long);
|
||||
+ len = 2 * sizeof(uint64_t);
|
||||
|
||||
if (lseek(fd, 0, SEEK_SET) < 0)
|
||||
die("unrecoverable error: error seeking in \"%s\": %s\n",
|
||||
@@ -179,7 +179,7 @@ static void add_usable_mem_property(int
|
||||
ranges[rlen++] = 0;
|
||||
}
|
||||
|
||||
- rlen = rlen * sizeof(unsigned long);
|
||||
+ rlen = rlen * sizeof(uint64_t);
|
||||
/*
|
||||
* No add linux,usable-memory property.
|
||||
*/
|
||||
--- a/kexec/arch/ppc64/kexec-elf-ppc64.c
|
||||
+++ b/kexec/arch/ppc64/kexec-elf-ppc64.c
|
||||
@@ -187,7 +187,7 @@ int elf_ppc64_load(int argc, char **argv
|
||||
if (size > phdr->p_memsz)
|
||||
size = phdr->p_memsz;
|
||||
|
||||
- hole_addr = (unsigned long)locate_hole(info, size, 0, 0,
|
||||
+ hole_addr = (uint64_t)locate_hole(info, size, 0, 0,
|
||||
max_addr, 1);
|
||||
ehdr.e_phdr[0].p_paddr = hole_addr;
|
||||
result = elf_exec_load(&ehdr, info);
|
||||
--- a/kexec/arch/ppc64/kexec-ppc64.c
|
||||
+++ b/kexec/arch/ppc64/kexec-ppc64.c
|
||||
@@ -37,8 +37,8 @@
|
||||
static struct memory_range *exclude_range = NULL;
|
||||
static struct memory_range *memory_range = NULL;
|
||||
static struct memory_range *base_memory_range = NULL;
|
||||
-static unsigned long long rmo_top;
|
||||
-unsigned long long memory_max = 0;
|
||||
+static uint64_t rmo_top;
|
||||
+uint64_t memory_max = 0;
|
||||
static int nr_memory_ranges, nr_exclude_ranges;
|
||||
uint64_t crash_base, crash_size;
|
||||
unsigned int rtas_base, rtas_size;
|
||||
@@ -251,12 +251,12 @@ static int sort_ranges(void)
|
||||
*/
|
||||
static int get_devtree_details(unsigned long kexec_flags)
|
||||
{
|
||||
- unsigned long long rmo_base;
|
||||
- unsigned long long tce_base;
|
||||
+ uint64_t rmo_base;
|
||||
+ uint64_t tce_base;
|
||||
unsigned int tce_size;
|
||||
- unsigned long long htab_base, htab_size;
|
||||
- unsigned long long kernel_end;
|
||||
- unsigned long long initrd_start, initrd_end;
|
||||
+ uint64_t htab_base, htab_size;
|
||||
+ uint64_t kernel_end;
|
||||
+ uint64_t initrd_start, initrd_end;
|
||||
char buf[MAXBYTES];
|
||||
char device_tree[256] = "/proc/device-tree/";
|
||||
char fname[256];
|
||||
@@ -465,8 +465,8 @@ static int get_devtree_details(unsigned
|
||||
perror(fname);
|
||||
goto error_openfile;
|
||||
}
|
||||
- rmo_base = ((unsigned long long *)buf)[0];
|
||||
- rmo_top = rmo_base + ((unsigned long long *)buf)[1];
|
||||
+ rmo_base = ((uint64_t *)buf)[0];
|
||||
+ rmo_top = rmo_base + ((uint64_t *)buf)[1];
|
||||
if (rmo_top > 0x30000000UL)
|
||||
rmo_top = 0x30000000UL;
|
||||
|
@ -1,36 +0,0 @@
|
||||
From 86ff227557dde6398317f0cea9448391314b070a Mon Sep 17 00:00:00 2001
|
||||
From: Bernhard Walle <bwalle@suse.de>
|
||||
Date: Mon, 26 May 2008 23:12:58 +0200
|
||||
Subject: [PATCH] EDD fix
|
||||
|
||||
This patch fixes EDD support where the BIOS reports a length lower than the
|
||||
actual length of raw_data in sysfs. That's no problem -- the check only
|
||||
needs to catch the case where the sysfs file is *smaller* than the
|
||||
BIOS reported length.
|
||||
|
||||
Also add a newline at the end of the error message.
|
||||
|
||||
The problem was introduced in 3bf0213789d56054f601c5a06372f78567aacdd9 by
|
||||
myself, the initial EDD implementation.
|
||||
|
||||
|
||||
Signed-off-by: Bernhard Walle <bwalle@suse.de>
|
||||
|
||||
---
|
||||
kexec/arch/i386/x86-linux-setup.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/kexec/arch/i386/x86-linux-setup.c
|
||||
+++ b/kexec/arch/i386/x86-linux-setup.c
|
||||
@@ -255,9 +255,9 @@ static int read_edd_raw_data(const char
|
||||
len = ((uint16_t *)edd_info->edd_device_params)[0];
|
||||
dbgprintf("EDD raw data has length %d\n", len);
|
||||
|
||||
- if (read_chars != len) {
|
||||
+ if (read_chars < len) {
|
||||
fprintf(stderr, "BIOS reported EDD length of %hd but only "
|
||||
- "%d chars read.", len, (int)read_chars);
|
||||
+ "%d chars read.\n", len, (int)read_chars);
|
||||
return -1;
|
||||
}
|
||||
|
@ -1,386 +0,0 @@
|
||||
From: Bernhard Walle <bwalle@suse.de>
|
||||
Subject: [PATCH] Implement EDD support for 32 bit boot
|
||||
To: kexec@lists.infradead.org
|
||||
|
||||
This patch implements EDD support. The information is read from
|
||||
/sys/firmware/edd (the edd driver must be loaded for this) and is written into
|
||||
the zero page of the 32 bit boot protocol.
|
||||
|
||||
I successfully tested the patch on a x86_64 machine with the x86_64 kernel.
|
||||
|
||||
This fixes a hardware detection problem, discovered in
|
||||
https://bugzilla.novell.com/show_bug.cgi?id=383210.
|
||||
|
||||
The last patch that updates the E820MAX constant is required to use that patch.
|
||||
|
||||
Signed-off-by: Bernhard Walle <bwalle@suse.de>
|
||||
|
||||
---
|
||||
doc/linux-i386-zero-page.txt | 3
|
||||
include/x86/x86-linux.h | 41 +++++-
|
||||
kexec/arch/i386/x86-linux-setup.c | 244 ++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 279 insertions(+), 9 deletions(-)
|
||||
|
||||
--- a/doc/linux-i386-zero-page.txt
|
||||
+++ b/doc/linux-i386-zero-page.txt
|
||||
@@ -75,5 +75,4 @@ Offset Type Description
|
||||
0x224 unsigned short setup.S heap end pointer
|
||||
0x290 - 0x2cf EDD_MBR_SIG_BUFFER (edd.S)
|
||||
0x2d0 - 0x600 E820MAP
|
||||
-0x600 - 0x7ff EDDBUF (edd.S) for disk signature read sector
|
||||
-0x600 - 0x7eb EDDBUF (edd.S) for edd data
|
||||
+0xd00 - 0xeec EDDBUF (edd.S) for edd data
|
||||
--- a/include/x86/x86-linux.h
|
||||
+++ b/include/x86/x86-linux.h
|
||||
@@ -4,7 +4,7 @@
|
||||
#define TENATIVE 0 /* Code that is tenatively correct but hasn't yet been officially accepted */
|
||||
|
||||
#define E820MAP 0x2d0 /* our map */
|
||||
-#define E820MAX 32 /* number of entries in E820MAP */
|
||||
+#define E820MAX 128 /* number of entries in E820MAP */
|
||||
#define E820NR 0x1e8 /* # entries in E820MAP */
|
||||
|
||||
#ifndef ASSEMBLY
|
||||
@@ -43,6 +43,29 @@ struct apm_bios_info {
|
||||
uint8_t reserved[44]; /* 0x54 */
|
||||
};
|
||||
|
||||
+/*
|
||||
+ * EDD stuff
|
||||
+ */
|
||||
+
|
||||
+#define EDD_MBR_SIG_MAX 16
|
||||
+#define EDDMAXNR 6 /* number of edd_info structs starting at EDDBUF */
|
||||
+
|
||||
+#define EDD_EXT_FIXED_DISK_ACCESS (1 << 0)
|
||||
+#define EDD_EXT_DEVICE_LOCKING_AND_EJECTING (1 << 1)
|
||||
+#define EDD_EXT_ENHANCED_DISK_DRIVE_SUPPORT (1 << 2)
|
||||
+#define EDD_EXT_64BIT_EXTENSIONS (1 << 3)
|
||||
+
|
||||
+#define EDD_DEVICE_PARAM_SIZE 74
|
||||
+
|
||||
+struct edd_info {
|
||||
+ uint8_t device;
|
||||
+ uint8_t version;
|
||||
+ uint16_t interface_support;
|
||||
+ uint16_t legacy_max_cylinder;
|
||||
+ uint8_t legacy_max_head;
|
||||
+ uint8_t legacy_sectors_per_track;
|
||||
+ uint8_t edd_device_params[EDD_DEVICE_PARAM_SIZE];
|
||||
+} __attribute__ ((packed));
|
||||
|
||||
struct x86_linux_param_header {
|
||||
uint8_t orig_x; /* 0x00 */
|
||||
@@ -87,7 +110,9 @@ struct x86_linux_param_header {
|
||||
uint32_t alt_mem_k; /* 0x1e0 */
|
||||
uint8_t reserved5[4]; /* 0x1e4 */
|
||||
uint8_t e820_map_nr; /* 0x1e8 */
|
||||
- uint8_t reserved6[8]; /* 0x1e9 */
|
||||
+ uint8_t eddbuf_entries; /* 0x1e9 */
|
||||
+ uint8_t edd_mbr_sig_buf_entries; /* 0x1ea */
|
||||
+ uint8_t reserved6[6]; /* 0x1eb */
|
||||
uint8_t setup_sects; /* 0x1f1 */
|
||||
uint16_t mount_root_rdonly; /* 0x1f2 */
|
||||
uint16_t syssize; /* 0x1f4 */
|
||||
@@ -148,18 +173,20 @@ struct x86_linux_param_header {
|
||||
uint32_t cmdline_size; /* 0x238 */
|
||||
uint32_t hardware_subarch; /* 0x23C */
|
||||
uint64_t hardware_subarch_data; /* 0x240 */
|
||||
- uint8_t reserved16[0x2d0 - 0x248]; /* 0x248 */
|
||||
+ uint8_t reserved16[0x290 - 0x248]; /* 0x248 */
|
||||
+ uint32_t edd_mbr_sig_buffer[EDD_MBR_SIG_MAX]; /* 0x290 */
|
||||
#endif
|
||||
- struct e820entry e820_map[E820MAX]; /* 0x2d0 */
|
||||
- /* 0x550 */
|
||||
+ struct e820entry e820_map[E820MAX]; /* 0x2d0 */
|
||||
+ uint8_t _pad8[48]; /* 0xcd0 */
|
||||
+ struct edd_info eddbuf[EDDMAXNR]; /* 0xd00 */
|
||||
+ /* 0xeec */
|
||||
#define COMMAND_LINE_SIZE 2048
|
||||
};
|
||||
|
||||
struct x86_linux_faked_param_header {
|
||||
struct x86_linux_param_header hdr; /* 0x00 */
|
||||
- uint8_t reserved17[0xab0]; /* 0x550 */
|
||||
uint8_t command_line[COMMAND_LINE_SIZE]; /* 0x1000 */
|
||||
- uint8_t reserved18[0x200]; /* 0x1800 - 0x2000 */
|
||||
+ // uint8_t reserved18[0x200]; /* 0x1800 - 0x2000 */
|
||||
};
|
||||
|
||||
struct x86_linux_header {
|
||||
--- a/kexec/arch/i386/x86-linux-setup.c
|
||||
+++ b/kexec/arch/i386/x86-linux-setup.c
|
||||
@@ -13,10 +13,12 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
+/* #define DEBUG 1 */
|
||||
#define _GNU_SOURCE
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
+#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
@@ -27,6 +29,7 @@
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/fb.h>
|
||||
#include <unistd.h>
|
||||
+#include <dirent.h>
|
||||
#include <x86/x86-linux.h>
|
||||
#include "../../kexec.h"
|
||||
#include "kexec-x86.h"
|
||||
@@ -157,6 +160,244 @@ int setup_linux_vesafb(struct x86_linux_
|
||||
return -1;
|
||||
}
|
||||
|
||||
+#define EDD_SYFS_DIR "/sys/firmware/edd"
|
||||
+
|
||||
+#define EDD_EXT_FIXED_DISK_ACCESS (1 << 0)
|
||||
+#define EDD_EXT_DEVICE_LOCKING_AND_EJECTING (1 << 1)
|
||||
+#define EDD_EXT_ENHANCED_DISK_DRIVE_SUPPORT (1 << 2)
|
||||
+#define EDD_EXT_64BIT_EXTENSIONS (1 << 3)
|
||||
+
|
||||
+/*
|
||||
+ * Scans one line from a given filename. Returns on success the number of
|
||||
+ * items written (same like scanf()).
|
||||
+ */
|
||||
+static int file_scanf(const char *dir, const char *file, const char *scanf_line, ...)
|
||||
+{
|
||||
+ va_list argptr;
|
||||
+ FILE *fp;
|
||||
+ int retno;
|
||||
+ char filename[PATH_MAX];
|
||||
+
|
||||
+ snprintf(filename, PATH_MAX, "%s/%s", dir, file);
|
||||
+ filename[PATH_MAX-1] = 0;
|
||||
+
|
||||
+ fp = fopen(filename, "r");
|
||||
+ if (!fp) {
|
||||
+ return -errno;
|
||||
+ }
|
||||
+
|
||||
+ va_start(argptr, scanf_line);
|
||||
+ retno = vfscanf(fp, scanf_line, argptr);
|
||||
+ va_end(argptr);
|
||||
+
|
||||
+ fclose(fp);
|
||||
+
|
||||
+ return retno;
|
||||
+}
|
||||
+
|
||||
+static int parse_edd_extensions(const char *dir, struct edd_info *edd_info)
|
||||
+{
|
||||
+ char filename[PATH_MAX];
|
||||
+ char line[1024];
|
||||
+ uint16_t flags = 0;
|
||||
+ FILE *fp;
|
||||
+
|
||||
+ snprintf(filename, PATH_MAX, "%s/%s", dir, "extensions");
|
||||
+ filename[PATH_MAX-1] = 0;
|
||||
+
|
||||
+ fp = fopen(filename, "r");
|
||||
+ if (!fp) {
|
||||
+ return -errno;
|
||||
+ }
|
||||
+
|
||||
+ while (fgets(line, 1024, fp)) {
|
||||
+ /*
|
||||
+ * strings are in kernel source, function edd_show_extensions()
|
||||
+ * drivers/firmware/edd.c
|
||||
+ */
|
||||
+ if (strstr(line, "Fixed disk access") == line)
|
||||
+ flags |= EDD_EXT_FIXED_DISK_ACCESS;
|
||||
+ else if (strstr(line, "Device locking and ejecting") == line)
|
||||
+ flags |= EDD_EXT_DEVICE_LOCKING_AND_EJECTING;
|
||||
+ else if (strstr(line, "Enhanced Disk Drive support") == line)
|
||||
+ flags |= EDD_EXT_ENHANCED_DISK_DRIVE_SUPPORT;
|
||||
+ else if (strstr(line, "64-bit extensions") == line)
|
||||
+ flags |= EDD_EXT_64BIT_EXTENSIONS;
|
||||
+ }
|
||||
+
|
||||
+ fclose(fp);
|
||||
+
|
||||
+ edd_info->interface_support = flags;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int read_edd_raw_data(const char *dir, struct edd_info *edd_info)
|
||||
+{
|
||||
+ char filename[PATH_MAX];
|
||||
+ FILE *fp;
|
||||
+ size_t read_chars;
|
||||
+ uint16_t len;
|
||||
+
|
||||
+ snprintf(filename, PATH_MAX, "%s/%s", dir, "raw_data");
|
||||
+ filename[PATH_MAX-1] = 0;
|
||||
+
|
||||
+ fp = fopen(filename, "r");
|
||||
+ if (!fp) {
|
||||
+ return -errno;
|
||||
+ }
|
||||
+
|
||||
+ memset(edd_info->edd_device_params, 0, EDD_DEVICE_PARAM_SIZE);
|
||||
+ read_chars = fread(edd_info->edd_device_params, sizeof(uint8_t),
|
||||
+ EDD_DEVICE_PARAM_SIZE, fp);
|
||||
+ fclose(fp);
|
||||
+
|
||||
+ len = ((uint16_t *)edd_info->edd_device_params)[0];
|
||||
+ dbgprintf("EDD raw data has length %d\n", len);
|
||||
+
|
||||
+ if (read_chars != len) {
|
||||
+ fprintf(stderr, "BIOS reported EDD length of %hd but only "
|
||||
+ "%d chars read.", len, (int)read_chars);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int add_edd_entry(struct x86_linux_param_header *real_mode,
|
||||
+ const char *sysfs_name, int *current_edd, int *current_mbr)
|
||||
+{
|
||||
+ uint8_t devnum, version;
|
||||
+ uint32_t mbr_sig;
|
||||
+ struct edd_info *edd_info;
|
||||
+
|
||||
+ if (!current_mbr || !current_edd) {
|
||||
+ fprintf(stderr, "%s: current_edd and current_edd "
|
||||
+ "must not be NULL", __FUNCTION__);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ edd_info = &real_mode->eddbuf[*current_edd];
|
||||
+ memset(edd_info, 0, sizeof(struct edd_info));
|
||||
+
|
||||
+ /* extract the device number */
|
||||
+ if (sscanf(basename(sysfs_name), "int13_dev%hhx", &devnum) != 1) {
|
||||
+ fprintf(stderr, "Invalid format of int13_dev dir "
|
||||
+ "entry: %s\n", basename(sysfs_name));
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ /* if there's a MBR signature, then add it */
|
||||
+ if (file_scanf(sysfs_name, "mbr_signature", "0x%x", &mbr_sig) == 1) {
|
||||
+ real_mode->edd_mbr_sig_buffer[*current_mbr] = mbr_sig;
|
||||
+ (*current_mbr)++;
|
||||
+ dbgprintf("EDD Device 0x%x: mbr_sig=0x%x\n", devnum, mbr_sig);
|
||||
+ }
|
||||
+
|
||||
+ /* set the device number */
|
||||
+ edd_info->device = devnum;
|
||||
+
|
||||
+ /* set the version */
|
||||
+ if (file_scanf(sysfs_name, "version", "0x%hhx", &version) != 1)
|
||||
+ return -1;
|
||||
+
|
||||
+ edd_info->version = version;
|
||||
+
|
||||
+ /* if version == 0, that's some kind of dummy entry */
|
||||
+ if (version != 0) {
|
||||
+ /* legacy_max_cylinder */
|
||||
+ if (file_scanf(sysfs_name, "legacy_max_cylinder", "%hu",
|
||||
+ &edd_info->legacy_max_cylinder) != 1) {
|
||||
+ fprintf(stderr, "Reading legacy_max_cylinder failed.\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ /* legacy_max_head */
|
||||
+ if (file_scanf(sysfs_name, "legacy_max_head", "%hhu",
|
||||
+ &edd_info->legacy_max_head) != 1) {
|
||||
+ fprintf(stderr, "Reading legacy_max_head failed.\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ /* legacy_sectors_per_track */
|
||||
+ if (file_scanf(sysfs_name, "legacy_sectors_per_track", "%hhu",
|
||||
+ &edd_info->legacy_sectors_per_track) != 1) {
|
||||
+ fprintf(stderr, "Reading legacy_sectors_per_track failed.\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ /* Parse the EDD extensions */
|
||||
+ if (parse_edd_extensions(sysfs_name, edd_info) != 0) {
|
||||
+ fprintf(stderr, "Parsing EDD extensions failed.\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ /* Parse the raw info */
|
||||
+ if (read_edd_raw_data(sysfs_name, edd_info) != 0) {
|
||||
+ fprintf(stderr, "Reading EDD raw data failed.\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ (*current_edd)++;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void zero_edd(struct x86_linux_param_header *real_mode)
|
||||
+{
|
||||
+ real_mode->eddbuf_entries = 0;
|
||||
+ real_mode->edd_mbr_sig_buf_entries = 0;
|
||||
+ memset(real_mode->eddbuf, 0,
|
||||
+ EDDMAXNR * sizeof(struct edd_info));
|
||||
+ memset(real_mode->edd_mbr_sig_buffer, 0,
|
||||
+ EDD_MBR_SIG_MAX * sizeof(uint32_t));
|
||||
+}
|
||||
+
|
||||
+void setup_edd_info(struct x86_linux_param_header *real_mode,
|
||||
+ unsigned long kexec_flags)
|
||||
+{
|
||||
+ DIR *edd_dir;
|
||||
+ struct dirent *cursor;
|
||||
+ int current_edd = 0;
|
||||
+ int current_mbr = 0;
|
||||
+
|
||||
+ edd_dir = opendir(EDD_SYFS_DIR);
|
||||
+ if (!edd_dir) {
|
||||
+ dbgprintf(EDD_SYFS_DIR " does not exist.\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ zero_edd(real_mode);
|
||||
+ while ((cursor = readdir(edd_dir))) {
|
||||
+ char full_dir_name[PATH_MAX];
|
||||
+
|
||||
+ /* only read the entries that start with "int13_dev" */
|
||||
+ if (strstr(cursor->d_name, "int13_dev") != cursor->d_name)
|
||||
+ continue;
|
||||
+
|
||||
+ snprintf(full_dir_name, PATH_MAX, "%s/%s",
|
||||
+ EDD_SYFS_DIR, cursor->d_name);
|
||||
+ full_dir_name[PATH_MAX-1] = 0;
|
||||
+
|
||||
+ if (add_edd_entry(real_mode, full_dir_name, ¤t_edd,
|
||||
+ ¤t_mbr) != 0) {
|
||||
+ zero_edd(real_mode);
|
||||
+ goto out;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ real_mode->eddbuf_entries = current_edd;
|
||||
+ real_mode->edd_mbr_sig_buf_entries = current_mbr;
|
||||
+
|
||||
+out:
|
||||
+ closedir(edd_dir);
|
||||
+
|
||||
+ dbgprintf("Added %d EDD MBR entries and %d EDD entries.\n",
|
||||
+ real_mode->edd_mbr_sig_buf_entries,
|
||||
+ real_mode->eddbuf_entries);
|
||||
+}
|
||||
+
|
||||
void setup_linux_system_parameters(struct x86_linux_param_header *real_mode,
|
||||
unsigned long kexec_flags)
|
||||
{
|
||||
@@ -240,4 +481,7 @@ void setup_linux_system_parameters(struc
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+ /* fill the EDD information */
|
||||
+ setup_edd_info(real_mode, kexec_flags);
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
From eeec23d689747e9170c6f711161cf1f1258ee03e Mon Sep 17 00:00:00 2001
|
||||
From: Bernhard Walle <bwalle@suse.de>
|
||||
Date: Mon, 26 May 2008 14:12:53 +0200
|
||||
Subject: [PATCH] Specify the arch on kexec_unload.
|
||||
|
||||
This fixes the problem in kexec-tools that the patch
|
||||
http://article.gmane.org/gmane.linux.kernel/685027 tries to fix in kernel.
|
||||
|
||||
The fix in userspace is correct.
|
||||
|
||||
Signed-off-by: Bernhard Walle <bwalle@suse.de>
|
||||
|
||||
---
|
||||
kexec/kexec.c | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
--- a/kexec/kexec.c
|
||||
+++ b/kexec/kexec.c
|
||||
@@ -714,6 +714,14 @@ static int my_load(const char *type, int
|
||||
int k_unload (unsigned long kexec_flags)
|
||||
{
|
||||
int result;
|
||||
+ long native_arch;
|
||||
+
|
||||
+ /* set the arch */
|
||||
+ native_arch = physical_arch();
|
||||
+ if (native_arch < 0) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+ kexec_flags |= native_arch;
|
||||
|
||||
result = kexec_load(NULL, 0, NULL, kexec_flags);
|
||||
if (result != 0) {
|
@ -1,527 +0,0 @@
|
||||
From 7c3109cb6c5e1834bb3b6f788c9dcaa0ddbdf090 Mon Sep 17 00:00:00 2001
|
||||
From: Jamey Sharp <jamey@thetovacompany.com>
|
||||
Date: Thu, 15 May 2008 22:42:10 -0700
|
||||
Subject: [PATCH] Factor uname-based native architecture detection into a common function.
|
||||
|
||||
This code was copy-pasted into every architecture and was basically
|
||||
identical.
|
||||
|
||||
Besides producing a nice net reduction in code, this factors a
|
||||
portability challenge into a single function that can be easily replaced
|
||||
at build-time.
|
||||
|
||||
Signed-off-by: Jamey Sharp <jamey@thetovacompany.com>
|
||||
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||
|
||||
---
|
||||
kexec/Makefile | 1 +
|
||||
kexec/arch/arm/kexec-arm.c | 23 +++++------------------
|
||||
kexec/arch/i386/kexec-x86.c | 39 +++++++++++++--------------------------
|
||||
kexec/arch/ia64/kexec-ia64.c | 23 +++++------------------
|
||||
kexec/arch/mips/kexec-mips.c | 29 ++++++++---------------------
|
||||
kexec/arch/ppc/kexec-ppc.c | 29 ++++++++---------------------
|
||||
kexec/arch/ppc64/kexec-ppc64.c | 29 ++++++++---------------------
|
||||
kexec/arch/s390/kexec-s390.c | 8 ++++++--
|
||||
kexec/arch/sh/kexec-sh.c | 34 ++++++++++------------------------
|
||||
kexec/arch/x86_64/kexec-x86_64.c | 29 ++++++++---------------------
|
||||
kexec/kexec.c | 6 ++++++
|
||||
kexec/kexec.h | 9 +++++++++
|
||||
kexec/phys_arch.c | 23 +++++++++++++++++++++++
|
||||
13 files changed, 110 insertions(+), 172 deletions(-)
|
||||
|
||||
--- a/kexec/Makefile
|
||||
+++ b/kexec/Makefile
|
||||
@@ -20,6 +20,7 @@ KEXEC_SRCS += kexec/kexec-elf-boot.c
|
||||
KEXEC_SRCS += kexec/kexec-iomem.c
|
||||
KEXEC_SRCS += kexec/crashdump.c
|
||||
KEXEC_SRCS += kexec/crashdump-xen.c
|
||||
+KEXEC_SRCS += kexec/phys_arch.c
|
||||
|
||||
KEXEC_GENERATED_SRCS += $(PURGATORY_HEX_C)
|
||||
|
||||
--- a/kexec/arch/arm/kexec-arm.c
|
||||
+++ b/kexec/arch/arm/kexec-arm.c
|
||||
@@ -12,7 +12,6 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <getopt.h>
|
||||
-#include <sys/utsname.h>
|
||||
#include "../../kexec.h"
|
||||
#include "../../kexec-syscall.h"
|
||||
#include "kexec-arm.h"
|
||||
@@ -109,25 +108,13 @@ int arch_process_options(int argc, char
|
||||
return 0;
|
||||
}
|
||||
|
||||
+const struct arch_map_entry arches[] = {
|
||||
+ { "arm", KEXEC_ARCH_ARM },
|
||||
+ { 0 },
|
||||
+};
|
||||
+
|
||||
int arch_compat_trampoline(struct kexec_info *info)
|
||||
{
|
||||
- int result;
|
||||
- struct utsname utsname;
|
||||
- result = uname(&utsname);
|
||||
- if (result < 0) {
|
||||
- fprintf(stderr, "uname failed: %s\n",
|
||||
- strerror(errno));
|
||||
- return -1;
|
||||
- }
|
||||
- if (strncmp(utsname.machine, "arm",3) == 0)
|
||||
- {
|
||||
- info->kexec_flags |= KEXEC_ARCH_ARM;
|
||||
- }
|
||||
- else {
|
||||
- fprintf(stderr, "Unsupported machine type: %s\n",
|
||||
- utsname.machine);
|
||||
- return -1;
|
||||
- }
|
||||
return 0;
|
||||
}
|
||||
|
||||
--- a/kexec/arch/i386/kexec-x86.c
|
||||
+++ b/kexec/arch/i386/kexec-x86.c
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
-#include <sys/utsname.h>
|
||||
#include "../../kexec.h"
|
||||
#include "../../kexec-elf.h"
|
||||
#include "../../kexec-syscall.h"
|
||||
@@ -223,29 +222,22 @@ int arch_process_options(int argc, char
|
||||
return 0;
|
||||
}
|
||||
|
||||
+const struct arch_map_entry arches[] = {
|
||||
+ /* For compatibility with older patches
|
||||
+ * use KEXEC_ARCH_DEFAULT instead of KEXEC_ARCH_386 here.
|
||||
+ */
|
||||
+ { "i386", KEXEC_ARCH_DEFAULT },
|
||||
+ { "i486", KEXEC_ARCH_DEFAULT },
|
||||
+ { "i586", KEXEC_ARCH_DEFAULT },
|
||||
+ { "i686", KEXEC_ARCH_DEFAULT },
|
||||
+ { "x86_64", KEXEC_ARCH_X86_64 },
|
||||
+ { 0 },
|
||||
+};
|
||||
+
|
||||
int arch_compat_trampoline(struct kexec_info *info)
|
||||
{
|
||||
- int result;
|
||||
- struct utsname utsname;
|
||||
- result = uname(&utsname);
|
||||
- if (result < 0) {
|
||||
- fprintf(stderr, "uname failed: %s\n",
|
||||
- strerror(errno));
|
||||
- return -1;
|
||||
- }
|
||||
- if ( (strcmp(utsname.machine, "i386") == 0) ||
|
||||
- (strcmp(utsname.machine, "i486") == 0) ||
|
||||
- (strcmp(utsname.machine, "i586") == 0) ||
|
||||
- (strcmp(utsname.machine, "i686") == 0))
|
||||
+ if ((info->kexec_flags & KEXEC_ARCH_MASK) == KEXEC_ARCH_X86_64)
|
||||
{
|
||||
- /* For compatibility with older patches
|
||||
- * use KEXEC_ARCH_DEFAULT instead of KEXEC_ARCH_386 here.
|
||||
- */
|
||||
- info->kexec_flags |= KEXEC_ARCH_DEFAULT;
|
||||
- }
|
||||
- else if (strcmp(utsname.machine, "x86_64") == 0)
|
||||
- {
|
||||
- info->kexec_flags |= KEXEC_ARCH_X86_64;
|
||||
if (!info->rhdr.e_shdr) {
|
||||
fprintf(stderr,
|
||||
"A trampoline is required for cross architecture support\n");
|
||||
@@ -256,11 +248,6 @@ int arch_compat_trampoline(struct kexec_
|
||||
|
||||
info->entry = (void *)elf_rel_get_addr(&info->rhdr, "compat_x86_64");
|
||||
}
|
||||
- else {
|
||||
- fprintf(stderr, "Unsupported machine type: %s\n",
|
||||
- utsname.machine);
|
||||
- return -1;
|
||||
- }
|
||||
return 0;
|
||||
}
|
||||
|
||||
--- a/kexec/arch/ia64/kexec-ia64.c
|
||||
+++ b/kexec/arch/ia64/kexec-ia64.c
|
||||
@@ -28,7 +28,6 @@
|
||||
#include <string.h>
|
||||
#include <getopt.h>
|
||||
#include <sched.h>
|
||||
-#include <sys/utsname.h>
|
||||
#include <limits.h>
|
||||
#include "../../kexec.h"
|
||||
#include "../../kexec-syscall.h"
|
||||
@@ -204,25 +203,13 @@ int arch_process_options(int argc, char
|
||||
return 0;
|
||||
}
|
||||
|
||||
+const struct arch_map_entry arches[] = {
|
||||
+ { "ia64", KEXEC_ARCH_IA_64 },
|
||||
+ { 0 },
|
||||
+};
|
||||
+
|
||||
int arch_compat_trampoline(struct kexec_info *info)
|
||||
{
|
||||
- int result;
|
||||
- struct utsname utsname;
|
||||
- result = uname(&utsname);
|
||||
- if (result < 0) {
|
||||
- fprintf(stderr, "uname failed: %s\n",
|
||||
- strerror(errno));
|
||||
- return -1;
|
||||
- }
|
||||
- if (strcmp(utsname.machine, "ia64") == 0)
|
||||
- {
|
||||
- info->kexec_flags |= KEXEC_ARCH_IA_64;
|
||||
- }
|
||||
- else {
|
||||
- fprintf(stderr, "Unsupported machine type: %s\n",
|
||||
- utsname.machine);
|
||||
- return -1;
|
||||
- }
|
||||
return 0;
|
||||
}
|
||||
|
||||
--- a/kexec/arch/mips/kexec-mips.c
|
||||
+++ b/kexec/arch/mips/kexec-mips.c
|
||||
@@ -16,7 +16,6 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <getopt.h>
|
||||
-#include <sys/utsname.h>
|
||||
#include "../../kexec.h"
|
||||
#include "../../kexec-syscall.h"
|
||||
#include "kexec-mips.h"
|
||||
@@ -122,28 +121,16 @@ int arch_process_options(int argc, char
|
||||
return 0;
|
||||
}
|
||||
|
||||
+const struct arch_map_entry arches[] = {
|
||||
+ /* For compatibility with older patches
|
||||
+ * use KEXEC_ARCH_DEFAULT instead of KEXEC_ARCH_MIPS here.
|
||||
+ */
|
||||
+ { "mips", KEXEC_ARCH_DEFAULT },
|
||||
+ { 0 },
|
||||
+};
|
||||
+
|
||||
int arch_compat_trampoline(struct kexec_info *info)
|
||||
{
|
||||
- int result;
|
||||
- struct utsname utsname;
|
||||
- result = uname(&utsname);
|
||||
- if (result < 0) {
|
||||
- fprintf(stderr, "uname failed: %s\n",
|
||||
- strerror(errno));
|
||||
- return -1;
|
||||
- }
|
||||
- if (strcmp(utsname.machine, "mips") == 0)
|
||||
- {
|
||||
- /* For compatibility with older patches
|
||||
- * use KEXEC_ARCH_DEFAULT instead of KEXEC_ARCH_MIPS here.
|
||||
- */
|
||||
- info->kexec_flags |= KEXEC_ARCH_DEFAULT;
|
||||
- }
|
||||
- else {
|
||||
- fprintf(stderr, "Unsupported machine type: %s\n",
|
||||
- utsname.machine);
|
||||
- return -1;
|
||||
- }
|
||||
return 0;
|
||||
}
|
||||
|
||||
--- a/kexec/arch/ppc/kexec-ppc.c
|
||||
+++ b/kexec/arch/ppc/kexec-ppc.c
|
||||
@@ -12,7 +12,6 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <getopt.h>
|
||||
-#include <sys/utsname.h>
|
||||
#include "../../kexec.h"
|
||||
#include "../../kexec-syscall.h"
|
||||
#include "kexec-ppc.h"
|
||||
@@ -117,28 +116,16 @@ int arch_process_options(int argc, char
|
||||
return 0;
|
||||
}
|
||||
|
||||
+const struct arch_map_entry arches[] = {
|
||||
+ /* For compatibility with older patches
|
||||
+ * use KEXEC_ARCH_DEFAULT instead of KEXEC_ARCH_PPC here.
|
||||
+ */
|
||||
+ { "ppc", KEXEC_ARCH_DEFAULT },
|
||||
+ { 0 },
|
||||
+};
|
||||
+
|
||||
int arch_compat_trampoline(struct kexec_info *info)
|
||||
{
|
||||
- int result;
|
||||
- struct utsname utsname;
|
||||
- result = uname(&utsname);
|
||||
- if (result < 0) {
|
||||
- fprintf(stderr, "uname failed: %s\n",
|
||||
- strerror(errno));
|
||||
- return -1;
|
||||
- }
|
||||
- if (strcmp(utsname.machine, "ppc") == 0)
|
||||
- {
|
||||
- /* For compatibility with older patches
|
||||
- * use KEXEC_ARCH_DEFAULT instead of KEXEC_ARCH_PPC here.
|
||||
- */
|
||||
- info->kexec_flags |= KEXEC_ARCH_DEFAULT;
|
||||
- }
|
||||
- else {
|
||||
- fprintf(stderr, "Unsupported machine type: %s\n",
|
||||
- utsname.machine);
|
||||
- return -1;
|
||||
- }
|
||||
return 0;
|
||||
}
|
||||
|
||||
--- a/kexec/arch/ppc64/kexec-ppc64.c
|
||||
+++ b/kexec/arch/ppc64/kexec-ppc64.c
|
||||
@@ -28,7 +28,6 @@
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
#include <getopt.h>
|
||||
-#include <sys/utsname.h>
|
||||
#include "../../kexec.h"
|
||||
#include "../../kexec-syscall.h"
|
||||
#include "kexec-ppc64.h"
|
||||
@@ -681,28 +680,16 @@ int arch_process_options(int argc, char
|
||||
return 0;
|
||||
}
|
||||
|
||||
+const struct arch_map_entry arches[] = {
|
||||
+ /* We are running a 32-bit kexec-tools on 64-bit ppc64.
|
||||
+ * So pass KEXEC_ARCH_PPC64 here
|
||||
+ */
|
||||
+ { "ppc64", KEXEC_ARCH_PPC64 },
|
||||
+ { 0 },
|
||||
+};
|
||||
+
|
||||
int arch_compat_trampoline(struct kexec_info *info)
|
||||
{
|
||||
- int result;
|
||||
- struct utsname utsname;
|
||||
- result = uname(&utsname);
|
||||
- if (result < 0) {
|
||||
- fprintf(stderr, "uname failed: %s\n",
|
||||
- strerror(errno));
|
||||
- return -1;
|
||||
- }
|
||||
- if (strcmp(utsname.machine, "ppc64") == 0)
|
||||
- {
|
||||
- /* We are running a 32-bit kexec-tools on 64-bit ppc64.
|
||||
- * So pass KEXEC_ARCH_PPC64 here
|
||||
- */
|
||||
- info->kexec_flags |= KEXEC_ARCH_PPC64;
|
||||
- }
|
||||
- else {
|
||||
- fprintf(stderr, "Unsupported machine type: %s\n",
|
||||
- utsname.machine);
|
||||
- return -1;
|
||||
- }
|
||||
return 0;
|
||||
}
|
||||
|
||||
--- a/kexec/arch/s390/kexec-s390.c
|
||||
+++ b/kexec/arch/s390/kexec-s390.c
|
||||
@@ -14,7 +14,6 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <getopt.h>
|
||||
-#include <sys/utsname.h>
|
||||
#include "../../kexec.h"
|
||||
#include "../../kexec-syscall.h"
|
||||
#include "kexec-s390.h"
|
||||
@@ -95,9 +94,14 @@ int arch_process_options(int argc, char
|
||||
return 0;
|
||||
}
|
||||
|
||||
+const struct arch_map_entry arches[] = {
|
||||
+ { "s390", KEXEC_ARCH_S390 },
|
||||
+ { "s390x", KEXEC_ARCH_S390 },
|
||||
+ { 0 },
|
||||
+};
|
||||
+
|
||||
int arch_compat_trampoline(struct kexec_info *info)
|
||||
{
|
||||
- info->kexec_flags |= KEXEC_ARCH_S390;
|
||||
return 0;
|
||||
}
|
||||
|
||||
--- a/kexec/arch/sh/kexec-sh.c
|
||||
+++ b/kexec/arch/sh/kexec-sh.c
|
||||
@@ -14,7 +14,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <getopt.h>
|
||||
-#include <sys/utsname.h>
|
||||
#include "../../kexec.h"
|
||||
#include "../../kexec-syscall.h"
|
||||
#include "kexec-sh.h"
|
||||
@@ -99,31 +98,18 @@ int arch_process_options(int argc, char
|
||||
return 0;
|
||||
}
|
||||
|
||||
+const struct arch_map_entry arches[] = {
|
||||
+ /* For compatibility with older patches
|
||||
+ * use KEXEC_ARCH_DEFAULT instead of KEXEC_ARCH_SH here.
|
||||
+ */
|
||||
+ { "sh3", KEXEC_ARCH_DEFAULT },
|
||||
+ { "sh4", KEXEC_ARCH_DEFAULT },
|
||||
+ { "sh4a", KEXEC_ARCH_DEFAULT },
|
||||
+ { 0 },
|
||||
+};
|
||||
+
|
||||
int arch_compat_trampoline(struct kexec_info *info)
|
||||
{
|
||||
- int result;
|
||||
- struct utsname utsname;
|
||||
- result = uname(&utsname);
|
||||
- if (result < 0) {
|
||||
- fprintf(stderr, "uname failed: %s\n",
|
||||
- strerror(errno));
|
||||
- return -1;
|
||||
- }
|
||||
- if ( (strcmp(utsname.machine, "sh3") == 0) ||
|
||||
- (strcmp(utsname.machine, "sh4") == 0) ||
|
||||
- (strcmp(utsname.machine, "sh4a") == 0))
|
||||
- {
|
||||
- /*
|
||||
- * For compatibility with older patches
|
||||
- * use KEXEC_ARCH_DEFAULT instead of KEXEC_ARCH_SH here.
|
||||
- */
|
||||
- info->kexec_flags |= KEXEC_ARCH_DEFAULT;
|
||||
- }
|
||||
- else {
|
||||
- fprintf(stderr, "Unsupported machine type: %s\n",
|
||||
- utsname.machine);
|
||||
- return -1;
|
||||
- }
|
||||
return 0;
|
||||
}
|
||||
|
||||
--- a/kexec/arch/x86_64/kexec-x86_64.c
|
||||
+++ b/kexec/arch/x86_64/kexec-x86_64.c
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
-#include <sys/utsname.h>
|
||||
#include "../../kexec.h"
|
||||
#include "../../kexec-elf.h"
|
||||
#include "../../kexec-syscall.h"
|
||||
@@ -224,28 +223,16 @@ int arch_process_options(int argc, char
|
||||
return 0;
|
||||
}
|
||||
|
||||
+const struct arch_map_entry arches[] = {
|
||||
+ /* For compatibility with older patches
|
||||
+ * use KEXEC_ARCH_DEFAULT instead of KEXEC_ARCH_X86_64 here.
|
||||
+ */
|
||||
+ { "x86_64", KEXEC_ARCH_DEFAULT },
|
||||
+ { 0 },
|
||||
+};
|
||||
+
|
||||
int arch_compat_trampoline(struct kexec_info *info)
|
||||
{
|
||||
- int result;
|
||||
- struct utsname utsname;
|
||||
- result = uname(&utsname);
|
||||
- if (result < 0) {
|
||||
- fprintf(stderr, "uname failed: %s\n",
|
||||
- strerror(errno));
|
||||
- return -1;
|
||||
- }
|
||||
- if (strcmp(utsname.machine, "x86_64") == 0)
|
||||
- {
|
||||
- /* For compatibility with older patches
|
||||
- * use KEXEC_ARCH_DEFAULT instead of KEXEC_ARCH_X86_64 here.
|
||||
- */
|
||||
- info->kexec_flags |= KEXEC_ARCH_DEFAULT;
|
||||
- }
|
||||
- else {
|
||||
- fprintf(stderr, "Unsupported machine type: %s\n",
|
||||
- utsname.machine);
|
||||
- return -1;
|
||||
- }
|
||||
return 0;
|
||||
}
|
||||
|
||||
--- a/kexec/kexec.c
|
||||
+++ b/kexec/kexec.c
|
||||
@@ -607,6 +607,7 @@ static int my_load(const char *type, int
|
||||
int i = 0;
|
||||
int result;
|
||||
struct kexec_info info;
|
||||
+ long native_arch;
|
||||
int guess_only = 0;
|
||||
|
||||
memset(&info, 0, sizeof(info));
|
||||
@@ -674,6 +675,11 @@ static int my_load(const char *type, int
|
||||
return -1;
|
||||
}
|
||||
/* If we are not in native mode setup an appropriate trampoline */
|
||||
+ native_arch = physical_arch();
|
||||
+ if (native_arch < 0) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+ info.kexec_flags |= native_arch;
|
||||
if (arch_compat_trampoline(&info) < 0) {
|
||||
return -1;
|
||||
}
|
||||
--- a/kexec/kexec.h
|
||||
+++ b/kexec/kexec.h
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
+#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#define USE_BSD
|
||||
#include <byteswap.h>
|
||||
@@ -125,6 +126,14 @@ struct kexec_info {
|
||||
unsigned long kern_size;
|
||||
};
|
||||
|
||||
+struct arch_map_entry {
|
||||
+ const char *machine;
|
||||
+ unsigned long arch;
|
||||
+};
|
||||
+
|
||||
+extern const struct arch_map_entry arches[];
|
||||
+long physical_arch(void);
|
||||
+
|
||||
void usage(void);
|
||||
int get_memory_ranges(struct memory_range **range, int *ranges,
|
||||
unsigned long kexec_flags);
|
||||
--- /dev/null
|
||||
+++ b/kexec/phys_arch.c
|
||||
@@ -0,0 +1,23 @@
|
||||
+#include "kexec.h"
|
||||
+#include <errno.h>
|
||||
+#include <string.h>
|
||||
+#include <sys/utsname.h>
|
||||
+
|
||||
+long physical_arch(void)
|
||||
+{
|
||||
+ struct utsname utsname;
|
||||
+ int i, result = uname(&utsname);
|
||||
+ if (result < 0) {
|
||||
+ fprintf(stderr, "uname failed: %s\n",
|
||||
+ strerror(errno));
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; arches[i].machine; ++i)
|
||||
+ if (strcmp(utsname.machine, arches[i].machine) == 0)
|
||||
+ return arches[i].arch;
|
||||
+
|
||||
+ fprintf(stderr, "Unsupported machine type: %s\n",
|
||||
+ utsname.machine);
|
||||
+ return -1;
|
||||
+}
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:52fe39d79324921f14427884bd4c350fa5b8321c54b461bde08e3a27b7a8c1ea
|
||||
size 257367
|
@ -1,3 +1,38 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Jul 14 17:32:17 CEST 2008 - bwalle@suse.de
|
||||
|
||||
- update to kexec-tools 2.0.0-rc1
|
||||
o implement support for /sys/firmware/memmap interface
|
||||
o Allow 32 bit kexec binary to boot kdump kernel on ppc64
|
||||
architecture
|
||||
o kexec/crashdump.c: remove file descriptor leaks; make kdump_info
|
||||
argument to get_vmcoreinfo() const
|
||||
o Fix implicit declaration of inb/outb
|
||||
o EDD implementation
|
||||
o Specify the arch on kexec_unload
|
||||
o Update KEXEC_ARCH_* constants from Linux kernel headers
|
||||
o lots of code cleanup
|
||||
o Add --reuse-cmdline
|
||||
o documentation update (manpage, boot protocol)
|
||||
o ensure that extra rtas segment is a multiple of PAGE_SIZE
|
||||
o Allow building for ppc32 platforms
|
||||
o Die on early EOF in slurp_file, instead of infinite-looping
|
||||
o Fix copy-paste bug: entry16 does not start at entry16_debug
|
||||
o Fix undefined symbol errors on readw/writew: arch/io.h, not
|
||||
sys/io.h
|
||||
o extract vmcoreinfo from /proc/vmcore for Xen
|
||||
o Give installed files user-writable permission
|
||||
o Use separate CPPFLAGS and LDFLAGS for purgatory
|
||||
- dropped kexec-tools-fix-arch-on-unload: merged upstream
|
||||
- dropped kexec-tools-edd-fix: merged upstream
|
||||
- dropped kexec-tools-refactor-architecture-detection: merged
|
||||
upstram
|
||||
- dropped kexec-tools.gcc-bug.patch: merged upstream
|
||||
- dropped kexec-tools.ppc32-64bit-purgatory.patch: merged upstream
|
||||
- kexec-tools-edd-support: merged upstream
|
||||
- kexec-tools-32bit-kexec-with-64bit-ppc64.patch: merged upstream
|
||||
- removed README.SUSE: information not necessary any more
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Jul 3 14:39:02 CEST 2008 - bwalle@suse.de
|
||||
|
||||
@ -104,7 +139,7 @@ Wed Jan 30 15:17:18 CET 2008 - sassmann@suse.de
|
||||
-------------------------------------------------------------------
|
||||
Tue Jan 22 10:14:31 CET 2008 - ro@suse.de
|
||||
|
||||
- update ppc buildreq
|
||||
- update ppc buildreq
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Nov 30 10:52:03 CET 2007 - bwalle@suse.de
|
||||
|
@ -1,27 +0,0 @@
|
||||
---
|
||||
kexec/arch/i386/crashdump-x86.c | 2 ++
|
||||
kexec/arch/x86_64/crashdump-x86_64.c | 2 ++
|
||||
2 files changed, 4 insertions(+)
|
||||
|
||||
--- a/kexec/arch/i386/crashdump-x86.c
|
||||
+++ b/kexec/arch/i386/crashdump-x86.c
|
||||
@@ -286,6 +286,8 @@ static int delete_memmap(struct memory_r
|
||||
unsigned long long mstart, mend;
|
||||
struct memory_range temp_region;
|
||||
|
||||
+ /* kexec/arch/i386/crashdump-x86.c:343: warning: 'temp_region.type' is used uninitialized in this function */
|
||||
+ memset(&temp_region, 0, sizeof(temp_region));
|
||||
/* Do alignment check. */
|
||||
if ((addr%align) || (size%align))
|
||||
return -1;
|
||||
--- a/kexec/arch/x86_64/crashdump-x86_64.c
|
||||
+++ b/kexec/arch/x86_64/crashdump-x86_64.c
|
||||
@@ -391,6 +391,8 @@ static int delete_memmap(struct memory_r
|
||||
unsigned long long mstart, mend;
|
||||
struct memory_range temp_region;
|
||||
|
||||
+ /* kexec/arch/x86_64/crashdump-x86_64.c:448: warning: 'temp_region.type' is used uninitialized in this function */
|
||||
+ memset(&temp_region, 0, sizeof(temp_region));
|
||||
/* Do alignment check. */
|
||||
if ((addr%align) || (size%align))
|
||||
return -1;
|
@ -1,37 +0,0 @@
|
||||
---
|
||||
kexec/arch/ppc64/crashdump-ppc64.h | 4 ++--
|
||||
purgatory/Makefile | 7 ++++++-
|
||||
2 files changed, 8 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/kexec/arch/ppc64/crashdump-ppc64.h
|
||||
+++ b/kexec/arch/ppc64/crashdump-ppc64.h
|
||||
@@ -6,9 +6,9 @@ int load_crashdump_segments(struct kexec
|
||||
unsigned long max_addr, unsigned long min_base);
|
||||
void add_usable_mem_rgns(unsigned long long base, unsigned long long size);
|
||||
|
||||
-#define PAGE_OFFSET 0xC000000000000000
|
||||
+#define PAGE_OFFSET 0xC000000000000000ULL
|
||||
#define KERNELBASE PAGE_OFFSET
|
||||
-#define VMALLOCBASE 0xD000000000000000
|
||||
+#define VMALLOCBASE 0xD000000000000000ULL
|
||||
|
||||
#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
|
||||
#define MAXMEM (-KERNELBASE-VMALLOCBASE)
|
||||
--- a/purgatory/Makefile
|
||||
+++ b/purgatory/Makefile
|
||||
@@ -40,9 +40,14 @@ $(PURGATORY): CPPFLAGS+=-I$(srcdir)/purg
|
||||
$(PURGATORY): LDFLAGS+=--no-undefined -nostartfiles -nostdlib -nodefaultlibs \
|
||||
-e purgatory_start -r
|
||||
|
||||
+LDFLAGS_P = $(shell echo $(LDFLAGS) | sed -e 's/-lz//g')
|
||||
+ifeq ($(ARCH),ppc64)
|
||||
+LDFLAGS_P+=-melf64ppc -m64
|
||||
+endif
|
||||
+
|
||||
$(PURGATORY): $(PURGATORY_OBJS)
|
||||
$(MKDIR) -p $(@D)
|
||||
- $(CC) $(LDFLAGS) -o $@ $^
|
||||
+ $(CC) $(LDFLAGS_P) -o $@ $^
|
||||
|
||||
# $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) --no-undefined -e purgatory_start -r -o $@ $(PURGATORY_OBJS) $(UTIL_LIB)
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# spec file for package kexec-tools (Version 1.101)
|
||||
# spec file for package kexec-tools (Version 1.9.9_rc1)
|
||||
#
|
||||
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
# This file and all modifications and additions to the pristine
|
||||
@ -16,26 +16,18 @@ Name: kexec-tools
|
||||
%ifarch ppc
|
||||
BuildRequires: gcc-64bit glibc-devel-64bit
|
||||
%endif
|
||||
%define package_version testing-20080324
|
||||
%define package_version 2.0.0-rc1
|
||||
License: GPL v2 or later
|
||||
Group: System/Kernel
|
||||
Requires: %insserv_prereq %fillup_prereq
|
||||
AutoReqProv: on
|
||||
Summary: Tools for fast kernel loading
|
||||
Version: 1.101
|
||||
Release: 205
|
||||
Version: 1.9.9_rc1
|
||||
Release: 1
|
||||
Source: %{name}-%{package_version}.tar.bz2
|
||||
Source1: README.SUSE
|
||||
Url: http://ftp.kernel.org/pub/linux/kernel/people/horms/kexec-tools/
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
BuildRequires: zlib-devel
|
||||
Patch1: kexec-tools.ppc32-64bit-purgatory.patch
|
||||
Patch2: kexec-tools.gcc-bug.patch
|
||||
Patch3: kexec-tools-edd-support
|
||||
Patch4: kexec-tools-refactor-architecture-detection
|
||||
Patch5: kexec-tools-fix-arch-on-unload
|
||||
Patch6: kexec-tools-edd-fix
|
||||
Patch7: kexec-tools-32bit-kexec-with-64bit-ppc64.patch
|
||||
|
||||
%description
|
||||
Kexec is a user space utility for loading another kernel and asking the
|
||||
@ -56,17 +48,9 @@ Authors:
|
||||
|
||||
%prep
|
||||
%setup -q -n kexec-tools-%{package_version}
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
|
||||
%build
|
||||
%{?suse_update_config -f}
|
||||
cp %{SOURCE1} .
|
||||
%ifarch ia64
|
||||
RPM_OPT_FLAGS=$(echo $RPM_OPT_FLAGS | sed -e 's/-fstack-protector//')
|
||||
%endif
|
||||
@ -78,7 +62,7 @@ CFLAGS=$RPM_OPT_FLAGS ./configure \
|
||||
%endif
|
||||
--sbindir=/sbin \
|
||||
--libdir=/%_lib || true
|
||||
make #CPPFLAGS="$RPM_OPT_FLAGS"
|
||||
make
|
||||
|
||||
%install
|
||||
make DESTDIR=$RPM_BUILD_ROOT install
|
||||
@ -90,7 +74,7 @@ install -c -m 0644 kexec/kexec.8 $RPM_BUILD_ROOT%{_mandir}/man8
|
||||
|
||||
%files
|
||||
%defattr(-, root, root)
|
||||
%doc AUTHORS COPYING News TODO doc README.SUSE
|
||||
%doc AUTHORS COPYING News TODO doc
|
||||
%doc %{_mandir}/man*/*
|
||||
/sbin/*
|
||||
%ifarch %ix86 x86_64
|
||||
@ -98,6 +82,38 @@ install -c -m 0644 kexec/kexec.8 $RPM_BUILD_ROOT%{_mandir}/man8
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Mon Jul 14 2008 bwalle@suse.de
|
||||
- update to kexec-tools 2.0.0-rc1
|
||||
o implement support for /sys/firmware/memmap interface
|
||||
o Allow 32 bit kexec binary to boot kdump kernel on ppc64
|
||||
architecture
|
||||
o kexec/crashdump.c: remove file descriptor leaks; make kdump_info
|
||||
argument to get_vmcoreinfo() const
|
||||
o Fix implicit declaration of inb/outb
|
||||
o EDD implementation
|
||||
o Specify the arch on kexec_unload
|
||||
o Update KEXEC_ARCH_* constants from Linux kernel headers
|
||||
o lots of code cleanup
|
||||
o Add --reuse-cmdline
|
||||
o documentation update (manpage, boot protocol)
|
||||
o ensure that extra rtas segment is a multiple of PAGE_SIZE
|
||||
o Allow building for ppc32 platforms
|
||||
o Die on early EOF in slurp_file, instead of infinite-looping
|
||||
o Fix copy-paste bug: entry16 does not start at entry16_debug
|
||||
o Fix undefined symbol errors on readw/writew: arch/io.h, not
|
||||
sys/io.h
|
||||
o extract vmcoreinfo from /proc/vmcore for Xen
|
||||
o Give installed files user-writable permission
|
||||
o Use separate CPPFLAGS and LDFLAGS for purgatory
|
||||
- dropped kexec-tools-fix-arch-on-unload: merged upstream
|
||||
- dropped kexec-tools-edd-fix: merged upstream
|
||||
- dropped kexec-tools-refactor-architecture-detection: merged
|
||||
upstram
|
||||
- dropped kexec-tools.gcc-bug.patch: merged upstream
|
||||
- dropped kexec-tools.ppc32-64bit-purgatory.patch: merged upstream
|
||||
- kexec-tools-edd-support: merged upstream
|
||||
- kexec-tools-32bit-kexec-with-64bit-ppc64.patch: merged upstream
|
||||
- removed README.SUSE: information not necessary any more
|
||||
* Thu Jul 03 2008 bwalle@suse.de
|
||||
- fix 32 bit kexec to boot on 64 bit ppc64 (bnc#405015)
|
||||
* Tue May 27 2008 bwalle@suse.de
|
||||
|
Loading…
Reference in New Issue
Block a user