Firmware Deblobber: Make device agnostic, remove more blobs

This commit is contained in:
Tad 2017-11-11 07:27:00 -05:00
parent 5dfb34d47d
commit 35a449dc82
4 changed files with 157 additions and 8 deletions

View File

@ -7,6 +7,7 @@ $(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

@ -1,5 +1,114 @@
#!/sbin/sh
#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
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
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
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
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
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
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
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
@ -7,9 +116,32 @@ rm -f /firmware/image/playread.b03
rm -f /firmware/image/playread.mdt
echo "Removed Microsoft PlayReady DRM firmware"
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.mdt
echo "Removed Google Widevine 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
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
echo "Removed [Unknown 2] DRM firmware"

View File

@ -0,0 +1,13 @@
#!/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

@ -1,9 +1,12 @@
ui_print("DivestOS Firmware Deblobber");
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);
set_metadata("/tmp/firmware_deblobber.sh", "uid", 0, "gid", 0, "mode", 0755);
unmount("/firmware");
mount("ext4", "EMMC", "/dev/block/bootdevice/by-name/modem", "/firmware", "");
run_program("/tmp/mount_firmware.sh") == 0 || abort("Could not mount /firmware");
run_program("/sbin/sh", "/tmp/firmware_deblobber.sh");