Bunches of bugfixes from RHEL5 + bz 428684
This commit is contained in:
parent
79df4118e8
commit
dbc5e5bd2e
@ -1,11 +0,0 @@
|
|||||||
--- kexec-tools-1.101/Makefile.orig 2006-10-20 13:42:52.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/Makefile 2006-10-20 13:43:22.000000000 -0400
|
|
||||||
@@ -45,7 +45,7 @@
|
|
||||||
MAN_PAGES:= kexec/kexec.8
|
|
||||||
MAN_PAGES+= kdump/kdump.8
|
|
||||||
BINARIES_i386:= $(SBINDIR)/kexec $(PKGLIBDIR)/kexec_test $(SBINDIR)/kdump
|
|
||||||
-BINARIES_x86_64:=$(SBINDIR)/kexec $(PKGLIBDIR)/kexec_test
|
|
||||||
+BINARIES_x86_64:= $(SBINDIR)/kexec $(PKGLIBDIR)/kexec_test $(SBINDIR)/kdump
|
|
||||||
BINARIES:=$(SBINDIR)/kexec $(BINARIES_$(ARCH))
|
|
||||||
|
|
||||||
TARGETS:=$(BINARIES) $(MAN_PAGES)
|
|
@ -1,34 +0,0 @@
|
|||||||
--- kexec-tools-1.101/kexec/arch/i386/kexec-bzImage.c.orig 2007-01-04 13:58:06.000000000 -0500
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/i386/kexec-bzImage.c 2007-01-04 14:14:07.000000000 -0500
|
|
||||||
@@ -234,6 +234,9 @@ int bzImage_load(int argc, char **argv,
|
|
||||||
#define OPT_APPEND (OPT_ARCH_MAX+0)
|
|
||||||
#define OPT_RAMDISK (OPT_ARCH_MAX+1)
|
|
||||||
#define OPT_REAL_MODE (OPT_ARCH_MAX+2)
|
|
||||||
+#define OPT_ARGS_ELF (OPT_ARCH_MAX+3)
|
|
||||||
+#define OPT_ARGS_LINUX (OPT_ARCH_MAX+4)
|
|
||||||
+#define OPT_ARGS_NONE (OPT_ARCH_MAX+5)
|
|
||||||
static const struct option options[] = {
|
|
||||||
KEXEC_ARCH_OPTIONS
|
|
||||||
{ "debug", 0, 0, OPT_DEBUG },
|
|
||||||
@@ -242,6 +245,9 @@ int bzImage_load(int argc, char **argv,
|
|
||||||
{ "initrd", 1, 0, OPT_RAMDISK },
|
|
||||||
{ "ramdisk", 1, 0, OPT_RAMDISK },
|
|
||||||
{ "real-mode", 0, 0, OPT_REAL_MODE },
|
|
||||||
+ { "args-elf", 0, NULL, OPT_ARGS_ELF },
|
|
||||||
+ { "args-linux", 0, NULL, OPT_ARGS_LINUX },
|
|
||||||
+ { "args-none", 0, NULL, OPT_ARGS_NONE },
|
|
||||||
{ 0, 0, 0, 0 },
|
|
||||||
};
|
|
||||||
static const char short_options[] = KEXEC_ARCH_OPT_STR "d";
|
|
||||||
@@ -276,6 +282,11 @@ int bzImage_load(int argc, char **argv,
|
|
||||||
case OPT_REAL_MODE:
|
|
||||||
real_mode_entry = 1;
|
|
||||||
break;
|
|
||||||
+ case OPT_ARGS_ELF:
|
|
||||||
+ case OPT_ARGS_LINUX:
|
|
||||||
+ case OPT_ARGS_NONE:
|
|
||||||
+ /* we can ignore these options */
|
|
||||||
+ break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
command_line_len = 0;
|
|
@ -1,11 +0,0 @@
|
|||||||
--- kexec-tools-1.101/kexec/arch/i386/kexec-x86.c.orig 2006-11-15 16:28:04.000000000 -0500
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/i386/kexec-x86.c 2006-11-15 16:28:13.000000000 -0500
|
|
||||||
@@ -145,7 +145,7 @@
|
|
||||||
.serial_baud = 0,
|
|
||||||
.console_vga = 0,
|
|
||||||
.console_serial = 0,
|
|
||||||
- .core_header_type = CORE_TYPE_ELF64,
|
|
||||||
+ .core_header_type = CORE_TYPE_ELF32,
|
|
||||||
};
|
|
||||||
|
|
||||||
int arch_process_options(int argc, char **argv)
|
|
@ -1,22 +0,0 @@
|
|||||||
--- kexec-tools-1.101/kexec/arch/x86_64/kexec-elf-x86_64.c.fix 2006-08-29 20:07:34.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/x86_64/kexec-elf-x86_64.c 2006-08-29 20:08:03.000000000 -0400
|
|
||||||
@@ -120,7 +120,7 @@ int elf_x86_64_load(int argc, char **arg
|
|
||||||
/*
|
|
||||||
* Parse the command line arguments
|
|
||||||
*/
|
|
||||||
- arg_style = ARG_STYLE_ELF;
|
|
||||||
+ arg_style = ARG_STYLE_LINUX;
|
|
||||||
command_line = 0;
|
|
||||||
modified_cmdline = 0;
|
|
||||||
modified_cmdline_len = 0;
|
|
||||||
--- kexec-tools-1.101/kexec/arch/i386/kexec-elf-x86.c.fix 2006-08-29 20:07:14.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/i386/kexec-elf-x86.c 2006-08-29 20:07:24.000000000 -0400
|
|
||||||
@@ -121,7 +121,7 @@ int elf_x86_load(int argc, char **argv,
|
|
||||||
/*
|
|
||||||
* Parse the command line arguments
|
|
||||||
*/
|
|
||||||
- arg_style = ARG_STYLE_ELF;
|
|
||||||
+ arg_style = ARG_STYLE_LINUX;
|
|
||||||
command_line = 0;
|
|
||||||
modified_cmdline = 0;
|
|
||||||
modified_cmdline_len = 0;
|
|
@ -1,44 +0,0 @@
|
|||||||
--- kexec-tools-1.101/kexec/kexec-elf.h.orig 2006-07-31 10:41:57.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/kexec/kexec-elf.h 2006-07-31 10:42:09.000000000 -0400
|
|
||||||
@@ -89,7 +89,7 @@ extern int build_elf_info(const char *bu
|
|
||||||
extern int build_elf_exec_info(const char *buf, off_t len, struct mem_ehdr *ehdr);
|
|
||||||
extern int build_elf_rel_info(const char *buf, off_t len, struct mem_ehdr *ehdr);
|
|
||||||
|
|
||||||
-extern int elf_exec_load(const struct mem_ehdr *ehdr, struct kexec_info *info);
|
|
||||||
+extern int elf_exec_load(struct mem_ehdr *ehdr, struct kexec_info *info);
|
|
||||||
extern int elf_rel_load(struct mem_ehdr *ehdr, struct kexec_info *info,
|
|
||||||
unsigned long min, unsigned long max, int end);
|
|
||||||
|
|
||||||
--- kexec-tools-1.101/kexec/kexec-elf-exec.c.orig 2006-07-31 10:14:20.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/kexec/kexec-elf-exec.c 2006-07-31 10:18:25.000000000 -0400
|
|
||||||
@@ -47,7 +47,7 @@ int build_elf_exec_info(const char *buf,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
-int elf_exec_load(const struct mem_ehdr *ehdr, struct kexec_info *info)
|
|
||||||
+int elf_exec_load(struct mem_ehdr *ehdr, struct kexec_info *info)
|
|
||||||
{
|
|
||||||
unsigned long base;
|
|
||||||
int result;
|
|
||||||
@@ -79,8 +79,8 @@ int elf_exec_load(const struct mem_ehdr
|
|
||||||
}
|
|
||||||
start = phdr->p_paddr;
|
|
||||||
stop = start + phdr->p_memsz;
|
|
||||||
- if (start > first) {
|
|
||||||
- start = first;
|
|
||||||
+ if (first > start) {
|
|
||||||
+ first = start;
|
|
||||||
}
|
|
||||||
if (last < stop) {
|
|
||||||
last = stop;
|
|
||||||
@@ -126,6 +126,10 @@ int elf_exec_load(const struct mem_ehdr
|
|
||||||
phdr->p_data, size,
|
|
||||||
phdr->p_paddr + base, phdr->p_memsz);
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ /* Update entry point to reflect new load address*/
|
|
||||||
+ ehdr->e_entry += base;
|
|
||||||
+
|
|
||||||
result = 0;
|
|
||||||
out:
|
|
||||||
return result;
|
|
@ -1,281 +0,0 @@
|
|||||||
--- kexec-tools-1.101/purgatory/arch/ia64/entry.S.orig1 2006-10-12 14:25:54.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/purgatory/arch/ia64/entry.S 2006-10-12 14:48:04.000000000 -0400
|
|
||||||
@@ -46,6 +46,8 @@
|
|
||||||
br.call.sptk.many b0=ia64_env_setup
|
|
||||||
movl r10=__kernel_entry;;
|
|
||||||
ld8 r14=[r10];;
|
|
||||||
+ movl r10=__boot_param_base;;
|
|
||||||
+ ld8 r28=[r10];;
|
|
||||||
mov b6=r14;;
|
|
||||||
mov ar.lc=r0
|
|
||||||
mov ar.ec=r0
|
|
||||||
@@ -61,6 +63,7 @@
|
|
||||||
DECLARE_DATA8(__command_line_len)
|
|
||||||
DECLARE_DATA8(__efi_memmap_base)
|
|
||||||
DECLARE_DATA8(__efi_memmap_size)
|
|
||||||
+DECLARE_DATA8(__boot_param_base)
|
|
||||||
DECLARE_DATA8(__loaded_segments)
|
|
||||||
DECLARE_DATA8(__loaded_segments_num)
|
|
||||||
|
|
||||||
--- kexec-tools-1.101/purgatory/arch/ia64/purgatory-ia64.c.orig1 2006-10-12 14:25:54.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/purgatory/arch/ia64/purgatory-ia64.c 2006-10-12 14:48:04.000000000 -0400
|
|
||||||
@@ -123,11 +123,12 @@
|
|
||||||
uint64_t command_line_len;
|
|
||||||
uint64_t efi_memmap_base;
|
|
||||||
uint64_t efi_memmap_size;
|
|
||||||
+ uint64_t boot_param_base;
|
|
||||||
struct loaded_segment *loaded_segments;
|
|
||||||
unsigned long loaded_segments_num;
|
|
||||||
};
|
|
||||||
|
|
||||||
-void
|
|
||||||
+void
|
|
||||||
setup_arch(void)
|
|
||||||
{
|
|
||||||
reset_vga();
|
|
||||||
@@ -138,11 +139,11 @@
|
|
||||||
return addr - PAGE_OFFSET;
|
|
||||||
}
|
|
||||||
|
|
||||||
-void
|
|
||||||
-patch_efi_memmap(struct kexec_boot_params *params,
|
|
||||||
+void
|
|
||||||
+patch_efi_memmap(struct kexec_boot_params *params,
|
|
||||||
struct ia64_boot_param *boot_param)
|
|
||||||
{
|
|
||||||
- void *dest = (void *)params->efi_memmap_base;
|
|
||||||
+ void *dest = (void *)params->efi_memmap_base;
|
|
||||||
void *src = (void *)boot_param->efi_memmap;
|
|
||||||
unsigned long len = boot_param->efi_memmap_size;
|
|
||||||
unsigned long memdesc_size = boot_param->efi_memdesc_size;
|
|
||||||
@@ -150,15 +151,15 @@
|
|
||||||
efi_memory_desc_t *md1, *md2;
|
|
||||||
void *p1, *p2, *src_end = src + len;
|
|
||||||
int i;
|
|
||||||
- for (p1 = src, p2 = dest; p1 < src_end;
|
|
||||||
+ for (p1 = src, p2 = dest; p1 < src_end;
|
|
||||||
p1 += memdesc_size, p2 += memdesc_size) {
|
|
||||||
unsigned long mstart, mend;
|
|
||||||
md1 = p1;
|
|
||||||
md2 = p2;
|
|
||||||
- if (md1->num_pages == 0)
|
|
||||||
+ if (md1->num_pages == 0)
|
|
||||||
continue;
|
|
||||||
mstart = md1->phys_addr;
|
|
||||||
- mend = md1->phys_addr + (md1->num_pages
|
|
||||||
+ mend = md1->phys_addr + (md1->num_pages
|
|
||||||
<< EFI_PAGE_SHIFT);
|
|
||||||
switch (md1->type) {
|
|
||||||
case EFI_LOADER_DATA:
|
|
||||||
@@ -168,7 +169,7 @@
|
|
||||||
default:
|
|
||||||
*md2 = *md1;
|
|
||||||
}
|
|
||||||
- // segments are already sorted and aligned to 4K
|
|
||||||
+ // segments are already sorted and aligned to 4K
|
|
||||||
orig_type = md2->type;
|
|
||||||
for (i = 0; i < params->loaded_segments_num; i++) {
|
|
||||||
struct loaded_segment *seg;
|
|
||||||
@@ -177,50 +178,50 @@
|
|
||||||
unsigned long start_pages, mid_pages, end_pages;
|
|
||||||
if (seg->end > mend) {
|
|
||||||
p1 += memdesc_size;
|
|
||||||
- for(; p1 < src_end;
|
|
||||||
+ for(; p1 < src_end;
|
|
||||||
p1 += memdesc_size) {
|
|
||||||
md1 = p1;
|
|
||||||
/* TODO check contig and attribute here */
|
|
||||||
- mend = md1->phys_addr
|
|
||||||
+ mend = md1->phys_addr
|
|
||||||
+ (md1->num_pages << EFI_PAGE_SHIFT);
|
|
||||||
if (seg->end < mend)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
- start_pages = (seg->start - mstart)
|
|
||||||
+ start_pages = (seg->start - mstart)
|
|
||||||
>> EFI_PAGE_SHIFT;
|
|
||||||
mid_pages = (seg->end - seg->start)
|
|
||||||
>> EFI_PAGE_SHIFT;
|
|
||||||
- end_pages = (mend - seg->end)
|
|
||||||
+ end_pages = (mend - seg->end)
|
|
||||||
>> EFI_PAGE_SHIFT;
|
|
||||||
if (start_pages) {
|
|
||||||
md2->num_pages = start_pages;
|
|
||||||
- p2 += memdesc_size;
|
|
||||||
+ p2 += memdesc_size;
|
|
||||||
md2 = p2;
|
|
||||||
*md2 = *md1;
|
|
||||||
}
|
|
||||||
md2->phys_addr = seg->start;
|
|
||||||
md2->num_pages = mid_pages;
|
|
||||||
- md2->type = seg->reserved ?
|
|
||||||
+ md2->type = seg->reserved ?
|
|
||||||
EFI_UNUSABLE_MEMORY:EFI_LOADER_DATA;
|
|
||||||
if (end_pages) {
|
|
||||||
- p2 += memdesc_size;
|
|
||||||
+ p2 += memdesc_size;
|
|
||||||
md2 = p2;
|
|
||||||
*md2 = *md1;
|
|
||||||
md2->phys_addr = seg->end;
|
|
||||||
md2->num_pages = end_pages;
|
|
||||||
md2->type = orig_type;
|
|
||||||
mstart = seg->end;
|
|
||||||
- } else
|
|
||||||
+ } else
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-
|
|
||||||
+
|
|
||||||
boot_param->efi_memmap_size = p2 - dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
-void
|
|
||||||
+void
|
|
||||||
flush_icache_range(char *start, unsigned long len)
|
|
||||||
{
|
|
||||||
unsigned long i;
|
|
||||||
@@ -233,7 +234,7 @@
|
|
||||||
extern char __dummy_efi_function[], __dummy_efi_function_end[];
|
|
||||||
|
|
||||||
|
|
||||||
-void
|
|
||||||
+void
|
|
||||||
ia64_env_setup(struct ia64_boot_param *boot_param,
|
|
||||||
struct kexec_boot_params *params)
|
|
||||||
{
|
|
||||||
@@ -243,13 +244,15 @@
|
|
||||||
unsigned long *set_virtual_address_map;
|
|
||||||
char *command_line = (char *)params->command_line;
|
|
||||||
uint64_t command_line_len = params->command_line_len;
|
|
||||||
-
|
|
||||||
+ struct ia64_boot_param *new_boot_param =
|
|
||||||
+ (struct ia64_boot_param *) params->boot_param_base;
|
|
||||||
+ memcpy(new_boot_param, boot_param, 4096);
|
|
||||||
// patch efi_runtime->set_virtual_address_map to a
|
|
||||||
// dummy function
|
|
||||||
len = __dummy_efi_function_end - __dummy_efi_function;
|
|
||||||
- memcpy(command_line + command_line_len,
|
|
||||||
+ memcpy(command_line + command_line_len,
|
|
||||||
__dummy_efi_function, len);
|
|
||||||
- systab = (efi_system_table_t *)boot_param->efi_systab;
|
|
||||||
+ systab = (efi_system_table_t *)new_boot_param->efi_systab;
|
|
||||||
runtime = (efi_runtime_services_t *)PA(systab->runtime);
|
|
||||||
set_virtual_address_map =
|
|
||||||
(unsigned long *)PA(runtime->set_virtual_address_map);
|
|
||||||
@@ -257,15 +260,14 @@
|
|
||||||
(unsigned long)(command_line + command_line_len);
|
|
||||||
flush_icache_range(command_line + command_line_len, len);
|
|
||||||
|
|
||||||
- patch_efi_memmap(params, boot_param);
|
|
||||||
-
|
|
||||||
- boot_param->efi_memmap = params->efi_memmap_base;
|
|
||||||
+ patch_efi_memmap(params, new_boot_param);
|
|
||||||
|
|
||||||
- boot_param->command_line = params->command_line;
|
|
||||||
- boot_param->console_info.orig_x = 0;
|
|
||||||
- boot_param->console_info.orig_y = 0;
|
|
||||||
- boot_param->initrd_start = params->ramdisk_base;
|
|
||||||
- boot_param->initrd_size = params->ramdisk_size;
|
|
||||||
+ new_boot_param->efi_memmap = params->efi_memmap_base;
|
|
||||||
+ new_boot_param->command_line = params->command_line;
|
|
||||||
+ new_boot_param->console_info.orig_x = 0;
|
|
||||||
+ new_boot_param->console_info.orig_y = 0;
|
|
||||||
+ new_boot_param->initrd_start = params->ramdisk_base;
|
|
||||||
+ new_boot_param->initrd_size = params->ramdisk_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This function can be used to execute after the SHA256 verification. */
|
|
||||||
--- kexec-tools-1.101/kexec/arch/ia64/kexec-ia64.c.orig1 2006-10-12 14:25:54.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/ia64/kexec-ia64.c 2006-10-12 14:47:57.000000000 -0400
|
|
||||||
@@ -36,6 +36,38 @@
|
|
||||||
|
|
||||||
static struct memory_range memory_range[MAX_MEMORY_RANGES];
|
|
||||||
|
|
||||||
+/* Reserve range for EFI memmap and Boot parameter */
|
|
||||||
+static int split_range(int range, unsigned long start, unsigned long end)
|
|
||||||
+{
|
|
||||||
+ unsigned long ram_end = memory_range[range - 1].end;
|
|
||||||
+ unsigned int type = memory_range[range - 1].type;
|
|
||||||
+ int i;
|
|
||||||
+ //align end and start to page size of EFI
|
|
||||||
+ start = start & ~((1UL<<12) - 1);
|
|
||||||
+ end = (end + (1UL<<12) - 1)& ~((1UL<<12) - 1);
|
|
||||||
+ for (i = 0; i < range; i++)
|
|
||||||
+ if(memory_range[i].start <= start && memory_range[i].end >=end)
|
|
||||||
+ break;
|
|
||||||
+ if (i >= range)
|
|
||||||
+ return range;
|
|
||||||
+ range = i;
|
|
||||||
+ if (memory_range[range].start < start) {
|
|
||||||
+ memory_range[range].end = start;
|
|
||||||
+ range++;
|
|
||||||
+ }
|
|
||||||
+ memory_range[range].start = start;
|
|
||||||
+ memory_range[range].end = end;
|
|
||||||
+ memory_range[range].type = RANGE_RESERVED;
|
|
||||||
+ range++;
|
|
||||||
+ if (end < ram_end) {
|
|
||||||
+ memory_range[range].start = end;
|
|
||||||
+ memory_range[range].end = ram_end;
|
|
||||||
+ memory_range[range].type = type;
|
|
||||||
+ range++;
|
|
||||||
+ }
|
|
||||||
+ return range;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
/* Return a sorted list of available memory ranges. */
|
|
||||||
int get_memory_ranges(struct memory_range **range, int *ranges,
|
|
||||||
unsigned long kexec_flags)
|
|
||||||
@@ -85,6 +117,12 @@
|
|
||||||
mem_max = end;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
+ } else if (memcmp(str, "Boot parameter\n", 14) == 0) {
|
|
||||||
+ memory_ranges = split_range(memory_ranges, start, end);
|
|
||||||
+ continue;
|
|
||||||
+ } else if (memcmp(str, "EFI Memory Map\n", 14) == 0) {
|
|
||||||
+ memory_ranges = split_range(memory_ranges, start, end);
|
|
||||||
+ continue;
|
|
||||||
} else
|
|
||||||
continue;
|
|
||||||
/*
|
|
||||||
@@ -125,7 +163,7 @@
|
|
||||||
{
|
|
||||||
static const struct option options[] = {
|
|
||||||
KEXEC_ARCH_OPTIONS
|
|
||||||
- { 0, 0, NULL, 0 },
|
|
||||||
+ { 0, 0, NULL, 0 },
|
|
||||||
};
|
|
||||||
static const char short_options[] = KEXEC_ARCH_OPT_STR;
|
|
||||||
int opt;
|
|
||||||
--- kexec-tools-1.101/kexec/arch/ia64/kexec-elf-ia64.c.orig1 2006-10-12 14:25:54.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/ia64/kexec-elf-ia64.c 2006-10-12 14:48:04.000000000 -0400
|
|
||||||
@@ -115,9 +115,10 @@
|
|
||||||
unsigned long entry, max_addr, gp_value;
|
|
||||||
unsigned long command_line_base, ramdisk_base;
|
|
||||||
unsigned long efi_memmap_base, efi_memmap_size;
|
|
||||||
+ unsigned long boot_param_base;
|
|
||||||
int result;
|
|
||||||
int opt;
|
|
||||||
- char *efi_memmap_buf;
|
|
||||||
+ char *efi_memmap_buf, *boot_param;
|
|
||||||
#define OPT_APPEND (OPT_ARCH_MAX+0)
|
|
||||||
#define OPT_RAMDISK (OPT_ARCH_MAX+1)
|
|
||||||
static const struct option options[] = {
|
|
||||||
@@ -191,6 +192,13 @@
|
|
||||||
&command_line) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
+ // reverve 4k for ia64_boot_param
|
|
||||||
+ boot_param = xmalloc(4096);
|
|
||||||
+ boot_param_base = add_buffer(info, boot_param, 4096, 4096, 4096, 0,
|
|
||||||
+ max_addr, -1);
|
|
||||||
+ elf_rel_set_symbol(&info->rhdr, "__boot_param_base",
|
|
||||||
+ &boot_param_base, sizeof(long));
|
|
||||||
+
|
|
||||||
// reserve 8k for efi_memmap
|
|
||||||
efi_memmap_size = 1UL<<14;
|
|
||||||
efi_memmap_buf = xmalloc(efi_memmap_size);
|
|
@ -1,125 +0,0 @@
|
|||||||
--- kexec-tools-1.101/kexec/arch/ia64/kexec-ia64.h.orig 2006-12-01 14:36:39.000000000 -0500
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/ia64/kexec-ia64.h 2006-12-01 14:49:13.000000000 -0500
|
|
||||||
@@ -7,6 +7,10 @@
|
|
||||||
int elf_ia64_load(int argc, char **argv, const char *buf, off_t len,
|
|
||||||
struct kexec_info *info);
|
|
||||||
void elf_ia64_usage(void);
|
|
||||||
+int update_loaded_segments(struct kexec_info *info, struct mem_ehdr *ehdr);
|
|
||||||
+void move_loaded_segments(struct kexec_info *info, struct mem_ehdr *ehdr,
|
|
||||||
+ unsigned long addr);
|
|
||||||
+
|
|
||||||
#define MAX_MEMORY_RANGES 1024
|
|
||||||
#define EFI_PAGE_SIZE (1UL<<12)
|
|
||||||
#define ELF_PAGE_SIZE (1UL<<16)
|
|
||||||
--- kexec-tools-1.101/kexec/arch/ia64/kexec-ia64.c.orig 2006-12-01 14:36:39.000000000 -0500
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/ia64/kexec-ia64.c 2006-12-01 14:55:16.000000000 -0500
|
|
||||||
@@ -28,14 +28,16 @@
|
|
||||||
#include <string.h>
|
|
||||||
#include <getopt.h>
|
|
||||||
#include <sched.h>
|
|
||||||
+#include <limits.h>
|
|
||||||
#include <sys/utsname.h>
|
|
||||||
#include "../../kexec.h"
|
|
||||||
#include "../../kexec-syscall.h"
|
|
||||||
+#include "elf.h"
|
|
||||||
#include "kexec-ia64.h"
|
|
||||||
#include <arch/options.h>
|
|
||||||
|
|
||||||
static struct memory_range memory_range[MAX_MEMORY_RANGES];
|
|
||||||
-
|
|
||||||
+static int memory_ranges;
|
|
||||||
/* Reserve range for EFI memmap and Boot parameter */
|
|
||||||
static int split_range(int range, unsigned long start, unsigned long end)
|
|
||||||
{
|
|
||||||
@@ -73,7 +75,6 @@
|
|
||||||
unsigned long kexec_flags)
|
|
||||||
{
|
|
||||||
const char iomem[]= "/proc/iomem";
|
|
||||||
- int memory_ranges = 0;
|
|
||||||
char line[MAX_LINE];
|
|
||||||
FILE *fp;
|
|
||||||
fp = fopen(iomem, "r");
|
|
||||||
@@ -209,6 +210,45 @@
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
+int update_loaded_segments(struct kexec_info *info, struct mem_ehdr *ehdr)
|
|
||||||
+{
|
|
||||||
+ int i;
|
|
||||||
+ struct mem_phdr *phdr;
|
|
||||||
+ unsigned long start_addr = ULONG_MAX, end_addr = 0;
|
|
||||||
+ unsigned long align = 1UL<<26; // 64M
|
|
||||||
+ for(i = 0; i < ehdr->e_phnum; i++) {
|
|
||||||
+ phdr = &ehdr->e_phdr[i];
|
|
||||||
+ if (phdr->p_type == PT_LOAD) {
|
|
||||||
+ if (phdr->p_paddr < start_addr)
|
|
||||||
+ start_addr = phdr->p_paddr;
|
|
||||||
+ if ((phdr->p_paddr + phdr->p_memsz) > end_addr)
|
|
||||||
+ end_addr = phdr->p_paddr + phdr->p_memsz;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ for (i = 0; i < memory_ranges
|
|
||||||
+ && memory_range[i].start <= start_addr; i++) {
|
|
||||||
+ if (memory_range[i].type == RANGE_RAM &&
|
|
||||||
+ memory_range[i].end > end_addr)
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ for (i = 0; i < memory_ranges; i++) {
|
|
||||||
+ if (memory_range[i].type == RANGE_RAM) {
|
|
||||||
+ unsigned long start =
|
|
||||||
+ (memory_range[i].start + align - 1)&~(align - 1);
|
|
||||||
+ unsigned long end = memory_range[i].end;
|
|
||||||
+ if (end > start &&
|
|
||||||
+ (end - start) > (end_addr - start_addr)) {
|
|
||||||
+ move_loaded_segments(info, ehdr, start);
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ return 1;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
void arch_update_purgatory(struct kexec_info *info)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
--- kexec-tools-1.101/kexec/arch/ia64/kexec-elf-ia64.c.orig 2006-12-01 14:36:39.000000000 -0500
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/ia64/kexec-elf-ia64.c 2006-12-01 14:59:29.000000000 -0500
|
|
||||||
@@ -84,7 +84,8 @@
|
|
||||||
|
|
||||||
/* Move the crash kerenl physical offset to reserved region
|
|
||||||
*/
|
|
||||||
-static void move_loaded_segments(struct kexec_info *info, struct mem_ehdr *ehdr)
|
|
||||||
+void move_loaded_segments(struct kexec_info *info, struct mem_ehdr *ehdr,
|
|
||||||
+ unsigned long addr)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
long offset;
|
|
||||||
@@ -92,7 +93,7 @@
|
|
||||||
for(i = 0; i < ehdr->e_phnum; i++) {
|
|
||||||
phdr = &ehdr->e_phdr[i];
|
|
||||||
if (phdr->p_type == PT_LOAD) {
|
|
||||||
- offset = mem_min - phdr->p_paddr;
|
|
||||||
+ offset = addr - phdr->p_paddr;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -174,8 +175,14 @@
|
|
||||||
fprintf(stderr, "Failed to find crash kernel region in /proc/iomem\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
- move_loaded_segments(info, &ehdr);
|
|
||||||
- }
|
|
||||||
+ move_loaded_segments(info, &ehdr, mem_min);
|
|
||||||
+ } else {
|
|
||||||
+ if (update_loaded_segments(info, &ehdr)) {
|
|
||||||
+ fprintf(stderr, "Failed to place kernel\n");
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
|
|
||||||
entry = ehdr.e_entry;
|
|
||||||
max_addr = elf_max_addr(&ehdr);
|
|
@ -1,40 +0,0 @@
|
|||||||
--- kexec-tools-1.101/kexec/arch/ia64/kexec-ia64.c.orig 2006-07-05 15:16:35.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/ia64/kexec-ia64.c 2006-07-05 15:16:54.000000000 -0400
|
|
||||||
@@ -87,8 +87,6 @@ int arch_process_options(int argc, char
|
|
||||||
};
|
|
||||||
static const char short_options[] = KEXEC_ARCH_OPT_STR;
|
|
||||||
int opt;
|
|
||||||
- unsigned long value;
|
|
||||||
- char *end;
|
|
||||||
|
|
||||||
opterr = 0; /* Don't complain about unrecognized options here */
|
|
||||||
while((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) {
|
|
||||||
@@ -115,28 +113,6 @@ int arch_compat_trampoline(struct kexec_
|
|
||||||
}
|
|
||||||
if (strcmp(utsname.machine, "ia64") == 0)
|
|
||||||
{
|
|
||||||
- info->kexec_flags |= KEXEC_ARCH_X86_64;
|
|
||||||
- }
|
|
||||||
- else {
|
|
||||||
- fprintf(stderr, "Unsupported machine type: %s\n",
|
|
||||||
- utsname.machine);
|
|
||||||
- return -1;
|
|
||||||
- }
|
|
||||||
- return 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)
|
|
||||||
- {
|
|
||||||
/* For compatibility with older patches
|
|
||||||
* use KEXEC_ARCH_DEFAULT instead of KEXEC_ARCH_IA64 here.
|
|
||||||
*/
|
|
@ -1,13 +0,0 @@
|
|||||||
--- kexec-tools-1.101/purgatory/arch/ia64/purgatory-ia64.c.orig 2006-10-20 13:45:49.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/purgatory/arch/ia64/purgatory-ia64.c 2006-10-20 13:46:56.000000000 -0400
|
|
||||||
@@ -224,7 +224,9 @@
|
|
||||||
void
|
|
||||||
flush_icache_range(char *start, unsigned long len)
|
|
||||||
{
|
|
||||||
- unsigned long i;
|
|
||||||
+ unsigned long i,addr;
|
|
||||||
+ addr = (unsigned long)start & ~31UL;
|
|
||||||
+ len += (unsigned long)start - addr;
|
|
||||||
for (i = 0;i < len; i += 32)
|
|
||||||
asm volatile("fc.i %0"::"r"(start + i):"memory");
|
|
||||||
asm volatile (";;sync.i;;":::"memory");
|
|
File diff suppressed because it is too large
Load Diff
@ -1,11 +0,0 @@
|
|||||||
--- kexec-tools-1.101/kexec/arch/ia64/crashdump-ia64.c.orig 2006-12-01 14:16:07.000000000 -0500
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/ia64/crashdump-ia64.c 2006-12-01 14:18:34.000000000 -0500
|
|
||||||
@@ -28,7 +28,7 @@
|
|
||||||
#include "crashdump-ia64.h"
|
|
||||||
|
|
||||||
int memory_ranges = 0;
|
|
||||||
-#define LOAD_OFFSET (0xa000000000000000UL + 0x100000000UL - (1UL<<26))
|
|
||||||
+#define LOAD_OFFSET (0xa000000000000000UL + 0x100000000UL - kernel_code_start)
|
|
||||||
#define MAX_LINE 160
|
|
||||||
/* Stores a sorted list of RAM memory ranges for which to create elf headers.
|
|
||||||
* A separate program header is created for backup region */
|
|
@ -1,11 +0,0 @@
|
|||||||
--- kexec-tools-1.101/kexec/arch/ia64/kexec-elf-ia64.c.orig 2006-12-01 14:30:59.000000000 -0500
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/ia64/kexec-elf-ia64.c 2006-12-01 14:31:04.000000000 -0500
|
|
||||||
@@ -128,7 +128,7 @@
|
|
||||||
{"command-line", 1, 0, OPT_APPEND},
|
|
||||||
{"append", 1, 0, OPT_APPEND},
|
|
||||||
{"initrd", 1, 0, OPT_RAMDISK},
|
|
||||||
- {"noio", 1, 0, OPT_NOIO},
|
|
||||||
+ {"noio", 0, 0, OPT_NOIO},
|
|
||||||
{0, 0, 0, 0},
|
|
||||||
};
|
|
||||||
|
|
@ -1,252 +0,0 @@
|
|||||||
On Thu, Sep 21, 2006 at 01:06:08PM +0800, Zou Nan hai wrote:
|
|
||||||
> SN platform support PIO in a different way to generic IA64 platform. It
|
|
||||||
> does not support most of the legacy I/O ports.
|
|
||||||
>
|
|
||||||
> Give an --noio option to kexec-tools to disable I/O in purgatory code.
|
|
||||||
>
|
|
||||||
> This patch also removed an unused io.h in kexec-tools.
|
|
||||||
>
|
|
||||||
> Signed-off-by: Zou Nan hai <nanhai.zou@intel.com>
|
|
||||||
|
|
||||||
I have merged the following into kexec-tools-test.
|
|
||||||
|
|
||||||
--
|
|
||||||
Horms
|
|
||||||
H: http://www.vergenet.net/~horms/
|
|
||||||
W: http://www.valinux.co.jp/en/
|
|
||||||
|
|
||||||
From: Zou Nan hai <nanhai.zou@intel.com>
|
|
||||||
Date: 21 Sep 2006 13:06:08 +0800
|
|
||||||
Subject: kexec-tools: --noio option to disable I/O in purgatory code.
|
|
||||||
|
|
||||||
SN platform support PIO in a different way to generic IA64 platform. It
|
|
||||||
does not support most of the legacy I/O ports.
|
|
||||||
|
|
||||||
Give an --noio option to kexec-tools to disable I/O in purgatory code.
|
|
||||||
|
|
||||||
This patch also removed an unused io.h in kexec-tools.
|
|
||||||
|
|
||||||
Signed-off-by: Zou Nan hai <nanhai.zou@intel.com>
|
|
||||||
|
|
||||||
Edited to consistently use tabs instead of spaces for intentation,
|
|
||||||
remove one instance of trailing whitespace, and fix indentation
|
|
||||||
of noio line in options[].
|
|
||||||
|
|
||||||
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
||||||
|
|
||||||
diff -Nraup kexec-tools-1.101/kexec/arch/ia64/kexec-elf-ia64.c
|
|
||||||
kexec-tools-1.101-fix/kexec/arch/ia64/kexec-elf-ia64.c
|
|
||||||
--- kexec-tools-1.101/kexec/arch/ia64/kexec-elf-ia64.c 2006-09-20 15:30:40.000000000 +0800
|
|
||||||
+++ kexec-tools-1.101-fix/kexec/arch/ia64/kexec-elf-ia64.c 2006-09-21 15:12:20.000000000 +0800
|
|
||||||
@@ -116,16 +116,19 @@ int elf_ia64_load(int argc, char **argv,
|
|
||||||
unsigned long command_line_base, ramdisk_base;
|
|
||||||
unsigned long efi_memmap_base, efi_memmap_size;
|
|
||||||
unsigned long boot_param_base;
|
|
||||||
+ unsigned long noio=0;
|
|
||||||
int result;
|
|
||||||
int opt;
|
|
||||||
char *efi_memmap_buf, *boot_param;
|
|
||||||
#define OPT_APPEND (OPT_ARCH_MAX+0)
|
|
||||||
#define OPT_RAMDISK (OPT_ARCH_MAX+1)
|
|
||||||
+#define OPT_NOIO (OPT_ARCH_MAX+2)
|
|
||||||
static const struct option options[] = {
|
|
||||||
KEXEC_ARCH_OPTIONS
|
|
||||||
{"command-line", 1, 0, OPT_APPEND},
|
|
||||||
{"append", 1, 0, OPT_APPEND},
|
|
||||||
{"initrd", 1, 0, OPT_RAMDISK},
|
|
||||||
+ {"noio", 1, 0, OPT_NOIO},
|
|
||||||
{0, 0, 0, 0},
|
|
||||||
};
|
|
||||||
|
|
||||||
@@ -148,6 +151,9 @@ int elf_ia64_load(int argc, char **argv,
|
|
||||||
case OPT_RAMDISK:
|
|
||||||
ramdisk = optarg;
|
|
||||||
break;
|
|
||||||
+ case OPT_NOIO: /* disable PIO and MMIO in purgatory code*/
|
|
||||||
+ noio = 1;
|
|
||||||
+ break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
command_line_len = 0;
|
|
||||||
@@ -196,6 +202,10 @@ int elf_ia64_load(int argc, char **argv,
|
|
||||||
boot_param = xmalloc(4096);
|
|
||||||
boot_param_base = add_buffer(info, boot_param, 4096, 4096, 4096, 0,
|
|
||||||
max_addr, -1);
|
|
||||||
+
|
|
||||||
+ elf_rel_set_symbol(&info->rhdr, "__noio",
|
|
||||||
+ &noio, sizeof(long));
|
|
||||||
+
|
|
||||||
elf_rel_set_symbol(&info->rhdr, "__boot_param_base",
|
|
||||||
&boot_param_base, sizeof(long));
|
|
||||||
|
|
||||||
diff -Nraup kexec-tools-1.101/purgatory/arch/ia64/entry.S
|
|
||||||
kexec-tools-1.101-fix/purgatory/arch/ia64/entry.S
|
|
||||||
--- kexec-tools-1.101/purgatory/arch/ia64/entry.S 2006-09-20 15:30:40.000000000 +0800
|
|
||||||
+++ kexec-tools-1.101-fix/purgatory/arch/ia64/entry.S 2006-09-21 15:11:36.000000000 +0800
|
|
||||||
@@ -68,3 +68,4 @@ DECLARE_DATA8(__loaded_segments)
|
|
||||||
DECLARE_DATA8(__loaded_segments_num)
|
|
||||||
|
|
||||||
DECLARE_DATA8(__gp_value)
|
|
||||||
+DECLARE_DATA8(__noio)
|
|
||||||
diff -Nraup kexec-tools-1.101/purgatory/arch/ia64/include/arch/io.h
|
|
||||||
kexec-tools-1.101-fix/purgatory/arch/ia64/include/arch/io.h
|
|
||||||
--- kexec-tools-1.101/purgatory/arch/ia64/include/arch/io.h 2006-09-20 15:29:29.000000000 +0800
|
|
||||||
+++ kexec-tools-1.101-fix/purgatory/arch/ia64/include/arch/io.h 1970-01-01 08:00:00.000000000 +0800
|
|
||||||
@@ -1,25 +0,0 @@
|
|
||||||
-#ifndef ARCH_IO_H
|
|
||||||
-#define ARCH_IO_H
|
|
||||||
-
|
|
||||||
-#include <stdint.h>
|
|
||||||
-/* Helper functions for directly doing I/O */
|
|
||||||
-
|
|
||||||
-extern inline uint8_t inb(void *port)
|
|
||||||
-{
|
|
||||||
- volatile unsigned char *addr = (unsigned char *)port;
|
|
||||||
- uint8_t result;
|
|
||||||
-
|
|
||||||
- result = *addr;
|
|
||||||
- asm volatile ("mf.a"::: "memory");
|
|
||||||
- return result;
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-extern inline void outb (uint8_t value, void *port)
|
|
||||||
-{
|
|
||||||
- volatile unsigned char *addr = (unsigned char *)port;
|
|
||||||
-
|
|
||||||
- *addr = value;
|
|
||||||
- asm volatile ("mf.a"::: "memory");
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-#endif /* ARCH_IO_H */
|
|
||||||
diff -Nraup kexec-tools-1.101/purgatory/arch/ia64/io.h
|
|
||||||
kexec-tools-1.101-fix/purgatory/arch/ia64/io.h
|
|
||||||
--- kexec-tools-1.101/purgatory/arch/ia64/io.h 2006-09-20 15:29:29.000000000 +0800
|
|
||||||
+++ kexec-tools-1.101-fix/purgatory/arch/ia64/io.h 2006-09-21 15:11:19.000000000 +0800
|
|
||||||
@@ -3,7 +3,7 @@
|
|
||||||
#define UNCACHED(x) (void *)((x)|(1UL<<63))
|
|
||||||
#define MF() asm volatile ("mf.a" ::: "memory")
|
|
||||||
#define IO_SPACE_ENCODING(p) ((((p) >> 2) << 12) | (p & 0xfff))
|
|
||||||
-
|
|
||||||
+extern long __noio;
|
|
||||||
static inline void *io_addr (unsigned long port)
|
|
||||||
{
|
|
||||||
unsigned long offset;
|
|
||||||
@@ -16,28 +16,34 @@ static inline void *io_addr (unsigned lo
|
|
||||||
static inline unsigned int inb (unsigned long port)
|
|
||||||
{
|
|
||||||
volatile unsigned char *addr = io_addr(port);
|
|
||||||
- unsigned char ret;
|
|
||||||
- ret = *addr;
|
|
||||||
- MF();
|
|
||||||
+ unsigned char ret = 0;
|
|
||||||
+ if (!__noio) {
|
|
||||||
+ ret = *addr;
|
|
||||||
+ MF();
|
|
||||||
+ }
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline unsigned int inw (unsigned long port)
|
|
||||||
{
|
|
||||||
volatile unsigned short *addr = io_addr(port);
|
|
||||||
- unsigned short ret;
|
|
||||||
+ unsigned short ret = 0;
|
|
||||||
|
|
||||||
- ret = *addr;
|
|
||||||
- MF();
|
|
||||||
+ if (!__noio) {
|
|
||||||
+ ret = *addr;
|
|
||||||
+ MF();
|
|
||||||
+ }
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
-static inline unsigned int ia64_inl (unsigned long port)
|
|
||||||
+static inline unsigned int inl (unsigned long port)
|
|
||||||
{
|
|
||||||
- volatile unsigned int *addr = __ia64_mk_io_addr(port);
|
|
||||||
- unsigned int ret;
|
|
||||||
- ret = *addr;
|
|
||||||
- MF();
|
|
||||||
+ volatile unsigned int *addr = io_addr(port);
|
|
||||||
+ unsigned int ret ;
|
|
||||||
+ if (!__noio) {
|
|
||||||
+ ret = *addr;
|
|
||||||
+ MF();
|
|
||||||
+ }
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -45,50 +51,58 @@ static inline void outb (unsigned char v
|
|
||||||
{
|
|
||||||
volatile unsigned char *addr = io_addr(port);
|
|
||||||
|
|
||||||
- *addr = val;
|
|
||||||
- MF();
|
|
||||||
+ if (!__noio) {
|
|
||||||
+ *addr = val;
|
|
||||||
+ MF();
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void outw (unsigned short val, unsigned long port)
|
|
||||||
{
|
|
||||||
volatile unsigned short *addr = io_addr(port);
|
|
||||||
|
|
||||||
- *addr = val;
|
|
||||||
- MF();
|
|
||||||
+ if (!__noio) {
|
|
||||||
+ *addr = val;
|
|
||||||
+ MF();
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void outl (unsigned int val, unsigned long port)
|
|
||||||
{
|
|
||||||
volatile unsigned int *addr = io_addr(port);
|
|
||||||
|
|
||||||
- *addr = val;
|
|
||||||
- MF();
|
|
||||||
+ if (!__noio) {
|
|
||||||
+ *addr = val;
|
|
||||||
+ MF();
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
-
|
|
||||||
static inline unsigned char readb(const volatile void *addr)
|
|
||||||
{
|
|
||||||
- return *(volatile unsigned char *) addr;
|
|
||||||
+ return __noio ? 0 :*(volatile unsigned char *) addr;
|
|
||||||
}
|
|
||||||
static inline unsigned short readw(const volatile void *addr)
|
|
||||||
{
|
|
||||||
- return *(volatile unsigned short *) addr;
|
|
||||||
+ return __noio ? 0 :*(volatile unsigned short *) addr;
|
|
||||||
}
|
|
||||||
static inline unsigned int readl(const volatile void *addr)
|
|
||||||
{
|
|
||||||
- return *(volatile unsigned int *) addr;
|
|
||||||
+ return __noio ? 0 :*(volatile unsigned int *) addr;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void writeb(unsigned char b, volatile void *addr)
|
|
||||||
{
|
|
||||||
- *(volatile unsigned char *) addr = b;
|
|
||||||
+ if (!__noio)
|
|
||||||
+ *(volatile unsigned char *) addr = b;
|
|
||||||
}
|
|
||||||
static inline void writew(unsigned short b, volatile void *addr)
|
|
||||||
{
|
|
||||||
- *(volatile unsigned short *) addr = b;
|
|
||||||
+ if (!__noio)
|
|
||||||
+ *(volatile unsigned short *) addr = b;
|
|
||||||
}
|
|
||||||
static inline void writel(unsigned int b, volatile void *addr)
|
|
||||||
{
|
|
||||||
- *(volatile unsigned int *) addr = b;
|
|
||||||
+ if (!__noio)
|
|
||||||
+ *(volatile unsigned int *) addr = b;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
|||||||
--- kexec-tools-1.101/kexec/arch/ia64/crashdump-ia64.c.orig 2006-11-14 13:38:45.000000000 -0500
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/ia64/crashdump-ia64.c 2006-11-14 14:52:34.000000000 -0500
|
|
||||||
@@ -316,10 +316,14 @@
|
|
||||||
int nr_ranges;
|
|
||||||
size_t size;
|
|
||||||
void *tmp;
|
|
||||||
+ long int nr_cpus;
|
|
||||||
+ if ((nr_cpus = sysconf(_SC_NPROCESSORS_CONF)) < 0)
|
|
||||||
+ return -1;
|
|
||||||
if (info->kexec_flags & KEXEC_ON_CRASH ) {
|
|
||||||
if (get_crash_memory_ranges(&mem_range, &nr_ranges) == 0) {
|
|
||||||
- size = sizeof(Elf64_Ehdr) +
|
|
||||||
- (nr_ranges + 1) * sizeof(Elf64_Phdr);
|
|
||||||
+ size = (sizeof(Elf64_Ehdr) +
|
|
||||||
+ ((nr_cpus +1) * sizeof(Elf64_Phdr)) +
|
|
||||||
+ ((nr_ranges + 1) * sizeof(Elf64_Phdr)));
|
|
||||||
size = (size + EFI_PAGE_SIZE - 1) & ~(EFI_PAGE_SIZE - 1);
|
|
||||||
tmp = xmalloc(size);
|
|
||||||
memset(tmp, 0, size);
|
|
@ -1,808 +0,0 @@
|
|||||||
--- kexec-tools-1.101/Makefile.orig 2006-10-20 13:38:53.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/Makefile 2006-10-20 13:39:08.000000000 -0400
|
|
||||||
@@ -43,6 +43,7 @@
|
|
||||||
PKGINCLUDEIR=$(INCLUDEDIR)/$(PACKAGE)
|
|
||||||
|
|
||||||
MAN_PAGES:= kexec/kexec.8
|
|
||||||
+MAN_PAGES+= kdump/kdump.8
|
|
||||||
BINARIES_i386:= $(SBINDIR)/kexec $(PKGLIBDIR)/kexec_test $(SBINDIR)/kdump
|
|
||||||
BINARIES_x86_64:=$(SBINDIR)/kexec $(PKGLIBDIR)/kexec_test
|
|
||||||
BINARIES:=$(SBINDIR)/kexec $(BINARIES_$(ARCH))
|
|
||||||
--- /dev/null 2006-10-19 09:27:39.770809345 -0400
|
|
||||||
+++ kexec-tools-1.101/kdump/kdump.8 2006-10-20 13:39:08.000000000 -0400
|
|
||||||
@@ -0,0 +1,39 @@
|
|
||||||
+.\" Hey, EMACS: -*- nroff -*-
|
|
||||||
+.\" First parameter, NAME, should be all caps
|
|
||||||
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
|
||||||
+.\" other parameters are allowed: see man(7), man(1)
|
|
||||||
+.TH KDUMP 8 "Jul 27, 2005"
|
|
||||||
+.\" Please adjust this date whenever revising the manpage.
|
|
||||||
+.\"
|
|
||||||
+.\" Some roff macros, for reference:
|
|
||||||
+.\" .nh disable hyphenation
|
|
||||||
+.\" .hy enable hyphenation
|
|
||||||
+.\" .ad l left justify
|
|
||||||
+.\" .ad b justify to both left and right margins
|
|
||||||
+.\" .nf disable filling
|
|
||||||
+.\" .fi enable filling
|
|
||||||
+.\" .br insert line break
|
|
||||||
+.\" .sp <n> insert n+1 empty lines
|
|
||||||
+.\" for manpage-specific macros, see man(7)
|
|
||||||
+.SH NAME
|
|
||||||
+kdump \- This is just a placeholder until real man page has been written
|
|
||||||
+.SH SYNOPSIS
|
|
||||||
+.B kdump
|
|
||||||
+.RI [ options ] " start_address" ...
|
|
||||||
+.SH DESCRIPTION
|
|
||||||
+.PP
|
|
||||||
+.\" TeX users may be more comfortable with the \fB<whatever>\fP and
|
|
||||||
+.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
|
|
||||||
+.\" respectively.
|
|
||||||
+\fBkdump\fP does not have a man page yet.
|
|
||||||
+.SH OPTIONS
|
|
||||||
+.\"These programs follow the usual GNU command line syntax, with long
|
|
||||||
+.\"options starting with two dashes (`-').
|
|
||||||
+.\"A summary of options is included below.
|
|
||||||
+.\"For a complete description, see the Info files.
|
|
||||||
+.SH SEE ALSO
|
|
||||||
+.SH AUTHOR
|
|
||||||
+kdump was written by Eric Biederman.
|
|
||||||
+.PP
|
|
||||||
+This manual page was written by Khalid Aziz <khalid.aziz@hp.com>,
|
|
||||||
+for the Debian project (but may be used by others).
|
|
||||||
--- kexec-tools-1.101/purgatory/arch/ia64/Makefile.orig 2004-12-20 17:44:22.000000000 -0500
|
|
||||||
+++ kexec-tools-1.101/purgatory/arch/ia64/Makefile 2006-10-20 13:39:08.000000000 -0400
|
|
||||||
@@ -1,8 +1,8 @@
|
|
||||||
#
|
|
||||||
# Purgatory ia64
|
|
||||||
#
|
|
||||||
-
|
|
||||||
-PURGATORY_S_SRCS+=
|
|
||||||
+PCFLAGS += -ffixed-r28
|
|
||||||
+PURGATORY_S_SRCS+= purgatory/arch/ia64/entry.S
|
|
||||||
PURGATORY_C_SRCS+= purgatory/arch/ia64/purgatory-ia64.c
|
|
||||||
PURGATORY_C_SRCS+= purgatory/arch/ia64/console-ia64.c
|
|
||||||
PURGATORY_C_SRCS+=
|
|
||||||
--- /dev/null 2006-10-19 09:27:39.770809345 -0400
|
|
||||||
+++ kexec-tools-1.101/purgatory/arch/ia64/include/arch/io.h 2006-10-20 13:39:08.000000000 -0400
|
|
||||||
@@ -0,0 +1,25 @@
|
|
||||||
+#ifndef ARCH_IO_H
|
|
||||||
+#define ARCH_IO_H
|
|
||||||
+
|
|
||||||
+#include <stdint.h>
|
|
||||||
+/* Helper functions for directly doing I/O */
|
|
||||||
+
|
|
||||||
+extern inline uint8_t inb(void *port)
|
|
||||||
+{
|
|
||||||
+ volatile unsigned char *addr = (unsigned char *)port;
|
|
||||||
+ uint8_t result;
|
|
||||||
+
|
|
||||||
+ result = *addr;
|
|
||||||
+ asm volatile ("mf.a"::: "memory");
|
|
||||||
+ return result;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+extern inline void outb (uint8_t value, void *port)
|
|
||||||
+{
|
|
||||||
+ volatile unsigned char *addr = (unsigned char *)port;
|
|
||||||
+
|
|
||||||
+ *addr = value;
|
|
||||||
+ asm volatile ("mf.a"::: "memory");
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+#endif /* ARCH_IO_H */
|
|
||||||
--- /dev/null 2006-10-19 09:27:39.770809345 -0400
|
|
||||||
+++ kexec-tools-1.101/purgatory/arch/ia64/entry.S 2006-10-20 13:39:08.000000000 -0400
|
|
||||||
@@ -0,0 +1,85 @@
|
|
||||||
+/*
|
|
||||||
+ * purgatory: setup code
|
|
||||||
+ *
|
|
||||||
+ * Copyright (C) 2005 Zou Nan hai (nanhai.zou@intel.com)
|
|
||||||
+ *
|
|
||||||
+ * This program is free software; you can redistribute it and/or modify
|
|
||||||
+ * it under the terms of the GNU General Public License as published by
|
|
||||||
+ * the Free Software Foundation (version 2 of the License).
|
|
||||||
+ *
|
|
||||||
+ * This program is distributed in the hope that it will be useful,
|
|
||||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
+ * GNU General Public License for more details.
|
|
||||||
+ *
|
|
||||||
+ * You should have received a copy of the GNU General Public License
|
|
||||||
+ * along with this program; if not, write to the Free Software
|
|
||||||
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+.global __dummy_efi_function
|
|
||||||
+.align 32
|
|
||||||
+.proc __dummy_efi_function
|
|
||||||
+__dummy_efi_function:
|
|
||||||
+ mov r8=r0;;
|
|
||||||
+ br.ret.sptk.many rp;;
|
|
||||||
+.global __dummy_efi_function_end
|
|
||||||
+__dummy_efi_function_end:
|
|
||||||
+.endp __dummy_efi_function
|
|
||||||
+
|
|
||||||
+.global purgatory_start
|
|
||||||
+.align 32
|
|
||||||
+.proc purgatory_start
|
|
||||||
+purgatory_start:
|
|
||||||
+ movl r2=__gp_value;;
|
|
||||||
+ ld8 gp=[r2];;
|
|
||||||
+ br.call.sptk.many b0=purgatory
|
|
||||||
+ ;;
|
|
||||||
+ alloc r2 = ar.pfs, 0, 0, 5, 0
|
|
||||||
+ ;;
|
|
||||||
+ mov out0=r28
|
|
||||||
+
|
|
||||||
+ movl r2=__command_line;;
|
|
||||||
+ ld8 out1=[r2];;
|
|
||||||
+ movl r2=__command_line_len;;
|
|
||||||
+ ld8 out2=[r2];;
|
|
||||||
+ movl r2=__ramdisk_base;;
|
|
||||||
+ ld8 out3=[r2];;
|
|
||||||
+ movl r2=__ramdisk_size;;
|
|
||||||
+ ld8 out4=[r2];;
|
|
||||||
+ br.call.sptk.many b0=ia64_env_setup
|
|
||||||
+ movl r10=__kernel_entry;;
|
|
||||||
+ ld8 r14=[r10];;
|
|
||||||
+ mov b6=r14;;
|
|
||||||
+ mov ar.lc=r0
|
|
||||||
+ mov ar.ec=r0
|
|
||||||
+ cover;;
|
|
||||||
+ invala;;
|
|
||||||
+ br.call.sptk.many b0=b6
|
|
||||||
+.endp purgatory_start
|
|
||||||
+
|
|
||||||
+.align 32
|
|
||||||
+.global __kernel_entry
|
|
||||||
+.size __kernel_entry, 8
|
|
||||||
+__kernel_entry:
|
|
||||||
+ data8 0x0
|
|
||||||
+.global __command_line
|
|
||||||
+.size __command_line, 8
|
|
||||||
+__command_line:
|
|
||||||
+ data8 0x0
|
|
||||||
+.global __command_line_len
|
|
||||||
+.size __command_line_len, 8
|
|
||||||
+__command_line_len:
|
|
||||||
+ data8 0x0
|
|
||||||
+.global __ramdisk_base
|
|
||||||
+.size __ramdisk_base, 8
|
|
||||||
+__ramdisk_base:
|
|
||||||
+ data8 0x0
|
|
||||||
+.global __ramdisk_size
|
|
||||||
+.size __ramdisk_size, 8
|
|
||||||
+__ramdisk_size:
|
|
||||||
+ data8 0x0
|
|
||||||
+.global __gp_value
|
|
||||||
+.size __gp_value, 8
|
|
||||||
+__gp_value:
|
|
||||||
+ data8 0x0
|
|
||||||
--- kexec-tools-1.101/purgatory/arch/ia64/purgatory-ia64.c.orig 2006-10-20 13:38:53.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/purgatory/arch/ia64/purgatory-ia64.c 2006-10-20 13:39:08.000000000 -0400
|
|
||||||
@@ -1,10 +1,116 @@
|
|
||||||
#include <purgatory.h>
|
|
||||||
+#include <stdint.h>
|
|
||||||
+#include <string.h>
|
|
||||||
#include "purgatory-ia64.h"
|
|
||||||
|
|
||||||
+#define PAGE_OFFSET 0xe000000000000000
|
|
||||||
+
|
|
||||||
+typedef struct {
|
|
||||||
+ uint64_t signature;
|
|
||||||
+ uint32_t revision;
|
|
||||||
+ uint32_t headersize;
|
|
||||||
+ uint32_t crc32;
|
|
||||||
+ uint32_t reserved;
|
|
||||||
+} efi_table_hdr_t;
|
|
||||||
+
|
|
||||||
+typedef struct {
|
|
||||||
+ efi_table_hdr_t hdr;
|
|
||||||
+ unsigned long get_time;
|
|
||||||
+ unsigned long set_time;
|
|
||||||
+ unsigned long get_wakeup_time;
|
|
||||||
+ unsigned long set_wakeup_time;
|
|
||||||
+ unsigned long set_virtual_address_map;
|
|
||||||
+ unsigned long convert_pointer;
|
|
||||||
+ unsigned long get_variable;
|
|
||||||
+ unsigned long get_next_variable;
|
|
||||||
+ unsigned long set_variable;
|
|
||||||
+ unsigned long get_next_high_mono_count;
|
|
||||||
+ unsigned long reset_system;
|
|
||||||
+} efi_runtime_services_t;
|
|
||||||
+
|
|
||||||
+typedef struct {
|
|
||||||
+ efi_table_hdr_t hdr;
|
|
||||||
+ unsigned long fw_vendor; /* physical addr of CHAR16 vendor string
|
|
||||||
+ */
|
|
||||||
+ uint32_t fw_revision;
|
|
||||||
+ unsigned long con_in_handle;
|
|
||||||
+ unsigned long con_in;
|
|
||||||
+ unsigned long con_out_handle;
|
|
||||||
+ unsigned long con_out;
|
|
||||||
+ unsigned long stderr_handle;
|
|
||||||
+ unsigned long stderr;
|
|
||||||
+ unsigned long runtime;
|
|
||||||
+ unsigned long boottime;
|
|
||||||
+ unsigned long nr_tables;
|
|
||||||
+ unsigned long tables;
|
|
||||||
+} efi_system_table_t;
|
|
||||||
+
|
|
||||||
+struct ia64_boot_param {
|
|
||||||
+ uint64_t command_line; /* physical address of command line arguments */
|
|
||||||
+ uint64_t efi_systab; /* physical address of EFI system table */
|
|
||||||
+ uint64_t efi_memmap; /* physical address of EFI memory map */
|
|
||||||
+ uint64_t efi_memmap_size; /* size of EFI memory map */
|
|
||||||
+ uint64_t efi_memdesc_size; /* size of an EFI memory map descriptor */
|
|
||||||
+ uint32_t efi_memdesc_version; /* memory descriptor version */
|
|
||||||
+ struct {
|
|
||||||
+ uint16_t num_cols; /* number of columns on console output device */
|
|
||||||
+ uint16_t num_rows; /* number of rows on console output device */
|
|
||||||
+ uint16_t orig_x; /* cursor's x position */
|
|
||||||
+ uint16_t orig_y; /* cursor's y position */
|
|
||||||
+ } console_info;
|
|
||||||
+ uint64_t fpswa; /* physical address of the fpswa interface */
|
|
||||||
+ uint64_t initrd_start;
|
|
||||||
+ uint64_t initrd_size;
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
void setup_arch(void)
|
|
||||||
{
|
|
||||||
/* Nothing for now */
|
|
||||||
}
|
|
||||||
+inline unsigned long PA(unsigned long addr)
|
|
||||||
+{
|
|
||||||
+ return addr - PAGE_OFFSET;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void flush_icache_range(char *start, unsigned long len)
|
|
||||||
+{
|
|
||||||
+ unsigned long i;
|
|
||||||
+ for (i = 0;i < len; i += 32)
|
|
||||||
+ asm volatile("fc.i %0"::"r"(start+i):"memory");
|
|
||||||
+ asm volatile (";;sync.i;;":::"memory");
|
|
||||||
+ asm volatile ("srlz.i":::"memory");
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+extern char __dummy_efi_function[], __dummy_efi_function_end[];
|
|
||||||
+
|
|
||||||
+void ia64_env_setup(struct ia64_boot_param *boot_param,
|
|
||||||
+ uint64_t command_line, uint64_t command_line_len,
|
|
||||||
+ uint64_t ramdisk_base, uint64_t ramdisk_size)
|
|
||||||
+{
|
|
||||||
+ unsigned long len;
|
|
||||||
+ efi_system_table_t *systab;
|
|
||||||
+ efi_runtime_services_t *runtime;
|
|
||||||
+ unsigned long *set_virtual_address_map;
|
|
||||||
+
|
|
||||||
+ // patch efi_runtime->set_virtual_address_map to a
|
|
||||||
+ // dummy function
|
|
||||||
+ len = __dummy_efi_function_end - __dummy_efi_function;
|
|
||||||
+ memcpy((char *)command_line + command_line_len, __dummy_efi_function,
|
|
||||||
+ len);
|
|
||||||
+ systab = (efi_system_table_t *)boot_param->efi_systab;
|
|
||||||
+ runtime = (efi_runtime_services_t *)PA(systab->runtime);
|
|
||||||
+ set_virtual_address_map =
|
|
||||||
+ (unsigned long *)PA(runtime->set_virtual_address_map);
|
|
||||||
+ *(set_virtual_address_map)=
|
|
||||||
+ (unsigned long)((char *)command_line + command_line_len);
|
|
||||||
+ flush_icache_range((char *)command_line+command_line_len, len);
|
|
||||||
+
|
|
||||||
+ boot_param->command_line = command_line;
|
|
||||||
+ boot_param->console_info.orig_x = 0;
|
|
||||||
+ boot_param->console_info.orig_y = 0;
|
|
||||||
+ boot_param->initrd_start = ramdisk_base;
|
|
||||||
+ boot_param->initrd_size = ramdisk_size;
|
|
||||||
+}
|
|
||||||
|
|
||||||
/* This function can be used to execute after the SHA256 verification. */
|
|
||||||
void post_verification_setup_arch(void)
|
|
||||||
--- kexec-tools-1.101/kexec/Makefile.orig 2006-10-20 13:38:53.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/kexec/Makefile 2006-10-20 13:39:08.000000000 -0400
|
|
||||||
@@ -28,6 +28,7 @@
|
|
||||||
KEXEC_OBJS:= $(KEXEC_C_OBJS) $(KEXEC_S_OBJS)
|
|
||||||
KEXEC_DEPS:= $(KEXEC_C_DEPS) $(KEXEC_S_DEPS)
|
|
||||||
KEXEC:= $(SBINDIR)/kexec
|
|
||||||
+KEXEC_MANPAGE:= $(MANDIR)/man8/kexec.8
|
|
||||||
|
|
||||||
include $(KEXEC_DEPS)
|
|
||||||
|
|
||||||
@@ -51,6 +52,9 @@
|
|
||||||
mkdir -p $(@D)
|
|
||||||
$(CC) $(KCFLAGS) -o $@ $(KEXEC_OBJS) $(UTIL_LIB) $(LIBS)
|
|
||||||
|
|
||||||
+$(KEXEC_MANPAGE): kexec/kexec.8
|
|
||||||
+ $(MKDIR) -p $(MANDIR)/man8
|
|
||||||
+ cp kexec/kexec.8 $(KEXEC_MANPAGE)
|
|
||||||
echo::
|
|
||||||
@echo "KEXEC_C_SRCS $(KEXEC_C_SRCS)"
|
|
||||||
@echo "KEXEC_C_DEPS $(KEXEC_C_DEPS)"
|
|
||||||
--- kexec-tools-1.101/kexec/arch/ia64/kexec-ia64.h.orig 2004-12-19 18:52:38.000000000 -0500
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/ia64/kexec-ia64.h 2006-10-20 13:39:08.000000000 -0400
|
|
||||||
@@ -1,6 +1,8 @@
|
|
||||||
#ifndef KEXEC_IA64_H
|
|
||||||
#define KEXEC_IA64_H
|
|
||||||
|
|
||||||
+#define MAX_MEMORY_RANGES 1024
|
|
||||||
+
|
|
||||||
int elf_ia64_probe(const char *buf, off_t len);
|
|
||||||
int elf_ia64_load(int argc, char **argv, const char *buf, off_t len,
|
|
||||||
struct kexec_info *info);
|
|
||||||
--- kexec-tools-1.101/kexec/arch/ia64/kexec-elf-rel-ia64.c.orig 2004-12-20 17:43:23.000000000 -0500
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/ia64/kexec-elf-rel-ia64.c 2006-10-20 13:39:08.000000000 -0400
|
|
||||||
@@ -1,8 +1,14 @@
|
|
||||||
+/* Most of the code in this file is
|
|
||||||
+ * based on arch/ia64/kernel/module.c in Linux kernel
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <elf.h>
|
|
||||||
#include "../../kexec.h"
|
|
||||||
#include "../../kexec-elf.h"
|
|
||||||
|
|
||||||
+#define MAX_LTOFF ((uint64_t) (1 << 22))
|
|
||||||
+
|
|
||||||
int machine_verify_elf_rel(struct mem_ehdr *ehdr)
|
|
||||||
{
|
|
||||||
if (ehdr->ei_data != ELFDATA2LSB) {
|
|
||||||
@@ -17,12 +23,40 @@
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
+static void
|
|
||||||
+ia64_patch (uint64_t insn_addr, uint64_t mask, uint64_t val)
|
|
||||||
+{
|
|
||||||
+ uint64_t m0, m1, v0, v1, b0, b1, *b = (uint64_t *) (insn_addr & -16);
|
|
||||||
+# define insn_mask ((1UL << 41) - 1)
|
|
||||||
+ unsigned long shift;
|
|
||||||
+
|
|
||||||
+ b0 = b[0]; b1 = b[1];
|
|
||||||
+ shift = 5 + 41 * (insn_addr % 16); /* 5 bits of template, then 3 x 41-bit instructions */
|
|
||||||
+ if (shift >= 64) {
|
|
||||||
+ m1 = mask << (shift - 64);
|
|
||||||
+ v1 = val << (shift - 64);
|
|
||||||
+ } else {
|
|
||||||
+ m0 = mask << shift; m1 = mask >> (64 - shift);
|
|
||||||
+ v0 = val << shift; v1 = val >> (64 - shift);
|
|
||||||
+ b[0] = (b0 & ~m0) | (v0 & m0);
|
|
||||||
+ }
|
|
||||||
+ b[1] = (b1 & ~m1) | (v1 & m1);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static inline uint64_t
|
|
||||||
+bundle (const uint64_t insn)
|
|
||||||
+{
|
|
||||||
+ return insn & ~0xfUL;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
void machine_apply_elf_rel(struct mem_ehdr *ehdr, unsigned long r_type,
|
|
||||||
void *location, unsigned long address, unsigned long value)
|
|
||||||
{
|
|
||||||
+ uint64_t gp_value = ehdr->rel_addr + 0x200000;
|
|
||||||
switch(r_type) {
|
|
||||||
case R_IA64_NONE:
|
|
||||||
break;
|
|
||||||
+ case R_IA64_SEGREL64LSB:
|
|
||||||
case R_IA64_DIR64LSB:
|
|
||||||
*((uint64_t *)location) = value;
|
|
||||||
break;
|
|
||||||
@@ -31,15 +65,67 @@
|
|
||||||
if (value != *((uint32_t *)location))
|
|
||||||
goto overflow;
|
|
||||||
break;
|
|
||||||
- case R_IA64_PCREL21B:
|
|
||||||
+ case R_IA64_IMM64:
|
|
||||||
+ ia64_patch((uint64_t)location, 0x01fffefe000UL,
|
|
||||||
+ /* bit 63 -> 36 */
|
|
||||||
+ (((value & 0x8000000000000000UL) >> 27)
|
|
||||||
+ /* bit 21 -> 21 */
|
|
||||||
+ | ((value & 0x0000000000200000UL) << 0)
|
|
||||||
+ /* bit 16 -> 22 */
|
|
||||||
+ | ((value & 0x00000000001f0000UL) << 6)
|
|
||||||
+ /* bit 7 -> 27 */
|
|
||||||
+ | ((value & 0x000000000000ff80UL) << 20)
|
|
||||||
+ /* bit 0 -> 13 */
|
|
||||||
+ | ((value & 0x000000000000007fUL) << 13)));
|
|
||||||
+ ia64_patch((uint64_t)location - 1, 0x1ffffffffffUL, value>>22);
|
|
||||||
+ break;
|
|
||||||
+ case R_IA64_IMM22:
|
|
||||||
+ if (value + (1 << 21) >= (1 << 22))
|
|
||||||
+ die("value out of IMM22 range\n");
|
|
||||||
+ ia64_patch((uint64_t)location, 0x01fffcfe000UL,
|
|
||||||
+ /* bit 21 -> 36 */
|
|
||||||
+ (((value & 0x200000UL) << 15)
|
|
||||||
+ /* bit 16 -> 22 */
|
|
||||||
+ | ((value & 0x1f0000UL) << 6)
|
|
||||||
+ /* bit 7 -> 27 */
|
|
||||||
+ | ((value & 0x00ff80UL) << 20)
|
|
||||||
+ /* bit 0 -> 13 */
|
|
||||||
+ | ((value & 0x00007fUL) << 13) ));
|
|
||||||
+ break;
|
|
||||||
+ case R_IA64_PCREL21B: {
|
|
||||||
+ uint64_t delta = ((int64_t)value - (int64_t)address)/16;
|
|
||||||
+ if (delta + (1 << 20) >= (1 << 21))
|
|
||||||
+ die("value out of IMM21B range\n");
|
|
||||||
+ value = ((int64_t)(value - bundle(address)))/16;
|
|
||||||
+ ia64_patch((uint64_t)location, 0x11ffffe000UL,
|
|
||||||
+ (((value & 0x100000UL) << 16) /* bit 20 -> 36 */
|
|
||||||
+ | ((value & 0x0fffffUL) << 13) /* bit 0 -> 13 */));
|
|
||||||
+ }
|
|
||||||
+ break;
|
|
||||||
+ case R_IA64_LTOFF22X:
|
|
||||||
+ if (value - gp_value + MAX_LTOFF/2 >= MAX_LTOFF)
|
|
||||||
+ die("value out of gp relative range");
|
|
||||||
+ value -= gp_value;
|
|
||||||
+ ia64_patch((uint64_t)location, 0x01fffcfe000UL,
|
|
||||||
+ (((value & 0x200000UL) << 15) /* bit 21 -> 36 */
|
|
||||||
+ |((value & 0x1f0000UL) << 6) /* bit 16 -> 22 */
|
|
||||||
+ |((value & 0x00ff80UL) << 20) /* bit 7 -> 27 */
|
|
||||||
+ |((value & 0x00007fUL) << 13) /* bit 0 -> 13 */));
|
|
||||||
+ break;
|
|
||||||
+ case R_IA64_LDXMOV:
|
|
||||||
+ if (value - gp_value + MAX_LTOFF/2 >= MAX_LTOFF)
|
|
||||||
+ die("value out of gp relative range");
|
|
||||||
+ ia64_patch((uint64_t)location, 0x1fff80fe000UL, 0x10000000000UL);
|
|
||||||
+ break;
|
|
||||||
case R_IA64_LTOFF22:
|
|
||||||
- case R_IA64_SEGREL64LSB:
|
|
||||||
+
|
|
||||||
default:
|
|
||||||
- die("Unknown rela relocation: %lu\n", r_type);
|
|
||||||
+ die("Unknown rela relocation: 0x%lx 0x%lx\n",
|
|
||||||
+ r_type, address);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
- overflow:
|
|
||||||
+overflow:
|
|
||||||
die("overflow in relocation type %lu val %Lx\n",
|
|
||||||
- r_type, value);
|
|
||||||
+ r_type, value);
|
|
||||||
}
|
|
||||||
--- kexec-tools-1.101/kexec/arch/ia64/kexec-elf-ia64.c.orig 2004-12-21 15:01:37.000000000 -0500
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/ia64/kexec-elf-ia64.c 2006-10-20 13:39:08.000000000 -0400
|
|
||||||
@@ -6,6 +6,7 @@
|
|
||||||
* Copyright (C) 2004 Silicon Graphics, Inc.
|
|
||||||
* Jesse Barnes <jbarnes@sgi.com>
|
|
||||||
* Copyright (C) 2004 Khalid Aziz <khalid.aziz@hp.com> Hewlett Packard Co
|
|
||||||
+ * Copyright (C) 2005 Zou Nan hai <nanhai.zou@intel.com> Intel Corp
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
@@ -34,6 +35,7 @@
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <getopt.h>
|
|
||||||
+#include <limits.h>
|
|
||||||
#include <elf.h>
|
|
||||||
#include <boot/elf_boot.h>
|
|
||||||
#include <ip_checksum.h>
|
|
||||||
@@ -74,23 +76,29 @@
|
|
||||||
{
|
|
||||||
printf(
|
|
||||||
" --command-line=STRING Set the kernel command line to STRING.\n"
|
|
||||||
- " --append=STRING Set the kernel command line to STRING.\n");
|
|
||||||
+ " --append=STRING Set the kernel command line to STRING.\n"
|
|
||||||
+ " --initrd=FILE Use FILE as the kernel's initial ramdisk.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
int elf_ia64_load(int argc, char **argv, const char *buf, off_t len,
|
|
||||||
struct kexec_info *info)
|
|
||||||
{
|
|
||||||
struct mem_ehdr ehdr;
|
|
||||||
- const char *command_line;
|
|
||||||
- int command_line_len;
|
|
||||||
- unsigned long entry, max_addr;
|
|
||||||
+ const char *command_line, *ramdisk=0;
|
|
||||||
+ char *ramdisk_buf = NULL;
|
|
||||||
+ off_t ramdisk_size = 0;
|
|
||||||
+ unsigned long command_line_len;
|
|
||||||
+ unsigned long entry, max_addr, gp_value;
|
|
||||||
+ unsigned command_line_base, ramdisk_base;
|
|
||||||
int result;
|
|
||||||
int opt;
|
|
||||||
#define OPT_APPEND (OPT_ARCH_MAX+0)
|
|
||||||
+#define OPT_RAMDISK (OPT_ARCH_MAX+1)
|
|
||||||
static const struct option options[] = {
|
|
||||||
KEXEC_ARCH_OPTIONS
|
|
||||||
{"command-line", 1, 0, OPT_APPEND},
|
|
||||||
{"append", 1, 0, OPT_APPEND},
|
|
||||||
+ {"initrd", 1, 0, OPT_RAMDISK},
|
|
||||||
{0, 0, 0, 0},
|
|
||||||
};
|
|
||||||
|
|
||||||
@@ -110,11 +118,14 @@
|
|
||||||
case OPT_APPEND:
|
|
||||||
command_line = optarg;
|
|
||||||
break;
|
|
||||||
+ case OPT_RAMDISK:
|
|
||||||
+ ramdisk = optarg;
|
|
||||||
+ break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
command_line_len = 0;
|
|
||||||
if (command_line) {
|
|
||||||
- command_line_len = strlen(command_line) + 1;
|
|
||||||
+ command_line_len = strlen(command_line) + 16;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Parse the Elf file */
|
|
||||||
@@ -129,13 +140,46 @@
|
|
||||||
|
|
||||||
/* Load the Elf data */
|
|
||||||
result = elf_exec_load(&ehdr, info);
|
|
||||||
- free_elf_info(&ehdr);
|
|
||||||
if (result < 0) {
|
|
||||||
fprintf(stderr, "ELF load failed\n");
|
|
||||||
+ free_elf_info(&ehdr);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+ /* Load the setup code */
|
|
||||||
+ elf_rel_build_load(info, &info->rhdr, purgatory, purgatory_size,
|
|
||||||
+ 0x80000, ULONG_MAX, 1);
|
|
||||||
+
|
|
||||||
+ if (command_line_len) {
|
|
||||||
+ char *cmdline = xmalloc(command_line_len);
|
|
||||||
+ strcpy(cmdline, command_line);
|
|
||||||
+ command_line_len = (command_line_len + 15)&(~15);
|
|
||||||
+ elf_rel_set_symbol(&info->rhdr, "__command_line_len",
|
|
||||||
+ &command_line_len, sizeof(long));
|
|
||||||
+ command_line_base = add_buffer(info, cmdline,
|
|
||||||
+ command_line_len, command_line_len,
|
|
||||||
+ 16, 0, max_addr, 1);
|
|
||||||
+ elf_rel_set_symbol(&info->rhdr, "__command_line",
|
|
||||||
+ &command_line_base, sizeof(long));
|
|
||||||
+ }
|
|
||||||
|
|
||||||
- /* For now we don't have arguments to pass :( */
|
|
||||||
- info->entry = (void *)entry;
|
|
||||||
+ if (ramdisk) {
|
|
||||||
+ ramdisk_buf = slurp_file(ramdisk, &ramdisk_size);
|
|
||||||
+ ramdisk_base = add_buffer(info, ramdisk_buf, ramdisk_size,
|
|
||||||
+ ramdisk_size,
|
|
||||||
+ getpagesize(), 0, max_addr, 1);
|
|
||||||
+ elf_rel_set_symbol(&info->rhdr, "__ramdisk_base",
|
|
||||||
+ &ramdisk_base, sizeof(long));
|
|
||||||
+ elf_rel_set_symbol(&info->rhdr, "__ramdisk_size",
|
|
||||||
+ &ramdisk_size, sizeof(long));
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ gp_value = info->rhdr.rel_addr + 0x200000;
|
|
||||||
+ elf_rel_set_symbol(&info->rhdr, "__gp_value", &gp_value,
|
|
||||||
+ sizeof(gp_value));
|
|
||||||
+
|
|
||||||
+ elf_rel_set_symbol(&info->rhdr, "__kernel_entry", &entry, sizeof(entry));
|
|
||||||
+ free_elf_info(&ehdr);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
--- kexec-tools-1.101/kexec/arch/ia64/kexec-ia64.c.orig 2006-10-20 13:38:53.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/ia64/kexec-ia64.c 2006-10-20 13:39:08.000000000 -0400
|
|
||||||
@@ -27,42 +27,87 @@
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <getopt.h>
|
|
||||||
+#include <sched.h>
|
|
||||||
#include <sys/utsname.h>
|
|
||||||
#include "../../kexec.h"
|
|
||||||
#include "../../kexec-syscall.h"
|
|
||||||
#include "kexec-ia64.h"
|
|
||||||
#include <arch/options.h>
|
|
||||||
|
|
||||||
-#define MAX_MEMORY_RANGES 64
|
|
||||||
static struct memory_range memory_range[MAX_MEMORY_RANGES];
|
|
||||||
|
|
||||||
/* Return a sorted list of available memory ranges. */
|
|
||||||
int get_memory_ranges(struct memory_range **range, int *ranges,
|
|
||||||
unsigned long kexec_flags)
|
|
||||||
{
|
|
||||||
- int memory_ranges;
|
|
||||||
- /*
|
|
||||||
- * /proc/iomem on ia64 does not show where all memory is. If
|
|
||||||
- * that is fixed up, we can make use of that to validate
|
|
||||||
- * the memory range kernel will be loade din. Until then.....
|
|
||||||
- * -- Khalid Aziz
|
|
||||||
- */
|
|
||||||
-
|
|
||||||
- /* Note that the ia64 architecture mandates all systems will
|
|
||||||
- * have at least 64MB at 0-64M. The SGI altix does not follow
|
|
||||||
- * that restriction, but a reasonable guess is better than nothing
|
|
||||||
- * at all.
|
|
||||||
- * -- Eric Biederman
|
|
||||||
- */
|
|
||||||
- fprintf(stderr, "Warning assuming memory at 0-64MB is present\n");
|
|
||||||
- memory_ranges = 0;
|
|
||||||
- memory_range[memory_ranges].start = 0x00010000;
|
|
||||||
- memory_range[memory_ranges].end = 0x10000000;
|
|
||||||
- memory_range[memory_ranges].type = RANGE_RAM;
|
|
||||||
- memory_ranges++;
|
|
||||||
- *range = memory_range;
|
|
||||||
- *ranges = memory_ranges;
|
|
||||||
- return 0;
|
|
||||||
+ const char iomem[]= "/proc/iomem";
|
|
||||||
+ int memory_ranges = 0;
|
|
||||||
+ char line[MAX_LINE];
|
|
||||||
+ FILE *fp;
|
|
||||||
+ fp = fopen(iomem, "r");
|
|
||||||
+ if (!fp) {
|
|
||||||
+ fprintf(stderr, "Cannot open %s: %s\n",
|
|
||||||
+ iomem, strerror(errno));
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ while(fgets(line, sizeof(line), fp) != 0) {
|
|
||||||
+ unsigned long start, end;
|
|
||||||
+ char *str;
|
|
||||||
+ int type;
|
|
||||||
+ int consumed;
|
|
||||||
+ int count;
|
|
||||||
+ if (memory_ranges >= MAX_MEMORY_RANGES)
|
|
||||||
+ break;
|
|
||||||
+ count = sscanf(line, "%lx-%lx : %n",
|
|
||||||
+ &start, &end, &consumed);
|
|
||||||
+ if (count != 2)
|
|
||||||
+ continue;
|
|
||||||
+ str = line + consumed;
|
|
||||||
+ end = end + 1;
|
|
||||||
+ if (memcmp(str, "System RAM\n", 11) == 0) {
|
|
||||||
+ type = RANGE_RAM;
|
|
||||||
+ }
|
|
||||||
+ else if (memcmp(str, "reserved\n", 9) == 0) {
|
|
||||||
+ type = RANGE_RESERVED;
|
|
||||||
+ }
|
|
||||||
+ else if (memcmp(str, "Crash kernel\n", 13) == 0) {
|
|
||||||
+ /* Redefine the memory region boundaries if kernel
|
|
||||||
+ * exports the limits and if it is panic kernel.
|
|
||||||
+ * Override user values only if kernel exported
|
|
||||||
+ * values are subset of user defined values.
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+ if (kexec_flags & KEXEC_ON_CRASH) {
|
|
||||||
+ if (start > mem_min)
|
|
||||||
+ mem_min = start;
|
|
||||||
+ if (end < mem_max)
|
|
||||||
+ mem_max = end;
|
|
||||||
+ }
|
|
||||||
+ continue;
|
|
||||||
+ } else
|
|
||||||
+ continue;
|
|
||||||
+ /*
|
|
||||||
+ * Check if this memory range can be coalesced with
|
|
||||||
+ * the previous range
|
|
||||||
+ */
|
|
||||||
+ if ((memory_ranges > 0) &&
|
|
||||||
+ (start == memory_range[memory_ranges-1].end) &&
|
|
||||||
+ (type == memory_range[memory_ranges-1].type)) {
|
|
||||||
+ memory_range[memory_ranges-1].end = end;
|
|
||||||
+ }
|
|
||||||
+ else {
|
|
||||||
+ memory_range[memory_ranges].start = start;
|
|
||||||
+ memory_range[memory_ranges].end = end;
|
|
||||||
+ memory_range[memory_ranges].type = type;
|
|
||||||
+ memory_ranges++;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ fclose(fp);
|
|
||||||
+ *range = memory_range;
|
|
||||||
+ *ranges = memory_ranges;
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Supported file types and callbacks */
|
|
||||||
@@ -76,9 +121,6 @@
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
-static struct {
|
|
||||||
-} arch_options = {
|
|
||||||
-};
|
|
||||||
int arch_process_options(int argc, char **argv)
|
|
||||||
{
|
|
||||||
static const struct option options[] = {
|
|
||||||
@@ -88,6 +130,12 @@
|
|
||||||
static const char short_options[] = KEXEC_ARCH_OPT_STR;
|
|
||||||
int opt;
|
|
||||||
|
|
||||||
+ /* execute from monarch processor */
|
|
||||||
+ cpu_set_t affinity;
|
|
||||||
+ CPU_ZERO(&affinity);
|
|
||||||
+ CPU_SET(0, &affinity);
|
|
||||||
+ sched_setaffinity(0, sizeof(affinity), &affinity);
|
|
||||||
+
|
|
||||||
opterr = 0; /* Don't complain about unrecognized options here */
|
|
||||||
while((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) {
|
|
||||||
switch(opt) {
|
|
||||||
@@ -113,10 +161,7 @@
|
|
||||||
}
|
|
||||||
if (strcmp(utsname.machine, "ia64") == 0)
|
|
||||||
{
|
|
||||||
- /* For compatibility with older patches
|
|
||||||
- * use KEXEC_ARCH_DEFAULT instead of KEXEC_ARCH_IA64 here.
|
|
||||||
- */
|
|
||||||
- info->kexec_flags |= KEXEC_ARCH_DEFAULT;
|
|
||||||
+ info->kexec_flags |= KEXEC_ARCH_IA_64;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
fprintf(stderr, "Unsupported machine type: %s\n",
|
|
||||||
--- kexec-tools-1.101/kexec/kexec.8.orig 2004-12-19 17:27:31.000000000 -0500
|
|
||||||
+++ kexec-tools-1.101/kexec/kexec.8 2006-10-20 13:39:08.000000000 -0400
|
|
||||||
@@ -2,7 +2,7 @@
|
|
||||||
.\" First parameter, NAME, should be all caps
|
|
||||||
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
|
||||||
.\" other parameters are allowed: see man(7), man(1)
|
|
||||||
-.TH KEXEC-TOOLS 8 "October 13, 2004"
|
|
||||||
+.TH KEXEC 8 "October 13, 2004"
|
|
||||||
.\" Please adjust this date whenever revising the manpage.
|
|
||||||
.\"
|
|
||||||
.\" Some roff macros, for reference:
|
|
||||||
@@ -16,30 +16,60 @@
|
|
||||||
.\" .sp <n> insert n+1 empty lines
|
|
||||||
.\" for manpage-specific macros, see man(7)
|
|
||||||
.SH NAME
|
|
||||||
-kexec-tools \- Tool to load a kernel for warm reboot and initiate a warm reboot
|
|
||||||
+kexec \- Tool to load a kernel for warm reboot and initiate a warm reboot
|
|
||||||
.SH SYNOPSIS
|
|
||||||
-.B kexec-tools
|
|
||||||
+.B kexec
|
|
||||||
.RI [ options ] " files" ...
|
|
||||||
.SH DESCRIPTION
|
|
||||||
.PP
|
|
||||||
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
|
|
||||||
.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
|
|
||||||
.\" respectively.
|
|
||||||
-\fBkexec-tools\fP does not have a man page yet. Please use "kexec -h" for help.
|
|
||||||
+\fBkexec\fP allows one to load another kernel from the currently running
|
|
||||||
+Linux kernel. Normally one would load a kernel, and possibly an initial
|
|
||||||
+ramdisk, into the currently running kernel using kexec and then initiate
|
|
||||||
+a warm reboot by executing kexec again with appropriate option.
|
|
||||||
.SH OPTIONS
|
|
||||||
These programs follow the usual GNU command line syntax, with long
|
|
||||||
options starting with two dashes (`-').
|
|
||||||
A summary of options is included below.
|
|
||||||
-For a complete description, see the Info files.
|
|
||||||
.TP
|
|
||||||
.B \-h, \-\-help
|
|
||||||
Show summary of options.
|
|
||||||
.TP
|
|
||||||
.B \-v, \-\-version
|
|
||||||
Show version of program.
|
|
||||||
-.SH SEE ALSO
|
|
||||||
+.TP
|
|
||||||
+.B \-f, \-\-force
|
|
||||||
+Force an immediate kexec without calling shutdown.
|
|
||||||
+.TP
|
|
||||||
+.B \-x, \-\-no-ifdown
|
|
||||||
+Don't bring down network interfaces. (if used, must be last option specified)
|
|
||||||
+.TP
|
|
||||||
+.B \-l, \-\-load
|
|
||||||
+Load the new kernel into the current kernel.
|
|
||||||
+.TP
|
|
||||||
+.B \-p, \-\-load-panic
|
|
||||||
+Load the new kernel for use on panic.
|
|
||||||
+.TP
|
|
||||||
+.B \-u, \-\-unload
|
|
||||||
+Unload the current kexec target kernel.
|
|
||||||
+.TP
|
|
||||||
+.B \-e, \-\-exec
|
|
||||||
+Execute a currently loaded kernel.
|
|
||||||
+.TP
|
|
||||||
+.B \-t, \-\-type=TYPE
|
|
||||||
+Specify the new kernel is of this type.
|
|
||||||
+.TP
|
|
||||||
+.B \-\-mem\-min=<addr>
|
|
||||||
+Specify the lowest memory addres to load code into.
|
|
||||||
+.TP
|
|
||||||
+.B \-\-mem\-max=<addr>
|
|
||||||
+Specify the highest memory addres to load code into.
|
|
||||||
+.TP
|
|
||||||
+There may be additional options supported on individual architectures. Use --help option to see those options.
|
|
||||||
.SH AUTHOR
|
|
||||||
-kexec-tools was written by Eric Biederman.
|
|
||||||
+kexec was written by Eric Biederman.
|
|
||||||
.PP
|
|
||||||
-This manual page was written by Khalid Aziz <khalid_aziz@hp.com>,
|
|
||||||
+This manual page was written by Khalid Aziz <khalid.aziz@hp.com>,
|
|
||||||
for the Debian project (but may be used by others).
|
|
@ -1,33 +0,0 @@
|
|||||||
--- kexec-tools-1.101/kexec/kexec.c.orig1 2006-10-13 14:01:39.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/kexec/kexec.c 2006-10-13 14:10:28.000000000 -0400
|
|
||||||
@@ -698,6 +698,19 @@ void usage(void)
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
+static int kexec_loaded(void)
|
|
||||||
+{
|
|
||||||
+ int ret;
|
|
||||||
+ FILE *fp;
|
|
||||||
+
|
|
||||||
+ fp = fopen("/sys/kernel/kexec_loaded", "r");
|
|
||||||
+ if (fp == NULL)
|
|
||||||
+ return -1;
|
|
||||||
+ fscanf(fp, "%d", &ret);
|
|
||||||
+ fclose(fp);
|
|
||||||
+ return ret;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
int do_load = 1;
|
|
||||||
@@ -801,6 +814,10 @@ int main(int argc, char *argv[])
|
|
||||||
if (do_load && (result == 0)) {
|
|
||||||
result = my_load(type, fileind, argc, argv, kexec_flags);
|
|
||||||
}
|
|
||||||
+ /* Don't shutdown unless there is something to reboot to! */
|
|
||||||
+ if ((result == 0) && (do_shutdown || do_exec) && !kexec_loaded()) {
|
|
||||||
+ die("Nothing has been loaded!\n");
|
|
||||||
+ }
|
|
||||||
if ((result == 0) && do_shutdown) {
|
|
||||||
result = my_shutdown();
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
@ -1,81 +0,0 @@
|
|||||||
--- kexec-tools-1.101/makedumpfile/makedumpfile.c.orig 2007-07-27 13:16:28.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/makedumpfile/makedumpfile.c 2007-08-22 13:20:04.000000000 -0400
|
|
||||||
@@ -5195,6 +5195,9 @@
|
|
||||||
int i;
|
|
||||||
struct pt_load_segment *pls;
|
|
||||||
int ret = FALSE;
|
|
||||||
+ unsigned long long paddr;
|
|
||||||
+ off_t offset_page;
|
|
||||||
+ unsigned char *buf = NULL;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* NOTE: the first half of bitmap is not used for Xen extraction
|
|
||||||
@@ -5211,6 +5214,11 @@
|
|
||||||
strerror(errno));
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
+ if ((buf = malloc(info->page_size)) == NULL) {
|
|
||||||
+ ERRMSG("Can't allocate memory for the page. %s\n",
|
|
||||||
+ strerror(errno));
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
pfn = 0;
|
|
||||||
for (i = 0; i < info->num_load_memory; i++) {
|
|
||||||
@@ -5255,11 +5263,35 @@
|
|
||||||
* - xen heap area, or
|
|
||||||
* - selected domain page
|
|
||||||
*/
|
|
||||||
- if (_domain == 0 ||
|
|
||||||
+ if (!(_domain == 0 ||
|
|
||||||
(info->xen_heap_start <= pfn && pfn < info->xen_heap_end) ||
|
|
||||||
- ((count_info & 0xffff) && is_select_domain(info, _domain))) {
|
|
||||||
- set_bitmap(bm2.buf, pfn%PFN_BUFBITMAP, 1);
|
|
||||||
+ ((count_info & 0xffff) && is_select_domain(info, _domain)))) {
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+ if (info->dump_level & DL_EXCLUDE_ZERO) {
|
|
||||||
+ paddr = (unsigned long long)pfn * info->page_size;
|
|
||||||
+ offset_page = paddr_to_offset(info, paddr);
|
|
||||||
+ if (!offset_page) {
|
|
||||||
+ ERRMSG("Can't convert physaddr(%llx) to a offset.\n",
|
|
||||||
+ paddr);
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+ if (lseek(info->fd_memory, offset_page,
|
|
||||||
+ SEEK_SET) == (off_t)-1) {
|
|
||||||
+ ERRMSG("Can't seek the dump memory(%s). %s\n",
|
|
||||||
+ info->name_memory, strerror(errno));
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+ if (read(info->fd_memory, buf, info->page_size)
|
|
||||||
+ != info->page_size) {
|
|
||||||
+ ERRMSG("Can't read the dump memory(%s). %s\n",
|
|
||||||
+ info->name_memory, strerror(errno));
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+ if (is_zero_page(buf, info->page_size))
|
|
||||||
+ continue;
|
|
||||||
}
|
|
||||||
+ set_bitmap(bm2.buf, pfn%PFN_BUFBITMAP, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -5275,6 +5307,8 @@
|
|
||||||
out:
|
|
||||||
if (bm2.buf != NULL)
|
|
||||||
free(bm2.buf);
|
|
||||||
+ if (buf != NULL)
|
|
||||||
+ free(buf);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
@@ -5546,7 +5580,7 @@
|
|
||||||
MSG("-E must be specified with --xen-syms or --xen-vmcoreinfo.\n");
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
- info->dump_level = DL_EXCLUDE_XEN;
|
|
||||||
+ info->dump_level |= DL_EXCLUDE_XEN;
|
|
||||||
return handle_xen(info);
|
|
||||||
|
|
||||||
} else if (info->flag_rearrange) {
|
|
@ -1,19 +0,0 @@
|
|||||||
--- kexec-tools-1.101/kexec/arch/i386/kexec-multiboot-x86.c.orig 2006-08-28 14:32:50.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/i386/kexec-multiboot-x86.c 2006-08-28 14:34:29.000000000 -0400
|
|
||||||
@@ -47,7 +47,6 @@
|
|
||||||
#include <getopt.h>
|
|
||||||
#include <elf.h>
|
|
||||||
#include <boot/elf_boot.h>
|
|
||||||
-#include <asm/page.h>
|
|
||||||
#include <ip_checksum.h>
|
|
||||||
#include "../../kexec.h"
|
|
||||||
#include "../../kexec-elf.h"
|
|
||||||
@@ -342,7 +341,7 @@
|
|
||||||
/* Pick the next aligned spot to load it in */
|
|
||||||
freespace = add_buffer(info,
|
|
||||||
buf, mod_size, mod_size,
|
|
||||||
- PAGE_SIZE, 0, 0xffffffffUL, 1);
|
|
||||||
+ getpagesize(), 0, 0xffffffffUL, 1);
|
|
||||||
|
|
||||||
/* Add the module command line */
|
|
||||||
sprintf(mod_clp, "%s", mod_command_line);
|
|
@ -1,292 +0,0 @@
|
|||||||
--- kexec-tools-1.101/kexec/arch/ppc64/kexec-elf-rel-ppc64.c.orig 2007-04-10 15:33:46.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/ppc64/kexec-elf-rel-ppc64.c 2007-04-10 15:34:06.000000000 -0400
|
|
||||||
@@ -101,10 +101,10 @@
|
|
||||||
break;
|
|
||||||
|
|
||||||
case R_PPC64_ADDR16_HIGHEST:
|
|
||||||
- *(uint16_t *)location = ((value>>48) & 0xffff);
|
|
||||||
+ *(uint16_t *)location = (((uint64_t)value>>48) & 0xffff);
|
|
||||||
break;
|
|
||||||
case R_PPC64_ADDR16_HIGHER:
|
|
||||||
- *(uint16_t *)location = ((value>>32) & 0xffff);
|
|
||||||
+ *(uint16_t *)location = (((uint64_t)value>>32) & 0xffff);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
--- kexec-tools-1.101/kexec/arch/ppc64/crashdump-ppc64.h.orig 2007-04-10 15:34:59.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/ppc64/crashdump-ppc64.h 2007-04-10 15:35:16.000000000 -0400
|
|
||||||
@@ -25,7 +25,7 @@
|
|
||||||
#define _ALIGN_UP(addr,size) (((addr)+((size)-1))&(~((size)-1)))
|
|
||||||
#define _ALIGN_DOWN(addr,size) ((addr)&(~((size)-1)))
|
|
||||||
|
|
||||||
-extern unsigned long long crash_base;
|
|
||||||
-extern unsigned long long crash_size;
|
|
||||||
+extern uint64_t crash_base;
|
|
||||||
+extern uint64_t crash_size;
|
|
||||||
|
|
||||||
#endif /* CRASHDUMP_PPC64_H */
|
|
||||||
--- kexec-tools-1.101/kexec/arch/ppc64/kexec-elf-ppc64.c.orig 2007-04-10 15:33:47.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/ppc64/kexec-elf-ppc64.c 2007-04-10 15:34:06.000000000 -0400
|
|
||||||
@@ -42,7 +42,7 @@
|
|
||||||
#define BOOTLOADER "kexec"
|
|
||||||
#define BOOTLOADER_VERSION VERSION
|
|
||||||
|
|
||||||
-unsigned long initrd_base, initrd_size;
|
|
||||||
+uint64_t initrd_base, initrd_size;
|
|
||||||
|
|
||||||
int create_flatten_tree(struct kexec_info *, unsigned char **, unsigned long *,
|
|
||||||
char *);
|
|
||||||
@@ -76,19 +76,19 @@
|
|
||||||
char *cmdline, *modified_cmdline;
|
|
||||||
const char *ramdisk, *devicetreeblob;
|
|
||||||
int cmdline_len, modified_cmdline_len;
|
|
||||||
- unsigned long long max_addr, hole_addr;
|
|
||||||
+ uint64_t max_addr, hole_addr;
|
|
||||||
unsigned char *seg_buf = NULL;
|
|
||||||
off_t seg_size = 0;
|
|
||||||
struct mem_phdr *phdr;
|
|
||||||
size_t size;
|
|
||||||
- unsigned long long *rsvmap_ptr;
|
|
||||||
+ uint64_t *rsvmap_ptr;
|
|
||||||
struct bootblock *bb_ptr;
|
|
||||||
unsigned int nr_segments, i;
|
|
||||||
int result, opt;
|
|
||||||
- unsigned long my_kernel, my_dt_offset;
|
|
||||||
+ uint64_t my_kernel, my_dt_offset;
|
|
||||||
unsigned int my_panic_kernel;
|
|
||||||
- unsigned long my_stack, my_backup_start;
|
|
||||||
- unsigned long toc_addr;
|
|
||||||
+ uint64_t my_stack, my_backup_start;
|
|
||||||
+ uint64_t toc_addr;
|
|
||||||
|
|
||||||
#define OPT_APPEND (OPT_ARCH_MAX+0)
|
|
||||||
#define OPT_RAMDISK (OPT_ARCH_MAX+1)
|
|
||||||
@@ -226,10 +226,10 @@
|
|
||||||
}
|
|
||||||
seg_buf = (unsigned char *)slurp_file(ramdisk, &seg_size);
|
|
||||||
add_buffer(info, seg_buf, seg_size, seg_size, 0, 0, max_addr, 1);
|
|
||||||
- hole_addr = (unsigned long long)
|
|
||||||
+ hole_addr = (uint64_t)
|
|
||||||
info->segment[info->nr_segments-1].mem;
|
|
||||||
initrd_base = hole_addr;
|
|
||||||
- initrd_size = (unsigned long long)
|
|
||||||
+ initrd_size = (uint64_t)
|
|
||||||
info->segment[info->nr_segments-1].memsz;
|
|
||||||
} /* ramdisk */
|
|
||||||
|
|
||||||
@@ -259,25 +259,25 @@
|
|
||||||
*/
|
|
||||||
bb_ptr = (struct bootblock *)(
|
|
||||||
(unsigned char *)info->segment[(info->nr_segments)-1].buf);
|
|
||||||
- rsvmap_ptr = (unsigned long long *)(
|
|
||||||
+ rsvmap_ptr = (uint64_t *)(
|
|
||||||
(unsigned char *)info->segment[(info->nr_segments)-1].buf +
|
|
||||||
bb_ptr->off_mem_rsvmap);
|
|
||||||
while (*rsvmap_ptr || *(rsvmap_ptr+1))
|
|
||||||
rsvmap_ptr += 2;
|
|
||||||
rsvmap_ptr -= 2;
|
|
||||||
- *rsvmap_ptr = (unsigned long long)(
|
|
||||||
+ *rsvmap_ptr = (uint64_t)(
|
|
||||||
info->segment[(info->nr_segments)-1].mem);
|
|
||||||
rsvmap_ptr++;
|
|
||||||
- *rsvmap_ptr = (unsigned long long)bb_ptr->totalsize;
|
|
||||||
+ *rsvmap_ptr = (uint64_t)bb_ptr->totalsize;
|
|
||||||
|
|
||||||
nr_segments = info->nr_segments;
|
|
||||||
|
|
||||||
/* Set kernel */
|
|
||||||
- my_kernel = (unsigned long )info->segment[0].mem;
|
|
||||||
+ my_kernel = (uint64_t)info->segment[0].mem;
|
|
||||||
elf_rel_set_symbol(&info->rhdr, "kernel", &my_kernel, sizeof(my_kernel));
|
|
||||||
|
|
||||||
/* Set dt_offset */
|
|
||||||
- my_dt_offset = (unsigned long )info->segment[nr_segments-1].mem;
|
|
||||||
+ my_dt_offset = (uint64_t)info->segment[nr_segments-1].mem;
|
|
||||||
elf_rel_set_symbol(&info->rhdr, "dt_offset", &my_dt_offset,
|
|
||||||
sizeof(my_dt_offset));
|
|
||||||
|
|
||||||
--- kexec-tools-1.101/kexec/arch/ppc64/kexec-ppc64.h.orig 2007-04-10 15:33:46.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/ppc64/kexec-ppc64.h 2007-04-10 15:34:06.000000000 -0400
|
|
||||||
@@ -15,7 +15,7 @@
|
|
||||||
void elf_ppc64_usage(void);
|
|
||||||
void reserve(unsigned long long where, unsigned long long length);
|
|
||||||
|
|
||||||
-extern unsigned long initrd_base, initrd_size;
|
|
||||||
+extern uint64_t initrd_base, initrd_size;
|
|
||||||
/* boot block version 2 as defined by the linux kernel */
|
|
||||||
struct bootblock {
|
|
||||||
unsigned magic,
|
|
||||||
--- kexec-tools-1.101/kexec/arch/ppc64/kexec-ppc64.c.orig 2007-04-10 15:33:46.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/ppc64/kexec-ppc64.c 2007-04-10 15:34:06.000000000 -0400
|
|
||||||
@@ -35,12 +35,12 @@
|
|
||||||
#include <arch/options.h>
|
|
||||||
|
|
||||||
static struct exclude_range exclude_range[MAX_MEMORY_RANGES];
|
|
||||||
-static unsigned long long rmo_top;
|
|
||||||
+static uint64_t rmo_top;
|
|
||||||
static struct memory_range memory_range[MAX_MEMORY_RANGES];
|
|
||||||
static struct memory_range base_memory_range[MAX_MEMORY_RANGES];
|
|
||||||
-unsigned long long memory_max = 0;
|
|
||||||
+uint64_t memory_max = 0;
|
|
||||||
static int nr_memory_ranges, nr_exclude_ranges;
|
|
||||||
-unsigned long long crash_base, crash_size;
|
|
||||||
+uint64_t crash_base, crash_size;
|
|
||||||
|
|
||||||
static int sort_base_ranges();
|
|
||||||
|
|
||||||
@@ -90,10 +90,10 @@
|
|
||||||
if (local_memory_ranges >= MAX_MEMORY_RANGES)
|
|
||||||
break;
|
|
||||||
base_memory_range[local_memory_ranges].start =
|
|
||||||
- ((unsigned long long *)buf)[0];
|
|
||||||
+ ((uint64_t *)buf)[0];
|
|
||||||
base_memory_range[local_memory_ranges].end =
|
|
||||||
base_memory_range[local_memory_ranges].start +
|
|
||||||
- ((unsigned long long *)buf)[1];
|
|
||||||
+ ((uint64_t *)buf)[1];
|
|
||||||
base_memory_range[local_memory_ranges].type = RANGE_RAM;
|
|
||||||
local_memory_ranges++;
|
|
||||||
#ifdef DEBUG
|
|
||||||
@@ -120,7 +120,7 @@
|
|
||||||
static int sort_base_ranges()
|
|
||||||
{
|
|
||||||
int i, j;
|
|
||||||
- unsigned long long tstart, tend;
|
|
||||||
+ uint64_t tstart, tend;
|
|
||||||
|
|
||||||
for (i = 0; i < nr_memory_ranges - 1; i++) {
|
|
||||||
for (j = 0; j < nr_memory_ranges - i - 1; j++) {
|
|
||||||
@@ -141,7 +141,7 @@
|
|
||||||
static int sort_ranges()
|
|
||||||
{
|
|
||||||
int i, j;
|
|
||||||
- unsigned long long tstart, tend;
|
|
||||||
+ uint64_t tstart, tend;
|
|
||||||
for (i = 0; i < nr_exclude_ranges - 1; i++) {
|
|
||||||
for (j = 0; j < nr_exclude_ranges - i - 1; j++) {
|
|
||||||
if (exclude_range[j].start > exclude_range[j+1].start) {
|
|
||||||
@@ -162,12 +162,12 @@
|
|
||||||
*/
|
|
||||||
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 int rtas_base, rtas_size;
|
|
||||||
- unsigned long long htab_base, htab_size;
|
|
||||||
- unsigned long long kernel_end;
|
|
||||||
+ uint64_t htab_base, htab_size;
|
|
||||||
+ uint64_t kernel_end;
|
|
||||||
char buf[MAXBYTES-1];
|
|
||||||
char device_tree[256] = "/proc/device-tree/";
|
|
||||||
char fname[256];
|
|
||||||
@@ -203,7 +203,7 @@
|
|
||||||
closedir(dir);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
- if (fread(&kernel_end, sizeof(unsigned long), 1, file) != 1) {
|
|
||||||
+ if (fread(&kernel_end, sizeof(uint64_t), 1, file) != 1) {
|
|
||||||
perror(fname);
|
|
||||||
fclose(file);
|
|
||||||
closedir(cdir);
|
|
||||||
@@ -228,7 +228,7 @@
|
|
||||||
closedir(dir);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
- if (fread(&crash_base, sizeof(unsigned long), 1,
|
|
||||||
+ if (fread(&crash_base, sizeof(uint64_t), 1,
|
|
||||||
file) != 1) {
|
|
||||||
perror(fname);
|
|
||||||
fclose(file);
|
|
||||||
@@ -248,7 +248,7 @@
|
|
||||||
closedir(dir);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
- if (fread(&crash_size, sizeof(unsigned long), 1,
|
|
||||||
+ if (fread(&crash_size, sizeof(uint64_t), 1,
|
|
||||||
file) != 1) {
|
|
||||||
perror(fname);
|
|
||||||
fclose(file);
|
|
||||||
@@ -281,7 +281,7 @@
|
|
||||||
closedir(dir);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
- if (fread(&htab_base, sizeof(unsigned long), 1, file) != 1) {
|
|
||||||
+ if (fread(&htab_base, sizeof(uint64_t), 1, file) != 1) {
|
|
||||||
perror(fname);
|
|
||||||
fclose(file);
|
|
||||||
closedir(cdir);
|
|
||||||
@@ -298,7 +298,7 @@
|
|
||||||
closedir(dir);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
- if (fread(&htab_size, sizeof(unsigned long), 1, file) != 1) {
|
|
||||||
+ if (fread(&htab_size, sizeof(uint64_t), 1, file) != 1) {
|
|
||||||
perror(fname);
|
|
||||||
fclose(file);
|
|
||||||
closedir(cdir);
|
|
||||||
@@ -367,8 +367,8 @@
|
|
||||||
closedir(dir);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
- 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 > 0x07C00000UL)
|
|
||||||
rmo_top = 0x07C00000UL;
|
|
||||||
|
|
||||||
@@ -389,7 +389,7 @@
|
|
||||||
closedir(dir);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
- if (fread(&tce_base, sizeof(unsigned long), 1, file) != 1) {
|
|
||||||
+ if (fread(&tce_base, sizeof(uint64_t), 1, file) != 1) {
|
|
||||||
perror(fname);
|
|
||||||
fclose(file);
|
|
||||||
closedir(cdir);
|
|
||||||
--- kexec-tools-1.101/kexec/kexec-sha256.h.orig 2007-04-10 15:33:46.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/kexec/kexec-sha256.h 2007-04-10 15:34:06.000000000 -0400
|
|
||||||
@@ -2,8 +2,8 @@
|
|
||||||
#define KEXEC_SHA256_H
|
|
||||||
|
|
||||||
struct sha256_region {
|
|
||||||
- const void *start;
|
|
||||||
- unsigned long len;
|
|
||||||
+ uint64_t start;
|
|
||||||
+ uint64_t len;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define SHA256_REGIONS 16
|
|
||||||
--- kexec-tools-1.101/purgatory/Makefile.orig 2007-04-10 15:33:46.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/purgatory/Makefile 2007-04-10 15:34:06.000000000 -0400
|
|
||||||
@@ -57,9 +57,9 @@
|
|
||||||
$(MKDIR) -p $(@D)
|
|
||||||
$(CC) $(PCFLAGS) -o $@ -c $<
|
|
||||||
|
|
||||||
-$(PURGATORY): $(PURGATORY_OBJS) $(UTIL_LIB)
|
|
||||||
+$(PURGATORY): $(PURGATORY_OBJS)
|
|
||||||
$(MKDIR) -p $(@D)
|
|
||||||
- $(LD) $(LDFLAGS) --no-undefined -e purgatory_start -r -o $@ $(PURGATORY_OBJS) $(UTIL_LIB)
|
|
||||||
+ $(LD) $(LDFLAGS) --no-undefined -e purgatory_start -r -o $@ $(PURGATORY_OBJS)
|
|
||||||
|
|
||||||
echo::
|
|
||||||
@echo "PURGATORY_C_SRCS $(PURGATORY_C_SRCS)"
|
|
||||||
--- kexec-tools-1.101/purgatory/arch/ppc64/Makefile.orig 2007-04-10 15:33:46.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/purgatory/arch/ppc64/Makefile 2007-04-10 15:34:06.000000000 -0400
|
|
||||||
@@ -6,3 +6,5 @@
|
|
||||||
PURGATORY_C_SRCS += purgatory/arch/ppc64/purgatory-ppc64.c
|
|
||||||
PURGATORY_C_SRCS += purgatory/arch/ppc64/console-ppc64.c
|
|
||||||
PURGATORY_C_SRCS += purgatory/arch/ppc64/crashdump_backup.c
|
|
||||||
+
|
|
||||||
+PCFLAGS += -m64 -mcall-aixdesc
|
|
||||||
--- kexec-tools-1.101/purgatory/purgatory.c.orig 2007-04-10 15:33:46.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/purgatory/purgatory.c 2007-04-10 15:34:06.000000000 -0400
|
|
||||||
@@ -46,3 +46,5 @@
|
|
||||||
verify_sha256_digest();
|
|
||||||
post_verification_setup_arch();
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+#include "../util_lib/sha256.c"
|
|
@ -1,10 +0,0 @@
|
|||||||
--- kexec-tools-1.101/kexec/arch/ppc/kexec-ppc.c.orig 2006-07-05 16:21:50.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/ppc/kexec-ppc.c 2006-07-05 16:22:01.000000000 -0400
|
|
||||||
@@ -33,7 +33,6 @@ int get_memory_ranges(struct memory_rang
|
|
||||||
memory_range[memory_ranges].type = RANGE_RAM;
|
|
||||||
memory_ranges++;
|
|
||||||
#else
|
|
||||||
-#error Please, fix this for your platform
|
|
||||||
const char iomem[] = "/proc/iomem";
|
|
||||||
char line[MAX_LINE];
|
|
||||||
FILE *fp;
|
|
@ -1,111 +0,0 @@
|
|||||||
Signed-off-by: Sachin Sant <sachinp@in.ibm.com>
|
|
||||||
---
|
|
||||||
|
|
||||||
diff -Naurp kexec-tools-rh/kexec/arch/ppc64/crashdump-ppc64.c kexec-tools-rh-fix/kexec/arch/ppc64/crashdump-ppc64.c
|
|
||||||
--- kexec-tools-rh/kexec/arch/ppc64/crashdump-ppc64.c 2006-09-08 07:29:52.000000000 +0530
|
|
||||||
+++ kexec-tools-rh-fix/kexec/arch/ppc64/crashdump-ppc64.c 2006-09-08 07:32:19.000000000 +0530
|
|
||||||
@@ -20,6 +20,7 @@
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
+#include <unistd.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <limits.h>
|
|
||||||
#include <elf.h>
|
|
||||||
@@ -85,8 +86,8 @@ static int get_crash_memory_ranges(struc
|
|
||||||
unsigned long long start, end, cstart, cend;
|
|
||||||
|
|
||||||
/* create a separate program header for the backup region */
|
|
||||||
- crash_memory_range[0].start = 0x0000000000000000;
|
|
||||||
- crash_memory_range[0].end = 0x0000000000008000;
|
|
||||||
+ crash_memory_range[0].start = BACKUP_START;
|
|
||||||
+ crash_memory_range[0].end = BACKUP_END;
|
|
||||||
crash_memory_range[0].type = RANGE_RAM;
|
|
||||||
memory_ranges++;
|
|
||||||
|
|
||||||
@@ -125,8 +126,8 @@ static int get_crash_memory_ranges(struc
|
|
||||||
break;
|
|
||||||
start = ((unsigned long long *)buf)[0];
|
|
||||||
end = start + ((unsigned long long *)buf)[1];
|
|
||||||
- if (start == 0 && end >= 0x8000)
|
|
||||||
- start = 0x8000;
|
|
||||||
+ if (start == 0 && end >= BACKUP_END)
|
|
||||||
+ start = BACKUP_END;
|
|
||||||
match = 0;
|
|
||||||
sort_regions(&exclude_rgns);
|
|
||||||
|
|
||||||
@@ -420,8 +421,8 @@ void add_usable_mem_rgns(unsigned long l
|
|
||||||
unsigned long long end = base + size;
|
|
||||||
unsigned long long ustart, uend;
|
|
||||||
|
|
||||||
- base = _ALIGN_DOWN(base, PAGE_SIZE);
|
|
||||||
- end = _ALIGN_UP(end, PAGE_SIZE);
|
|
||||||
+ base = _ALIGN_DOWN(base, getpagesize());
|
|
||||||
+ end = _ALIGN_UP(end, getpagesize());
|
|
||||||
|
|
||||||
for (i=0; i < usablemem_rgns.size; i++) {
|
|
||||||
ustart = usablemem_rgns.ranges[i].start;
|
|
||||||
diff -Naurp kexec-tools-rh/kexec/arch/ppc64/crashdump-ppc64.h kexec-tools-rh-fix/kexec/arch/ppc64/crashdump-ppc64.h
|
|
||||||
--- kexec-tools-rh/kexec/arch/ppc64/crashdump-ppc64.h 2006-09-08 07:29:52.000000000 +0530
|
|
||||||
+++ kexec-tools-rh-fix/kexec/arch/ppc64/crashdump-ppc64.h 2006-09-08 07:33:38.000000000 +0530
|
|
||||||
@@ -6,28 +6,24 @@ int load_crashdump_segments(struct kexec
|
|
||||||
void add_usable_mem_rgns(unsigned long long base, unsigned long long size);
|
|
||||||
void add_exclude_rgns(unsigned long long base, unsigned long long size);
|
|
||||||
|
|
||||||
-#define PAGE_OFFSET 0xC000000000000000
|
|
||||||
+#define PAGE_OFFSET 0xC000000000000000
|
|
||||||
#define KERNELBASE PAGE_OFFSET
|
|
||||||
#define VMALLOCBASE 0xD000000000000000
|
|
||||||
|
|
||||||
#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
|
|
||||||
-
|
|
||||||
-#define MAXMEM (-KERNELBASE-VMALLOCBASE)
|
|
||||||
+#define MAXMEM (-KERNELBASE-VMALLOCBASE)
|
|
||||||
|
|
||||||
#define CRASH_MAX_MEMORY_RANGES (MAX_MEMORY_RANGES + 6)
|
|
||||||
|
|
||||||
#define COMMAND_LINE_SIZE 512 /* from kernel */
|
|
||||||
-/* Backup Region, First 32K of System RAM. */
|
|
||||||
+/* Backup Region, First 64K of System RAM. */
|
|
||||||
#define BACKUP_START 0x0000
|
|
||||||
-#define BACKUP_END 0x8000
|
|
||||||
+#define BACKUP_END 0x10000
|
|
||||||
#define BACKUP_SIZE (BACKUP_END - BACKUP_START + 1)
|
|
||||||
|
|
||||||
-#define KDUMP_BACKUP_LIMIT 0x8000
|
|
||||||
+#define KDUMP_BACKUP_LIMIT BACKUP_END
|
|
||||||
#define _ALIGN_UP(addr,size) (((addr)+((size)-1))&(~((size)-1)))
|
|
||||||
#define _ALIGN_DOWN(addr,size) ((addr)&(~((size)-1)))
|
|
||||||
-#ifndef PAGE_SIZE
|
|
||||||
-#define PAGE_SIZE 4096
|
|
||||||
-#endif
|
|
||||||
|
|
||||||
extern unsigned long long crash_base;
|
|
||||||
extern unsigned long long crash_size;
|
|
||||||
diff -Naurp kexec-tools-rh/purgatory/arch/ppc64/crashdump_backup.c kexec-tools-rh-fix/purgatory/arch/ppc64/crashdump_backup.c
|
|
||||||
--- kexec-tools-rh/purgatory/arch/ppc64/crashdump_backup.c 2006-09-08 07:29:52.000000000 +0530
|
|
||||||
+++ kexec-tools-rh-fix/purgatory/arch/ppc64/crashdump_backup.c 2006-09-08 08:42:27.000000000 +0530
|
|
||||||
@@ -21,9 +21,7 @@
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <string.h>
|
|
||||||
-
|
|
||||||
-#define BACKUP_REGION_SOURCE 0x0
|
|
||||||
-#define BACKUP_REGION_SIZE 32*1024
|
|
||||||
+#include "../../../kexec/arch/ppc64/crashdump-ppc64.h"
|
|
||||||
|
|
||||||
extern unsigned long backup_start;
|
|
||||||
|
|
||||||
@@ -32,10 +30,10 @@ void crashdump_backup_memory(void)
|
|
||||||
{
|
|
||||||
void *dest, *src;
|
|
||||||
|
|
||||||
- src = (void *)BACKUP_REGION_SOURCE;
|
|
||||||
+ src = (void *)BACKUP_START;
|
|
||||||
|
|
||||||
if (backup_start) {
|
|
||||||
dest = (void *)(backup_start);
|
|
||||||
- memcpy(dest, src, BACKUP_REGION_SIZE);
|
|
||||||
+ memcpy(dest, src, BACKUP_SIZE);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
--- kexec-tools-1.101/kexec/arch/ppc64/fs2dt.c~ 2006-04-27 15:01:55.000000000 +0900
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/ppc64/fs2dt.c 2006-05-08 14:15:50.571330714 +0900
|
|
||||||
@@ -61,7 +61,8 @@
|
|
||||||
struct stat statbuf[1];
|
|
||||||
char pathname[MAXPATH], *pathstart;
|
|
||||||
char propnames[NAMESPACE];
|
|
||||||
-dvt dtstruct[TREEWORDS], *dt;
|
|
||||||
+dvt dtstruct[TREEWORDS] __attribute((aligned(8)));
|
|
||||||
+dvt *dt;
|
|
||||||
unsigned long long mem_rsrv[2*MEMRESERVE];
|
|
||||||
|
|
||||||
static int initrd_found = 0;
|
|
@ -1,11 +0,0 @@
|
|||||||
--- kexec-tools-1.101/kexec/arch/ppc64/fs2dt.c.org 2006-04-26 13:12:55.515946645 +0900
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/ppc64/fs2dt.c 2006-04-26 13:50:00.665270758 +0900
|
|
||||||
@@ -275,6 +275,8 @@
|
|
||||||
strcat(local_cmdline, " ");
|
|
||||||
cmd_len = strlen(local_cmdline);
|
|
||||||
cmd_len = cmd_len + 1;
|
|
||||||
+ if ((cmd_len >= 8) && ((unsigned long)dt & 0x4))
|
|
||||||
+ dt++;
|
|
||||||
memcpy(dt,local_cmdline,cmd_len);
|
|
||||||
len = cmd_len;
|
|
||||||
*dt_len = cmd_len;
|
|
@ -1,21 +0,0 @@
|
|||||||
Index: kexec-tools-1.101/kexec/arch/ppc64/fs2dt.c
|
|
||||||
===================================================================
|
|
||||||
--- kexec-tools-1.101.orig/kexec/arch/ppc64/fs2dt.c
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/ppc64/fs2dt.c
|
|
||||||
@@ -267,10 +267,12 @@ void putprops(char *fn, struct dirent **
|
|
||||||
char *old_param;
|
|
||||||
memcpy(temp_cmdline, dt, len);
|
|
||||||
param = strstr(temp_cmdline, "root=");
|
|
||||||
- old_param = strtok(param, " ");
|
|
||||||
- if (cmd_len != 0)
|
|
||||||
- strcat(local_cmdline, " ");
|
|
||||||
- strcat(local_cmdline, old_param);
|
|
||||||
+ if (param) {
|
|
||||||
+ old_param = strtok(param, " ");
|
|
||||||
+ if (cmd_len != 0)
|
|
||||||
+ strcat(local_cmdline, " ");
|
|
||||||
+ strcat(local_cmdline, old_param);
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
strcat(local_cmdline, " ");
|
|
||||||
cmd_len = strlen(local_cmdline);
|
|
@ -1,27 +0,0 @@
|
|||||||
--- a/kexec/arch/ppc64/kexec-elf-ppc64.c
|
|
||||||
+++ b/kexec/arch/ppc64/kexec-elf-ppc64.c
|
|
||||||
@@ -93,6 +93,7 @@ int elf_ppc64_load(int argc, char **argv
|
|
||||||
#define OPT_APPEND (OPT_ARCH_MAX+0)
|
|
||||||
#define OPT_RAMDISK (OPT_ARCH_MAX+1)
|
|
||||||
#define OPT_DEVICETREEBLOB (OPT_ARCH_MAX+2)
|
|
||||||
+#define OPT_ARGS_IGNORE (OPT_ARCH_MAX+3)
|
|
||||||
|
|
||||||
static const struct option options[] = {
|
|
||||||
KEXEC_ARCH_OPTIONS
|
|
||||||
@@ -101,6 +102,7 @@ int elf_ppc64_load(int argc, char **argv
|
|
||||||
{ "ramdisk", 1, NULL, OPT_RAMDISK },
|
|
||||||
{ "initrd", 1, NULL, OPT_RAMDISK },
|
|
||||||
{ "devicetreeblob", 1, NULL, OPT_DEVICETREEBLOB },
|
|
||||||
+ { "args-linux", 0, NULL, OPT_ARGS_IGNORE },
|
|
||||||
{ 0, 0, NULL, 0 },
|
|
||||||
};
|
|
||||||
|
|
||||||
@@ -134,6 +136,8 @@ int elf_ppc64_load(int argc, char **argv
|
|
||||||
case OPT_DEVICETREEBLOB:
|
|
||||||
devicetreeblob = optarg;
|
|
||||||
break;
|
|
||||||
+ case OPT_ARGS_IGNORE:
|
|
||||||
+ break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
|||||||
--- kexec-tools-1.101/kexec/arch/ppc64/crashdump-ppc64.c.orig 2007-03-21 13:08:54.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/ppc64/crashdump-ppc64.c 2007-03-21 13:14:06.000000000 -0400
|
|
||||||
@@ -143,10 +143,10 @@
|
|
||||||
if (start < cstart && end > cend) {
|
|
||||||
match = 1;
|
|
||||||
crash_memory_range[memory_ranges].start = start;
|
|
||||||
- crash_memory_range[memory_ranges].end = cstart - 1;
|
|
||||||
+ crash_memory_range[memory_ranges].end = cstart;
|
|
||||||
crash_memory_range[memory_ranges].type = RANGE_RAM;
|
|
||||||
memory_ranges++;
|
|
||||||
- crash_memory_range[memory_ranges].start = cend + 1;
|
|
||||||
+ crash_memory_range[memory_ranges].start = cend;
|
|
||||||
crash_memory_range[memory_ranges].end = end;
|
|
||||||
crash_memory_range[memory_ranges].type = RANGE_RAM;
|
|
||||||
memory_ranges++;
|
|
||||||
@@ -154,18 +154,18 @@
|
|
||||||
} else if (start < cstart) {
|
|
||||||
match = 1;
|
|
||||||
crash_memory_range[memory_ranges].start = start;
|
|
||||||
- crash_memory_range[memory_ranges].end = cstart - 1;
|
|
||||||
+ crash_memory_range[memory_ranges].end = cstart;
|
|
||||||
crash_memory_range[memory_ranges].type = RANGE_RAM;
|
|
||||||
memory_ranges++;
|
|
||||||
- end = cstart - 1;
|
|
||||||
+ end = cstart;
|
|
||||||
continue;
|
|
||||||
} else if (end > cend){
|
|
||||||
match = 1;
|
|
||||||
- crash_memory_range[memory_ranges].start = cend + 1;
|
|
||||||
+ crash_memory_range[memory_ranges].start = cend;
|
|
||||||
crash_memory_range[memory_ranges].end = end;
|
|
||||||
crash_memory_range[memory_ranges].type = RANGE_RAM;
|
|
||||||
memory_ranges++;
|
|
||||||
- start = cend + 1;
|
|
||||||
+ start = cend;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,116 +0,0 @@
|
|||||||
|
|
||||||
In recent kernels, the plaform property is removed from the /proc/device-tree.
|
|
||||||
This property is used to determine whether the platform is LPAR or non-lpar,
|
|
||||||
and reads htab-* and tce-* properties based on the platform. Fixed this issue
|
|
||||||
such that read these properties if exists, otherwise continue instead of
|
|
||||||
exiting with an error message.
|
|
||||||
|
|
||||||
Signed-off-by: David Wilder <dwilder@us.ibm.com>
|
|
||||||
Signed-off-by: Haren Myneni <haren@us.ibm.com>
|
|
||||||
---
|
|
||||||
kexec/arch/ppc64/kexec-ppc64.c | 55 +++++++++++------------------------------
|
|
||||||
1 file changed, 15 insertions(+), 40 deletions(-)
|
|
||||||
|
|
||||||
Index: kexec-tools-1.101/kexec/arch/ppc64/kexec-ppc64.c
|
|
||||||
===================================================================
|
|
||||||
--- kexec-tools-1.101.orig/kexec/arch/ppc64/kexec-ppc64.c
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/ppc64/kexec-ppc64.c
|
|
||||||
@@ -34,13 +34,8 @@
|
|
||||||
#include "crashdump-ppc64.h"
|
|
||||||
#include <arch/options.h>
|
|
||||||
|
|
||||||
-/* Platforms supported by kexec on PPC64 */
|
|
||||||
-#define PLATFORM_PSERIES 0x0100
|
|
||||||
-#define PLATFORM_PSERIES_LPAR 0x0101
|
|
||||||
-
|
|
||||||
static struct exclude_range exclude_range[MAX_MEMORY_RANGES];
|
|
||||||
static unsigned long long rmo_top;
|
|
||||||
-static unsigned int platform;
|
|
||||||
static struct memory_range memory_range[MAX_MEMORY_RANGES];
|
|
||||||
static struct memory_range base_memory_range[MAX_MEMORY_RANGES];
|
|
||||||
unsigned long long memory_max = 0;
|
|
||||||
@@ -201,26 +196,6 @@ static int get_devtree_details(unsigned
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strncmp(dentry->d_name, "chosen", 6) == 0) {
|
|
||||||
- /* get platform details from /chosen node */
|
|
||||||
- strcat(fname, "/linux,platform");
|
|
||||||
- if ((file = fopen(fname, "r")) == NULL) {
|
|
||||||
- perror(fname);
|
|
||||||
- closedir(cdir);
|
|
||||||
- closedir(dir);
|
|
||||||
- return -1;
|
|
||||||
- }
|
|
||||||
- if (fread(&platform, sizeof(int), 1, file) != 1) {
|
|
||||||
- perror(fname);
|
|
||||||
- fclose(file);
|
|
||||||
- closedir(cdir);
|
|
||||||
- closedir(dir);
|
|
||||||
- return -1;
|
|
||||||
- }
|
|
||||||
- fclose(file);
|
|
||||||
-
|
|
||||||
- memset(fname, 0, sizeof(fname));
|
|
||||||
- strcpy(fname, device_tree);
|
|
||||||
- strcat(fname, dentry->d_name);
|
|
||||||
strcat(fname, "/linux,kernel-end");
|
|
||||||
if ((file = fopen(fname, "r")) == NULL) {
|
|
||||||
perror(fname);
|
|
||||||
@@ -291,18 +266,18 @@ static int get_devtree_details(unsigned
|
|
||||||
reserve(KDUMP_BACKUP_LIMIT, crash_base-KDUMP_BACKUP_LIMIT);
|
|
||||||
}
|
|
||||||
|
|
||||||
- /* if LPAR, no need to read any more from /chosen */
|
|
||||||
- if (platform != PLATFORM_PSERIES) {
|
|
||||||
- closedir(cdir);
|
|
||||||
- continue;
|
|
||||||
- }
|
|
||||||
memset(fname, 0, sizeof(fname));
|
|
||||||
strcpy(fname, device_tree);
|
|
||||||
strcat(fname, dentry->d_name);
|
|
||||||
strcat(fname, "/linux,htab-base");
|
|
||||||
if ((file = fopen(fname, "r")) == NULL) {
|
|
||||||
- perror(fname);
|
|
||||||
closedir(cdir);
|
|
||||||
+ if (errno == ENOENT) {
|
|
||||||
+ /* Non LPAR */
|
|
||||||
+ errno = 0;
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+ perror(fname);
|
|
||||||
closedir(dir);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
@@ -394,23 +369,23 @@ static int get_devtree_details(unsigned
|
|
||||||
}
|
|
||||||
rmo_base = ((unsigned long long *)buf)[0];
|
|
||||||
rmo_top = rmo_base + ((unsigned long long *)buf)[1];
|
|
||||||
- if (platform == PLATFORM_PSERIES) {
|
|
||||||
- if (rmo_top > 0x30000000UL)
|
|
||||||
- rmo_top = 0x30000000UL;
|
|
||||||
- }
|
|
||||||
+ if (rmo_top > 0x30000000UL)
|
|
||||||
+ rmo_top = 0x30000000UL;
|
|
||||||
+
|
|
||||||
fclose(file);
|
|
||||||
closedir(cdir);
|
|
||||||
} /* memory */
|
|
||||||
|
|
||||||
if (strncmp(dentry->d_name, "pci@", 4) == 0) {
|
|
||||||
- if (platform != PLATFORM_PSERIES) {
|
|
||||||
- closedir(cdir);
|
|
||||||
- continue;
|
|
||||||
- }
|
|
||||||
strcat(fname, "/linux,tce-base");
|
|
||||||
if ((file = fopen(fname, "r")) == NULL) {
|
|
||||||
- perror(fname);
|
|
||||||
closedir(cdir);
|
|
||||||
+ if (errno == ENOENT) {
|
|
||||||
+ /* Non LPAR */
|
|
||||||
+ errno = 0;
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+ perror(fname);
|
|
||||||
closedir(dir);
|
|
||||||
return -1;
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
--- kexec-tools-1.101/kexec/arch/ppc64/kexec-ppc64.c.orig 2006-10-20 11:10:39.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/ppc64/kexec-ppc64.c 2006-10-20 11:11:22.000000000 -0400
|
|
||||||
@@ -577,6 +577,10 @@
|
|
||||||
|
|
||||||
void arch_usage(void)
|
|
||||||
{
|
|
||||||
+ fprintf(stderr, " --command-line=<Command line> command line to append.\n");
|
|
||||||
+ fprintf(stderr, " --append=<Command line> same as --command-line.\n");
|
|
||||||
+ fprintf(stderr, " --ramdisk=<filename> Initial RAM disk.\n");
|
|
||||||
+ fprintf(stderr, " --initrd=<filename> same as --ramdisk.\n");
|
|
||||||
fprintf(stderr, " --devicetreeblob=<filename> Specify device tree blob file.\n");
|
|
||||||
fprintf(stderr, " --elf64-core-headers Prepare core headers in ELF64 format\n");
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
--- kexec-tools-1.101/kexec/arch/ppc64/kexec-ppc64.c.orig 2007-04-10 10:53:44.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/ppc64/kexec-ppc64.c 2007-04-10 10:53:58.000000000 -0400
|
|
||||||
@@ -369,8 +369,8 @@
|
|
||||||
}
|
|
||||||
rmo_base = ((unsigned long long *)buf)[0];
|
|
||||||
rmo_top = rmo_base + ((unsigned long long *)buf)[1];
|
|
||||||
- if (rmo_top > 0x30000000UL)
|
|
||||||
- rmo_top = 0x30000000UL;
|
|
||||||
+ if (rmo_top > 0x07C00000UL)
|
|
||||||
+ rmo_top = 0x07C00000UL;
|
|
||||||
|
|
||||||
fclose(file);
|
|
||||||
closedir(cdir);
|
|
File diff suppressed because it is too large
Load Diff
@ -1,252 +0,0 @@
|
|||||||
--- kexec-tools-1.101/include/x86/x86-linux.h.orig 2007-01-05 13:28:08.000000000 -0500
|
|
||||||
+++ kexec-tools-1.101/include/x86/x86-linux.h 2007-01-05 13:24:49.000000000 -0500
|
|
||||||
@@ -141,7 +141,10 @@ struct x86_linux_param_header {
|
|
||||||
uint32_t high_filesz; /* 0x254 */
|
|
||||||
uint8_t reserved15[0x2d0 - 0x258]; /* 0x258 */
|
|
||||||
#else
|
|
||||||
- uint8_t reserved15[0x2d0 - 0x230]; /* 0x230 */
|
|
||||||
+ /* 2.04+ */
|
|
||||||
+ uint32_t kernel_alignment; /* 0x230 */
|
|
||||||
+ uint8_t relocatable_kernel; /* 0x234 */
|
|
||||||
+ uint8_t reserved15[0x2d0 - 0x235]; /* 0x230 */
|
|
||||||
#endif
|
|
||||||
struct e820entry e820_map[E820MAX]; /* 0x2d0 */
|
|
||||||
/* 0x550 */
|
|
||||||
@@ -201,12 +204,15 @@ struct x86_linux_header {
|
|
||||||
uint32_t high_filesz; /* 0x254 */
|
|
||||||
uint32_t tail[32*1024 - 0x258]; /* 0x258 */
|
|
||||||
#else
|
|
||||||
- uint8_t tail[32*1024 - 0x230]; /* 0x230 */
|
|
||||||
+ uint32_t kernel_alignment; /* 0x230 */
|
|
||||||
+ uint8_t relocatable_kernel; /* 0x234 */
|
|
||||||
+ uint8_t tail[32*1024 - 0x235]; /* 0x230 */
|
|
||||||
#endif
|
|
||||||
} PACKED;
|
|
||||||
|
|
||||||
#endif /* ASSEMBLY */
|
|
||||||
|
|
||||||
#define DEFAULT_INITRD_ADDR_MAX 0x37FFFFFF
|
|
||||||
+#define DEFAULT_BZIMAGE_ADDR_MAX 0x37FFFFFF
|
|
||||||
|
|
||||||
#endif /* X86_LINUX_H */
|
|
||||||
--- kexec-tools-1.101/kexec/arch/i386/crashdump-x86.c.orig 2007-01-05 13:28:08.000000000 -0500
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/i386/crashdump-x86.c 2007-01-05 13:27:53.000000000 -0500
|
|
||||||
@@ -680,7 +680,9 @@ int load_crashdump_segments(struct kexec
|
|
||||||
tmp = xmalloc(sz);
|
|
||||||
memset(tmp, 0, sz);
|
|
||||||
info->backup_start = add_buffer(info, tmp, sz, sz, align,
|
|
||||||
- 0, max_addr, 1);
|
|
||||||
+ 0, max_addr, -1);
|
|
||||||
+ dfprintf(stdout, "Created backup segment at 0x%lx\n",
|
|
||||||
+ info->backup_start);
|
|
||||||
if (delete_memmap(memmap_p, info->backup_start, sz) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
@@ -719,7 +721,8 @@ int load_crashdump_segments(struct kexec
|
|
||||||
* This is a makeshift solution until it is fixed in kernel.
|
|
||||||
*/
|
|
||||||
elfcorehdr = add_buffer(info, tmp, sz, 16*1024, align, min_base,
|
|
||||||
- max_addr, 1);
|
|
||||||
+ max_addr, -1);
|
|
||||||
+ dfprintf(stdout, "Created elf header segment at 0x%lx\n", elfcorehdr);
|
|
||||||
if (delete_memmap(memmap_p, elfcorehdr, sz) < 0)
|
|
||||||
return -1;
|
|
||||||
cmdline_add_memmap(mod_cmdline, memmap_p);
|
|
||||||
--- kexec-tools-1.101/kexec/arch/i386/x86-linux-setup.c.orig 2007-01-05 13:28:08.000000000 -0500
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/i386/x86-linux-setup.c 2007-01-05 13:24:49.000000000 -0500
|
|
||||||
@@ -59,6 +59,7 @@ void setup_linux_bootloader_parameters(
|
|
||||||
initrd_addr_max = DEFAULT_INITRD_ADDR_MAX;
|
|
||||||
if (real_mode->protocol_version >= 0x0203) {
|
|
||||||
initrd_addr_max = real_mode->initrd_addr_max;
|
|
||||||
+ dfprintf(stdout, "initrd_addr_max is 0x%lx\n", initrd_addr_max);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Load the initrd if we have one */
|
|
||||||
@@ -66,6 +67,8 @@ void setup_linux_bootloader_parameters(
|
|
||||||
initrd_base = add_buffer(info,
|
|
||||||
initrd_buf, initrd_size, initrd_size,
|
|
||||||
4096, INITRD_BASE, initrd_addr_max, -1);
|
|
||||||
+ dfprintf(stdout, "Loaded initrd at 0x%lx size 0x%lx\n",
|
|
||||||
+ initrd_base, initrd_size);
|
|
||||||
} else {
|
|
||||||
initrd_base = 0;
|
|
||||||
initrd_size = 0;
|
|
||||||
--- kexec-tools-1.101/kexec/arch/i386/kexec-bzImage.c.orig 2007-01-05 13:28:08.000000000 -0500
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/i386/kexec-bzImage.c 2007-01-05 13:27:53.000000000 -0500
|
|
||||||
@@ -34,8 +34,10 @@
|
|
||||||
#include <x86/x86-linux.h>
|
|
||||||
#include "../../kexec.h"
|
|
||||||
#include "../../kexec-elf.h"
|
|
||||||
+#include "../../kexec-syscall.h"
|
|
||||||
#include "kexec-x86.h"
|
|
||||||
#include "x86-linux-setup.h"
|
|
||||||
+#include "crashdump-x86.h"
|
|
||||||
#include <arch/options.h>
|
|
||||||
|
|
||||||
static const int probe_debug = 0;
|
|
||||||
@@ -109,6 +111,9 @@ int do_bzImage_load(struct kexec_info *i
|
|
||||||
unsigned long setup_base, setup_size;
|
|
||||||
struct entry32_regs regs32;
|
|
||||||
struct entry16_regs regs16;
|
|
||||||
+ unsigned int relocatable_kernel = 0;
|
|
||||||
+ unsigned long kernel32_load_addr;
|
|
||||||
+ char *modified_cmdline;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Find out about the file I am about to load.
|
|
||||||
@@ -121,6 +126,7 @@ int do_bzImage_load(struct kexec_info *i
|
|
||||||
if (setup_sects == 0) {
|
|
||||||
setup_sects = 4;
|
|
||||||
}
|
|
||||||
+
|
|
||||||
kern16_size = (setup_sects +1) *512;
|
|
||||||
kernel_version = ((unsigned char *)&setup_header) + 512 + setup_header.kver_addr;
|
|
||||||
if (kernel_len < kern16_size) {
|
|
||||||
@@ -128,25 +134,88 @@ int do_bzImage_load(struct kexec_info *i
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ if (setup_header.protocol_version >= 0x0205) {
|
|
||||||
+ relocatable_kernel = setup_header.relocatable_kernel;
|
|
||||||
+ dfprintf(stdout, "bzImage is relocatable\n");
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* Can't use bzImage for crash dump purposes with real mode entry */
|
|
||||||
+ if((info->kexec_flags & KEXEC_ON_CRASH) && real_mode_entry) {
|
|
||||||
+ fprintf(stderr, "Can't use bzImage for crash dump purposes"
|
|
||||||
+ " with real mode entry\n");
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if((info->kexec_flags & KEXEC_ON_CRASH) && !relocatable_kernel) {
|
|
||||||
+ fprintf(stderr, "BzImage is not relocatable. Can't be used"
|
|
||||||
+ " as capture kernel.\n");
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* Need to append some command line parameters internally in case of
|
|
||||||
+ * taking crash dumps.
|
|
||||||
+ */
|
|
||||||
+ if (info->kexec_flags & KEXEC_ON_CRASH) {
|
|
||||||
+ modified_cmdline = xmalloc(COMMAND_LINE_SIZE);
|
|
||||||
+ memset((void *)modified_cmdline, 0, COMMAND_LINE_SIZE);
|
|
||||||
+ if (command_line) {
|
|
||||||
+ strncpy(modified_cmdline, command_line,
|
|
||||||
+ COMMAND_LINE_SIZE);
|
|
||||||
+ modified_cmdline[COMMAND_LINE_SIZE - 1] = '\0';
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* If panic kernel is being loaded, additional segments need
|
|
||||||
+ * to be created. load_crashdump_segments will take care of
|
|
||||||
+ * loading the segments as high in memory as possible, hence
|
|
||||||
+ * in turn as away as possible from kernel to avoid being
|
|
||||||
+ * stomped by the kernel.
|
|
||||||
+ */
|
|
||||||
+ if (load_crashdump_segments(info, modified_cmdline, -1, 0) < 0)
|
|
||||||
+ return -1;
|
|
||||||
+
|
|
||||||
+ /* Use new command line buffer */
|
|
||||||
+ command_line = modified_cmdline;
|
|
||||||
+ command_line_len = strlen(command_line) +1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
/* Load the trampoline. This must load at a higher address
|
|
||||||
* the the argument/parameter segment or the kernel will stomp
|
|
||||||
* it's gdt.
|
|
||||||
*/
|
|
||||||
- elf_rel_build_load(info, &info->rhdr, purgatory, purgatory_size,
|
|
||||||
- 0x3000, 640*1024, -1);
|
|
||||||
+
|
|
||||||
+ if (!real_mode_entry && relocatable_kernel)
|
|
||||||
+ elf_rel_build_load(info, &info->rhdr, purgatory, purgatory_size,
|
|
||||||
+ 0x3000, -1, -1, 0);
|
|
||||||
+ else
|
|
||||||
+ elf_rel_build_load(info, &info->rhdr, purgatory, purgatory_size,
|
|
||||||
+ 0x3000, 640*1024, -1, 0);
|
|
||||||
+ dfprintf(stdout, "Loaded purgatory at addr 0x%lx\n",
|
|
||||||
+ info->rhdr.rel_addr);
|
|
||||||
|
|
||||||
/* The argument/parameter segment */
|
|
||||||
setup_size = kern16_size + command_line_len;
|
|
||||||
real_mode = xmalloc(setup_size);
|
|
||||||
memcpy(real_mode, kernel, kern16_size);
|
|
||||||
- if (real_mode->protocol_version >= 0x0200) {
|
|
||||||
+
|
|
||||||
+ if (info->kexec_flags & KEXEC_ON_CRASH) {
|
|
||||||
+ /* If using bzImage for capture kernel, then we will not be
|
|
||||||
+ * executing real mode code. setup segment can be loaded
|
|
||||||
+ * anywhere as we will be just reading command line.
|
|
||||||
+ */
|
|
||||||
+ setup_base = add_buffer(info, real_mode, setup_size, setup_size,
|
|
||||||
+ 16, 0x3000, -1, 1);
|
|
||||||
+ }
|
|
||||||
+ else if (real_mode->protocol_version >= 0x0200) {
|
|
||||||
/* Careful setup_base must be greater than 8K */
|
|
||||||
setup_base = add_buffer(info, real_mode, setup_size, setup_size,
|
|
||||||
- 16, 0x3000, 640*1024, -1);
|
|
||||||
+ 16, 0x3000, 640*1024, 1);
|
|
||||||
} else {
|
|
||||||
add_segment(info, real_mode, setup_size, SETUP_BASE, setup_size);
|
|
||||||
setup_base = SETUP_BASE;
|
|
||||||
}
|
|
||||||
+ dfprintf(stdout, "Loaded real-mode code and command line at 0x%lx\n",
|
|
||||||
+ setup_base);
|
|
||||||
+
|
|
||||||
/* Verify purgatory loads higher than the parameters */
|
|
||||||
if (info->rhdr.rel_addr < setup_base) {
|
|
||||||
die("Could not put setup code above the kernel parameters\n");
|
|
||||||
@@ -154,9 +223,30 @@ int do_bzImage_load(struct kexec_info *i
|
|
||||||
|
|
||||||
/* The main kernel segment */
|
|
||||||
size = kernel_len - kern16_size;
|
|
||||||
- add_segment(info, kernel + kern16_size, size, KERN32_BASE, size);
|
|
||||||
|
|
||||||
+ if (real_mode->protocol_version >=0x0205 && relocatable_kernel) {
|
|
||||||
+ /* Relocatable bzImage */
|
|
||||||
+ unsigned long kern_align = real_mode->kernel_alignment;
|
|
||||||
+ unsigned long kernel32_max_addr = DEFAULT_BZIMAGE_ADDR_MAX;
|
|
||||||
+
|
|
||||||
+ if (real_mode->protocol_version >= 0x0203) {
|
|
||||||
+ if (kernel32_max_addr > real_mode->initrd_addr_max)
|
|
||||||
+ kernel32_max_addr = real_mode->initrd_addr_max;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ kernel32_load_addr = add_buffer(info, kernel + kern16_size,
|
|
||||||
+ size, size, kern_align,
|
|
||||||
+ 0x100000, kernel32_max_addr,
|
|
||||||
+ 1);
|
|
||||||
+ }
|
|
||||||
+ else {
|
|
||||||
+ kernel32_load_addr = KERN32_BASE;
|
|
||||||
+ add_segment(info, kernel + kern16_size, size,
|
|
||||||
+ kernel32_load_addr, size);
|
|
||||||
+ }
|
|
||||||
|
|
||||||
+ dfprintf(stdout, "Loaded 32bit kernel at 0x%lx\n", kernel32_load_addr);
|
|
||||||
+
|
|
||||||
/* Tell the kernel what is going on */
|
|
||||||
setup_linux_bootloader_parameters(info, real_mode, setup_base,
|
|
||||||
kern16_size, command_line, command_line_len,
|
|
||||||
@@ -177,7 +267,7 @@ int do_bzImage_load(struct kexec_info *i
|
|
||||||
regs32.edi = 0; /* unused */
|
|
||||||
regs32.esp = elf_rel_get_addr(&info->rhdr, "stack_end"); /* stack, unused */
|
|
||||||
regs32.ebp = 0; /* unused */
|
|
||||||
- regs32.eip = KERN32_BASE; /* kernel entry point */
|
|
||||||
+ regs32.eip = kernel32_load_addr; /* kernel entry point */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Initialize the 16bit start information.
|
|
||||||
--- kexec-tools-1.101/kexec/kexec.h.orig 2007-01-05 13:28:08.000000000 -0500
|
|
||||||
+++ kexec-tools-1.101/kexec/kexec.h 2007-01-05 13:24:43.000000000 -0500
|
|
||||||
@@ -197,4 +197,11 @@ int arch_compat_trampoline(struct kexec_
|
|
||||||
void arch_update_purgatory(struct kexec_info *info);
|
|
||||||
|
|
||||||
#define MAX_LINE 160
|
|
||||||
+
|
|
||||||
+#ifdef DEBUG
|
|
||||||
+#define dfprintf(args...) do {fprintf(args);} while(0)
|
|
||||||
+#else
|
|
||||||
+#define dfprintf(args...) do { } while(0)
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
#endif /* KEXEC_H */
|
|
@ -1,20 +0,0 @@
|
|||||||
--- kexec-tools-1.101/kexec/arch/s390/kexec-s390.c.orig 2006-07-05 16:01:46.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/s390/kexec-s390.c 2006-07-05 16:02:48.000000000 -0400
|
|
||||||
@@ -36,7 +36,7 @@ static struct memory_range memory_range[
|
|
||||||
* - (-1) if something went wrong.
|
|
||||||
*/
|
|
||||||
|
|
||||||
-int get_memory_ranges(struct memory_range **range, int *ranges)
|
|
||||||
+int get_memory_ranges(struct memory_range **range, int *ranges, unsigned long kexec_flags)
|
|
||||||
{
|
|
||||||
char sys_ram[] = "System RAM\n";
|
|
||||||
char iomem[] = "/proc/iomem";
|
|
||||||
@@ -94,7 +94,7 @@ int arch_process_options(int argc, char
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
-int arch_compat_trampoline(struct kexec_info *info, unsigned long *flags)
|
|
||||||
+int arch_compat_trampoline(struct kexec_info *info)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
--- kexec-tools-1.101/kexec/arch/i386/crashdump-x86.c.orig 2007-07-17 08:33:59.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/kexec/arch/i386/crashdump-x86.c 2007-07-17 08:34:13.000000000 -0400
|
|
||||||
@@ -663,6 +663,7 @@ int load_crashdump_segments(struct kexec
|
|
||||||
int nr_ranges, align = 1024;
|
|
||||||
long int nr_cpus = 0;
|
|
||||||
struct memory_range *mem_range, *memmap_p;
|
|
||||||
+ int i;
|
|
||||||
|
|
||||||
if (get_crash_memory_ranges(&mem_range, &nr_ranges) < 0)
|
|
||||||
return -1;
|
|
||||||
@@ -720,8 +721,13 @@ int load_crashdump_segments(struct kexec
|
|
||||||
* elf core header segment to 16K to avoid being placed in such gaps.
|
|
||||||
* This is a makeshift solution until it is fixed in kernel.
|
|
||||||
*/
|
|
||||||
- elfcorehdr = add_buffer(info, tmp, sz, 16*1024, align, min_base,
|
|
||||||
- max_addr, -1);
|
|
||||||
+ for (i=0;i<KEXEC_MAX_SEGMENTS;i++) {
|
|
||||||
+ if ((memmap_p[i].start == 0) &&
|
|
||||||
+ (memmap_p[i].end == 0))
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+ elfcorehdr = add_buffer(info, tmp, sz, 16*1024, align, min_base,
|
|
||||||
+ memmap_p[i-1].end, -1);
|
|
||||||
dfprintf(stdout, "Created elf header segment at 0x%lx\n", elfcorehdr);
|
|
||||||
if (delete_memmap(memmap_p, elfcorehdr, sz) < 0)
|
|
||||||
return -1;
|
|
||||||
--- kexec-tools-1.101/kexec/kexec.c.orig 2007-07-17 08:34:00.000000000 -0400
|
|
||||||
+++ kexec-tools-1.101/kexec/kexec.c 2007-07-17 08:34:13.000000000 -0400
|
|
||||||
@@ -327,6 +327,7 @@ unsigned long add_buffer(struct kexec_in
|
|
||||||
unsigned long base;
|
|
||||||
int result;
|
|
||||||
int pagesize;
|
|
||||||
+ int i;
|
|
||||||
|
|
||||||
result = sort_segments(info);
|
|
||||||
if (result < 0) {
|
|
||||||
@@ -336,11 +337,22 @@ unsigned long add_buffer(struct kexec_in
|
|
||||||
/* Round memsz up to a multiple of pagesize */
|
|
||||||
pagesize = getpagesize();
|
|
||||||
memsz = (memsz + (pagesize - 1)) & ~(pagesize - 1);
|
|
||||||
-
|
|
||||||
+retry:
|
|
||||||
base = locate_hole(info, memsz, buf_align, buf_min, buf_max, buf_end);
|
|
||||||
if (base == ULONG_MAX) {
|
|
||||||
die("locate_hole failed\n");
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ for (i = 0; i < info->nr_segments; i++) {
|
|
||||||
+ if ((base < (info->segment[i].mem + info->segment[i].memsz)) &&
|
|
||||||
+ ((base+memsz) > info->segment[i].mem)) {
|
|
||||||
+ /*
|
|
||||||
+ *we have an overlap, bump down buf_max
|
|
||||||
+ */
|
|
||||||
+ buf_max = (unsigned long)info->segment[i].mem;
|
|
||||||
+ goto retry;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
|
|
||||||
add_segment(info, buf, bufsz, base, memsz);
|
|
||||||
return base;
|
|
33
kexec-tools-1.102pre-ppc64-buffer-overflow.patch
Normal file
33
kexec-tools-1.102pre-ppc64-buffer-overflow.patch
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
diff -up kexec-tools-testing-20070330/kexec/arch/ppc64/kexec-ppc64.c.orig kexec-tools-testing-20070330/kexec/arch/ppc64/kexec-ppc64.c
|
||||||
|
--- kexec-tools-testing-20070330/kexec/arch/ppc64/kexec-ppc64.c.orig 2008-02-20 10:08:36.000000000 -0500
|
||||||
|
+++ kexec-tools-testing-20070330/kexec/arch/ppc64/kexec-ppc64.c 2008-02-20 10:10:32.000000000 -0500
|
||||||
|
@@ -133,7 +133,7 @@ static int get_base_ranges()
|
||||||
|
int local_memory_ranges = 0;
|
||||||
|
char device_tree[256] = "/proc/device-tree/";
|
||||||
|
char fname[256];
|
||||||
|
- char buf[MAXBYTES-1];
|
||||||
|
+ char buf[MAXBYTES];
|
||||||
|
DIR *dir, *dmem;
|
||||||
|
FILE *file;
|
||||||
|
struct dirent *dentry, *mentry;
|
||||||
|
@@ -253,7 +253,7 @@ static int get_devtree_details(unsigned
|
||||||
|
unsigned int tce_size;
|
||||||
|
unsigned long long htab_base, htab_size;
|
||||||
|
unsigned long long kernel_end;
|
||||||
|
- char buf[MAXBYTES-1];
|
||||||
|
+ char buf[MAXBYTES];
|
||||||
|
char device_tree[256] = "/proc/device-tree/";
|
||||||
|
char fname[256];
|
||||||
|
DIR *dir, *cdir;
|
||||||
|
diff -up kexec-tools-testing-20070330/kexec/arch/ppc64/crashdump-ppc64.c.orig kexec-tools-testing-20070330/kexec/arch/ppc64/crashdump-ppc64.c
|
||||||
|
--- kexec-tools-testing-20070330/kexec/arch/ppc64/crashdump-ppc64.c.orig 2007-03-30 00:34:36.000000000 -0400
|
||||||
|
+++ kexec-tools-testing-20070330/kexec/arch/ppc64/crashdump-ppc64.c 2008-02-20 10:09:23.000000000 -0500
|
||||||
|
@@ -101,7 +101,7 @@ static int get_crash_memory_ranges(struc
|
||||||
|
int memory_ranges = 0;
|
||||||
|
char device_tree[256] = "/proc/device-tree/";
|
||||||
|
char fname[256];
|
||||||
|
- char buf[MAXBYTES-1];
|
||||||
|
+ char buf[MAXBYTES];
|
||||||
|
DIR *dir, *dmem;
|
||||||
|
FILE *file;
|
||||||
|
struct dirent *dentry, *mentry;
|
94
kexec-tools-1.102pre-vmcoreinfo.patch
Normal file
94
kexec-tools-1.102pre-vmcoreinfo.patch
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
diff -rpuN backup/kexec-tools-testing-20070330/kexec/crashdump-elf.c kexec-tools/kexec/crashdump-elf.c
|
||||||
|
--- backup/kexec-tools-testing-20070330/kexec/crashdump-elf.c 2007-03-30 13:34:36.000000000 +0900
|
||||||
|
+++ kexec-tools/kexec/crashdump-elf.c 2007-08-03 14:45:47.000000000 +0900
|
||||||
|
@@ -36,6 +36,8 @@
|
||||||
|
char *bufp;
|
||||||
|
long int nr_cpus = 0;
|
||||||
|
uint64_t notes_addr, notes_len;
|
||||||
|
+ uint64_t vmcoreinfo_addr, vmcoreinfo_len;
|
||||||
|
+ int has_vmcoreinfo = 0;
|
||||||
|
int (*get_note_info)(int cpu, uint64_t *addr, uint64_t *len);
|
||||||
|
|
||||||
|
if (xen_present())
|
||||||
|
@@ -47,7 +49,11 @@
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
- sz = sizeof(EHDR) + nr_cpus * sizeof(PHDR) + ranges * sizeof(PHDR);
|
||||||
|
+ if (get_kernel_vmcoreinfo(&vmcoreinfo_addr, &vmcoreinfo_len) == 0) {
|
||||||
|
+ has_vmcoreinfo = 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ sz = sizeof(EHDR) + (nr_cpus + has_vmcoreinfo) * sizeof(PHDR) + ranges * sizeof(PHDR);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Certain architectures such as x86_64 and ia64 require a separate
|
||||||
|
@@ -148,6 +154,21 @@
|
||||||
|
dfprintf_phdr(stdout, "Elf header", phdr);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (has_vmcoreinfo) {
|
||||||
|
+ phdr = (PHDR *) bufp;
|
||||||
|
+ bufp += sizeof(PHDR);
|
||||||
|
+ phdr->p_type = PT_NOTE;
|
||||||
|
+ phdr->p_flags = 0;
|
||||||
|
+ phdr->p_offset = phdr->p_paddr = vmcoreinfo_addr;
|
||||||
|
+ phdr->p_vaddr = 0;
|
||||||
|
+ phdr->p_filesz = phdr->p_memsz = vmcoreinfo_len;
|
||||||
|
+ /* Do we need any alignment of segments? */
|
||||||
|
+ phdr->p_align = 0;
|
||||||
|
+
|
||||||
|
+ (elf->e_phnum)++;
|
||||||
|
+ dfprintf_phdr(stdout, "vmcoreinfo header", phdr);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
/* Setup an PT_LOAD type program header for the region where
|
||||||
|
* Kernel is mapped if info->kern_size is non-zero.
|
||||||
|
*/
|
||||||
|
--- backup/kexec-tools-testing-20070330/kexec/crashdump.c 2007-03-30 13:34:36.000000000 +0900
|
||||||
|
+++ kexec-tools/kexec/crashdump.c 2007-08-03 14:45:05.000000000 +0900
|
||||||
|
@@ -108,3 +108,32 @@
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+/* Returns the physical address of start of crash notes buffer for a kernel. */
|
||||||
|
+int get_kernel_vmcoreinfo(uint64_t *addr, uint64_t *len)
|
||||||
|
+{
|
||||||
|
+ char kdump_info[PATH_MAX];
|
||||||
|
+ char line[MAX_LINE];
|
||||||
|
+ int count;
|
||||||
|
+ FILE *fp;
|
||||||
|
+ unsigned long long temp, temp2;
|
||||||
|
+
|
||||||
|
+ *addr = 0;
|
||||||
|
+ *len = 0;
|
||||||
|
+
|
||||||
|
+ sprintf(kdump_info, "/sys/kernel/vmcoreinfo");
|
||||||
|
+ fp = fopen(kdump_info, "r");
|
||||||
|
+ if (!fp)
|
||||||
|
+ return -1;
|
||||||
|
+
|
||||||
|
+ if (!fgets(line, sizeof(line), fp))
|
||||||
|
+ die("Cannot parse %s: %s\n", kdump_info, strerror(errno));
|
||||||
|
+ count = sscanf(line, "%Lx %Lx", &temp, &temp2);
|
||||||
|
+ if (count != 2)
|
||||||
|
+ die("Cannot parse %s: %s\n", kdump_info, strerror(errno));
|
||||||
|
+
|
||||||
|
+ *addr = (uint64_t) temp;
|
||||||
|
+ *len = (uint64_t) temp2;
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
diff -rpuN backup/kexec-tools-testing-20070330/kexec/crashdump.h kexec-tools/kexec/crashdump.h
|
||||||
|
--- backup/kexec-tools-testing-20070330/kexec/crashdump.h 2007-03-30 13:34:36.000000000 +0900
|
||||||
|
+++ kexec-tools/kexec/crashdump.h 2007-08-03 14:45:05.000000000 +0900
|
||||||
|
@@ -2,6 +2,7 @@
|
||||||
|
#define CRASHDUMP_H
|
||||||
|
|
||||||
|
extern int get_crash_notes_per_cpu(int cpu, uint64_t *addr, uint64_t *len);
|
||||||
|
+extern int get_kernel_vmcoreinfo(uint64_t *addr, uint64_t *len);
|
||||||
|
|
||||||
|
/* Need to find a better way to determine per cpu notes section size. */
|
||||||
|
#define MAX_NOTE_BYTES 1024
|
||||||
|
_
|
@ -1,6 +1,6 @@
|
|||||||
Name: kexec-tools
|
Name: kexec-tools
|
||||||
Version: 1.102pre
|
Version: 1.102pre
|
||||||
Release: 5%{?dist}
|
Release: 6%{?dist}
|
||||||
License: GPL
|
License: GPL
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
Summary: The kexec/kdump userspace component.
|
Summary: The kexec/kdump userspace component.
|
||||||
@ -36,8 +36,8 @@ Patch2: kexec-tools-1.102pre-bzimage-options.patch
|
|||||||
#
|
#
|
||||||
# Patches 101 through 200 are meant for x86_64 kexec-tools enablement
|
# Patches 101 through 200 are meant for x86_64 kexec-tools enablement
|
||||||
#
|
#
|
||||||
Patch101: kexec-tools-1.101-disable-kdump-x8664.patch
|
Patch101: kexec-tools-1.102pre-disable-kdump-x8664.patch
|
||||||
Patch102: kexec-tools-1.101-x86_64-exactmap.patch
|
Patch102: kexec-tools-1.102pre-x86_64-exactmap.patch
|
||||||
|
|
||||||
#
|
#
|
||||||
# Patches 201 through 300 are meant for ia64 kexec-tools enablement
|
# Patches 201 through 300 are meant for ia64 kexec-tools enablement
|
||||||
@ -47,6 +47,7 @@ Patch102: kexec-tools-1.101-x86_64-exactmap.patch
|
|||||||
# Patches 301 through 400 are meant for ppc64 kexec-tools enablement
|
# Patches 301 through 400 are meant for ppc64 kexec-tools enablement
|
||||||
#
|
#
|
||||||
Patch301: kexec-tools-1.102pre-ppc64_rmo_top.patch
|
Patch301: kexec-tools-1.102pre-ppc64_rmo_top.patch
|
||||||
|
Patch302: kexec-tools-1.102pre-ppc64-buffer-overflow.patch
|
||||||
|
|
||||||
#
|
#
|
||||||
# Patches 401 through 500 are meant for s390 kexec-tools enablement
|
# Patches 401 through 500 are meant for s390 kexec-tools enablement
|
||||||
@ -64,7 +65,8 @@ Patch601: kexec-tools-1.102pre-elf-format.patch
|
|||||||
Patch602: kexec-tools-1.102pre-x86-add_buffer_retry.patch
|
Patch602: kexec-tools-1.102pre-x86-add_buffer_retry.patch
|
||||||
Patch603: kexec-tools-1.102pre-makedumpfile-xen-syms.patch
|
Patch603: kexec-tools-1.102pre-makedumpfile-xen-syms.patch
|
||||||
Patch604: kexec-tools-1.102pre-disable-kexec-test.patch
|
Patch604: kexec-tools-1.102pre-disable-kexec-test.patch
|
||||||
Patch605: kexec-tools-1.102pre-makedumpfile-makefile.patch
|
Patch605: kexec-tools-1.102pre-vmcoreinfo.patch
|
||||||
|
Patch606: kexec-tools-1.102pre-makedumpfile-makefile.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
kexec-tools provides /sbin/kexec binary that facilitates a new
|
kexec-tools provides /sbin/kexec binary that facilitates a new
|
||||||
@ -92,6 +94,7 @@ tar -z -x -v -f %{SOURCE9}
|
|||||||
%patch603 -p1
|
%patch603 -p1
|
||||||
%patch604 -p1
|
%patch604 -p1
|
||||||
%patch605 -p1
|
%patch605 -p1
|
||||||
|
%patch606 -p1
|
||||||
|
|
||||||
tar -z -x -v -f %{SOURCE13}
|
tar -z -x -v -f %{SOURCE13}
|
||||||
|
|
||||||
@ -220,6 +223,10 @@ done
|
|||||||
%doc kexec-kdump-howto.txt
|
%doc kexec-kdump-howto.txt
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Feb 22 2008 Neil Horman <nhorman@redhat.com> - 1.102pre-6
|
||||||
|
- Bringing rawhide up to date with bugfixes from RHEL5
|
||||||
|
- Adding patch to prevent kexec buffer overflow on ppc (bz 428684)
|
||||||
|
|
||||||
* Tue Feb 19 2008 Neil Horman <nhorman@redhat.com> - 1.102pre-5
|
* Tue Feb 19 2008 Neil Horman <nhorman@redhat.com> - 1.102pre-5
|
||||||
- Modifying mkdumprd to include dynamic executibles (bz 433350)
|
- Modifying mkdumprd to include dynamic executibles (bz 433350)
|
||||||
|
|
||||||
|
582
mkdumprd
582
mkdumprd
@ -25,6 +25,7 @@
|
|||||||
# Guillaume Cottenceau <gc@mandrakesoft.com>
|
# Guillaume Cottenceau <gc@mandrakesoft.com>
|
||||||
# Peter Jones <pjones@redhat.com>
|
# Peter Jones <pjones@redhat.com>
|
||||||
# Neil Horman <nhorman@redhat.com>
|
# Neil Horman <nhorman@redhat.com>
|
||||||
|
# Jarod Wilson <jwilson@redhat.com>
|
||||||
cmdname=`basename $0`
|
cmdname=`basename $0`
|
||||||
|
|
||||||
umask 0022
|
umask 0022
|
||||||
@ -68,6 +69,9 @@ vg_list=""
|
|||||||
net_list=""
|
net_list=""
|
||||||
USING_METHOD=""
|
USING_METHOD=""
|
||||||
SAVE_PATH=/var/crash
|
SAVE_PATH=/var/crash
|
||||||
|
bin=""
|
||||||
|
KDUMP_POST=""
|
||||||
|
extra_kdump_mods=""
|
||||||
|
|
||||||
vecho()
|
vecho()
|
||||||
{
|
{
|
||||||
@ -97,9 +101,7 @@ usage () {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
$cmd "usage: $cmdname [--version] [--help] [-v] [-d] [-f] [--preload <module>]"
|
$cmd "usage: $cmdname [--version] [--help] [-v] [-d] [-f] [--preload <module>]"
|
||||||
$cmd " [--force-ide-probe] [--force-scsi-probe | --omit-scsi-modules]"
|
$cmd " [--image-version] [--with-module]"
|
||||||
$cmd " [--image-version] [--force-scsi-probe | --omit-raid-modules]"
|
|
||||||
$cmd " [--with=<module>] [--force-lvm-probe | --omit-lvm-modules]"
|
|
||||||
$cmd " [--builtin=<module>] [--omit-dmraid]"
|
$cmd " [--builtin=<module>] [--omit-dmraid]"
|
||||||
$cmd " [--fstab=<fstab>] [--nocompress] <initrd-image> <kernel-version>"
|
$cmd " [--fstab=<fstab>] [--nocompress] <initrd-image> <kernel-version>"
|
||||||
$cmd ""
|
$cmd ""
|
||||||
@ -191,18 +193,26 @@ findmodule() {
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for modExt in o.gz o ko ; do
|
fmPath=$(modprobe --set-version $kernel -l $modName 2>/dev/null)
|
||||||
for modDir in /lib/modules/$kernel/updates /lib/modules/$kernel ; do
|
|
||||||
if [ -d $modDir ]; then
|
if [ ! -f "$fmPath" ]; then
|
||||||
|
for modExt in o.gz o ko
|
||||||
|
do
|
||||||
|
for modDir in /lib/modules/$kernel/updates /lib/modules/$kernel
|
||||||
|
do
|
||||||
|
if [ -d $modDir ]
|
||||||
|
then
|
||||||
fmPath=$(findone $modDir -name $modName.$modExt)
|
fmPath=$(findone $modDir -name $modName.$modExt)
|
||||||
if [ -f "$fmPath" ]; then
|
if [ -f "$fmPath" ]
|
||||||
|
then
|
||||||
break 2
|
break 2
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -f $fmPath ]; then
|
if [ ! -f "$fmPath" ]; then
|
||||||
if [ -n "$skiperrors" ]; then
|
if [ -n "$skiperrors" ]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@ -275,12 +285,13 @@ findstoragedriver () {
|
|||||||
continue ;;
|
continue ;;
|
||||||
*) handleddevices="$handleddevices $device" ;;
|
*) handleddevices="$handleddevices $device" ;;
|
||||||
esac
|
esac
|
||||||
if [[ "$device" =~ "md[0-9]+" ]]; then
|
if [[ "$device" == "md[0-9]+" ]]; then
|
||||||
vecho "Found RAID component $device"
|
vecho "Found RAID component $device"
|
||||||
handleraid "$device"
|
handleraid "$device"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
vecho "Looking for driver for device $device"
|
vecho "Looking for driver for device $device"
|
||||||
|
device=`echo $device | sed 's/\//\!/g'`
|
||||||
sysfs=$(findone -type d /sys/block -name $device)
|
sysfs=$(findone -type d /sys/block -name $device)
|
||||||
[ -z "$sysfs" ] && return
|
[ -z "$sysfs" ] && return
|
||||||
pushd $sysfs >/dev/null 2>&1
|
pushd $sysfs >/dev/null 2>&1
|
||||||
@ -716,7 +727,7 @@ if [ "x$PROBE" == "xyes" ]; then
|
|||||||
if [ "$rootfs" == "nfs" ]; then
|
if [ "$rootfs" == "nfs" ]; then
|
||||||
remote=$(echo $rootdev | cut -d : -f 1)
|
remote=$(echo $rootdev | cut -d : -f 1)
|
||||||
# FIXME: this doesn't handle ips properly
|
# FIXME: this doesn't handle ips properly
|
||||||
remoteip=$(host $remote | cut -d ' ' -f 4)
|
remoteip=$(getent hosts $remote | cut -d ' ' -f 1)
|
||||||
netdev=`/sbin/ip route get to $remoteip |sed 's|.*dev \(.*\).*|\1|g' |awk {'print $1;'} |head -n 1`
|
netdev=`/sbin/ip route get to $remoteip |sed 's|.*dev \(.*\).*|\1|g' |awk {'print $1;'} |head -n 1`
|
||||||
net_list="$net_list $netdev"
|
net_list="$net_list $netdev"
|
||||||
# check if it's root by label
|
# check if it's root by label
|
||||||
@ -840,104 +851,6 @@ if [ -z "$MNTIMAGE" -o -z "$IMAGE" ]; then
|
|||||||
error "Error creating temporaries. Try again"
|
error "Error creating temporaries. Try again"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ -n "$KDUMP_CONFIG_FILE" ]; then
|
|
||||||
while read type location; do
|
|
||||||
|
|
||||||
case "$type" in
|
|
||||||
net)
|
|
||||||
#grab remote host and xlate into numbers
|
|
||||||
rhost=`echo $location | sed 's/.*@//' | cut -d':' -f1`
|
|
||||||
USE_SSH=`echo $location | grep @`
|
|
||||||
if [ -n "$USE_SSH" ]; then
|
|
||||||
USING_METHOD="ssh"
|
|
||||||
else
|
|
||||||
USING_METHOD="nfs"
|
|
||||||
fi
|
|
||||||
need_dns=`echo $rhost|grep [a-zA-Z]`
|
|
||||||
[ -n "$need_dns" ] && rhost=`host $rhost|cut -d' ' -f4`
|
|
||||||
|
|
||||||
#find ethernet device used to route to remote host, ie eth0
|
|
||||||
netdev=`/sbin/ip route get to $rhost 2>&1`
|
|
||||||
[ $? != 0 ] && echo "Bad kdump location: $location" && exit 1
|
|
||||||
#the field in the ip output changes if we go to another subnet
|
|
||||||
OFF_SUBNET=`echo $netdev | grep via`
|
|
||||||
if [ -n "$OFF_SUBNET" ]
|
|
||||||
then
|
|
||||||
# we are going to a different subnet
|
|
||||||
netdev=`echo $netdev|awk '{print $5;}'|head -n 1`
|
|
||||||
else
|
|
||||||
# we are on the same subnet
|
|
||||||
netdev=`echo $netdev|awk '{print $3}'|head -n 1`
|
|
||||||
fi
|
|
||||||
|
|
||||||
#add the ethernet device to the list of modules
|
|
||||||
mkdir -p $MNTIMAGE/etc/network/
|
|
||||||
handlenetdev $netdev
|
|
||||||
echo $netdev >> $MNTIMAGE/etc/iface_to_activate
|
|
||||||
|
|
||||||
#load nfs modules, if needed
|
|
||||||
echo $location | grep -v "@" > /dev/null && findmodule nfs
|
|
||||||
;;
|
|
||||||
raw)
|
|
||||||
USING_METHOD="raw"
|
|
||||||
if (echo $location | egrep -q "^(LABEL|UUID)="); then
|
|
||||||
location=$(findfs $location)
|
|
||||||
fi
|
|
||||||
handlelvordev $location
|
|
||||||
;;
|
|
||||||
core_collector)
|
|
||||||
if [ -x /sbin/makedumpfile ]; then
|
|
||||||
CORE_COLLECTOR=$location
|
|
||||||
CORE_COLLECTOR=`echo $CORE_COLLECTOR | sed -e's/makedumpfile/makedumpfile -i \/etc\/makedumpfile.config --message-level 1/'`
|
|
||||||
else
|
|
||||||
echo "Cannot use the core_collector option on this arch"
|
|
||||||
rm -rf $MNTIMAGE
|
|
||||||
rm -rf $IMAGE
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
path)
|
|
||||||
SAVE_PATH=$location
|
|
||||||
;;
|
|
||||||
link_delay)
|
|
||||||
LINK_DELAY=$location
|
|
||||||
;;
|
|
||||||
default)
|
|
||||||
DEFAULT_ACTION=$location
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
IS_COMMENT=`echo $type | grep ^#.*$`
|
|
||||||
if [ -n "$IS_COMMENT" -o -z "$location" ]
|
|
||||||
then
|
|
||||||
#don't process comments or blank line
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
USING_METHOD="filesystem"
|
|
||||||
if (echo $location | egrep -q "^(LABEL|UUID)="); then
|
|
||||||
location=$(findfs $location)
|
|
||||||
fi
|
|
||||||
handlelvordev $location
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
done < $KDUMP_CONFIG_FILE
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$CORE_COLLECTOR" ]; then
|
|
||||||
if [ "$USING_METHOD" == "ssh" ] || [ "$USING_METHOD" == "raw" ]; then
|
|
||||||
echo "You may only use alternate core collectors with the NFS and Local Filesystem targets"
|
|
||||||
rm -rf $MNTIMAGE
|
|
||||||
rm -rf $IMAGE
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$USING_METHOD" ]
|
|
||||||
then
|
|
||||||
echo "Warning! Lack of dump target specification means core_collector option is ignored!"
|
|
||||||
CORE_COLLECTOR=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
#START BUILDING INITRD HERE
|
#START BUILDING INITRD HERE
|
||||||
@ -960,8 +873,145 @@ mkdir -p $MNTIMAGE/etc/network/if-down.d
|
|||||||
mkdir -p $MNTIMAGE/etc/network/if-post-down.d
|
mkdir -p $MNTIMAGE/etc/network/if-post-down.d
|
||||||
ln -s bin $MNTIMAGE/sbin
|
ln -s bin $MNTIMAGE/sbin
|
||||||
|
|
||||||
|
if [ -n "$KDUMP_CONFIG_FILE" ]; then
|
||||||
|
while read config_opt config_val; do
|
||||||
|
|
||||||
|
case "$config_opt" in
|
||||||
|
net)
|
||||||
|
#grab remote host and xlate into numbers
|
||||||
|
rhost=`echo $config_val | sed 's/.*@//' | cut -d':' -f1`
|
||||||
|
USE_SSH=`echo $config_val | grep @`
|
||||||
|
if [ -n "$USE_SSH" ]; then
|
||||||
|
USING_METHOD="ssh"
|
||||||
|
else
|
||||||
|
USING_METHOD="nfs"
|
||||||
|
fi
|
||||||
|
need_dns=`echo $rhost|grep [a-zA-Z]`
|
||||||
|
[ -n "$need_dns" ] && rhost=`getent hosts $rhost|cut -d' ' -f1`
|
||||||
|
|
||||||
|
#find ethernet device used to route to remote host, ie eth0
|
||||||
|
netdev=`/sbin/ip route get to $rhost 2>&1`
|
||||||
|
[ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
|
||||||
|
#the field in the ip output changes if we go to another subnet
|
||||||
|
OFF_SUBNET=`echo $netdev | grep via`
|
||||||
|
if [ -n "$OFF_SUBNET" ]
|
||||||
|
then
|
||||||
|
# we are going to a different subnet
|
||||||
|
netdev=`echo $netdev|awk '{print $5;}'|head -n 1`
|
||||||
|
else
|
||||||
|
# we are on the same subnet
|
||||||
|
netdev=`echo $netdev|awk '{print $3}'|head -n 1`
|
||||||
|
fi
|
||||||
|
|
||||||
|
#add the ethernet device to the list of modules
|
||||||
|
mkdir -p $MNTIMAGE/etc/network/
|
||||||
|
handlenetdev $netdev
|
||||||
|
echo $netdev >> $MNTIMAGE/etc/iface_to_activate
|
||||||
|
|
||||||
|
#load nfs modules, if needed
|
||||||
|
echo $config_val | grep -v "@" > /dev/null && findmodule nfs
|
||||||
|
;;
|
||||||
|
raw)
|
||||||
|
USING_METHOD="raw"
|
||||||
|
if (echo $config_val | egrep -q "^(LABEL|UUID)="); then
|
||||||
|
config_val=$(findfs $config_val)
|
||||||
|
fi
|
||||||
|
handlelvordev $config_val
|
||||||
|
;;
|
||||||
|
core_collector)
|
||||||
|
if [ -x /sbin/makedumpfile ]; then
|
||||||
|
CORE_COLLECTOR=$config_val
|
||||||
|
grep -q control_d /proc/xen/capabilities 2>/dev/null
|
||||||
|
if [ $? -eq 0 ]
|
||||||
|
then
|
||||||
|
if [ -e /sys/kernel/vmcoreinfo ]
|
||||||
|
then
|
||||||
|
CORE_COLLECTOR=`echo $CORE_COLLECTOR | sed -e's/makedumpfile/makedumpfile --message-level 1/'`
|
||||||
|
else
|
||||||
|
CORE_COLLECTOR=`echo $CORE_COLLECTOR | sed -e's/makedumpfile/makedumpfile --xen-vmcoreinfo \/etc\/makedumpfile.config --message-level 1/'`
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ -e /sys/kernel/vmcoreinfo ]
|
||||||
|
then
|
||||||
|
CORE_COLLECTOR=`echo $CORE_COLLECTOR | sed -e's/makedumpfile/makedumpfile --message-level 1/'`
|
||||||
|
else
|
||||||
|
CORE_COLLECTOR=`echo $CORE_COLLECTOR | sed -e's/makedumpfile/makedumpfile -i \/etc\/makedumpfile.config --message-level 1/'`
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Cannot use the core_collector option on this arch"
|
||||||
|
rm -rf $MNTIMAGE
|
||||||
|
rm -rf $IMAGE
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
path)
|
||||||
|
SAVE_PATH=$config_val
|
||||||
|
;;
|
||||||
|
link_delay)
|
||||||
|
LINK_DELAY=$config_val
|
||||||
|
;;
|
||||||
|
kdump_post)
|
||||||
|
KDUMP_POST=$config_val
|
||||||
|
if [ ! -x "$KDUMP_POST" ]; then
|
||||||
|
echo "$KDUMP_POST not executable or not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
bin="$bin $KDUMP_POST"
|
||||||
|
KDUMP_POST_INTERNAL=`echo $KDUMP_POST | sed -e's/\(^.*\/\)\(.*$\)/\/bin\/\2/'`
|
||||||
|
;;
|
||||||
|
kdump_pre)
|
||||||
|
KDUMP_PRE=$config_val
|
||||||
|
if [ ! -x "$KDUMP_PRE" ]; then
|
||||||
|
echo "$KDUMP_PRE not executable or not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
bin="$bin $KDUMP_PRE"
|
||||||
|
KDUMP_PRE_INTERNAL=`echo $KDUMP_PRE | sed -e's/\(^.*\/\)\(.*$\)/\/bin\/\2/'`
|
||||||
|
;;
|
||||||
|
extra_bins)
|
||||||
|
bin="$bin $config_val"
|
||||||
|
;;
|
||||||
|
extra_modules)
|
||||||
|
extra_kdump_mods="$extra_kdump_mods $config_val"
|
||||||
|
;;
|
||||||
|
default)
|
||||||
|
DEFAULT_ACTION=$config_val
|
||||||
|
case $DEFAULT_ACTION in
|
||||||
|
reboot|shell)
|
||||||
|
FINAL_ACTION="reboot -f"
|
||||||
|
;;
|
||||||
|
halt)
|
||||||
|
FINAL_ACTION="halt -f"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
IS_COMMENT=`echo $config_opt | grep ^#.*$`
|
||||||
|
if [ -n "$IS_COMMENT" -o -z "$config_val" ]
|
||||||
|
then
|
||||||
|
#don't process comments or blank line
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
USING_METHOD="filesystem"
|
||||||
|
if (echo $config_val | egrep -q "^(LABEL|UUID)="); then
|
||||||
|
config_val=$(findfs $config_val)
|
||||||
|
fi
|
||||||
|
handlelvordev $config_val
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
done < $KDUMP_CONFIG_FILE
|
||||||
|
fi
|
||||||
|
|
||||||
#if we are using makedumpfile here, then generate the config file
|
#if we are using makedumpfile here, then generate the config file
|
||||||
if [ -n "$CORE_COLLECTOR" ]; then
|
#also only build this config if we don't have vmcoreinfo on this kernel
|
||||||
|
if [ -n "$CORE_COLLECTOR" -a ! -e /sys/kernel/vmcoreinfo ]; then
|
||||||
|
if [ -z "$USING_METHOD" ]
|
||||||
|
then
|
||||||
|
echo "Warning! Lack of dump target specification means core_collector option is ignored!"
|
||||||
|
CORE_COLLECTOR=""
|
||||||
|
else
|
||||||
RUN_KERN_VER=`uname -r`
|
RUN_KERN_VER=`uname -r`
|
||||||
if [ ! -f /usr/lib/debug/lib/modules/$RUN_KERN_VER/vmlinux ]
|
if [ ! -f /usr/lib/debug/lib/modules/$RUN_KERN_VER/vmlinux ]
|
||||||
then
|
then
|
||||||
@ -971,15 +1021,51 @@ if [ -n "$CORE_COLLECTOR" ]; then
|
|||||||
rm -rf $IMAGE
|
rm -rf $IMAGE
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
/sbin/makedumpfile -g $MNTIMAGE/etc/makedumpfile.config -x
|
XEN_OPTS=""
|
||||||
/usr/lib/debug/lib/modules/$RUN_KERN_VER/vmlinux > /dev/null 2>&1
|
grep -q control_d /proc/xen/capabilities 2>/dev/null
|
||||||
|
if [ $? -eq 0 ]
|
||||||
|
then
|
||||||
|
# This is a dom0 xen kernel so we need to add xen-syms to the
|
||||||
|
# makedumpefile config
|
||||||
|
RUN_XEN_VER=${RUN_KERN_VER%xen}
|
||||||
|
if [ ! -f /usr/lib/debug/boot/xen-syms-$RUN_XEN_VER.debug ]
|
||||||
|
then
|
||||||
|
echo "xen-syms.debug not found and is needed on this kernel to use makedumpfile!"
|
||||||
|
echo "please install it and restart the kdump service"
|
||||||
|
rm -rf $MNTIMAGE
|
||||||
|
rm -rf $IMAGE
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
XEN_OPTS="--xen-syms /usr/lib/debug/boot/xen-syms-$RUN_XEN_VER.debug"
|
||||||
|
/sbin/makedumpfile -g $MNTIMAGE/etc/makedumpfile.config $XEN_OPTS > /dev/null 2>&1
|
||||||
|
else
|
||||||
|
/sbin/makedumpfile -g $MNTIMAGE/etc/makedumpfile.config -x /usr/lib/debug/lib/modules/$RUN_KERN_VER/vmlinux > /dev/null 2>&1
|
||||||
|
fi
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
echo "could not generate makedumpfile configuration. aborting"
|
echo "could not generate makedumpfile configuration. aborting"
|
||||||
rm -rf $MNTIMAGE
|
rm -rf $MNTIMAGE
|
||||||
rm -rf $IMAGE
|
rm -rf $IMAGE
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#include extra user-specified modules for kdump initrd
|
||||||
|
for n in $extra_kdump_mods; do
|
||||||
|
findmodule $n
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -z "$FINAL_ACTION" ]; then
|
||||||
|
FINAL_ACTION="reboot -f"
|
||||||
|
else
|
||||||
|
if [ -z "$USING_METHOD" ]; then
|
||||||
|
echo "Warning! Lack of dump target specification means default option is ignored!"
|
||||||
|
DEFAULT_ACTION=""
|
||||||
|
FINAL_ACTION="reboot -f"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
#copy in busybox and make symlinks to its supported utilities
|
#copy in busybox and make symlinks to its supported utilities
|
||||||
cp /sbin/busybox $MNTIMAGE/sbin/busybox
|
cp /sbin/busybox $MNTIMAGE/sbin/busybox
|
||||||
cd $MNTIMAGE/sbin
|
cd $MNTIMAGE/sbin
|
||||||
@ -991,6 +1077,16 @@ do
|
|||||||
done
|
done
|
||||||
cd - > /dev/null 2>&1
|
cd - > /dev/null 2>&1
|
||||||
|
|
||||||
|
if [ -f /etc/mdadm.conf ]
|
||||||
|
then
|
||||||
|
cp /etc/mdadm.conf $MNTIMAGE/etc
|
||||||
|
bin="$bin /sbin/mdadm"
|
||||||
|
for i in `cat /etc/mdadm.conf | grep ARRAY | sed -e's/\(^.*level=\)\(.*$\)/\2/' | cut -d" " -f1`
|
||||||
|
do
|
||||||
|
findmodule $i
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
#THIS IS WHERE WE GENERATE OUR ADDITINONAL UTILITIES
|
#THIS IS WHERE WE GENERATE OUR ADDITINONAL UTILITIES
|
||||||
#Busybox doesn't have a /bin/sh applet,
|
#Busybox doesn't have a /bin/sh applet,
|
||||||
#so we build a reasonable faximilie here
|
#so we build a reasonable faximilie here
|
||||||
@ -1356,10 +1452,19 @@ done
|
|||||||
# this will make sure that we have all of our devices before trying
|
# this will make sure that we have all of our devices before trying
|
||||||
# things like RAID or LVM
|
# things like RAID or LVM
|
||||||
emit "echo Creating Block Devices"
|
emit "echo Creating Block Devices"
|
||||||
|
emit "mkdir /dev/cciss"
|
||||||
|
emit "mkdir /dev/ida"
|
||||||
emit "for i in \`ls /sys/block\`; do"
|
emit "for i in \`ls /sys/block\`; do"
|
||||||
emit " MAJOR_NUM=\`cat /sys/block/\$i/dev | cut -d":" -f1\`"
|
emit " MAJOR_NUM=\`cat /sys/block/\$i/dev | cut -d":" -f1\`"
|
||||||
emit " MINOR_NUM=\`cat /sys/block/\$i/dev | cut -d":" -f2\`"
|
emit " MINOR_NUM=\`cat /sys/block/\$i/dev | cut -d":" -f2\`"
|
||||||
emit " MINOR_RANGE=\`cat /sys/block/\$i/range | cut -d":" -f2\`"
|
emit " MINOR_RANGE=\`cat /sys/block/\$i/range | cut -d":" -f2\`"
|
||||||
|
emit " PART_SEP=''"
|
||||||
|
emit " i=\`echo \$i | sed 's/\!/\//g'\`"
|
||||||
|
emit " if echo \$i | grep -q '^cciss'; then"
|
||||||
|
emit " PART_SEP='p'"
|
||||||
|
emit " elif echo \$i | grep -q '^ida'; then"
|
||||||
|
emit " PART_SEP='p'"
|
||||||
|
emit " fi"
|
||||||
emit " echo Creating block device \$i"
|
emit " echo Creating block device \$i"
|
||||||
emit " mknod /dev/\$i b \$MAJOR_NUM \$MINOR_NUM"
|
emit " mknod /dev/\$i b \$MAJOR_NUM \$MINOR_NUM"
|
||||||
emit " if [ \"\$MINOR_RANGE\" -gt 1 ]"
|
emit " if [ \"\$MINOR_RANGE\" -gt 1 ]"
|
||||||
@ -1371,12 +1476,21 @@ emit " for j in \`seq \$MINOR_START 1 \$MINOR_END\`"
|
|||||||
emit " do"
|
emit " do"
|
||||||
emit " if [ ! -e /dev/\$i\$PART_NUM ]"
|
emit " if [ ! -e /dev/\$i\$PART_NUM ]"
|
||||||
emit " then"
|
emit " then"
|
||||||
emit " mknod /dev/\$i\$PART_NUM b \$MAJOR_NUM \$j"
|
emit " mknod /dev/\$i\$PART_SEP\$PART_NUM b \$MAJOR_NUM \$j"
|
||||||
emit " fi"
|
emit " fi"
|
||||||
emit " PART_NUM=\`expr \$PART_NUM + 1\`"
|
emit " PART_NUM=\`expr \$PART_NUM + 1\`"
|
||||||
emit " done"
|
emit " done"
|
||||||
emit " fi"
|
emit " fi"
|
||||||
emit "done"
|
emit "done"
|
||||||
|
#now do any software raid devices we might have
|
||||||
|
emit "if [ -f /etc/mdadm.conf ]"
|
||||||
|
emit "then"
|
||||||
|
emit " for i in \`awk '/.*ARRAY.*/{print \$2}' /etc/mdadm.conf\`"
|
||||||
|
emit " do"
|
||||||
|
emit " MD_MIN=\`echo \$i | sed -e's/\(^.*\)\([0-9]\+$\)/\2/'\`"
|
||||||
|
emit " mknod \$i b 9 \$MD_MIN"
|
||||||
|
emit " done"
|
||||||
|
emit "fi"
|
||||||
|
|
||||||
if [ -n "$vg_list" ]; then
|
if [ -n "$vg_list" ]; then
|
||||||
emit "echo Making device-mapper control node"
|
emit "echo Making device-mapper control node"
|
||||||
@ -1402,6 +1516,11 @@ if [ -n "$raiddevices" ]; then
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
emit "if [ -f /etc/mdadm.conf ]"
|
||||||
|
emit "then"
|
||||||
|
emit " mdadm -A -s"
|
||||||
|
emit "fi"
|
||||||
|
|
||||||
if [ -n "$vg_list" ]; then
|
if [ -n "$vg_list" ]; then
|
||||||
emit "echo Scanning logical volumes"
|
emit "echo Scanning logical volumes"
|
||||||
emit "lvm vgscan --ignorelockingfailure --mknodes"
|
emit "lvm vgscan --ignorelockingfailure --mknodes"
|
||||||
@ -1431,6 +1550,7 @@ kdump_chk()
|
|||||||
echo "$KDUMP_CONFIG_FILE: $2"
|
echo "$KDUMP_CONFIG_FILE: $2"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -n "$KDUMP_CONFIG_FILE" ]; then
|
if [ -n "$KDUMP_CONFIG_FILE" ]; then
|
||||||
memtotal=`cat /proc/meminfo | grep MemTotal | awk '{print $2}'`
|
memtotal=`cat /proc/meminfo | grep MemTotal | awk '{print $2}'`
|
||||||
|
|
||||||
@ -1459,32 +1579,52 @@ if [ -n "$KDUMP_CONFIG_FILE" ]; then
|
|||||||
k_extras="/$lib/libnss_compat.so.2 /$lib/libnss_files.so.2"
|
k_extras="/$lib/libnss_compat.so.2 /$lib/libnss_files.so.2"
|
||||||
|
|
||||||
#traverse the config file and setup each dump location
|
#traverse the config file and setup each dump location
|
||||||
while read type location; do
|
while read config_opt config_val; do
|
||||||
[ -z "$type" ] && continue #skip empty lines
|
[ -z "$config_opt" ] && continue #skip empty lines
|
||||||
[ "`echo $type| grep ^# `" ] && continue #skip comments
|
[ "`echo $config_opt | grep ^# `" ] && continue #skip comments
|
||||||
kdump_chk "test -n \"$location\"" "Need a location for $type"
|
kdump_chk "test -n \"$config_val\"" "Need a location for $config_opt"
|
||||||
|
|
||||||
case "$type" in
|
case "$config_opt" in
|
||||||
\#*) continue;; #skip comments
|
\#*) continue;; #skip comments
|
||||||
|
|
||||||
raw)
|
raw)
|
||||||
#test raw partition
|
#test raw partition
|
||||||
kdump_chk "dd if=$location count=1 of=/dev/null > /dev/null 2>&1" \
|
kdump_chk "dd if=$config_val count=1 of=/dev/null > /dev/null 2>&1" \
|
||||||
"Bad raw partition $location"
|
"Bad raw partition $config_val"
|
||||||
#check for available size is greater than $memtotal
|
#check for available size is greater than $memtotal
|
||||||
available_size=$(fdisk -s $location)
|
available_size=$(fdisk -s $config_val)
|
||||||
if [ $available_size -lt $memtotal ]; then
|
if [ $available_size -lt $memtotal ]; then
|
||||||
echo "Warning: There is not space enough to save a vmcore."
|
echo "Warning: There is not space enough to save a vmcore."
|
||||||
echo " The size of $config_val should be much greater than $memtotal kilo bytes."
|
echo " The size of $config_val should be much greater than $memtotal kilo bytes."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#setup raw case
|
#setup raw case
|
||||||
emit "echo Saving to partition $location"
|
if [ -n "$KDUMP_PRE_INTERNAL" ]
|
||||||
emit "dd if=/proc/vmcore of=$location"
|
then
|
||||||
emit "if [ \$? == 0 ]"
|
emit "$KDUMP_PRE_INTERNAL"
|
||||||
|
emit "if [ $? -ne 0 ]"
|
||||||
emit "then"
|
emit "then"
|
||||||
emit " reboot -f"
|
emit " echo kdump_pre script exited with non-zero status"
|
||||||
|
emit " $FINAL_ACTION"
|
||||||
emit "fi"
|
emit "fi"
|
||||||
|
fi
|
||||||
|
emit "echo Saving to partition $config_val"
|
||||||
|
if [ -z "$CORE_COLLECTOR" ]
|
||||||
|
then
|
||||||
|
emit "dd if=/proc/vmcore of=$config_val"
|
||||||
|
else
|
||||||
|
CORE_COLLECTOR=`echo $CORE_COLLECTOR | sed -e's/\(^makedumpfile\)\(.*$\)/\1 -F \2/'`
|
||||||
|
emit "$CORE_COLLECTOR /proc/vmcore | dd of=$config_val"
|
||||||
|
fi
|
||||||
|
emit "exitcode=\$?"
|
||||||
|
emit "if [ \$exitcode == 0 ]"
|
||||||
|
emit "then"
|
||||||
|
emit " echo \"Saving core complete\""
|
||||||
|
emit "fi"
|
||||||
|
if [ -x "$KDUMP_POST" ]; then
|
||||||
|
emit "$KDUMP_POST \$exitcode"
|
||||||
|
fi
|
||||||
|
emit "[ \$exitcode == 0 ] && $FINAL_ACTION"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
net)
|
net)
|
||||||
@ -1509,20 +1649,17 @@ if [ -n "$KDUMP_CONFIG_FILE" ]; then
|
|||||||
then
|
then
|
||||||
emit " echo \"Dropping to shell. exit to reboot\""
|
emit " echo \"Dropping to shell. exit to reboot\""
|
||||||
emit " /bin/msh"
|
emit " /bin/msh"
|
||||||
emit " reboot -f"
|
|
||||||
elif [ "$DEFAULT_ACTION" == "reboot" ]
|
|
||||||
then
|
|
||||||
emit " reboot -f"
|
|
||||||
fi
|
fi
|
||||||
|
emit " $FINAL_ACTION"
|
||||||
emit "fi"
|
emit "fi"
|
||||||
#grab remote host and xlate into numbers
|
#grab remote host and xlate into numbers
|
||||||
rhost=`echo $location | sed 's/.*@//' | cut -d':' -f1`
|
rhost=`echo $config_val | sed 's/.*@//' | cut -d':' -f1`
|
||||||
need_dns=`echo $rhost|grep [a-zA-Z]`
|
need_dns=`echo $rhost|grep [a-zA-Z]`
|
||||||
[ -n "$need_dns" ] && rhost=`host $rhost|cut -d' ' -f4`
|
[ -n "$need_dns" ] && rhost=`getent hosts $rhost|cut -d' ' -f1`
|
||||||
|
|
||||||
#find the local ip being used as a route to remote ip
|
#find the local ip being used as a route to remote ip
|
||||||
netdev=`/sbin/ip route get to $rhost 2>&1`
|
netdev=`/sbin/ip route get to $rhost 2>&1`
|
||||||
[ $? != 0 ] && echo "Bad kdump location: $location" && exit 1
|
[ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
|
||||||
OFF_SUBNET=`echo $netdev | grep via`
|
OFF_SUBNET=`echo $netdev | grep via`
|
||||||
if [ -n "$OFF_SUBNET" ]
|
if [ -n "$OFF_SUBNET" ]
|
||||||
then
|
then
|
||||||
@ -1533,14 +1670,14 @@ if [ -n "$KDUMP_CONFIG_FILE" ]; then
|
|||||||
lhost=`echo $netdev|awk '{print $5}'|head -n 1`
|
lhost=`echo $netdev|awk '{print $5}'|head -n 1`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
emit "echo Saving to remote location $location"
|
emit "echo Saving to remote location $config_val"
|
||||||
if [ -z "`echo $location|grep @`" ]; then
|
if [ -z "`echo $config_val|grep @`" ]; then
|
||||||
#NFS path
|
#NFS path
|
||||||
#test nfs mount and directory creation
|
#test nfs mount and directory creation
|
||||||
rlocation=`echo $location| sed 's/.*:/'"$rhost"':/'`
|
rlocation=`echo $config_val| sed 's/.*:/'"$rhost"':/'`
|
||||||
tmnt=`mktemp -dq`
|
tmnt=`mktemp -dq`
|
||||||
kdump_chk "mount -t nfs -o nolock $rlocation $tmnt" \
|
kdump_chk "mount -t nfs -o nolock $rlocation $tmnt" \
|
||||||
"Bad NFS mount $location"
|
"Bad NFS mount $config_val"
|
||||||
mkdir -p $tmnt/$SAVE_PATH
|
mkdir -p $tmnt/$SAVE_PATH
|
||||||
tdir=`mktemp -dqp $tmnt/$SAVE_PATH`
|
tdir=`mktemp -dqp $tmnt/$SAVE_PATH`
|
||||||
available_size=$(df -P $tdir | tail -1 | tr -s ' ' ':' | cut -d: -f5)
|
available_size=$(df -P $tdir | tail -1 | tr -s ' ' ':' | cut -d: -f5)
|
||||||
@ -1553,7 +1690,7 @@ if [ -n "$KDUMP_CONFIG_FILE" ]; then
|
|||||||
fi
|
fi
|
||||||
rm -rf $tmnt
|
rm -rf $tmnt
|
||||||
if [ $rc != "0" ]; then
|
if [ $rc != "0" ]; then
|
||||||
echo "Cannot create directory in $location: $SAVE_PATH"
|
echo "Cannot create directory in $config_val: $SAVE_PATH"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -1564,40 +1701,62 @@ if [ -n "$KDUMP_CONFIG_FILE" ]; then
|
|||||||
#check for available size is greater than $memtotal
|
#check for available size is greater than $memtotal
|
||||||
if [ $available_size -lt $memtotal ]; then
|
if [ $available_size -lt $memtotal ]; then
|
||||||
echo "Warning: There is not space enough to save a vmcore."
|
echo "Warning: There is not space enough to save a vmcore."
|
||||||
echo " The size of $location should be much greater than $memtotal kilo bytes."
|
echo " The size of $config_val should be much greater than $memtotal kilo bytes."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#setup nfs case
|
#setup nfs case
|
||||||
|
if [ -n "$KDUMP_PRE_INTERNAL" ]
|
||||||
|
then
|
||||||
|
emit "$KDUMP_PRE_INTERNAL"
|
||||||
|
emit "if [ $? -ne 0 ]"
|
||||||
|
emit "then"
|
||||||
|
emit " echo kdump_pre script exited with non-zero status"
|
||||||
|
emit " $FINAL_ACTION"
|
||||||
|
emit "fi"
|
||||||
|
fi
|
||||||
|
|
||||||
mkdir -p $MNTIMAGE/mnt
|
mkdir -p $MNTIMAGE/mnt
|
||||||
emit "mount -t nfs -o nolock $rlocation /mnt"
|
emit "mount -t nfs -o nolock $rlocation /mnt"
|
||||||
emit "if [ \$? == 0 ]"
|
emit "if [ \$? == 0 ]"
|
||||||
emit "then"
|
emit "then"
|
||||||
emit " mkdir -p /mnt/$SAVE_PATH/$lhost-\$DATE"
|
emit " mkdir -p /mnt/$SAVE_PATH/$lhost-\$DATE"
|
||||||
emit " $CORE_COLLECTOR /proc/vmcore /mnt/$SAVE_PATH/$lhost-\$DATE/vmcore-incomplete"
|
emit " VMCORE=/mnt/$SAVE_PATH/$lhost-\$DATE/vmcore"
|
||||||
emit " if [ \$? == 0 ]"
|
emit " export VMCORE"
|
||||||
|
emit " $CORE_COLLECTOR /proc/vmcore \$VMCORE-incomplete >/dev/null"
|
||||||
|
emit " exitcode=\$?"
|
||||||
|
emit " if [ \$exitcode == 0 ]"
|
||||||
emit " then"
|
emit " then"
|
||||||
emit " mv /mnt/$SAVE_PATH/$lhost-\$DATE/vmcore-incomplete /mnt/$SAVE_PATH/$lhost-\$DATE/vmcore"
|
emit " mv \$VMCORE-incomplete \$VMCORE"
|
||||||
emit " umount /mnt"
|
emit " echo \"Saving core complete\""
|
||||||
emit " reboot -f"
|
|
||||||
emit " fi"
|
emit " fi"
|
||||||
|
if [ -x "$KDUMP_POST" ]; then
|
||||||
|
emit " $KDUMP_POST \$exitcode"
|
||||||
|
fi
|
||||||
emit " umount /mnt"
|
emit " umount /mnt"
|
||||||
|
emit " [ \$exitcode == 0 ] && $FINAL_ACTION"
|
||||||
emit "fi"
|
emit "fi"
|
||||||
else
|
else
|
||||||
#SSH path
|
#SSH path
|
||||||
#rebuild $location replacing machine name with ip address
|
#rebuild $config_val replacing machine name with ip address
|
||||||
|
if [ -n "$CORE_COLLECTOR" ]
|
||||||
|
then
|
||||||
|
CORE_COLLECTOR=`echo $CORE_COLLECTOR | sed -e's/\(^makedumpfile\)\(.*$\)/\1 -F \2/'`
|
||||||
|
fi
|
||||||
|
|
||||||
bin="$bin /usr/bin/ssh /usr/bin/scp"
|
bin="$bin /usr/bin/ssh /usr/bin/scp"
|
||||||
rlocation=`echo $location|sed 's/@.*/@'"$rhost"'/'`
|
rlocation=`echo $config_val|sed 's/@.*/@'"$rhost"'/'`
|
||||||
#test ssh path and directory creation
|
#test ssh path and directory creation
|
||||||
s_opts="-o BatchMode=yes -o StrictHostKeyChecking=no"
|
s_opts="-o BatchMode=yes -o StrictHostKeyChecking=no"
|
||||||
kdump_chk "ssh -q $s_opts $rlocation mkdir -p $SAVE_PATH </dev/null" \
|
kdump_chk "ssh -q $s_opts $rlocation mkdir -p $SAVE_PATH </dev/null" \
|
||||||
"Could not create $location:$SAVE_PATH, you probably need to run \"service kdump propagate\""
|
"Could not create $config_val:$SAVE_PATH, you probably need to run \"service kdump propagate\""
|
||||||
tdir=`ssh -q $s_opts $rlocation mktemp -dqp $SAVE_PATH </dev/null`
|
tdir=`ssh -q $s_opts $rlocation mktemp -dqp $SAVE_PATH </dev/null`
|
||||||
if [ $? != "0" ]; then
|
if [ $? != "0" ]; then
|
||||||
echo "$KDUMP_CONFIG_FILE: Could not create temp directory in $location:$SAVE_PATH"
|
echo "$KDUMP_CONFIG_FILE: Could not create temp directory in $config_val:$SAVE_PATH"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
remote_df=`ssh -q $s_opts $rlocation df $tdir`
|
|
||||||
available_size=$(echo $remote_df | tail -1 | tr -s ' ' '|' | cut -d\| -f10)
|
remote_df=`ssh -q $s_opts $rlocation df -P $tdir | tail -1`
|
||||||
|
available_size=$(echo $remote_df | tr -s ' ' '|' | cut -d\| -f4)
|
||||||
|
|
||||||
#check for available size is greater than $memtotal
|
#check for available size is greater than $memtotal
|
||||||
if [ $available_size -lt $memtotal ]; then
|
if [ $available_size -lt $memtotal ]; then
|
||||||
@ -1608,6 +1767,16 @@ if [ -n "$KDUMP_CONFIG_FILE" ]; then
|
|||||||
ssh -q $s_opts $rlocation rmdir $tdir
|
ssh -q $s_opts $rlocation rmdir $tdir
|
||||||
|
|
||||||
#setup ssh case, quick check to see if setup already
|
#setup ssh case, quick check to see if setup already
|
||||||
|
if [ -n "$KDUMP_PRE_INTERNAL" ]
|
||||||
|
then
|
||||||
|
emit "$KDUMP_PRE_INTERNAL"
|
||||||
|
emit "if [ $? -ne 0 ]"
|
||||||
|
emit "then"
|
||||||
|
emit " echo kdump_pre script exited with non-zero status"
|
||||||
|
emit " $FINAL_ACTION"
|
||||||
|
emit "fi"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -r $MNTIMAGE/dev/urandom ]; then
|
if [ ! -r $MNTIMAGE/dev/urandom ]; then
|
||||||
#only need to do these once
|
#only need to do these once
|
||||||
mkdir -p $MNTIMAGE/root
|
mkdir -p $MNTIMAGE/root
|
||||||
@ -1617,16 +1786,39 @@ if [ -n "$KDUMP_CONFIG_FILE" ]; then
|
|||||||
fi
|
fi
|
||||||
emit "dd if=/dev/mem of=/dev/urandom count=1 bs=512 skip=100"
|
emit "dd if=/dev/mem of=/dev/urandom count=1 bs=512 skip=100"
|
||||||
emit "ssh -q -o BatchMode=yes -o StrictHostKeyChecking=no $rlocation mkdir $SAVE_PATH/$lhost-\$DATE"
|
emit "ssh -q -o BatchMode=yes -o StrictHostKeyChecking=no $rlocation mkdir $SAVE_PATH/$lhost-\$DATE"
|
||||||
emit "scp -q -o BatchMode=yes -o StrictHostKeyChecking=no /proc/vmcore $rlocation:$SAVE_PATH/$lhost-\$DATE/vmcore-incomplete"
|
emit "VMCORE=$SAVE_PATH/$lhost-\$DATE/vmcore"
|
||||||
emit "if [ \$? == 0 ]"
|
emit "export VMCORE"
|
||||||
|
if [ -z "$CORE_COLLECTOR" ]
|
||||||
|
then
|
||||||
|
emit "scp -q -o BatchMode=yes -o StrictHostKeyChecking=no /proc/vmcore $rlocation:\$VMCORE-incomplete"
|
||||||
|
else
|
||||||
|
emit "$CORE_COLLECTOR /proc/vmcore | ssh -o BatchMode=yes -o StrictHostKeyChecking=no $rlocation \"cat > $SAVE_PATH/$lhost-\$DATE/vmcore-incomplete\""
|
||||||
|
fi
|
||||||
|
emit "exitcode=\$?"
|
||||||
|
emit "if [ \$exitcode == 0 ]"
|
||||||
emit "then"
|
emit "then"
|
||||||
emit " ssh -q -o BatchMode=yes -o StrictHostKeyChecking=no $rlocation mv $SAVE_PATH/$lhost-\$DATE/vmcore-incomplete $SAVE_PATH/$lhost-\$DATE/vmcore"
|
if [ -z "$CORE_COLLECTOR" ]
|
||||||
emit " reboot -f"
|
then
|
||||||
|
emit " ssh -q -o BatchMode=yes -o StrictHostKeyChecking=no $rlocation mv \$VMCORE-incomplete \$VMCORE"
|
||||||
|
else
|
||||||
|
emit " ssh -q -o BatchMode=yes -o StrictHostKeyChecking=no $rlocation mv \$VMCORE-incomplete \$VMCORE.flat"
|
||||||
|
fi
|
||||||
|
emit " echo \"Saving core complete\""
|
||||||
emit "fi"
|
emit "fi"
|
||||||
|
if [ -x "$KDUMP_POST" ]; then
|
||||||
|
emit "$KDUMP_POST \$exitcode"
|
||||||
|
fi
|
||||||
|
emit "[ \$exitcode == 0 ] && $FINAL_ACTION"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
core_collector)
|
core_collector)
|
||||||
;;
|
;;
|
||||||
|
kdump_post)
|
||||||
|
;;
|
||||||
|
extra_bins)
|
||||||
|
;;
|
||||||
|
extra_modules)
|
||||||
|
;;
|
||||||
default)
|
default)
|
||||||
;;
|
;;
|
||||||
link_delay)
|
link_delay)
|
||||||
@ -1635,52 +1827,71 @@ if [ -n "$KDUMP_CONFIG_FILE" ]; then
|
|||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
#test filesystem and directory creation
|
#test filesystem and directory creation
|
||||||
kdump_chk "test -f /sbin/fsck.$type" "Unsupported type $type"
|
kdump_chk "test -f /sbin/fsck.$config_opt" "Unsupported type $config_opt"
|
||||||
tmnt=`mktemp -dq`
|
tmnt=`mktemp -dq`
|
||||||
kdump_chk "mount -t $type $location $tmnt" "Bad mount point $location"
|
kdump_chk "mount -t $config_opt $config_val $tmnt" "Bad mount point $config_val"
|
||||||
mkdir -p $tmnt/$SAVE_PATH
|
mkdir -p $tmnt/$SAVE_PATH
|
||||||
tdir=`mktemp -dqp $tmnt/$SAVE_PATH`
|
tdir=`mktemp -dqp $tmnt/$SAVE_PATH`
|
||||||
|
rc=$?
|
||||||
available_size=$(df $tdir | tail -1 | tr -s ' ' ':' | cut -d: -f4)
|
available_size=$(df $tdir | tail -1 | tr -s ' ' ':' | cut -d: -f4)
|
||||||
rc=$? && rm -rf $tdir && umount $tmnt
|
rm -rf $tdir > /dev/null 2>&1
|
||||||
|
umount $tmnt > /dev/null 2>&1
|
||||||
if [ $rc != "0" ]; then
|
if [ $rc != "0" ]; then
|
||||||
echo "Cannot create directory in $location: $SAVE_PATH"
|
echo "Cannot create directory in $config_val: $SAVE_PATH"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
#check for available size is greater than $memtotal
|
#check for available size is greater than $memtotal
|
||||||
if [ $available_size -lt $memtotal ]; then
|
if [ $available_size -lt $memtotal ]; then
|
||||||
echo "Warning: There is not space enough to save a vmcore."
|
echo "Warning: There is not space enough to save a vmcore."
|
||||||
echo " The size of $location should be much greater than $memtotal kilo bytes."
|
echo " The size of $config_val should be much greater than $memtotal kilo bytes."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
#setup filesystem case
|
#setup filesystem case
|
||||||
|
|
||||||
|
if [ -n "$KDUMP_PRE_INTERNAL" ]
|
||||||
|
then
|
||||||
|
emit "$KDUMP_PRE_INTERNAL"
|
||||||
|
emit "if [ $? -ne 0 ]"
|
||||||
|
emit "then"
|
||||||
|
emit " echo kdump_pre script exited with non-zero status"
|
||||||
|
emit " $FINAL_ACTION"
|
||||||
|
emit "fi"
|
||||||
|
fi
|
||||||
|
|
||||||
mkdir -p $MNTIMAGE/mnt
|
mkdir -p $MNTIMAGE/mnt
|
||||||
touch $MNTIMAGE/etc/mtab
|
touch $MNTIMAGE/etc/mtab
|
||||||
if [ -z "$CORE_COLLECTOR" ]; then
|
if [ -z "$CORE_COLLECTOR" ]; then
|
||||||
CORE_COLLECTOR="cp"
|
CORE_COLLECTOR="cp"
|
||||||
fi
|
fi
|
||||||
emit "echo Saving to the local filesystem $location"
|
emit "echo Saving to the local filesystem $config_val"
|
||||||
emit "DUMPDEV=$location"
|
emit "DUMPDEV=$config_val"
|
||||||
emit "IS_LABEL=\`echo \$DUMPDEV | grep LABEL\`"
|
emit "IS_LABEL=\`echo \$DUMPDEV | grep LABEL\`"
|
||||||
emit "IS_UUID=\`echo \$DUMPDEV | grep UUID\`"
|
emit "IS_UUID=\`echo \$DUMPDEV | grep UUID\`"
|
||||||
emit "if [ -n \"\$IS_LABEL\" -o -n \"\$IS_UUID\" ] "
|
emit "if [ -n \"\$IS_LABEL\" -o -n \"\$IS_UUID\" ] "
|
||||||
emit "then"
|
emit "then"
|
||||||
emit " DUMPDEV=\`findfs \$DUMPDEV\`"
|
emit " DUMPDEV=\`findfs \$DUMPDEV\`"
|
||||||
emit "fi"
|
emit "fi"
|
||||||
emit "fsck.$type \$DUMPDEV"
|
emit "fsck.$config_opt \$DUMPDEV"
|
||||||
emit "mount -t $type \$DUMPDEV /mnt"
|
emit "mount -t $config_opt \$DUMPDEV /mnt"
|
||||||
emit "if [ \$? == 0 ]"
|
emit "if [ \$? == 0 ]"
|
||||||
emit "then"
|
emit "then"
|
||||||
emit " mkdir -p /mnt/$SAVE_PATH/127.0.0.1-\$DATE"
|
emit " mkdir -p /mnt/$SAVE_PATH/127.0.0.1-\$DATE"
|
||||||
emit " $CORE_COLLECTOR /proc/vmcore /mnt/$SAVE_PATH/127.0.0.1-\$DATE/vmcore-incomplete"
|
emit " VMCORE=/mnt/$SAVE_PATH/127.0.0.1-\$DATE/vmcore"
|
||||||
emit " if [ \$? == 0 ]"
|
emit " export VMCORE"
|
||||||
|
emit " $CORE_COLLECTOR /proc/vmcore \$VMCORE-incomplete >/dev/null"
|
||||||
|
emit " exitcode=\$?"
|
||||||
|
emit " if [ \$exitcode == 0 ]"
|
||||||
emit " then"
|
emit " then"
|
||||||
emit " mv /mnt/$SAVE_PATH/127.0.0.1-\$DATE/vmcore-incomplete /mnt/$SAVE_PATH/127.0.0.1-\$DATE/vmcore"
|
emit " mv \$VMCORE-incomplete \$VMCORE"
|
||||||
emit " umount /mnt"
|
emit " echo \"Saving core complete\""
|
||||||
emit " reboot -f"
|
|
||||||
emit " fi"
|
emit " fi"
|
||||||
|
if [ -x "$KDUMP_POST" ]; then
|
||||||
|
emit " $KDUMP_POST \$exitcode"
|
||||||
|
fi
|
||||||
emit "fi"
|
emit "fi"
|
||||||
emit "umount /mnt"
|
emit "umount /mnt"
|
||||||
|
emit "[ \$exitcode == 0 ] && $FINAL_ACTION"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done < $KDUMP_CONFIG_FILE
|
done < $KDUMP_CONFIG_FILE
|
||||||
@ -1691,17 +1902,29 @@ if [ -n "$KDUMP_CONFIG_FILE" ]; then
|
|||||||
emit "echo dropping to initramfs shell"
|
emit "echo dropping to initramfs shell"
|
||||||
emit "echo exiting this shell will reboot your system"
|
emit "echo exiting this shell will reboot your system"
|
||||||
emit "/bin/msh"
|
emit "/bin/msh"
|
||||||
emit "reboot -f"
|
|
||||||
elif [ "$DEFAULT_ACTION" == "reboot" ]
|
|
||||||
then
|
|
||||||
emit "reboot -f"
|
|
||||||
fi
|
fi
|
||||||
|
case $DEFAULT_ACTION in
|
||||||
|
reboot|halt|shell)
|
||||||
|
emit "$FINAL_ACTION"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
emit "echo Attempting to enter user-space to capture vmcore"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
#find the shared libraries. this snippet taken from kboot
|
#find the shared libraries. this snippet taken from kboot
|
||||||
|
TEMPLDCFG=`mktemp`
|
||||||
|
for lib in `ls /etc/ld.so.conf.d/* | grep -v kernelcap`
|
||||||
|
do
|
||||||
|
echo "include " $lib >> $TEMPLDCFG
|
||||||
|
done
|
||||||
|
/sbin/ldconfig -f $TEMPLDCFG
|
||||||
kdump_libs=`for n in $bin; do
|
kdump_libs=`for n in $bin; do
|
||||||
ldd "$n" 2>/dev/null | tr -s '\011' ' ' |
|
ldd "$n" 2>/dev/null | tr -s '\011' ' ' |
|
||||||
sed 's/.*=> *//;s/^ *//;/ *(0x.*)/s///p;d'
|
sed 's/.*=> *//;s/^ *//;/ *(0x.*)/s///p;d'
|
||||||
done | sort | uniq | sed '/^ *$/d'`
|
done | sort | uniq | sed '/^ *$/d'`
|
||||||
|
/sbin/ldconfig
|
||||||
|
rm -f $TEMPLDCFG
|
||||||
|
|
||||||
#copy the binaries and their shared libraries to the archive
|
#copy the binaries and their shared libraries to the archive
|
||||||
for n in $bin $kdump_libs $k_extras; do
|
for n in $bin $kdump_libs $k_extras; do
|
||||||
@ -1734,11 +1957,18 @@ emit "fi"
|
|||||||
emit "echo Checking root filesystem."
|
emit "echo Checking root filesystem."
|
||||||
emit "fsck \$ROOTDEV"
|
emit "fsck \$ROOTDEV"
|
||||||
emit "echo Mounting root filesystem."
|
emit "echo Mounting root filesystem."
|
||||||
emit "FSTYPE=\`fsck -N \$ROOTDEV | awk '/.*sbin.*/ {print \$1}' | sed -e's/\\(^.*\\.\\)\\(.*\\)/\\2/'\`"
|
emit "for FSTYPE in ext3 ext2 minix"
|
||||||
emit "fsck -t \$FSTYPE \$ROOTDEV"
|
emit "do"
|
||||||
emit "echo mount -t \$FSTYPE \$ROOTDEV /sysroot"
|
emit " echo Trying mount -t \$FSTYPE \$ROOTDEV /sysroot"
|
||||||
emit "mount -t \$FSTYPE \$ROOTDEV /sysroot"
|
emit " mount -t \$FSTYPE \$ROOTDEV /sysroot >/dev/null 2>&1 "
|
||||||
emit "if [ \$? != 0 ]"
|
emit " if [ \$? == 0 ]"
|
||||||
|
emit " then"
|
||||||
|
emit " echo Using \$FSTYPE on root filesystem"
|
||||||
|
emit " ROOT_MOUNT_GOOD=1"
|
||||||
|
emit " break;"
|
||||||
|
emit " fi"
|
||||||
|
emit "done"
|
||||||
|
emit "if [ -z \"\$ROOT_MOUNT_GOOD\" ]"
|
||||||
emit "then"
|
emit "then"
|
||||||
emit " echo unable to mount rootfs. Dropping to shell"
|
emit " echo unable to mount rootfs. Dropping to shell"
|
||||||
emit " /bin/msh"
|
emit " /bin/msh"
|
||||||
@ -1754,6 +1984,8 @@ emit "touch /sysroot/fastboot"
|
|||||||
emit "echo Switching to new root and running init."
|
emit "echo Switching to new root and running init."
|
||||||
emit "exec switch_root /sysroot /sbin/init"
|
emit "exec switch_root /sysroot /sbin/init"
|
||||||
|
|
||||||
|
# END OF INIT SCRIPT
|
||||||
|
|
||||||
chmod +x $RCFILE
|
chmod +x $RCFILE
|
||||||
|
|
||||||
(cd $MNTIMAGE; findall . | cpio --quiet -c -o) >| $IMAGE || exit 1
|
(cd $MNTIMAGE; findall . | cpio --quiet -c -o) >| $IMAGE || exit 1
|
||||||
|
Loading…
Reference in New Issue
Block a user