yashsingh1/xdaforums huggingface dataset:
[Galaxy S6 General] The Sickness:
Your missing a folder in build_kernel.

It is the one that would contain your boot.img per the updater-scipt in the META folder....

sickness is the folder you are missing
[Galaxy S6 General] bay12:
Hi guys, i have a question about the kernel rebuilding but not sure if this is the right thread.

This is my situation:

I have a galaxy s6 and i create my custom rom starting from the original samsung touchwiz, just removing all the bloatware, but to successfully boot the rom i've got these options:

a) install a custom kernel (arter or spacex), and the phone boots correctly even withouth root.

b) install the original kernel but in this case i need to root otherwise the phone doesn't boot.

If i want to go for the option B, BUT WITHOUT ROOTING, what shall i do in the stock kernel to make it boot, rebuild the kernel and maybe tweak or remove something? Anyone can please give me a tip on this? I tried to research but no luck.

thanks in advance for the response
[Galaxy S6 General] Ram121:
For option B, using stock kernel for custom ROM,

You are having following two options

1. Rooting stock kernel

2. Make a permissive kernel from source and use it.

But rooting (option 1) is a easy option.
[Galaxy S6 General] bay12:
thanks for your reply! yes i'm already doing the option 1...i just want to understand how to make a permissive kernel from source...can you explain it or point me to some documentation?

thanks
[Galaxy S6 General] The Sickness:
This guide is your answer
[Galaxy S6 General] The Sickness:
Well folks, this is goodbye. I have decided to stop developing across the board.

It's been a fun ride for the past few years. But I'm moving on to other things. I want to thank everyone who has supported me since the S3.

Especially [MENTION=2488858]bx10r[/MENTION] and [MENTION=567138]slickrick[/MENTION].....

Take care.....peace
[Galaxy S6 General] carlosggb:
Can anyone tell me if i compile the note 4 kernel from source, would i still get the Warranty bit: kernel YELLOW LABEL on top of the boot splash screen?

even if i dont make a change?
[Galaxy S6 General] scrappy610:
Probably so because it's not signed from Samsung.
[Galaxy S6 General] ShinySide:
Yes
[Galaxy S6 General] bay12:
hi all,

i've managed to compile the kernel but just using the stock one without using the makefile and all the other files provided in the guide. My goal is to compile a 100% stock unrooted permissive kernel.

I have a custom rom and twrp installed.

When installed my compiled kernel from twrp i see the red message (during the boot) : kernel is no seandroid but i've got a boot loop and i end up in the twrp again.

my question is: what am i doing wrong? is this type of kernel possible to build?

thanks all in advance
[Galaxy S6 General] The Sickness:
I provided the MakeFile for a reason. If you compiled with the Google toolchain you have to modify flags and add a commit.

Is there are reason as to why you omitted my MakeFile? The MakeFile has nothing to do with the kernel being permissive. And the 5.3 optimizes the build.

Also, that red message can be a Busybox issue
[Galaxy S6 General] bay12:
Thanks for your reply! So I've compiled the kernel the 1st time following your guide and using all your files but I've received some errors at the end of the compile as I've removed some folders like supersu and busybox and sickness (i want an unrooted kernel similar to the stock one but permissive).

After this attempt then I've compiled the original stock source using google toolchain.

In both cases, to make the kernel permissive, I've changed the file selinuxfs.c following your commit.

So my question is: to compile an unrooted kernel shall i use your makefile or use the stock makefile? What i need to do to build a kernel without supersu?

Thanks in advance
[Galaxy S6 General] The Sickness:
I'm at work right now. I'll post the "how to" when I get home if someone else doesn't b4 I get home.
[Galaxy S6 General] bay12:
Originally Posted by bay12

Thanks for your reply! So I've compiled the kernel the 1st time following your guide and using all your files but I've received some errors at the end of the compile as I've removed some folders like supersu and busybox and sickness (i want an unrooted kernel similar to the stock one but permissive).

After this attempt then I've compiled the original stock source using google toolchain.

In both cases, to make the kernel permissive, I've changed the file selinuxfs.c following your commit.

So my question is: to compile an unrooted kernel shall i use your makefile or use the stock makefile? What i need to do to build a kernel without supersu?

Thanks in advance

Hi and thank you for this...sorry to nag you...do you or someone else have an update on this?

thanks
[Galaxy S6 General] The Sickness:
I'm pretty sick right now. I'm at the doctors office right. Just give me a few days.

