yashsingh1/xdaforums huggingface dataset:
[Android Software/Hacking General [Developers Only]] Anon333266:
These are my errors:

drivers/bluetooth/btfm_slim.c:26:10: fatal error: btfm_slim.h: No such file or directory
#include <btfm_slim.h>
^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [scripts/Makefile.build:339: drivers/bluetooth/btfm_slim.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CC mm/cma.o
CC sound/core/info.o
CC sound/core/ctljack.o
CC drivers/base/syscore.o
make[1]: *** [scripts/Makefile.build:653: drivers/bluetooth] Error 2
make[1]: *** Waiting for unfinished jobs....

fs/ext4/page-io.c: In function ‘ext4_bio_write_page’:
fs/ext4/page-io.c:483:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
error, forbidden warning: page-io.c:483
make[2]: *** [scripts/Makefile.build:339: fs/ext4/page-io.o] Error 1
make[1]: *** [scripts/Makefile.build:653: fs/ext4] Error 2
make: *** [Makefile:1102: fs] Error 2
make: *** Waiting for unfinished jobs....

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

[user@arch msm-4.9]$ make O=/home/user/build/msm-4.9/out clean
make[1]: Entering directory '/home/user/build/msm-4.9/out'
find: ‘arch/arm64/boot/dts/’: No such file or directory
make[1]: Leaving directory '/home/user/build/msm-4.9/out'

[user@arch msm-4.9]$ make O=/home/user/build/msm-4.9/out mrproper
make[1]: Entering directory '/home/user/build/msm-4.9/out'
find: ‘arch/arm64/boot/dts/’: No such file or directory
make[1]: Leaving directory '/home/user/build/msm-4.9/out'

make[1]: Entering directory '/home/user/build/msm-4.9/out'
HOSTCC scripts/basic/fixdep
GEN ./Makefile
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
#
# configuration written to .config
#
make[1]: Leaving directory '/home/user/build/msm-4.9/out'

../fs/ext4/page-io.c: In function ‘ext4_bio_write_page’:
../fs/ext4/page-io.c:483:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
error, forbidden warning: page-io.c:483
make[3]: *** [../scripts/Makefile.build:340: fs/ext4/page-io.o] Error 1
make[2]: *** [../scripts/Makefile.build:653: fs/ext4] Error 2
make[1]: *** [/home/user/build/msm-4.9/Makefile:1102: fs] Error 2
make[1]: Leaving directory '/home/whoami/build/msm-4.9/out'
make: *** [Makefile:152: sub-make] Error 2
[Android Software/Hacking General [Developers Only]] ShinAli:
Thanks for this tutorial; even though I didn't use this in the end, it definitely help me understand the kernel build process more as someone previously inexperienced with Linux kernel development.

I've gotten a realme X50 Pro and started hacking on the recently open sourced kernel to see if I can get it to build and boot. The code they've put up is definitely incomplete, though, so it definitely requires some hacks.

I'm a professional programmer primarily focusing on 3D graphics and low level optimization, so at the very least I definitely know my way around C/C++, as well as decent enough knowledge to use Linux alright; kernel development is new to me, however. Despite that, I've managed to get the non-perf kernel to build and actually boot. Of course the real trouble begins here, as the display is black once the boot logo switches off. Shell works, so I was able to pull whatever I can from /proc/kmsg.

At this point I could use a little more guidance in my bug fixing phase. I've got /proc/kmsg from a stock kernel to compare against, but I'm not sure how to exactly debug why or how some piece of hardware isn't working. I would assume it some driver issue, but I wouldn't know where to start. In the bad kernel log, I've seen this message pop a lot

init: Received control message 'interface_start' for 'vendor.display.config@1.7::IDisplayConfig/default' from pid: 525 (/system/bin/hwservicemanager)

so I would assume that would have something to it, I'm guessing the vender.display.config is some HAL descriptor?

Any general advice and tips would be wonderful, as well. I would like to discuss this with other developers but XDA is a little confusing to me.
[Android Software/Hacking General [Developers Only]] rdxkatana99:
arch/arm64/Makefile:83: *** CROSS_COMPILE_ARM32 not defined or empty, the compat vDSO will not be built. Stop.

I am a newbie plz help.
[Android Software/Hacking General [Developers Only]] janjan:
It is clearly tell you that you need to define CROSS_COMPILE_ARM32. Set the right path to your CROSS_COMPILE_ARM32.
[Android Software/Hacking General [Developers Only]] fidoedidoe:
I've compiled custom kernels for an old 32bit tablet of mine (cortext-a9), but I'm a getting little confused compiling for my newer phone (S8 plus) which is 64bit and that has 2 processors: 4 core Exynos-m2 and 4 core Cortex-a53 processor (although combo is not listed in big.LITTLE gcc arm options). I've been assigning the -mtune/-mcpu for cross toolchain compiling to: "exynos-m1", but does that imply that the there's no optimisation for the 2nd CPU (Exynos-a53) - is this anything to be concerned about?? Apologies if a dumb question, I'm not a developer just a keen enthusiast tripping over the basics.
[Android Software/Hacking General [Developers Only]] linckandrea:
Why use exynos-m1 when you exynos-m1 big cluster is exynos-m2?

Anyway if you are using Gcc

The flag should look like that(in you case) =

exynos-m2.cortex-a53 for both mcpu and mtune
[Android Software/Hacking General [Developers Only]] fidoedidoe:
Thank you so much for the reply.

"Yes" I've been using one of: GCC 9.3/GCC 10.2 while compiling. In GCC online docs (arm options) it only lists "exynos-m1" as a viable option for -mcpu & -mtune. I think compiling with clang supports a value of "exynos-m2" (but I've been struggling to compile with clang - another issue).

