yashsingh1/xdaforums huggingface dataset:
[Android Software/Hacking General [Developers Only]] tripLr:
Let me know if I can help.

What build script are you using?

I am with the lineageOS 15 thread

And would like to help test and build with you.

Are you using any specific build thread?

The method you are using will build the whole ROM, and while this thread is only for the kernel portion.

I have a note 4 Verizon.

Pm me so we can. Work out by chat group or email.

Thanks. I would like to side by side duplicate your efforts on my 64 core server. It might save some time. ;)

---------- Post added at 11:53 PM ---------- Previous post was at 11:30 PM ----------

I have been building kernels for amd/Intel 64 bit servers.

Using kernel.org sources

And kernelnoob build methods.

All Linux kernels have a source tree for the version

A tree for the CPU core

Amd64 intel 64 arm6 arm 7 etc..

Then there are code for the motherboard chipsets for things like the memory controller, PCI bus, and all the other IO busses. These can be compiled with the kernel, or loaded as a module. The module is a small compiled piece of code, that is run by the kernel when needed, then when not needed , unloaded from memory

For almost every motherboard from the 386 to today's multi core xenon, someone released open source drivers for each chip or function. Or someone in the Linux world, wrote a driver and posted it at kernel.org or Linus Torvaldis wrote code for it.

Video cards network cards, modems etc, all these manufacturing companies either released a Linux driver, or someone made it.

Enter Google, buying Android, a GUI running on a Linux kernel.

Enter a smartphone manufacturing or chipset company, they buy chipsets or build their own, build a testbed for the smartphone, and release source code only to developers .

So the kernel source, has to be open source per the rules, but the drivers don't. So they drag their feet releasing the kernel source code , sometimes years later.

Security updates to the kernel are released daily as are bug fixes. But we usually get stuck with a real old kernel version because of Blobs

So now we have blobs. Bits of propritary code that the open source kernel can talk to. That are pre compiled machine code.

Fortunately, Linus provided an option for including pre compiled drivers . The kernel compiler just needs a list to include them.

But this makes it hard to build an updated kernel as well as a ROM. Thus all the XDA threads
[Android Software/Hacking General [Developers Only]] mmsdc_mi:
I followed the guide in Google's site and it didn't mention any build scripts except lunch command.. This is the error that I am getting..failed:/sepolicy/non_platpolicy.cil and syntax error in another file called atfwd.te

I'll add the screenshots

Links for screenshots:

https://drive.google.com/file/u/0/d/117R0YvjnkXQS1FPu5qDXUJGtmlP2DYVg/view?usp=drive_web

https://drive.google.com/file/u/0/d/1AhDj5fNF0X3bjURxCLPpRmSamhxP51Zv/view?usp=drive_web

Any help would be appreciated.
[Android Software/Hacking General [Developers Only]] HellBladePlay:
Hi, I compiled the kernel without errors, but with the firmware the phone hangs on the manufacturer's logo (which is up to bootanimation).

The kernel sources are taken from the description of the firmware and the kernel version corresponds to the version of android

Performed actions:

After compilation, I got 3 files: image, image.gz and image.gz-dtb on arch/arm64/boot, downloaded and unpacked android image kitchen, pulled boot.img from my rom (lineageos 15.1), and unpacked it with command

./unpackimg.sh

then copied the previously obtained image.gz-dtb to the split_img folder and renamed it into boot.img-zImage and repacked with the command

./repackimg.sh

connected the phone in bootloader mode and entered

sudo fastboot flash boot image-new.img

all passed without errors, but the phone does not turn on, while the boot.img of the firmware is successfully installed, unpacked and back packed, also successfully installed.

I beg you to help, thank you in advance :angel:

