summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-09-16 02:00:51 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-09-16 02:00:51 +0000
commit96aabfbcde08035773b1e761d52095996d928ab7 (patch)
tree3507b1c299ed78b3716e5cf422fbbe17d2fa58c6
parent96c8df6ba3f859f0751a5bb377d1f8076bb7b7dc (diff)
parent7381d38e897f95457a62a5fd7e022405fe746eb4 (diff)
downloadzuma-96aabfbcde08035773b1e761d52095996d928ab7.tar.gz
Merge cherrypicks of ['googleplex-android-review.googlesource.com/24778044'] into sparse-10807597-L55800000963065165.
SPARSE_CHANGE: I57a19ab6206793e7dac8ebcc9f08d979330c7bca Change-Id: Ic9451b053accf53d4e609fda4baa93b75f0ce75a
-rw-r--r--conf/init.recovery.device.rc12
-rw-r--r--device.mk9
-rw-r--r--thermistor_log/Android.bp47
-rwxr-xr-xthermistor_log/mark_normal_boot.sh3
-rwxr-xr-xthermistor_log/mark_recovery_boot.sh3
-rw-r--r--thermistor_log/thermistor_log.rc25
-rwxr-xr-xthermistor_log/thermistor_log.sh33
7 files changed, 132 insertions, 0 deletions
diff --git a/conf/init.recovery.device.rc b/conf/init.recovery.device.rc
index 592efbd..d3e1a29 100644
--- a/conf/init.recovery.device.rc
+++ b/conf/init.recovery.device.rc
@@ -3,6 +3,18 @@ on init
setprop sys.usb.controller "11210000.dwc3"
setprop sys.usb.configfs 1
+on init
+ mkdir /mnt/vendor/persist
+ mount f2fs /dev/block/sda1 /mnt/vendor/persist
+ start thermistor_log_recovery_sh
+ start mark_recovery_boot
+
+service thermistor_log_recovery /system/bin/thermistor_log_recovery.sh
+ user root
+ group root shell log readproc
+ seclabel u:r:su:s0
+
+
on init && property:ro.debuggable=1 && property:ro.boot.mode=recovery
start recovery-console
diff --git a/device.mk b/device.mk
index f8a45a8..e438be1 100644
--- a/device.mk
+++ b/device.mk
@@ -50,6 +50,7 @@ else
endif
endif
+
TARGET_BOARD_PLATFORM := zuma
ALLOW_MISSING_DEPENDENCIES := true
@@ -251,6 +252,14 @@ PRODUCT_PACKAGES += \
libOpenCL \
libgpudataproducer
+# factory should always has SELinux permissive
+BOARD_BOOTCONFIG += androidboot.selinux=permissive
+BOARD_KERNEL_CMDLINE += androidboot.selinux=permissive
+PRODUCT_PACKAGES += thermistor_log.sh \
+ thermistor_log_recovery.sh \
+ mark_normal_boot.sh \
+ mark_recovery_boot.sh
+
ifeq ($(USE_SWIFTSHADER),true)
PRODUCT_PACKAGES += \
libEGL_angle \
diff --git a/thermistor_log/Android.bp b/thermistor_log/Android.bp
new file mode 100644
index 0000000..24eb911
--- /dev/null
+++ b/thermistor_log/Android.bp
@@ -0,0 +1,47 @@
+//
+// Copyright (C) 2017 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_applicable_licenses: [
+ "//device/google/zuma:device_google_zuma_license",
+ ],
+}
+
+sh_binary {
+ name: "thermistor_log.sh",
+ src: "thermistor_log.sh",
+ init_rc: ["thermistor_log.rc"],
+ vendor: true,
+}
+
+sh_binary {
+ name: "thermistor_log_recovery.sh",
+ src: "thermistor_log.sh",
+ init_rc: ["thermistor_log.rc"],
+ vendor: true,
+ recovery: true,
+}
+
+sh_binary {
+ name: "mark_normal_boot.sh",
+ src: "mark_normal_boot.sh",
+ vendor: true,
+}
+
+sh_binary {
+ name: "mark_recovery_boot.sh",
+ src: "mark_recovery_boot.sh",
+ vendor: true,
+}
diff --git a/thermistor_log/mark_normal_boot.sh b/thermistor_log/mark_normal_boot.sh
new file mode 100755
index 0000000..1bce609
--- /dev/null
+++ b/thermistor_log/mark_normal_boot.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+echo "normal,`date +%s`" >> /mnt/vendor/persist/bootlog.txt
+
diff --git a/thermistor_log/mark_recovery_boot.sh b/thermistor_log/mark_recovery_boot.sh
new file mode 100755
index 0000000..6e3e919
--- /dev/null
+++ b/thermistor_log/mark_recovery_boot.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+echo "recovery,`date +%s`" >> /mnt/vendor/persist/bootload
+
diff --git a/thermistor_log/thermistor_log.rc b/thermistor_log/thermistor_log.rc
new file mode 100644
index 0000000..a28a8a5
--- /dev/null
+++ b/thermistor_log/thermistor_log.rc
@@ -0,0 +1,25 @@
+on post-fs
+ # Copy ufs firmware to disk
+ start thermistor_log_sh
+ start mark_normal_boot
+
+service thermistor_log_sh /vendor/bin/thermistor_log.sh
+ user root
+ group root shell log readproc
+ seclabel u:r:su:s0
+ disabled
+ oneshot
+
+service mark_normal_boot /vendor/bin/mark_normal_boot.sh
+ user root
+ group root shell log readproc
+ seclabel u:r:su:s0
+ disabled
+ oneshot
+
+service mark_recovery_boot /vendor/bin/mark_recovery_boot.sh
+ user root
+ group root shell log readproc
+ seclabel u:r:su:s0
+ disabled
+ oneshot
diff --git a/thermistor_log/thermistor_log.sh b/thermistor_log/thermistor_log.sh
new file mode 100755
index 0000000..af1616e
--- /dev/null
+++ b/thermistor_log/thermistor_log.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+# Script to write THERMISTORS to OUTFILE every 10s.
+# Backup OUTFILE to OUTFILE.old if it gets too big (>1000000 bytes)
+
+OUTFILE=/mnt/vendor/persist/therm.log
+THERMISTORS="soc_therm cam_therm charge_therm rf1_therm disp_therm battery"
+
+while sleep 10; do
+ if [ -e ${OUTFILE} ]; then
+ if [ `stat -c %s ${OUTFILE}` -ge 1000000 ]; then
+ echo "backing up 1MB file";
+ mv ${OUTFILE} ${OUTFILE}.old
+ else
+ echo "exists - small";
+ fi
+ else
+ VALUES="time"
+ for thermistor in ${THERMISTORS}; do
+ VALUES="${VALUES},${thermistor}"
+ done
+ echo "${VALUES}" >> ${OUTFILE}
+ fi
+
+ TIME=`date +%s`
+ VALUES="${TIME}"
+ for thermistor in ${THERMISTORS}; do
+ READ=`cat /dev/thermal/tz-by-name/${thermistor}/temp`
+ TRIMMED=`echo -n ${READ}`
+ VALUES="${VALUES},${TRIMMED}"
+ done
+ echo "${VALUES}" >> ${OUTFILE}
+done
+