Interestingly, the kernel source I've git cloned used: -mcpu=exynos-m1.cortex-a53, *but* when I start the compile with ether GCC 9.3.0/10.2.0 I quickly hit the error:

cc1: error: unknown value 'exynos-m1.cortex-a53' for '-mcpu'
cc1: note: valid arguments are: cortex-a34 cortex-a35 cortex-a53 cortex-a57 cortex-a72 cortex-a73 thunderx thunderxt88p1 thunderxt88 octeontx octeontx81 octeontx83 thunderxt81 thunderxt83 emag xgene1 falkor qdf24xx exynos-m1 phecda thunderx2t99p1 vulcan thunderx2t99 cortex-a55 cortex-a75 cortex-a76 cortex-a76ae cortex-a77 cortex-a65 cortex-a65ae ares neoverse-n1 neoverse-e1 octeontx2 octeontx2t98 octeontx2t96 octeontx2t93 octeontx2f95 octeontx2f95n octeontx2f95mm tsv110 thunderx3t110 zeus saphira cortex-a57.cortex-a53 cortex-a72.cortex-a53 cortex-a73.cortex-a35 cortex-a73.cortex-a53 cortex-a75.cortex-a55 cortex-a76.cortex-a55 generic

This is why I changed the value to "exynos-m1", which is one of the arguments the compiler lists as "valid".

I'm obviously I'm missing something fundamental here, as the original kernel source and you both suggest I should be using either: exynos-m2.cortex-a53; exynos-m2.cortex-a53. Also GCC 9.3.0/10.2.0 docs doesn't support this value for mtune/mcpu?

Am i using the the wrong type of toolchain (googling the suggested mtune value hasn't helped me either). Apologies for appearing stupid, any possibility on expanding how you came to that suggested value and what toolchain supports it (or how i enable it in the current toolchain versions I'm using?)

really appreciate the help/insight. thank you.
[Android Software/Hacking General [Developers Only]] ahsan.pervaiz:
Request for guidance on running a custom Kernel on Pixel 3

Hello!

I've followed your excellent guide to do some basic kernel development for Nexus 6P.

I am currently working with a Pixel 3. And followed the Official Android Compilation Guide from Google (source . android . com/setup/build/building-kernels).

However, I'm having some difficulty running the compiler kernel on the device.

I compiled using the

build/build.sh

script (without using any of the environment variables)

