From: mauronofrio matarrese Date: Tue, 25 Dec 2018 18:42:22 +0000 (+0100) Subject: Adding automatic twrp-installer creation X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=42e2e80df2c59f1125a425ac5df1b751f5a28d35;p=GitHub%2Fmoto-9609%2Ftwrp_device_motorola_troika.git Adding automatic twrp-installer creation --- diff --git a/BoardConfig.mk b/BoardConfig.mk index c0b715d..3bbd1ce 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -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 diff --git a/README.md b/README.md index 663c9ea..14a8e05 100644 --- 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 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 index 0000000..3f308c0 --- /dev/null +++ b/installer/META-INF/CERT.SF @@ -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 index 0000000..3578c91 --- /dev/null +++ b/installer/META-INF/MANIFEST.MF @@ -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 index 0000000..e242d83 --- /dev/null +++ b/installer/META-INF/com/android/otacert @@ -0,0 +1,27 @@ +-----BEGIN CERTIFICATE----- +MIIEqDCCA5CgAwIBAgIJAJNurL4H8gHfMA0GCSqGSIb3DQEBBQUAMIGUMQswCQYD +VQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4g +VmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UE +AxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTAe +Fw0wODAyMjkwMTMzNDZaFw0zNTA3MTcwMTMzNDZaMIGUMQswCQYDVQQGEwJVUzET +MBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4G +A1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9p +ZDEiMCAGCSqGSIb3DQ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CHzzTy3sIeJFymwr +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 index 0000000..7dfe811 --- /dev/null +++ b/installer/META-INF/com/google/android/update-binary @@ -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 index 0000000..c7fdf4d Binary files /dev/null and b/installer/magiskboot differ