ANDROID: refactor build.config files to remove duplication

The build.config.* files largely contain duplicate information by their
nature. Reorganize them reduce duplication and to allow adding new
configurations without copying the definitions again.

Bug: 140224784
Change-Id: I6a3810a125b0ed48591690ca33bb5c02be58218a
Signed-off-by: Matthias Maennich <maennich@google.com>
diff --git a/build.config.aarch64 b/build.config.aarch64
new file mode 100644
index 0000000..523bbc0
--- /dev/null
+++ b/build.config.aarch64
@@ -0,0 +1,11 @@
+ARCH=arm64
+
+CLANG_TRIPLE=aarch64-linux-gnu-
+CROSS_COMPILE=aarch64-linux-androidkernel-
+LINUX_GCC_CROSS_COMPILE_PREBUILTS_BIN=prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin
+
+FILES="
+arch/arm64/boot/Image.gz
+vmlinux
+System.map
+"
diff --git a/build.config.common b/build.config.common
new file mode 100644
index 0000000..3f1fac2
--- /dev/null
+++ b/build.config.common
@@ -0,0 +1,9 @@
+BRANCH=android-mainline
+KERNEL_DIR=common
+
+CC=clang
+CLANG_PREBUILT_BIN=prebuilts-master/clang/host/linux-x86/clang-r353983c/bin
+BUILDTOOLS_PREBUILT_BIN=build/build-tools/path/linux-x86
+
+EXTRA_CMDS=''
+STOP_SHIP_TRACEPRINTK=1
diff --git a/build.config.gki b/build.config.gki
new file mode 100644
index 0000000..66f6eb8
--- /dev/null
+++ b/build.config.gki
@@ -0,0 +1,4 @@
+DEFCONFIG=gki_defconfig
+POST_DEFCONFIG_CMDS="check_defconfig"
+BUILD_INITRAMFS=1
+
diff --git a/build.config.gki.aarch64 b/build.config.gki.aarch64
index 5f40d91c..352a638 100644
--- a/build.config.gki.aarch64
+++ b/build.config.gki.aarch64
@@ -1,20 +1,5 @@
-ARCH=arm64
-BRANCH=android-mainline
-CLANG_TRIPLE=aarch64-linux-gnu-
-CROSS_COMPILE=aarch64-linux-androidkernel-
-CC=clang
-DEFCONFIG=gki_defconfig
-EXTRA_CMDS=''
-KERNEL_DIR=common
-POST_DEFCONFIG_CMDS="check_defconfig"
-CLANG_PREBUILT_BIN=prebuilts-master/clang/host/linux-x86/clang-r353983c/bin
-BUILDTOOLS_PREBUILT_BIN=build/build-tools/path/linux-x86
-LINUX_GCC_CROSS_COMPILE_PREBUILTS_BIN=prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin
-FILES="
-arch/arm64/boot/Image.gz
-vmlinux
-System.map
-"
-STOP_SHIP_TRACEPRINTK=1
+. ${ROOT_DIR}/common/build.config.common
+. ${ROOT_DIR}/common/build.config.aarch64
+. ${ROOT_DIR}/common/build.config.gki
+
 ABI_DEFINITION=abi_gki_aarch64.xml
-BUILD_INITRAMFS=1
diff --git a/build.config.gki.x86_64 b/build.config.gki.x86_64
index 5c2db37..627d1e1 100644
--- a/build.config.gki.x86_64
+++ b/build.config.gki.x86_64
@@ -1,19 +1,4 @@
-ARCH=x86_64
-BRANCH=android-mainline
-CLANG_TRIPLE=x86_64-linux-gnu-
-CROSS_COMPILE=x86_64-linux-androidkernel-
-CC=clang
-DEFCONFIG=gki_defconfig
-EXTRA_CMDS=''
-KERNEL_DIR=common
-POST_DEFCONFIG_CMDS="check_defconfig"
-CLANG_PREBUILT_BIN=prebuilts-master/clang/host/linux-x86/clang-r353983c/bin
-BUILDTOOLS_PREBUILT_BIN=build/build-tools/path/linux-x86
-LINUX_GCC_CROSS_COMPILE_PREBUILTS_BIN=prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/bin
-FILES="
-arch/x86/boot/bzImage
-vmlinux
-System.map
-"
-STOP_SHIP_TRACEPRINTK=1
-BUILD_INITRAMFS=1
+. ${ROOT_DIR}/common/build.config.common
+. ${ROOT_DIR}/common/build.config.x86_64
+. ${ROOT_DIR}/common/build.config.gki
+
diff --git a/build.config.x86_64 b/build.config.x86_64
new file mode 100644
index 0000000..df73a47
--- /dev/null
+++ b/build.config.x86_64
@@ -0,0 +1,11 @@
+ARCH=x86_64
+
+CLANG_TRIPLE=x86_64-linux-gnu-
+CROSS_COMPILE=x86_64-linux-androidkernel-
+LINUX_GCC_CROSS_COMPILE_PREBUILTS_BIN=prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/bin
+
+FILES="
+arch/x86/boot/bzImage
+vmlinux
+System.map
+"