Then I tried to flash the compiled kernel temporarily using

fastboot boot Image.lz4-dtb

However, while the phone would boot into the UI launcher the touchscreen would not work and the UI Launcher did not have a wallpaper.

However, I could still access the phone through ADB.

After a while when the screen turned off the google sign (the one that appears when the phone is booting) reappears and a bit later I would get the same blank UI Launcher as I mentioned earlier. And this process continues over and over again. During this entire time I have uninterrupted access to ADB.

I have using other methods to flash the kernel

1. using the compiled kernel to get a boot.img from the AOSP build tree

2. using anykernel2

However, the end result is always the same.

I would be extremely grateful to anyone who could provide any pointers to solve this issue.

Thank you!!
[Android Software/Hacking General [Developers Only]] nathanchance:
You will need to build the modules into the kernel. For newer kernels, it is a little bit more complicated. Normally, you would just change the '=m' entries in the configuration file to '=y' but there are modules elsewhere. I would recommend using a basic custom kernel like ElementalX or the stock Dirty Unicorns kernel for messing around with stuff, they will allow you to get up and running quickly. You should be able to modify the manifest to sync that down and modify the build.config file to point to the appropriate config.
[Android Software/Hacking General [Developers Only]] Adv0:
Hello.....

I want to develop a custom kernel for a Qualcomm based device (msm8909). Unfortunately i haven't found stock kernel source code for this device and kernel version is very old i.e., 3.10.49. So i have tried google kernel source code to build kernel and it ended up a big failure. The build was done multiple times from different sources but no result so, could you please suggest me which google based kernel should be used to build kernel along with toolchain and defconfig. I do have the stock firmware and i don't mind this device getting bricked. Moreover it's a rooted device (magisk).

Device:

LS-4505 (android verion 6.0.1)

kernel version: 3.10.49 (gcc version 4.8) (armv71)

Qualcomm Snapdragon 210 (ARM Cortex-A7)

Board msm8909

Thanks in advance.
[Android Software/Hacking General [Developers Only]] ahsan.pervaiz:
how to build modules into the kernel for newer kernels

Great! Thank you so much. I replaced the original kernel with a dirty unicorn version of the kernel and it started working using the b1c1_defconfig provided in the kernel. And it worked! Thank you!

However, I need to work on the stock kernel for my work right now. Would you happen to have any pointers on how to build the modules into the kernel?

Any pointers would be a great help. Thank you!
[Android Software/Hacking General [Developers Only]] JinbrianZ:
Compiling 3.18.1** Nokia 6 Source Kernel (Pie)

[MENTION=6842057]nathanchance[/MENTION]

Hello, I need help I got a problem when making the last step without doing any changes in ****_defconfig.

I get stuck in this line with no idea, hereI will attach the error 1 and error2 ss.

there is no vdso.so.dbg in the existing folder either.

I also used this code make CONFIG_NO_ERROR_ON_MISMATCH=y

and this and got the same error.

maybe there is some problem in the kernel source or the linaro gcc?

using different toolchain gives me No such file or directory or deprecated. only linaro works, it also included in the kernel source with has only conf files inside

thanks!~

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

Using:

Windows 10 2004 x64

WSL2 Ubuntu

Linaro GCC 4.9

Nokia Opensource (Nokia6_V6.***.tar.bz2)

https://www.nokia.com/phones/en_int/opensource

Github NokiaDev

https://github.com/nokia-dev/android_kernel_nokia_msm8937

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

Edit: the error has been solved by reinstalling the toolchain, now I've been slowly fixing for some file string which also takes time after compiling and show the errors that need to be fix.
[Android Software/Hacking General [Developers Only]] NullCode:
Updating Kernel

