From: Roland M. Roehrich <rroehric at mc.com>

 This hack passes a hardcoded codepage as the first segment in the 
sys_kexec_load call.  It shows how to use the "[patch 1/1] Kexec: allow 
passed in codepage on sys_kexec_load", sent separately.  This hack will 
probably not work on your platform, and will need customization.  No 
work was done to incorporate this function properly into the tool.

Signed-off-by: Roland M. Roehrich <rroehric at mc.com>

---

This patch applies to kexec-tools-1.101. 
A codepage is binary, and should probably contain relative 
jumps...except the last one....
Debug prints turned on....
Not intended to be merged....

diff -uprN kexec-tools-1.101/kexec/arch/ppc/kexec-ppc.c 
kexec-tools-1.101.mercury/kexec/arch/ppc/kexec-ppc.c
--- kexec-tools-1.101/kexec/arch/ppc/kexec-ppc.c        2005-01-11 
01:28:03.000000000 -0500
+++ kexec-tools-1.101.mercury/kexec/arch/ppc/kexec-ppc.c        
2006-10-26 20:48:54.000000000 -0400
@@ -33,6 +33,13 @@ int get_memory_ranges(struct memory_rang
        memory_range[memory_ranges].type = RANGE_RAM;
        memory_ranges++;
 #else
+        /* MRCY DRAM - 256M populated on TahoeSBC */
+        memory_range[memory_ranges].start = 0x00008000;
+        memory_range[memory_ranges].end = 0x10000000;
+        memory_range[memory_ranges].type = RANGE_RAM;
+        memory_ranges++;
+#endif
+#ifdef FALSE
 #error Please, fix this for your platform
        const char iomem[] = "/proc/iomem";
        char line[MAX_LINE];
diff -uprN kexec-tools-1.101/kexec/kexec.c 
kexec-tools-1.101.mercury/kexec/kexec.c
--- kexec-tools-1.101/kexec/kexec.c     2005-01-13 08:24:29.000000000 -0500
+++ kexec-tools-1.101.mercury/kexec/kexec.c     2006-10-26 
20:35:35.000000000 -0400
@@ -498,6 +498,9 @@ static int my_load(const char *type, int
        char *kernel;
        char *kernel_buf;
        off_t kernel_size;
+       char *codepages;
+       char *codepages_buf;
+       off_t codepages_size;
        int i = 0;
        int result;
        struct kexec_info info;
@@ -514,10 +517,12 @@ static int my_load(const char *type, int
                usage();
                return -1;
        }
+
+
        kernel = argv[fileind];
        /* slurp in the input kernel */
        kernel_buf = slurp_decompress_file(kernel, &kernel_size);
-#if 0
+#if 1
        fprintf(stderr, "kernel: %p kernel_size: %lx\n",
                kernel_buf, kernel_size);
 #endif
@@ -526,6 +531,7 @@ static int my_load(const char *type, int
                fprintf(stderr, "Could not get memory layout\n");
                return -1;
        }
+
        /* if a kernel type was specified, try to honor it */
        if (type) {
                for (i = 0; i < file_types; i++) {
@@ -577,13 +583,45 @@ static int my_load(const char *type, int
                        return -1;
                }
        }
+printf("loading codepages...");
+       codepages = &"/home/codepage.bin";
+       codepages_buf = slurp_decompress_file(codepages, &codepages_size);
+#if 1
+       fprintf(stderr, "codepages: %p codepages_size: 0x%lx\n",
+               codepages_buf, codepages_size);
+#endif
+       add_segment(&info, codepages_buf, codepages_size, 0x9000, 
codepages_size);
+       kexec_flags |= KEXEC_USE_PASSED_CODEPAGE;
+printf("ok\n");
        /* Sort the segments and verify we don't have overlaps */
        if (sort_segments(&info) < 0) {
                return -1;
        }
+printf("Mush around\n");
+       { unsigned long temp_buf;
+         unsigned long temp_bufsz;
+         unsigned long temp_mem;
+         unsigned long temp_memsz;
+
+         temp_buf = info.segment[1].buf;
+         temp_bufsz = info.segment[1].bufsz;
+         temp_mem = info.segment[1].mem;
+         temp_memsz = info.segment[1].memsz;
+
+         info.segment[1].buf = info.segment[0].buf;
+         info.segment[1].bufsz = info.segment[0].bufsz;
+         info.segment[1].mem = info.segment[0].mem;
+         info.segment[1].memsz = info.segment[0].memsz;
+
+         info.segment[0].buf = temp_buf;
+         info.segment[0].bufsz = temp_bufsz;
+         info.segment[0].mem = temp_mem;
+         info.segment[0].memsz = temp_memsz;
+       }
+
        /* if purgatory is loaded update it */
        update_purgatory(&info);
-#if 0
+#if 1
        fprintf(stderr, "kexec_load: entry = %p flags = %lx\n",
                info.entry, kexec_flags);
        print_segments(stderr, &info);
diff -uprN kexec-tools-1.101/kexec/kexec-syscall.h 
kexec-tools-1.101.mercury/kexec/kexec-syscall.h
--- kexec-tools-1.101/kexec/kexec-syscall.h     2005-01-06 
01:59:50.000000000 -0500
+++ kexec-tools-1.101.mercury/kexec/kexec-syscall.h     2006-10-16 
10:09:24.000000000 -0400
@@ -55,8 +55,9 @@ static inline long kexec_reboot(void)
 }


-#define KEXEC_ON_CRASH  0x00000001
-#define KEXEC_ARCH_MASK 0xffff0000
+#define KEXEC_ON_CRASH                 0x00000001
+#define KEXEC_USE_PASSED_CODEPAGE      0x00000002
+#define KEXEC_ARCH_MASK                0xffff0000

 /* These values match the ELF architecture values.
  * Unless there is a good reason that should continue to be the case.


_______________________________________________
fastboot mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/fastboot

Reply via email to