Firmware deblobber: Fix mounting /firmware

This commit is contained in:
Tad 2017-11-11 09:40:23 -05:00
parent 35a449dc82
commit 557d18a471
5 changed files with 78 additions and 146 deletions

View File

@ -7,7 +7,6 @@ $(FD_INSTALL_TARGET): $(ALL_MODULES.updater.BUILT)
$(hide) rm -rf $@ $(FD_INSTALL_OUT)
$(hide) mkdir -p $(FD_INSTALL_OUT)/META-INF/com/google/android/
$(hide) cp $(ALL_MODULES.updater.BUILT) $(FD_INSTALL_OUT)/META-INF/com/google/android/update-binary
$(hide) cp $(FD_PREBUILTS_PATH)/mount_firmware.sh $(FD_INSTALL_OUT)/
$(hide) cp $(FD_PREBUILTS_PATH)/firmware_deblobber.sh $(FD_INSTALL_OUT)/
$(hide) cp $(FD_PREBUILTS_PATH)/updater-script $(FD_INSTALL_OUT)/META-INF/com/google/android/updater-script
$(hide) (cd $(FD_INSTALL_OUT) && zip -qr $@ *)

View File

@ -2,146 +2,89 @@
#Maintain "safe" parity with Deblob.sh
#Why so many lines? Why not make a fancy function? Because we'd rather not brick devices!
rm -f /firmware/alipay.b00
rm -f /firmware/alipay.b01
rm -f /firmware/alipay.b02
rm -f /firmware/alipay.b03
rm -f /firmware/alipay.b04
rm -f /firmware/alipay.b05
rm -f /firmware/alipay.b06
rm -f /firmware/alipay.mdt
rm -f /firmware/image/alipay.b00
rm -f /firmware/image/alipay.b01
rm -f /firmware/image/alipay.b02
rm -f /firmware/image/alipay.b03
rm -f /firmware/image/alipay.b04
rm -f /firmware/image/alipay.b05
rm -f /firmware/image/alipay.b06
rm -f /firmware/image/alipay.mdt
deleteBlob() {
rm -f /firmware/$1;
rm -f /firmware/image/$1;
}
deleteBlob alipay.b00
deleteBlob alipay.b01
deleteBlob alipay.b02
deleteBlob alipay.b03
deleteBlob alipay.b04
deleteBlob alipay.b05
deleteBlob alipay.b06
deleteBlob alipay.mdt
echo "Removed Alibaba AliPay firmware"
rm -f /firmware/dxcprm.b00
rm -f /firmware/dxcprm.b01
rm -f /firmware/dxcprm.b02
rm -f /firmware/dxcprm.b03
rm -f /firmware/dxcprm.mdt
rm -f /firmware/image/dxcprm.b00
rm -f /firmware/image/dxcprm.b01
rm -f /firmware/image/dxcprm.b02
rm -f /firmware/image/dxcprm.b03
rm -f /firmware/image/dxcprm.mdt
deleteBlob dxcprm.b00
deleteBlob dxcprm.b01
deleteBlob dxcprm.b02
deleteBlob dxcprm.b03
deleteBlob dxcprm.mdt
echo "Removed Discretix DRM (old) firmware"
rm -f /firmware/dxhdcp2.b00
rm -f /firmware/dxhdcp2.b01
rm -f /firmware/dxhdcp2.b02
rm -f /firmware/dxhdcp2.b03
rm -f /firmware/dxhdcp2.mdt
rm -f /firmware/image/dxhdcp2.b00
rm -f /firmware/image/dxhdcp2.b01
rm -f /firmware/image/dxhdcp2.b02
rm -f /firmware/image/dxhdcp2.b03
rm -f /firmware/image/dxhdcp2.mdt
deleteBlob dxhdcp2.b00
deleteBlob dxhdcp2.b01
deleteBlob dxhdcp2.b02
deleteBlob dxhdcp2.b03
deleteBlob dxhdcp2.mdt
echo "Removed Discretix DRM (new) firmware"
rm -f /firmware/widevine.b00
rm -f /firmware/widevine.b01
rm -f /firmware/widevine.b02
rm -f /firmware/widevine.b03
rm -f /firmware/widevine.b04
rm -f /firmware/widevine.b05
rm -f /firmware/widevine.b06
rm -f /firmware/widevine.mdt
rm -f /firmware/image/widevine.b00
rm -f /firmware/image/widevine.b01
rm -f /firmware/image/widevine.b02
rm -f /firmware/image/widevine.b03
rm -f /firmware/image/widevine.b04
rm -f /firmware/image/widevine.b05
rm -f /firmware/image/widevine.b06
rm -f /firmware/image/widevine.mdt
deleteBlob widevine.b00
deleteBlob widevine.b01
deleteBlob widevine.b02
deleteBlob widevine.b03
deleteBlob widevine.b04
deleteBlob widevine.b05
deleteBlob widevine.b06
deleteBlob widevine.mdt
echo "Removed Google Widevine DRM firmware"
rm -f /firmware/tzwidevine.b00
rm -f /firmware/tzwidevine.b01
rm -f /firmware/tzwidevine.b02
rm -f /firmware/tzwidevine.b03
rm -f /firmware/tzwidevine.mdt
rm -f /firmware/image/tzwidevine.b00
rm -f /firmware/image/tzwidevine.b01
rm -f /firmware/image/tzwidevine.b02
rm -f /firmware/image/tzwidevine.b03
rm -f /firmware/image/tzwidevine.mdt
deleteBlob tzwidevine.b00
deleteBlob tzwidevine.b01
deleteBlob tzwidevine.b02
deleteBlob tzwidevine.b03
deleteBlob tzwidevine.mdt
echo "Removed Google Widevine DRM (alternate 1) firmware"
rm -f /firmware/tzwvcpybuf.b00
rm -f /firmware/tzwvcpybuf.b01
rm -f /firmware/tzwvcpybuf.b02
rm -f /firmware/tzwvcpybuf.b03
rm -f /firmware/tzwvcpybuf.mdt
rm -f /firmware/image/tzwvcpybuf.b00
rm -f /firmware/image/tzwvcpybuf.b01
rm -f /firmware/image/tzwvcpybuf.b02
rm -f /firmware/image/tzwvcpybuf.b03
rm -f /firmware/image/tzwvcpybuf.mdt
deleteBlob tzwvcpybuf.b00
deleteBlob tzwvcpybuf.b01
deleteBlob tzwvcpybuf.b02
deleteBlob tzwvcpybuf.b03
deleteBlob tzwvcpybuf.mdt
echo "Removed Google Widevine DRM (alternate 2) firmware"
rm -f /firmware/htc_drmprov.b00
rm -f /firmware/htc_drmprov.b01
rm -f /firmware/htc_drmprov.b02
rm -f /firmware/htc_drmprov.b03
rm -f /firmware/htc_drmprov.b04
rm -f /firmware/htc_drmprov.b05
rm -f /firmware/htc_drmprov.b06
rm -f /firmware/htc_drmprov.mdt
rm -f /firmware/image/htc_drmprov.b00
rm -f /firmware/image/htc_drmprov.b01
rm -f /firmware/image/htc_drmprov.b02
rm -f /firmware/image/htc_drmprov.b03
rm -f /firmware/image/htc_drmprov.b04
rm -f /firmware/image/htc_drmprov.b05
rm -f /firmware/image/htc_drmprov.b06
rm -f /firmware/image/htc_drmprov.mdt
deleteBlob htc_drmprov.b00
deleteBlob htc_drmprov.b01
deleteBlob htc_drmprov.b02
deleteBlob htc_drmprov.b03
deleteBlob htc_drmprov.b04
deleteBlob htc_drmprov.b05
deleteBlob htc_drmprov.b06
deleteBlob htc_drmprov.mdt
echo "Removed HTC DRM firmware"
rm -f /firmware/playread.b00
rm -f /firmware/playread.b01
rm -f /firmware/playread.b02
rm -f /firmware/playread.b03
rm -f /firmware/playread.mdt
rm -f /firmware/image/playread.b00
rm -f /firmware/image/playread.b01
rm -f /firmware/image/playread.b02
rm -f /firmware/image/playread.b03
rm -f /firmware/image/playread.mdt
deleteBlob playread.b00
deleteBlob playread.b01
deleteBlob playread.b02
deleteBlob playread.b03
deleteBlob playread.mdt
echo "Removed Microsoft PlayReady DRM firmware"
rm -f /firmware/hdcp1.b00
rm -f /firmware/hdcp1.b01
rm -f /firmware/hdcp1.b02
rm -f /firmware/hdcp1.b03
rm -f /firmware/hdcp1.b04
rm -f /firmware/hdcp1.b05
rm -f /firmware/hdcp1.b06
rm -f /firmware/hdcp1.mdt
rm -f /firmware/image/hdcp1.b00
rm -f /firmware/image/hdcp1.b01
rm -f /firmware/image/hdcp1.b02
rm -f /firmware/image/hdcp1.b03
rm -f /firmware/image/hdcp1.b04
rm -f /firmware/image/hdcp1.b05
rm -f /firmware/image/hdcp1.b06
rm -f /firmware/image/hdcp1.mdt
deleteBlob hdcp1.b00
deleteBlob hdcp1.b01
deleteBlob hdcp1.b02
deleteBlob hdcp1.b03
deleteBlob hdcp1.b04
deleteBlob hdcp1.b05
deleteBlob hdcp1.b06
deleteBlob hdcp1.mdt
echo "Removed [Unknown 1] DRM firmware"
rm -f /firmware/tzhdcp.b00
rm -f /firmware/tzhdcp.b01
rm -f /firmware/tzhdcp.b02
rm -f /firmware/tzhdcp.b03
rm -f /firmware/tzhdcp.mdt
rm -f /firmware/image/tzhdcp.b00
rm -f /firmware/image/tzhdcp.b01
rm -f /firmware/image/tzhdcp.b02
rm -f /firmware/image/tzhdcp.b03
rm -f /firmware/image/tzhdcp.mdt
deleteBlob tzhdcp.b00
deleteBlob tzhdcp.b01
deleteBlob tzhdcp.b02
deleteBlob tzhdcp.b03
deleteBlob tzhdcp.mdt
echo "Removed [Unknown 2] DRM firmware"

