2020年4月12日 星期日

[Android]Android OTA & fastboot method 與avc dennied(sepolicy裡.te檔的變更規則)的解決方法

A/B(无缝)系统更新 : https://source.android.google.cn/devices/tech/ota/ab

OTA
Android SELinux avc dennied权限问题解决方法 : https://blog.csdn.net/tung214/article/details/72734086

Android Update Engine分析(三)客户端进程 : https://blog.csdn.net/guyongqiangx/article/details/80820399

三、A/B 升级update_engine分析-客户端 : https://blog.csdn.net/Android_2016/article/details/102912357

Android SELinux avc dennied权限问题解决方法 : https://my.oschina.net/kingchen8080/blog/2876363
android selinux : https://blog.csdn.net/u012719256/article/details/52094713



圖片可能會因為太久而遺失,以下多拿幾個error log範例來說明 : 

[ 4237.537022] type=1400 audit(1568869525.184:24238): avc: denied { dac_read_search } for pid=3640 comm="Binder:3640_6" capability=2 scontext=u:r:installd:s0 tcontext=u:r:installd:s0 tclass=capability permissive=0 duplicate messages suppressed
[ 4237.537048] type=1400 audit(1568869535.920:25782): avc: denied { dac_read_search } for pid=3640 comm="Binder:3640_7" capability=2 scontext=u:r:installd:s0 tcontext=u:r:installd:s0 tclass=capability permissive=0
[ 5091.489268] type=1400 audit(1568870379.416:30542): avc: denied { dac_read_search } for pid=3640 comm="Binder:3640_7" capability=2 scontext=u:r:installd:s0 tcontext=u:r:installd:s0 tclass=capability permissive=0 duplicate messages suppressed
[ 5091.489296] type=1400 audit(1568870389.864:32086): avc: denied { dac_read_search } for pid=3640 comm="Binder:3640_6" capability=2 scontext=u:r:installd:s0 tcontext=u:r:installd:s0 tclass=capability permissive=0


修改規則 : 
"comm"+te -> allow "comm" object_r:tclass { "denied_permission" };



A/B system <二> update_engine_client : http://hooltech.com/2018/08/07/ab_system-20-00/#ab-system--update_engine_client
查了老半天發現主要還是餵給update_engine_client格式的問題
正確如下 :
隨身碟 :
update_engine_client  --payload=file:///mnt/media_rw/707B-88DE/payload.bin --update --headers="FILE_HASH=/VSC4qnNIG4jpGgQIZKF/jqTNVOUWR7bO3H7mHl/Dug=
FILE_SIZE=463764699
METADATA_HASH=DKzdifBcuHUuIfgYJjjj3EAprqfiPOnfZWbex35wNVI=
METADATA_SIZE=58918"

SD Card :
update_engine_client  --payload=file:///sdcard/payload.bin --update --headers="FILE_HASH=/VSC4qnNIG4jpGgQIZKF/jqTNVOUWR7bO3H7mHl/Dug=
FILE_SIZE=463764699
METADATA_HASH=DKzdifBcuHUuIfgYJjjj3EAprqfiPOnfZWbex35wNVI=
METADATA_SIZE=58918"


附圖 :









fastboot方法 : 

$adb root
$adb shell reboot bootloader

$fastboot flashing unlock #Android OEM unlocking "Enable" first   如果無法順利使用fastboot必須在開發者模式解鎖OEM鎖

$fastboot flash bootloader0 u-boot-imx8qm.imx
$fastboot flash gpt partition-table.img
$fastboot flash dtbo_a dtbo-imx8qm-hdmi.img
$fastboot flash dtbo_b dtbo-imx8qm-hdmi.img
$fastboot flash boot_a boot.img
$fastboot flash boot_b boot.img
$fastboot flash system_a system.img
$fastboot flash system_b system.img
$fastboot flash vendor_a vendor.img
$fastboot flash vendor_b vendor.img
$fastboot --disable-verification flash vbmeta_a vbmeta-imx8qm-hdmi-in.img
$fastboot --disable-verification flash vbmeta_b vbmeta-imx8qm-hdmi.img
#fastboot erase userdata (if partition size change)
$fastboot reboot


















Recovery


看起來是把ota image檔案放到   /cache/update.zip
然後執行下述指令就可以了,

mkdir -p /cache/recovery
touch /cache/recovery/command
echo "--update_package=/cache/update.zip" > /cache/recovery/command
reboot recovery


測試時使用 adb root

沒有留言:

張貼留言