yashsingh1/xdaforums huggingface dataset:
[Android Software/Hacking General [Developers Only]] Watanabe_You:
[MENTION=6842057]nathanchance[/MENTION] I've been trying to get clang building with the kernel and would like some advice on how to link them properly together (I can build but it pops up ton of errors, that's a worry for another day).

In the Makefile I have set this:

ARCH	?= arm64
CROSS_COMPILE	?= ~/Documents/android-ndk-r13b/toolchains/aarch64-cortex_a53-linux-android-a53-7.x/bin/aarch64-opt-linux-android-

And then launched build with this:

export ARCH=arm64 && export SUBARCH=arm64
CROSS_COMPILE=aarch64-opt-linux-android-
make ARCH=arm64 CROSS_COMPILE=aarch64-opt-linux-android- mido_defconfig
export KBUILD_BUILD_USER=Shinsoo
export KBUILD_BUILD_HOST=Divination
make -j2 ARCH=arm64 CC=~/Documents/android-ndk-r13b/clang/linux-x86-master-clang-r328903/bin/clang CLANG_TRIPLE=aarch64-linux-gnu- CROSS_COMPILE=aarch64-opt-linux-android-

As you can see, it's kinda messy. Is there any way I can simplify/unclutter it further?
[Android Software/Hacking General [Developers Only]] Wishpering:
I can't fix this, [MENTION=6842057]nathanchance[/MENTION] can you help me, please?

Error in this line:

vmlinux: scripts/link-vmlinux.sh $(vmlinux-deps) FORCE
[Android Software/Hacking General [Developers Only]] KiD3991:
https://pastebin.com/PiHhzmZm

There's no error message. So what do I do?
[Android Software/Hacking General [Developers Only]] donwizzy:
A script like cronos.sh! I'm interesting in how to create such scripts.

---------- Post added at 04:09 PM ---------- Previous post was at 03:09 PM ----------

Tnx so much for ur work; falling in love with it already!

This's a noob question; pls be gentle.

In compiling kali nethunter kernel for my Samsung J530F & using linaro 4.9.4 toolchain on Ubuntu 16.04, i'm getting the following errors:

"scripts/Makefile.fwinst:43: target '/lib/firmware/melfas_tk/mhs2041_j5y17.fw' given more than once in the same rule"

"scripts/Makefile.fwinst:43: target '/lib/firmware/melfas_tk/mhs2041_j7y17.fw' given more than once in the same rule"

I'm very close to obtaining my J530F nethunter kernel, pls kindly advice what to do so i can rectify d error and successfully compile d nethunter kernel!

Tnx for your reply

mod edit - totally unnecessary quote hidden
[Android Software/Hacking General [Developers Only]] zurik:
I'm trying to build stock kernel with upstream patches from https://github.com/android-linix-stable/tissot for Mi A1 but I get this error while typing the make clean && make mrproper
[Android Software/Hacking General [Developers Only]] nathanchance:
Your cross compile variable is incorrect
[Android Software/Hacking General [Developers Only]] zurik:
The compiler and source folder is on folder named "kernel".

What's the correct one?
[Android Software/Hacking General [Developers Only]] nathanchance:
Replace $/home/zurik with $HOME
[Android Software/Hacking General [Developers Only]] zurik:
It gives the same error

I'll try again.

---------- Post added 30th September 2018 at 12:23 AM ---------- Previous post was 29th September 2018 at 11:54 PM ----------

Still the same.
[Android Software/Hacking General [Developers Only]] zurik:
Screenshot
[Android Software/Hacking General [Developers Only]] dhannyell:
Thank you for the great tutorial.
[Android Software/Hacking General [Developers Only]] zurik:
I moved to Ubuntu 16.04 and the make clean and make mrproper worked so now is this issue. Typing the make defconfig tissot-perf_defconfig and I get this error

Edit: fixed by doing this : apt install gcc
[Android Software/Hacking General [Developers Only]] zurik:
Sorry about posting too much posts there. The most of things are resolved but when I compile, it not give the zImage files and I think because of the error (attached screenshot)
[Android Software/Hacking General [Developers Only]] Watanabe_You:
If you read the errors, the compile didn't finish so no zimage files yet.

