yashsingh1/xdaforums huggingface dataset:
[Galaxy S6 General] kevintm78:
Man, that's sounds great. I've been sitting here trying it all again and double checking things, but when it gets to the point where it's writing the config it fails saying that I must specify variant. The error directs me to /scripts/kconfig/makefile but when I look at that file I don't understand what it's telling me do. I feel like I have a blind spot and I'm just not getting it. Here's my source if anyone can help.
[Galaxy S6 General] Noxxxious:
Have you tried using the Makefile for your device? This one is for 3.10.y kernels i dunno on what N910V is based on. You can take the Makefile from another kernel repo for the N910V or from the original kernel source
[Galaxy S6 General] kevintm78:
Yeah I'm making the changes in env.setup but it's seems like that's being ignored or over ruled. If you check out my last post I put a screen shot of the error. The tool chain I'm using is arm-linux-android-4.9 and I've tried a few others in the past. I've been failing at this for a little while now unfortunately.
[Galaxy S6 General] Demicro:
I get error

Graphite is not supported by compiler with all tool chain greater than 4.9

Linaro Uber
[Galaxy S6 General] kevintm78:
Here's my source and thank you.
[Galaxy S6 General] Demicro:
You have to use the makefile and build from your kernel.

Your kernel use a variant devconfig

The sighness files do not use it
[Galaxy S6 General] Noxxxious:
Maybe you need to edit that Makefile then. The one provided in OP is a bit of a mess and causes reboots due sched module, fivopts etc optimization.

https://github.com/Noxxxious/Zero/blob/master/Makefile
[Galaxy S6 General] Demicro:
If you want to use the full devconfig

You have to generate a complete configuration

And remove the variant requirement from script/kconfig/conf.c
[Galaxy S6 General] noob4598:
Did you export SUBARCH=arm? And i think variant=user
[Galaxy S6 General] Demicro:
GRAPHITE = -fgraphite-identity -floop-parallelize-all -ftree-loop-linear -floop-flatten -floop-nest-optimize

My makefile ?

The makefile that you have shown contains no graphite flags

---------- Post added at 05:27 AM ---------- Previous post was at 05:25 AM ----------

Variant is a configuration file

arch/arm/configs/devconfig......

arch/arm64/configs/......
[Galaxy S6 General] Noxxxious:
Right.. Ctrl + F that to make your statement true..

Also here you can read that not all your flags are required. https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
[Galaxy S6 General] The Sickness:
Actually my MakeFile is fine. It is used in my latest kernel which runs nice. There are zero reports of reboots in my threads.

Not all toolchains play nice with optimizations. So my toolchain is not a "mess" as you so call it. I made this guide to help people. Not to have folks saying something is wrong with my developing due to the fact that you have reboots from my work.
[Galaxy S6 General] kevintm78:
I appreciate everyones feedback. I'm in the process of trying some of your suggestions. A lot of them I've tried a time or two, but I'll double check. Is everyone in agreement that the files provided in the op require too many changes for an arm device to use? I've tried a few times without them but I was really hoping to take advantage of everything in that build_file but at this point I would settle for a successful build of any kind.
[Galaxy S6 General] The Sickness:
Use your MakeFile
[Galaxy S6 General] kevintm78:
I get virtually the same error with my original Makefile. This like a Twilight Zone episode I just seem to be trading one error for another. Don't get me wrong, I wasn't suggesting there's anything wrong with your files. I'm just looking for any port in the storm. Regardless of whether or not I actually get this accomplished or not I've learned a whole lot from this thread.
[Galaxy S6 General] Noxxxious:
I was referering to the old Makefile I started with months ago with the kbuild cflags that did not play out nice with 6/7 GCC, which was a mess. I did not know if you changed it or not. Sorry about that. Also I have nothing to complain about the toolchain like you say I do.

I see that N910V is also 3.10.y so it are your bash scripts that are not set right

I made you a new bash script. You will only need to change the toolchain folder name, username because it is set to mine at the moment due testing this script. The script might not be perfect, because I also started in this thread months ago. It does compile, but I am not sure if i messed up creating the boot img. It might need some touch from The Sickness.

You need to make a new .sh file or just delete all inside the current build_kernel.sh and paste this. Then write "sudo bash build_kernel.sh 920V" in terminal and it will do all the work

DEVICE=$1

make-config()
{
if [ "$DEVICE" = "920V" ]; then
echo "Make 920V defconfig"
make apq8084_sec_defconfig VARIANT_DEFCONFIG=apq8084_sec_trlte_vwz_defconfig SELINUX_DEFCONFIG=selinux_defconfig
fi
}