P.S. sorry for google translator
[Android Software/Hacking General [Developers Only]] Uzephi:
Link to the source you're building from please or none of us can help you.
[Android Software/Hacking General [Developers Only]] HellBladePlay:
github com /LineageOS/android_kernel_leeco_msm8996
[Android Software/Hacking General [Developers Only]] Uzephi:
Which branch are you building and the defconfig you're using?
[Android Software/Hacking General [Developers Only]] HellBladePlay:
I'm new to this and I do not quite understand, I did everything in this order

sudo apt install build-essential libncurses5-dev bzip2 git
git clone https://github.com/carbonrom/android_kernel_leeco_msm8996
cd android_kernel_leeco_msm8996
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9 -b oreo-release toolchain64
export ARCH=arm64
export SUBARCH=arm64
export CROSS_COMPILE=`pwd`/toolchain64/bin/aarch64-linux-android-
make clean
make lineage_x2_defconfig
make menuconfig
make
[Android Software/Hacking General [Developers Only]] Uzephi:
I see one issue. You claimed using the lineage source for lineage ROM but your terminal commands show you cloning carbon's kernel. It is best to stick to the ROM developer's kernel. Example: LOS and DU for my device have different kernel branches and for awhile there my kernel stayed in line with DU due to easy sync with linux-stable. It broke WiFi for both AOSiP and LOS until they updated to the CAF WiFi updates. Please try cloning from Lineage's instead of Carbon
[Android Software/Hacking General [Developers Only]] HellBladePlay:
I tried both, and this is the first attempt, then I started using the same commands with

git clone https://github.com/LineageOS/android_kernel_leeco_msm8996
[Android Software/Hacking General [Developers Only]] DsturbD:
ok, first attempt at this, trying a moto nash stock kernel, i cloned this https://github.com/MotorolaMobilityLLC/kernel-msm/tree/oreo-8.0.0-release-nash and this google cross compiler https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/ and followed the prompts from the OP, however i was not certain on which directory to run some of the commands.

under the 3rd section "compile the kernel" i'm pretty sure i did the compiler right and the export commands right, and when i did the make commands i did those from the root of the kernel source.

it ran for just a bit then just stopped. here is the entire output, not sure what im missing

https://pastebin.com/j1ZwfQDG
[Android Software/Hacking General [Developers Only]] Uzephi:
Did you specify O="foldernamehere" needs to be capital O. That specifies an out folder
[Android Software/Hacking General [Developers Only]] DsturbD:
what command do i add that to? i tried all of them as in the OP, then was getting errors and told to do a make mrproper, so did that, and then ran through the commands again

make clean

make mrproper

make msm--perf_defconfig (not sure this is correct though as i get errors)

HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
SHIPPED scripts/kconfig/zconf.tab.c
SHIPPED scripts/kconfig/zconf.lex.c
SHIPPED scripts/kconfig/zconf.hash.c
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
warning: (SND_SOC_MSM8996) selects SND_SOC_MODS_CODEC_SHIM which has unmet direct dependencies (SOUND && !M68K && !UML && SND && SND_SOC && MODS_CODEC_BUS)
warning: (SND_SOC_QDSP6V2) selects SND_SOC_MSM_QDSP6V2_INTF which has unmet direct dependencies (SOUND && !M68K && !UML && SND && SND_SOC && MSM_QDSP6_APRV2_GLINK)
warning: (SND_SOC_QDSP6V2) selects SND_SOC_MSM_QDSP6V2_INTF which has unmet direct dependencies (SOUND && !M68K && !UML && SND && SND_SOC && MSM_QDSP6_APRV2_GLINK)
warning: (SND_SOC_MSM8996) selects SND_SOC_MODS_CODEC_SHIM which has unmet direct dependencies (SOUND && !M68K && !UML && SND && SND_SOC && MODS_CODEC_BUS)
#
# configuration written to .config
#

then

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

and get this output