You are missing a file in your repo
[Android Software/Hacking General [Developers Only]] zurik:
I use the android-linux-stable repo

Also, I didn't faced something like this, to be honest, since Nexus 5X
[Android Software/Hacking General [Developers Only]] nmdn:
I'm getting the following error:

Any thoughts?

(trying to compile MotorolaMobilityLLC/kernel-msm nougat-7.0.0-release-athene for a G4 Plus)
[Android Software/Hacking General [Developers Only]] Uzephi:
Can you post your terminal commands from git clone to make?
[Android Software/Hacking General [Developers Only]] nmdn:
$ sudo env ARCH=arm64 CROSS_COMPILE=/home/ubuntu/aarch64-linux-android-4.9/bin/aarch64-linux-android- SUBARCH=arm64 make O=out clean
$ sudo env ARCH=arm64 CROSS_COMPILE=/home/ubuntu/aarch64-linux-android-4.9/bin/aarch64-linux-android- SUBARCH=arm64 make O=out mrproper
$ sudo env ARCH=arm64 CROSS_COMPILE=/home/ubuntu/aarch64-linux-android-4.9/bin/aarch64-linux-android- SUBARCH=arm64 make O=out msm_defconfig
$ sudo env ARCH=arm64 CROSS_COMPILE=/home/ubuntu/aarch64-linux-android-4.9/bin/aarch64-linux-android- SUBARCH=arm64 make O=out -j8
[Android Software/Hacking General [Developers Only]] Uzephi:
Have you tried without sudo env? I've never needed su to build a kernel.

Try export ARCH={arch} && export SUBARCH={arch} && export CROSS_COMPILE={BLAH} then on a different line try your make commands.
[Android Software/Hacking General [Developers Only]] attack11:
Your device is 32 bits (at least on stock)

You can look at the readme in moto github

https://github.com/MotorolaMobility...0dd940e#diff-D9D47BFC8664823C6D3C71F1B635A6C4
[Android Software/Hacking General [Developers Only]] nmdn:
Thanks, should have noticed it, now I'm getting this error following the instructions in the moto github:

home/ubuntu/kernel/drivers/input/touchscreen/synaptics_fw_update.c: In function 'fwu_sysfs_image_name_show':
/home/ubuntu/kernel/drivers/input/touchscreen/synaptics_fw_update.c:1739:6: error: 'count' undeclared (first use in this function)
if (count > fwu->image_size - fwu->data_pos) {
^
/home/ubuntu/kernel/drivers/input/touchscreen/synaptics_fw_update.c:1739:6: note: each undeclared identifier is reported only once for each function it appears in
make[4]: *** [drivers/input/touchscreen/synaptics_fw_update.o] Error 1
make[3]: *** [drivers/input/touchscreen] Error 2
make[2]: *** [drivers/input] Error 2
make[1]: *** [drivers] Error 2
make: *** [sub-make] Error 2
[Android Software/Hacking General [Developers Only]] attack11:
Link to your source? You get the defconfig following moto instructions?
[Android Software/Hacking General [Developers Only]] nmdn:
https://github.com/MotorolaMobilityLLC/kernel-msm/tree/nougat-7.0.0-release-athene

No, I skipped that part because I was getting this error:

$ ( perl -le 'print \"# This file was automatically generated from:\\n#\\t\" . join(\"\\n#\\t\", @ARGV) . \"\\n\"' kernel/arch/arm/configs/msm8916-perf_defconfig kernel/arch/arm/configs/ext_config/moto-msm8916.config && cat kernel/arch/arm/configs/msm8916-perf_defconfig kernel/arch/arm/configs/ext_config/moto-msm8916.config ) > $kernel_out_dir/mapphone_defconfig || ( rm -f $kernel_out_dir/mapphone_defconfig && false )
Can't find string terminator '"' anywhere before EOF at -e line 1.
[Android Software/Hacking General [Developers Only]] attack11:
You can try to extract the defconfig from a stock boot.img

https://github.com/flar2/kernel-msm/commit/9e3095ee8d0157ab0cff522fe7904c66e178197e

It wont build without the correct defconfig
[Android Software/Hacking General [Developers Only]] nmdn:
I managed to get the defconfig file from instructions, but now I'm getting this error when compiling:

/home/ubuntu/kernel/fs/f2fs/dir.c:13:27: fatal error: linux/f2fs_fs.h: No such file or directory
#include <linux/f2fs_fs.h>
^
compilation terminated.
make[3]: *** [fs/f2fs/dir.o] Error 1
make[2]: *** [fs/f2fs] Error 2
make[1]: *** [fs] Error 2
make: *** [sub-make] Error 2
[Android Software/Hacking General [Developers Only]] attack11:
You clone the f2fs repo for your device like its explained in the readme from moto?
[Android Software/Hacking General [Developers Only]] nmdn:
Yes I downloaded https://github.com/MotorolaMobilityLLC/motorola-kernel/tree/nougat-7.0.0-release-athene and pointed $my_top_dir/kernel/fs/f2fs to the $my_top_dir/motorola/kernel/fs/f2fs/ folder
[Android Software/Hacking General [Developers Only]] nmdn:
Got it all set following the instructions from Motorola, but no .img files are created in the out directory
[Android Software/Hacking General [Developers Only]] attack11:
You would get a zImage , you can use anykernel to Flash it,you would also need the wlan.ko module for making wifi work in your build
[Android Software/Hacking General [Developers Only]] Sands207:
[MENTION=6842057]nathanchance[/MENTION] I'm considering taking another crack at building a kernel for my device which is the j3 emerge (sm-j327p) codename j3popltespr I have metered connection and cannot download the 100+ gb of android source code at this time. I can run android studio although im still pretty new to kernel building. Is it possible for me to build us a kernel using the sdk and Android Studio? We've been on stock ROM for awhile now and i want to offer our testers something new for us to try. I appreciate any thoughts or advice you might have on this and thank you in advance for your help if you have a minute.
[Android Software/Hacking General [Developers Only]] RebelLion_:
If you can find your device's kernel source code you don't need the entire Android source code. A quick search on github of your devices codename usually gives you what you need. I took the liberty of doing so since one source seems to be a tarball or some other kind of kernel source. The other comes with some instructions from the dev as well https://github.com/surepy/samsung-kernel-j3popltespr
[Android Software/Hacking General [Developers Only]] Sands207:
One would be the mess i created. The link you provided is definitely a start. Thank you for responding, i really appreciate it! ?
[Android Software/Hacking General [Developers Only]] RebelLion_:
Oh I see now, did you extract a boot image with AIK and get that? that's what it looks like to me at least. You'll want to do that, but replace the Image in the extracted boot with the Image you compile. And you get that Image by compiling with the directions in the repo I linked, if all goes well. And then if you zip that back up with AIK you'll have a boot.img you can flash in fastboot/ODIN or TWRP
[Android Software/Hacking General [Developers Only]] Sands207:
Yes it was but I was unsure how to proceed from there. Thank you so much for your help, I'll do my best and the j3 community thanks you!

On a side note are there any kernel options to avoid with samsung with the kernel itself? Id like to speed up our devices a bit, add adbd and fast charge but only if its safe but once i see options i start to get a little lost. I don't wish to damage anyone's device or my own but i do have testers but i dont want to harm them obviously
[Android Software/Hacking General [Developers Only]] RebelLion_:
Best advice is add features one at a time. Test them thoroughly if you're unsure about the effects and make sure to make sure that you're testers always keep a recent backup. Bricks and bootloops are going to happen in developing kernels, the more you learn and know the less they'll happen. And also make sure whatever commits you're picking are from a device with the same or similar chipset. That helps a lot to keep the code compatible
[Android Software/Hacking General [Developers Only]] n.pikota:
it possible to build LOS15.1 with android 8.0 kernel source?
[Android Software/Hacking General [Developers Only]] Sygmasf:
the make <defconfig_name> command point to a x86 arch subdirectory and not to the arm64 correct one, how i solve?
[Android Software/Hacking General [Developers Only]] attack11:
export ARCH=arm64 && export SUBARCH=arm64
[Android Software/Hacking General [Developers Only]] Sygmasf:
thank you, i was doing this command in the toolchain folder. Anyway at make clean time now it gives me this warning:

.config:9507:warning: symbol value 'm' invalid for KVM

and then it stucks
[Android Software/Hacking General [Developers Only]] attack11:
Give link to your sources and your commands to build
[Android Software/Hacking General [Developers Only]] Wishpering:
Error with gcc 4.9

Hi all, does anyone know how fix this error?

Error :

field 'ondemand_gov_data' has incomplete type

struct devfreq_simple_ondemand_data ondemand_gov_data;

^

Log - https://del.dog/imofojezuh.json
[Android Software/Hacking General [Developers Only]] janjan:
[MENTION=6842057]nathanchance[/MENTION] and other kernel Guru I need help :) I was trying to compile kernel for Pixel 3 Xl but it failed due to cam_actuator_i2c_pkt_parse etc...
[Android Software/Hacking General [Developers Only]] ridobe:
How did you sync your source? The p2(xl) is in ...msm_extra which is not complete without ...msm source.
[Android Software/Hacking General [Developers Only]] freeZbies:
I've been trying to build Motorola G5's Kernel since ages.

