1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
| diff --git a/kexec-tools-1.102pre-makedumpfile-dump-dmesg.patch b/kexec-tools-1.102pre-makedumpfile-dump-dmesg.patch
index 3938280..76c402a 100644
--- a/kexec-tools-1.102pre-makedumpfile-dump-dmesg.patch
+++ b/kexec-tools-1.102pre-makedumpfile-dump-dmesg.patch
@@ -68,7 +68,7 @@ diff -up kexec-tools-testing-20070330/makedumpfile/makedumpfile.c.orig kexec-too
+dump_dmesg()
+{
+ int log_buf_len, length_log, length_oldlog, ret = FALSE;
-+ unsigned long log_addr, logged_chars, index;
++ unsigned long log_addr, logged_chars, log_end, index;
+ char *log_buffer = NULL;
+
+ if (!open_files_for_creating_dumpfile())
@@ -101,10 +101,15 @@ diff -up kexec-tools-testing-20070330/makedumpfile/makedumpfile.c.orig kexec-too
+ printf("Failed to get logged_chars.\n");
+ return FALSE;
+ }
++ if (!readmem(VADDR, SYMBOL(log_end), &log_end, sizeof(log_end))) {
++ printf("Failed to get log_end.\n");
++ return FALSE;
++ }
+ DEBUG_MSG("\n");
+ DEBUG_MSG("log_addr : %lx\n", log_addr);
+ DEBUG_MSG("log_buf_len : %d\n", log_buf_len);
+ DEBUG_MSG("logged_chars : %ld\n", logged_chars);
++ DEBUG_MSG("log_end : %ld\n", log_end);
+
+ if ((log_buffer = malloc(log_buf_len)) == NULL) {
+ ERRMSG("Can't allocate memory for log_buf. %s\n",
@@ -112,21 +117,16 @@ diff -up kexec-tools-testing-20070330/makedumpfile/makedumpfile.c.orig kexec-too
+ return FALSE;
+ }
+
-+ if (logged_chars < log_buf_len) {
++ if (log_end < log_buf_len) {
+ index = 0;
-+ length_log = logged_chars;
++ length_log = log_end;
+
+ if(!readmem(VADDR, log_addr, log_buffer, length_log)) {
+ printf("Failed to read dmesg log.\n");
+ goto out;
+ }
+ } else {
-+ if (!readmem(VADDR, SYMBOL(log_end), &index, sizeof(index))) {
-+ printf("Failed to get log_end.\n");
-+ goto out;
-+ }
-+ DEBUG_MSG("log_end : %lx\n", index);
-+ index &= log_buf_len - 1;
++ index = log_end & (log_buf_len - 1);
+ length_log = log_buf_len;
+ length_oldlog = log_buf_len - index;
+
|