github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/dashboard/config/android/generate.sh (about)

     1  #!/usr/bin/env bash
     2  # Copyright 2020 syzkaller project authors. All rights reserved.
     3  # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
     4  
     5  # See https://source.android.com/setup/build/building-kernels
     6  # for details on how to checkout and build Android kernel.
     7  
     8  set -eux
     9  
    10  SRC_DIR=$1
    11  VERSION=$2
    12  KERNEL_SOURCE="$SRC_DIR/common"
    13  DEFCONFIG="$KERNEL_SOURCE/arch/x86/configs/gki_defconfig"
    14  SCRIPT_DIR=`cd $(dirname $0); pwd`
    15  
    16  function usage {
    17  	echo "usage: generate.sh /android/kernel/checkout/dir kernel.version"
    18  	echo "supported kernel versions: 5.4"
    19  	exit 1
    20  }
    21  
    22  if [ ! -e "$DEFCONFIG" ]; then
    23  	usage
    24  fi
    25  
    26  case "$VERSION" in
    27  	5.4)
    28  		CC="$SRC_DIR/prebuilts-master/clang/host/linux-x86/clang-r370808/bin/clang"
    29  		;;
    30  	*)
    31  		usage
    32  esac
    33  
    34  . ${SCRIPT_DIR}/../util.sh
    35  cd ${KERNEL_SOURCE}
    36  cp $DEFCONFIG .config
    37  
    38  util_add_usb_bits "android"
    39  util_add_syzbot_bits
    40  
    41  scripts/kconfig/merge_config.sh -m .config ${SCRIPT_DIR}/config-bits
    42  make ${MAKE_VARS} olddefconfig
    43  
    44  cp .config ${SCRIPT_DIR}/config-$VERSION