yashsingh1/xdaforums huggingface dataset:
[Android Software/Hacking General [Developers Only]] KaMyKaSii:
I thought the required compression method was already set, after all I'm compiling the stock kernel with (apparently) the stock defconfig. Anyway, I edited ze554kl-user-sdm660-perf_defconfig by uncommenting/setting CONFIG_RD_LZ4=y and adding CONFIG_CRYPTO_LZ4=y. Even so, the kernel Image binaries remain very large (roughly the same size as before, difference of a few bytes/kilobytes). One interesting thing is that the /out/vmlinux.o binary has 629.9MB and /out/vmlinux has 251.2MB, so I think the kernel Image binaries were already being compressed from the beginning. Attached is defconfig, I hope you can take a look.

And one question: do I need to make clean && make mrproper after every successful make? I ask this because after a successful make, I can never finish another make after doing some modification in the defconfig file (and then make defconfig), then I have to delete the kernel source folder and start the whole process from the beginning, this time making all the desired modifications before make defconfig && make
[Android Software/Hacking General [Developers Only]] :
These sound more promising:

CONFIG_LZO_COMPRESS=y

CONFIG_LZO_DECOMPRESS=y

CONFIG_LZ4_COMPRESS=y

CONFIG_LZ4_DECOMPRESS=y

I don't know if supported by your kernel
[Android Software/Hacking General [Developers Only]] KaMyKaSii:
Okay so I just have to add these lines to my defconfig file and then make defconfig && make? Is there a need to undo the changes I've already made (which I quoted in my previous post)?

Edit: compiled but still the same size :/
[Android Software/Hacking General [Developers Only]] ashu7073:
I have used 3 compilers but still same problem. Kernel boots straight to fastboot. Stock zImage is 10mb and Image.gz-dtb is of 25mb. There are another two file image and Image.gz
[Android Software/Hacking General [Developers Only]] KaMyKaSii:
So your device is not booting with Image.gz-dtb when replacing the stock zImage with it? I was having the same problem here. The solution was to extract the dtb from the stock zImage (with this python script) and then concatenate the extracted dtb in the same sequence with my compiled Image.gz (cat Image.gz 01dtb 02dtb ... 08dtb > Image.gz-working-dtb)
[Android Software/Hacking General [Developers Only]] ashu7073:
Thank you so much bro. I compiled my first kernel because of you.
[Android Software/Hacking General [Developers Only]] KaMyKaSii:
You're welcome! And if you figure out how to compile generating a functional Image.gz-dtb, let me know :)
[Android Software/Hacking General [Developers Only]] zeratull:
make -j$(nproc --all) O=out ARCH=arm64 SUBARCH=arm64 CC="/home/zeratull/Desktop/kernel/toolchain/clang/bin/clang" CLANG_TRIPLE=aarch64-linux-gnu- CROSS_COMPILE="/home/zeratull/Desktop/kernel/toolchain/gcc/bin/aarch64-linux-android-"
make[1]: Entering directory '/home/zeratull/Desktop/kernel/op6-try/out'
arch/arm64/Makefile:58: *** CROSS_COMPILE_ARM32 not defined or empty, the compat vDSO will not be built. Stop.
make[1]: Leaving directory '/home/zeratull/Desktop/kernel/op6-try/out'
Makefile:152: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2

Can anyone help me this error? i did search on google but ı didnt any clear answer.
[Android Software/Hacking General [Developers Only]] KaMyKaSii:
I'm not an expert but it looks like you're trying to use gcc and clang at the same time to compile the kernel. Why?
[Android Software/Hacking General [Developers Only]] zeratull:
Thanks but ı am getting same error with clang or without clang.
[Android Software/Hacking General [Developers Only]] KaMyKaSii:
And why are you having so many parameters in the final make? Try to run each one at a time, the commands below worked for me in an open terminal in the root folder of the kernel source (do everything in a new folder with the kernel source, to avoid problems with previous compilations)

export CROSS_COMPILE=/home/matheus/kernel_building/aarch64-linux-android-4.9/bin/aarch64-linux-android-
export ARCH=arm64
make clean
make mrproper
make O=out ze554kl-user-sdm660-perf_defconfig
make O=out -j$(nproc --all)
[Android Software/Hacking General [Developers Only]] janjan:
Delete

