Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) #include <linux/crash_dump.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) #include <linux/errno.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) #include <linux/export.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9)  * stores the physical address of elf header of crash image
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)  * Note: elfcorehdr_addr is not just limited to vmcore. It is also used by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)  * is_kdump_kernel() to determine if we are booting after a panic. Hence put
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)  * it under CONFIG_CRASH_DUMP and not CONFIG_PROC_VMCORE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) EXPORT_SYMBOL_GPL(elfcorehdr_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)  * stores the size of elf header of crash image
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) unsigned long long elfcorehdr_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)  * elfcorehdr= specifies the location of elf core header stored by the crashed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)  * kernel. This option will be passed by kexec loader to the capture kernel.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)  * Syntax: elfcorehdr=[size[KMG]@]offset[KMG]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) static int __init setup_elfcorehdr(char *arg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	char *end;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	if (!arg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	elfcorehdr_addr = memparse(arg, &end);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	if (*end == '@') {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 		elfcorehdr_size = elfcorehdr_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 		elfcorehdr_addr = memparse(end + 1, &end);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	return end > arg ? 0 : -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) early_param("elfcorehdr", setup_elfcorehdr);