make-dtb()
{
if [ "$DEVICE" = "920V" ]; then
echo "Creating DTB"
tools/dtbtool -o dt.img -s 2048 -p scripts/dtc/arch/arm/boot/dts/
fi
}

make-boot()
{
if [ "$DEVICE" = "920V" ]; then
echo "Creating Boot image."
mkbootimg \
--kernel arch/arm/boot/Image \
--ramdisk ramdisk.packed \
--base 0x10000000 \
--pagesize 2048 \
--dt dt.img \
--ramdisk_offset 0x01000000 \
--tags_offset 0x00000100 \
--output boot.img
echo -n "SEANDROIDENFORCE" >> boot.img
tar -cvf boot.tar boot.img
fi
}

if [ "$DEVICE" = "920V" ]; then
export ARCH=arm

export PATH=/home/noxxx/arm-eabi-5.3:$PATH

export PATH=/home/noxxx/mkbootimg_tools:$PATH

export CROSS_COMPILE=/home/noxxx/arm-eabi-5.3/bin/arm-eabi-

make-config

make -j7 2>&1 |tee build.txt

rm arch/arm/boot/dts/*.dtb

make-dtb

make-boot
else
echo "Oops fail"
fi
[Galaxy S6 General] kevintm78:
SUCCESS

Thank you guys so much for all your help and to The Sickness for creating this thread. I never would have tried this if I hadn't came across this wealth of info. Ram121, I owe you one buddy, I am forever in your debt.
[Galaxy S6 General] !Led*Eyes!:
SM-G920T | Chose "y" for clean install | chose "c" for custom dt.img | I'm currently on the newest G920TUVS5EQA2 build, stock, rooted with cf-autoroot and TWRP.

Ok so as couple of things.. I was getting errors for undeclared items /f_conn_gadget.c: In function 'conn_gadget_ioctl':.. I did some googling and searched my repo for the undeclared items as suggested but ultimately came up short. I ended up copying the drivers/usb/gadget folder from Sickness' source to mine and everything compiled successfully. However that doesn't satisfy my want to know why. If anyone can clue me in or point me in the direction of some documentation i'd appreciate it. Thing 2: The kernel compiled successfully without error but when I tried to flash the zip I got the "Could not do normal boot: Invalid kernel length" error. Could this be due to changes I made in the updater-script after I compiled the kernel or more likely a compression error from when I re-zipped the kernel files?? Thanks guys.

EDIT: As it turns out the answer is neither.. I flashed the zip file from the output and same result... I guess I'll try choosing "s" fopr stock boot image.
[Galaxy S6 General] Noxxxious:
Some toolchains dont work out nice with certain files. Therefore some files need a small modification so the warning disappears. Like for 5.3 toolchain you need to fix testmgr file etc.

In your case check this https://github.com/geiti94/NEMESIS_KERNEL_N5/commit/bb285cdea02e69ff4baa522050d71a161ee21d8d

The f_conn_gadget ioctl.h file only

About that length i dunno why, I had it 2-3x due to a bad compilation (changing cflags from O2 to Ofast causes this for me for example) and then just recompiled it. Like The Sickness says you should always choose "s".
[Galaxy S6 General] The Sickness:
Use this commit to shorten the kernel length.

https://github.com/The-Sickness/S6-MM/commit/db25b414e1ad27f38d2eae829e727f4515fa06f8
[Galaxy S6 General] !Led*Eyes!:
Hell yes! Worked perfectly thanks man.
[Galaxy S6 General] The Sickness:
So I assume you have a working kernel now?
[Galaxy S6 General] !Led*Eyes!:
You would be absolutely correct in that assumption! Thanks again. Time to try and make some adjustments:cyclops:
[Galaxy S6 General] Maw2607:
Now i manage to make a kernel and manage a little bit the github command and rules, how do you monitor your kernel ? What applications do you use ? i try with adb but i can't manage to connect to my phone as i'm a noobs on archlinux... Do you have some recommendations ?
[Galaxy S6 General] Demicro:
What do you want to monitor?

I use gitkraken for github

Matlog for Android logcat
[Galaxy S6 General] spookcity138:
A noob and Arch Linux?! Come on these don't go together at all! [emoji2]

Seriously though, I'm not real sure what you mean. Kernel Adiutor is a great app though. Also,make sure you download the android udev package from yaourt and you should have no issues with your adb connection. At least I don't. I use arch as well.
[Galaxy S6 General] The Sickness:
Arch is all I use. And no, it's not for beginners. Actually I run Manjaro.....
[Galaxy S6 General] noob4598:
Love it. I've tried bout every distribution of Linux but none can compare to manjaro in my opinion.
[Galaxy S6 General] The Sickness:
Same here. I ran Xubuntu for a long time. Had issues with Mint.

But I did see a new Arch Black ( I think that's right) that I may look into. It's on Distrowatch.
[Galaxy S6 General] noob4598:
Arch damn sure ain't for beginners but if someone is wanting to learn arch or get the feel of it then Manjaro is the way to go. I run Manjaro KDE 16.10
[Galaxy S6 General] The Sickness:
XFCE here.
[Galaxy S6 General] Maw2607:
Thanks all for all your answer[emoji106] , I will try the udev from yaourt and the tools you talk.

I know that arch Linux is not for beginner as me but I find a tutorial for my laptop to dual boot with windows and finally I like it. My only problem with Linux is the exchange server support but now I prefer Linux environment.

Everything is the sickness fault because he gives me the desire to make my Own kernel and now I love Linux...[emoji12]
[Galaxy S6 General] spookcity138:
Agree with most everything that's been said here... Cept I still prefer Arch over Manjaro [emoji2]

Anyone new to Arch,or not new even, the Arch wiki is your friend. It is simply fantastic!

Congratulations on getting away from windows and seeing the light. hehe
[Galaxy S6 General] WILMANS2M:
Hello there,

Thanks for all explanations and informations here. Very useful.

I do not own an s6 but an s5neo and unfortunately there is no developer for this phone, that's why i am searching elsewhere.

I want to make a kernel for this phone. But as you know with samsung, it is not always as easy as it seems.

I am a newbie into linux world and building world lol. That's why i look into many github repo about kernel, read many articles here but....i have not resolve my problem. Asked help from Yank but he is not building kernel anymore (especially sammy one lol).

As i said, i have a galaxy s5 neo. My kernel source (arm64) here: https://github.com/ShedrockN4/SM-G903F

My problem is: Once i flash my kernel, my phone boots, got the logo and black screen. (nothing work except pulling out battery). Can't connect to adb...

Yank thought it was the dt img that i need to build myself. Did it, not work too.

And i see a strange thing. When i unpack the boot.img, i have a zimage (sick!?) size 16Mo. BUT my built image is only 12Mo. Do not understand why. Even if i use the standard defconfig, same size.

Please. Hope you will be able to help me to give a working kernel.

I really thank you in advance.
[Galaxy S6 General] The Sickness:
Take the stock boot.img and use mkboot to extract the ramdisk. Put your new Image in place of the one extracted. Repack it.

Try it that way.
[Galaxy S6 General] WILMANS2M:
Thank you for your answer. But that is the first thing i have done. And not working. The kernel img built from source is same size as the one extracted from stock bootimg for you ?

Envoyé de mon LG-H850 en utilisant Tapatalk
[Galaxy S6 General] The Sickness:
Not always. It can be different. But very little
[Galaxy S6 General] The Sickness:
Also, I would just build the source without any edits and see if it boots.

What commands are you using in your terminal to build?
[Galaxy S6 General] WILMANS2M:
well did it too. But same :(

Here are all the commands i use:

export ARCH=arm64

export CROSS_COMPILE= path to google tc

make exynos7580-s5neolte_defconfig => default defconfig

make -j2

Thanks.
[Galaxy S6 General] The Sickness:
Then unless I'm missing something. Your source has a problem. Which isn't unheard of with Sammy
[Galaxy S6 General] WILMANS2M:
:( tried with both MM source but no success. Standard s5 is ok as there are some custom kernel. So bad....But thanks for your answers.

Envoyé de mon LG-H850 en utilisant Tapatalk
[Galaxy S6 General] The Sickness:
Hence thats why I gave you credits. I dont remove anything.

And actually, I didnt get that script from your kernel on Github. I noticed the names when I first used it when I got it from another dev....
[Galaxy S6 General] UpInTheAir:
I never implied you removed anything, just that much of work and ideas I've used may be far modified from original. I leave their credit in place, and on occasion add it to the script.

You actually didn't give me any credit for the BUILD SCRIPTS . . Just for some patches/ commits.

Where ever you "obtained" them from is not the point I'm making here. So would appreciate if you also credit me for the scripts in OP.

Thanks
[Galaxy S6 General] Bajanman:
Well I added it to his OP, so you now have credit for you build scripts OK.:good::cool:

Thanks,

Bajanman
[Galaxy S6 General] Darktitor:
[MENTION=4861212]TheSickness[/MENTION] With this guide, can we build a kernel that will regornize the S7 3000MAh or S7 Edge 3700MAh battery ?

Thanks
[Galaxy S6 General] The Sickness:
That would be in the kernel source for the S7....so yes. On the S6 the stock source is the same for the Flat and the Edge. Should be the same for the S7.
[Galaxy S6 General] Darktitor:
So how can I do that ?

Thanks again
[Galaxy S6 General] Diaze:
Wow. Amazing guide m8
[Galaxy S6 General] s89281b:
Thank you very much for this guide. I keep getting a 404 file not found from one of the links found in this section "Now we need to get a couple more files. Download these files here. Open the zip and copy them to

your source. In another words just drop them in. Please note that the "output" folder contains empty folder for the G920T and G925T. IF you are building the G920F you need

to change the folder name. Thats very important. We will get more into the build_kernel.sh and env_setup.sh later."
[Galaxy S6 General] Maqical:
I have to say I was always a little bit afraid scared of Linux and all of it because it's so easy to mess things up even by a little text edit, but if anyone and I mean anyone even my dog follows this guide exactly how it is

its super easy to follow and understand I haven't got lost or confused much at all after reading it about 3 times then trying it on my own and if I had questions you answered them very quickly at that

I'm glad to begin my journey on taking over Twisted Kernel for the Tmobile Variant, Thanks Chris for the guide and all the help

Successful project built #1
[Galaxy S6 General] The Sickness:
I will fix that right now

EDIT: Its fixed
[Galaxy S6 General] jr866gooner:
Awesome in depth guide!!
[Galaxy S6 General] The Sickness:
Thank you
[Galaxy S6 General] javitolopez69:
Good post

Enviado desde mi SM-G920F mediante Tapatalk
[Galaxy S6 General] The Sickness:
So only one person built a kernel? I figured there would be a little more action here...

Oh, don't tell me it's too intimidating to do?
[Galaxy S6 General] s89281b:
I managed to successfully compile one for my G920T. Just a basic one following your guide. Now I hope to modify kernel for the N7 port to fix call audio for TMO phones. Thank you so much for sharing your knowledge and providing this tutorial.
[Galaxy S6 General] yash92duster:
[MENTION=4921688]The Sickness[/MENTION]

Thanks a lot for your awesome work :svetius:

I can easily understand the guide.

But

Can I use this guide to Build a kernel for my Galaxy S5 G900h? With your sources and download files?

I'm new to these stuff

Thanks in advance :)
[Galaxy S6 General] pawo99:
I tried to build one for G920F but it didn't booted. Probably I screwed up something :angel: :o I will try more when you finish guide to cherry picking commits :fingers-crossed: Thanks for this tutorial :good:
[Galaxy S6 General] The Sickness:
You can use the guide...but not the ramdisk.

I will have to explain how to get the ramdisk from the stock boot.img with mkboot when I have time
[Galaxy S6 General] pawo99:
Hi, Is it difficult to merge older PB8 sources from this repo: Adam-Kernel-GalaxyS6-G920F with DPG2 sources? :confused:

Could you show us how to do it, please? :angel:
[Galaxy S6 General] The Sickness:
Why merge them? Just get the newest kernel.tar and it will save you the time.....
[Galaxy S6 General] Maw2607:
Thanks to [MENTION=7065337]spookcity138[/MENTION] i manage to connect my phone with adb. Before i use another udev package that don't work on my archlinux.

Now i try to make custom dtb files with your script but i don't manage. With script from tkkg1994 i manage to make my own dtb files but i can't manage to adapt it to your build script that i prefer use.

Can someone help me ?
[Galaxy S6 General] The Sickness:
So do you see a dt.img generated in your source? The script will tell you when it's building it and or if one is found.
[Galaxy S6 General] Maw2607:
I don't see dt.img in my source.

I use the dtbTool in script and change the line in your script according to the doc but in terminal I have: "dtbTool: unable to locate any dtbs in the given path" or I have dts file in the given path....
[Galaxy S6 General] The Sickness:
OK, so how do you know if his script generates the .img?
[Galaxy S6 General] Maw2607:
Sorry, I don't understand your question.

With the tkkg1994 script I see a dt.img in ramdisk with the osm0sis tool that he use but with your script I have the error.
[Galaxy S6 General] The Sickness:
Then take the dt.img created by the script and use mkboot to repack it into your ramdisk
[Galaxy S6 General] Maw2607:
Yes that what I'm doing but as a good developer that I'm not, I'm lazy so I prefer have an all in one script but never mind.
[Galaxy S6 General] RealGalaxyLink:
I got this error, i'm trying to compiling for g920f :(:(

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) {

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
make[2]: *** Waiting for unfinished jobs....

scripts/Makefile.build:455: recipe for target 'drivers/usb' failed
make[1]: *** [drivers/usb] Error 2
make[1]: *** Waiting for unfinished jobs....

Makefile:902: recipe for target 'drivers' failed
make: *** [drivers] Error 2
[Galaxy S6 General] The Sickness:
Yep that's a good one. I'm not going to tell you how to fix it. I have given yall the tools to build. It's up to each of you to figure out your errors.

And yes, the error is fixable.
[Galaxy S6 General] RealGalaxyLink:
I'll try :highfive:
[Galaxy S6 General] Demicro:
The dt.img is generate in the output folder or in /arch/arm/boot/ or arch/arm64/boot

In my kernel the dtb is generate after the zimage

But in some case you need to add a script to generate it

tools/dtbTool -s 2048 -o out/arch/arm/boot/dt.img -p out/scripts/dtc/ out/arch/arm/boot/dts/ -v;

I change the output folder To keep the source code separate?

out/arch/arm/boot/dts/

The place where dts are generated

out/arch/arm/boot/dt.img

The place where the dtb image will be generated, joining all dts

---------- Post added at 01:37 AM ---------- Previous post was at 01:34 AM ----------

These function should be declared somewhere ?
[Galaxy S6 General] WILMANS2M:
Be careful on arm64 there is no zImage but Image and image.gz.

To build a dt image you need dtb files built from dts file (case on my SM G903F).

Envoyé de mon LG-H850 en utilisant Tapatalk
[Galaxy S6 General] RandomUsername02:
Does this guide still apply in March of 2017?
[Galaxy S6 General] DopeSick:
Of course. It was only written in July of last year.
[Galaxy S6 General] The Sickness:
Just some advice here......

If you cherry-pick someone's commit, make sure the credit goes to that author. Which means, don't add the commit manually and call it your own. I've seen countless commits that were made and the original author was left out.

I won't say who's repo's I looked at. It's more than one that I glanced over.
[Galaxy S6 General] kevintm78:
I have been curious about ramdisk patching that maybe someone could shed some light on. I've added several tweaks to my kernel (several governors, BFQ, MSM hotplug, etc) and if I manually add the SU patches to the ramdisk everything shows up in Kernel Adiutor. But if I let SU patch the ramdisk everything shows up except for the overclock. I did notice that the governors and BFQ didn't show up either way until I added them to the defconfig so maybe that's the answer but I'm not quite sure what line(s) to add. The only reason I would like to let SU do the patch is just because it takes away the red "kernel is not seandroid enforcing" message which seems to weird people out but if there's no way around so be it.

Kernel Source
[Galaxy S6 General] The Sickness:
There's another way around it....
[Galaxy S6 General] kevintm78:
Yeah I know I'm missing something. I'm going to double check to make sure it's even set right in the first place, I just assumed it was since it was showing up and hitting those freq according to KA and cpufreq info. Other than that I'm thinking that it's getting written (or overwritten) by an init file in the ramdisk and I think I've found a few possibilities. I'm really not expecting to someone to troubleshoot this fot me it just helps sometimes to talk this out and nobody in my house wants to hear about my kernel problems.:p I was just concerned that I was wasting my time looking for a solution that can't be found.
[Galaxy S6 General] Matt07211:
Just echo SEANDROIDENFORCING onto the end of the boot.img, that's what SuperSU scripts does
[Galaxy S6 General] kevintm78:
Oh, yeah I'll try that. I think I have other issues as well with the overclock not being set correctly. If I get part figured out I'm hoping that all this will be a moot point. Thanks for the input though, I'm hoping this thread will liven up a bit. It would be nice to learn with others and there's just not a whole lot of kernel talk on xda.
[Galaxy S6 General] Matt07211:
When you say, "overclock not being set correctly" are you saying it gets stuck in one frequencie? Cause I'm currently trying to figure out a problem related to frequencies. My problem is my kernels go up in frequencies due to the work load then are unable to go back down, thus being stuck in the highest frequency and drain High amounts of battery. Is your case the same or different?