---------- Post added at 08:10 PM ---------- Previous post was at 08:09 PM ----------

You are missing to set up CROSS_COMPILE_ARM32..

ARCH=arm64 SUBARCH=arm64 CC=/path.... CLANG_TRIPLE=aarch64-linux-gnu-

CROSS_COMPILE=/path..... CROSS_COMPILE_ARM32=/path..... Your defconfig... make -j$(nproc --all) O=out
[Android Software/Hacking General [Developers Only]] Geckyn:
Can I upstream stock kernel 3.18.71 or it has to be CAF rebased before

---------- Post added at 02:32 AM ---------- Previous post was at 02:30 AM ----------

Can I upstream stock kernel or it has to be CAF rebased before
[Android Software/Hacking General [Developers Only]] eremitein:
[MENTION=6842057]nathanchance[/MENTION] , hello and thanks you

i need a help, i'm confused:eek:

i try compile msm-3.18 for Xiaomi Mi A2 lite (named "daisy") with -O2 optimization.

wifi module for "daisy" is a prima CAF and he should be external and signed. and this is a trouble, because when kernel and modules compiled with -O2 flag i got "Error exec format" while try loading wifi module. with -O2 for kernel and -Os for module i had same error. only -Os for all works good.

any suggestions?
[Android Software/Hacking General [Developers Only]] zaibansari20:
Can someone please tell me how can I add Faux sound gain in kernel
[Android Software/Hacking General [Developers Only]] kevintm78:
It looks like your cross compiler is not set. Before you start your build run:

export CROSS_COMPILE=/path/to/toolchain
[Android Software/Hacking General [Developers Only]] tripLr:
Nice guide
[Android Software/Hacking General [Developers Only]] Adi5:
Hi. First time iam using clang for compile kernel and have error:

PATH="/home/adiszyman1/abc/clang/clang-r353983/bin:/home/adiszyman1/abc/gcc/bin/aarch64-linux-android-/bin:${PATH}" make -j$(nproc --all) O=out ARCH=arm64 CC=clang CLANG_TRIPLE=aarch64-linux-gnu- CROSS_COMPILE=aarch64-linux-android-

make[1]: Entering directory '/home/adiszyman1/abc/kernel/xiaomi/sdm660/out'

CHK include/config/kernel.release

GEN ./Makefile

CHK include/generated/uapi/linux/version.h

Using .. as source for kernel

CHK include/generated/utsrelease.h

CHK scripts/mod/devicetable-offsets.h

CHK include/generated/timeconst.h

CHK include/generated/bounds.h

CHK include/generated/asm-offsets.h

CALL ../scripts/checksyscalls.sh

VDSOL arch/arm64/kernel/vdso/vdso.so.dbg

/usr/bin/ld: unrecognised emulation mode: aarch64linux

Supported emulations: elf_x86_64 elf32_x86_64 elf_i386 elf_iamcu i386linux elf_l1om elf_k1om i386pep i386pe

clang-9: error: linker command failed with exit code 1 (use -v to see invocation)

make[2]: *** [../arch/arm64/kernel/vdso/Makefile:48: arch/arm64/kernel/vdso/vdso.so.dbg] Error 1

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

make[1]: Leaving directory '/home/adiszyman1/abc/kernel/xiaomi/sdm660/out'

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

tried cross compile 32 into vdso but still same problem
[Android Software/Hacking General [Developers Only]] janjan:
diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile
index 837e877a326b..fc59440258b2 100644
--- a/arch/arm64/kernel/vdso32/Makefile
+++ b/arch/arm64/kernel/vdso32/Makefile
@@ -6,6 +6,10 @@

