From 0e43206775dd4c3da4266e0f8d1658476cb94b80 Mon Sep 17 00:00:00 2001 From: Giuliano Procida Date: Mon, 28 Jun 2021 15:33:10 +0100 Subject: [PATCH] GKI: build_abi.sh: copy updated symbols to DIST_DIR This hopes to address reports that the distribution directory doesn't contain up-to-date symbol information after running build_abi.sh --update. The functionality that does this is split out into the new script copy_symbols.sh. Bug: 191692661 Suggested-by: Matthias Maennich Change-Id: I918c64cb8845dd47a27615421aa93ac911d404ed Signed-off-by: Giuliano Procida --- build.sh | 13 ++----------- build_abi.sh | 5 +++++ copy_symbols.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 11 deletions(-) create mode 100755 copy_symbols.sh diff --git a/build.sh b/build.sh index d720b19..2be333f 100755 --- a/build.sh +++ b/build.sh @@ -844,18 +844,9 @@ fi # Copy the abi symbol list file from the sources into the dist dir if [ -n "${KMI_SYMBOL_LIST}" ]; then - echo "========================================================" - echo " Generating abi symbol list definition to ${ABI_SL}" + ${ROOT_DIR}/build/copy_symbols.sh "$ABI_SL" "$ROOT_DIR/$KERNEL_DIR" \ + "${KMI_SYMBOL_LIST}" ${ADDITIONAL_KMI_SYMBOL_LISTS} pushd $ROOT_DIR/$KERNEL_DIR - cp "${KMI_SYMBOL_LIST}" ${ABI_SL} - - # If there are additional symbol lists specified, append them - if [ -n "${ADDITIONAL_KMI_SYMBOL_LISTS}" ]; then - for symbol_list in ${ADDITIONAL_KMI_SYMBOL_LISTS}; do - echo >> ${ABI_SL} - cat "${symbol_list}" >> ${ABI_SL} - done - fi if [ "${TRIM_NONLISTED_KMI}" = "1" ]; then # Create the raw symbol list cat ${ABI_SL} | \ diff --git a/build_abi.sh b/build_abi.sh index 7f583ef..446a2d3 100755 --- a/build_abi.sh +++ b/build_abi.sh @@ -220,6 +220,11 @@ if [ -n "$KMI_SYMBOL_LIST" ]; then ${FULL_ABI_FLAG} \ ${DIST_DIR} + # Redo what build.sh has done, with possibly fresher symbol lists. + ABI_SL="${DIST_DIR}/abi_symbollist" + ${ROOT_DIR}/build/copy_symbols.sh "$ABI_SL" "$ROOT_DIR/$KERNEL_DIR" \ + "${KMI_SYMBOL_LIST}" ${ADDITIONAL_KMI_SYMBOL_LISTS} + # In case of a simple --update-symbol-list call we can bail out early [ $UPDATE -eq 0 ] && exit 0 diff --git a/copy_symbols.sh b/copy_symbols.sh new file mode 100755 index 0000000..f64ecc0 --- /dev/null +++ b/copy_symbols.sh @@ -0,0 +1,42 @@ +#!/bin/bash -eu + +# Copyright (C) 2021 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This is an internal helper script used by build.sh and build_abi.sh + +# arguments are: +# abi_sl - the dist directory ABI symbol list +# kernel_dir +# main_symbol_list_file_name +# (additional_symbol_list_file_name)* + +abi_sl="$1"; shift +kernel_dir="$1"; shift +symbol_list="$1"; shift + +# Copy the abi symbol list file from the sources into the dist dir. +verb=Generating +test -e "$abi_sl" && verb=Refreshing +echo "========================================================" +echo " $verb abi symbol list definition in $abi_sl" +cp -- "$kernel_dir/$symbol_list" "$abi_sl" + +# If there are additional symbol lists specified, append them. +for symbol_list; do + echo >> "$abi_sl" + cat -- "$kernel_dir/$symbol_list" >> "$abi_sl" +done + +exit 0