Ask / Submit

Revision history [back]

click to hide/show revision 1
initial version

posted 2019-02-24 20:34:12 +0300

[How-to] Install MicroG on XA2 (Android 8.1)

Hopefully this is not a duplicate.

I just managed to get the signature spoofing and Microg working on XA2 (3.0.1.14) with the new Android support so I thought to write a small how-to if others are interested.

Note that you should do this before installing Android apps. Many apps will crash if you install MicroG after them, but you can reinstall the apps and they should start working. Also you probably need to do this everytime there is a update for the Android Support and the system.img is changed.

Whats needed:

-squashfs-tools (Available for both Windows and Linux, I used the linux version)
-vdexExtractor (https://github.com/anestisb/vdexExtractor AFAIK only works on Linux)
-SmaliPatcher (https://forum.xda-developers.com/apps/magisk/module-smali-patcher-0-7-t3680053 AFAIK only works on Windows)

Steps:

1. Get the file /opt/alien/system.img from your phone and copy it to your PC (make a backup too)

2. Use squashfs-tools to unpack the .img file

    unsquashfs /path/to/image/system.img

3. Get the following files and copy them to another folder 

    unpacked_image_path/system/framework/oat/arm/services.vdex
    unpacked_image_path/system/framework/services.jar

4. Deodex the services.vdex with vdexExtractor

    /path/to/vdexExtractor/bin/vdexExtractor -i path/to/services.vdex --ignore-crc-error

5. Now you should have a file called services_classes.dex, you need to rename it to classes.dex and pack it into the services.jar file

    zip -j path/to/services.jar classes*.dex

6. Now you need to use SmaliPatcher to inject the signature spoof patch to the services.jar (which now includes the classes.dex file). So switch to Windows (unless you can find a linux version of smalipatcher) and use the graphical UI to patch services.jar. I chose the default settings which includes mock location patch and the signature spoof patch. You probably only need the signature spoof patch.

7. SmaliPatcher creates a .zip file which includes a /system folder. Copy this system folder over your unpacked_image_path/system to replace the original files with the patched files.

8. Now use squashfs-tools again to pack the files to system.img

    mksquashfs unpacked_image_path/ system.img -comp lz4 -Xhc -noappend -no-exports -no-duplicates -no-fragments

9. Copy the new system.img to your phone. Make sure Android Support is not running. 

    As devel-su: cp /path/to/image/system.img /opt/alien/system.img
    Press y to confirm overwrite (make sure you have backup of the original system.img)

(9.5 Not sure if necessary but I set the permissions of system.img to match the original by:)

    As devel-su: chmod u=rw,g=r,o=rw /opt/alien/system.img 

10. Start the Android Support. Install MicroG from F-droid repo. You should see signature spoofing enabled and MicroG working.

Thanks to people on thread https://together.jolla.com/question/198500/xperia-xa2-sailfish-x-dont-have-systempriv-app-directory/ for getting the squashfs parameters right, thanks to authors of vdexExtractor, SmaliPatcher and of course the MicroG team. Also thanks to the author(s) of NanoDroid for creating a tutorial for deodexing.

Hopefully I got everything right. Please share any improvements you might have in mind for this tutorial. Happy patching =)

[How-to] Install MicroG on XA2 (Android 8.1)

Hopefully this is not a duplicate.

I just managed to get the signature spoofing and Microg working on XA2 (3.0.1.14) with the new Android support so I thought to write a small how-to if others are interested.

Note that you should do this before installing Android apps. Many apps will crash if you install MicroG after them, but you can reinstall the apps and they should start working. Also you probably need to do this everytime there is a update for the Android Support and the system.img is changed.

Whats needed:

-squashfs-tools (Available for both Windows and Linux, I used the linux version) linux version)

-vdexExtractor (https://github.com/anestisb/vdexExtractor (https://github.com/anestisb/vdexExtractor AFAIK only works on Linux) Linux)

-SmaliPatcher (https://forum.xda-developers.com/apps/magisk/module-smali-patcher-0-7-t3680053 (https://forum.xda-developers.com/apps/magisk/module-smali-patcher-0-7-t3680053 AFAIK only works on Windows)

Windows)

Steps:

1. 

Get the file /opt/alien/system.img from your phone and copy it to your PC (make a backup too) 2. too)

Use squashfs-tools to unpack the .img file file