ifeq ($(cc-name),clang)
CC_ARM32 := $(CC) $(CLANG_TARGET_ARM32) -no-integrated-as
+ GCC_ARM32_TC := $(realpath $(dir $(shell which $(CROSS_COMPILE_ARM32)ld))/..)
+ifneq ($(GCC_ARM32_TC),)
+ CC_ARM32 += --gcc-toolchain=$(GCC_ARM32_TC)
+endif
else
CC_ARM32 := $(CROSS_COMPILE_ARM32)$(cc-name)
endif
[Android Software/Hacking General [Developers Only]] zaibansari20:
Can anyone tell me how can I add sound gain in kernel source
[Android Software/Hacking General [Developers Only]] eremitein:
hello again)

i catch some info about trouble with latest prima wlan + latest msm-3.18 and O2 flag build

dmesg show me this:

[ 1033.962049] wlan: module is from the staging directory, the quality is unknown, you have been warned.

[ 1033.984990] module wlan: overflow in relocation type 261 val ffffffbffc2564a4

what is "overflow in relocation type 261 val ffffffbffc2564a4" mean?

how to deeply debug this and fix in source code?

thanks
[Android Software/Hacking General [Developers Only]] GATTYDELY:
anyone know overclock custom kernel? Thank you.
[Android Software/Hacking General [Developers Only]] tripLr:
@nathanchance , I am building lineageos trlte ( 910v) and I updated the roomservice.xml and got the linero 7.4 cross compiler correctly repo synced and downloaded for the kernel in the prebuilts folder,, but the build process still looks for the older 7.3 . So i added that back in the roomservice, did a repo sync, and am recompiling. where does the cross compile command need to be updated ?

Thanks, and your invited to my server if you wish. telegram me at https://t.me/joinchat/E96qPldYN8y1KzykF4-Xxw

https://xdaforums.com/chef-central/android/guide-noobs-complete-t3885363/post78567799#post78567799
[Android Software/Hacking General [Developers Only]] tycoon78[stoner]:
can anyone here guide me how to add f2fs support in samsung kernel? and add f2fs suopprt in twrp too. sorry i'm still a noob.
[Android Software/Hacking General [Developers Only]] onliner:
Merge f2fs branch from Google and add this in your defconfig:

CONFIG_F2FS_FS=y

CONFIG_F2FS_FS_SECURITY=y

CONFIG_F2FS_CHECK_FS=y

CONFIG_F2FS_FS_ENCRYPTION=y
[Android Software/Hacking General [Developers Only]] ramast_:
Hi Nathan,

Thank you very much for your brilliant tutorial!

First:

I'd kindly request that you add this line to your original tutorial as it would reduce chances of people bricking their devices:

Second:

Never mind, spoke too soon. I still can't get the kernel to boot.

I've followed all the steps but the produced image never booted for me so I've spent two days trying to figure it out.

This comment is relevant to those of you who are trying to compile for a Qualcomm device (in my case Lenovo 6010).

Before reading any further, print the content of the file split_img/boot-dtbtype It should be

QCDT

.

If this is not the case, this guide/comment is probably not for you.

When using AIK script, it's not enough to replace the kernel. You also need to generate a QCDT (Qualcomm device tree) file and place it instead of the existing boot-dtb file.To produce that file you need to issue this commands in your kernel directory (after successful kernel compilation).

./dtbToolCM -s 2048 -p ./scripts/dtc/ -o boot-dtb arch/arm/boot/dts/

Note: if you are compiling arm64 kernel, u would replace arm above with arm64

If the command succeeded, u should have "boot-dtb" file in your current directory. Copy it over along with your kernel before repacking your boot image.

Reference: https://wiki.postmarketos.org/wiki/Mainlining_Guide#QCDT_devices

Happy Hacking
[Android Software/Hacking General [Developers Only]] tycoon78[stoner]:
Thanks for the reply.

I wanna compile twrp with f2fs support too coz when I try to change my data to f2fs the cache partition doesn't show up in mount section. Plus it gives error while flashing anything. How to add f2fs support in twrp?
[Android Software/Hacking General [Developers Only]] Uzephi:
Some kernel source doesn't have the WiFi driver with it. Motorola is notorious for this, but in their release readme, they do give instructions on how to add in the WiFi driver from Qualcomm. Best to check your source readme.
[Android Software/Hacking General [Developers Only]] Uzephi:
Odd your OEM didn't give you instructions... Motorola did for most of their releases...

