summaryrefslogtreecommitdiff
path: root/util_lib/Makefile
diff options
context:
space:
mode:
authorBhupesh Sharma <bhsharma@redhat.com>2018-12-20 16:52:51 +0530
committerSimon Horman <horms@verge.net.au>2019-01-09 13:27:50 +0100
commitf4ce0706d9574aecb7d4aa9af7208a1bc9b6afb4 (patch)
treec5ab742cc5b916f09dd3b4ef9a7f7a0b54876aed /util_lib/Makefile
parentf56cbcf4c2766e5e7d18808b33f2b71519be5207 (diff)
util_lib: Add functionality to read elf notes
'vmcore-dmesg.c' already implements functionality to read 'vmcoreinfo' from vmcore file. The same can be used in other features as well (one of which is reading the elf notes from 'kcore' file), so there is merit in moving this to the utility libraries (util_lib). Newer kernel versions (>= 4.19, with commit 23c85094fe1895caefdd ["proc/kcore: add vmcoreinfo note to /proc/kcore"], available), have 'kcore' which now contains a new PT_NOTE which carries the VMCOREINFO information. If the same is available, we can benefit by using it in 'kexec-tools'. This is especially useful for architectures like arm64 as we can get kernel symbols like 'PHYS_OFFSET' from the '/proc/kcore' itself and use it to calculate 'phys_offset' before we make a call to 'set_phys_offset()'. For older kernels, we can try and determine the PHYS_OFFSET value from PT_LOAD segments inside 'kcore' via some jugglery of the correct virtual and physical address combinations. Subsequent patch(es) in this series will use the same feature to read the 'kcore' file. This patch also makes some of the functions which were earlier present in 'vmcore-dmesg.c' as non-static, so as to allow future patches to use them as library functions. Also we add the capability to read 'NUMBER(PHYS_OFFSET)' from vmcoreinfo to the already present 'scan_vmcoreinfo()' code. Future patches can look at reading more vmcoreinfo information (for e.g. 'kaslr_offset()' for x86_64 and arm64) by using the same framework. Signed-off-by: Bhupesh Sharma <bhsharma@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'util_lib/Makefile')
-rw-r--r--util_lib/Makefile4
1 files changed, 3 insertions, 1 deletions
diff --git a/util_lib/Makefile b/util_lib/Makefile
index 54ccdc5..4a6213a 100644
--- a/util_lib/Makefile
+++ b/util_lib/Makefile
@@ -3,6 +3,7 @@
#
UTIL_LIB_SRCS +=
UTIL_LIB_SRCS += util_lib/compute_ip_checksum.c
+UTIL_LIB_SRCS += util_lib/elf_info.c
UTIL_LIB_SRCS += util_lib/sha256.c
UTIL_LIB_OBJS =$(call objify, $(UTIL_LIB_SRCS))
UTIL_LIB_DEPS =$(call depify, $(UTIL_LIB_OBJS))
@@ -11,7 +12,8 @@ UTIL_LIB = libutil.a
-include $(UTIL_LIB_DEPS)
dist += util_lib/Makefile $(UTIL_LIB_SRCS) \
- util_lib/include/sha256.h util_lib/include/ip_checksum.h
+ util_lib/include/elf_info.h util_lib/include/sha256.h \
+ util_lib/include/ip_checksum.h
clean += $(UTIL_LIB_OBJS) $(UTIL_LIB_DEPS) $(UTIL_LIB)
$(UTIL_LIB): CPPFLAGS += -I$(srcdir)/util_lib/include