yashsingh1/xdaforums huggingface dataset:
[Android Software/Hacking General [Developers Only]] nik600:
Dear all

i need to compile a specific module for a tablet running Android 4.4.2 with kernel 3.4.0+, what is the best way to download -exactly- the 3.4.0+ version?

Actually the https://android.googlesource.com/kernel/msm/+/android-4.4 cointains an updated version and the "tag" KOT49H doesn't cointain any source code, is right to browse all the git commit and checkout the exact revision related to commit 3.4.0?

For example i've done that:

and so i've downloaded 76e10d1

Is that the true procedure?

Thanks to all in advance!
[Android Software/Hacking General [Developers Only]] pozidrivphil:
Hi! First of all, thanks a lot for this guide. I'm in the process of compiling TWRP for my Samsung XCover4 (SM-G390F), it's been a real struggle and now I have to compile my kernel from source to fix some SELinux issues.

I followed your guide and another one, but I always get errors like this:

CC kernel/bounds.s
/home/theseus/aarch64-linux-android-4.9/bin/../libexec/gcc/aarch64-linux-android/4.9.x-sabermod/cc1: error while loading shared libraries: libmpfr.so.6: cannot open shared object file: No such file or directory
Kbuild:35: recipe for target 'kernel/bounds.s' failed
make[1]: *** [kernel/bounds.s] Error 1
Makefile:1028: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2

My makefile is the one that came with the stock kernel sources, nothing has been modified