Following their readme instructions, as provided here is a waste of time. The perl script they put together in order to create a defconfig doesn't work, and even if I join the files they use myself, I'll still have a defconfig that's different from the one found in the device's boot image, apart of the fact that the generated file lacks more than thousand lines.

So I ditched motorola's instuctions altogether and (except for the part where I have to fix the symlinks and stuff, everything done properly here) and went for the traditional way, using several toolchains.

When using linaro or arm baremetal compilation stops very quickly. With Google's prebuilt toolchains, compilation goes further and without presenting errors, until it also ceases.

Here the results using each toolchain.

Android Prebuilt GCC 4.9:

https://pastebin.com/565q8YKz

Android Prebuilt GCC 4.8 (This toolchain is always the one that goes fartherst)

https://hastebin.com/udafuqafew.bash

I will try using make O=out -j4 with GCC 4.8 and post the results here.
[Android Software/Hacking General [Developers Only]] janjan:
I use the following sources.

https://android.googlesource.com/device/google/

https://android.googlesource.com/kernel/msm

Maybe I have to extract the stock deconfig from stock kernel. Don't know.. Is it possible to pull the defconfig/config from your device? I am still waiting for pixel 3 XL.
[Android Software/Hacking General [Developers Only]] ridobe:
But that's not the full source for the p3 is it? Isn't this the source?

https://android.googlesource.com/kernel/msm-extra/+/android-msm-crosshatch-4.9-pie-dr1-release

I could be completely wrong of course.
[Android Software/Hacking General [Developers Only]] ridobe:
Here you go: https://drive.google.com/file/d/19FHZEOENmg6pMs25wpLxv6gajQ-Jo6bq/view?usp=drivesdk
[Android Software/Hacking General [Developers Only]] ridobe:
Let me know if you get it going. I can help test as well. Then maybe you can explain to me how msm_extra fits into the source.
[Android Software/Hacking General [Developers Only]] janjan:
Finally it works now. I can see Google just released another source for crosshatch. I don't use msm_extra. I use to compile from msm source.

