blob: 9b344dc800f5dd0f676ab4094b19ed5bb577d35c [file]
# SPDX-License-Identifier: (GPL-2.0+ OR MIT)
#
# Copyright (c) 2021 Google, Inc. All rights reserved.
#
#!/bin/bash
exec_name=$0
our_root=$(readlink -f $(dirname $0))
top=${our_root}/..
set -o errtrace
trap 'echo Fatal error: script ${exec_name} aborting at line $LINENO,\
command \"$BASH_COMMAND\" returned $?; exit 1' ERR
arch=arm64
toolchain_path=$top/prebuilt/toolchain/aarch64
cc_clang=$toolchain_path/bin/aarch64-cros-linux-gnu-clang
cross_compile=$toolchain_path/bin/aarch64-cros-linux-gnu-
function usage(){
echo "Usage: ${exec_name} <product> [workspace path]"
echo "supported products: korlan"
}
if (( $# < 1 ))
then
usage
exit 2
fi
readonly kernel_dir=${our_root}
readonly product=$1
readonly workspace_path=$2
function build_perf(){
pushd $kernel_dir/tools/perf
# overwrite the syscalls definitions
cp $toolchain_path/usr/aarch64-cros-linux-gnu/usr/include/asm-generic/unistd.h \
../include/uapi/asm-generic/unistd.h
make CC=$cc_clang CROSS_COMPILE=$cross_compile ARCH=$arch
popd
}
case $product in
korlan)
build_perf
;;
*)
echo "unknown board: $board"
exit 1
esac