(http://opensource.samsung.com/reception/receptionSub.do?method=sub&sub=F&searchValue=g390F)

I'm using aarch64-linux-android-4.9. I'd really appreciate some help, I've come this far already with compiling TWRP, else I've wasted an entire week :(

All the best, from Belgium!

EDIT:

Solved it following this guide, compiling right now:

Your library is a dynamic library. You need to tell the operating system where it can locate it at runtime.

To do so, we will need to do those easy steps:

(1 ) Find where the library is placed if you don't know it.

cd /

sudo find ./ | grep the_name_of_the_file.so

(2) Check for the existence of the dynamic library path environment variable(LD_LIBRARY_PATH)

$ echo $LD_LIBRARY_PATH

if there is nothing to be display we need to add the default path value (or not as you wich)

$ LD_LIBRARY_PATH=/usr/local/lib

(3) We add the desire path, export it and try the application.

Note that the path should be the directory where the path.so.something is. So if path.so.something is in /my_library/path.so.something it should be :

$ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/my_library/

$ export LD_LIBRARY_PATH

$ ./my_app

Should've googled harder before posting, but I'm sick and tired of these endless errors :p
[Android Software/Hacking General [Developers Only]] icrunchbanger:
Hi [MENTION=6842057]nathanchance[/MENTION].

Thanks for this tutorial.

I have a question though. I have managed to build kernel. Anyhow when i flash it /using anykernel2/ it seems very slugish as like i am missing something.

Im using google toolchain 4.9

I tried building a couple of kernels and result is the same.

Can you take a look at this script and tell me if im doing something wrong?

https://github.com/icrunchbanger/android/blob/master/build-kernel.sh

Thanks for your help :)
[Android Software/Hacking General [Developers Only]] macblaze:
I am Nooooob, But very interest to do things,

Please help me!

I have one main folder located in HOME called Lenovo

1. home/lenovo/platform/aarch64-linux-android-4.9 - where i installed toolchain from google

2. home/lenovo/kernel/arch/arm64/configs- here the device_defconfig (Kernel Source Folder)

Now, how do I write command to build the zImage

Please write the command for me to compile

Thanks in advance
[Android Software/Hacking General [Developers Only]] ViperXvenom8888:
Hello.

I'm receiving this error when I try to build a ROM and I'm not sure if it's kernel related: https://hastebin.com/opucinavib.pl

Can you help me fix it???

Thanks!
[Android Software/Hacking General [Developers Only]] icrunchbanger:
How much RAM do you have?
[Android Software/Hacking General [Developers Only]] Uzephi:
As above stated, how much ram do you have? Not enough, ninja wrapper error is when you have no more available RAM for the build.
[Android Software/Hacking General [Developers Only]] ViperXvenom8888:
I'm dual booting Windows 10 and Ubuntu 16.04.3 LTS

I have 8GB of RAM

---------- Post added at 04:18 AM ---------- Previous post was at 04:17 AM ----------

I'm dual booting Windows 10 and Ubuntu 16.04.3 LTS

I have 8GB of RAM
[Android Software/Hacking General [Developers Only]] Kaiyum:
Hey nathan and thanks for a guide that is (as you mentioned) really up-to-date! I ran into this thread at the very last minutes of me giving up on trying to build a stock j3nxlte LL kernel on ubuntu16.04 ....That was last night so i cam back just to give it another try..I would like to ask you a couple of things just to be sure im not starting off wrong in the first place...

I am having some package problems with ubuntu16 (lib32z2-1.0 and a few more) not having them in any repo..Would you recommend using 14/15 versions of it or Arch should cover the packages needed?

Also you covered my first mistake about the home folder compiling..I was using a sub /Android/Kerkel dir... Sould i delete it all and re-exctract the files in /home/Kernel /home/Platform respectively ?

The errors i got were about missing files while compiling (mind you im surprised it got to menuconfig)..

Are the steps you explain here sufficient for compiling arm-armeabi/LL ?
[Android Software/Hacking General [Developers Only]] Uzephi:
Okay, so I finally got anykernel to work. (been pulling apart the boot image and injecting the kernel, not user/ROM friendly). Both methods, AK (flashed in TWRP and Flashfire) or AIK (adb pulled my rooted boot image and replaced the zimage) with my kernel I lose root. Is there something I need to do to keep root for users that want it on my kernels?

Edit: this is still the Motorola Z2 Force kernel from earlier. Only changes so far to it have been upstream and adding the CTS bypass.
[Android Software/Hacking General [Developers Only]] mady51:
Hi,

Can i get any help for the below error - am trying to build lineage kernal 14.1 for Oneplus 3 device (arm64) using aarch64-linux-android-linaro-4.9. I got stuck at the below error.

In file included from drivers/net/ethernet/msm/rndis_ipa_trace.h:81:0,

from drivers/net/ethernet/msm/rndis_ipa.c:32:

include/trace/define_trace.h:83:43: fatal error: ./rndis_ipa_trace.h: No such file or directory

#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)

^

compilation terminated.

make[4]: *** [scripts/Makefile.build:258: drivers/net/ethernet/msm/rndis_ipa.o] Error 1

make[3]: *** [scripts/Makefile.build:402: drivers/net/ethernet/msm] Error 2

make[2]: *** [scripts/Makefile.build:402: drivers/net/ethernet] Error 2

make[1]: *** [scripts/Makefile.build:402: drivers/net] Error 2

make: *** [Makefile:942: drivers] Error 2

make: *** Waiting for unfinished jobs....
[Android Software/Hacking General [Developers Only]] Uzephi:
Try building with "make O=out -j$(nproc --all)" command. I had off syntax errors with file links until adding the O=out
[Android Software/Hacking General [Developers Only]] EncryptedCurse:
Edit: Resolved.
[Android Software/Hacking General [Developers Only]] King smus:
please help me this is between live and death. I bought a coolpad 8715 but the android version doesn't work with Playstore and everything about it is in Chinese, I try to change the language to English but the apps are still written in China. please how can I install another OS on it that support Playstore. I downloaded the firmware ( 8715_4.4.016.P1.8715.CPB ) which is in CPB format and i try to extract it to change application and some settings, after extraction I found some files but I don't know which one to edit or how to. The help I needed is that, how to edit my firmware .....CPB file after extraction and pack it back as .......CPB file so that I can use it to flash my coolpad 8715. Or is their any OS or ROM I can use like KitKat, lollipop, marshmallow miui etc. I try to update the phone with wireless hotspot, not working. I also try to install KitKat 4.4.2 Custom ROM through the phone recovery mode which is in China, but showing verification failed and signature error. please help me what can I do, am ready to take any ricks.
[Android Software/Hacking General [Developers Only]] kereng77:
Hi everyone,

Has anone succeeded in actually compiling and flashing GKI kernel on Android 14 phones? I have tried to do so for my Oneplus 12 and stuck in boot loop. I did not change anything in the code, just compile and flash. I have checked forums for OP12 and other Android 14 phones and found no custom kernels for any phone.

Any ideas?
[Android Software/Hacking General [Developers Only]] Sands207:
You are posting in a kernel compiling thread. Please move your question to the appropriate sub forum.
[Android Software/Hacking General [Developers Only]] aymanz:
Hello to everyone, i had a doubt when i compiling. I just clone git and compile without any mod with x86 compiler from android-studio, i do the make and can create the vmlinux.bin and bzImage (arch/x86/boot) and now i can't make the img file to write :( (i'm thinking... maybe bzImage is the kernel but i can flash only this ? how ?) if possible someone can help me ? Thanks !
[Android Software/Hacking General [Developers Only]] Uzephi:
You have to add the kernel to a boot image (AIK in op) or use a flashable zip (via anykernel in op) to put the kernel on an Android device.
[Android Software/Hacking General [Developers Only]] iissmart:
I'm trying to compile the wahoo kernel for a Pixel 2 but I'm running into an issue. I have a workflow that compiles the marlin kernel for OG Pixel/Pixel XL devices successfully. The only change I made to this workflow was to add the dtc tools as explained in this post. The wahoo kernel compiles successfully, but when I boot from it the touchscreen is completely unresponsive. Power button turns the screen on and off, volume buttons work, but I can't register a single touch or tap at all. I'm stuck at the "PIN required after reboot" screen. Nothing obvious in the logcat either. Any thoughts as to what I could be doing wrong?
[Android Software/Hacking General [Developers Only]] Uzephi:
Wait... You're building from a Marlin to a Wahoo? Marlin is 3.18.y while the Wahoo is 4.4.y I am surprised it even booted... Have you tried just building from Google source for your Wahoo without any changes?

