Adding automatic twrp-installer creation
authormauronofrio matarrese <poronofrio@gmail.com>
Tue, 25 Dec 2018 18:42:22 +0000 (19:42 +0100)
committermauronofrio matarrese <poronofrio@gmail.com>
Tue, 25 Dec 2018 18:42:22 +0000 (19:42 +0100)
BoardConfig.mk
README.md
installer/META-INF/CERT.RSA [new file with mode: 0644]
installer/META-INF/CERT.SF [new file with mode: 0644]
installer/META-INF/MANIFEST.MF [new file with mode: 0644]
installer/META-INF/com/android/otacert [new file with mode: 0644]
installer/META-INF/com/google/android/update-binary [new file with mode: 0644]
installer/magiskboot [new file with mode: 0644]

index c0b715d67450d5a40351830bc29b14b46ab40f7f..3bbd1ce06c51d7b2aea661bb565cf7843e99aefc 100644 (file)
@@ -105,3 +105,5 @@ BOARD_SUPPRESS_SECURE_ERASE := true
 TW_USE_LEDS_HAPTICS := true
 #TW_USE_TOOLBOX := true
 TW_EXCLUDE_TWRPAPP := true
+USE_RECOVERY_INSTALLER := true
+RECOVERY_INSTALLER_PATH := device/oneplus/fajita/installer
index 663c9ea7d3cf05a3d05c9afb35199619496df417..14a8e052dd521e3e9f56d38d53969d3996369507 100644 (file)
--- a/README.md
+++ b/README.md
@@ -55,6 +55,8 @@ If you want to use the notch theme you need of this commit: https://gerrit.omnir
 
 Now you need of this patch to make decryption working: https://gist.github.com/mauronofrio/af29bad34ad87a1a957d193794f0bf5f
 
+To auotomatic make the twrp installer, you need to import this commit in the build path: https://gerrit.omnirom.org/#/c/android_build/+/33182/
+
 
 To make all works you need to modify the buildinfo.sh in build/tools
 echo "ro.build.version.release=$PLATFORM_VERSION"
