Android phones run on a modified Linux kernel with a modified FHS.
To Compile an android kernel, You need :-
The kernel source (custom preferably as stock can fuck up things)
A toolchain ( depending on the kernel version)
A Linux system ( on android chroot env works)
Always remember for kernels newer than 3.xx use O=out at every compilation command
Also rememberto do a test build first (without any additional stuffs) and if it works then modify and make 2nd build. For 2nd build use ccache to low down compilation time.
Once you cloned the kernel and the toolchain
move the toolchain inside the kernel dir
Then export the things below (edit as u wish)
export ARCH=arm64
export SUBARCH=arm64
export CONFIG=name_defconfig
export CURRENTDIR=$(pwd)
export CROSS_COMPILE=$CURRENTDIR/path/to/toolchain
export CROSS_COMPILE_ARM32=$CURRENTDIR/path/to/toolchain
export CLANG_TOOLCHAIN=/path/to/clang
make O=out $CONFIG
make O=out menuconfig
For test build just hit save and exit
For next build modify stuffs for ur needs
cp -rf out/.config arch/$ARCH/configs/$CONFIG
Then comes the main part
make O=out CC=clang $CONFIG
make O=out CC=clang
After compilation done go to out/arch/$ARCH/boot/
And see if image.gz is there. If it is there then use it to make a anykernel3.zip and flash it. If it boots then voila, you have compiled ur own android kernel.
Hey knight, I have a micromax mobile which is dumped into my drawer and it is very old it is 4g 4gb ram and maybe less space. That phone hangs alot gives errors which arenโt errors it shows bluetooth not working and shit. So can I play with it and make it work cause deep down in my mind I want that for myself xD. Can I do something with it?
You can. Try to find more about the device on XDA. If you get any kernel source, itโll be noice. Or just try to find a way to unlock the bootloader and flash magisk. Rest probably would be easy.