This commit is contained in:
parent
fdd79db572
commit
c50239f780
@ -131,6 +131,11 @@ if (!$section) {
|
|||||||
$section = Bootloader::Tools::GetDefaultSection();
|
$section = Bootloader::Tools::GetDefaultSection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$section) {
|
||||||
|
print STDERR "Unable to get default section of bootloader configuration.\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
if ($debug) {
|
if ($debug) {
|
||||||
print "Type : " . $section->{"type"}."\n";
|
print "Type : " . $section->{"type"}."\n";
|
||||||
print "Name : " . $section->{"name"}."\n";
|
print "Name : " . $section->{"name"}."\n";
|
||||||
@ -142,7 +147,7 @@ if ($debug) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($section->{"type"} ne "image") {
|
if ($section->{"type"} ne "image") {
|
||||||
print STDERR "Default boot section is no image.";
|
print STDERR "Default boot section is no image.\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
106
kexec-tools-add-usable-drconf-memory-node-to-device-tree.diff
Normal file
106
kexec-tools-add-usable-drconf-memory-node-to-device-tree.diff
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
From cd8497a9a9e487684679b6747f7ba3f0a557328b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chandru <chandru@in.ibm.com>
|
||||||
|
Date: Wed, 24 Sep 2008 17:19:18 +0530
|
||||||
|
Subject: [PATCH] kexec/kdump : add a new linux, usable-drconf-memory node to the device tree
|
||||||
|
|
||||||
|
Add a new linux,usable-drconf-memory property to the device tree passed to the
|
||||||
|
2nd kernel. Each entry in the property is of the form: a count followed by so
|
||||||
|
many (base, size) pairs of usable memory regions. The total number of such
|
||||||
|
entries is equal to number of lmb's in ibm,dynamic-memory property.
|
||||||
|
|
||||||
|
Signed-off-by: Chandru Siddalingappa <chandru@in.ibm.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
Acked-by: Bernhard Walle <bwalle@suse.de>
|
||||||
|
|
||||||
|
---
|
||||||
|
kexec/arch/ppc64/fs2dt.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 72 insertions(+)
|
||||||
|
|
||||||
|
--- a/kexec/arch/ppc64/fs2dt.c
|
||||||
|
+++ b/kexec/arch/ppc64/fs2dt.c
|
||||||
|
@@ -122,6 +122,74 @@ static unsigned propnum(const char *name
|
||||||
|
return offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void add_dyn_reconf_usable_mem_property(int fd)
|
||||||
|
+{
|
||||||
|
+ char fname[MAXPATH], *bname;
|
||||||
|
+ uint64_t buf[32];
|
||||||
|
+ uint64_t ranges[2*MAX_MEMORY_RANGES];
|
||||||
|
+ uint64_t base, end, loc_base, loc_end;
|
||||||
|
+ int range, rlen = 0, i;
|
||||||
|
+ int rngs_cnt, tmp_indx;
|
||||||
|
+
|
||||||
|
+ strcpy(fname, pathname);
|
||||||
|
+ bname = strrchr(fname, '/');
|
||||||
|
+ bname[0] = '\0';
|
||||||
|
+ bname = strrchr(fname, '/');
|
||||||
|
+ if (strncmp(bname, "/ibm,dynamic-reconfiguration-memory", 36))
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ if (lseek(fd, 4, SEEK_SET) < 0)
|
||||||
|
+ die("unrecoverable error: error seeking in \"%s\": %s\n",
|
||||||
|
+ pathname, strerror(errno));
|
||||||
|
+
|
||||||
|
+ rlen = 0;
|
||||||
|
+ for (i = 0; i < num_of_lmbs; i++) {
|
||||||
|
+ if (read(fd, buf, 24) < 0)
|
||||||
|
+ die("unrecoverable error: error reading \"%s\": %s\n",
|
||||||
|
+ pathname, strerror(errno));
|
||||||
|
+
|
||||||
|
+ base = (uint64_t) buf[0];
|
||||||
|
+ end = base + lmb_size;
|
||||||
|
+ if (~0ULL - base < end)
|
||||||
|
+ die("unrecoverable error: mem property overflow\n");
|
||||||
|
+
|
||||||
|
+ tmp_indx = rlen++;
|
||||||
|
+
|
||||||
|
+ rngs_cnt = 0;
|
||||||
|
+ for (range = 0; range < usablemem_rgns.size; range++) {
|
||||||
|
+ loc_base = usablemem_rgns.ranges[range].start;
|
||||||
|
+ loc_end = usablemem_rgns.ranges[range].end;
|
||||||
|
+ if (loc_base >= base && loc_end <= end) {
|
||||||
|
+ ranges[rlen++] = loc_base;
|
||||||
|
+ ranges[rlen++] = loc_end - loc_base;
|
||||||
|
+ rngs_cnt++;
|
||||||
|
+ } else if (base < loc_end && end > loc_base) {
|
||||||
|
+ if (loc_base < base)
|
||||||
|
+ loc_base = base;
|
||||||
|
+ if (loc_end > end)
|
||||||
|
+ loc_end = end;
|
||||||
|
+ ranges[rlen++] = loc_base;
|
||||||
|
+ ranges[rlen++] = loc_end - loc_base;
|
||||||
|
+ rngs_cnt++;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ /* Store the count of (base, size) duple */
|
||||||
|
+ ranges[tmp_indx] = rngs_cnt;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ rlen = rlen * sizeof(uint64_t);
|
||||||
|
+ /*
|
||||||
|
+ * Add linux,drconf-usable-memory property.
|
||||||
|
+ */
|
||||||
|
+ *dt++ = 3;
|
||||||
|
+ *dt++ = rlen;
|
||||||
|
+ *dt++ = propnum("linux,drconf-usable-memory");
|
||||||
|
+ if ((rlen >= 8) && ((unsigned long)dt & 0x4))
|
||||||
|
+ dt++;
|
||||||
|
+ memcpy(dt, &ranges, rlen);
|
||||||
|
+ dt += (rlen + 3)/4;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static void add_usable_mem_property(int fd, int len)
|
||||||
|
{
|
||||||
|
char fname[MAXPATH], *bname;
|
||||||
|
@@ -267,6 +335,10 @@ static void putprops(char *fn, struct di
|
||||||
|
dt += (len + 3)/4;
|
||||||
|
if (!strcmp(dp->d_name, "reg") && usablemem_rgns.size)
|
||||||
|
add_usable_mem_property(fd, len);
|
||||||
|
+ if (!strcmp(dp->d_name, "ibm,dynamic-memory") &&
|
||||||
|
+ usablemem_rgns.size)
|
||||||
|
+ add_dyn_reconf_usable_mem_property(fd);
|
||||||
|
+
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
|
187
kexec-tools-crash-memory-ranges-drconf.diff
Normal file
187
kexec-tools-crash-memory-ranges-drconf.diff
Normal file
@ -0,0 +1,187 @@
|
|||||||
|
From 726c130af8b1371aa32dc14f108a3fb1695860bb Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chandru <chandru@in.ibm.com>
|
||||||
|
Date: Wed, 24 Sep 2008 17:19:07 +0530
|
||||||
|
Subject: [PATCH] kexec/kdump: read crash memory ranges from drconf memory
|
||||||
|
|
||||||
|
Get the memory ranges of the 1st kernel excluding the memory reserved for
|
||||||
|
kexec/kdump kernel in case of ibm,dynamic-reconfiguration-memory node of
|
||||||
|
device tree
|
||||||
|
|
||||||
|
Signed-off-by: Chandru Siddalingappa <chandru@in.ibm.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
Acked-by: Bernhard Walle <bwalle@suse.de>
|
||||||
|
|
||||||
|
---
|
||||||
|
kexec/arch/ppc64/crashdump-ppc64.c | 121 ++++++++++++++++++++++++++-----------
|
||||||
|
kexec/arch/ppc64/crashdump-ppc64.h | 3
|
||||||
|
2 files changed, 90 insertions(+), 34 deletions(-)
|
||||||
|
|
||||||
|
--- a/kexec/arch/ppc64/crashdump-ppc64.c
|
||||||
|
+++ b/kexec/arch/ppc64/crashdump-ppc64.c
|
||||||
|
@@ -84,6 +84,82 @@ mem_rgns_t usablemem_rgns = {0, NULL};
|
||||||
|
*/
|
||||||
|
uint64_t saved_max_mem = 0;
|
||||||
|
|
||||||
|
+static unsigned long long cstart, cend;
|
||||||
|
+static int memory_ranges;
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ * Exclude the region that lies within crashkernel
|
||||||
|
+ */
|
||||||
|
+static void exclude_crash_region(uint64_t start, uint64_t end)
|
||||||
|
+{
|
||||||
|
+ if (cstart < end && cend > start) {
|
||||||
|
+ if (start < cstart && end > cend) {
|
||||||
|
+ crash_memory_range[memory_ranges].start = start;
|
||||||
|
+ crash_memory_range[memory_ranges].end = cstart;
|
||||||
|
+ crash_memory_range[memory_ranges].type = RANGE_RAM;
|
||||||
|
+ memory_ranges++;
|
||||||
|
+ crash_memory_range[memory_ranges].start = cend;
|
||||||
|
+ crash_memory_range[memory_ranges].end = end;
|
||||||
|
+ crash_memory_range[memory_ranges].type = RANGE_RAM;
|
||||||
|
+ memory_ranges++;
|
||||||
|
+ } else if (start < cstart) {
|
||||||
|
+ crash_memory_range[memory_ranges].start = start;
|
||||||
|
+ crash_memory_range[memory_ranges].end = cstart;
|
||||||
|
+ crash_memory_range[memory_ranges].type = RANGE_RAM;
|
||||||
|
+ memory_ranges++;
|
||||||
|
+ } else if (end > cend) {
|
||||||
|
+ crash_memory_range[memory_ranges].start = cend;
|
||||||
|
+ crash_memory_range[memory_ranges].end = end;
|
||||||
|
+ crash_memory_range[memory_ranges].type = RANGE_RAM;
|
||||||
|
+ memory_ranges++;
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ crash_memory_range[memory_ranges].start = start;
|
||||||
|
+ crash_memory_range[memory_ranges].end = end;
|
||||||
|
+ crash_memory_range[memory_ranges].type = RANGE_RAM;
|
||||||
|
+ memory_ranges++;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int get_dyn_reconf_crash_memory_ranges()
|
||||||
|
+{
|
||||||
|
+ uint64_t start, end;
|
||||||
|
+ char fname[128], buf[32];
|
||||||
|
+ FILE *file;
|
||||||
|
+ int i, n;
|
||||||
|
+
|
||||||
|
+ strcpy(fname, "/proc/device-tree/");
|
||||||
|
+ strcat(fname, "ibm,dynamic-reconfiguration-memory/ibm,dynamic-memory");
|
||||||
|
+ if ((file = fopen(fname, "r")) == NULL) {
|
||||||
|
+ perror(fname);
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ fseek(file, 4, SEEK_SET);
|
||||||
|
+ for (i = 0; i < num_of_lmbs; i++) {
|
||||||
|
+ if ((n = fread(buf, 1, 24, file)) < 0) {
|
||||||
|
+ perror(fname);
|
||||||
|
+ fclose(file);
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+ if (memory_ranges >= (max_memory_ranges + 1)) {
|
||||||
|
+ /* No space to insert another element. */
|
||||||
|
+ fprintf(stderr,
|
||||||
|
+ "Error: Number of crash memory ranges"
|
||||||
|
+ " excedeed the max limit\n");
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ start = ((uint64_t *)buf)[0];
|
||||||
|
+ end = start + lmb_size;
|
||||||
|
+ if (start == 0 && end >= (BACKUP_SRC_END + 1))
|
||||||
|
+ start = BACKUP_SRC_END + 1;
|
||||||
|
+ exclude_crash_region(start, end);
|
||||||
|
+ }
|
||||||
|
+ fclose(file);
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/* Reads the appropriate file and retrieves the SYSTEM RAM regions for whom to
|
||||||
|
* create Elf headers. Keeping it separate from get_memory_ranges() as
|
||||||
|
* requirements are different in the case of normal kexec and crashdumps.
|
||||||
|
@@ -98,7 +174,6 @@ uint64_t saved_max_mem = 0;
|
||||||
|
static int get_crash_memory_ranges(struct memory_range **range, int *ranges)
|
||||||
|
{
|
||||||
|
|
||||||
|
- int memory_ranges = 0;
|
||||||
|
char device_tree[256] = "/proc/device-tree/";
|
||||||
|
char fname[256];
|
||||||
|
char buf[MAXBYTES];
|
||||||
|
@@ -106,7 +181,7 @@ static int get_crash_memory_ranges(struc
|
||||||
|
FILE *file;
|
||||||
|
struct dirent *dentry, *mentry;
|
||||||
|
int i, n, crash_rng_len = 0;
|
||||||
|
- unsigned long long start, end, cstart, cend;
|
||||||
|
+ unsigned long long start, end;
|
||||||
|
int page_size;
|
||||||
|
|
||||||
|
crash_max_memory_ranges = max_memory_ranges + 6;
|
||||||
|
@@ -129,7 +204,16 @@ static int get_crash_memory_ranges(struc
|
||||||
|
perror(device_tree);
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ cstart = crash_base;
|
||||||
|
+ cend = crash_base + crash_size;
|
||||||
|
+
|
||||||
|
while ((dentry = readdir(dir)) != NULL) {
|
||||||
|
+ if (!strncmp(dentry->d_name,
|
||||||
|
+ "ibm,dynamic-reconfiguration-memory", 35)){
|
||||||
|
+ get_dyn_reconf_crash_memory_ranges();
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
if (strncmp(dentry->d_name, "memory@", 7) &&
|
||||||
|
strcmp(dentry->d_name, "memory"))
|
||||||
|
continue;
|
||||||
|
@@ -170,38 +254,7 @@ static int get_crash_memory_ranges(struc
|
||||||
|
if (start == 0 && end >= (BACKUP_SRC_END + 1))
|
||||||
|
start = BACKUP_SRC_END + 1;
|
||||||
|
|
||||||
|
- cstart = crash_base;
|
||||||
|
- cend = crash_base + crash_size;
|
||||||
|
- /*
|
||||||
|
- * Exclude the region that lies within crashkernel
|
||||||
|
- */
|
||||||
|
- if (cstart < end && cend > start) {
|
||||||
|
- if (start < cstart && end > cend) {
|
||||||
|
- crash_memory_range[memory_ranges].start = start;
|
||||||
|
- crash_memory_range[memory_ranges].end = cstart;
|
||||||
|
- crash_memory_range[memory_ranges].type = RANGE_RAM;
|
||||||
|
- memory_ranges++;
|
||||||
|
- crash_memory_range[memory_ranges].start = cend;
|
||||||
|
- crash_memory_range[memory_ranges].end = end;
|
||||||
|
- crash_memory_range[memory_ranges].type = RANGE_RAM;
|
||||||
|
- memory_ranges++;
|
||||||
|
- } else if (start < cstart) {
|
||||||
|
- crash_memory_range[memory_ranges].start = start;
|
||||||
|
- crash_memory_range[memory_ranges].end = cstart;
|
||||||
|
- crash_memory_range[memory_ranges].type = RANGE_RAM;
|
||||||
|
- memory_ranges++;
|
||||||
|
- } else if (end > cend){
|
||||||
|
- crash_memory_range[memory_ranges].start = cend;
|
||||||
|
- crash_memory_range[memory_ranges].end = end;
|
||||||
|
- crash_memory_range[memory_ranges].type = RANGE_RAM;
|
||||||
|
- memory_ranges++;
|
||||||
|
- }
|
||||||
|
- } else {
|
||||||
|
- crash_memory_range[memory_ranges].start = start;
|
||||||
|
- crash_memory_range[memory_ranges].end = end;
|
||||||
|
- crash_memory_range[memory_ranges].type = RANGE_RAM;
|
||||||
|
- memory_ranges++;
|
||||||
|
- }
|
||||||
|
+ exclude_crash_region(start, end);
|
||||||
|
fclose(file);
|
||||||
|
}
|
||||||
|
closedir(dmem);
|
||||||
|
--- a/kexec/arch/ppc64/crashdump-ppc64.h
|
||||||
|
+++ b/kexec/arch/ppc64/crashdump-ppc64.h
|
||||||
|
@@ -28,4 +28,7 @@ extern uint64_t crash_size;
|
||||||
|
extern unsigned int rtas_base;
|
||||||
|
extern unsigned int rtas_size;
|
||||||
|
|
||||||
|
+uint64_t lmb_size;
|
||||||
|
+unsigned int num_of_lmbs;
|
||||||
|
+
|
||||||
|
#endif /* CRASHDUMP_PPC64_H */
|
229
kexec-tools-get-details-dynamic-reconfiguration-memory-node.diff
Normal file
229
kexec-tools-get-details-dynamic-reconfiguration-memory-node.diff
Normal file
@ -0,0 +1,229 @@
|
|||||||
|
From 1d19ca0c4306c3c684cf4d277781975e4ad1c193 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chandru <chandru@in.ibm.com>
|
||||||
|
Date: Wed, 24 Sep 2008 17:19:29 +0530
|
||||||
|
Subject: [PATCH] kexec/kdump : get details of ibm, dynamic-reconfiguration-memory node of device tree
|
||||||
|
|
||||||
|
Get number of lmb's (logical memory blocks) , size of each lmb from
|
||||||
|
ibm,dynamic-memory property , get base memory ranges from
|
||||||
|
ibm,dynamic-reconfiguration-memory node.
|
||||||
|
|
||||||
|
Signed-off-by: Chandru Siddalingappa <chandru@in.ibm.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
Acked-by: Bernhard Walle <bwalle@suse.de>
|
||||||
|
|
||||||
|
---
|
||||||
|
kexec/arch/ppc64/kexec-ppc64.c | 145 ++++++++++++++++++++++++++++++++++++-----
|
||||||
|
1 file changed, 130 insertions(+), 15 deletions(-)
|
||||||
|
|
||||||
|
--- a/kexec/arch/ppc64/kexec-ppc64.c
|
||||||
|
+++ b/kexec/arch/ppc64/kexec-ppc64.c
|
||||||
|
@@ -96,6 +96,49 @@ err1:
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
+static int count_dyn_reconf_memory_ranges(void)
|
||||||
|
+{
|
||||||
|
+ char device_tree[] = "/proc/device-tree/";
|
||||||
|
+ char fname[128];
|
||||||
|
+ char buf[32];
|
||||||
|
+ FILE *file;
|
||||||
|
+
|
||||||
|
+ strcpy(fname, device_tree);
|
||||||
|
+ strcat(fname, "ibm,dynamic-reconfiguration-memory/ibm,lmb-size");
|
||||||
|
+ if ((file = fopen(fname, "r")) == NULL) {
|
||||||
|
+ perror(fname);
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (fread(buf, 1, 8, file) < 0) {
|
||||||
|
+ perror(fname);
|
||||||
|
+ fclose(file);
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ lmb_size = ((uint64_t *)buf)[0];
|
||||||
|
+ fclose(file);
|
||||||
|
+
|
||||||
|
+ /* Get number of lmbs from ibm,dynamic-memory */
|
||||||
|
+ strcpy(fname, device_tree);
|
||||||
|
+ strcat(fname, "ibm,dynamic-reconfiguration-memory/ibm,dynamic-memory");
|
||||||
|
+ if ((file = fopen(fname, "r")) == NULL) {
|
||||||
|
+ perror(fname);
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+ /*
|
||||||
|
+ * first 4 bytes provide number of entries(lmbs)
|
||||||
|
+ */
|
||||||
|
+ if (fread(buf, 1, 4, file) < 0) {
|
||||||
|
+ perror(fname);
|
||||||
|
+ fclose(file);
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+ num_of_lmbs = ((unsigned int *)buf)[0];
|
||||||
|
+ max_memory_ranges += num_of_lmbs;
|
||||||
|
+ fclose(file);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/*
|
||||||
|
* Count the memory nodes under /proc/device-tree and populate the
|
||||||
|
* max_memory_ranges variable. This variable replaces MAX_MEMORY_RANGES
|
||||||
|
@@ -113,6 +156,12 @@ static int count_memory_ranges(void)
|
||||||
|
}
|
||||||
|
|
||||||
|
while ((dentry = readdir(dir)) != NULL) {
|
||||||
|
+ if (!strncmp(dentry->d_name,
|
||||||
|
+ "ibm,dynamic-reconfiguration-memory", 35)){
|
||||||
|
+ count_dyn_reconf_memory_ranges();
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (strncmp(dentry->d_name, "memory@", 7) &&
|
||||||
|
strcmp(dentry->d_name, "memory") &&
|
||||||
|
strncmp(dentry->d_name, "pci@", 4))
|
||||||
|
@@ -128,7 +177,52 @@ static int count_memory_ranges(void)
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
+static void add_base_memory_range(uint64_t start, uint64_t end)
|
||||||
|
+{
|
||||||
|
+ base_memory_range[nr_memory_ranges].start = start;
|
||||||
|
+ base_memory_range[nr_memory_ranges].end = end;
|
||||||
|
+ base_memory_range[nr_memory_ranges].type = RANGE_RAM;
|
||||||
|
+ nr_memory_ranges++;
|
||||||
|
+
|
||||||
|
+ dbgprintf("%016llx-%016llx : %x\n",
|
||||||
|
+ base_memory_range[nr_memory_ranges-1].start,
|
||||||
|
+ base_memory_range[nr_memory_ranges-1].end,
|
||||||
|
+ base_memory_range[nr_memory_ranges-1].type);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int get_dyn_reconf_base_ranges(void)
|
||||||
|
+{
|
||||||
|
+ uint64_t start, end;
|
||||||
|
+ char fname[128], buf[32];
|
||||||
|
+ FILE *file;
|
||||||
|
+ int i, n;
|
||||||
|
+
|
||||||
|
|
||||||
|
+ strcpy(fname, "/proc/device-tree/");
|
||||||
|
+ strcat(fname,
|
||||||
|
+ "ibm,dynamic-reconfiguration-memory/ibm,dynamic-memory");
|
||||||
|
+ if ((file = fopen(fname, "r")) == NULL) {
|
||||||
|
+ perror(fname);
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ fseek(file, 4, SEEK_SET);
|
||||||
|
+ for (i = 0; i < num_of_lmbs; i++) {
|
||||||
|
+ if ((n = fread(buf, 1, 24, file)) < 0) {
|
||||||
|
+ perror(fname);
|
||||||
|
+ fclose(file);
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+ if (nr_memory_ranges >= max_memory_ranges)
|
||||||
|
+ return -1;
|
||||||
|
+
|
||||||
|
+ start = ((uint64_t *)buf)[0];
|
||||||
|
+ end = start + lmb_size;
|
||||||
|
+ add_base_memory_range(start, end);
|
||||||
|
+ }
|
||||||
|
+ fclose(file);
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
/* Sort the base ranges in memory - this is useful for ensuring that our
|
||||||
|
* ranges are in ascending order, even if device-tree read of memory nodes
|
||||||
|
* is done differently. Also, could be used for other range coalescing later
|
||||||
|
@@ -156,7 +250,7 @@ static int sort_base_ranges(void)
|
||||||
|
/* Get base memory ranges */
|
||||||
|
static int get_base_ranges(void)
|
||||||
|
{
|
||||||
|
- int local_memory_ranges = 0;
|
||||||
|
+ uint64_t start, end;
|
||||||
|
char device_tree[256] = "/proc/device-tree/";
|
||||||
|
char fname[256];
|
||||||
|
char buf[MAXBYTES];
|
||||||
|
@@ -170,6 +264,11 @@ static int get_base_ranges(void)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
while ((dentry = readdir(dir)) != NULL) {
|
||||||
|
+ if (!strncmp(dentry->d_name,
|
||||||
|
+ "ibm,dynamic-reconfiguration-memory", 35)) {
|
||||||
|
+ get_dyn_reconf_base_ranges();
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
if (strncmp(dentry->d_name, "memory@", 7) &&
|
||||||
|
strcmp(dentry->d_name, "memory"))
|
||||||
|
continue;
|
||||||
|
@@ -197,27 +296,18 @@ static int get_base_ranges(void)
|
||||||
|
closedir(dir);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
- if (local_memory_ranges >= max_memory_ranges) {
|
||||||
|
+ if (nr_memory_ranges >= max_memory_ranges) {
|
||||||
|
fclose(file);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
- base_memory_range[local_memory_ranges].start =
|
||||||
|
- ((uint64_t *)buf)[0];
|
||||||
|
- base_memory_range[local_memory_ranges].end =
|
||||||
|
- base_memory_range[local_memory_ranges].start +
|
||||||
|
- ((uint64_t *)buf)[1];
|
||||||
|
- base_memory_range[local_memory_ranges].type = RANGE_RAM;
|
||||||
|
- local_memory_ranges++;
|
||||||
|
- dbgprintf("%016llx-%016llx : %x\n",
|
||||||
|
- base_memory_range[local_memory_ranges-1].start,
|
||||||
|
- base_memory_range[local_memory_ranges-1].end,
|
||||||
|
- base_memory_range[local_memory_ranges-1].type);
|
||||||
|
+ start = ((uint64_t *)buf)[0];
|
||||||
|
+ end = start + ((uint64_t *)buf)[1];
|
||||||
|
+ add_base_memory_range(start, end);
|
||||||
|
fclose(file);
|
||||||
|
}
|
||||||
|
closedir(dmem);
|
||||||
|
}
|
||||||
|
closedir(dir);
|
||||||
|
- nr_memory_ranges = local_memory_ranges;
|
||||||
|
sort_base_ranges();
|
||||||
|
memory_max = base_memory_range[nr_memory_ranges - 1].end;
|
||||||
|
#ifdef DEBUG
|
||||||
|
@@ -276,7 +366,9 @@ static int get_devtree_details(unsigned
|
||||||
|
strncmp(dentry->d_name, "memory@", 7) &&
|
||||||
|
strcmp(dentry->d_name, "memory") &&
|
||||||
|
strncmp(dentry->d_name, "pci@", 4) &&
|
||||||
|
- strncmp(dentry->d_name, "rtas", 4))
|
||||||
|
+ strncmp(dentry->d_name, "rtas", 4) &&
|
||||||
|
+ strncmp(dentry->d_name,
|
||||||
|
+ "ibm,dynamic-reconfiguration-memory", 35))
|
||||||
|
continue;
|
||||||
|
strcpy(fname, device_tree);
|
||||||
|
strcat(fname, dentry->d_name);
|
||||||
|
@@ -474,6 +566,29 @@ static int get_devtree_details(unsigned
|
||||||
|
closedir(cdir);
|
||||||
|
} /* memory */
|
||||||
|
|
||||||
|
+ if (!strncmp(dentry->d_name,
|
||||||
|
+ "ibm,dynamic-reconfiguration-memory", 35)) {
|
||||||
|
+ unsigned int k;
|
||||||
|
+ strcat(fname, "/ibm,dynamic-memory");
|
||||||
|
+ if ((file = fopen(fname, "r")) == NULL) {
|
||||||
|
+ perror(fname);
|
||||||
|
+ goto error_opencdir;
|
||||||
|
+ }
|
||||||
|
+ fseek(file, 4, SEEK_SET);
|
||||||
|
+ for (k = 0; k < num_of_lmbs; k++) {
|
||||||
|
+ if ((n = fread(buf, 1, 24, file)) < 0) {
|
||||||
|
+ perror(fname);
|
||||||
|
+ goto error_openfile;
|
||||||
|
+ }
|
||||||
|
+ rmo_base = ((uint64_t *)buf)[0];
|
||||||
|
+ rmo_top = rmo_base + lmb_size;
|
||||||
|
+ if (rmo_top > 0x30000000UL)
|
||||||
|
+ rmo_top = 0x30000000UL;
|
||||||
|
+ }
|
||||||
|
+ fclose(file);
|
||||||
|
+ closedir(cdir);
|
||||||
|
+ } /* ibm,dynamic-reconfiguration-memory */
|
||||||
|
+
|
||||||
|
if (strncmp(dentry->d_name, "pci@", 4) == 0) {
|
||||||
|
strcat(fname, "/linux,tce-base");
|
||||||
|
if ((file = fopen(fname, "r")) == NULL) {
|
@ -1,3 +1,20 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Oct 09 18:39:45 CEST 2008 - bwalle@suse.de
|
||||||
|
|
||||||
|
- Fix empty /proc/vmcore on PPC64 (bnc#431492).
|
||||||
|
o kexec/kdump: read crash memory ranges from drconf memory.
|
||||||
|
o kexec/kdump: add a new linux, usable-drconf-memory node to the
|
||||||
|
device tree.
|
||||||
|
o kexec/kdump: get details of ibm, dynamic-reconfiguration-memory
|
||||||
|
node of device tree.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Oct 09 15:47:46 CEST 2008 - bwalle@suse.de
|
||||||
|
|
||||||
|
- Add newline in error message of "kexec-bootloader".
|
||||||
|
- Add error handling when Bootloader::Tools::GetDefaultSection()
|
||||||
|
fails.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Oct 08 16:57:28 CEST 2008 - bwalle@suse.de
|
Wed Oct 08 16:57:28 CEST 2008 - bwalle@suse.de
|
||||||
|
|
||||||
|
150
kexec-tools.spec
150
kexec-tools.spec
@ -1,23 +1,15 @@
|
|||||||
#
|
#
|
||||||
# spec file for package kexec-tools (Version 2.0.0)
|
# spec file for package kexec-tools (Version 1.101)
|
||||||
#
|
#
|
||||||
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||||
|
# This file and all modifications and additions to the pristine
|
||||||
|
# package are under the same license as the package itself.
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
|
||||||
# upon. The license for this file, and modifications and additions to the
|
|
||||||
# file, is the same license as for the pristine package itself (unless the
|
|
||||||
# license for the pristine package is not an Open Source License, in which
|
|
||||||
# case the license is the MIT License). An "Open Source License" is a
|
|
||||||
# license that conforms to the Open Source Definition (Version 1.9)
|
|
||||||
# published by the Open Source Initiative.
|
|
||||||
|
|
||||||
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||||
#
|
#
|
||||||
|
|
||||||
# norootforbuild
|
# norootforbuild
|
||||||
|
|
||||||
|
|
||||||
Name: kexec-tools
|
Name: kexec-tools
|
||||||
%ifarch ppc
|
%ifarch ppc
|
||||||
BuildRequires: gcc-64bit glibc-devel-64bit
|
BuildRequires: gcc-64bit glibc-devel-64bit
|
||||||
@ -29,7 +21,7 @@ PreReq: %insserv_prereq %fillup_prereq
|
|||||||
AutoReqProv: on
|
AutoReqProv: on
|
||||||
Summary: Tools for fast kernel loading
|
Summary: Tools for fast kernel loading
|
||||||
Version: 2.0.0
|
Version: 2.0.0
|
||||||
Release: 37
|
Release: 0
|
||||||
Source: %{name}-%{version}.tar.bz2
|
Source: %{name}-%{version}.tar.bz2
|
||||||
Source1: kexec-bootloader
|
Source1: kexec-bootloader
|
||||||
Source2: kexec-bootloader.8.txt
|
Source2: kexec-bootloader.8.txt
|
||||||
@ -40,7 +32,10 @@ Patch2: %{name}-build-warnings.diff
|
|||||||
Patch3: %{name}-ppc64-build-warnings.diff
|
Patch3: %{name}-ppc64-build-warnings.diff
|
||||||
Patch4: %{name}-ppc64-IBM-QS2x-blades.diff
|
Patch4: %{name}-ppc64-IBM-QS2x-blades.diff
|
||||||
Patch5: %{name}-ia64-kdump-PT_LOAD-order.diff
|
Patch5: %{name}-ia64-kdump-PT_LOAD-order.diff
|
||||||
Url: http://ftp.kernel.org/pub/linux/kernel/people/horms/kexec-tools/
|
Patch6: %{name}-crash-memory-ranges-drconf.diff
|
||||||
|
Patch7: %{name}-add-usable-drconf-memory-node-to-device-tree.diff
|
||||||
|
Patch8: %{name}-get-details-dynamic-reconfiguration-memory-node.diff
|
||||||
|
Url: http://www.vergenet.net/linux/kexec/kexec-tools/
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
BuildRequires: zlib-devel
|
BuildRequires: zlib-devel
|
||||||
%if 0%{?suse_version} >= 1110
|
%if 0%{?suse_version} >= 1110
|
||||||
@ -72,6 +67,9 @@ Authors:
|
|||||||
%patch3 -p1
|
%patch3 -p1
|
||||||
%patch4 -p1
|
%patch4 -p1
|
||||||
%patch5 -p1
|
%patch5 -p1
|
||||||
|
%patch6 -p1
|
||||||
|
%patch7 -p1
|
||||||
|
%patch8 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%{?suse_update_config -f}
|
%{?suse_update_config -f}
|
||||||
@ -110,11 +108,12 @@ install -m 0755 kexec.init ${RPM_BUILD_ROOT}/etc/init.d/kexec
|
|||||||
|
|
||||||
%clean
|
%clean
|
||||||
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
|
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
|
||||||
%if 0%{?suse_version} >= 1110
|
|
||||||
|
|
||||||
|
%if 0%{?suse_version} >= 1110
|
||||||
%post
|
%post
|
||||||
%{fillup_and_insserv -n kexec kexec}
|
%{fillup_and_insserv -n kexec kexec}
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
#
|
#
|
||||||
#%preun
|
#%preun
|
||||||
|
|
||||||
@ -138,127 +137,6 @@ install -m 0755 kexec.init ${RPM_BUILD_ROOT}/etc/init.d/kexec
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Wed Oct 08 2008 bwalle@suse.de
|
|
||||||
- IA64: Order of operations bug in PT_LOAD segment reader.
|
|
||||||
* Wed Oct 08 2008 bwalle@suse.de
|
|
||||||
- ia64: Do not include uncached memory to vmcore.
|
|
||||||
- ia64: Make PA() work for both physical identity-mapped virtual
|
|
||||||
addresses.
|
|
||||||
- PPC64: Let kexec work on IBM QS2x blade servers
|
|
||||||
- Fix build warnings.
|
|
||||||
* Mon Oct 06 2008 bwalle@suse.de
|
|
||||||
- Implement -h (help) option (bnc#432386).
|
|
||||||
- Remove documentation of -o (options) option that never existed.
|
|
||||||
* Wed Aug 27 2008 bwalle@suse.de
|
|
||||||
- only install and build /etc/init.d/kexec with openSUSE 11.1 /
|
|
||||||
SLES 11 and later
|
|
||||||
* Sat Aug 16 2008 bwalle@suse.de
|
|
||||||
- mark /etc/init.d/kexec as %%config
|
|
||||||
- remove (empty) %%preun
|
|
||||||
* Fri Aug 15 2008 bwalle@suse.de
|
|
||||||
- add /etc/init.d/kexec to be able to reboot with kexec(8)
|
|
||||||
(FATE#302238)
|
|
||||||
* Sat Jul 19 2008 bwalle@suse.de
|
|
||||||
- update to kexec-tools 2.0.0 (final)
|
|
||||||
o Allow BUILD_CFLAGS and TARGET_CFLAGS to be specified at
|
|
||||||
configure time
|
|
||||||
* Mon Jul 14 2008 bwalle@suse.de
|
|
||||||
- update to kexec-tools 2.0.0-rc1
|
|
||||||
o implement support for /sys/firmware/memmap interface
|
|
||||||
o Allow 32 bit kexec binary to boot kdump kernel on ppc64
|
|
||||||
architecture
|
|
||||||
o kexec/crashdump.c: remove file descriptor leaks; make
|
|
||||||
kdump_info argument to get_vmcoreinfo() const
|
|
||||||
o Fix implicit declaration of inb/outb
|
|
||||||
o EDD implementation
|
|
||||||
o Specify the arch on kexec_unload
|
|
||||||
o Update KEXEC_ARCH_* constants from Linux kernel headers
|
|
||||||
o lots of code cleanup
|
|
||||||
o Add --reuse-cmdline
|
|
||||||
o documentation update (manpage, boot protocol)
|
|
||||||
o ensure that extra rtas segment is a multiple of PAGE_SIZE
|
|
||||||
o Allow building for ppc32 platforms
|
|
||||||
o Die on early EOF in slurp_file, instead of infinite-looping
|
|
||||||
o Fix copy-paste bug: entry16 does not start at entry16_debug
|
|
||||||
o Fix undefined symbol errors on readw/writew: arch/io.h, not
|
|
||||||
sys/io.h
|
|
||||||
o extract vmcoreinfo from /proc/vmcore for Xen
|
|
||||||
o Give installed files user-writable permission
|
|
||||||
o Use separate CPPFLAGS and LDFLAGS for purgatory
|
|
||||||
- dropped kexec-tools-fix-arch-on-unload: merged upstream
|
|
||||||
- dropped kexec-tools-edd-fix: merged upstream
|
|
||||||
- dropped kexec-tools-refactor-architecture-detection: merged
|
|
||||||
upstram
|
|
||||||
- dropped kexec-tools.gcc-bug.patch: merged upstream
|
|
||||||
- dropped kexec-tools.ppc32-64bit-purgatory.patch: merged upstream
|
|
||||||
- kexec-tools-edd-support: merged upstream
|
|
||||||
- kexec-tools-32bit-kexec-with-64bit-ppc64.patch: merged upstream
|
|
||||||
- removed README.SUSE: information not necessary any more
|
|
||||||
* Thu Jul 03 2008 bwalle@suse.de
|
|
||||||
- fix 32 bit kexec to boot on 64 bit ppc64 (bnc#405015)
|
|
||||||
* Tue May 27 2008 bwalle@suse.de
|
|
||||||
- fix EDD support when the BIOS-reported length is smaller than
|
|
||||||
the sysfs raw_data size (bnc#388754)
|
|
||||||
* Mon May 26 2008 bwalle@suse.de
|
|
||||||
- fix kexec unload (rckdump stop) on ppc64 (bnc#394216)
|
|
||||||
* Tue May 13 2008 bwalle@suse.de
|
|
||||||
- implement EDD (bnc#383210)
|
|
||||||
* Tue Mar 25 2008 bwalle@suse.de
|
|
||||||
- update to kexec-tools-testing v20080324
|
|
||||||
o tarball update (version), no functional changes between
|
|
||||||
v20080318-rc and v20080324
|
|
||||||
* Tue Mar 18 2008 bwalle@suse.de
|
|
||||||
- update to kexec-tools-testing v20080318-rc
|
|
||||||
o ia64 kern_vaddr_start was calculated incorrectly
|
|
||||||
o ia64: make load_crashdump_segments 80col wide
|
|
||||||
o fix i386 EFI boot using efifb
|
|
||||||
o mipsel: mipsel port
|
|
||||||
o fix kexec-tools on x86_64 (see bnc#368138)
|
|
||||||
o fix valid_memory_range region merging
|
|
||||||
o arm: invalid initialisation of iomem in get_memory_ranges()
|
|
||||||
o arm: use proc_iomem()
|
|
||||||
o no machine machine to proc_iomem()
|
|
||||||
* Fri Mar 14 2008 bwalle@suse.de
|
|
||||||
- update to kexec-tools-testing v20080227-git
|
|
||||||
(current git snapshot, fixes x86_64, bnc#368138)
|
|
||||||
- kexec-tools-portability-issue deleted: mainline
|
|
||||||
* Wed Feb 27 2008 bwalle@suse.de
|
|
||||||
- update to kexec-tools-testing v20080227
|
|
||||||
(only increased version number)
|
|
||||||
* Tue Feb 26 2008 bwalle@suse.de
|
|
||||||
- update to kexec-tools-testing v20080226-rc
|
|
||||||
o build: include configure and include/config.h.in in dist
|
|
||||||
tarball
|
|
||||||
- adjusted kexec-tools-portability-issue to build without warnings
|
|
||||||
on 32 bit systems
|
|
||||||
* Thu Feb 21 2008 bwalle@suse.de
|
|
||||||
- update to kexec-tools-testing v20080221-rc
|
|
||||||
o Only include needed files in distribution tarball
|
|
||||||
o Clean up whitespace in include/x86/x86-linux.h
|
|
||||||
o Kexec command line length
|
|
||||||
- removed kexec-longer-cmdline.diff: fixed mainline differently
|
|
||||||
* Wed Feb 20 2008 bwalle@suse.de
|
|
||||||
- update to kexec-tools-testing v20080219-rc
|
|
||||||
o Fix the feature determining ELF32/ELF64 automatically
|
|
||||||
o Enable building a 32 bit binary for ppc64 platforms.
|
|
||||||
o Consolidate BOOTLOADER defines
|
|
||||||
o Use config.h for defines
|
|
||||||
o Add gamecube to config.h defines
|
|
||||||
o removed partially duplicated system headers
|
|
||||||
o Use general _SRCS and _OBJS, rather and _C_{SRCS, OBJS} and
|
|
||||||
_S_{SRCS, OBJS}
|
|
||||||
o build system fixes
|
|
||||||
o Add documentation on creating include/config.h.in to INSTALL
|
|
||||||
o Log unknown reloc name instead of its number
|
|
||||||
o Use zlib if present
|
|
||||||
o kexec buffer overflow on ppc platform
|
|
||||||
o sh: Remove hardcoded PAGE_SIZE in NetBSD loader
|
|
||||||
o Add ARM support to kexec
|
|
||||||
o Remove some extraneous whitespace
|
|
||||||
o kexec: Use target linker for purgatory
|
|
||||||
- removed kexec-tools-elf32-elf64-fix: mainline
|
|
||||||
- removed kexec-tools.ppc64-32bit-build.patch: mainline
|
|
||||||
- removed kexec-tools.fread-buffer-overflow.patch: mainline
|
|
||||||
* Wed Jan 30 2008 sassmann@suse.de
|
* Wed Jan 30 2008 sassmann@suse.de
|
||||||
- fix fread buffer overflow on ppc
|
- fix fread buffer overflow on ppc
|
||||||
* Tue Jan 22 2008 ro@suse.de
|
* Tue Jan 22 2008 ro@suse.de
|
||||||
@ -287,7 +165,7 @@ install -m 0755 kexec.init ${RPM_BUILD_ROOT}/etc/init.d/kexec
|
|||||||
package
|
package
|
||||||
* Wed Aug 29 2007 bwalle@suse.de
|
* Wed Aug 29 2007 bwalle@suse.de
|
||||||
- add reset_devices kernel parameter as default
|
- add reset_devices kernel parameter as default
|
||||||
* Sun Aug 26 2007 olh@suse.de
|
* Sat Aug 25 2007 olh@suse.de
|
||||||
- do not require kdump-helpers on s390
|
- do not require kdump-helpers on s390
|
||||||
* Fri Jul 27 2007 bwalle@suse.de
|
* Fri Jul 27 2007 bwalle@suse.de
|
||||||
- update documentation for deleting all dumps (#302257)
|
- update documentation for deleting all dumps (#302257)
|
||||||
|
Loading…
Reference in New Issue
Block a user