BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+7
@@ -0,0 +1,7 @@
|
||||
#!/vendor/bin/sh
|
||||
echo "Citadel VERSION\n"
|
||||
vendor/bin/hw/citadel_updater -lv
|
||||
echo "Citadel STATS\n"
|
||||
vendor/bin/hw/citadel_updater --stats
|
||||
echo "GSC DEBUG DUMP\n"
|
||||
vendor/bin/hw/citadel_updater -D
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+48
@@ -0,0 +1,48 @@
|
||||
#!/vendor/bin/sh
|
||||
|
||||
echo 'Temperatures'
|
||||
for f in /sys/class/thermal/thermal* ; do
|
||||
echo `cat $f/type`: `cat $f/temp`
|
||||
done
|
||||
|
||||
echo 'Cooling Device Current State'
|
||||
for f in /sys/class/thermal/cooling* ; do
|
||||
echo `cat $f/type`: `cat $f/cur_state`
|
||||
done
|
||||
|
||||
echo 'Cooling Device User Vote State'
|
||||
for f in /sys/class/thermal/cooling* ; do
|
||||
if ! [ -r $f/user_vote ]; then continue; fi;
|
||||
echo `cat $f/type`: `cat $f/user_vote`
|
||||
done
|
||||
|
||||
echo 'Cooling Device Time in State'
|
||||
for f in /sys/class/thermal/cooling* ; do
|
||||
echo `cat $f/type`: `cat $f/stats/time_in_state_ms`
|
||||
done
|
||||
|
||||
echo 'Cooling Device Trans Table'
|
||||
for f in /sys/class/thermal/cooling* ; do
|
||||
echo `cat $f/type`: `cat $f/stats/trans_table`
|
||||
done
|
||||
|
||||
echo 'Cooling Device State2Power Table'
|
||||
for f in /sys/class/thermal/cooling* ; do
|
||||
if ! [ -r $f/state2power_table ]; then continue; fi;
|
||||
echo `cat $f/type`: `cat $f/state2power_table`
|
||||
done
|
||||
|
||||
echo 'TMU state:'
|
||||
cat /sys/module/gs_thermal/parameters/tmu_reg_dump_state
|
||||
echo 'TMU intpend:'
|
||||
cat /sys/module/gs_thermal/parameters/tmu_reg_dump_intpend
|
||||
echo 'TMU current temperature:'
|
||||
cat /sys/module/gs_thermal/parameters/tmu_reg_dump_current_temp
|
||||
echo 'TMU_TOP rise thresholds:'
|
||||
cat /sys/module/gs_thermal/parameters/tmu_top_reg_dump_rise_thres
|
||||
echo 'TMU_TOP fall thresholds:'
|
||||
cat /sys/module/gs_thermal/parameters/tmu_top_reg_dump_fall_thres
|
||||
echo 'TMU_SUB rise thresholds:'
|
||||
cat /sys/module/gs_thermal/parameters/tmu_sub_reg_dump_rise_thres
|
||||
echo 'TMU_SUB fall thresholds:'
|
||||
cat /sys/module/gs_thermal/parameters/tmu_sub_reg_dump_fall_thres
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
#!/vendor/bin/sh
|
||||
|
||||
DIR=/data/vendor/dump_touch
|
||||
LOCKFILE="$DIR"/dumping
|
||||
LOGFILE="$DIR"/dump.log
|
||||
|
||||
if [ ! -f $LOCKFILE ] || [ ! -f $LOGFILE ] || [ "$(cat $LOCKFILE)" = 0 ]
|
||||
then
|
||||
echo "-----------------------------------------------------"
|
||||
echo "Info : Touch debug data not found! Backfilling..."
|
||||
echo "-----------------------------------------------------"
|
||||
/vendor/bin/predump_touch.sh > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
state=$(cat $LOCKFILE)
|
||||
if [ "$state" != 2 ]
|
||||
then
|
||||
echo "Unexpected state! Expected 2 but found ${state}"
|
||||
fi
|
||||
|
||||
if [ -f $LOGFILE ]
|
||||
then
|
||||
cat $LOGFILE
|
||||
echo "" > $LOGFILE
|
||||
fi
|
||||
|
||||
if [ -f $LOCKFILE ]
|
||||
then
|
||||
echo 0 > $LOCKFILE
|
||||
fi
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
#!/vendor/bin/sh
|
||||
echo "--- Trusty TEE0 Logs ---"
|
||||
cat /dev/trusty-log0
|
||||
BIN
Binary file not shown.
+69
@@ -0,0 +1,69 @@
|
||||
#!/vendor/bin/sh
|
||||
path="/sys/devices/virtual/goog_touch_interface/gti.0"
|
||||
procfs_path="/proc/goog_touch_interface/gti.0"
|
||||
|
||||
if [[ -d "$procfs_path" ]]; then
|
||||
heatmap_path=$procfs_path
|
||||
else
|
||||
heatmap_path=$path
|
||||
fi
|
||||
|
||||
if [[ -f "${procfs_path}/dump" ]]; then
|
||||
echo "------ Dump ------"
|
||||
cat ${procfs_path}/dump
|
||||
fi
|
||||
|
||||
echo "------ Force Touch Active ------"
|
||||
result=$( cat "$path/force_active" 2>&1 )
|
||||
if [ $? -eq 0 ]; then
|
||||
state=$( echo "$result" |cut -d " " -f 2 )
|
||||
if [ "$state" = "locked" ]; then
|
||||
echo "The force_active is already locked!"
|
||||
else
|
||||
echo 1 > $path/force_active
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to active touch device"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if [[ $result == *Operation\ not\ supported* ]]; then
|
||||
echo "force_active is not support, skip it"
|
||||
else
|
||||
echo "Failed to read the state of force_force"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "------ Touch Firmware Version ------"
|
||||
cat $path/fw_ver
|
||||
|
||||
echo "------ Panel ID ------"
|
||||
cat $path/panel_id
|
||||
|
||||
echo "------ Offload ID ------"
|
||||
cat $path/offload_id
|
||||
|
||||
echo "------ Get Mutual Sensing Data - Baseline ------"
|
||||
cat $heatmap_path/ms_base
|
||||
|
||||
echo "------ Get Mutual Sensing Data - Delta ------"
|
||||
cat $heatmap_path/ms_diff
|
||||
|
||||
echo "------ Get Mutual Sensing Data - Raw ------"
|
||||
cat $heatmap_path/ms_raw
|
||||
|
||||
echo "------ Get Self Sensing Data - Baseline ------"
|
||||
cat $heatmap_path/ss_base
|
||||
|
||||
echo "------ Get Self Sensing Data - Delta ------"
|
||||
cat $heatmap_path/ss_diff
|
||||
|
||||
echo "------ Get Self Sensing Data - Raw ------"
|
||||
cat $heatmap_path/ss_raw
|
||||
|
||||
echo "------ Self Test ------"
|
||||
cat $path/self_test
|
||||
|
||||
echo "------ Disable Force Touch Active ------"
|
||||
echo 0 > $path/force_active
|
||||
BIN
Binary file not shown.
Vendored
Executable
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
Executable
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+6
@@ -0,0 +1,6 @@
|
||||
#!/vendor/bin/sh
|
||||
|
||||
max77759tcpc_path=/sys/devices/platform/10d60000.hsi2c/i2c-13/13-0025
|
||||
if [ -d $max77759tcpc_path ]; then
|
||||
echo 0 > $max77759tcpc_path/contaminant_detection;
|
||||
fi
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
+261
@@ -0,0 +1,261 @@
|
||||
#!/vendor/bin/sh
|
||||
#
|
||||
# Copyright 2020 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.
|
||||
|
||||
# This script automates Dauntless firmware updates
|
||||
#
|
||||
# We use the name "dauntless" in the source for clarity, but keep "citadel" on
|
||||
# the target so we don't have to change all the factory scripts.
|
||||
|
||||
set -u
|
||||
|
||||
# There are multiple pre-production images, so we have to pick the right one
|
||||
FWDIR=/vendor/firmware/dauntless
|
||||
|
||||
# Update tool
|
||||
UPDATER=/vendor/bin/hw/citadel_updater
|
||||
|
||||
# Log messages to both logcat and the shell
|
||||
LOG_TAG=init_citadel
|
||||
|
||||
log_info() {
|
||||
log -p i -t "${LOG_TAG}" "$1"
|
||||
echo "$1" >&2
|
||||
}
|
||||
|
||||
log_error() {
|
||||
log -p e -t "${LOG_TAG}" "$1"
|
||||
echo "$1" >&2
|
||||
}
|
||||
|
||||
die() {
|
||||
log_error "fatal: $1"
|
||||
exit 1
|
||||
}
|
||||
|
||||
get_running_version() {
|
||||
# See what's running now
|
||||
log_info "Checking RW firmware version..."
|
||||
version=$(${UPDATER} -vv)
|
||||
status=$?
|
||||
if [[ $status -ne 0 ]] ; then
|
||||
log_error "Failed to get RW firmware version"
|
||||
return 1
|
||||
fi
|
||||
log_info "Running RW version: ${version}"
|
||||
echo "$version"
|
||||
}
|
||||
|
||||
log_ro_version() {
|
||||
log_info "Checking RO firmware version..."
|
||||
version=$(${UPDATER} -l | grep RO_)
|
||||
status=$?
|
||||
if [[ $status -ne 0 ]] ; then
|
||||
log_error "Failed to get RO firmware version"
|
||||
return 0
|
||||
fi
|
||||
log_info "${version}"
|
||||
}
|
||||
|
||||
find_image_file() {
|
||||
version="$1"
|
||||
|
||||
# There are several flavors of dauntless chips and they're all signed
|
||||
# differently. If we have multiple images to choose from, we'll try to pick
|
||||
# the image that matches the running firmware.
|
||||
|
||||
# The -vv option will try to identify the flavor. If it can, it will append
|
||||
# a /FLAVOR string to the version string.
|
||||
flavor=$(echo $version | cut -d/ -f3)
|
||||
# For node-locked images we have to let the chip tell us
|
||||
[[ -z "$flavor" ]] &&
|
||||
flavor=$(${UPDATER} -l | grep Chip | sed -e 's/^.*(//' -e 's/).*//')
|
||||
# Look for a matching image name
|
||||
[[ -n "$flavor" ]] && log_info "Flavor: $flavor" &&
|
||||
[[ -f "$FWDIR/$flavor.ec.bin" ]] &&
|
||||
fwbin="$FWDIR/$flavor.ec.bin"
|
||||
# Look for the default if no flavor known or image available
|
||||
[[ -z "${fwbin:-}" ]] && [[ -f "$FWDIR/ec.bin" ]] &&
|
||||
fwbin="$FWDIR/ec.bin"
|
||||
# Still nothing? That's not right
|
||||
if [[ -z "${fwbin:-}" ]]; then
|
||||
log_info "Couldn't find a firmware image to upload"
|
||||
return 1;
|
||||
fi
|
||||
log_info "Image file: $fwbin"
|
||||
echo "$fwbin"
|
||||
}
|
||||
|
||||
is_newer_ro() {
|
||||
fwbin="$1"
|
||||
|
||||
file_is_newer=$(${UPDATER} --is_newer_ro "$fwbin")
|
||||
status=$?
|
||||
if [[ $status -ne 0 ]] ; then
|
||||
log_error "Failed to compare running RO with file"
|
||||
return 1
|
||||
fi
|
||||
|
||||
log_info "Is RO in file newer: $file_is_newer"
|
||||
echo "$file_is_newer";
|
||||
}
|
||||
|
||||
is_newer_rw() {
|
||||
fwbin="$1"
|
||||
|
||||
file_is_newer=$(${UPDATER} --is_newer_rw "$fwbin")
|
||||
status=$?
|
||||
if [[ $status -ne 0 ]] ; then
|
||||
log_error "Failed to compare running RW with file"
|
||||
return 1
|
||||
fi
|
||||
|
||||
log_info "Is RW in file newer: $file_is_newer"
|
||||
echo "$file_is_newer";
|
||||
}
|
||||
|
||||
upload_fw() {
|
||||
which="$1"
|
||||
fwbin="$2"
|
||||
|
||||
# Try several times
|
||||
log_info "Uploading firmware..."
|
||||
${UPDATER} "$which" "${fwbin}" && echo "okay" && return 0
|
||||
|
||||
log_info "Trying again..."
|
||||
${UPDATER} "$which" "${fwbin}" && echo "okay" && return 0
|
||||
|
||||
log_info "Maybe a forced reset will help"
|
||||
${UPDATER} --force_reset || log_error "Couldn't force reset the chip"
|
||||
sleep 1
|
||||
|
||||
log_info "Trying once more..."
|
||||
${UPDATER} "$which" "${fwbin}" && echo "okay" && return 0
|
||||
|
||||
log_error "Nope. Couldn't upload the new firmware."
|
||||
return 1;
|
||||
}
|
||||
|
||||
# If cryptolib_RO is already provided by the current RO, or the new RW doesn't
|
||||
# reequire it, then it's safe to update RW.
|
||||
safe_to_update_rw() {
|
||||
fwbin=$1
|
||||
|
||||
# Get epoch.major.minor of the current RO image
|
||||
chip_ver=$(${UPDATER} -l | tr ':/' ' ' | egrep 'R[OW]_[AB].*\*')
|
||||
cur_ro_vers=$(echo "$chip_ver" | awk '/RO_/ {print $3}')
|
||||
|
||||
# RO 0.1.6 (evt) and RO 0.0.6 (proto11) contain RO_CRYPTO
|
||||
# Assume(!) that the minor number will just continue to increment
|
||||
minor=$(echo "$cur_ro_vers" | cut -d. -f3)
|
||||
|
||||
if [[ "$minor" -ge 6 ]] ; then
|
||||
log_info "RO version $cur_ro_vers contains cryptolib"
|
||||
echo "yes"
|
||||
return
|
||||
fi
|
||||
|
||||
# There's no RO crypto currently installed, but do we really need it?
|
||||
# Which RW image are we considering?
|
||||
cur_rw_slot=$(echo "$chip_ver" | awk '/RW_/ {print $1}')
|
||||
new_rw_slot=$(echo "$cur_rw_slot" | tr 'AB' 'BA')
|
||||
# Obtain the new RW version string from the provided image file.
|
||||
file_ver=$(${UPDATER} -f "$fwbin" | tr ':/' ' ')
|
||||
new_rw_vers=$(echo "$file_ver" | awk "/$new_rw_slot/ {print \$3}")
|
||||
|
||||
|
||||
# go/nor/50384 added -r, -l, or -w to the version string
|
||||
# -r means "needs RO_CRYPTO"
|
||||
if [[ "$new_rw_vers" == *-r ]] ; then
|
||||
log_info "New RW firmware $new_rw_vers requires RO cryptolib"
|
||||
echo "no"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "yes"
|
||||
}
|
||||
|
||||
|
||||
# Let's do this
|
||||
log_info "Starting $0"
|
||||
|
||||
# What do we know?
|
||||
version=$(get_running_version) || die "No running version"
|
||||
fwbin=$(find_image_file "$version") || die "No image file"
|
||||
do_ro=$(is_newer_ro "$fwbin") || die "No RO comparsion"
|
||||
|
||||
# If there's a RO update available, try it first.
|
||||
if [[ "$do_ro" = "yes" ]]; then
|
||||
|
||||
log_info "Trying to update RO"
|
||||
|
||||
log_ro_version
|
||||
|
||||
# Upload should succeed
|
||||
upload_fw --ro "$fwbin" || die "RO upload failed"
|
||||
|
||||
# Enable might succeed with default (empty) password
|
||||
if ${UPDATER} --enable_ro '' ; then
|
||||
|
||||
# RO takes effect immediately and will reboot if RW changed too, so
|
||||
# give it some time to happen.
|
||||
sleep 2
|
||||
log_ro_version || die "Can't read version after update"
|
||||
|
||||
else
|
||||
# The user has a PIN/pattern/password set
|
||||
log_info "The primary user will have to enable the update"
|
||||
fi
|
||||
fi
|
||||
|
||||
# What do we know now?
|
||||
version=$(get_running_version) || die "No running version"
|
||||
fwbin=$(find_image_file "$version") || die "No image file"
|
||||
do_rw=$(is_newer_rw "$fwbin") || die "No RW comparsion"
|
||||
|
||||
# If there's a RW update available, try it next
|
||||
if [[ "$do_rw" = "yes" ]]; then
|
||||
|
||||
log_info "Trying to update RW"
|
||||
|
||||
# If the new RW requires cryptolib_RO and we don't have it, don't try
|
||||
safe=$(safe_to_update_rw "$fwbin")
|
||||
|
||||
if [[ "$safe" != "yes" ]]; then
|
||||
log_error "Cowardly refusing to update RW right now"
|
||||
else
|
||||
# Upload should succeed
|
||||
upload_fw --rw "$fwbin" || die "RW upload failed"
|
||||
|
||||
# Enable might succeed with default (empty) password
|
||||
if ${UPDATER} --enable_rw '' ; then
|
||||
|
||||
# We need to reboot manually for RW update
|
||||
log_info "RW update enabled, rebooting now"
|
||||
${UPDATER} --reboot || ${UPDATER} --force_reset || \
|
||||
log_error "can't reboot"
|
||||
|
||||
get_running_version || die "Can't read version after update"
|
||||
|
||||
else
|
||||
# The user has a PIN/pattern/password set
|
||||
log_info "The primary user will have to enable the update"
|
||||
fi
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
log_info "All done"
|
||||
exit 0
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+10
@@ -0,0 +1,10 @@
|
||||
#!/vendor/bin/sh
|
||||
|
||||
camera_irq_nums=$(grep "lwis" /proc/interrupts | awk '{ print(substr($1, 0, length($1) - 1)) }')
|
||||
|
||||
for irq_num in ${camera_irq_nums[@]};
|
||||
do
|
||||
chown system:system /proc/irq/${irq_num}/smp_affinity
|
||||
chown system:system /proc/irq/${irq_num}/smp_affinity_list
|
||||
done
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
#!/vendor/bin/sh
|
||||
modules_dir=
|
||||
|
||||
for f in /vendor/lib/modules/*/modules.dep /vendor/lib/modules/modules.dep; do
|
||||
if [[ -f "$f" ]]; then
|
||||
modules_dir="$(dirname "$f")"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ -z "${modules_dir}" ]]; then
|
||||
echo "Unable to locate kernel modules directory" 2>&1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
panel_drv=`getprop ro.boot.primary_panel_drv`
|
||||
if [[ -z "$panel_drv" ]]; then
|
||||
panel_drv="panel-samsung-emul"
|
||||
fi
|
||||
modprobe -d "${modules_dir}" exynos-drm.ko
|
||||
modprobe -d "${modules_dir}" $panel_drv.ko
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
#! /vendor/bin/sh
|
||||
#
|
||||
# Copy /vendor/etc/database/ if needed for RIL
|
||||
#
|
||||
data_ecc_ver=$(cat /data/vendor/radio/database/ecc_version)
|
||||
if [ -z $data_ecc_ver ]; then
|
||||
data_ecc_ver=0
|
||||
fi
|
||||
vendor_ecc_ver=$(cat /vendor/etc/database/ecc_version)
|
||||
if [ -z $vendor_ecc_ver ]; then
|
||||
vendor_ecc_ver=0
|
||||
fi
|
||||
# Copy files from /vendor/etc/database/ to /data/vendor/radio/ when data_ecc_ver < vendor_ecc_ver
|
||||
if [ $data_ecc_ver -lt $vendor_ecc_ver ]; then
|
||||
mkdir -p /data/vendor/radio/database
|
||||
cp -R /vendor/etc/database/* /data/vendor/radio/database/
|
||||
chown -hR radio.radio /data/vendor/radio/databse/
|
||||
fi
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
#!/vendor/bin/sh
|
||||
|
||||
###################################################################
|
||||
### init.insmod.cfg format: ###
|
||||
### ----------------------------------------------------------- ###
|
||||
### [insmod|setprop|enable|moprobe|rmmod|wait] [path|prop name] ###
|
||||
### ... ###
|
||||
###################################################################
|
||||
|
||||
modules_dir=
|
||||
system_modules_dir=
|
||||
vendor_modules_dir=
|
||||
|
||||
# This directory ONLY contains the 16k modules loaded in 16k mode
|
||||
# during the Second Boot Stage. This directory is not present in the
|
||||
# <device>_16k targets.
|
||||
mode_16k_modules_dir=/vendor/lib/modules/16k-mode
|
||||
pagesize=$(getconf PAGE_SIZE)
|
||||
|
||||
for dir in system vendor; do
|
||||
for f in /${dir}/lib/modules/*/modules.dep /${dir}/lib/modules/modules.dep; do
|
||||
if [[ -f "$f" ]]; then
|
||||
if [[ "${dir}" == "system" ]]; then
|
||||
system_modules_dir="$(dirname "$f")"
|
||||
else
|
||||
vendor_modules_dir="$(dirname "$f")"
|
||||
modules_dir=${vendor_modules_dir}
|
||||
fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
if [[ -z "${system_modules_dir}" ]]; then
|
||||
echo "Unable to locate system kernel modules directory" 2>&1
|
||||
fi
|
||||
|
||||
if [[ -z "${vendor_modules_dir}" ]]; then
|
||||
echo "Unable to locate vendor kernel modules directory" 2>&1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# imitates wait_for_file() in init
|
||||
wait_for_file()
|
||||
{
|
||||
filename="${1}"
|
||||
timeout="${2:-5}"
|
||||
|
||||
expiry=$(($(date "+%s")+timeout))
|
||||
while [[ ! -e "${filename}" ]] && [[ "$(date "+%s")" -le "${expiry}" ]]
|
||||
do
|
||||
sleep 0.01
|
||||
done
|
||||
}
|
||||
|
||||
if [ $# -eq 1 ]; then
|
||||
cfg_file=$1
|
||||
else
|
||||
# Set property even if there is no insmod config
|
||||
# to unblock early-boot trigger
|
||||
setprop vendor.common.modules.ready 1
|
||||
setprop vendor.device.modules.ready 1
|
||||
setprop vendor.all.modules.ready 1
|
||||
setprop vendor.all.devices.ready 1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -f $cfg_file ]; then
|
||||
while IFS="|" read -r action arg
|
||||
do
|
||||
case $action in
|
||||
"insmod") insmod $arg ;;
|
||||
"setprop") setprop $arg 1 ;;
|
||||
"enable") echo 1 > $arg ;;
|
||||
"condinsmod")
|
||||
prop=$(echo $arg | cut -d '|' -f 1)
|
||||
module1=$(echo $arg | cut -d '|' -f 2)
|
||||
module2=$(echo $arg | cut -d '|' -f 3)
|
||||
value=$(getprop $prop)
|
||||
if [[ ${value} == "true" ]]; then
|
||||
insmod ${vendor_modules_dir}/${module1}
|
||||
else
|
||||
insmod ${vendor_modules_dir}/${module2}
|
||||
fi
|
||||
;;
|
||||
"modprobe")
|
||||
case ${arg} in
|
||||
"system -b *" | "system -b")
|
||||
modules_dir=${system_modules_dir}
|
||||
arg="-b --all=${system_modules_dir}/modules.load" ;;
|
||||
"system *" | "system")
|
||||
modules_dir=${system_modules_dir}
|
||||
arg="--all=${system_modules_dir}/modules.load" ;;
|
||||
"-b *" | "-b" | "vendor -b *" | "vendor -b")
|
||||
modules_dir=${vendor_modules_dir}
|
||||
arg="-b --all=${vendor_modules_dir}/modules.load" ;;
|
||||
"*" | "" | "vendor *" | "vendor")
|
||||
modules_dir=${vendor_modules_dir}
|
||||
arg="--all=${vendor_modules_dir}/modules.load" ;;
|
||||
esac
|
||||
if [[ "${pagesize}" == "16384" && -d "${mode_16k_modules_dir}" ]]; then
|
||||
insmod ${mode_16k_modules_dir}/$arg
|
||||
elif [[ -d "${modules_dir}" ]]; then
|
||||
modprobe -a -d "${modules_dir}" $arg
|
||||
fi
|
||||
;;
|
||||
"rmmod") rmmod $arg ;;
|
||||
"wait") wait_for_file $arg ;;
|
||||
esac
|
||||
done < $cfg_file
|
||||
fi
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+51
@@ -0,0 +1,51 @@
|
||||
#!/vendor/bin/sh
|
||||
|
||||
DIR=/data/vendor/dump_touch
|
||||
SCRIPT_DIR=/vendor/bin/dump_touch
|
||||
LOCKFILE="$DIR"/dumping
|
||||
LOGFILE="$DIR"/dump.log
|
||||
DEBUG_START_TIME="$DIR"/start
|
||||
DEBUG_END_TIME="$DIR"/end
|
||||
|
||||
date +%s%N > $DEBUG_START_TIME
|
||||
|
||||
if [ ! -f $LOCKFILE ]
|
||||
then
|
||||
#Init Setup
|
||||
echo 0 > $LOCKFILE
|
||||
echo "" > $LOGFILE
|
||||
chmod 660 $LOCKFILE
|
||||
chmod 660 $LOGFILE
|
||||
fi
|
||||
|
||||
date >> $LOGFILE
|
||||
|
||||
state=$(cat $LOCKFILE)
|
||||
if [ "$state" = 2 ]
|
||||
then
|
||||
echo "Warning : Pending predump data detected (state=${state})" >> $LOGFILE
|
||||
elif [ "$state" != 0 ]
|
||||
then
|
||||
echo "Unexpected state! Expected 0 but found ${state}" >> $LOGFILE
|
||||
fi
|
||||
|
||||
echo 1 > $LOCKFILE
|
||||
|
||||
for entry in "$SCRIPT_DIR"/*.sh
|
||||
do
|
||||
echo "----------------------------------" >> $LOGFILE
|
||||
echo "$entry" >> $LOGFILE
|
||||
echo "----------------------------------" >> $LOGFILE
|
||||
sh "$entry" >> $LOGFILE 2>&1
|
||||
echo "----------------------------------" >> $LOGFILE
|
||||
done
|
||||
|
||||
state=$(cat $LOCKFILE)
|
||||
if [ "$state" != 1 ]
|
||||
then
|
||||
echo "Unexpected state! Expected 1 but found ${state}" >> $LOGFILE
|
||||
fi
|
||||
|
||||
echo 2 > $LOCKFILE
|
||||
|
||||
date +%s%N > $DEBUG_END_TIME
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+29
@@ -0,0 +1,29 @@
|
||||
#!/vendor/bin/sh
|
||||
#
|
||||
# The script belongs to the feature of UFS FFU via OTA: go/p23-ffu-ota
|
||||
# Its purpose is to copy the corresponding firmware into partition for UFS FFU.
|
||||
|
||||
ufs_dev="/dev/sys/block/bootdevice"
|
||||
fw_dir="/vendor/firmware"
|
||||
blk_dev="/dev/block/by-name/fips"
|
||||
min_timestamp=$(date -d "2022-10-01" +%s)
|
||||
epoch_1y=$(date -u -d "1971-01-01" +%s)
|
||||
|
||||
vendor=$(cat ${ufs_dev}/vendor | tr -d "[:space:]")
|
||||
model=$(cat ${ufs_dev}/model | tr -d "[:space:]")
|
||||
rev=$(cat ${ufs_dev}/rev | tr -d "[:space:]")
|
||||
|
||||
file=$(find ${fw_dir} -name "*${vendor}${model}${rev}*" | head -n 1)
|
||||
lifec=$(cat ${ufs_dev}/health_descriptor/life_time_estimation_c | tr -d "[:space:]")
|
||||
[ ! "$lifec" ] && lifec=0xff
|
||||
|
||||
atime=$(ls -lu -d /data 2>&1 | awk '{print $6}')
|
||||
timestamp=$(date -d "$atime" +%s)
|
||||
(( $timestamp < $min_timestamp )) && timestamp=$min_timestamp
|
||||
now=$(date +%s)
|
||||
|
||||
if [ -n "$file" ] && (( $lifec < 0x0a )) && (( $timestamp + $epoch_1y >= $now )); then
|
||||
# The first 4KB block at fips partition has been occupied, and unused space begins from 4 KB
|
||||
# Refer to: go/pixel-mp-ffu-ota-1p
|
||||
dd if="$file" of=$blk_dev bs=4k seek=1
|
||||
fi
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Reference in New Issue
Block a user