yashsingh1/xdaforums huggingface dataset:
[Galaxy S6 General] The Sickness:
How to use Mkboot to edit your ramdisk​

Here will will learn how to use mkboot to do many things...... The first thing we need to do is clone mkboot.img from Github. So you need to go

here. Now open a terminal in your home folder and "clone" the source.....it should look like this

Then when you open the folder it should look like this

Now, you need to place your stock boot.img into the folder. Its up to you to get your boot.img from your device firmware. I cant do

everything for you...lol. Drop the boot.img in like this

Now, in the mkbootimg_tools folder you need to open a terminal and type: ./mkboot boot.img unpacked......hit enter. Looks like this

When its done unpacking the boot.img it will look like this

Now, for all non T-Mobile users.........

In your kernel source you need to go to your build_kernel folder. Now "make" a folder of your device IE: G920F......G920I...etc

Once you have this folder made you need to take the ramdisk, dt.img, and img_info from the unpacked folder in mkboot_tools and

place them in the new folder you just created in build_kernel...like this

Now your ready to build....
[Galaxy S6 General] Maqical:
Really hope this helps bring development up for our device, probably not by much but if anything at least I can keep the tmobile variant alive, thanks for taking the time out of your busy days to write this guide, even when you retire still giving to this community. :)
[Galaxy S6 General] genuine55:
Thanks for the guide might have to switch to Linux since I'm on Windows:good:
[Galaxy S6 General] The Sickness:
Linux is really the only way to go. I removed Windows from my machine a very long time ago..

Once you go Linux, you will never go back to Windows.
[Galaxy S6 General] genuine55:
How do I go about installing Linux by the way? Thanks
[Galaxy S6 General] The Sickness:
That is another topic.......that depends of if you want to keep Widows with dual boot, or replace Windows with Linux
[Galaxy S6 General] genuine55:
Think I would prefer dual boot to keep windows
[Galaxy S6 General] The Sickness:
http://www.pcworld.com/article/2955...linux-with-windows-what-you-need-to-know.html
[Galaxy S6 General] genuine55:
Thanks bro will read up on it
[Galaxy S6 General] inteks:
thx. but why no vm box?

Gesendet von meinem SM-G920F mit Tapatalk
[Galaxy S6 General] warface123:
Can confirm it works on a MacBook Pro with El Capitan :)
[Galaxy S6 General] Maqical:
Alot of Vm applications limit how much ram you can set and then it would take quite awhile with lower resources on build time probably up to 3 hours in some cases where it could be 1 hour and less

1 extremely good vm application I use for everything is VMwareworkstation It's quite expensive but worth it and fully able to change any settings needed at any time

Theres a free 30 trial if you plan on going the vm way for workstation
[Galaxy S6 General] inteks:
i use virtualbox normaly and without performance issues! the last time i build a kernel is some time ago. for my xperia neo [emoji6] but this was although virtualbox with debian and i had no problems with it!

i thought about kernel building for s6 because all kernel projects are EOL and i have no money for a new device for now. btw i quite happy with my 128gb version [emoji12] only batterytime is a bit low. maybe i swap the battery for a s7egde battery sometime...

Gesendet von meinem SM-G920F mit Tapatalk
[Galaxy S6 General] pawo99:
Is possible to show us how to build your Twisted kernel for 920F, please? :fingers-crossed: :angel: Call audio not working :( Or how to update older kernel to new sources? :oThanks

BTW, your Twisted kernel is the best :good::good::good:
[Galaxy S6 General] The Sickness:
This guide will show you how to build a kernel. I will also explain how to cherry pick commits and such...so yes, you can build one just like my Twisted kernel
[Galaxy S6 General] yash92duster:
[MENTION=4921688]The Sickness[/MENTION]

Nice guide:):good:
[Galaxy S6 General] royorbs3:
Cool [MENTION=4861212]TheSickness[/MENTION] this will be easier than referring to our hangouts conversations ;) Thanks buddy. I told u I eventually got some errors using git cherry pick. Looking out for that part of the tut
[Galaxy S6 General] UpInTheAir:
Actually . . . the build script(s) were