https://github.com/MotorolaMobilityLLC/readme/blob/master/MMI-OPX27.109-34.txt is for the Z2.

Edit: I just followed that to install my CAF module, so I wouldn't know for your kernel.
[Android Software/Hacking General [Developers Only]] Uzephi:
Depends on the oem.
[Android Software/Hacking General [Developers Only]] hoenhind:
I have the same problem. I have a lenovo device with msm8937.The problem is that the open source code on their website does not have any wlan drivers.There is no reference to what is the current CAF tag or any instructions on how to merge the wlan drivers ? I tried a lot of steps but all failed.I gave up eventully. If you find a solution on how to do it please do tell.

Thanks
[Android Software/Hacking General [Developers Only]] Vats12:
How to select the toolchain for a 64-bit android device?

Thanks for the great introduction. I am very new to kernel customization and I need a help in choosing the right tool-chain for my OnePlus 6T kernel source code.

I have downloaded kernel source from https://github.com/OnePlusOSS/android_kernel_oneplus_sdm845.git

I found "[ro.product.cpu.abi]: [arm64-v8a]" in device properties. So this device is based on 64-bit architecture.

Then I went to the https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/ link which you have given in your description. I am confused on which branch I should clone for my device OR is it fine to continue with other step by choosing the master branch from google tool-chains?

Please guide me. I will be very helpful to you.

Thanks.
[Android Software/Hacking General [Developers Only]] Sands207:
Was it necessary to quote the entire OP?
[Android Software/Hacking General [Developers Only]] onliner:
1- The cross compile ARM32 should have the path of the arm toolchain.

2- Sultan uses GCC to build his kernel, so he disabled the Clang-related features in the defconfig (check the defconfig history to revert the commits) and he did some treewide changes to fix GCC warnings that can cause problems with Clang (Again, check the history to revert the commits).
[Android Software/Hacking General [Developers Only]] Vats12:
I am just new to this site and was not familiar with "
[Android Software/Hacking General [Developers Only]] Vats12:
Hi RogerF81,

I am able to compile the kernel source code for my OnePlus 6T device as following:

- Download latest dtc from https://packages.ubuntu.com/cosmic/amd64/device-tree-compiler/download and install it.

- Clone kernel source code: git clone https://github.com/OnePlusOSS/android_kernel_oneplus_sdm845.git

- Clone ToolChain: git clone -b linaro-4.9-arm-linux-androideabi https://github.com/ArchiDroid/Toolchain prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-linaro-4.8

- Open terminal at prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-linaro-4.9 and run: export CROSS_COMPILE=$(pwd)/bin/aarch64-linux-android-

- Navigate to kernel source code path in the same terminal.

- export ARCH=arm64 && export SUBARCH=arm64

- make clean

- make mrproper

- mkdir Out

- make O=Out sdm845_defconfig

- make O=Out DTC_EXT=dtc CONFIG_BUILD_ARM64_DT_OVERLAY=y DTC_EXT=dtc -j4

Following are the last lines of compilation:

```

CC drivers/media/platform/msm/broadcast/tspp.mod.o

CC drivers/media/platform/msm/dvb/adapter/mpq-adapter.mod.o

CC drivers/media/platform/msm/dvb/demux/mpq-dmx-hw-plugin.mod.o

GZIP arch/arm64/boot/Image.gz

CC drivers/soc/qcom/llcc_perfmon.mod.o

CC drivers/video/backlight/lcd.mod.o

CC net/bridge/br_netfilter.mod.o

LD [M] drivers/char/rdbg.ko

LD [M] drivers/media/platform/msm/broadcast/tspp.ko

LD [M] drivers/media/platform/msm/dvb/adapter/mpq-adapter.ko

LD [M] drivers/media/platform/msm/dvb/demux/mpq-dmx-hw-plugin.ko

LD [M] drivers/soc/qcom/llcc_perfmon.ko

LD [M] drivers/video/backlight/lcd.ko

LD [M] net/bridge/br_netfilter.ko

CAT arch/arm64/boot/Image.gz-dtb

make[1]: Leaving directory '/home/.../KernelCustomization/android_kernel_oneplus_sdm845/Out'

```