Do you know how to use mkboot?
[Galaxy S6 General] Ram121:
You can use stock makefile. The compiled kernel(zimage) will be in output/arch/arm64/boot folder

Just remember to add the files stated by [MENTION=4921688]The Sickness[/MENTION] in tutorial, without adding those files kernel may not work

To make permissive only modifying selinuxfs.c is sufficient.

Just flash supersu after flashing your kernel
[Galaxy S6 General] bay12:
Oh sorry to hear that! hope you'll get better soon!

Yes i used the mkboto to get the ramdisk from the latest DPIJ boot.img.

---------- Post added at 05:00 PM ---------- Previous post was at 04:57 PM ----------

thanks but i don't want to use supersu and root the phone!

all i want to do is (if possible) build a kernel from stock sources with no root but permissive...just like spacex kernel.
[Galaxy S6 General] Ram121:
Then dont flash supersu
[Galaxy S6 General] bay12:
yeah the problem is that the kernel doesn't boot!

i've done this so far (using the latest g920f dpij kernel sources):

1) compiled with google toolchain 4.9 using the stock makefile

-added sickness commit to make it permissive

-got the zImage and joined to the stock ramdisk

-not using supersu or any other customisation as explained in this guide

the kernel goes in boot loop with red message on top and then back to the twrp recovery.

2) compiled the stock source using this guide just adding the permissive commit and no supersu. no red boot message but bootloop again and back to twrp recovery.

what am i doing wrong?
[Galaxy S6 General] Ram121:
Might be mkbootimg problem the boot.img might not be repacked properly

I always use aik

http://xdaforums.com/showthread.php?t=2073775

To confirm mkbootimg working try unpackimg and repacking stock boot.img and check if works
[Galaxy S6 General] The Sickness:
Actually, I bet your missing folders in your ramdisk.

Does it bootloop? Or go back into recovery
[Galaxy S6 General] bay12:
I'm exactly using aik (in windows) when i compile the kernel with google toolchain and doesn't work.

When i compile the kernel following sickness guide i'm not using aik as the image comes as boot.img

I don't think is aik not working as i've used it to remove the supersu systemless root from from spacex kernel and is working fine...
[Galaxy S6 General] bay12:
after i install the kernel...it tries to boot i see the black screen with the white samsung brand and then goes to recovery.

what does that mean?

regarding the ramdisk i'm unpacking it from stock and copying as it's in you guide...shall i do something else?
[Galaxy S6 General] The Sickness:
If it's going straight back to recovery you are missing folders in your ramdisk. Look at mine. Do you have the same?

https://github.com/The-Sickness/S6-MM/tree/master/build_kernel/G920T/ramdisk
[Galaxy S6 General] bay12:
ok just checked and the only folder i'm missing is:

res

also i don't have these files:

init.carrier.rc

init.rilcarrier.rc

init.rilepdg.rc
[Galaxy S6 General] Demicro:
https://github.com/Demicro/J510FN

I do not know what I'm doing wrong but it gives me error

stuck on build

I tried to compile the J510FN kernel

:(
[Galaxy S6 General] The Sickness:
What is the 2nd "update" commit?
[Galaxy S6 General] Demicro:
Sync local file with remote

Because ramdisk was not present on Github

I remove the galaxy S6 folders
[Galaxy S6 General] The Sickness:
What folders? In the ramdisk?
[Galaxy S6 General] Demicro:
G920 and G925

It stopped compiling after asking me for kernel configuration, modules and other things.

Yes/No/M (New)

Red letters "Error ....... Stuck on build"
[Galaxy S6 General] The Sickness:
Did you set "your" folders inside that contains your ramdisk etc?
[Galaxy S6 General] Demicro:
You mean the ramdisk of my device? I extracted the boot image from my device
[Galaxy S6 General] KingRaheel:
Hey dude. I needed some help with kernel. I haven't followed your guide but i want to know some stuffs generally. Here is what i did is

1. Download correct ubertc toolchain 4.8 .

2. Downloaded samsung kernel source.

3. Edited the build_kernel.sh file to location of toolchain.

4. Followed the instructions in readme.txt and successfully built the kernel i.e i found zImage in the output directory.

What should i do next to get a boot.img? :)

Regards

Raheel
[Galaxy S6 General] spookcity138:
Use this https://github.com/xiaolu/mkbootimg_tools

Assuming you've already have the ramdisk, Just place your zImage in the same folder and make the boot IMG.
[Galaxy S6 General] KingRaheel:
Thank you. I got it to boot but wifi not working. I didnt compile with wlan.ko or something. How to compile kernel with it bro?
[Galaxy S6 General] Ram121:
The kernel you have compiled seems enforcing, make it permissive in source then compile and try.

