[Galaxy S 4 i9505 Android Development] legendt:
New kernel!

I have intended to use the original kernel but the random reboot really sucks and cannot be resolved.

So, are we here to listen to monthly joke? I'm afraid what Google did to ROM is just replacing the build number at some months.:( The monthly security patch apparently is mainly some binary update in the kernel. Part of them is in our ramdisk (if you unpack each month's kernel ramdisk you will find the difference?). However, samsung never open source their kernel updates since last Sept. We should adapt kernels so that we can benefit from the security update.

As we know, the only kernel we use is based on [MENTION=4899086]alucard_24[/MENTION] 's great work, so is this kernel but a little newer. Of course, no random reboots!

Here is the major changes:

Linux 3.4.109

SELinux Permissive ! (You can install Viper4Android and more now!)

Built with UBER TOOLCHAINS 5.3 20160401

Shipped with latest PE1 ramdisk (May, 2016)

Please note: the first boot you may encounter black screen issue or something else. Don't worry, second and further boots will be okay. I don't know what causes this.

I might not have time to update the kernel frequently. NO GUARANTEES, NO WARRANTY, NO SUPPORT, NO ANSWER FROM ME. Since I am not a specialist and the kernel source won't update anymore unless somebody continues the sync of upstream, you don't have to and need to recompile the kernel source to patch the monthly kernel update. That is, in my case, mostly the ramdisk will only update three files (sometimes may be more), which is:

- init

- sbin/adbd

- sbin/healthd

- selinux_version (Only the build number)

( DO NOT TOUCH THE fstab file I modified because Samsung hasn't release the newer kernel source)

Therefore what you need to do is only to unpack and repack boot.img, then replace the boot.img in zip and reflash the kernel. If there are more files that are changed, make sure you don't override these changes here or you still get SELinux enforce: http://xdaforums.com/showpost.php?p=49371728&postcount=93. I've made those change this time and in most cases you won't touch those files.

How to unpack and repack? (Don't go on if you are a newbie to Linux and just wait for a update)

Make sure you are in Linux / *nix envrionment with gzip, cpio, mkbootfs, mkbootimg installed.

Checkout this script from gist: https://gist.github.com/1087743

Unpack kernel

Split the boot.img

$ ./split_bootimg.pl boot.img
Page size: 2048 (0x00000800)
Kernel size: 1388548 (0x00153004)
Ramdisk size: 141518 (0x000228ce)
Second size: 0 (0x00000000)
Board name:
Command line: no_console_suspend=1
Writing boot.img-kernel ... complete.
Writing boot.img-ramdisk.gz ... complete.

Extract the ramdisk.

$ mkdir ramdisk
$ cd ramdisk
$ gzip -dc ../boot.img-ramdisk.gz | cpio -i

Make some change to the ramdisk (those updated file mentioned above extracted from the monthly update kernel ramdisk)

Repack the kernel

$ mkbootfs ./ramdisk | gzip > ramdisk-new.gz
$ cmd_line="console=ttyHSL0,115200,n8 androidboot.hardware=qcom user_debug=31 ehci-hcd.park=3 androidboot.bootdevice=msm_sdcc.1 androidboot.selinux=permissive"
$ ./mkbootimg --cmdline "$cmd_line" --kernel boot.img-kernel --ramdisk ramdisk-new.gz --base 0x80200000 --pagesize 2048 --ramdisk_offset 0x02000000 --output boot.img

Replace the boot.img in the zip and flash! It's all done!