If it helps you then I will be glad :)

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

I need help in determining the correct image file that I should use to flash on my device. Is it

- arch/arm64/boot/Image.gz-dtb OR

- arch/arm64/boot/Image.gz OR

- arch/arm64/boot/Image

If any can share this knowledge with me OR any relevant link then I will be very thankful to that person.

Happy Codding.
[Android Software/Hacking General [Developers Only]] Vats12:
I need a favour in:

- What image can I use to flash on android device?

- Is booting a image with TWRP is enough to flash kernel?

Is anyone kind enough to help me?
[Android Software/Hacking General [Developers Only]] Vats12:
Found Google documentation

https://source.android.com/devices/bootloader/partitions-images

As per following lines from google documentation:

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

boot: The boot partition contains a kernel image and a RAM disk combined via mkbootimg. In order to flash the kernel directly without flashing a new boot partition, a virtual partition can be used:

kernel: The virtual kernel partition overwrites only the kernel (zImage, zImage-dtb, Image.gz-dtb) by writing the new image over the old one. To do this, it determines the start location of the existing kernel image in eMMC and copies to that location, keeping in mind that the new kernel image may be larger than the existing one. The bootloader can either make space by moving any data following it or abandoning the operation with an error. If the development kernel supplied is incompatible, you may need to update the dtb partition if present, or vendor or system partition with associated kernel modules.

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

I think I have to use arch/arm64/boot/Image.gz-dtb for flashing the kernel. My understanding is that Image.gz-dtb is a virtual image that can be used to flash only kernel on android.

I understand all the steps that are mentioned in this thread to unpack and pack the kernel image except the first step i.e.

"Pull your device's boot image from the latest image available for your device (whether it be a ROM or stock)"

How to pull the device boot image?

(I think you are saying to pull the image from the OS that is currently running on my Oneplus 6T device but I am not sure how to pull that image file)

Any help or guidance will be very helpful at this moment.
[Android Software/Hacking General [Developers Only]] thenotonly:
Hi Guys,

I am getting the following error trying to compile stock kernel for lg g7 from source:

arch/arm64/boot/dts/lge/sdm845-v2.1-judyln_lao_com_kr_rev-1.0-overlay.dtbo

./scripts/dtc/dtc: invalid option -- '@'

Usage: dtc [options] <input file>

I have removed GCC Wrapper by patching Makefile using code from OP so that it would compile using linaro-4.9. Compilation went fine until I activated CONFIG_BUILD_ARM64_DT_OVERLAY=y in defconfig, which resulted in the error stated above. I have also tried to update dtc which is V1.4.1 to 1.4.6 using update-dtc-source.sh which uses linux dtc source but it throws off some other errors.

I found out other kerrnel devs were able to compile using DTC v1.4.2 and 1.4.6 but was unable to compile with their dtc code.

Could someone please help me out.

edit:

I was able to compile by installing the latest DTC on ubuntu dtc v1.4.7 and exporting DTC_EXT="dtc -f"

Would not compile using only DTC_EXT=dtc, log below:

arch/arm64/boot/dts/lge/sdm845-v2.1-judyln_lao_com_kr_rev-b-overlay.dtbo: ERROR (duplicate_label): /fragment@86/__overlay__/qcom,smb2-vbus: Duplicate label 'smb 2_vbus' on /fragment@86/__overlay__/qcom,smb2-vbus and /fragment@3/__overlay__/q com,smb2-vbus

ERROR: Input tree has errors, aborting (use -f to force output)

../arch/arm64/boot/dts/lge/Makefile:104: recipe for target 'arch/arm64/boot/dts/ lge/sdm845-v2.1-judyln_lao_com_kr_rev-b-overlay.dtbo' failed

make[3]: *** [arch/arm64/boot/dts/lge/sdm845-v2.1-judyln_lao_com_kr_rev-b-overla y.dtbo] Error 2

Any idea how to fix this guys?
[Android Software/Hacking General [Developers Only]] legents:
Hi, I see that this post is a bit old but I am facing the exact same issue you had with crosshatch here and hopefully you are able to help me, could you please share how you fixed it exactly? I am using the source below:

