This repository was archived by the owner on Jan 8, 2025. It is now read-only.
forked from Tasssadar/kexec-tools
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This patch adds support for kexec-tools on ia64. This patch applies on top of -kdump7 patch from <http://lse.sourceforge.net/kdump/>. Signed-off-by: Khalid Aziz <[email protected]> Signed-off-by: Maneesh Soni <[email protected]>
- Loading branch information
Showing
12 changed files
with
456 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <[email protected]>, | ||
for the Debian project (but may be used by others). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
* Copyright (C) 2004 Silicon Graphics, Inc. | ||
* Jesse Barnes <[email protected]> | ||
* Copyright (C) 2004 Khalid Aziz <[email protected]> Hewlett Packard Co | ||
* Copyright (C) 2005 Zou Nan hai <[email protected]> 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 @@ void elf_ia64_usage(void) | |
{ | ||
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 @@ int elf_ia64_load(int argc, char **argv, const char *buf, off_t len, | |
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 @@ int elf_ia64_load(int argc, char **argv, const char *buf, off_t len, | |
|
||
/* 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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.