Include a check in kexec-tools for crashkernel memory reservation.
Create dummy functions in ppc, ia64 and s390 architectures.


Check for crashkernel memory reservation.

Check whether memory for crashkernel is reserved by calling arch dependent
functions. The patch also creates dummy functions in ppc, ia64 and s390
architectures, so that the build process will not break.
Actual is_crashkernel_mem_reserved function needs to be implemented on ppc,
ia64 and s390 architectures.


Signed-off-by: Mohan Kumar M <[EMAIL PROTECTED]>
---
 kexec/arch/ia64/kexec-elf-ia64.c |    8 ++++++++
 kexec/arch/ppc/kexec-elf-ppc.c   |    8 ++++++++
 kexec/arch/s390/kexec-image.c    |    9 +++++++++
 kexec/kexec.c                    |    7 +++++++
 kexec/kexec.h                    |    1 +
 5 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/kexec/arch/ia64/kexec-elf-ia64.c b/kexec/arch/ia64/kexec-elf-ia64.c
index 349c812..beb9b79 100644
--- a/kexec/arch/ia64/kexec-elf-ia64.c
+++ b/kexec/arch/ia64/kexec-elf-ia64.c
@@ -82,6 +82,14 @@ void elf_ia64_usage(void)
                "    --initrd=FILE       Use FILE as the kernel's initial 
ramdisk.\n");
 }
 
+/* Adding a dummy function, so that build on IA64 will not break.
+ * Need to implement the actual checking code
+ */
+int is_crashkernel_mem_reserved()
+{
+       return 1;
+}
+
 /* Move the crash kerenl physical offset to reserved region
  */
 static void move_loaded_segments(struct kexec_info *info, struct mem_ehdr 
*ehdr)
diff --git a/kexec/arch/ppc/kexec-elf-ppc.c b/kexec/arch/ppc/kexec-elf-ppc.c
index e5e5ebd..b0126e9 100644
--- a/kexec/arch/ppc/kexec-elf-ppc.c
+++ b/kexec/arch/ppc/kexec-elf-ppc.c
@@ -102,6 +102,14 @@ void elf_ppc_usage(void)
             "                          addresses suitable for the 
GameCube.\n");
 }
 
+/* Adding a dummy function, so that build on ppc will not break.
+ * Need to implement the actual checking code
+ */
+int is_crashkernel_mem_reserved()
+{
+       return 1;
+}
+
 static void gamecube_hack_addresses(struct mem_ehdr *ehdr)
 {
        struct mem_phdr *phdr, *phdr_end;
diff --git a/kexec/arch/s390/kexec-image.c b/kexec/arch/s390/kexec-image.c
index e1849f0..b65d61d 100644
--- a/kexec/arch/s390/kexec-image.c
+++ b/kexec/arch/s390/kexec-image.c
@@ -135,3 +135,12 @@ image_s390_usage(void)
               "--initrd=FILENAME     Use the file FILENAME as a ramdisk.\n"
                );
 }
+
+/* Adding a dummy function, so that build on s390 will not break.
+ * Need to implement the actual checking code
+ */
+int is_crashkernel_mem_reserved()
+{
+       return 1;
+}
+
diff --git a/kexec/kexec.c b/kexec/kexec.c
index ce0663e..e7d6bb6 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -848,6 +848,13 @@ int main(int argc, char *argv[])
                }
        }
 
+       if ((kexec_flags & KEXEC_ON_CRASH) && !is_crashkernel_mem_reserved()) {
+                       printf("Memory for crashkernel is not reserved\n");
+                       printf("Please reserve memory by passing ");
+                       printf("\"[EMAIL PROTECTED]" parameter to the 
kernel\n");
+                       die("Then try loading kdump kernel\n");
+       }
+
        fileind = optind;
        /* Reset getopt for the next pass; called in other source modules */
        opterr = 1;
diff --git a/kexec/kexec.h b/kexec/kexec.h
index 1cee900..d6942bf 100644
--- a/kexec/kexec.h
+++ b/kexec/kexec.h
@@ -199,6 +199,7 @@ void arch_usage(void);
 int arch_process_options(int argc, char **argv);
 int arch_compat_trampoline(struct kexec_info *info);
 void arch_update_purgatory(struct kexec_info *info);
+int is_crashkernel_mem_reserved(void);
 
 #define MAX_LINE       160
 #endif /* KEXEC_H */
-- 
1.4.2


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

Reply via email to