Solution to Moto G (2013) Tearing with Lollipop Bootloader (41.19) and Android KitKat

tal.aloni

Member
May 12, 2014
46
95
0
After upgrading my bootloader to Lollipop (41.18 / 41.19), I had decided to revert back the kernel / system to Android 4.4.4, this combination introduced an horizontal line going from the top of the screen to the bottom (a.k.a. tearing).

After hours of investigation, I realized that the following Motorola patch updates the Lollipop kernel to match the changes made to the bootloader:
https://github.com/MotorolaMobilityLLC/kernel-msm/commit/0d868145ddd71389c1df8b875aea2c5cee2b1cb3

if you apply the same patch to kernel version 4.4.4, it will solve the tearing issue with the Lollipop bootloader :)

attached a build of the GPE-4.4.4 kernel that includes the fix (based on kernel-msm-kitkat-4.4.4-KTU84P.M003)

p.s. The only part in the kernel that is changed is the device tree.
 

Attachments

Last edited:

motogextreme

New member
Jul 2, 2016
1
0
0
It is possible to build a boot.img with the patch for Retail US 4.4.2 KXB20.9-1.10-1.24-1.1? I've been trying to compile it myself but I have not achieved yet, I'm noob with this.
Sorry and thank you.
 

tal.aloni

Member
May 12, 2014
46
95
0
It is possible to build a boot.img with the patch for Retail US 4.4.2 KXB20.9-1.10-1.24-1.1? I've been trying to compile it myself but I have not achieved yet, I'm noob with this.
Sorry and thank you.
I was not able to find the source code for this specific version, in any case, I won't be able to provide a build for every kernel out there,
I'm using BuilduntuVM.
You'll need NDK r10d and a few additional prerequisites:
Code:
sudo apt-get install p7zip-full
7z x android-ndk-r10d-linux-x86.bin
Code:
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2
sudo apt-get install lzop
Steps:
1. Apply the attached patches.
Code:
patch -p1 < ../build_fix.patch
patch -p1 < ../tearing_fix_for_lollipop_bootloader.patch
2. Build the kernel.
Code:
export CROSS_COMPILE=/home/yourusername/NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-
export ARCH=arm
make clean
make mrproper
make msm8226_defconfig
make menuconfig
make -j3
3. Build the device tree using dtbTool
Code:
../dtbTool/dtbTool -p scripts/dtc/ -o arch/arm/boot/dt.img arch/arm/boot/
4. Use Android Image Kitchen to unpack boot.img and replace "boot.img-dtb" with the one you built (dt.img), and then repack boot.img, use "repackimg.bat --original" to keep the original ramdisk.
5. Flash the resulting boot.img to your Moto G.
 

Attachments

Last edited:

cgrs

Member
Aug 10, 2013
14
3
0
Salamanca
cgrs.tk
I was not able to find the source code for this specific version, in any case, I won't be able to provide a build for every kernel out there,
I'm using BuilduntuVM.
You'll need NDK r10d and a few additional prerequisites:
Code:
sudo apt-get install p7zip-full
7z x android-ndk-r10d-linux-x86.bin
Code:
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2
sudo apt-get install lzop
Steps:
1. Apply the attached patches.
Code:
patch -p1 < ../build_fix.patch
patch -p1 < ../tearing_fix_for_lollipop_bootloader.patch
2. Build the kernel.
Code:
export CROSS_COMPILE=/home/yourusername/NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-
export ARCH=arm
make clean
make mrproper
make msm8226_defconfig
make menuconfig
make -j3
3. Build the device tree using dtbTool
Code:
../dtbTool/dtbTool -p scripts/dtc/ -o arch/arm/boot/dt.img arch/arm/boot/
4. Use Android Image Kitchen to unpack boot.img and replace "boot.img-dtb" with the one you built (dt.img), and then repack boot.img.
5. Flash the resulting boot.img to your Moto G.
So this will build every kitkat kernel fixed?
I'll need it for non-GPE version (KXB21.14-L1.40). If you provided a more extense tutorial, it'd be great ;)

PS: As you can see, I'm a noob on Android Dev ?
 
Last edited:

tal.aloni

Member
May 12, 2014
46
95
0
if you need a different version, first you go to https://github.com/MotorolaMobilityLLC/kernel-msm/releases and locate the kernel source code for the version you require, then you build it per my instructions (google for more detailed instructions).

cgrs,
attached a build of the KXB21.14-L1.40 kernel including the fix.
p.s. you don't have to quote my whole post.
 

Attachments

Last edited:
  • Like
Reactions: miami_

miami_

Member
May 13, 2010
7
1
0
...
cgrs,
attached a build of the KXB21.14-L1.40 kernel including the fix.
p.s. you don't have to quote my whole post.
Unfortunately after flashing your boot.img for 'KXB21.14-L1.40' on my stock KK Ver. 'XT1032_RETAIL-GB_4.4.4_KXB21.14-L1.40_36_cid7' I loose all cellular & wifi services on my phone.
Is there something wrong with my flashing method?
Code:
mfastboot flash boot boot.img
mfastboot flash modem NON-HLOS.bin
mfastboot erase modemst1
mfastboot erase modemst2
mfastboot flash fsg fsg.mbn
After reverting back to the original kernel everything is back to normal.

I also noticed there is ~2MB file size difference between the original and your boot.img files :confused:
Original => 10MB
Patched => 8MB
Is this normal?

Would it be possible to patch my boot.img? I dumped my linux partition on my PC, setting up a build environment will cost me many hours. :(
Thank you very much!

# Attached : my original boot.img from XT1032_RETAIL-GB_4.4.4_KXB21.14-L1.40_36_cid7
 

Attachments

Last edited:

tal.aloni

Member
May 12, 2014
46
95
0
apparently there's a bug in Android Image Kitchen v2.4, and it's enough to unpack and repack boot.img to cause the wifi issue you encountered.

I've updated the original posts with proper images.
Thanks for reporting the issue.

Edit:
The bug is in mkbootfs, the program responsible to recompress the ramdisk, that's an optional step that can be skipped with "repackimg.bat --original" (which will leave the original ramdisk as is), we don't need to modify the ramdisk anyway.
 
Last edited:
  • Like
Reactions: miami_

miami_

Member
May 13, 2010
7
1
0
apparently there's a bug in Android Image Kitchen v2.4, and it's enough to unpack and repack boot.img to cause the wifi issue you encountered.

I've updated the original posts with proper images.
Thanks for reporting the issue.
No problem! No more tearing now and WiFi is working as expected. ;)
Thanks for patching!

Cheers,
miami_