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:
Ramji Jiyani
2023-01-20 02:35:02 +00:00
committed by Treehugger Robot
parent d9ffe17d8a
commit 0a903fe828
2 changed files with 23 additions and 9 deletions

View File

@@ -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