Another chance is something missing in source like include #something for that check another custom kernel for your device, most of the time I have seen some minor things missing in Samsung source to make kernel working.

For making permissive you can see this commit of my source

https://github.com/Ram121/RamKernel_N4/commit/4ad3d2b41574bee06b1b2c834ef2c59b71314976

Also try using stock or any other tool chain for compiling it may affect.
[Galaxy S6 General] spookcity138:
You need to build the WiFi module and include it in your kernel zip. Create a folder within your kernel zip named system. In that folder create another folder called lib. Then in that folder create another called modules. Place the WiFi module in there and all should be solved.
[Galaxy S6 General] KingRaheel:
I have tried using the command "make modules" and then it gives me an error saying i have to run "make menuconfig". But after i run this menuconfig, i get a GUI and what should i do with that? I couldnt understand much in that. Thanks for your reply

---------- Post added at 08:55 AM ---------- Previous post was at 08:54 AM ----------

Yes i will surely try sabermod or someother toolchain later buddy. Yes env_setup.sh is not there in my kernel source. So thats why i tried using stock method. Thanks for ur time
[Galaxy S6 General] spookcity138:
You can try to compile with CFLAGS_MODULE=-fno-pic

Perhaps that will work for you.
[Galaxy S6 General] KingRaheel:
Firstly I apologize for asking so many noob questions but you see I really wanna learn kernel development. So now I got WiFi also working on my kernel and all is good. But whenever I try to cherry-pick a commit, it says that fatal error: bad object. I have tried it so many times on a simple permissive commit as well yet I get the same result. Can someone please check this and advise me something? What am I doing wrong?

My source:

https://github.com/MdRaheel/Dayyan_Kernel_SM-J500XX
[Galaxy S6 General] The Sickness:
Did you fetch the source from Github that you are picking from?
[Galaxy S6 General] KingRaheel:
No I didn't do that. Dang. So I should do like this?

git fetch https://github.com/Ram121/RamKernel_N4/

git cherry-pick 4ad3d2b41574bee06b1b2c834ef2c59b71314976

Is this right or is something still missing?
[Galaxy S6 General] Ram121:
Yes like that, it's correct, git fetch command will take some time depending on you connection speed
[Galaxy S6 General] Demicro:
HI I build the J510Fn kernel but the size of the boot.img is 19.7 MB so I can't flash it:p

UBERTC arm-eabi-4.8
[Galaxy S6 General] Demicro:
I re-compiled the kernel, this time only 9MB, in addition try to make it permissive but when the device starts at the top a red letter appears.

The kernel is not selinux enforced

Keep reboot every time

I change the value to 0 in selinuxfc
[Galaxy S6 General] spookcity138:
The red lettered message is not a problem and is normal for Samsung devices. I can't say why your device is boot looping though sorry. Too many possibilities. If I had to guess I'd say it's probably an issue with your ramdisk. Just letting you know the message isn't the issue.
[Galaxy S6 General] Demicro:
I will remove the Cmdline

Enforce=0 and androidboot... =permissive

That I had previously put
[Galaxy S6 General] Demicro:
I found the problem ?

The problem was in the mkboot of xiaolu mkbootfs ---> "could not find file or directory". Preventing ramdisk packaging, leaving the boot.img with an empty folder when creating the image

I used thesigness mkboot tools changing mkbootimg_dtb by mkbootimg inside the mkboot file. Since mkbootimg_dtb also did not work "could not find file or directory"

My kernel now is also permissive

Thanks
[Galaxy S6 General] spookcity138:
Glad to hear you got it working!
[Galaxy S6 General] KingRaheel:
Hey! So I cherry-picked many stuffs and got this kernel working great. Thanks guys. But How can I edit this name? Can someone help me out?
[Galaxy S6 General] Ram121:
Check this

https://github.com/Ram121/RamKernel_N4/commit/adaaca774e58e05b3f0c805aeca687e485014c13

Above commit line you will find how to define kernel name and use commit also

And this

https://github.com/Ram121/RamKernel_N4/commit/efdcf5922a1817dfcfe76fa3caf67abc02fbc71f
[Galaxy S6 General] The Sickness:
Delete
[Galaxy S6 General] bay12:
Hi guys,

finally i was able to compile a kernel but now i've got another problem, here is what i'm doing:

1) compilled with aarch64-linux-android-4.9 the latest dpij stock sources (using stock makefile and stock ram disk as well).

2) the only change i've made is the deepsleep fix in drives/scsi/sd.c

3) the kernel is not permissive, so enforcing, and it's not rooted (no supersu installed).

the problem is that i have wakelocks and have no idea why! do you have any tip?

to test if the wakelocks depends by the dpij kernel i installed the original boot.img (not compiled by me), rooted with supersu and no wakelocks at all.

so, do you have any idea what am i doing wrong? to me it seems that clearly depends by my compilation.

thanks in advance
[Galaxy S6 General] hfl12:
Question for the dev out there.

Surely there is a debug mode for this right?
[Galaxy S6 General] The Sickness:
You can debug per your kernel logs if that's what you are referring to.
[Galaxy S6 General] hfl12:
Is this also the case in the real world?

If so, that is one consuming process to put the print line everywhere, and put the compiled code in the real device and still not able to do live debugging.

I might be completely wrong, but I would assume the manufacturer has some type of simulation for live debugging, meaning to step through the code line by line ?
[Galaxy S6 General] tomiga:
Gonna be giving this a try later today. It's about time I built a custom kernel for my phone.
[Galaxy S6 General] The Sickness:
What are you trying to achieve?
[Galaxy S6 General] hfl12:
Just want to know what is the proper way to debug kernel code in the real world.
[Galaxy S6 General] The Sickness:
http://www.elinux.org/Debugging_The_Linux_Kernel_Using_Gdb
[Galaxy S6 General] hfl12:
Thanks The Sickness.

I am a web dev.

To debug our code we just put break point in our IDE- eclipse and intelli-, and sometimes print to console to debug our code. It is very simple.
[Galaxy S6 General] tomiga:
Thanks to this guide, I'm now running a 3.10.104 kernel that I was able to build myself. This is amazing, thank you [MENTION=4921688]The Sickness[/MENTION]!
[Galaxy S6 General] kevintm78:
Hello! I'm having a hard time even getting started with this. Everything goes good until I get to the "sudo build_kernel.sh" part. The device I have is the N910V and it's arm instead of arm64. So I don't know if that's my issue or not, but I'll enter "sudo build_kernel.sh N910V" and it returns "sudo: build_kernel.sh: command not found". I just can't figure out what I'm doing wrong, the terminal is open in my source folder where the build_kernel.sh is and I've repeated the guide several times, but clearly I'm missing something. Here is the link to the source code. If anyone could get me pointed in the right direction on this I would be very grateful.

By the way thank you so much for taking the time to write this guide. If nothing else it got me to make the switch to Linux finally.
[Galaxy S6 General] scrappy610:
I had a similar issue building for the 920t. I entered "sudo bash build_kernel.sh" and it went as it should have.
[Galaxy S6 General] The Sickness:
Anytime you get the error "command not found" just close out everything and reopen. It will be fine after that
[Galaxy S6 General] kevintm78:
Thankfully I was able to get it to execute using the bash command that scrappy610 suggested, but now I'm getting kernel stuck in build. I'm afraid that I might be in over my head trying to do this with an arm device. I read some mention of it around page 11 and 12, so I'm still hopeful but part of the conversation went to pm lol.
[Galaxy S6 General] Demicro:
./build_kernel.sh

------ Or ------

sh build_kernel.sh

Do not use sudo ヽ(｀⌒´)ノ
[Galaxy S6 General] The Sickness:
Yes, you use sudo to build. Just read the build script. It's in plain English.
[Galaxy S6 General] kevintm78:
Man, some days I think I'm making progress with this and some days I feel I'm just way in over my head. The device I'm trying to build for is sm-n910v and it's armv7. I've tried with the files given in the op "as is" and I've tried with some of the suggestions given throughout the thread but so far not much luck. At one point I was able to get the zImage made using the makefile and build_kernel.sh that came with the source code download (progress?). I think part of what is hanging me up is the ".config". Most of my error messages end by telling me that it can't find the .config and then gives options on assigning or making one. If I try menuconfig, it gives a bunch of options to choose from and I was wondering if anyone has advice on that front or if I doing something wrong that is prompting the .config error. Sorry for the long post but I'm determined to get this working or go crazy doing it. Lol
[Galaxy S6 General] MeItsNotMe:
Thanks bro!!! I was curious about kernel but now i can try to build my own kernel for my SM-G531H
[Galaxy S6 General] The Sickness:
Are you still having issues?
[Galaxy S6 General] kevintm78:
Ha, yeah man. I have tried looking to ram121's source since we have the same device and I'm assuming that this guide is the one he used but he's made enough changes that I'm getting a little lost there too. I've read through the build_kernel.sh script that you provide and the readme file that's in the source code and I feel like I'm putting the right defconfig info in the right spot but it doesn't seem to be generating the .config properly. And I can't get make clean or mrproper to run without errors. I'm new to Linux as well so maybe I've have something wrong on that end. I'm dual booting xubuntu by the way and stackoverflow has been helping with that end of it but I don't know man I'm struggling with all to say the least.
[Galaxy S6 General] The Sickness:
When you try to clean are you doing this....