I can make a flashable zip later today, if u wanna test.
[Android Software/Hacking General [Developers Only]] vekenti:
[--Edit--

I actually did find an error.

Error: ../arch/arm64/boot/dts/qcom/sdm845-interposer-pm660.dtsi:164.1-16 Label or path led_flash_rear not found
Error: ../arch/arm64/boot/dts/qcom/sdm845-interposer-pm660.dtsi:170.1-20 Label or path led_flash_rear_aux not found
Error: ../arch/arm64/boot/dts/qcom/sdm845-interposer-pm660.dtsi:176.1-17 Label or path led_flash_front not found
Error: ../arch/arm64/boot/dts/qcom/sdm845-interposer-pm660.dtsi:182.1-16 Label or path led_flash_iris not found
Error: ../arch/arm64/boot/dts/qcom/sdm845-interposer-pm660.dtsi:188.1-20 Label or path actuator_regulator not found
Error: ../arch/arm64/boot/dts/qcom/sdm845-interposer-pm660.dtsi:193.1-13 Label or path eeprom_rear not found
Error: ../arch/arm64/boot/dts/qcom/sdm845-interposer-pm660.dtsi:198.1-17 Label or path eeprom_rear_aux not found
Error: ../arch/arm64/boot/dts/qcom/sdm845-interposer-pm660.dtsi:203.1-14 Label or path eeprom_front not found
FATAL ERROR: Syntax error parsing input tree
make[3]: *** [scripts/Makefile.lib:319: arch/arm64/boot/dts/qcom/sdm845-interposer-sdm670-mtp.dtb] Error 1
make[3]: *** Waiting for unfinished jobs....
CC net/netfilter/nfnetlink_log.o
CC net/netfilter/nf_conntrack_core.o
CC drivers/gpu/drm/drm_encoder.o
CC drivers/gpu/drm/drm_mode_object.o
make[2]: *** [../scripts/Makefile.build:650: arch/arm64/boot/dts/qcom] Error 2
make[1]: *** [arch/arm64/Makefile:161: dtbs] Error 2
make[1]: *** Waiting for unfinished jobs....

I found a solution on google and I will report back here my results once I try it out.

--Edit--]

Hello people! so I am trying to build the stock Oneplus 6T kernel but I am getting an error that I am not sure how to fix. I can't seem to find anyone else that will help me so I will try asking here.

Kernel Source:https://github.com/OnePlusOSS/android_kernel_oneplus_sdm845/tree/oneplus/SDM845_P_9.0

OS: Debian Sid

Toolchain: https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/

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

No errors occurred during the build except the one listed above.

Here is a list of all the commands I ran before:

export CROSS_COMPILE=$(pwd)/bin/aarch64-linux-android-
export ARCH=arm64 && export SUBARCH=arm64
make O=out clean
make O=out mrproper
make O=out sdm845_defconfig
make O=out -j$(nproc --all)

I also tried without the out directory and received the same results. I tried redownloading the sources and toolchain thinking that something went corrupt but that also did not help.

I don't know why but it seems like all of oneplus stock kernels never compile by themselves. I tried to build the stock kernel for my 5T when I got it but gave up after a week of trying and asking kernel devs how to do it. I am determined to do some kernel work on this 6t. I miss messing with the kernel on my old samcrap phones.

Thank you for any help.
[Android Software/Hacking General [Developers Only]] freeZbies:
I got my device's (moto G5) kernel source and extracted the defconfig from it's boot image. After compilation succeeds the zImage file is generated successfully, but I see various dtb files (msm8937-cedric-p{1 through 5}.dtb).

I tried to use Android Image Kitchen as well as AnyKernel to flash the Kernel with these dtb files but it won't boot with any of them. Using the default dtb that's packed on the stock boot image or with other custom kernels but it also doesn't work.

What should I do?
[Android Software/Hacking General [Developers Only]] Uzephi:
If it is like other Motorola Kernels like my Z2 kernel, it is the "image.gz-dtb" that is what I flash to my boot image and have no boot issues
[Android Software/Hacking General [Developers Only]] freeZbies:
No such file exists.

If u have a a time, could you please send me a PM with the defconfig you used for your device? I suspect I have a split dtb image due to a specific attribute in the defconfig my device uses, but gotta check it against another Moto phone first.
[Android Software/Hacking General [Developers Only]] Uzephi:
https://github.com/Uzephi/Nash_Oreo/blob/oreo-8.0.0-release-nash/arch/arm64/configs/nash_defconfig

No need for a PM. My source is on git. That is for stock blur. I have an aosp one if you need that. The defconfig is almost identical though.
[Android Software/Hacking General [Developers Only]] Ano01:
Sorry, i've been trying to compile the boeffla venom kernel, i tried using linaro 7.x and arm-eabi-4.8, both give me the same error:

'sub-make' cant be found..

What might i be doing wrong? Considering i've been doing all the steps, what might i be missing?

