Compiling kernel with TWRP

Search This thread

Oebbler1

Senior Member
Dec 9, 2016
144
182
Hello everyone,

I want to compile a kernel for my Galaxy S2 and for CM13.0 that contains TWRP, a Marshmallow ramdisk and the features I added to it (by modifying the source code).
Does anyone know how to do that?

Greetings,
Oebbler
 

Gustavo_s

Senior Member
Aug 15, 2011
659
2,740
Hello everyone,

I want to compile a kernel for my Galaxy S2 and for CM13.0 that contains TWRP, a Marshmallow ramdisk and the features I added to it (by modifying the source code).
Does anyone know how to do that?

Greetings,
Oebbler

1 - You need to extract the ramdisk from a MM rom's kernel, you can do that with galaxys2_kernel_repack
https://github.com/xiaolu/galaxys2_kernel_repack
I - Put your boot.img on the root of galaxys2_kernel_repack
II - Open a terminal:
III - cd /galaxys2_kernel_repack
IV - ./unpack.sh boot.img
V - The ramdisk was extracted to ./initramfs_files folder

2 - You can use my build script, you just have to extract the boot.cpio file like in this commit:
What this does:
I - There is a "master" file with the source to ramdisk files, it is "i9100.list"
II - The build script repacks the ramdisk files into a new .cpio file, so any change you make to the ramdisk files will be added to the new kernel

3 - The recovery:
I - The recovery is extracted with the ramdisk, it is "recovery.cpio"
II - I'm not sure if you can just rename the official, prebuilt, TWRP to recovery.cpio and replace it, i'm almost sure it won't work
III - If you find a kernel with TWRP, you can unpack it using the tool i mentioned and replace your recovery.cpio file
IV - I think using IsoRec is better anyway
 

Top Liked Posts