Skip to content

Instantly share code, notes, and snippets.

@jmz-b
Last active October 4, 2019 08:44
Show Gist options
  • Save jmz-b/e4007a2e23ea20960111f8e0ef22023d to your computer and use it in GitHub Desktop.
Save jmz-b/e4007a2e23ea20960111f8e0ef22023d to your computer and use it in GitHub Desktop.
Lineage on the Mi A1 notes

Handle non-slotted partition in A/B OTA package

Issue

https://github.com/omnirom/android_bootable_recovery/issues/253

Notes

  • Tissot maintainer here. If you weren't already aware, we ship bootloader/modem firmware with the ROM in official lineage for some devices (including tissot) to prevent any issues caused by outdated firmware. The problem with tissot is the fact that unlike most of the usual A/B devices, it has more weird partitioning where most partitions are not slotted (except of boot, system, modem). By default, update_engine doesn't expect you to have any non-slotted partition in A/B OTA package. That's why installation fails on all TWRP packages except mine. It doesn't happen in the system because lineage's update_engine already handles these cases - https://github.com/LineageOS/android_system_update_engine/commit/27ddc7269807ebbe31688482dd5eade56d4cccdf I apply this patch in my TWRP builds as well and that's the only difference from the official TWRP source.

  • patched twrp image

  • CosmicDan recovery: XDA/GH

Encryption

Issue

https://forum.xda-developers.com/showpost.php?p=77330471&postcount=3850

Notes

Encryption from LineageOS without data loss

If you formatted (rather than wiped) /data in recovery before installing Lineage, it IS possible to encrypt from Lineage without returning to stock or using the gist. This method means you can do it without reformatting the partition, so you shouldn't lose any data (although YMMV so MAKE BACKUPS!) The partition names and locations may vary on your device as well.

  1. First, you need to find out which /dev/block device your data partition is on. I used ConnectBot to open up a root terminal and issue:
ls -l /dev/block/platform/soc/7824900.sdhci/by-name/userdata

This should give you an output similar to this:

lrwxrwxrwx 1 root root 21 1970-08-01 02:10 /dev/block/platform/soc/7824900.sdhci/by-name/userdata -> /dev/block/mmcblk0p49

This means that for me the /data partition lives on /dev/block/mmcblk0p49

Next, you need to calculate the block size of the existing partition. Again, in ConnectBot, issue:

tune2fs -l /dev/block/mmcblk0p49 | grep "Block count"

This should give an output similar to below:

Block count:              13449081
Formatting /data in TWRP uses up all the blocks, but encryption from Lineage needs 16kb of free space at the end of the partition to store the headers. The block size is 4KB so you basically need to subtract four from your block count to get the new partition size allowing for the encryption headers
(in my case 13449081 - 4 is 13449077)

To make this adjustment, reboot into recovery (I'm using CosmicDan's TWRP) then:

Unmount data Go to Advanced>Terminal and issue the following two commands:

e2fsck -y -f /dev/block/mmcblk0p49
Code:
resize2fs /dev/block/mmcblk0p49 13449077

This frees up the blocks needed to encrypt the phone from within LineageOS, which I just did on the latest nightly (took around 10 minutes).

NB - If you use Magisk to root like me, you will need to reflash it from TWRP once encryption has completed.

redit to the Fairphone forums for this information:

I had to add -f to resize2fs command not sure why:

resize2fs -f /dev/block/mmcblk0p49 13449077

No audio after flashing lineage-15.1-20190313-microG-tissot.zip

Issue

https://www.reddit.com/r/LineageOS/comments/anhdp7/fix_the_no_sound_in_calls/

Notes

$ adb root
$ adb shell
# mount -o rw,remount /
# vim /system/build.prop
  • Find the line persist.vendor.audio.fluence.voicecall=true
  • Replace it with persist.vendor.audio.fluence.voicecall=false
# mount -o ro,remount /
# exit
# adb reboot

LineageOS microG fork

Android Pie

The only way I've been able to get android pie + microg to work so far is to switch to AOSPExtended and use Magisk + NanoDroid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment