aboutsummaryrefslogtreecommitdiffstats
path: root/dashboard/config/android/generate.sh
blob: 36f4bf1fc8c4a30d3d2d55da03f005a2294d1a8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env bash
# Copyright 2020 syzkaller project authors. All rights reserved.
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.

# See https://source.android.com/setup/build/building-kernels
# for details on how to checkout and build Android kernel.

set -eux

SRC_DIR=$1
VERSION=$2
KERNEL_SOURCE="$SRC_DIR/common"
DEFCONFIG="$KERNEL_SOURCE/arch/x86/configs/gki_defconfig"
SCRIPT_DIR=`cd $(dirname $0); pwd`

function usage {
	echo "usage: generate.sh /android/kernel/checkout/dir kernel.version"
	echo "supported kernel versions: 5.4"
	exit 1
}

if [ ! -e "$DEFCONFIG" ]; then
	usage
fi

case "$VERSION" in
	5.4)
		CC="$SRC_DIR/prebuilts-master/clang/host/linux-x86/clang-r370808/bin/clang"
		;;
	*)
		usage
esac

. ${SCRIPT_DIR}/../util.sh
cd ${KERNEL_SOURCE}
cp $DEFCONFIG .config

util_add_usb_bits "android"
util_add_syzbot_bits

scripts/kconfig/merge_config.sh -m .config ${SCRIPT_DIR}/config-bits
make ${MAKE_VARS} olddefconfig

cp .config ${SCRIPT_DIR}/config-$VERSION