make[1]: Entering directory '/home/jerry/dev/anthem/out'
GEN ./Makefile
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
scripts/kconfig/conf --silentoldconfig Kconfig
***
*** Configuration file ".config" not found!
***
*** Please run some configurator (e.g. "make oldconfig" or
*** "make menuconfig" or "make xconfig").
***
../scripts/kconfig/Makefile:40: recipe for target 'silentoldconfig' failed
make[3]: *** [silentoldconfig] Error 1
../Makefile:546: recipe for target 'silentoldconfig' failed
make[2]: *** [silentoldconfig] Error 2
make[1]: *** No rule to make target 'include/config/auto.conf', needed by 'include/config/kernel.release'. Stop.
make[1]: Leaving directory '/home/jerry/dev/anthem/out'
Makefile:150: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2
[Android Software/Hacking General [Developers Only]] Uzephi:
All commands with make will get O=out
[Android Software/Hacking General [Developers Only]] MeguminBOT:
Hello and thank you for the excellent instructions, I successfully managed to build my kernel from source without modifications on the 2nd try and it booted without any problems. I also made a buildscript which worked flawlessly aswell.

However, now I'm trying to add a CPU Governor but with no success so far, I've searched around a bit and tried some stuff but no luck. So now here I am hoping that someone could give me some advice on how I should solve this problem (If it's appropiate to post here that is, if it isn't then I'll delete this)

Some links that might help when assisting me:

Github - Kernel Source (The build script I made is there aswell: "cheryl_buildscript.sh")

Pastebin - Full copy+paste from my terminal

NOTE: The github repo has a different folder name than the one in the pastebin, same goes for the buildscript, but they're exactly the same and working (without the added governor that is.)

I've put TL;DR of the error code in this spoilerbox.

Here is the first error, it's at line 1425-1433. I also included line 1422-1424. (from the pastebin)

Like the error below says, there is no "lcd_notify.h" file. I've looked in "cpufreq_zzmoove.o" and it calls for "lcd_notify.h", so I went to google and looked at the kernel source for a different device that has "lcd_notify.h" just to try to examine/understand what it does. I'm pretty sure zzmoove governor calls for that file to adjust cpu frequencies for screen on and screen off.

CC drivers/acpi/acpica/utownerid.o
CC drivers/cpufreq/cpufreq_zzmoove.o
CC drivers/clk/msm/mdss/mdss-dsi-pll-8998.o
../drivers/cpufreq/cpufreq_zzmoove.c:39:30: fatal error: linux/lcd_notify.h: No such file or directory
#include <linux/lcd_notify.h>
^
compilation terminated.
../scripts/Makefile.build:263: recipe for target 'drivers/cpufreq/cpufreq_zzmoove.o' failed
make[3]: *** [drivers/cpufreq/cpufreq_zzmoove.o] Error 1
../scripts/Makefile.build:408: recipe for target 'drivers/cpufreq' failed
make[2]: *** [drivers/cpufreq] Error 2
make[2]: *** Waiting for unfinished jobs....

Here is the second error @ line 1481-1483. I also included line 1478-1480. (from the pastebin)

LD drivers/acpi/acpi.o
LD drivers/acpi/processor.o
LD drivers/acpi/built-in.o
/home/meguminbot/android/kernel/razer_kernel/Makefile:966: recipe for target 'drivers' failed
make[1]: *** [drivers] Error 2
make[1]: *** Waiting for unfinished jobs....

Here is the last one and the build stops @ line 2054-2057. (from the pastebin)

make[1]: Leaving directory '/home/meguminbot/android/kernel/razer_kernel/out'
Makefile:150: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2
meguminbot@Ubuntu-VirtualBox:~/android/kernel/razer_kernel$

If I can provide with any other info, just tell me and I'll get it for you.

Thanks in advance.
[Android Software/Hacking General [Developers Only]] ProttoyX:
Any guides to customise/add features? I am totally a newbe here!
[Android Software/Hacking General [Developers Only]] Rawwrius01:
I try to build samsung stock kernel on Ubuntu. Im using the stock google toolchain (also tried uber 4.9) and everytime i got a makefile error at the compiling process. Nothing was changed just stock samsung kernel source. any ideas ? (sorry its in german im setting up a new build enviorment and will keep the english language and post the error again if its needed).

LD vmlinux

SORTEX vmlinux

SYSMAP System.map

Building modules, stage 2.

OBJCOPY arch/arm64/boot/Image

MODPOST 1 modules

GZIP arch/arm64/boot/Image.gz

CC crypto/ansi_cprng.mod.o

LD [M] crypto/ansi_cprng.ko

scripts/Makefile.fwinst:43: Das Ziel „/lib/firmware/melfas_tk/mhs2041_j5y17.fw“ steht mehrfach in derselben Regel.

scripts/Makefile.fwinst:43: Das Ziel „/lib/firmware/melfas_tk/mhs2041_j7y17.fw“ steht mehrfach in derselben Regel.

android@builduntuvm:~/galaxy-tab-a-kernel-n$
[Android Software/Hacking General [Developers Only]] mkgrage:
Hi, I would compile my existing lineage 15.1 kernel, using toolchain arm-linux-androideabi-4.9, but shows error like below:

make apq8084_sec_lentislte_skt_defconfig # existing kernel

HOSTCC scripts/basic/fixdep

HOSTCC scripts/kconfig/conf.o

SHIPPED scripts/kconfig/zconf.tab.c

SHIPPED scripts/kconfig/zconf.lex.c

SHIPPED scripts/kconfig/zconf.hash.c

HOSTCC scripts/kconfig/zconf.tab.o

HOSTLD scripts/kconfig/conf

arch/arm/configs/apq8084_sec_lentislte_skt_defconfig:112:warning: override: reassigning to symbol LEDS_MAX77828

KCONFIG_SELINUX((null))

KCONFIG_LOG_SELINUX((null))

KCONFIG_TIMA((null))

KCONFIG_DMVERITY((null))

KCONFIG_VARIANT((null))

***

*** You must specify VARIANT_DEFCONFIG !

***

/home/kernel/scripts/kconfig/Makefile:130: recipe for target 'apq8084_sec_lentislte_skt_defconfig' failed

make[1]: *** [apq8084_sec_lentislte_skt_defconfig] Error 1

Makefile:514: recipe for target 'apq8084_sec_lentislte_skt_defconfig' failed

make: *** [apq8084_sec_lentislte_skt_defconfig] Error 2

Any suggest to resolve those problem?

Thank you
[Android Software/Hacking General [Developers Only]] ProttoyX:
That's the problem! You need to use device specific DEFCONFIG, and not the generic one for the SOC!

NOT SURE THOUGH! NEEDS CONFIRMATION FROM EXPERTS!
[Android Software/Hacking General [Developers Only]] HesThatGuy:
I'm in a bit of a situation and need some help.

I'm currently using the android-msm-marlin-3.18-p-preview-4 branch and when compiling a kernel everything works fine until my terminal outputs:

In file included from arch/arm64/kernel/signal.c:36:0:
./arch/arm64/include/asm/vdso.h:30:36: fatal error: generated/vdso-offsets.h: no such file or directory
#include <generated/vdso-offsets.h>
^

and the compilation stops. Looking at your Pixel kernel sources [MENTION=6842057]nathanchance[/MENTION] I see that the files that are giving me trouble are untouched/stock, so I'm not sure what exactly the issue is.
[Android Software/Hacking General [Developers Only]] Er. Aditya:
hi sir i am getting this error
[Android Software/Hacking General [Developers Only]] Rawwrius01:
Hey, i got my Samsung stock kernel comliled with the 64 bit Google toolchain. My tablet is booting as well but i cant get wifi working. I was reading over a week for solutions but nothing was working. For example putting the WiFi ko module from the compiled kernel in the lib/module folder of the ramdisk. After that the WiFi was "working" but when I'm turning the WiFi off I can't turn it back on. Some people said that the problem is the WiFi ko module. It isn't compatible with the firmware ones, because its compiled with another toolchain.

I hope you can understand my problem [emoji28]

Did anyone know a solution ?

My goal is to get a working stock kernel which I can upstream and share it here on xda.

Thanks.

Gesendet von meinem ONEPLUS A3003 mit Tapatalk
[Android Software/Hacking General [Developers Only]] jesan9:
error compiling kernel nexus 5

hi, i need some help... im trying to build ElementalX kernel for the nexus 5, i got the source and the cross compiler and all that, but when it is compiling this error appears and it stops... i looked to the file.c and is fine and has been like this from 3 versions before (current 9.0) and i dont know what else to try
[Android Software/Hacking General [Developers Only]] nathanchance:
Which version of GCC are you using?
[Android Software/Hacking General [Developers Only]] jesan9:
Im using the on from the OP for arm 32bit, arm-eabi-4.8

and also tried arm-linux-androideabi-4.9

and same errors :S
[Android Software/Hacking General [Developers Only]] nathanchance:
My advice is to just nuke the GCC wrapper, like this: https://github.com/sonyxperiadev/kernel/commit/eef45de9123998194023cc79a8889aba4de4e072
[Android Software/Hacking General [Developers Only]] jesan9:
ok now i see, i was thinking to do that but i was not quite sure how to, now i know... ill do that and let you know, :) THX!

