[Xiaomi Redmi 3s Questions & Answers] ercea:
Hey guys, I'm trying to compile and test the Xiaomi Redmi 3S kernel sources. I would like to know if someone could explain how we can compile it. Here I'm going to talk what steps I did and what result I got (bad bad xD).

I have to say that I'm a noob about ROM and kernel building, but I have some development skills.

Well, I followed this guide from Anik1199 (thanks!! :) ):

http://en.miui.com/thread-293285-1-1.html

After clone the git repository (of course, branch for "land" device) and compile the sources I had to do the following changes to fixes some errors:

Fixed some relative paths due a "no such file or directory" errors (about 5-6 files). At the moment I put my custom absoule path to see that I can compile

After that, I get this error

drivers/soc/qcom/subsystem_restart.c:1480:19: error: 'WT_SUBSYSTEM_REASTART_LEVEL' undeclared (first use in this function)
if (0 == strncmp(WT_SUBSYSTEM_REASTART_LEVEL, "SYSTEM", 6))

Following the instructions given by Anik1199 on this post:

http://en.miui.com/thread-293285-4-1.html

I fixed this error successfully :). As he say, we have to define the WT_SUBSYSTEM_REASTART_LEVEL constant (by the way, it's a little strange the name right? "reastart" insted of "restart"? xD):

#define WT_SUBSYSTEM_REASTART_LEVEL "related"

After all this fixes the compilation process finished... but, instead to get "zImage" I get some files (in root_sources/arch/arm64/boot) with the following names:

drwxrwxrwx 1 ercea users 4096 ene 3 21:52 dts
-rwxrwxrwx 1 ercea users 28 ene 2 12:37 .gitignore
-rwxrwxrwx 1 ercea users 23465344 ene 3 22:00 Image
-rwxrwxrwx 1 ercea users 227 ene 3 22:00 .Image.cmd
-rwxrwxrwx 1 ercea users 9387806 ene 3 22:00 Image.gz
-rwxrwxrwx 1 ercea users 147 ene 3 22:00 .Image.gz.cmd
-rwxrwxrwx 1 ercea users 9387806 ene 3 22:00 Image.gz-dtb
-rwxrwxrwx 1 ercea users 145 ene 3 22:00 .Image.gz-dtb.cmd
-rwxrwxrwx 1 ercea users 1188 ene 2 12:37 install.sh
-rwxrwxrwx 1 ercea users 1243 ene 2 12:37 Makefile

"dts" is a folder, the rest are files. I don't know what is the kernel, "Image"? or "Image.gz"?

I assumed that the kernel file was "Image" (without extensions). So, following the guide, I can see that the next steps are:

Take my original/current boot.img. The ROM that I've installed is this modified MIUI version (based in beta 6.12.29):

https://xdaforums.com/redmi-3/development/rom-redmi3-pro-ido-thunder-unofficial-t3435852

Unpack the boot.img file using mkbootimg

Rename my "Image" compiled file to "kernel"

Copy the renamed file "kernel" and paste inside the boot.img unpacked folder

Repack the folder to "boot.img"

After this process, I copy my original and compiled kernels in my phone and I restarted to recovery (TWRP). Then, I flashed my compiled kernel ("Install", then "Install Image", select my compiled kernel and select "boot" partition). When I restart my phone... I got bootloop :crying::crying::crying: Even I couldn't enter in Recovey/TWRP, I had to use my PC to flash again the TWRP recovery and enter it.

What am I doing wrong? The "Image" file is wrong and I have to get "Image.gz" file?. If someone could compile our Redmi 3s sources, please, could you explain how did you do it? :)

Sorry the big text (and my bad English), thanks in advantage :)

Cheers!