[Galaxy S6 Android Development] WOReKEn:
Hello, I am trying to modify the kernel and started by compiling the kernel from the source provided in the first post:

GitHub - SubZero7748/android_kernel_samsung_exynos7420

Contribute to SubZero7748/android_kernel_samsung_exynos7420 development by creating an account on GitHub.

github.com

For compilation I am following this guide:

[REFERENCE] How to compile an Android kernel

Introduction Hello everyone, I will be going over how to compile a kernel from beginning to end! Prerequisites: A Linux environment (preferably 64-bit) Knowledge of how to navigate the command line Common sense A learning spirit, there will be...

xdaforums.com

After fixing some compilation errors the kernel from the above repo successfully compiles. However the repacking is not really clear to me and I think I made a mistake since the device will get stuck at the Galaxy S6 boot logo when I try to flash the compiled kernel.

This are the steps I did. I hope someone can identify a mistake?

# go to working dirrectory
> cd /home/myuser/Downloads
# download kernel source
> git clone https://github.com/SubZero7748/android_kernel_samsung_exynos7420

# download toolchain
> git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/
> cd aarch64-linux-android-4.9
# since LOS 15.1 is based on Oreo 8.1 I thought checking out the release branch would be best
> git checkout oreo-release

# setup env variables
> export ARCH=arm64 && export SUBARCH=arm64
> export CROSS_COMPILE=/home/myuser/Downloads/aarch64-linux-android-4.9/bin/aarch64-linux-android-

I received some compilation errors in the first attempt:

...
/usr/bin/ld: scripts/dtc/dtc-parser.tab.o:(.bss+0x50): multiple definition of `yylloc'; scripts/dtc/dtc-lexer.lex.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [scripts/Makefile.host:127: scripts/dtc/dtc] Error 1
make[1]: *** [scripts/Makefile.build:455: scripts/dtc] Error 2
make[1]: *** Waiting for unfinished jobs....
HOSTLD scripts/mod/modpost
make: *** [Makefile:557: scripts] Error 2

After searching I came across this solution https://github.com/Tomoms/android_k...mmit/11647f99b4de6bc460e106e876f72fc7af3e54a6

to just patch the corresponding file to remove the definition of yylloc:

--- a/scripts/dtc/dtc-lexer.l
+++ b/scripts/dtc/dtc-lexer.l
@@ -39,7 +39,7 @@ LINECOMMENT "//".*\n
#include "srcpos.h"
#include "dtc-parser.tab.h"

-YYLTYPE yylloc;
+//YYLTYPE yylloc;

Furthermore I added a custom string to the EXTRAVERSION variable in the Makefile but I don't think this matters.

With the tiny patch from above the compilation was successful since I now have some kernel images.

> cd /home/myuser/Downloads/android_kernel_samsung_exynos7420
> make clean
> make mrproper
> make lineageos_zerofltexx_defconfig
> make -j$(nproc --all)
> ls /home/myuserDownloads/android_kernel_samsung_exynos7420/arch/arm64/boot
dts Image Image.gz Image.gz-dtb install.sh Makefile

I think until here I got everything right. But now the repacking begins and I am not sure if my procedure is correct.

First I downloaded the LineageOS ROM provided in the first post of this thread: https://androidfilehost.com/?fid=6006931924117915435

I extracted the lineage-15.1-20211022-UNOFFICIAL-zerofltexx.zip and then took the contained file boot.img and renamed it to orig_boot.img

I used Android Image Kitchen from here https://xdaforums.com/t/tool-androi...kernel-ramdisk-win-android-linux-mac.2073775/ to unpack the boot.img file

> unpackimg.sh orig_boot.img
> ls split_img
orig_boot.img-base orig_boot.img-dttype orig_boot.img-kernel_offset orig_boot.img-pagesize orig_boot.img-second_offset
orig_boot.img-board orig_boot.img-hashtype orig_boot.img-origsize orig_boot.img-ramdiskcomp orig_boot.img-tags_offset
orig_boot.img-cmdline orig_boot.img-imgtype orig_boot.img-os_patch_level orig_boot.img-ramdisk.cpio.gz orig_boot.img-tailtype
orig_boot.img-dt orig_boot.img-kernel orig_boot.img-os_version orig_boot.img-ramdisk_offset

Since I couldnt find any Image.gz, Image.gz-dtb kind of files in the unpacked kernel. I took the largest file

orig_boot.img-kernel which was 23MB and replaced it with my one of the compilation output files Image which was slightly bigger but also around 23MB.After renaming it back to orig_boot.img-kernel I repacked the kernel with

> repackimg.sh

Then I transferred the resulting image file to the root of my phone and flashed it with TWRP. This resulted in a bootloop which could be fixed by reflashing the orig_boot.img .

So what did I do wrong here? Maybe I should also mention that I had some problem with the repacking script and had to install cpio version 2.13.90 before repacking would work. Is there any additional information I could provide? I would highly appreciate any advice :)