initially

sourced from here : https://github.com/halaszk/Perseus-halaszk-universal5433 and if you diff them, will be

HUGE

changes. The 'modern' build script(s) version you are currently using was packaged within my SkyHigh v3.4 source (which isn't a requirement for GPL). I have since moved on and of course kept improving them since . . . .

I always leave original credit in all my scripts, even if the code has been modified (sometimes) beyond recognition . . .
[Galaxy S6 General] spookcity138:
Yes,you can have multiple toolchains. Just point your build to the one you want to use either via the terminal or in the makefile.
[Galaxy S6 General] The Sickness:
Yes, you can have multiple toolchains. I have several.
[Galaxy S6 General] hfl12:
Ok thanks.

1. Which rom is easiest for beginner to build with this kernel ?

2. Is it easy to integrate the kernel into the rom ?

3. Do we need to modify the rom also?
[Galaxy S6 General] The Sickness:
You build a rom for your device from the stock tar file. You can then build your kernel from the source that matches your firmware.

You make your kernel part of the installation process via a zip that includes your rom files.
[Galaxy S6 General] gvmiguez:
Great guide, i will have to switch to Linux to test it
[Galaxy S6 General] spookcity138:
There are so many reasons to switch to Linux [emoji2]
[Galaxy S6 General] The Sickness:
There is only one reason to run Linux.....it's what android is built on. Windows = trash.
[Galaxy S6 General] hfl12:
Thanks.

1. Stock tar file, does the carrier release the tar file or do we manually convert it to a tar file?

2. Is there a IDE used for modifying the OS and kernel code ?

3. Can we debug the OS and kernel code live-debug mode ?
[Galaxy S6 General] ShinySide:
1. Find your stock tar on http://www.sammobile.com/firmwares/

2. Besides apktool/baksmali which neither are an IDE nope. Unless you want to build an app with Android Studio

3. Besides adb, last_kmsg and dmesg, There's things like IDA which I highly doubt you'll find useful as I've never met anyone that's actually used it.
[Galaxy S6 General] AntonioMartosMendez:
Friends, I am trying to compile my version 2 of my kernel, but I get this error, we donot it should, you can help me ??

***** Make ramdisk *****

CHK include/generated/uapi/linux/version.h

CC scripts/mod/devicetable-offsets.s

CHK include/generated/utsrelease.h

GEN scripts/mod/devicetable-offsets.h

HOSTCC scripts/mod/file2alias.o

CALL scripts/checksyscalls.sh

HOSTLD scripts/mod/modpost

Building modules, stage 2.

MODPOST 2 modules

/home/antonio/MartitosKernelMM/scripts/Makefile.fwinst:45: el objetivo '/lib/firmware/tsp_stm/stm_z1.fw' se proporcionó más de una vez en la misma regla

/home/antonio/MartitosKernelMM/scripts/Makefile.fwinst:45: el objetivo '/lib/firmware/abov/abov_valley.fw' se proporcionó más de una vez en la misma regla

'/home/antonio/MartitosKernelMM/net/ipv4/tcp_htcp.ko' -> './build_kernel/system/lib/modules/tcp_htcp.ko'

'/home/antonio/MartitosKernelMM/net/ipv4/tcp_westwood.ko' -> './build_kernel/system/lib/modules/tcp_westwood.ko'

Thanks!!
[Galaxy S6 General] The Sickness:
That's just really a warning. It's telling you there is duplicate entries in firmware.

I assume it finishes building?
[Galaxy S6 General] AntonioMartosMendez:
Yes, but I wanted to see if this error affects something.

The kernel works perfect.

Thanks for the tutorial.
[Galaxy S6 General] The Sickness:
Look in my source. I have a commit you can use that will fix that warning
[Galaxy S6 General] hfl12:
Everyone here is modifying the kernel, so I am assuming you guys already know how to modify the os code ?

Because how would you test your code without integrating it to the OS ?

And finally, do you have an equivalent guide to modifying the OS code?
[Galaxy S6 General] The Sickness:
I have no guide on how to build a rom. But I'm sure there is one or two around XDA.

I assume when you say " Because how would you test your code without integrating it to the OS" your are referring to a kernel and a rom?

The kernel sources you build from match the stock firmware for the most part. If you have for example a Tmobile S6, and you are on EPH2 firmware, you build the EPH2 kernel source. Make sense now?
[Galaxy S6 General] AntonioMartosMendez:
Perfect, thank you very much, now no longer out warnings.
[Galaxy S6 General] hfl12:
Thanks.

What if there is a stock kernel but not a stock rom for the phone, in this case, which rom should I use ?
[Galaxy S6 General] The Sickness:
Then in that case you either build a rom, or stay on stock.
[Galaxy S6 General] hfl12:
Thanks.

When you said stay on stock do you mean the manufacturer stock rom ?

The phone I have is a zte awe which the manufacturer provides a kernel.

I want to build from a marshmallow based ROM. Do I have to start with the lastest cyanogenmod?

Can you guide me in the right direction ?
[Galaxy S6 General] StonebridgeGr:
hey man, i need some help here.. i have s6 32gb gt-920f with mm 6.0 last version.. i want make a kernel, i have ubuntu last version on my second pc.. so, i must download any source kernel? it will works on any s6 variant? because on my phone i have a version EU Gr(greece) so, if i want to make it to work on my phone i must search for the specific sourcE? on from any rom?
[Galaxy S6 General] spookcity138:
[MENTION=5710811]feikacab[/MENTION],you really shouldn't quote the main post, but to answer your question you need to download the S6 kernel source.

http://opensource.samsung.com/reception.do

I don't know much about the S6,but make sure you use the proper variant for your specific model.
[Galaxy S6 General] StonebridgeGr:
you really shouldn't quote the main post

why?
[Galaxy S6 General] spookcity138:
Well,it's kinda long in this case.
[Galaxy S6 General] StonebridgeGr:
ok., before i meant the build number.. my build number it is G920FXXS4DPIJ so.. i must search to find a source kernel for this build number? or i can use any source with any build number? of course mm source and for s6.
[Galaxy S6 General] scrappy610:
You have to look for the source for your device configuration. For example, the US Sprint Note 7 is the SM-N930P. The US version, in my example, uses the snapdragon chip. The international version of the Note 7 is the SM-N930F or FD. The international version uses the exynos chip. You want to get the kernel source for the specific hardware you are working with. Snapdragon kernel source will not work with exynos.

When you go to the samsung kernel source website, in the search bar, search for your specific device which should be G920FX.
[Galaxy S6 General] StonebridgeGr:
yeah, but here i am seeing a lot of version or something like that (mm is my interesting)

http://opensource.samsung.com/reception/receptionSub.do?method=sub&sub=F&searchValue=g920f
[Galaxy S6 General] scrappy610:
Ok, i misunderstood. Yes, in your case, I woild start with the one that has the full name of your firmware first, the DPIJ version i think. That cuts down on any confusion or modification to work with your system. Dont worry bout the other ones yet.
[Galaxy S6 General] spookcity138:
Yeah,just grab the latest MM release and you should be good.
[Galaxy S6 General] StonebridgeGr:
look dude, my build name it is G920FXXS4DPIJ so, if i create a kernel with this source .. it will be work for all build numbers? of course all must have 6.0 mm and g920f . i am just confused dude..
[Galaxy S6 General] spookcity138:
Yes,they are all for the same model so any of them will work as long as I'm looking at the link properly. Just use the latest one.

Edit: Yes it would work for all g920f's running MM.
[Galaxy S6 General] StonebridgeGr:
dude, i have download the source, but on files i dont see any named platform.. only kernel
[Galaxy S6 General] scrappy610:
You are correct. The kernel source with your exact build number does not have the platform included. I just downloaded it to double check. I don't want to add any confusion, but you can download a newer kernel source and it will work too. The kernel source is listed in descending order. The first one (top) is the newest. They will all work with your device running mm. They just release a "new" source with every update. That doesn't mean anything has actually changed inside the kernel source, just that they want the kernel source number to match the firmware number. If there are updates to the kernel source, it will not cause any issues. that is why [MENTION=7065337]spookcity138[/MENTION] was saying to download the latest.

I downloaded the first (top) source and it has the platform in it. I would try that one.
[Galaxy S6 General] StonebridgeGr:
I appriecieta your help, what is this files? i cant understand, it is a source code ? right? from s6?

https://github.com/The-Sickness/S6-MM
[Galaxy S6 General] scrappy610:
Yes that is his kernel source.
[Galaxy S6 General] StonebridgeGr:
i am reading the first posts to build the kernel, the guy say this Non T-Mobile users see post #3 so i must see the 3 post ?
[Galaxy S6 General] scrappy610:
Yeah it tells you how to get the extra info that your going to need. Its not too hard, just an extra step.
[Galaxy S6 General] StonebridgeGr:
my phone it is not t-mobile. so i must keep read this post yes or not?
[Galaxy S6 General] scrappy610:
Yes. Read post 3 and follow the instructions. [emoji4]
[Galaxy S6 General] spookcity138:
Yeah,you need to use the mkbootimage tools. You can do a fair amount with them. Its a wonderful set of tools
[Galaxy S6 General] StonebridgeGr:
pfff it is very complicated how he the posts is writing.. fine...
[Galaxy S6 General] The Sickness:
You need post #3.

And it's very simple to do. That is the simplest way of explaining it
[Galaxy S6 General] spookcity138:
Its just one of those things where once you do it a time or two it'll all make sense. I think he explained it well. Far better and far more detailed than I could have. It's just a matter of doing it and getting comfortable with the process I think.

Give it time. You'll be a pro soon enough. [emoji4]
[Galaxy S6 General] StonebridgeGr:
hahah you are right, sorry, well, the boot.img which i need, can i take it from my rom?

---------- Post added at 06:26 PM ---------- Previous post was at 06:20 PM ----------

here it is the proble, becuase if i take the boot.img from the stock rom which i have installed then if someone wants to install the kernel maybe bootloop his device if he have different boot.img..
[Galaxy S6 General] The Sickness:
No. It needs to be from the stock source. Get the tar from Sammobile and extract it from the firmware
[Galaxy S6 General] StonebridgeGr:
i have already extracted the tar to my home folder.. but i am seeing the boot.img on the kernel folder ( source code)
[Galaxy S6 General] The Sickness:
Post 3 is just to extract the ramdisk. Which then needs to be added to your source
[Galaxy S6 General] StonebridgeGr:
yeah but you writing to paste our boot.img to the home folder.. how to find the boot.img? from the stock rom?

---------- Post added at 06:37 PM ---------- Previous post was at 06:35 PM ----------

maybe, when u writing the 3 post u mean i must do only this for now? or all the above from the 3 post?
[Galaxy S6 General] The Sickness:
You need to do what post #3 says
[Galaxy S6 General] StonebridgeGr:
i know, but on the #3 post you say that we need the boot.img, if i take it from the stock rom, it is a problem? or i can find it somewhere else? and where?
[Galaxy S6 General] The Sickness:
You extract the files from the stock firmware. The boot.img is inside the tar
[Galaxy S6 General] StonebridgeGr:
ok. any build number have different boot.img? ( i am talking about g920f 6.0 mm)
[Galaxy S6 General] The Sickness:
Just get the newest firmware for your device from Sammobile. That's what you use. If, Samsung Open Source doesn't have the same, you can use a earlier source as long as it 6.0.1
[Galaxy S6 General] StonebridgeGr:
the problem is if i flash the newest firmware then i dont know if my language is there
[Galaxy S6 General] The Sickness:
That has nothing to do with the boot.img.
[Galaxy S6 General] StonebridgeGr:
sorry, but it actually does, becuase if i use my kernel if i build it and inside of it exist a boot.img from 'other' build-stock rom then the phone will bricked.
[Galaxy S6 General] The Sickness:
Your phone will not brick. Impossible. It will fail in TWRP.

Language is not kernel related. That's in the rom. A 6.0.1 kernel will work on any 6.0.1 firmware
[Galaxy S6 General] N00BY0815:
[MENTION=4921688]The Sickness[/MENTION] I really appreciate this guide, since I know how much time and effort you probably put into this, especially with this level of details. So I just wanted to say: Thanks a lot! Great job!
[Galaxy S6 General] The Sickness:
Thanks man. It came out pretty good I believe. I'm just hoping it inspires some folks into building Android instead of just flashing things.
[Galaxy S6 General] lijianjunyonghu:
Use this tool to complete editing can not start:(
[Galaxy S6 General] scrappy610:
Where are you stuck?
[Galaxy S6 General] bojinda:
Had a few issues in the process and was hoping I could wing it but I'm now breaking when compiling the kernel on Kali 2016.2.

I am trying to build for SM-G920W8, the kernel offered from Samsung had no build_kernel folder, build_kernel.sh, or env_setup.sh so I took the ones from your Kernel and stuck them in mine. I followed your guide all the way through and edited the files as necessary but I get the following error about 3 minutes into the build:

Makefile:903: recipe for target 'drivers' failed

make: *** [drivers] Error 2

Kernel STUCK in BUILD!

I got a few various errors through the build up to that point but that seems to be the one that breaks it. I don't know if this could be the issue, but my kernel DID come with the driver folders you said to add (I left them alone because I already had them)

Other errors were:

./env_setup.sh: line 34: ./build_clean.sh: No such file or directory

/bin/sh: 1: bc: not found

/root/SM-G920W8/kernel/Makefile:141: recipe for target 'kernel/timeconst.h' failed

make[1]: *** [kernel/timeconst.h] Error 127

Makefile:903: recipe for target 'kernel' failed

make: *** [kernel] Error 2

make: *** Waiting for unfinished jobs....

In file included from drivers/usb/gadget/android.c:143:0:

drivers/usb/gadget/f_conn_gadget.c: In function 'conn_gadget_ioctl':

drivers/usb/gadget/f_conn_gadget.c:762:24: error: 'CONN_GADGET_IOCTL_MAX_NR' undeclared (first use in this function)

const int IOCTL_ARRAY[CONN_GADGET_IOCTL_MAX_NR+1] = {

^

drivers/usb/gadget/f_conn_gadget.c:762:24: note: each undeclared identifier is reported only once for each function it appears in

drivers/usb/gadget/f_conn_gadget.c:763:3: error: 'CONN_GADGET_IOCTL_SUPPORT_LIST' undeclared (first use in this function)

CONN_GADGET_IOCTL_SUPPORT_LIST,

^

drivers/usb/gadget/f_conn_gadget.c:764:3: error: 'CONN_GADGET_IOCTL_BIND_WAIT_NOTIFY' undeclared (first use in this function)

CONN_GADGET_IOCTL_BIND_WAIT_NOTIFY,

^

drivers/usb/gadget/f_conn_gadget.c:765:3: error: 'CONN_GADGET_IOCTL_BIND_GET_STATUS' undeclared (first use in this function)

CONN_GADGET_IOCTL_BIND_GET_STATUS

^

drivers/usb/gadget/f_conn_gadget.c:768:24: error: 'CONN_GADGET_IOCTL_MAGIC_SIG' undeclared (first use in this function)

if (_IOC_TYPE(cmd) != CONN_GADGET_IOCTL_MAGIC_SIG) {

^

CC drivers/sensorhub/brcm_legacy/bbdpl/bbd_common.o

CC drivers/staging/android/timed_output.o

CC drivers/tty/tty_ldsem.o

scripts/Makefile.build:308: recipe for target 'drivers/usb/gadget/android.o' failed

make[3]: *** [drivers/usb/gadget/android.o] Error 1

scripts/Makefile.build:455: recipe for target 'drivers/usb/gadget' failed

make[2]: *** [drivers/usb/gadget] Error 2

scripts/Makefile.build:455: recipe for target 'drivers/usb' failed

make[1]: *** [drivers/usb] Error 2

Any help would be much appreciated and thanks a lot for the guide!
[Galaxy S6 General] ShinySide:
/bin/sh: 1: bc: not found

^^^ install bc
[Galaxy S6 General] bojinda:
Haha thanks a lot! I actually hesitated to put that error in my post because it kept compiling for a few minutes after it came up but that did it, by far the easiest fix out of all of the problems I ran into trying to do this on a virtual box.

I Forgot to add the output folders the first time around, but the second time around everything went error free and a 18.9MB zip file appeared in the output folder (in addition to a 27.3MB tar.md5 file, and the busybox, META-INF, sickness(contains boot.img), supersu, and system folders), do those files sound like the right sizes? Am I alright to flash with the 18.9MB zip?

Thanks again
[Galaxy S6 General] Ram121:
Compare size of your kernel with stock kernel, there should not be much difference, if size is about same then its correct
[Galaxy S6 General] TheBuduLord:
A very good, simple and clear tutorial ;) may i ask something please? Why did after succesfully compile and flash my own edited kernel, the kernel version didnt show my name in the settings :crying: i managed to change kernel local version in the make menuconfig, but still my name didnt show up in my samsung settings :crying:
[Galaxy S6 General] spookcity138:
You need to set whatever name you wish it to be in the kernel config process. I believe,but could be wrong,that's its under general->set local name..or append local name. Something along those lines.You could do it in the config file as well before you build.

Edit: I now read your post closer and it seems you did that. That should work. Just format it properly. No spaces and such I believe.
[Galaxy S6 General] bojinda:
the kernel source is about 135MB so I hope you aren't talking about that one (sorry, this is my first experience compiling kernels and I'm still pretty new to linux so it's the perfect storm for noob questions). The boot.img files are the same size, and the size of my kernel seems to be in line with the ones released by Tyrannus and the Hacker kernel (about 50% larger than arter97's and the Terminator kernels) so I think I'll just flash it and see what happens before I move onto the commits
[Galaxy S6 General] Ram121:
Kernel size means boot.img (zimage) size. If its ok you can definitely try
[Galaxy S6 General] The Sickness:
Didn't show your name, OR if says "Kernel Version Not Available "?
[Galaxy S6 General] ShinySide:
You can set the name in the "main" Makefile as well. Normally what the way I do it. But there's actually a few ways to do it. And yes no spaces. Use - or _ or anything to your preference to take up a space.
[Galaxy S6 General] TheBuduLord:
Thank you for all your reply devs :highfive: Luckily i manage to changed it by editing the init/version.c file :D thank you for all your support :fingers-crossed:
[Galaxy S6 General] bojinda:
Just tried flashing my Kernel and it hung up on the black and white Samsung boot screen. I wiped my caches after flashing and then rebooted to that. Any idea what I could try to do to fix it?
[Galaxy S6 General] The Sickness:
Look at your ramdisk, how many folders is there?
[Galaxy S6 General] bojinda:
There' s 1 folder (sbin) inside of the ramdisk folder
[Galaxy S6 General] The Sickness:
That's your problem. If you use mkboot to pull the ramdisk from your stock boot.img you will see the amount of folders you need.

Look at mine....

https://github.com/The-Sickness/S6-MM/tree/master/build_kernel/G920T/ramdisk
[Galaxy S6 General] bojinda:
Okay, I must have done something wrong the first time, I did it again and I now have all of the folders that you have except for the "res" folder. I just tried flashing the new zip and I am getting the same problem.
[Galaxy S6 General] The Sickness:
Then it's one of your edits. Have you just tried to compile straight stock source?
[Galaxy S6 General] bojinda:
I just redownloaded everything and then followed the steps in the guide again to make a totally fresh kernel without changing anything and I am still getting the same problem. I uploaded it here: https://github.com/jindavo/Test if you wouldn't mind taking a look for anything obvious I might have missed or did wrong