GmsCore icon indicating copy to clipboard operation
GmsCore copied to clipboard

Installation instructions

Open alex9434 opened this issue 2 years ago • 13 comments

Dear all,

The wiki does not explain how to directly "inject" microg into a system.img for Android 10 to 13. I would like to add microg directly into a mounted system.img file before flashing the file to the phone with fastboot.

Could you add installation instructions? Lineage.microg.org obvously does exactly this but I would like to do something similar for a device that is not listed there.

Thank you, alex

alex9434 avatar Jul 08 '23 19:07 alex9434

On their Github (I do not have a link handy) there is a page that shows the parts that they use to add the microG components to a ROM when building.

Here's the main repo page for the ROM-related things, if you don't see the files you need you can open an issue there and ask:

https://github.com/lineageos4microg/docker-lineage-cicd

Sapiosenses avatar Aug 20 '23 01:08 Sapiosenses

LineageOS for microG compile the ROM completely from scratch, it doesn't inject into an existing image.

ale5000-git avatar Aug 20 '23 12:08 ale5000-git

Now it seems possible to install MicroG on a vanilla LineageOS: https://review.lineageos.org/c/LineageOS/android_frameworks_base/+/383573

Can someone please provide instruction on how to do it?

g4b0 avatar Mar 01 '24 15:03 g4b0

Now it seems possible to install MicroG on a vanilla LineageOS: https://review.lineageos.org/c/LineageOS/android_frameworks_base/+/383573

Can someone please provide instruction on how to do it?

If you root phone, just flash this as a magisk/ksu module. https://github.com/nift4/microg_installer_revived

Wojtaz0w avatar Mar 01 '24 19:03 Wojtaz0w

This should be possible without rooting the phone. LineageOS has rooted adb without Magisk, you can push to /system/priv-app directly from adb. I haven't quite figured it out though, currently my phone bootloops when doing this. Will reply if I find anything out.

bblacher avatar Mar 03 '24 20:03 bblacher

Alright, I figured it out and put it all in a script, you can use that as installation instructions :) I don't know if there are things that could be done better but this works for me. https://gitlab.com/bblacher/microg-installer

bblacher avatar Mar 03 '24 22:03 bblacher

Didn't anyone see this? https://xdaforums.com/t/mod-flashable-microg-unofficial-installer.3432360/ If it were that simple, I wouldn't have spent 8 years of my life working on an installer

ale5000-git avatar Mar 03 '24 22:03 ale5000-git

I was looking for a way to add MicroG directly to the system.img file from payload.bin before flashing it. The current solution (incl. the great installer from ale5000 that I use) are flashed on top of the image. To clarify what I would like to archive on a linux system:th

  1. Extract system.img with payload_extractor
  2. Loop mount system.img
  3. Modify services.jar to enable signature spoofing
  4. Add microg to system.img
  5. Repackage everything as OTA
  6. Optional: Re-sign (e.g. Pixel devices)
  7. Flash to phone (e.g. as OTA update)

I know how to do 1,2,3,5, and 6 but I am still unclear on step 4. Any idea how to do that? The other steps (and more) are for instance covered by https://github.com/chriswoope/resign-android-image. Since all modifications need to be done on a linux computer, I am looking to set-up a shell script that does these automatically on the loop-mounted image file. Still I am not clear how to best add MicroG incl. all required dependencies.

alex9434 avatar Mar 23 '24 09:03 alex9434

Just copy the file and modify its attributes. Here is a snippet from my script:

mkdir mountdir
mount system.img mountdir
cp gmscore.apk mountdir/priv-app/
chown 0:0 mountdir/priv-app/gmscore.apk
chmod 644 mountdir/priv-app/gmscore.apk
chcon u:object_r:system_file:s0 mountdir/priv-app/gmscore.apk
umount mountdir

File must go to priv-app folder as it needs privileged permissions.

JonnyTech avatar Mar 23 '24 10:03 JonnyTech

Thank you very much. What is the best way to automatically set all permissions that Microg requires (eg. draw over other apps)?

alex9434 avatar Mar 24 '24 01:03 alex9434

https://github.com/micro5k/microg-unofficial-installer/tree/main/zip-content/origin/etc/permissions

JonnyTech avatar Mar 24 '24 07:03 JonnyTech

As a user I can confirm that clear ,up-to-date installation instructions will greatly help. Many thanks to @bblacher - only thanks to script from his repository I managed to get working Network location service on my LinageOS phone. Things that confused me a lot

  1. Not clear that network location providers are obsolete. Some documents still mention them, and their packages still can be found in F-Droid, that confuses users.
  2. Not clear that .apk must be installed manually via adb to /system/priv-app directory. I tried installing different versions by F-Droid on the phone, and could not understand why "My Location" application showed me "Not supported" in "Network" section.

vchigrin avatar Nov 13 '24 21:11 vchigrin

If one version of microG (even old) is inside /system/priv-app then you can update it with F-Droid without problems. But if it is installed only by F-Droid then it isn't a privileged app and it cannot bind to system location (limitation of Android not present in the old Android versions).

ale5000-git avatar Nov 13 '24 21:11 ale5000-git