[Samsung Galaxy A12] uluruman:
NOTE

These files might already be quite outdated, it is often the case that you just need to upgrade your stock firmware for the problems to be fixed! Before trying to flash anything make sure that your firmware is exactly the same version as that the fixed boot.img was based upon. See the "Files for" lists below for details.

Here is a few boot.img files (tarred for Odin and zipped) intended to be used together with GSI systems (e.g. LineageOS) which suffer from the non-functional touchscreen after the wake-up and the non-functional MTP (USB file transfer). The boot.img files contain the recompiled stock kernel taken from Samsung Open Source with only a couple of the most necessary fixes. 99.9% unaltered, 100% open-source :)

All credits for the touchscreen fix go to manteiga25, he's done an amazing job on figuring this all out, still from his solution which includes additional performance tweaks I've taken the absolute bare minimum so that the problem is no longer present. Also huge thanks to Osvaldo Costa for the wonderful bootimgtool.

NOTE #1: There are reports that the latest version of boot.img for SM-A125F (based on A125FXXS3CWE1) causes an early bootloop with no way to get into Recovery. Unfortunately no solution is yet found for this.

NOTE #2: If you did not yet flash any non-stock boot.img or recovery.img you may get the bootloop after flashing of any of these files (except for the orig's). That bootloop is caused by bootloader refusing to boot the VB-unsigned kernel together with the rest of the VB-signed components. The only solution (unfortunately) is the full factory reset, so you'll have to lose your user data; everything else, including the GSI will remain intact, but you'll have to set it up from scratch.

UPDATE 07/28/23: New kernels based on A125FXXS3CWE1 (SM-A125F) and A127FXXU9DWE4 (SM-A127F) added. All the older versions are now packed into a single old_files.zip file. Some simple scripts that I used (and the placeholder dirs for the Google's Clang and GCC binaries) added as tools.zip.

UPDATE 01/09/23: added the version based on A127FXXU7CVL2 (Android 13) version of the kernel.

UPDATE 01/11/23: added the fixed kernels for SM-A125F.

UPDATE 03/16/23: added the version based on A127FXXU5BVF3 (Android 12) version of the kernel.

Files for SM-A127F:

boot_sm-a127f_u9dwe4_fixed.zip: A127FXXU9DWE4-based kernel, Ilitek ili9881x fix, Novatek nt36525 fix, MTP fix

(old_files.zip) boot_sm-a127f-u4_fixed.zip: A127FXXU4AUK1-based kernel, Ilitek ili9881x fix, MTP fix

(old_files.zip) boot_sm-a127f-u5_fixed.zip: A127FXXU5BVF3-based (Android 12) kernel, Ilitek ili9881x fix, MTP fix

(old_files.zip) boot_sm-a127f-u7_fixed.zip: A127FXXU7CVL2-based (Android 13) kernel, Ilitek ili9881x fix, MTP fix

(old_files.zip) orig_boot_sm-a127-u4.zip: the original unaltered A127FXXU4AUK1 boot.img for undo

(old_files.zip) orig_boot_sm-a127-u5.zip: the original unaltered A127FXXU5BVF3 boot.img for undo

(old_files.zip) orig_boot_sm-a127-u7.zip: the original unaltered A127FXXU7CVL2 boot.img for undo

(old_files.zip) src_sm-a127f_fix.zip: all the altered source files

Files for SM-A125F:

NOTE: at least one user reported that on his SM-A125F the new S3-baseband firmware refuses to load the fixed boot.img (even VB-signed) causing a bootloop, so if you have not yet upgraded your phone to the A125FXXS3CWE1 firmware, then you better stay with the old version and use the old fixed boot.img from old_files.zip.

boot_sm-a125f_s3cwe1_fixed.zip: A125FXXS3CWE1-based kernel, Ilitek ili9881x fix, Novatek nt36525 fix, MTP fix.

(old_files.zip) boot_sm-a125f-u2_fixed_v1.zip: A125FXXU2BVB4-based kernel, Ilitek ili9881x fix, MTP fix

(old_files.zip) boot_sm-a125f-u2_fixed_v2.zip: A125FXXU2BVB4-based kernel, Ilitek ili9881x fix, Novatek nt36525 fix, MTP fix

(old_files.zip) orig_boot_sm-a125-u2.zip: the original unaltered A125FXXU2BVB3 boot.img for undo

(old_files.zip) src_sm-a127f-fix_v2.zip: all the altered source files

v1 should be easy on battery, but v2 will probably eat more because it basically disables the power saving features of the touchscreen chip (unfortunately that's the only solution at the kernel side).

If you don't trust me or if you're in desperate need of a more recent kernel, here are the steps how to rebuild it all yourself (for SM-A127F on Debian 11):

Download the kernel source from Samsung Open Source (A127FXXU3AUJ5)

Unpack SM-A127F_RR_Opensource.zip and Kernel.tar.gz inside

Unpack SM-A127F_RR_Opensource_A127FXXU4AUK1.zip into the same dir (overwriting the files)

Unpack the attached source.tar.gz, it contains only the changed files and build.sh facilitating compilation

From root: apt install clang-9 gcc-9-aarch64-linux-gnu

Remove any other versions of clang. Then cd /usr/bin; ln -s clang clang-9; ln -s clang++ clang++-9; ln -s clang-cpp clang-cpp-9

Back in the Kernel dir, run build.sh and wait for the kernel to compile

Download bootimgtool and compile it (just "make")

Download the stock firmware

Extract boot.img from AP_A127FXX[...].tar.md5 (unpack using tar, ignore the .md5) to the root dir of your Kernel

bootimgtool disassemble boot.img

cp Kernel/arch/arm64/boot/Image kernel

bootimgtool create -o boot.img

Flash boot.img as is using Heimdall or pack into .tar and flash using Odin

You'll need to use the Google's old/patched GCC (r383902 for SM-A125F and r353983c for SM-A127F) and GCC, and there is no way around that except for lots and lots of additional include paths for the Mediatek drivers (and even that does not guarentee that it will be compiled successfully). For boot.img un/re-packing you can use the scripts from the tools.zip file (bootimgtool is also included, although you can download and compile it yourself, of course).