yashsingh1/xdaforums huggingface dataset:
[Android Software/Hacking General [Developers Only]] adeii:
Image.gz could be zImage you looking for.

I got arch/arm64/boot/Image.gz-dtb as compiled zImage.

For full kernel, I unpack stock kernel with mktools,

replace zImage,

edit kernel.img-cmdline to userdebug and permissive,

edit kernel.img-oslevel and -osversion according to current OS,

delete kernel.img-avb1 check and repack kernel.
[Android Software/Hacking General [Developers Only]] newbit:
Yeah I think so too. But I noticed the missing $(obj)/Image after install: though.

Not sure what difference it does. But without the kernel source, it is like magic 8 balling anyway.

For this I just use the Android Image Kitchen from @osm0sis.

It couldn't be more easy.

Why are you setting the userdebug ? I just replace the kernel file and repack it, done.

But would be nice to know what the benefits of these changings are.

I've never managed to upgrade even one sublevel, so can't say anything helpful.

But what Is your hoped benefit for your task? Fixing a bunch of errors seems nice to me in contrast of a month work!

Perhaps a single patch that fixes your actually problem will do it as well?
[Android Software/Hacking General [Developers Only]] adeii:
@newbit

There are no special reason for "userdebug" or "eng" instead "user", I guess that has more freedom for advanced user.

Sublevel patches were successful from 3.18.66. But I would like to test custom roms (A10, A11) and I heard that many roms not work, because old kernel and/or old vendor (A8.0). And yes, I agree that fixing errors and adding features are much more nicer. Also using osm0sis' AIK on Windows, but never used on Linux yet.
[Android Software/Hacking General [Developers Only]] KRafi:
Getting the following issue. It's trying to compile an x86 kernel! :/

$ make O=~/Documents/UBports/Kernel -j$(nproc --

all)

make[1]: Entering directory '/home/user/Documents/UBports/Kernel'

GEN ./Makefile

scripts/kconfig/conf --silentoldconfig Kconfig

drivers/input/touchscreen/ft5446/Kconfig:5:warning: ignoring type redefinition of 'TOUCHSCREEN_FT5446' from 't

ristate' to 'boolean'

warning: (USB_CI13XXX_MSM) selects USB_MSM_OTG which has unmet direct dependencies (USB_SUPPORT && (USB || USB

_GADGET) && (ARCH_QCOM || COMPILE_TEST))

*

* Restart config...

*

*

* Linux/x86 4.9.193 Kernel Configuration

*

64-bit kernel (64BIT) [Y/n/?] (NEW)
[Android Software/Hacking General [Developers Only]] newbit:
Receiving help

I am particular in how people ask for help. I do NOT respond to posts asking for a hand out ("How do I fix this?", "Please fix this!", etc.). I only respond to posts with clear logs and steps that you have tried. Basically, show me that you have read this guide and have a specific issue. I am not here to hold your hand through this, this is a developers' forum.

What is your question again? Could you please fulfill the above-mentioned requirements to receive help?!
[Android Software/Hacking General [Developers Only]] KRafi:
Hlw. Which kernel config should I enable to include Device Tree Overlay in arm architecture. In arm64, I have `CONFIG_BUILD_ARM^$_DT_OVERLAY`, but i can't find a similar config option for arm.
[Android Software/Hacking General [Developers Only]] mistersmee:
Excellent guide, thanks! I was able to plod along with building the kernel for my Moto G9 Power "cebu", fixing the broken symlinks in the kernel tarball which somehow occurred, when I snagged this error

In file included from /home/andbuild/Downloads/and/kernel/motorola/cebu/kernel/sched/core.c:23:0:
/home/andbuild/Downloads/and/kernel/motorola/cebu/kernel/sched/walt.h:
In function 'walt_task_dump': /home/andbuild/Downloads/and/kernel/motorola/cebu/kernel/sched/walt.h:351:2:
warning: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type 'pid_t' [-Wformat=]
error, forbidden warning: walt.h:351

make[3]: *** [/home/andbuild/Downloads/and/kernel/motorola/cebu/scripts/Makefile.build:338: kernel/sched/core.o] Error 1

make[2]: *** [/home/andbuild/Downloads/and/kernel/motorola/cebu/scripts/Makefile.build:643: kernel/sched] Error 2

make[1]: *** [/home/andbuild/Downloads/and/kernel/motorola/cebu/Makefile:1143: kernel] Error 2

I've been using all of my Google-fu, and yet I can't resolve this, and I'm not a C expert, so I can't hack at the .c,.h files myself, I wouldn't even know where to start.

Has anyone had something similar happen to them, can anyone help me out here? The kernel source is https://github.com/MotorolaMobilityLLC/kernel-msm/tree/MMI-QZC30.Q4-22-57

EDIT: I just noticed that the makefile for the kernel is using the GCC wrapper that adds -Werror, erroring out at the slightest error. That might be it, though I have no idea if this particular error is critical or not. Actually, that is definitely it, I'm building on Arch, with the latest gcc 10.x toolchain, so yeah. I didn't disable that. Let me do that and see how that goes.
[Android Software/Hacking General [Developers Only]] mistersmee:
This problem is fixed, it was the GCC wrapper, the build progresses for a bit, but a new, unrelated problem crops up.

/bin/sh: line 1: -Wp,-MD,arch/arm64/kernel/vdso/.vdso.lds.d: No such file or directory

VDSOA arch/arm64/kernel/vdso/note.o

make[2]: *** [/home/smee/Downloads/twrp/kernel/motorola/cebu/scripts/Makefile.build:450: arch/arm64/kernel/vdso/vdso.lds] Error 127

make[2]: *** Waiting for unfinished jobs....

make[1]: *** [arch/arm64/Makefile:188: vdso_prepare] Error 2

Once again, Google-fu fails me. I don't quite know what to do here. Any help appreciated.
[Android Software/Hacking General [Developers Only]] mistersmee:
I'm not just trying to build the kernel, but rather TWRP for this phone, so let me see how to get this done within the TWRP build environment. Thanks, though. Knowing that it actually builds, and whatever the errors are, are due to something I'm doing incorrectly, is half the battle.

Hmm, I don't think that when I was building, that it was using clang to build, it probably was using gcc. That might honestly be it. Let's see how I crack along now.

The reason for this rigamarole, is that the touch doesn't work, for some reason while using the prebuilt kernel, and somewhere on the internet in some GitHub issue, someone mentioned that using the kernel sources could fix that, and so here I am.
[Android Software/Hacking General [Developers Only]] Flacko89:
Hello everyone can anyone help me out with building a kernel for p2xl? Or link me to one that is done? Been at this for days I'm a a noob at this keep getting error when compiling
[Android Software/Hacking General [Developers Only]] newbit:
Can you provide more specific details?

Google provides already a guide on how building-kernels
[Android Software/Hacking General [Developers Only]] Flacko89:
I was getting another message which is how I ended up at this wonderful forum whick was arch/arm64/makefile:48: *** cross_compile_arm32 not defined or empty, the compat vdso will not be built. stop.
[Android Software/Hacking General [Developers Only]] rishav518:
There are three defconfig files on /arch/arch/configs directory without my device name(wt88047 or msm8916), which to choose?
[Android Software/Hacking General [Developers Only]] rishav518:
Hi, i got error after last make command to compile, i have attached terminal log, can someone take a look at it.
[Android Software/Hacking General [Developers Only]] trueToastedCode:
Hey, I wanted to compile the stock OnePlus 7 kernel for which i made a repo (https://github.com/trueToastedCode/android_kernel_oneplus7_sm8150/tree/11.0.0.2/msm-4.14).

The problem is that i don't know of the resulting flashable zip is in theorie good (eg. my flash script). May someone just have a look over it: https://pastebin.com/xmFQaJJ1

*Full Kernel: https://drive.google.com/file/d/1JrDBNrzksmLaT7S5mkYcW86L65CsnDnS/view?usp=sharing *It uses AnyKernel3 (commit 37782872f69a68557f53129d3ff1eeca95a07f30)
[Android Software/Hacking General [Developers Only]] Sanskar Bhusal:
Do we need to learn programmimg to understand this tutorial? Firstly this looks a nice noob friendly guide and slowly as I continue reading throughly things get complicated. How did you learn these stuffs? Do college teaches these stuffs?
[Android Software/Hacking General [Developers Only]] DiamondJohn:
You would probably be better off to upload your error log to a text host, so people can see the actual error you are failing with.
[Android Software/Hacking General [Developers Only]] op9lover:
Hello，I have a problem for build the oneplus9 pro kernel.I use OnePlusOSS/android_kernel_oneplus_sm8350. The build Step is

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

2.export ARCH=arm64 && export SUBARCH=arm64

3.make O=out <defconfig_name>

4.make O=out -j2

There is a lot of errors, such as

"

../scripts/mkcompile_h: 57: ../scripts/mkcompile_h: Bad substitution

../init/Makefile:35: recipe for target 'include/generated/compile.h' failed

make[2]: *** [include/generated/compile.h] Error 2

"

and the "../scripts/mkcompile_h: 57: ../scripts/mkcompile_h" is

"

#delete /work

CURRENT_RELEASE="${RELEASE#\/work}"

#replace / to \\

WINDOWS_RELEASE="${CURRENT_RELEASE//\//\\\\}"

"

Could you tell me how to solve this problem?Thank you for your help!
[Android Software/Hacking General [Developers Only]] acuicultor:
Op9 kernel must be compiled with clang not with gcc.
[Android Software/Hacking General [Developers Only]] daveomg:
Hello.

Can anybody recommend me some books related in any way to compiling android kernel? I have been using Linux for a long time, and decided to compile a kernel for myself to learn something new(the same way I started learning programming languages), but I encounter a lot of errors during the compilation process... so I have decided to find and read some books about it to have a theory background. Thank you in advance :)
[Android Software/Hacking General [Developers Only]] kevin71246:
I know the OP (& guide) was posted several years ago, but it looks like this thread is still alive and well - and I'm guessing methods may have changed since.

I want to make a minimum change to the AOSP kernel config of a Google Pixel 3a/Sargo, and build/recompile it - but I'm not that stupid so I'm starting with trying to recompile it with NO CHANGES! I would think this would be as simple as it gets since its Google AOSP vanilla with no changes but no. I followed their guide and it doesnt work with a very fundamental error I cant figure out.

Error while building: (~7min in)

Creating initramfs
build/build.sh: line 967: mkbootfs: command not found

Followed Google's guide here: https://source.android.com/setup/build/building-kernels

mkdir android-kernel && cd android-kernel
repo init -u https://android.googlesource.com/kernel/manifest -b android-msm-bonito-4.9-android11-qpr2
repo sync
build/build.sh

I found the mkbootfs binary in $HOME/android/aosp-kernel/build/build-tools/path/linux-x86/mkbootfs, as well as many other locations actually, and all of them, when executed, say "command not found"! Is that expected?! Ie. I "cd to $HOME/android/aosp-kernel/build/build-tools/path/linux-x86 & execute mkbootfs (where I can see the file & verified it has execute permissions), and still issues the same error.

I tried adding "$HOME/android/aosp-kernel/build/build-tools/path/linux-x86" to my PATH but same results. For some reason I can't find anything helpful on the net.

PLEASE HELP!
[Android Software/Hacking General [Developers Only]] kevin71246:
I figured this out: https://android.stackexchange.com/q...ile-trying-to-build-aosp-kernel/239251#239251

Everything builds fine now, able then put to put the generated Image.lz4 in my AOSP source folder, compile, & get a boot.img. I flash it and Android boots fine...except the touchscreen doesnt work! I made ZERO changes to the kernel; Im just trying to build it and prove it works before I change anything. What am I doing wrong?! I created this: https://android.stackexchange.com/q...ild-for-pixel3a-sargo-touchscreen-not-working
[Android Software/Hacking General [Developers Only]] HesThatGuy:
I'm trying to compile a kernel for the OnePlus 8

Would someone be able to help me find a solution to this error?

No rule to make target 'arch/arm64/boot/dts/qcom/apq8016-sbc.dtb'

I'm using Ubuntu 16.04 LTS through a VM
[Android Software/Hacking General [Developers Only]] HesThatGuy:
You'll need to change the values of the configs with "touchscreen" in their name from 'm' to 'y'

you might also have to do that for your wifi and fast charging as it's like that with the Pixel 2

I hope this helps you

arch/arm64/configs/bonito_defconfig - kernel/msm - Git at Google
[Android Software/Hacking General [Developers Only]] kevin71246:
Thank you. I have this documented here as well: https://android.stackexchange.com/q...a-sargo-touchscreen-not-working/239417#239417
[Android Software/Hacking General [Developers Only]] AmolAmrit:
Guys, exporting KBUILD_BUILD_HOST and KBUILD_BUILD_HOST does not seem to work on Android 11 sources. It says nobody@android in about phone section. Is someone facing the same issue? Clang compile is enabled.
[Android Software/Hacking General [Developers Only]] erpilsG:
Good day... Im trying to compile the kernel of my Samsung Galaxy Note10 lite (SM-N770F),

Android version -11

Baseband version - N770FXXS7EUF1

Kernel version - 4.9.191-21630640

Service provider - XTC

using this kernel source from Samsung (SM-N770F_RR_Opensource) but errors pop-up when starting to Make files. Im hoping someone will share. Thanks..

Here's the Output :

Spoiler content hidden.
[Android Software/Hacking General [Developers Only]] davidsparker:
Hello, op9lover?

I've met the same error like you.

I think the error occured at line 57 of mkcompile_h is depend on the $RELEASE variable.

It seems that $RELEASE is empty string. But I don't know why.

If you resolved this issue, I will appreciate you to share the method.
[Android Software/Hacking General [Developers Only]] covar:
Hello

I'm trying to recompile nethunter kernel for oneplus5t (source kernel https://github.com/arter97/android_kernel_oneplus_msm8998) in order to enable RFCOMM support. I have download the (gcc-arm-8.3-2019.03-x86_64-aarch64-elf) toolchain and i tried to export cross_compile to the bin folder of the toolchain. But when i proceed to the command make clean i get the followin error:

root@ubuntu:/home/path_of_kernel#

export CROSS_COMPILE="/home/path_of_kernel/android_kernel_oneplus_msm8998/gcc-arm-8.3-2019.03-x86_64-aarch64-elf/bin/aarch64-elf-"

root@ubuntu:/home/path_of_kernel# make clean

./scripts/gcc-version.sh: line 26: /home/arter97/arm64-gcc/bin/aarch64-elf-gcc: No such file or directory

./scripts/gcc-version.sh: line 26: /home/arter97/arm64-gcc/bin/aarch64-elf-gcc: No such file or directory

it seems that the direction of the folder is wrong and i cannot changed it.

Why is trying to access "/home/arter97/arm64-gcc/bin/aarch64-elf-gcc" ????

How can i change it????
[Android Software/Hacking General [Developers Only]] davidsparker:
Hi, I found the troubleshoot.

In my case, this problem had occurred because of my ubuntu environment which using shell as dash. So, I reverted my shell env by running command below.

"sudo dpkg-reconfigure dash"

** Select option “No” to use /bin/bash as the default shell **

Good luck!
[Android Software/Hacking General [Developers Only]] covar:
Hello

I'm trying to recompile nethunter kernel for onplus5T in order to enable RFCOMM support for bluetooth devices.

I have download the source kernel from here https://github.com/arter97/android_kernel_oneplus_msm8998 (it is a custom kenel) and i have followed the instructions as showed. For some reason export CROSS_COMPILE does not work. Even if i download another toolchain still i have the same problem.

Please help.
[Android Software/Hacking General [Developers Only]] alecxs:
Exit code 137 - Out of memory
[Android Software/Hacking General [Developers Only]] lopster70:
Where can i get the kernel source for xiaomi miatoll

Any other guide honestly confused
[Android Software/Hacking General [Developers Only]] namhoang235:
You should have a tool chain and a fine kernel source. Some devs "cook" their source to become a soup, a mess with many fuming personal addition. You can get source from aospa or ormni. Their source are very fine and clean
[Android Software/Hacking General [Developers Only]] namhoang235:
I suggest a bash script to set all variable for you. You can find some hint about My b13.sh HTTPS://github.com/LeCmnGend/kernel_xiaomi_ginkgo . I can auto download proton clang13 and run kernel compile. Just edit your defconfig file of rơm (mine is ginkgo) and it will help you
[Android Software/Hacking General [Developers Only]] WOReKEn:
Hello, I am trying to compile a custom kernel for my Galaxy S6 which should be compatible with Lineage OS 15.1 which I am currently running (https://xdaforums.com/t/rom-sm-g920f-zerofltexx-lineageos-15-1-unofficial-for-the-galaxy-s6.3909458/)

I cloned the provided kernel source from the above link (https://github.com/SubZero7748/android_kernel_samsung_exynos7420)

Following this guide I cloned the arm64 toolchain (https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/) However I dont know which branch I should checkout. Since LineageOS 15.1 is based on Oreo 8.1 I thought that there would be some matching branch. However there are multiple ones and I dont know which one to choose. Can someone please help?
[Android Software/Hacking General [Developers Only]] buzhishishi:
HI，friend, I have the same problem，How was the final solution？thank you
[Android Software/Hacking General [Developers Only]] TekHck:
hello, anyone knows how to fix this error ?

im trying to compile pixel 4a kernel android 12

and m using clang

### Key pair generated.

###

EXTRACT_CERTS certs/signing_key.pem

AS certs/system_certificates.o

AR certs/built-in.o

CC arch/arm64/kernel/perf_regs.o

CC arch/arm64/kernel/perf_callchain.o

CC arch/arm64/kernel/perf_event.o

CC arch/arm64/kernel/perf_trace_counters.o

CC arch/arm64/kernel/perf_trace_user.o

CC arch/arm64/kernel/hw_breakpoint.o

In file included from ../arch/arm64/kernel/perf_trace_counters.c:19:

../include/trace/events/sched.h:269:2: error: "Unsupported NR_CPUS for lb tracepoint."

#error "Unsupported NR_CPUS for lb tracepoint."

^

AS arch/arm64/kernel/sleep.o

1 error generated.

make[2]: *** [../scripts/Makefile.build:364: arch/arm64/kernel/perf_trace_counters.o] Error 1

make[2]: *** Waiting for unfinished jobs....

make[1]: *** [/home/kali/Desktop/kernel/ks/Makefile:1209: arch/arm64/kernel] Error 2

make[1]: Leaving directory '/home/kali/Desktop/kernel/ks/out'

make: *** [Makefile:146: sub-make] Error 2
[Android Software/Hacking General [Developers Only]] lolvatveo:
I'm stuck at make <def_config>
[Android Software/Hacking General [Developers Only]] V3rB0se:
as it says you must specify what config to use you can find the config files in yourkernel/arch/arm64/configs/
[Android Software/Hacking General [Developers Only]] V3rB0se:
It's because of less memory You can compile the kernel without LTO in your case.

Remove these two lines from your defconfig

CONFIG_LTO_CLANG=y

CONFIG_CFI_CLANG=y
[Android Software/Hacking General [Developers Only]] bksvc:
I can't compile zImage

My kernel source code : https://opensource.samsung.com/uploadSearch?searchValue=sm-n980f

Version : N980FXXS3EULF

: My Command Set :

export ARCH=arm64

export CROSS_COMPILE=/home/SM-N980F/new-make/gcc-linaro/bin/aarch64-linux-gnu-

mkdir kout

make -C /home/SM-N980F/new-make/ O=output/ exynos9830-c1slte_defconfig

: ERROR OUT :

make: Entering directory '/home/SM-N980F/new-make'

make[1]: Entering directory '/home/SM-N980F/new-make/output'

HOSTCC scripts/basic/fixdep

GEN ./Makefile

HOSTCC scripts/kconfig/conf.o

YACC scripts/kconfig/zconf.tab.c

LEX scripts/kconfig/zconf.lex.c

HOSTCC scripts/kconfig/zconf.tab.o

HOSTLD scripts/kconfig/conf

arch/arm64/Kconfig:1339:warning: multi-line strings not supported

drivers/input/misc/hall/Kconfig:41: syntax error

drivers/input/misc/hall/Kconfig:40: invalid option

drivers/gpu/arm/Kconfig:28: syntax error

drivers/gpu/arm/Kconfig:27: invalid option

drivers/gpu/arm/Kconfig:29: syntax error

drivers/gpu/arm/Kconfig:28: invalid option

'rivers/soc/samsung/linkforward/Kconfig:4:warning: ignoring unsupported character '

'rivers/soc/samsung/linkforward/Kconfig:5:warning: ignoring unsupported character '

'rivers/soc/samsung/linkforward/Kconfig:6:warning: ignoring unsupported character '

'rivers/soc/samsung/linkforward/Kconfig:7:warning: ignoring unsupported character '

'rivers/soc/samsung/linkforward/Kconfig:8:warning: ignoring unsupported character '

fs/sdcardfs/Kconfig:19: syntax error

fs/sdcardfs/Kconfig:18: invalid option

make[2]: *** [../scripts/kconfig/Makefile:104: exynos9830-c1slte_defconfig] Error 1

make[1]: *** [/home/burak/SM-N980F/new-make/Makefile:547: exynos9830-c1slte_defconfig] Error 2

make[1]: Leaving directory '/home/SM-N980F/new-make/output'

make: *** [Makefile:146: sub-make] Error 2

make: Leaving directory '/home/SM-N980F/new-make'
[Android Software/Hacking General [Developers Only]] alecxs:
check Kconfig for wrong line endings CRLF
[Android Software/Hacking General [Developers Only]] nalas:
Try to use gcc google used by samsung or clang used by samsung...

You will find version it in Makefile or defconfig begin lines...

Linux-android-4.9

Linaro can breaks compile or you have to add some commits with fix linaro gcc in your source.

Look at github repos...

Are a lot of n980 series ... exynos 9830
[Android Software/Hacking General [Developers Only]] lolvatveo:
don't have wifi or bluetooth after compile kernel, no error while compiling. someone say I don't import qcacald module, etc my device is qualcomm and there are no guide how to do
[Android Software/Hacking General [Developers Only]] V3rB0se:
kernel source?
[Android Software/Hacking General [Developers Only]] lolvatveo:
this is stock kernel https://github.com/maingocvinh/j510fn-kernel-stock
[Android Software/Hacking General [Developers Only]] V3rB0se:
this happened to me too try exporting platform_version before compiling the kernel it's related to samsung.
[Android Software/Hacking General [Developers Only]] lolvatveo:
I don't know what is my platform_version number, I see platform.tar.gz with kernel source, what is it?
[Android Software/Hacking General [Developers Only]] V3rB0se:
based on android version

export ANDROID_MAJOR_VERSION=r
export PLATFORM_VERSION=11
[Android Software/Hacking General [Developers Only]] lolvatveo:
I can determine my version after searching for a long time

export ANDROID_MAJOR_VERSION=n

export PLATFORM_VERSION=7.1.1

will be test in next compile
[Android Software/Hacking General [Developers Only]] V3rB0se:
is it working now?
[Android Software/Hacking General [Developers Only]] lolvatveo:
Many developers have successfully compiled on samsung j5 2016 without wifi bluetooth error, so this kernel is a bit weird. I have tried both toolchain armeabi 4.8, 4.9 no need install any ndk package https://github.com/sayedather/arm-eabi-4.8-toolchain

GitHub - arter97/arm-linux-androideabi-4.9: Linaro Android toolchain 4.9

Linaro Android toolchain 4.9. Contribute to arter97/arm-linux-androideabi-4.9 development by creating an account on GitHub.

github.com

https://xdaforums.com/t/kernel-nn-j5-2016-linaro-6-4-1-cherry-kernel-2-0.3708520/

This developer using linaro toolchain 6.4.1 to compile kernel which requires ndk package installed otherwise it will lead to error arm-eabi-gcc: no such file or dir and I haven't used it to compile, is wifi bluetooth error related to toolchain?

although there are no errors when compiling but I will post some warning logs
[Android Software/Hacking General [Developers Only]] V3rB0se:
no it isn't related to toolchain it's an issue with samsung secure storage.