Marlin from Matthew Dalex makefile: https://github.com/matthewdalex/marlin/blob/oreo/Makefile (shows version info)

Wahoo from Matthew Dale's makefile: https://github.com/matthewdalex/wahoo/blob/master/Makefile
[Android Software/Hacking General [Developers Only]] iissmart:
Sorry I should have been more clear, I clone from a tag from here at the start so it's a fresh copy of the source each time. I'm cloning from android-8.0.0_r0.28 for the Pixel 2 kernel.
[Android Software/Hacking General [Developers Only]] nathanchance:
https://github.com/nathanchance/pixel2-manifest

You need to inline your touchscreen drivers (change all "=m" to "=y" in the defconfig if they don't mention battery). I'll add that to the manifest info soon.
[Android Software/Hacking General [Developers Only]] Dr_DjEnder:
Hey guys just got a new phone the LG v20 us966 (us cellular if it makes a difference) and I got lineage working and thats great but I wanna upstream the kernel

I just fixed a bunch of errors (only happening on standalone compile) one being some firmware relating to the touch screen firmware and when I flashed it the touch screen wouldn't work flashed a back up boot img and it works again

commit in question:

https://github.com/Devoark/android_...mmit/0cb5b781461744c0fc46c62fa579fcabdeae58cc

I wanted to see if anyone knows how to fix it? it only happens when complied standalone, the alternative is to upstream the kernel in the rom but the compile for that would take forever...

my repo:

https://github.com/Devoark/android_kernel_lge_msm8996

specifically the cm-14.1s branch

edit: after re-reading op i made a out dir and it compiled properly and after flashing the screen works now.
[Android Software/Hacking General [Developers Only]] JulienThomas:
Good afternoon.

I am trying to compile android-msm-bullhead-3.10-oreo-r4.

However, it seems there is a mismatch on the LINUX_VERSION_CODE as I get for instance the error

error: too few arguments to function 'cfg80211_put_bss'

cfg80211_put_bss(

caused by

cfg80211_put_bss(

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) || defined(WITH_BACKPORTS)

pHddCtx->wiphy,

#endif

bss);

I see on the defined variable that we have

include/generated/uapi/linux/version.h:#define LINUX_VERSION_CODE 199241

include/linux/version.h:#define LINUX_VERSION_CODE 197632

why do I get two different LINUX_VERSION_CODE and could that be the reason?

I followed standard procedure, that is

export CC=$(pwd)/aarch64-linux-android-4.9/bin/aarch64-linux-android-

export ARCH=arm64

export SUBARCH=arm64

export CROSS_COMPILE=$(pwd)/aarch64-linux-android-4.9/bin/aarch64-linux-android-

cd msm

git checkout origin/android-msm-bullhead-3.10-oreo-r4 (or r6)

make bullhead_defconfig
[Android Software/Hacking General [Developers Only]] janjan:
Thank you so much. Very useful info.
[Android Software/Hacking General [Developers Only]] nathanchance:
1. Where is your source so I can take a look?

2. Get rid of the eng.stk commit, it straight up is not necessary. You will instead just use

git clean -fxd
make O=out <defconfig>
make O=out -j(nproc --all)

to build the kernel. Then once you have built successfully once, you will just need to replace the git clean -fxd with rm -rf out.
[Android Software/Hacking General [Developers Only]] iissmart:
I'm confused on what needs to be done to flash a kernel on the Pixel 2 XL. On the Pixel 2 (non-XL) and Pixel 1 (both XL and non-XL) I could "fastboot flash kernel <kernel file>" which was the Image.lz4-dtb file from the compile. But that gives a "No such partition" error in fastboot when attempting to flash. Is there something else/different I need to do for the Pixel 2 XL?
[Android Software/Hacking General [Developers Only]] nathanchance:
Yes, you either need to make a boot image or use AnyKernel.

My minimal manifest will go over this: https://github.com/nathanchance/pixel2-manifest
[Android Software/Hacking General [Developers Only]] iissmart:
Dang, I was hoping to avoid making a boot image. I don't have enough RAM in my build machine to complete the "make bootimage" step.

I suppose I could just extract the boot.img from the factory image and replace the kernel that way, but I don't see an easy way to automate that for monthly releases.

Not a complaint to you obviously, but it is annoying that they don't have a kernel partition on the Pixel 2 XL...
[Android Software/Hacking General [Developers Only]] nathanchance:
You could use Android Image Kitchen to do that for sure. Trust me, I was extremely annoyed the first day I got the device...
[Android Software/Hacking General [Developers Only]] laperry1:
[MENTION=6842057]nathanchance[/MENTION]

thanks again for your help, i think i found the source of my error - an errant 'include $(srctree)/arch/$(SRCARCH)/Makefile' - in my makefile...

i started from scratch & included the 'boot' commit (manually applied the 'unreachable switch' commit to test)...

followed the steps:

git clean -fxd

make O=out <defconfig>

make O=out -j(nproc --all)

zipped via AnyKernel2 ...still failed to boot though...

here's my source: https://github.com/laperry1/android_kernel_oneplus_msm8996/tree/cm-14.1-dev-sa
[Android Software/Hacking General [Developers Only]] Louis1977:
Help...

1-git clone https://github.com/MotorolaMobilityLLC/kernel-msm -b marshmallow-6.0.1-release-clark

2-cd kernel-msm

3-mkdir out

4-export CROSS_COMPILE=$(pwd)/aarch64-linux-android-4.9/bin/aarch64-linux-android-

5-export ARCH=arm64 && export SUBARCH=arm64

6-make clean

7-make mrproper

8-make msm8994_defconfig

https://pastebin.com/w8yHA9Z1
[Android Software/Hacking General [Developers Only]] nathanchance:
I've highlighted part of the problem in red.

Please read the instructions a little more carefully, as your step 4 is probably wrong too since I doubt your toolchain is in the kernel directory.
[Android Software/Hacking General [Developers Only]] yulian6766:
Could you explain to cross compile a driver module? thanks.
[Android Software/Hacking General [Developers Only]] Nurujjamanpollob:
Thanks you soo much sir for help us kernel things......i halped alot from you,will write a kernel for my devices, i will take ur help if i'm mistaken some steps?

Helped alot sir
[Android Software/Hacking General [Developers Only]] zainifame:
Sorry, does anyone know how to extract kernel tarball contain linux permission and symlink file or folder on internal/local android storage? I've extracted kernel from lenovo oss but I've problem with loosing actual permission and symlink from compressed kernel oem provide, thanks
[Android Software/Hacking General [Developers Only]] nikkali25:
What is the difference of this two

arm-eabi-4.8

And

arm-linux-androideabi-4.9

Because icant fjnd arm-eabi-4.9
[Android Software/Hacking General [Developers Only]] kevintm78:
This is the one I used for arm-eabi-4.9.
[Android Software/Hacking General [Developers Only]] nikkali25:
Thanks
[Android Software/Hacking General [Developers Only]] Ani96:
How can I under-volt my kernel . ? Where I can find that script in kernel source? Thanks. .in adv
[Android Software/Hacking General [Developers Only]] Uzephi:
That really depends. Also if you have to ask, you probably shouldn't attempt it.

E.G. my device's dtsi for voltages and clocks are at " arch/arm/boot/dts/qcom/msm8998-v2.dtsi" If you don't have a pixel 2, 2 XL, OP5 or Z2 force, do not edit that file, it'd be useless. Each chipset uses a different dtsi file.
[Android Software/Hacking General [Developers Only]] NepoRood:
Awesome, built my first "stand alone" kernel! And it Boots! Woot, Woot! :good:
[Android Software/Hacking General [Developers Only]] hightech316:
Great write up!

I've followed the steps and attempted to compile for galaxy j7 exynos 7580 kernel.

Ran into some errors, ended up getting past them to only another! Now I understand why you must have patience!

The latest error is,

Which seems like an issues with my toolchain?

I'm sure Ill get past by going through defconfig and checking vdso?

Thanks for this reference, it was very helpful .
[Android Software/Hacking General [Developers Only]] Ani96:
How I can add TTL target patch in my kernel? Thanks
[Android Software/Hacking General [Developers Only]] metalmouth:
i was expecting using my device config it will compile flawlessly out of the box but it always stop at the "drivers" part lol
[Android Software/Hacking General [Developers Only]] DSA:
with what error?
[Android Software/Hacking General [Developers Only]] metalmouth:
sorry i didn't take a screenshot but it stopped at something about missing trace header in rndis. i was able to fix it but gave me more error still regarding rndis. so i gave up ?
[Android Software/Hacking General [Developers Only]] logan71f100:
need a little help

trying to compile nexus 6 for android 8.0 using https://github.com/AICP/kernel_moto_shamu/tree/o8.0

i used the google toolchain as stated because up streaming needs patchs, and id like to upstream but im not that good. i get this after i run make:

/home/logan/android_kernel_moto_shamu/scripts/gcc-version.sh: line 25: /home/logan/arm-eabi-4.8gcc: No such file or directory

/home/logan/android_kernel_moto_shamu/scripts/gcc-version.sh: line 26: /home/logan/arm-eabi-4.8gcc: No such file or directory

i did exactly like ZawZaw did

--------------------------------------------------------------------------------------

export CROSS_COMPILE=${HOME}/arm-eabi-4.8

export ARCH=arm && export SUBARCH=arm

make clean && make mrproper

---------------------------------------------------------------------------------------

everything seems to be in the right location and named the correct stuff

https://ibb.co/nvLKsR

my goal is to enable over clocking by modifying the frequency configs, if this cannot be done please let me know.... i haven't found any 8.0 kernels for shamu yet.... please enlighten me
[Android Software/Hacking General [Developers Only]] nathanchance:
I've highlighted the error in red
[Android Software/Hacking General [Developers Only]] logan71f100:
thank you that allowed make to work, the only documentation on adding frequency at a kernel level iv found is from 2014 for an acer and this kernel doesn't have the cpu frequency configs that i was looking for, could you tell me what im looking for? iv been poking around in the arch/arm but no luck
[Android Software/Hacking General [Developers Only]] nathanchance:
This? https://github.com/flar2/shamu/commit/eb8d56044571a4e597e7665aef1edcc4e2c1bd95
[Android Software/Hacking General [Developers Only]] logan71f100:
i was looking at this https://www.youtube.com/watch?v=lBYRLc5GKAI

but what you sent is way better, do you think i would be able to pull that whole file out of a kernel like elementalx? i used that kernel for some time and voltages where perfect.

https://github.com/flar2/shamu/blob/ElementalX-5.00/arch/arm/boot/dts/qcom/apq8084.dtsi

comparing this one to the one from your link i know elementalx allows for a 3.0 ghz overclock but it may be applying it in ramdisk.... do you think if i add a frequency in the current and frequency list for each cpu that it would use it?
[Android Software/Hacking General [Developers Only]] nathanchance:
git fetch https://github.com/flar2/shamu ElementalX-5.00
git cherry-pick eb8d56044571a4e597e7665aef1edcc4e2c1bd95

That's the proper way to add the change from one kernel to another.

git fetch <repo_url> <branch_name>
git cherry-pick <commit_hash>
[Android Software/Hacking General [Developers Only]] Qiangong2:
I have been trying to build a kernel for my mediatek device for a while now. I was given an incomplete kernel source and now it does not build when I use "make zImage".

It always gets stuck at xt_TCPMSS.c with this error:

net/netfilter/xt_TCPMSS.c: In function 'tcpmss_mt':
net/netfilter/xt_TCPMSS.c:64:26: error: dereferencing pointer to incomplete type
return (mssval >= info->mss_min &&
^
net/netfilter/xt_TCPMSS.c:65:19: error: dereferencing pointer to incomplete type
mssval <= info->mss_max) ^ info->invert;
^
net/netfilter/xt_TCPMSS.c:65:36: error: dereferencing pointer to incomplete type
mssval <= info->mss_max) ^ info->invert;
^
net/netfilter/xt_TCPMSS.c:73:13: error: dereferencing pointer to incomplete type
return info->invert;
^
net/netfilter/xt_TCPMSS.c: At top level:
net/netfilter/xt_TCPMSS.c:85:23: error: invalid application of 'sizeof' to incomplete type 'struct xt_tcpmss_match_info'
.matchsize = sizeof(struct xt_tcpmss_match_info),
^
net/netfilter/xt_TCPMSS.c:93:23: error: invalid application of 'sizeof' to incomplete type 'struct xt_tcpmss_match_info'
.matchsize = sizeof(struct xt_tcpmss_match_info),
^
scripts/Makefile.build:257: recipe for target 'net/netfilter/xt_TCPMSS.o' failed

There are no other errors.

Here is my kernel source (due to issues with travis-ci, the true stock branch is stock2 and dev is "stock"): https://github.com/Qiangong2/android_kernel_blu_d790q

I'm worried that just copying the xt_TCPMSS.c file from another MT6580 device may brick my device. That is why I have not tried that yet.
[Android Software/Hacking General [Developers Only]] ordinarykid23:
Nathan I followed your steps and I succeeded on building my kernel and making the zip file. My problem now is I cant flash it, I keep getting errors. I tried to tar it and other methods but they are not working.
[Android Software/Hacking General [Developers Only]] metalmouth:
just got lucky today :D i had compile my kernel successfully its for Asus Zenfone 3 (snapdragon). I used AIK for unpacking and repacking unfortunately after flashing the image it doesn't boot :D it just redirects me to fastboot mode.