EDIT: it kinda worked but i got another 3 or 4 errors, im done, ill wait for someone to build with the new commits for the video glitch. Thx for you help anyways, i learned a lot! :)
[Android Software/Hacking General [Developers Only]] sunny_deed:
thanks for the awesome guide im stuck here little help

!noob alert! ive nver done anything more than flashind things that someone have made

Ive followed along with your tutorial,the compilaing has started abd run for about 15 mins and the at the end there was a make file error 2, 'sub-make' failed

fyi i was trying to build a kernel for honor 9 lite arm 64 thanks for the help:)

and aslo i was using google lastest toolchain
[Android Software/Hacking General [Developers Only]] Uzephi:
Link to source, toolchain, and the last 25 lines of terminal please. Error 2 specifies just the file that errored out. We need the error before it to help out. Also the commands you entered might shed some light as well.
[Android Software/Hacking General [Developers Only]] sunny_deed:
oops sorry cant get that terminal lines i could say the command ive run.

either way ive followed these instruction very closely

link for kernel source : https://github.com/sunnydeed/labyrinth_kernel_prague

link for tool chain :http://releases.linaro.org/components/toolchain/gcc-linaro/4.9-2016.02/

ive also tried with this : https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/

they both seem to be same still just providing the link
[Android Software/Hacking General [Developers Only]] ThePiGuy:
I've got a slightly random question, but related to kernel compiling.

