android分区dtbo,verifyDTBO.sh

#!/bin/bash

if [ -z "${ANDROID_HOST_OUT}" ]; then

echo 'ANDROID_HOST_OUT not set. Please run lunch'

exit 1

fi

ANDROID_HOST_BIN_LOCATION=${ANDROID_HOST_OUT}/bin

adb root

tmpdir=$(mktemp -d)

trap 'rm -rf ${tmpdir};' EXIT

cd $tmpdir

#find out the location to read the DTBO image from

boot_suffix=$(adb wait-for-device shell getprop ro.boot.slot_suffix)

dtbo_partition="/dev/block/by-name/dtbo"

dtbo_path=$dtbo_partition$boot_suffix

#read the dtbo image and the final device tree from device

adb pull $dtbo_path dtbo.img > /dev/null

adb pull /sys/firmware/fdt final_dt > /dev/null

#decompile the DTBO image

mkdtimg_path="${ANDROID_HOST_BIN_LOCATION}/mkdtboimg.py"

$mkdtimg_path dump dtbo.img -b dumped_dtbo > /dev/null

#Get the index of the overlay applied from the kernel command line

overlay_idx=$(adb shell cat /proc/cmdline | grep -o "androidboot.dtbo_idx=[^ ]*" | cut -d "=" -f 2)

arg=""

for idx in ${overlay_idx//,/ }

do

arg="${arg}dumped_dtbo.${idx} "

done

#verify that the overlay was correctly applied

verify_bin_path="${ANDROID_HOST_BIN_LOCATION}/ufdt_verify_overlay_host"

$verify_bin_path final_dt $arg

result=$?

if [[ "$result" -eq "0" ]]; then

echo "Overlay was verified successfully"

else

echo "Incorrect overlay application"

fi

exit $result

Bash程序

|

51行

|

1.25 KB

#!/bin/bash

if [ -z "${ANDROID_HOST_OUT}" ]; then

echo 'ANDROID_HOST_OUT not set. Please run lunch'

exit 1

fi

ANDROID_HOST_BIN_LOCATION=${ANDROID_HOST_OUT}/bin

adb root

tmpdir=$(mktemp -d)

trap 'rm -rf ${tmpdir};' EXIT

cd $tmpdir

#find out the location to read the DTBO image from

boot_suffix=$(adb wait-for-device shell getprop ro.boot.slot_suffix)

dtbo_partition="/dev/block/by-name/dtbo"

dtbo_path=$dtbo_partition$boot_suffix

#read the dtbo image and the final device tree from device

adb pull $dtbo_path dtbo.img > /dev/null

adb pull /sys/firmware/fdt final_dt > /dev/null

#decompile the DTBO image

mkdtimg_path="${ANDROID_HOST_BIN_LOCATION}/mkdtboimg.py"

$mkdtimg_path dump dtbo.img -b dumped_dtbo > /dev/null

#Get the index of the overlay applied from the kernel command line

overlay_idx=$(adb shell cat /proc/cmdline | grep -o "androidboot.dtbo_idx=[^ ]*" | cut -d "=" -f 2)

arg=""

for idx in ${overlay_idx//,/ }

do

arg="${arg}dumped_dtbo.${idx} "

done

#verify that the overlay was correctly applied

verify_bin_path="${ANDROID_HOST_BIN_LOCATION}/ufdt_verify_overlay_host"

$verify_bin_path final_dt $arg

result=$?

if [[ "$result" -eq "0" ]]; then

echo "Overlay was verified successfully"

else

echo "Incorrect overlay application"

fi

exit $result

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值