ANDROID: GKI: Header generation fix and improvements
Remove dependency on kleaf intermediate abi_symbollist.raw and use vendor symbol lists as dependencies for header generation targets. This prevents the feature to break in case kleaf path and/or sandboxes changes and rebuilds the header files if any vendor symbol list changes. Update the header generation script to process the symbol lists before generating headers to make sure symbols are in byte order, any symbol list marker, whitespaces and emptylines are removed for kernel binary search API. Bug: 232430739 Test: TH Change-Id: Ib5783fb21543844dac7faf1fb0fcf3e7bd2bf608 Signed-off-by: Ramji Jiyani <ramjiyani@google.com>
This commit is contained in:
committed by
Treehugger Robot
parent
d9ffe17d8a
commit
0a903fe828
@@ -166,12 +166,20 @@ clean-files := kheaders_data.tar.xz kheaders.md5
|
||||
$(obj)/gki_module.o: $(obj)/gki_module_protected_exports.h \
|
||||
$(obj)/gki_module_unprotected.h
|
||||
|
||||
$(obj)/gki_module_unprotected.h: $(srctree)/scripts/gen_gki_modules_headers.sh \
|
||||
$(if $(wildcard ${OUT_DIR}/abi_symbollist.raw), ${OUT_DIR}/abi_symbollist.raw)
|
||||
ALL_KMI_SYMBOLS := all_kmi_symbols
|
||||
|
||||
$(obj)/gki_module_unprotected.h: $(ALL_KMI_SYMBOLS) \
|
||||
$(srctree)/scripts/gen_gki_modules_headers.sh
|
||||
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/gen_gki_modules_headers.sh $@ \
|
||||
"$(srctree)"
|
||||
"$(srctree)" \
|
||||
$(ALL_KMI_SYMBOLS)
|
||||
|
||||
# Generate symbol list with union of all symbol list for arm64; empty for others
|
||||
$(ALL_KMI_SYMBOLS): $(if $(filter arm64,$(ARCH)),$(wildcard $(srctree)/android/abi_gki_aarch64*),)
|
||||
$(if $(strip $^),cat $^ > $(ALL_KMI_SYMBOLS), echo "" > $(ALL_KMI_SYMBOLS))
|
||||
|
||||
$(obj)/gki_module_protected_exports.h: $(srctree)/android/abi_gki_protected_exports \
|
||||
$(srctree)/scripts/gen_gki_modules_headers.sh
|
||||
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/gen_gki_modules_headers.sh $@ \
|
||||
"$(srctree)"
|
||||
"$(srctree)" \
|
||||
$<
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
# Collect arguments from Makefile
|
||||
TARGET=$1
|
||||
SRCTREE=$2
|
||||
SYMBOL_LIST=$3
|
||||
|
||||
set -e
|
||||
|
||||
@@ -47,8 +48,14 @@ generate_header() {
|
||||
rm -f -- "${header_file}"
|
||||
fi
|
||||
|
||||
# Find Maximum symbol name length if valid symbol_file exist
|
||||
# If symbol_file exist preprocess it and find maximum name length
|
||||
if [ -s "${symbol_file}" ]; then
|
||||
# Remove White Spaces, empty lines and symbol list markers if any
|
||||
sed -i '/^[[:space:]]*$/d; /^#/d; /\[abi_symbol_list\]/d' "${symbol_file}"
|
||||
|
||||
# Sort in byte order for kernel binary search at runtime
|
||||
LC_ALL=C sort -o "${symbol_file}" "${symbol_file}"
|
||||
|
||||
# Trim white spaces & +1 for null termination
|
||||
local max_name_len=$(awk '
|
||||
{
|
||||
@@ -88,13 +95,12 @@ generate_header() {
|
||||
}
|
||||
|
||||
if [ "$(basename "${TARGET}")" = "gki_module_unprotected.h" ]; then
|
||||
# Sorted list of vendor symbols
|
||||
GKI_VENDOR_SYMBOLS="${OUT_DIR}/abi_symbollist.raw"
|
||||
|
||||
# Union of vendor symbol lists
|
||||
GKI_VENDOR_SYMBOLS="${SYMBOL_LIST}"
|
||||
generate_header "${TARGET}" "${GKI_VENDOR_SYMBOLS}" "unprotected"
|
||||
else
|
||||
# Sorted list of exported symbols
|
||||
GKI_EXPORTED_SYMBOLS="${SRCTREE}/android/abi_gki_protected_exports"
|
||||
GKI_EXPORTED_SYMBOLS="${SYMBOL_LIST}"
|
||||
|
||||
generate_header "${TARGET}" "${GKI_EXPORTED_SYMBOLS}" "protected_exports"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user