Olaf Hering | 93a7205 | 2011-03-23 16:43:29 -0700 | [diff] [blame] | 1 | #include <linux/kernel.h> |
| 2 | #include <linux/crash_dump.h> |
| 3 | #include <linux/init.h> |
| 4 | #include <linux/errno.h> |
Paul Gortmaker | 9984de1 | 2011-05-23 14:51:41 -0400 | [diff] [blame] | 5 | #include <linux/export.h> |
Olaf Hering | 93a7205 | 2011-03-23 16:43:29 -0700 | [diff] [blame] | 6 | |
| 7 | /* |
| 8 | * If we have booted due to a crash, max_pfn will be a very low value. We need |
| 9 | * to know the amount of memory that the previous kernel used. |
| 10 | */ |
| 11 | unsigned long saved_max_pfn; |
| 12 | |
| 13 | /* |
| 14 | * stores the physical address of elf header of crash image |
| 15 | * |
| 16 | * Note: elfcorehdr_addr is not just limited to vmcore. It is also used by |
| 17 | * is_kdump_kernel() to determine if we are booting after a panic. Hence put |
| 18 | * it under CONFIG_CRASH_DUMP and not CONFIG_PROC_VMCORE. |
| 19 | */ |
| 20 | unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX; |
Amir Vadai | b3292e8 | 2014-08-25 16:06:52 +0300 | [diff] [blame] | 21 | EXPORT_SYMBOL_GPL(elfcorehdr_addr); |
Olaf Hering | 93a7205 | 2011-03-23 16:43:29 -0700 | [diff] [blame] | 22 | |
| 23 | /* |
Michael Holzheu | d3bf3795 | 2011-10-30 15:16:37 +0100 | [diff] [blame] | 24 | * stores the size of elf header of crash image |
| 25 | */ |
| 26 | unsigned long long elfcorehdr_size; |
| 27 | |
| 28 | /* |
Olaf Hering | 93a7205 | 2011-03-23 16:43:29 -0700 | [diff] [blame] | 29 | * elfcorehdr= specifies the location of elf core header stored by the crashed |
| 30 | * kernel. This option will be passed by kexec loader to the capture kernel. |
Michael Holzheu | d3bf3795 | 2011-10-30 15:16:37 +0100 | [diff] [blame] | 31 | * |
| 32 | * Syntax: elfcorehdr=[size[KMG]@]offset[KMG] |
Olaf Hering | 93a7205 | 2011-03-23 16:43:29 -0700 | [diff] [blame] | 33 | */ |
| 34 | static int __init setup_elfcorehdr(char *arg) |
| 35 | { |
| 36 | char *end; |
| 37 | if (!arg) |
| 38 | return -EINVAL; |
| 39 | elfcorehdr_addr = memparse(arg, &end); |
Michael Holzheu | d3bf3795 | 2011-10-30 15:16:37 +0100 | [diff] [blame] | 40 | if (*end == '@') { |
| 41 | elfcorehdr_size = elfcorehdr_addr; |
| 42 | elfcorehdr_addr = memparse(end + 1, &end); |
| 43 | } |
Olaf Hering | 93a7205 | 2011-03-23 16:43:29 -0700 | [diff] [blame] | 44 | return end > arg ? 0 : -EINVAL; |
| 45 | } |
| 46 | early_param("elfcorehdr", setup_elfcorehdr); |