View File

@ -1,13 +0,0 @@
#!/sbin/sh
if mount /firmware; then
exit 0
fi
# Try to get the block from /etc/recovery.fstab
block=`cat /etc/recovery.fstab | cut -d '#' -f 1 | grep /firmware | grep -o '/dev/[^ ]*' | head -1`
if [ -n "$block" ] && mount $block /firmware; then
exit 0
fi
exit 1

View File

@ -3,14 +3,17 @@ ui_print("Based off of LineageOS's AddonSU");
ifelse(is_mounted("/firmware"), unmount("/firmware"));
set_metadata("/tmp/mount_system.sh", "uid", 0, "gid", 0, "mode", 0755);
ifelse(!is_mounted("/firmware"), mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/modem", "/firmware", ""));
ifelse(!is_mounted("/firmware"), mount("ext4", "EMMC", "/dev/block/bootdevice/by-name/modem", "/firmware", ""));
ifelse(!is_mounted("/firmware"), mount("ext4", "EMMC", "/dev/block/platform/soc.0/f9824900.sdhci/by-name/modem", "/firmware", ""));
if is_mounted("/firmware") then
set_metadata("/tmp/firmware_deblobber.sh", "uid", 0, "gid", 0, "mode", 0755);
run_program("/tmp/mount_firmware.sh") == 0 || abort("Could not mount /firmware");
run_program("/sbin/sh", "/tmp/firmware_deblobber.sh");
run_program("/tmp/firmware_deblobber.sh");
unmount("/firmware");
else
abort("Could not mount /firmware");
endif;
ui_print("Deblobbed!");
set_progress(1.000000);

View File

@ -96,7 +96,7 @@ export -f enhanceLocation;
enableZram() {
cd $base$1;
sed -i 's|#/dev/block/zram0|/dev/block/zram0|' fstab.* rootdir/fstab.* rootdir/etc/fstab.* &>/dev/null || true;
sed -i 's|#/dev/block/zram0|/dev/block/zram0|' fstab.* root/fstab.* rootdir/fstab.* rootdir/etc/fstab.* &>/dev/null || true;
echo "Enabled zram for $1";
cd $base;
}
@ -104,7 +104,7 @@ enableZram() {
enabledForcedEncryption() {
cd $base$1;
if [[ $1 != *"mako"* ]]; then
sed -i 's|encryptable=/|forceencrypt=/|' fstab.* rootdir/fstab.* rootdir/etc/fstab.* &>/dev/null || true;
sed -i 's|encryptable=/|forceencrypt=/|' fstab.* root/fstab.* rootdir/fstab.* rootdir/etc/fstab.* &>/dev/null || true;
echo "Enabled forceencrypt for $1";
fi;
cd $base;