unsquashfs /path/to/image/system.img 3. /path/to/image/system.img

Get the following files and copy them to another folder unpacked_image_path/system/framework/oat/arm/services.vdex unpacked_image_path/system/framework/services.jar 4.

unpacked_image_path/system/framework/oat/arm/services.vdex

unpacked_image_path/system/framework/services.jar

Deodex the services.vdex with vdexExtractor /path/to/vdexExtractor/bin/vdexExtractor vdexExtractor

/path/to/vdexExtractor/bin/vdexExtractor -i path/to/services.vdex --ignore-crc-error 5. --ignore-crc-error

Now you should have a file called services_classes.dex, you need to rename it to classes.dex and pack it into the services.jar file file

zip -j path/to/services.jar classes*.dex 6. path/to/services.jar classes*.dex

Now you need to use SmaliPatcher to inject the signature spoof patch to the services.jar (which now includes the classes.dex file). So switch to Windows (unless you can find a linux version of smalipatcher) and use the graphical UI to patch services.jar. I chose the default settings which includes mock location patch and the signature spoof patch. You probably only need the signature spoof patch. 7. patch.

SmaliPatcher creates a .zip file which includes a /system folder. Copy this system folder over your unpacked_image_path/system to replace the original files with the patched files. 8. files.

Now use squashfs-tools again to pack the files to system.img system.img

mksquashfs unpacked_image_path/ unpacked_image_path/ system.img -comp lz4 -Xhc -noappend -noappend -no-exports -no-duplicates -no-fragments 9. -no-fragments

Copy the new system.img to your phone. Make sure Android Support is not running.

As devel-su: cp /path/to/image/system.img /opt/alien/system.img cp /path/to/image/system.img /opt/alien/system.img

Press y to confirm overwrite (make (make sure you have backup of the original system.img) (9.5 Not original system.img)

(Not sure if necessary but I set the permissions of system.img to match the original by:) by:)

As devel-su: chmod u=rw,g=r,o=rw /opt/alien/system.img 10. u=rw,g=r,o=rw /opt/alien/system.img

Start the Android Support. Install MicroG from F-droid repo. You should see signature spoofing enabled and MicroG working.

working.

Thanks to people on thread https://together.jolla.com/question/198500/xperia-xa2-sailfish-x-dont-have-systempriv-app-directory/ for getting the squashfs parameters right, thanks to authors of vdexExtractor, SmaliPatcher and of course the MicroG team. Also thanks to the author(s) of NanoDroid for creating a tutorial for deodexing.

Hopefully I got everything right. Please share any improvements you might have in mind for this tutorial. Happy patching =)

[How-to] Install MicroG on XA2 (Android 8.1)

Hopefully this is not a duplicate.

I just managed to get the signature spoofing and Microg MicroG working on XA2 (3.0.1.14) with the new Android support so I thought to write a small how-to if others are interested.

Note that you should do this before installing Android apps. Many apps will crash if you install MicroG after them, but you can reinstall the apps and they should start working. Also you probably need to do this everytime there is a an update for the Android Support and the system.img is changed.

Whats What's needed:

-squashfs-tools (Available (available for both Windows and Linux, I used the linux Linux version)

-vdexExtractor (https://github.com/anestisb/vdexExtractor AFAIK only works on Linux)

-SmaliPatcher (https://forum.xda-developers.com/apps/magisk/module-smali-patcher-0-7-t3680053 AFAIK only works on Windows)

Steps:

Get the file /opt/alien/system.img from your phone and copy it to your PC (make a backup too)

Use squashfs-tools to unpack the .img file

unsquashfs /path/to/image/system.img

Get the following files and copy them to another folder

unpacked_image_path/system/framework/oat/arm/services.vdex

unpacked_image_path/system/framework/services.jar

Deodex the services.vdex with vdexExtractor

/path/to/vdexExtractor/bin/vdexExtractor -i path/to/services.vdex --ignore-crc-error

Now you should have a file called services_classes.dex, you need to rename it to classes.dex and pack it into the services.jar file

zip -j path/to/services.jar classes*.dex

Now you need to use SmaliPatcher to inject the signature spoof patch to the services.jar (which now includes the classes.dex file). So switch to Windows (unless you can find a linux Linux version of smalipatcher) and use the graphical UI to patch services.jar. I chose the default settings which includes mock location patch and the signature spoof patch. You probably only need the signature spoof patch.

SmaliPatcher creates a .zip file which includes a /system folder. Copy this system folder over your unpacked_image_path/system to replace the original files with the patched files.

Now use squashfs-tools again to pack the files to system.img

mksquashfs unpacked_image_path/ system.img -comp lz4 -Xhc -noappend -no-exports -no-duplicates -no-fragments

Copy the new system.img to your phone. Make sure Android Support is not running.

As devel-su: cp /path/to/image/system.img /opt/alien/system.img

Press y to confirm overwrite (make sure you have backup of the original system.img)

(Not sure if necessary but I set the permissions of system.img to match the original by:)

As devel-su: chmod u=rw,g=r,o=rw /opt/alien/system.img

Start the Android Support. Install MicroG from F-droid repo. You should see signature spoofing enabled and MicroG working.

Thanks to people on thread https://together.jolla.com/question/198500/xperia-xa2-sailfish-x-dont-have-systempriv-app-directory/ for getting the squashfs parameters right, thanks to authors of vdexExtractor, SmaliPatcher and of course the MicroG team. Also thanks to the author(s) of NanoDroid for creating a tutorial for deodexing.

Hopefully I got everything right. Please share any improvements you might have in mind for this tutorial. Happy patching =)

[How-to] Install MicroG on XA2 (Android 8.1)

Edit: Check the answer by yeoldegrove for an automated script, thank you to yeoldegrove!

Hopefully this is not a duplicate.

I just managed to get the signature spoofing and MicroG working on XA2 (3.0.1.14) with the new Android support so I thought to write a small how-to if others are interested.

Note that you should do this before installing Android apps. Many apps will crash if you install MicroG after them, but you can reinstall the apps and they should start working. Also you probably need to do this everytime there is an update for the Android Support and the system.img is changed.

What's needed:

-squashfs-tools (available for both Windows and Linux, I used the Linux version)

-vdexExtractor (https://github.com/anestisb/vdexExtractor AFAIK only works on Linux)

-SmaliPatcher (https://forum.xda-developers.com/apps/magisk/module-smali-patcher-0-7-t3680053 AFAIK only works on Windows)

Steps:

Get the file /opt/alien/system.img from your phone and copy it to your PC (make a backup too)

Use squashfs-tools to unpack the .img file

unsquashfs /path/to/image/system.img

Get the following files and copy them to another folder

unpacked_image_path/system/framework/oat/arm/services.vdex

unpacked_image_path/system/framework/services.jar

Deodex the services.vdex with vdexExtractor

/path/to/vdexExtractor/bin/vdexExtractor -i path/to/services.vdex --ignore-crc-error

Now you should have a file called services_classes.dex, you need to rename it to classes.dex and pack it into the services.jar file

zip -j path/to/services.jar classes*.dex

Now you need to use SmaliPatcher to inject the signature spoof patch to the services.jar (which now includes the classes.dex file). So switch to Windows (unless you can find a Linux version of smalipatcher) and use the graphical UI to patch services.jar. I chose the default settings which includes mock location patch and the signature spoof patch. You probably only need the signature spoof patch.

SmaliPatcher creates a .zip file which includes a /system folder. Copy this system folder over your unpacked_image_path/system to replace the original files with the patched files.

Now use squashfs-tools again to pack the files to system.img

mksquashfs unpacked_image_path/ system.img -comp lz4 -Xhc -noappend -no-exports -no-duplicates -no-fragments

Copy the new system.img to your phone. Make sure Android Support is not running.

As devel-su: cp /path/to/image/system.img /opt/alien/system.img

Press y to confirm overwrite (make sure you have backup of the original system.img)

(Not sure if necessary but I set the permissions of system.img to match the original by:)

As devel-su: chmod u=rw,g=r,o=rw /opt/alien/system.img

Start the Android Support. Install MicroG from F-droid repo. You should see signature spoofing enabled and MicroG working.

Thanks to people on thread https://together.jolla.com/question/198500/xperia-xa2-sailfish-x-dont-have-systempriv-app-directory/ for getting the squashfs parameters right, thanks to authors of vdexExtractor, SmaliPatcher and of course the MicroG team. Also thanks to the author(s) of NanoDroid for creating a tutorial for deodexing.

Hopefully I got everything right. Please share any improvements you might have in mind for this tutorial. Happy patching =)