https://android.googlesource.com/kernel/msm/+/refs/heads/android-msm-crosshatch-4.9-pie-qpr3

I would really appreciate your help
[Android Software/Hacking General [Developers Only]] janjan:
To old to remember.. do u mind to tell me what is the issue? I can try to help u
[Android Software/Hacking General [Developers Only]] GreatLifehacker:
I'm trying to compile FrancoKernel from his repo, I'm using linaro toolchain (aarch64) my build always getting stopped by some errors related to Misleading indentation like this [note: this statement, but the latter is misleadingly indented as if it were guarded by the 'if'] I tried removing GCC wrapper as instructed in the OP still no luck, Any help would be really appreciated
[Android Software/Hacking General [Developers Only]] onliner:
Hi, you need to disable the misleading indentation warning in Makefile.
[Android Software/Hacking General [Developers Only]] GreatLifehacker:
Actually that appears as an error for me, I tried

make all WARNINGS_AS_ERRORS=n

no luck, Can you help me by explaining that in detail? That would be great
[Android Software/Hacking General [Developers Only]] palmbeach05:
I'm having issues with the make and mrproper stage. When i enter those in, it basically says it doesn't know what to do. Any ideas? Using google prebuilt arm-linux-androideabi-4.9
[Android Software/Hacking General [Developers Only]] ramast_:
You need to have a file called "Makefile". If this file doesn't exist then this is not kernel source code or you are in wrong directory
[Android Software/Hacking General [Developers Only]] palmbeach05:
This is a screenshot of the github kernel source. This is the makefile you are referring to?
[Android Software/Hacking General [Developers Only]] ramast_:
Yes, this is the file I am referring to.

Are you sure this is an Android kernel and not a normal Linux kernel?
[Android Software/Hacking General [Developers Only]] palmbeach05:
I'll ask the dumb question, what's the difference between the two? Yes this build i am attempting to make is for an android phone if that helps
[Android Software/Hacking General [Developers Only]] ramast_:
What's the difference between the two is very technical subject but what you need to know is that Linux kernel won't work on an Android phone.

Also not any android kernel will work for your phone. You need to find Android kernel source code that is designed specifically for your phone model. Even a kernel for same brand but different model almost certainly won't work.
[Android Software/Hacking General [Developers Only]] palmbeach05:
Ok, i can understand that much. Yes i am using an existing kernel source code for my device, which has been used for builds for my device.
[Android Software/Hacking General [Developers Only]] Dhina17:
How to fix this error...I m trying to build stock kernel with gcc 4.7

Dhina17@instance-1:~/android/kernel/erax$ make -j2

CHK include/generated/uapi/linux/version.h

CHK include/generated/utsrelease.h

make[1]: 'include/generated/mach-types.h' is up to date.

CC scripts/mod/devicetable-offsets.s

CALL scripts/checksyscalls.sh

GEN scripts/mod/devicetable-offsets.h

HOSTCC scripts/mod/file2alias.o

HOSTLD scripts/mod/modpost

CHK include/generated/compile.h

LINK vmlinux

LD vmlinux.o

MODPOST vmlinux.o

WARNING: modpost: Found 3 section mismatch(es).

To see full details build your kernel with: 'make CONFIG_DEBUG_SECTION_MISMATCH=y'

GEN .version

CHK include/generated/compile.h

UPD include/generated/compile.h

CC init/version.o

LD init/built-in.o arch/arm/lib/lib.a(memcmpksm.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'

make: *** [Makefile:796: vmlinux] Error 1

Dhina17@instance-1:~/android/kernel/erax$
[Android Software/Hacking General [Developers Only]] Villard_hzq:
What is different between these two toolchain (big-endian-linux-gnu and linux-gnu)?

how to choose

https://developer.arm.com/tools-and...developer-tools/gnu-toolchain/gnu-a/downloads
[Android Software/Hacking General [Developers Only]] nathanchance:
All Android devices are little endian so you want the regular aarch64-linux-gnu one.
[Android Software/Hacking General [Developers Only]] sumit17:
error : btfm_slim.h no such directory .

but it is in the directory. could not find the solution. compiling lineage kernel for msm8953 xiaomi device