sudo make clean
[Galaxy S6 General] techdude18:
you need to set the correct config file. The source has it in the folder named arch. for mine is msm982eur.defconfig The config file usually based on your model number.
[Galaxy S6 General] kevintm78:
Yeah that's the command I'm using. I'm getting ready to be home and can give the exact error message but I think it's something about kconfig (?) .

That's what I'm using, but where my device is armv7, I'm using the one in arch/arm/config/ instead of arm64 folder. I think mine is something like sec_trlte_vzw_defconfig. I'm going to redo everything and I'll post my source because I've made so many changes trying to figure this out that I probably shouldn't have made.
[Galaxy S6 General] techdude18:
can you send me your logs on terminal?

Link me to your source when you are done with uploading to git. I needa take a look

thanks
[Galaxy S6 General] kevintm78:
While I'm setting all of this back up, there are a couple questions that I have. When using the makefile and build_kernel.sh that are provided, I'm assuming that I need to change the references to arch/arm64/configs to arch/arm/config and I would put the following CONFIG_WITH_CACHE=y and CONFIG_WITH_GRAPHITE=y in the defconfig file that I'm pointing the env.setup to, correct? Also, do I need to use a different toolchain then the one provided due to not using an arm64 device?
[Galaxy S6 General] techdude18:
i didnt actually read this guide, but yeah if you want the kernel to be graphite optimised

You definitely need a different toolchain cause your device is a different build architecture
[Galaxy S6 General] noob4598:
I'm also having these errors. I have been.trying for months to build a kernel for N910T for months. Always the same error like you. But yea i do know you need a arm-eabi toolchain. I am curious about this graphite optimizations though because its the first I have heard of it ha. I am also just learning bro. we might could help each other out seing as we are building for the same device. I'm sure together we might can get some steps forward. PM me sometime or if you have telegram I'm [MENTION=236287]Gene[/MENTION] Truluck. We both need help from the master Mr. Sickness but maybe we could eliminate the minor errors. Collaboration is the key to development.

Also there is oNe question I have about github. There is a 5.1.1 kernel I forked and cloned that I want to update to 6.0.1. The kernel is no longer being developed for T variant, only F. Is there a way to merge, or pull all the changes other than the initial samsung kernel base, or update the kernel source so I can use it on MM? I have googled til my fingers bled so I figured I would ask! Thanks in advance
[Galaxy S6 General] Demicro:
You must use the appropriate tool chain depending on the type of architecture arm / arm64

With tool chains greater than 4.9 I was not able to use graphite, according to something I read a few days ago, it was removed from the Gcc

I recommend using Gcc 4.9 since the higher versions generate many errors which must be corrected

The makefile and kernel build provided in the guide are part of another kernel and may not work by putting it in another kernel. They are of example and advice

You must use the configuration files that come with the source code
[Galaxy S6 General] Noxxxious:
So your defconfig is not called "custom_defconfig" like stated in the env_setup.sh file. You need to either rename your defconfig or change the line inside env_setup.sh where it says custom_defconfig to sec_trlte_vzw_defconfig

That is the reason you get an error when you start building and it says cant find config. Also depending on your toolchain you might be missing a few compiler files. For a 6.x/7.x toolchain you need 2 extra compiler files inside include/Linux folder, compiler-gcc6.h and compiler-gcc7.h. Without these you might get an error straight away. So i recommend to start with Google 4.9 toolchain, aarch64-linux-gnu or arm-eabi depending on your structure

Graphite works fine on any toolchain so far.

Also Makefiles are Linux kernel depended. If you have a 3.10.y kernel then this makefile is fine. If you are on anything higher or lower, then just stick to the Makefile that comes with the kernel source you downloaded. No need for fancy optimizations. Top tier devs like Franciscofranco, Flar2 etc barely use optimizations in their Makefiles, other than the mcpu or mtune