Sorry i dont have the log for now, my pc is far..
[Android Software/Hacking General [Developers Only]] WiZaRd981:
Same error here... Did you find out how to resolve this..? :)
[Android Software/Hacking General [Developers Only]] onliner:
No, I tried everything (I think), even I reinstalled Ubuntu but nothing.
[Android Software/Hacking General [Developers Only]] WiZaRd981:
Tried with "sudo -i"? Giving a root permission.. That helped for me.. :p
[Android Software/Hacking General [Developers Only]] onliner:
Yes, sudo works with "make clean" and "make mrproper" but the build fails.
[Android Software/Hacking General [Developers Only]] Canekok:
Guys help please port the firmware

Guys help please port the firmware https: //forum.xda-deve...os-unofficial-t3745277 from sm-j730fm to sm-j530fm, here's the theme of my phone on xda https: //forum.xda-deve...ies --other-development Telephones are very similar in hardware and when I edited the updater script, the firmware got up, but there was an endless download. There you need to edit the kernel a little (I think there are different drivers on the displays), but I don’t really know how to disassemble and assemble the kernel (boot.img). Help someone who understands the cores, please, I have not found either this firmware or the aosp core from android 7 for my phone anywhere ... The firmware is old, but I really want to install it, please help ... Thanks in advance!
[Android Software/Hacking General [Developers Only]] fatehh:
Hi there

I followed Nathan's old guide to compile kernel for my Nexus 5x as follows:

cd ~
mkdir Kernel && cd Kernel
git clone https://github.com/nathanchance/bullhead.git source
git clone https://github.com/nathanchance/AnyKernel2.git anykernel
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9 AOSP-4.9

cd source && git checkout upstream-7.1.2
cd ../anykernel && git checkout bullhead-stock-decrypt

Here it gives me the following error:

[B]error: pathspec 'bullhead-stock-decrypt' did not match any file(s) known to git.[/B]

Please help.
[Android Software/Hacking General [Developers Only]] max steiner:
Successfuly compiled kernel from here git://github.com/MiCode/Xiaomi_Kernel_OpenSource.git -b tissot-n-oss for Mi A1. But when I flash it into the phone wifi don't work. Please help.
[Android Software/Hacking General [Developers Only]] xda4evers:
marlin build errors for android-msm-marlin-3.18-pie-qpr1-s2

Hello,

I'm trying to build the stock pie kernel for a Pixel XL. I've chosen to build the latest version I had received an OTA for )android-msm-marlin-3.18-pie-qpr1-s2 from 10/09/2018). I am seeing the following errors during the kernel build:

/arch/arm64/include/asm/sysreg.h:219:43: error: value size does not match register size specified by the constraint and modifier

[-Werror,-Wasm-operand-widths]

asm volatile("mrs %0, sctlr_el1" : "=r" (val));

./arch/arm64/include/asm/sysreg.h:222:44: error: value size does not match register size specified by the constraint and modifier

[-Werror,-Wasm-operand-widths]

asm volatile("msr sctlr_el1, %0" : : "r" (val));

Any suggestions on what changes to my build configuration are needed to get past these build errors? ... or redirection to other different thread to post to?

Thanks much!

***** tool configuration *****

Kernel Source (for pixel xl - sha 4212e6b8dac5835bcf395e82f29987ff8975763c):

repo - android.googlesource.com/kernel/msm

branch - android-msm-marlin-3.18-pie-qpr1-s2

OS: UBUNTU 14.04

Toolchain: android-ndk-r18b

***** build steps *****

$ git clone <from android googlesource com kernel msm >

$ cd msm

$ git checkout -b android-msm-marlin-3.18-pie-qpr1-s2 origin/android-msm-marlin-3.18-pie-qpr1-s2

$ export ARCH=arm64

$ export SUBARCH=arm64

$ export CROSS_COMPILE=<path to>/android-ndk-r18b/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-

$ export CROSS_COMPILE_ARM32=<path to>/android-ndk-r18b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-

$ make marlin_defconfig

$ make
[Android Software/Hacking General [Developers Only]] xda4evers:
marlin build errors resolved

After switching from the ndk 64 bit toolchain to that in android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/, the kernel now compiles.