Let extract_kernel return full kernel release.
Also add relevant soong rules for genrules to use it.
Test: use it in GKI APEX
Bug: 161563386
Change-Id: I04f80ba91748ee5783088d4e20e6438418863f62
diff --git a/tools/Android.bp b/tools/Android.bp
index 149d06d..e0f3739 100644
--- a/tools/Android.bp
+++ b/tools/Android.bp
@@ -56,3 +56,23 @@
test_config: "post_process_props_unittest.xml",
test_suites: ["general-tests"],
}
+
+python_binary_host {
+ name: "extract_kernel",
+ srcs: ["extract_kernel.py"],
+ version: {
+ py2: {
+ enabled: true,
+ },
+ py3: {
+ enabled: false,
+ },
+ },
+}
+
+genrule_defaults {
+ name: "extract_kernel_release_defaults",
+ tools: ["extract_kernel", "lz4"],
+ out: ["kernel_release.txt"],
+ cmd: "$(location) --tools lz4:$(location lz4) --input $(in) --output-release > $(out)"
+}