diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 02:56:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 02:56:35 +0000 |
commit | eba0cfa6b0bef4f2e73c8630a7efa3944df8b0f8 (patch) | |
tree | 74c37eede1f0634cc5de1c63c934edaa1630c6bc /kexec/kexec-elf-core.c | |
parent | Initial commit. (diff) | |
download | kexec-tools-upstream.tar.xz kexec-tools-upstream.zip |
Adding upstream version 1:2.0.27.upstream/1%2.0.27upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'kexec/kexec-elf-core.c')
-rw-r--r-- | kexec/kexec-elf-core.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/kexec/kexec-elf-core.c b/kexec/kexec-elf-core.c new file mode 100644 index 0000000..a341fdb --- /dev/null +++ b/kexec/kexec-elf-core.c @@ -0,0 +1,29 @@ +#include <stdio.h> +#include <stdint.h> +#include <errno.h> +#include <stdlib.h> +#include "elf.h" +#include "kexec-elf.h" + + +int build_elf_core_info(const char *buf, off_t len, struct mem_ehdr *ehdr, + uint32_t flags) +{ + int result; + result = build_elf_info(buf, len, ehdr, flags); + if (result < 0) { + return result; + } + if ((ehdr->e_type != ET_CORE)) { + /* not an ELF Core */ + fprintf(stderr, "Not ELF type ET_CORE\n"); + return -1; + } + if (!ehdr->e_phdr) { + /* No program header */ + fprintf(stderr, "No ELF program header\n"); + return -1; + } + + return 0; +} |