summaryrefslogtreecommitdiff
path: root/include/linux/kexec.h
diff options
context:
space:
mode:
authorSven Schnelle <svens@stackframe.org>2019-08-23 22:49:13 +0300
committerHelge Deller <deller@gmx.de>2019-09-07 00:58:43 +0300
commit175fca3bf91a1111b7e46f6655666640556b9059 (patch)
tree7918a9326c405cc49f74cd8785749461c8c8a40c /include/linux/kexec.h
parent544f448599134ffee9ef35d685f933bab708a215 (diff)
downloadlinux-175fca3bf91a1111b7e46f6655666640556b9059.tar.xz
kexec: add KEXEC_ELF
Right now powerpc provides an implementation to read elf files with the kexec_file_load() syscall. Make that available as a public kexec interface so it can be re-used on other architectures. Signed-off-by: Sven Schnelle <svens@stackframe.org> Reviewed-by: Thiago Jung Bauermann <bauerman@linux.ibm.com> Signed-off-by: Helge Deller <deller@gmx.de>
Diffstat (limited to 'include/linux/kexec.h')
-rw-r--r--include/linux/kexec.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index b9b1bc5f9669..da2a6b1d69e7 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -216,6 +216,30 @@ extern int crash_prepare_elf64_headers(struct crash_mem *mem, int kernel_map,
void **addr, unsigned long *sz);
#endif /* CONFIG_KEXEC_FILE */
+#ifdef CONFIG_KEXEC_ELF
+struct kexec_elf_info {
+ /*
+ * Where the ELF binary contents are kept.
+ * Memory managed by the user of the struct.
+ */
+ const char *buffer;
+
+ const struct elfhdr *ehdr;
+ const struct elf_phdr *proghdrs;
+ struct elf_shdr *sechdrs;
+};
+
+int kexec_build_elf_info(const char *buf, size_t len, struct elfhdr *ehdr,
+ struct kexec_elf_info *elf_info);
+
+int kexec_elf_load(struct kimage *image, struct elfhdr *ehdr,
+ struct kexec_elf_info *elf_info,
+ struct kexec_buf *kbuf,
+ unsigned long *lowest_load_addr);
+
+void kexec_free_elf_info(struct kexec_elf_info *elf_info);
+int kexec_elf_probe(const char *buf, unsigned long len);
+#endif
struct kimage {
kimage_entry_t head;
kimage_entry_t *entry;