blob: 5acab1af1595fa02f5bd2d87e4a8c2ab5e79c4d0 [file] [log] [blame]
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Matthias Maennich <maennich@google.com>
Date: Mon, 21 Jun 2021 12:54:56 +0100
Subject: NOUPSTREAM: ANDROID: Kleaf: Bazel based GKI kernel build
Add build rules to build the GKI kernels using the hermetic bazel build.
The rules understand how to set up a build environment from build_config
and locations of the sources and build_configs.
Sample invocations:
$ bazel build //common:kernel_aarch64
$ bazel build //common:kernel_aarch64_debug
$ bazel build //common:kernel_x86_64
$ bazel build //common:kernel_x86_64_debug
[CPNOTE: 21/07/21] Lee: GKI code
Bug: 189451175
Bug: 192655270
Change-Id: I2f06b2b79dbcbf197cb23d68b3c2f6786191e19d
Signed-off-by: Matthias Maennich <maennich@google.com>
---
BUILD.bazel | 23 +++++++++++++++++++++++
Makefile | 4 ++++
2 files changed, 27 insertions(+)
create mode 100644 BUILD.bazel
diff --git a/BUILD.bazel b/BUILD.bazel
new file mode 100644
--- /dev/null
+++ b/BUILD.bazel
@@ -0,0 +1,23 @@
+# Copyright (C) 2021 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+package(
+ default_visibility = [
+ "//visibility:public",
+ ],
+)
+
+load("//build/kleaf:common_kernels.bzl", "define_common_kernels")
+load("@kernel_toolchain_info//:dict.bzl", "CLANG_VERSION")
+
+define_common_kernels(toolchain_version = CLANG_VERSION)
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -149,6 +149,10 @@ endif
mixed-build-prefix = $(if $(KBUILD_MIXED_TREE),$(KBUILD_MIXED_TREE)/)
export KBUILD_MIXED_TREE
+# This is a hack for kleaf to set mixed-build-prefix within the execution of a make rule, e.g.
+# within __modinst_pre.
+# TODO(b/205893923): Revert this hack once it is properly handled.
+export mixed-build-prefix
# Kbuild will save output files in the current working directory.
# This does not need to match to the root of the kernel source tree.