Add a script to install deadpool artifacts from go/ab
authorHongguang <hgchen@google.com>
Fri, 13 May 2022 21:43:25 +0000 (14:43 -0700)
committerChristian Hoffmann <chrmhoffmann@gmail.com>
Sun, 12 Feb 2023 08:13:13 +0000 (09:13 +0100)
Bug: 220644706
Change-Id: I6eb8f7d50016def7275a35b3ca2d358f617a4181

install_deadpool_artifacts.sh [new file with mode: 0644]

diff --git a/install_deadpool_artifacts.sh b/install_deadpool_artifacts.sh
new file mode 100644 (file)
index 0000000..3b99f8a
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/bash -eu
+
+source gbash.sh || exit
+
+DEFINE_string --required build_id "" "GMS Build Id on go/ab"
+DEFINE_string --required install_path "" "The target deadpool-kernel path"
+
+gbash::init_google "${@}"
+
+if [[ "${FLAGS_build_id}" == "" || "${FLAGS_install_path}" == "" ]]; then
+  gbash::quiet_die "Please specify build_id and install_path"
+fi
+
+# Working dir
+tmp_dir=$(mktemp -d -t deadpool-kernel-XXXXXXXXXX)
+
+# TODO: firmware should be built from kernel
+# Back up firmwares
+mv ${install_path}/4.9/lib/firmware/video/* ${tmp_dir}/
+
+# Clean target
+rm -rf ${install_path}/4.9/*
+
+# Download go/ab artifacts
+/google/data/ro/projects/android/fetch_artifact --bid ${FLAGS_build_id} \
+  --target kernel_deadpool --nouse_oauth2 'Image'
+gzip Image
+mv 'Image.gz' ${tmp_dir}/
+/google/data/ro/projects/android/fetch_artifact --bid ${FLAGS_build_id} \
+  --target kernel_deadpool --nouse_oauth2 '*.ko'
+mv '*.ko' ${tmp_dir}/
+
+mkdir -p ${install_path}/4.9/lib/firmware/video/
+mkdir -p ${install_path}/4.9/lib/modules/
+
+# Restore firmwares
+mv ${tmp_dir}/*.bin ${install_path}/4.9/lib/firmware/video/
+
+# Install go/ab artifacts
+mv ${tmp_dir}/Image.gz ${install_path}/4.9/
+mv ${tmp_dir}/optee* ${install_path}/4.9/lib/
+mv ${tmp_dir}/*.ko ${install_path}/4.9/lib/modules/