1#!/bin/bash 2 3# Copyright (C) 2019 The Android Open Source Project 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16 17# Usage: 18# build/build_abi.sh 19# 20# The following environment variables are considered during execution: 21# 22# ABI_OUT_TAG 23# Customize the output file name for the abi dump. If undefined, the tag is 24# derived from `git describe`. 25 26export ROOT_DIR=$(readlink -f $(dirname $0)/..) 27 28set -e 29set -a 30 31source "${ROOT_DIR}/build/envsetup.sh" 32 33# inject CONFIG_DEBUG_INFO=y 34export POST_DEFCONFIG_CMDS="${POST_DEFCONFIG_CMDS} : && update_config_for_abi_dump" 35function update_config_for_abi_dump() { 36 ${KERNEL_DIR}/scripts/config --file ${OUT_DIR}/.config \ 37 -e CONFIG_DEBUG_INFO 38 (cd ${OUT_DIR} && \ 39 make O=${OUT_DIR} $archsubarch CROSS_COMPILE=${CROSS_COMPILE} olddefconfig) 40} 41 42# delegate the actual build to build.sh 43${ROOT_DIR}/build/build.sh $* 44 45echo "========================================================" 46echo " Creating ABI dump" 47 48# create abi dump 49COMMON_OUT_DIR=$(readlink -m ${OUT_DIR:-${ROOT_DIR}/out/${BRANCH}}) 50id=${ABI_OUT_TAG:-$(git -C $KERNEL_DIR describe --dirty --always)} 51abi_out_file=abi-${id}.out 52${ROOT_DIR}/build/abi/dump_abi \ 53 --linux-tree $OUT_DIR \ 54 --out-file ${DIST_DIR}/${abi_out_file} 55 56ln -sf ${abi_out_file} ${DIST_DIR}/abi.out 57 58echo "========================================================" 59echo " ABI dump has been created at ${DIST_DIR}/${abi_out_file}" 60 61