Good Morning/Afternoon/Evening/Night! I do not know if this is the place where I should ask this, but you know this is a kernel thread after all. I have already compiled a kernel for SM-T820 from official Samsung sources. However, my main goal is to *update* the kernel version so that I can, say, make an Android 10 kernel using the Android 9 sources that I have available (Samsung's last source release is with Android 9). Can it be done?

Sorry if I asked a super dumb/off-topic question. My only feat has been in making custom recoveries.
[Android Software/Hacking General [Developers Only]] sdeft:
deleted
[Android Software/Hacking General [Developers Only]] physwizz:
I did it this way

https://xdaforums.com/galaxy-a20/how-to/making-kernel-a20-t4173485

---------- Post added at 10:01 AM ---------- Previous post was at 09:23 AM ----------

https://xdaforums.com/galaxy-a20/how-to/making-kernel-a20-t4173485
[Android Software/Hacking General [Developers Only]] yyq97:
Hi, First of all thank you for your outstanding contribution, I have encountered some problems in the process of compiling the kernel with clang, and hope for your reply.

Im trying to compile the kernel.lnx.4.4.r40-rel with clang, but there are some problems. Error logs are as follows:

CHK include/generated/timeconst.h
UPD include/generated/timeconst.h
CHK include/generated/bounds.h
UPD include/generated/bounds.h
CC arch/arm64/kernel/asm-offsets.s
In file included from ../arch/arm64/kernel/asm-offsets.c:21:
In file included from ../include/linux/sched.h:19:
In file included from ../include/linux/timex.h:56:
In file included from ../include/uapi/linux/timex.h:56:
In file included from ../include/linux/time.h:5:
In file included from ../include/linux/seqlock.h:35:
In file included from ../include/linux/spinlock.h:50:
In file included from ../include/linux/preempt.h:59:
In file included from arch/arm64/include/generated/asm/preempt.h:1:
In file included from ../include/asm-generic/preempt.h:4:
In file included from ../include/linux/thread_info.h:25:
In file included from ../arch/arm64/include/asm/thread_info.h:39:
../arch/arm64/include/asm/stack_pointer.h:7:51: error: register 'sp' unsuitable for global register variables on this target
register unsigned long current_stack_pointer asm ("sp");
^
In file included from ../arch/arm64/kernel/asm-offsets.c:21:
In file included from ../include/linux/sched.h:19:
In file included from ../include/linux/timex.h:56:
In file included from ../include/uapi/linux/timex.h:56:
In file included from ../include/linux/time.h:5:
In file included from ../include/linux/seqlock.h:35:
In file included from ../include/linux/spinlock.h:87:
../arch/arm64/include/asm/spinlock.h:95:28: error: value '65536' out of range for constraint 'I'
: "Q" (lock->owner), "I" (1 << TICKET_SHIFT)
^~~~~~~~~~~~~~~~~
../arch/arm64/include/asm/spinlock.h:123:9: error: value '65536' out of range for constraint 'I'
: "I" (1 << TICKET_SHIFT)
^~~~~~~~~~~~~~~~~
HOSTCC scripts/dtc/livetree.o
3 errors generated.
[Android Software/Hacking General [Developers Only]] y2kbugleung:
This is my first time to compile an Android kernel.

I am following this guide: https://developer.sony.com/develop/...nux-kernel-for-xperia-devices#tutorial-step-3

It always warn me when I run "make":

I have installed the latest GCC 10.2 already:

How should I fix the problem?

Thanks.
[Android Software/Hacking General [Developers Only]] EliasGraf:
Dumping/splitting image failed. Aborting....

I am unable to flash the image with anykernel3 using TWRP 3.4.0-0.

anykernel.sh

# AnyKernel3 Ramdisk Mod Script
# osm0sis @ xda-developers

## AnyKernel setup
# begin properties
properties() { '
kernel.string=ExampleKernel by osm0sis @ xda-developers
do.devicecheck=1
do.modules=0
do.systemless=1
do.cleanup=1
do.cleanuponabort=0
device.name1=dumpling
device.name2=
device.name3=
device.name4=
device.name5=
supported.versions=
supported.patchlevels=
'; } # end properties

# I have tried both "/boot" and "/system" for block
block=/dev/block/platform/soc/1da4000.ufshc/by-name/boot;

is_slot_device=0;
ramdisk_compression=auto;

## AnyKernel methods (DO NOT CHANGE)
# import patching functions/variables - see for reference
. tools/ak3-core.sh;

## AnyKernel file attributes
# set permissions/ownership for included ramdisk files
set_perm_recursive 0 0 755 644 $ramdisk/*;
set_perm_recursive 0 0 750 750 $ramdisk/init* $ramdisk/sbin;

## AnyKernel install
dump_boot;

# begin ramdisk changes

# init.rc
backup_file init.rc;
replace_string init.rc "cpuctl cpu,timer_slack" "mount cgroup none /dev/cpuctl cpu" "mount cgroup none /dev/cpuctl cpu,timer_slack";

# init.tuna.rc
backup_file init.tuna.rc;
insert_line init.tuna.rc "nodiratime barrier=0" after "mount_all /fstab.tuna" "\tmount ext4 /dev/block/platform/omap/omap_hsmmc.0/by-name/userdata /data remount nosuid nodev noatime nodiratime barrier=0";
append_file init.tuna.rc "bootscript" init.tuna;

# fstab.tuna
backup_file fstab.tuna;
patch_fstab fstab.tuna /system ext4 options "noatime,barrier=1" "noatime,nodiratime,barrier=0";
patch_fstab fstab.tuna /cache ext4 options "barrier=1" "barrier=0,nomblk_io_submit";
patch_fstab fstab.tuna /data ext4 options "data=ordered" "nomblk_io_submit,data=writeback";
append_file fstab.tuna "usbdisk" fstab;

# end ramdisk changes

write_boot;
## end install

zip command

zip -r9 kernel.zip * -x .git *placeholder README.md kernel.zip zip up kernel.sh

Kernel I want to compile: cannot post links so just this for you: github/DerpFest-Devices/kernel_oneplus_msm8998
[Android Software/Hacking General [Developers Only]] mateusfmcota:
What's the defconfig from the mia3 kernel?

I'm guessing that is the vendor/laurel_sprout-perf_defconfig but I don't really know
[Android Software/Hacking General [Developers Only]] @fastboot_erase_system:
I am trying to build for phoenixin, getting this error htt ps: //del. dog /gghipuckog

I think this is because of gcc wrapper, which I didn't understand what to do with, I am a newbie so it'd be great if anyone help me, (can't send full del dog link due to xda error)
[Android Software/Hacking General [Developers Only]] TheViciousGames:
Does this work with 2020 phones?

I have no experience in kernel development.

---------- Post added at 01:11 PM ---------- Previous post was at 01:10 PM ----------

Does this work with 2020 phones?

I have no experience in kernel development.
[Android Software/Hacking General [Developers Only]] Uzephi:
from source, same build errors. When I do my make o=out msm-perf_defconfig I do see odd errors that might be contributing to the erros I had to correct and maybe I corrected them wrong. Below is the error.

warning: (SND_SOC_MSM8996) selects SND_SOC_MODS_CODEC_SHIM which has unmet direct dependencies (SOUND && ~N68K && !UNL && SND && SND_SOC && MODS_CODEC_BUS)
drivers/video/fbdev/slimport/Kconfig:1:warning: multi-line strings not supported

When I try to build with an output now I get the error:

drivers/built-in.o: In function 'dwc3_msm_remove':
/home/uzephi/android/kernel/Nash_Kernel/drivers/usb/dwc3/dwc3-msm.c:3759: undefined reference to 'usb_ext_unregister_notifier'
/home/uzephi/android/kernel/Nash_Kernel/drivers/usb/dwc3/dwc3-msm.c:3759:(,text+0x351f98): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol 'usb_register_notifier'

Others in same file and a file in "sound/soc/codecs/mods_codec_shim" call26. different symbol, but same error besides that. Seems there is a file missing in source, or is it something else? If pointed in the right direction, I can fix it.

Original source: https://github.com/MotorolaMobilityLLC/kernel-msm/tree/nougat-7.1.1-release-nash only edits I did were to bad sym links (<> or " " incorrectly called, if I didn't fix that it would give me an error file not found, so I had to change those calls)

Edit: I used your toolchain and Google's 4.9 toolchain, both give that same error.
[Android Software/Hacking General [Developers Only]] nathanchance:
Sigh... I see what's going on here. Open arch/arm64/configs/ext_config/moto-msmcortex.config. They have added all of their changed config options to this file, so you need to copy them into the msmcortex-perf_defconfig file. This would be a great time to create your own defconfig (copy msmcortex-perf_defconfig to whatever name you want to give your defconfig, open that file, copy the contents of the Motorola specific file to the end, and save it). I don't recommend regenerating the full defconfig like most kernel developers do as it can become difficult to see what was changed from the default value and what was changed specifically by the OEM.

I was able to just compile the kernel successfully with Google's stock toolchain, using only an out folder (no header edits needed).
[Android Software/Hacking General [Developers Only]] Uzephi:
That was from Motorola's Git? If I go directly from their git. I get flooded with errors on about 20-30 .c files like the attached image. I have to go and fix <> to "". Could it be something in my machine then?

Edit: found my issue. I wasn't specifying branch so it was erring on their current "working" branch since the defconfig for my device isn't the same for the "working" device. Man, Motorola should better separate that.
[Android Software/Hacking General [Developers Only]] nathanchance:
Here's what I did:

git clone https://github.com/MotorolaMobilityLLC/kernel-msm -b nougat-7.1.1-release-nash
cd kernel-msm
mkdir out
export ARCH=arm64 && export SUBARCH=arm64
export CROSS_COMPILE=blah
cp arch/arm64/configs/msmcortex-perf_defconfig arch/arm64/configs/flash_defconfig
cat arch/arm64/configs/ext_config/moto-msmcortex.config >> arch/arm64/configs/flash_defconfig

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

That should build (it did for me at least).

EDIT: Didn't catch your edit haha. Hopefully it builds without issues now!
[Android Software/Hacking General [Developers Only]] Uzephi:
Yes, I didn't specify branch so it was trying to build the 7.1.1-nash config on their "working" branch which is a ICS device since Motorola didn't like doing a repo for each device. That was my stupidity.

Edit: it built and booted! Now to attempt editing it. Thanks again for verifying it was user errors except for those extra lines of code tucked away in a different file, great find.
[Android Software/Hacking General [Developers Only]] zurik:
I Get error Makefile:796: *** multiple target patterns. Stop.
[Android Software/Hacking General [Developers Only]] nathanchance:
The <arch> part is your architecture, which for bullhead is arm64. So go to arch/arm64/configs and find the relevant defconfig to use (probably bullhead_defconfig or whatever a custom kernel has named theirs). It's generally obvious looking at the list of configs in that folder.

Going to have to be more specific with your commands and output for further help though.
[Android Software/Hacking General [Developers Only]] zurik:
I typed "make clean" and it gives me this error
[Android Software/Hacking General [Developers Only]] nathanchance:
Okay... still doesn't tell me much. You're following the guide right?
[Android Software/Hacking General [Developers Only]] zurik:
What I did:

1. cd /home/user/Kernel

2. git clone -b android-msm-bullhead-3.10-oreo-r4 https://android.googlesource.com/kernel/msm/ bullhead

3. git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9

4. cd /home/user/Kernel/bullhead

5.

5.1. git remote add jolla https://github.com/jollaman999/jolla-kernel_bullhead

5.1.1. git fetch jolla

5.1.2. git cherry-pick <commit> (around 15 commits for kcal yellow screen fix and 1 for SafetyNet bypass)

5.2. git remote add franco https://github.com/franciscofranco/bullhead

5.2.1. git fetch franco

5.2.2. git cherry-pick <commit> (1 commit for wakelock restriction)

5.3. git remote add shadow https://github.com/mortezadadgar/shadow (Shadow Kernel for Bullhead)

5.3.1. git fetch shadow

5.3.2. git cherry-pick <commit> (1 commit for 2% battery drop fix)

6. cd ... (Moved to "Kernel" folder, not the source)

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

8. export ARCH=arm64 && export SUBARCH=arm64

9. cd /home/user/Kernel/bullhead

10. make clean

and then I get the error Makefile:796: *** multiple target patterns. Stop.