diff --git a/installer/META-INF/CERT.RSA b/installer/META-INF/CERT.RSA
new file mode 100644 (file)
index 0000000..b47b463
Binary files /dev/null and b/installer/META-INF/CERT.RSA differ
diff --git a/installer/META-INF/CERT.SF b/installer/META-INF/CERT.SF
new file mode 100644 (file)
index 0000000..3f308c0
--- /dev/null
@@ -0,0 +1,16 @@
+Signature-Version: 1.0
+SHA1-Digest-Manifest: QCWCUCcRamzGoOTiTXSQ/1AKdMo=
+Created-By: 1.0 (Android SignApk)
+
+Name: ramdisk-twrp.cpio
+SHA1-Digest: GrJjW1FsLNiJC5RX2CIqEmX8eI4=
+
+Name: META-INF/com/android/otacert
+SHA1-Digest: QW7yPFUPbhU0tUYKW4i2EdneCnw=
+
+Name: META-INF/com/google/android/update-binary
+SHA1-Digest: 02Ul88djHsIFRsI5gdyIcSLa0XQ=
+
+Name: magiskboot
+SHA1-Digest: 0fk+6jdh3EAyaBFFHavgeVhRFDc=
+
diff --git a/installer/META-INF/MANIFEST.MF b/installer/META-INF/MANIFEST.MF
new file mode 100644 (file)
index 0000000..3578c91
--- /dev/null
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Created-By: 1.0 (Android SignApk)
+
+Name: ramdisk-twrp.cpio
+SHA1-Digest: gtuG6Rf4Ywfx+3hraZUQZQ27Ukw=
+
+Name: META-INF/com/android/otacert
+SHA1-Digest: 71Q6Rn2DDZl1zPDVaaeEHItd+Yg=
+
+Name: META-INF/com/google/android/update-binary
+SHA1-Digest: Om9VSieSZdIxXv08mMFDJuUHrBA=
+
+Name: magiskboot
+SHA1-Digest: BT3tcdY5tZnJ8FVbujrBWEufjVw=
+
diff --git a/installer/META-INF/com/android/otacert b/installer/META-INF/com/android/otacert
new file mode 100644 (file)
index 0000000..e242d83
--- /dev/null
@@ -0,0 +1,27 @@
+-----BEGIN CERTIFICATE-----
+MIIEqDCCA5CgAwIBAgIJAJNurL4H8gHfMA0GCSqGSIb3DQEBBQUAMIGUMQswCQYD
+VQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4g
+VmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UE
+AxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTAe
+Fw0wODAyMjkwMTMzNDZaFw0zNTA3MT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vilFLAhLwn62oX6snb4Y
+LCBOsVMR9FXYJLZW2+TcIkCRLXWG/oiVHQGo/rWuWkJgU134NDEFJCJGjDbiLCpe
++ZTWHdcwauTJ9pUbo8EvHRkU3cYfGmLaLfgn9gP+pWA7LFQNvXwBnDa6sppCccEX
+31I828XzgXpJ4O+mDL1/dBd+ek8ZPUP0IgdyZm5MTYPhvVqGCHzzTy3sIeJFymwr
+sBbmg2OAUNLEMO6nwmocSdN2ClirfxqCzJOLSDE4QyS9BAH6EhY6UFcOaE0=
+-----END CERTIFICATE-----
diff --git a/installer/META-INF/com/google/android/update-binary b/installer/META-INF/com/google/android/update-binary
new file mode 100644 (file)
index 0000000..7dfe811
--- /dev/null
@@ -0,0 +1,84 @@
+#!/sbin/sh
+# LazyFlasher installer backend (for helper functions only)
+
+tmp=/tmp/twrp-install
+
+if [ "$3" ]; then
+       zip=$3
+       console=/proc/$$/fd/$2
+       # write the location of the console buffer to /tmp/console for other scripts to use
+       echo "$console" > /tmp/console
+else
+       console=$(cat /tmp/console)
+       [ "$console" ] || console=/proc/$$/fd/1
+fi
+
+print() {
+       if [ "$1" ]; then
+               echo "ui_print $1" > "$console"
+       else
+               echo "ui_print  " > "$console"
+       fi
+       echo
+}
+
+abort() {
+       [ "$1" ] && {
+               print "Error: $1"
+               print "Aborting..."
+       }
+       cleanup
+       print "Failed to patch boot image!"
+       exit 1
+}
+
+cleanup() {
+       [ "$zip" ] && rm /tmp/console
+}
+
+extract() {
+       rm -rf "$2"
+       mkdir -p "$2"
+       unzip -o "$1" -d "$2" || abort "Failed to extract zip to $2!"
+}
+
+print "#########################################"
+print "#     TWRP installer for OnePlus 6T     #"
+print "#             by mauronofrio            #"
+print "#########################################"
+
+# Unpack the installer
+[ "$zip" ] && {
+       print "Unpacking the installer..."
+       extract "$zip" "$tmp"
+}
+cd "$tmp"
+toolname="/magiskboot"
+tool="$tmp$toolname"
+targetfile="/boot.img"
+target="$tmp$targetfile"
+
+chmod 755 "$tool"
+
+print "Running boot image patcher on slot A..."
+dd if=/dev/block/bootdevice/by-name/boot_a "of=$target"
+"$tool" --unpack boot.img
+cp -f ramdisk-recovery.cpio ramdisk.cpio
+"$tool" --repack boot.img
+dd if=new-boot.img of=/dev/block/bootdevice/by-name/boot_a
+rm boot.img
+rm dtb
+rm kernel
+rm new-boot.img
+rm ramdisk.cpio
+print "Running boot image patcher on slot B..."
+dd if=/dev/block/bootdevice/by-name/boot_b "of=$target"
+"$tool" --unpack boot.img
+cp -f ramdisk-recovery.cpio ramdisk.cpio
+"$tool" --repack boot.img
+dd if=new-boot.img of=/dev/block/bootdevice/by-name/boot_b
+
+print "Boot image patching complete"
+
+#cleanup
+print "Done installing TWRP!"
diff --git a/installer/magiskboot b/installer/magiskboot
new file mode 100644 (file)
index 0000000..c7fdf4d
Binary files /dev/null and b/installer/magiskboot differ