blob: 92da32275af51eae116bdfa56b93813cdceb644e [file] [log] [blame]
Thomas Gleixner457c8992019-05-19 13:08:55 +01001// SPDX-License-Identifier: GPL-2.0-only
Olaf Hering93a72052011-03-23 16:43:29 -07002#include <linux/kernel.h>
3#include <linux/crash_dump.h>
4#include <linux/init.h>
5#include <linux/errno.h>
Paul Gortmaker9984de12011-05-23 14:51:41 -04006#include <linux/export.h>
Olaf Hering93a72052011-03-23 16:43:29 -07007
8/*
Olaf Hering93a72052011-03-23 16:43:29 -07009 * stores the physical address of elf header of crash image
10 *
11 * Note: elfcorehdr_addr is not just limited to vmcore. It is also used by
12 * is_kdump_kernel() to determine if we are booting after a panic. Hence put
13 * it under CONFIG_CRASH_DUMP and not CONFIG_PROC_VMCORE.
14 */
15unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX;
Amir Vadaib3292e82014-08-25 16:06:52 +030016EXPORT_SYMBOL_GPL(elfcorehdr_addr);
Olaf Hering93a72052011-03-23 16:43:29 -070017
18/*
Michael Holzheud3bf37952011-10-30 15:16:37 +010019 * stores the size of elf header of crash image
20 */
21unsigned long long elfcorehdr_size;
22
23/*
Olaf Hering93a72052011-03-23 16:43:29 -070024 * elfcorehdr= specifies the location of elf core header stored by the crashed
25 * kernel. This option will be passed by kexec loader to the capture kernel.
Michael Holzheud3bf37952011-10-30 15:16:37 +010026 *
27 * Syntax: elfcorehdr=[size[KMG]@]offset[KMG]
Olaf Hering93a72052011-03-23 16:43:29 -070028 */
29static int __init setup_elfcorehdr(char *arg)
30{
31 char *end;
32 if (!arg)
33 return -EINVAL;
34 elfcorehdr_addr = memparse(arg, &end);
Michael Holzheud3bf37952011-10-30 15:16:37 +010035 if (*end == '@') {
36 elfcorehdr_size = elfcorehdr_addr;
37 elfcorehdr_addr = memparse(end + 1, &end);
38 }
Olaf Hering93a72052011-03-23 16:43:29 -070039 return end > arg ? 0 : -EINVAL;
40}
41early_param("elfcorehdr", setup_elfcorehdr);