Fix trustkernel keystore/gatekeerp
TEE requires that ro.product.model is either original, or "AOSP on armxx" sed in-place I had to move from /dev to /mnt, because /dev is nosuid
This commit is contained in:
parent
63b2403f9f
commit
b139f72be4
42
rw-system.sh
42
rw-system.sh
@ -3,35 +3,36 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
fixSPL() {
|
fixSPL() {
|
||||||
|
if [ "$(getprop ro.product.cpu.abi)" == "armeabi-v7a" ];then
|
||||||
|
setprop ro.keymaster.mod 'AOSP on ARM32'
|
||||||
|
else
|
||||||
|
setprop ro.keymaster.mod 'AOSP on ARM64'
|
||||||
|
fi
|
||||||
img="$(find /dev/block -type l |grep by-name |grep /kernel$(getprop ro.boot.slot_suffix) |head -n 1)"
|
img="$(find /dev/block -type l |grep by-name |grep /kernel$(getprop ro.boot.slot_suffix) |head -n 1)"
|
||||||
[ -z "$img" ] && img="$(find /dev/block -type l |grep by-name |grep /boot$(getprop ro.boot.slot_suffix) |head -n 1)"
|
[ -z "$img" ] && img="$(find /dev/block -type l |grep by-name |grep /boot$(getprop ro.boot.slot_suffix) |head -n 1)"
|
||||||
if [ -n "$img" ];then
|
if [ -n "$img" ];then
|
||||||
#Rewrite SPL/Android version if needed
|
#Rewrite SPL/Android version if needed
|
||||||
Arelease="$(getSPL $img android)"
|
Arelease="$(getSPL $img android)"
|
||||||
setprop ro.keymaster.xxx.release $Arelease
|
setprop ro.keymaster.xxx.release "$Arelease"
|
||||||
setprop ro.keymaster.xxx.security_patch "$(getSPL $img spl)"
|
setprop ro.keymaster.xxx.security_patch "$(getSPL $img spl)"
|
||||||
|
|
||||||
#Only Android 8.0 needs this
|
for f in /vendor/lib64/hw/android.hardware.keymaster@3.0-impl-qti.so /system/lib64/vndk-26/libsoftkeymasterdevice.so /vendor/bin/teed;do
|
||||||
if ! echo "$Arelease" |grep -qF 8.0;then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
for f in /vendor/lib64/hw/android.hardware.keymaster@3.0-impl-qti.so /system/lib64/vndk-26/libsoftkeymasterdevice.so;do
|
|
||||||
[ ! -f $f ] && continue
|
[ ! -f $f ] && continue
|
||||||
|
ctxt="$(ls -lZ $f |grep -oE 'u:object_r:[^:]*:s0')"
|
||||||
b="$(basename "$f")"
|
b="$(basename "$f")"
|
||||||
|
|
||||||
mkdir -p /dev/phh/
|
mkdir -p /mnt/phh/
|
||||||
cp $f /dev/phh/$b
|
cp -a $f /mnt/phh/$b
|
||||||
sed -i -e 's/ro.build.version.release/ro.keymaster.xxx.release/g' -e 's/ro.build.version.security_patch/ro.keymaster.xxx.security_patch/g' /dev/phh/$b
|
sed -i \
|
||||||
if echo $f |grep vendor;then
|
-e 's/ro.build.version.release/ro.keymaster.xxx.release/g' \
|
||||||
chcon u:object_r:vendor_file:s0 /dev/phh/$b
|
-e 's/ro.build.version.security_patch/ro.keymaster.xxx.security_patch/g' \
|
||||||
else
|
-e 's/ro.product.model/ro.keymaster.mod/g' \
|
||||||
chcon u:object_r:system_file:s0 /dev/phh/$b
|
/mnt/phh/$b
|
||||||
fi
|
chcon "$ctxt" /mnt/phh/$b
|
||||||
chmod 0644 /dev/phh/$b
|
mount -o bind /mnt/phh/$b $f
|
||||||
mount -o bind /dev/phh/$b $f
|
|
||||||
done
|
done
|
||||||
setprop ctl.restart keymaster-3-0
|
[ "$(getprop init.svc.keymaster-3-0)" == "running" ] && setprop ctl.restart keymaster-3-0
|
||||||
|
[ "$(getprop init.svc.teed)" == "running" ] && setprop ctl.restart teed
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,8 +57,3 @@ fi
|
|||||||
if ! grep android.hardware.ir /vendor/manifest.xml;then
|
if ! grep android.hardware.ir /vendor/manifest.xml;then
|
||||||
mount -o bind system/phh/empty /system/etc/permissions/android.hardware.consumerir.xml
|
mount -o bind system/phh/empty /system/etc/permissions/android.hardware.consumerir.xml
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Disable trustkernel keystore, because it doesn't work for the moment
|
|
||||||
#Found on MTK devices
|
|
||||||
mount -o bind /system/phh/empty /vendor/lib/hw/keystore.trustkernel.so || true
|
|
||||||
mount -o bind /system/phh/empty /vendor/lib64/hw/keystore.trustkernel.so || true
|
|
||||||
|
Loading…
Reference in New Issue
Block a user