People mention compiling with different toolchains but I've only ever used the Google one. What's the difference (Isn't the kernel code the same)
[Android Software/Hacking General [Developers Only]] nathanchance:
New compilers add new warnings for common issues and fix bugs/optimize code generation.
[Android Software/Hacking General [Developers Only]] erad1:
First time trying this out and thought I followed op exactly but can't make it happen. I'm trying to build a custom kernel for Validus on the Op6. Fumbled thru this for a few hours and managed to figure some things out but am stuck with what looks like it builds without error but there's no img file found at the end? Tried both methods with and without creating an output dir. Logged the build here: https://hastebin.com/ezelawuxuz.rb .

Any ideas would be appreciated, I feel like I got so close! Lol!
[Android Software/Hacking General [Developers Only]] nathanchance:
You need to specify the correct architecture with the export statement. This must be done every terminal session.
[Android Software/Hacking General [Developers Only]] Darshan@Anand:
Which one of these image or image.gz or image. gz-dtb to be repack using android kitchen/anykernel.
[Android Software/Hacking General [Developers Only]] Darshan@Anand:
:confused:
[Android Software/Hacking General [Developers Only]] milouk:
Image.gz-dtb
[Android Software/Hacking General [Developers Only]] Darshan@Anand:
Thank u
[Android Software/Hacking General [Developers Only]] Rawwrius01:
Hey, I've got a problem here which I can't solve.

I successfully compiled the kernel without a problem and got a buildscript which I changed for my needing. I also tried several install methods.

-first unpack the boot.img, replace the image in it and repack it again using a kitchen.

-using anykernel2 zip modified for my device.

-using lazyflasher (which is my favorite).

My Galaxy tab a6 boots up and everything is working fine except wifi, it's getting stuck at turning on.

What I tried:

Change the defconfig to build the wifi module (ansi_cprng.ko) and place it in /system/lib/modules (with the lazyflasher method and manually).

I also placed it in the modules folder in the ramdisk and flash the boot img.

Then I backed up the old wifi module and placed in the /system/lib/modules folder after I flashed my compiled kernel.

I tried building the module with cflags module =-fno-pic argument. I changed the security.storage line in the build.prop and try to insmod the module. But nothing, wifi won't work.

I'm using the stock Samsung source from the official website and googles 4.9 Toolchain. Nothing changed.

If someone have any idea please :D I would appreciate it.

Gesendet von meinem ONEPLUS A3003 mit Tapatalk
[Android Software/Hacking General [Developers Only]] kevintm78:
I have a Samsung note 4 that's a sm-n910v and I can use the source code from a sm-n910f but only from certain regions. With the regions I can't use I'll get that same wifi issue where the qs icon is in the dim state and wifi won't fully turn on, but everything else will work fine. Maybe the source code that you're using isn't exactly for your region.

I used this commit to make the wifi compatible for other sm-n910 variants. Maybe this or something like it will be useful in your situation.
[Android Software/Hacking General [Developers Only]] Rawwrius01:
[MENTION=4097982]DSA[/MENTION] I've looked into them but can't really see something. I think I have to try it again. Thanks.

I downloaded the two versions the amarican version I think and after that the one from my country (which is the region of the firmware as well). Could it be possible that I need to use another than the one of my country?

MANY THANKS. I will look into logs but it would be nice if I can post them here for help. Also I will try to use another source.

Gesendet von meinem ONEPLUS A3003 mit Tapatalk
[Android Software/Hacking General [Developers Only]] DSA:
Put your logs on pastebin and post the link here, someone should be able to help :good:
[Android Software/Hacking General [Developers Only]] nathanchance:
Compile Android Pie kernels for the Pixel (XL) and Pixel 2 (XL)

Google added a new compat vDSO on Android Pie for 32-bit userspace, which requires a 32-bit toolchain (commit). As a result, if CROSS_COMPILE_ARM32 is not set, your build will error.

After setting your main CROSS_COMPILE in step 1, clone this toolchain (or another compatible arm toolchain) next to the aarch64 one (if in the toolchain folder after running 'export CROSS_COMPILE', type 'cd ..'). Move into the 32-bit toolchain folder using cd then run

export CROSS_COMPILE_ARM32=$(pwd)/bin/<toolchain_prefix>

Example:

export CROSS_COMPILE_ARM32=$(pwd)/bin/arm-linux-androideabi-

Then continue on with the rest of the steps.
[Android Software/Hacking General [Developers Only]] Uzephi:
Is this needed if we are using clang or only GCC 4.9? And I assume it is only for 9.x kernels?
[Android Software/Hacking General [Developers Only]] nathanchance:
It's only needed if that 32-bit vDSO has been added; it's not required for P by any means, it's just something Google did to optimize the Pixels.
[Android Software/Hacking General [Developers Only]] Rawwrius01:
https://pastebin.com/Ekbr0LgG here is the log filtered by wifi messages.
[Android Software/Hacking General [Developers Only]] ThePiGuy:
[MENTION=6842057]nathanchance[/MENTION]

I've just got this error (Makefile:589: Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: -fstack-protector-strong not supported by compiler)

Any ideas on how to solve it?
[Android Software/Hacking General [Developers Only]] nathanchance:
Correctly set your CROSS_COMPILE variable.