yashsingh1/xdaforums huggingface dataset:
[Android Software/Hacking General [Developers Only]] goryu:
I'm a noob at kernel development.

I only have the resources of using my OnePlus7t HD1907

OnePlus 7t HD1907 Kernel version 4.19.157-per+

ASOP PixelExperience 12.1 Rooted using Magisk

I complied everything on my OnePlus 7T so I didn't know if I needed a CROSS_COMPILE option.

Using termux I chrooted into ubuntu 22.04 then I compile the 5.16.x kernel from gitlab sm8150 oneplus7

Termux$su

Termux#cp /proc/config.gz UbuntuChroot/root/newkernelfolder/.config

Termux#exit

Termux$sudo ./startUbuntuChroot.sh

UbuntuChroot~#cd newKernelfolder

UbuntuChroot~/newKernelfolder#apt install *required dependencies

UbuntuChroot~/newKernelfolder#ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make hotdogb_defconfig

UbuntuChroot~/newKernelfolder#make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- menuconfig

I checked the Virtualization slot saved to .config then exit the menuconfig. I don't know if this enables KVM so here it goes.

UbuntuChroot~/newKernelfolder#ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make -J6 (took about 10 minutes)

I successfully compiled it and checked the folder where I can find the kernel image.

UbuntuChroot~/newKernelfolder#cd /arch/arm64/boot/

In this folder I found the files Image, Image.gz, Makefile, dts(folder)

Ok this is how far I got with my knowldege of what I think I'm doing right. I want to know how can I make a boot.img so I test this on my OnePlus 7t. I don't care if I brick it because I have another phone. My goal was to enable kvm on it.

I'm confused is to if I'm doing all this right or if I'm missing any steps. How do I create a boot.img from the steps above?
[Android Software/Hacking General [Developers Only]] V3rB0se:
you can use AnyKernel3 template to flash the kernel. no need to unpack and repack the boot.img.
[Android Software/Hacking General [Developers Only]] SlendowManX:
I always keep getting these errors
[Android Software/Hacking General [Developers Only]] xdroidfreakz:
did you solve this?
[Android Software/Hacking General [Developers Only]] bksvc:
Sorry for the late reply i tried with clang and it worked

really thank you ^^
[Android Software/Hacking General [Developers Only]] OTROfficial:
Do you fixed that error? I have the same with SM-G988B
[Android Software/Hacking General [Developers Only]] lolvatveo:
how to make dt.img? I want it to replace old dt.img in boot.img
[Android Software/Hacking General [Developers Only]] bksvc:
I fixed it with the system's own cross compiler.

if you are using a debian based linux distribution you can install it with apt.

also thank you i lost this thread ^^
[Android Software/Hacking General [Developers Only]] bksvc:
Thank you, I couldn't reply because I lost the topic.

When I exported the directory of gcc and clang installed on my system, it worked, but I still could not find the source code of the kernel of my SM-N980F/DS(Samsung Exynos 990) :')
[Android Software/Hacking General [Developers Only]] OTROfficial:
yes, I use linux, but I'm not very good at building the kernel. You didn't manage to build it?
[Android Software/Hacking General [Developers Only]] OTROfficial:
For this one i want to build the Nethunter Kernel but i don't know how do this. If you have time please help me ...
[Android Software/Hacking General [Developers Only]] nalas:
GitHub - ThunderStorms21th/S20-priv: Samsung Galaxy S20 kernels - in use

Samsung Galaxy S20 kernels - in use. Contribute to ThunderStorms21th/S20-priv development by creating an account on GitHub.

github.com

E g. Here us for G and N98xx
[Android Software/Hacking General [Developers Only]] bksvc:
I did a hard research about 30 minutes ago and I found it but I found out that I need to link the dtb structure to my Image file but I have no idea how to do it

Thank you again ^^
[Android Software/Hacking General [Developers Only]] OTROfficial:
You have other phone model then me?
[Android Software/Hacking General [Developers Only]] OTROfficial:
Do use telegram?
[Android Software/Hacking General [Developers Only]] nalas:
Look at ts-build.sh script...there is make and add dtb into img and dt.configs folder and arch/arn64/boot/

with using android image kitchen
[Android Software/Hacking General [Developers Only]] nalas:
Generally Samsung kernels uses GCC 4.9 and clang 6 for 4.14.xxx and clang 8 for 4.19.xxx 10 for 5.xx.xxx ect. For linaro 5.5 you have to check whitch gcc it uses and add commits for silece and fix gcc compile scripts.... for s10 you have a lot of aosp kernels with google clangs 6.02 and newer with fixed commits.... on xda with github sources....cherry-pick them.... for linaro...i dont think is used for sammy exynos bcose is for snapdragon... its my opinion...
[Android Software/Hacking General [Developers Only]] prt23:
Tried building it with GCC 4.9 it Gave me an error saying the compiler is not supported as it needs GCC 5.1 and above. Wheird stuff, maybe some custom stuff added by lineage but I will try another version
[Android Software/Hacking General [Developers Only]] prt23:
Nah, I already tried several different versions off GCC/Clang, from Linaro,from googles own repo etc.

Ive read into the code a bit and changed something, solved one error but made another. I think thats how far my skills go, so im just gonna use a different Kernel
[Android Software/Hacking General [Developers Only]] prt23:
I actually continued on trying different things and used the -i option of make.

It ignores all errors and compiles anyway. I got all the DTB/DTBO files but it didnt compile the Image itself:

make[1]: *** No rule to make target 'vmlinux', needed by 'arch/arm64/boot/Image'. Stop.

make: [arch/arm64/Makefile:168: Image] Error 2 (ignored)

make[1]: *** No rule to make target 'vmlinux', needed by 'arch/arm64/boot/Image'. Stop.

make: [arch/arm64/Makefile:171: Image.gz] Error 2 (ignored)

Update: Tried compiling the Official Kernel for the SM-G973F and got the same errors, tried it with several different compilers always same result:make only returns script errors, make -i compiles the kernel but Image isnt created because of the vmlinux problem. Tried Compiling vmlinux itself, normal command doesnt work, -i returns:

security/built-in.o: No such file or directory

make: [Makefile:1140: vmlinux] Error 1

At this point I dont know what to do, I cannot understand how ThundersStorm or the Cruel kernel compile succesfully (tried that too btw, worked like a charm, tried analysing and comparing that code to lineage/official one, dont understand crap.)

Maybe all of these errors are a result of me using WSL, but that wouldnt make sense either because im building everything in a dir that I have perms in (the $home dir)

These are Issues that go far beyond my coding abilities, I will give up here.

Sadly the lineageos 19.1 Kernel Repo has Issues closed, otherwise I would have commited an Issue

Thx for the Help tho :)
[Android Software/Hacking General [Developers Only]] nalas:
I use Linux mint 20.2 on my virtual machine on PC...with some essential install modules for compile...maybe you have to install this too... look at cruel or mine description what to install dev package for compile...
[Android Software/Hacking General [Developers Only]] bksvc:
after compile kernel i have Image file & DTS configs but i cant merge Image file and DTS files

Also, there was no result for the files you mentioned.

How can I find out which of these dts files belong to my phone?
[Android Software/Hacking General [Developers Only]] nalas:
Here you have ....for each onecdevice dtb's and what I add into boot.img... for s20 n20 no dtbo needed. Dtbo I added only for s10 n10...but generally this is not changed by me and are original...so i can remove them...and stay only at dtb exynos9820 9825. In python build script is for s10 n10 in build file in prime folder. For s20 n20 in ts-build.sh file in prime folder.
[Android Software/Hacking General [Developers Only]] bksvc:
I repackaged the rebuilt kernel into the stock boot.img file and flashed it to my device and it gave me such an error

[DTH] dt table header check Fail: FDT_ERR_BADMAGIC

[UFDT] DTB LOAD FAIL.

how can i solve this?

i'm a beginner and i ask a lot of questions i'm really sorry about that ^^
[Android Software/Hacking General [Developers Only]] nalas:
Looks like you have wrong name. Compare this with yours names... means samsung and yours...
[Android Software/Hacking General [Developers Only]] lolvatveo:
MUST HELP!!!

hello sir I just find out the new reason why my phone doesn't apply new kernel feature I added. That is I don't update dt.img into boot.img for phones, most modern phones need custom dt.img when using custom kernel. The dtb files are compiled at the same time as the kernel is compiled, I need to create, merge the dtb files to dt.img, but the important thing is I need to do it successfully. And it's a big mistake that most kernel compilation forums don't mention dtb and how to make dt.img or the tool to do it! sir how to merge dtb files and create dt.img?
[Android Software/Hacking General [Developers Only]] nalas:
Read pls what is written by me in 6 nov... and look at pics.
[Android Software/Hacking General [Developers Only]] Klairm:
I'm getting an error when I try to compile, any ideas?

which: invalid option -- 'E'
which: invalid option -- 'L'
CHK include/config/kernel.release
GEN ./Makefile
CHK include/generated/uapi/linux/version.h
for i in ../arch/arm64/boot/dts/mediatek/k63v1us_64_bsp.dts; do \
base_prj=`grep -m 1 '#include [<\"].*\/cust\.dtsi[>\"]' $i | sed 's/#include [<"]//g'\
| sed 's/\/cust\.dtsi[>"]//g' | sed 's/\/\*//g' | sed 's/\*\///g' | sed 's/ //g'`\
prj_path=./arch/arm64/boot/dts/$base_prj ;\
dws_path=../drivers/misc/mediatek/dws/mt6763/$base_prj.dws ;\
if [ -f $dws_path ] ; then \
mkdir -p $prj_path ;\
../tools/dct/DrvGen.py $dws_path $prj_path $prj_path cust_dtsi;\
fi \
done
rm -f dtboimg.cfg.tmp
echo /home/ivangarcia/Descargas/5048Y_5048D_20200508/OT_5048D_20200508/kernel-4.4/out/arch/arm64/boot/dts/mediatek/k63v1us_64_bsp.dtb >>dtboimg.cfg.tmp; echo " id=0" >>dtboimg.cfg.tmp;
if ! cmp -s dtboimg.cfg.tmp dtboimg.cfg; then \
mv dtboimg.cfg.tmp dtboimg.cfg; \
else \
rm dtboimg.cfg.tmp; \
fi
Using .. as source for kernel
CHK include/generated/utsrelease.h
CHK scripts/mod/devicetable-offsets.h
HOSTLD scripts/dtc/dtc
CHK include/generated/timeconst.h
/usr/bin/ld: scripts/dtc/dtc-parser.tab.o:(.bss+0x10): definiciones múltiples de `yylloc'; scripts/dtc/dtc-lexer.lex.o:(.bss+0x0): primero se definió aquí
CHK include/generated/bounds.h
CHK include/generated/asm-offsets.h
collect2: error: ld devolvió el estado de salida 1
[Android Software/Hacking General [Developers Only]] Klairm:
I solve that error but now I get this https://pastebin.com/cYL04qYX
[Android Software/Hacking General [Developers Only]] Motoepower:
How to fix this?
[Android Software/Hacking General [Developers Only]] GabriLed:
gabry@gabry-MS-7D22:~/platform_kernel_xiaomi_surya/arch/arm64/configs$ make clean

make: *** Nessuna regola per generare l'obiettivo «clean». Arresto.

gabry@gabry-MS-7D22:~/platform_kernel_xiaomi_surya/arch/arm64/configs$ make mrproper

make: *** Nessuna regola per generare l'obiettivo «mrproper». Arresto.

gabry@gabry-MS-7D22:~/platform_kernel_xiaomi_surya/arch/arm64/configs$ make surya_defconfig

make: Nessuna operazione da eseguire per «surya_defconfig».

gabry@gabry-MS-7D22:~/platform_kernel_xiaomi_surya/arch/arm64/configs$ make -j$(nproc --all)

make: *** Nessun obiettivo specificato e nessun makefile trovato. Arresto.

gabry@gabry-MS-7D22:~/platform_kernel_xiaomi_surya/arch/arm64/configs$ export CROSS_COMPILE=$(pwd)/aarch64-linux-android-4.14/bin/aarch64-linux-android-

gabry@gabry-MS-7D22:~/platform_kernel_xiaomi_surya/arch/arm64/configs$ export ARCH=arm64 && export SUBARCH=arm6

gabry@gabry-MS-7D22:~/platform_kernel_xiaomi_surya/arch/arm64/configs$ make clean

make: *** Nessuna regola per generare l'obiettivo «clean». Arresto.

gabry@gabry-MS-7D22:~/platform_kernel_xiaomi_surya/arch/arm64/configs$ make surya_defconfig

make: Nessuna operazione da eseguire per «surya_defconfig».

it's in italian.

Poco X3 NFC (tequila os kernel source 4.14.300)
[Android Software/Hacking General [Developers Only]] GabriLed:
gabry@gabry-MS-7D22:~/platform_kernel_xiaomi_surya$ make clean

grep: .config: File o directory non esistente

grep: .config: File o directory non esistente

grep: .config: File o directory non esistente

grep: .config: File o directory non esistente

grep: .config: File o directory non esistente

grep: .config: File o directory non esistente

grep: .config: File o directory non esistente

grep: .config: File o directory non esistente
[Android Software/Hacking General [Developers Only]] bksvc:
hello, sorry for the late reply I managed to extract the dtb in the original kernel of my device and convert it to the dts file, what should I do now?

NOTE: When I use the make command it fails :)

EDIT: I just saw the codes and I created small scripts for myself by looking at the ts-build.sh file, but I don't have a tool called mkdtimg, will I get successful results if I pull it from your git?
[Android Software/Hacking General [Developers Only]] lolvatveo:
dtb is diggest(compiled) file from dts, it's binary file (only 0 or 1 characters), can't decompile unless you are PRO compiler or GCC,...
[Android Software/Hacking General [Developers Only]] bksvc:
I can't believe I made such a simple mistake, I checked the dtb-hw and dtb-hw_rev_end addresses and read your code thoroughly, the exynos9830.cfg file you wrote matches the dtb file that I extracted and converted to dts, so I referenced your configuration and managed to create the dtb image

UPDATE: but for dtbo.img which samsung/*.dts file should i look at ?

UPDATE2 : I separated all the dtbo files in the boot img with external tools and converted them to dts files one by one, then I compared their headers with the source code I have and they were all the same as what I had, then I examined your codes and said that you used the repack.sh file of osmosis there and a few sets before use. I noticed that you made the prerequisites and I did these, everything worked great but when I flash the new boot.img file, my device becomes soft bricked and restarts after the samsung text, how do I solve this?
[Android Software/Hacking General [Developers Only]] bksvc:
I extracted the dts file with dtc tool

DTC Tool reference : https://git.kernel.org/cgit/utils/dtc/dtc.git

My command: dtc -I dtb -O dts yourfile.dtb
[Android Software/Hacking General [Developers Only]] nalas:
Looks like you have maybe wrong name of compatible or hw_rev and hw_rev_end numbers .... it must be the same in cfg each one dtb or dtbo and source or dts files are from another firmware version.... compilation rather doesnt break the files...
[Android Software/Hacking General [Developers Only]] bksvc:
so does that mean i have to change the names in your cfg file like this?

exynos9830.dtb

custom0=0x00000000

custom1=0xff000000

hw_rev=0x00000000

hw_rev_end=0xff000000
[Android Software/Hacking General [Developers Only]] nalas:
e.g.

for exynos9820.dts :

dtb.G970F​

exynos9820.dtb

custom1 = 0xff000000

in dts is :

compatible = "samsung,armv8", "samsung,exynos9820";

dtb-hw_rev = <0x0>;

dtb-hw_rev_end = <0xff>;

for dts - dtbo:

exynos9820-beyond0lte_eur_open_17.dts​

​

in dts is

compatible = "samsung,BEYOND0LTE EUR OPEN 17", "samsung,EXYNOS9820";

dtbo-hw_rev = <0x11>;

dtbo-hw_rev_end = <0x11>;

in

dtbo.G970F​

exynos9820-beyond0lte_eur_open_17.dtbo

custom0 = 0x11000000

custom1 = 0x11000000

exynos9820-beyond0lte_eur_open_17.dtbo
custom0 = 0x11000000
custom1 = 0x11000000

exynos9820-beyond0lte_eur_open_18.dtbo
custom0 = 0x12000000
custom1 = 0x12000000

exynos9820-beyond0lte_eur_open_19.dtbo
custom0 = 0x13000000
custom1 = 0x13000000

exynos9820-beyond0lte_eur_open_20.dtbo
custom0 = 0x14000000
custom1 = 0x15000000

exynos9820-beyond0lte_eur_open_22.dtbo
custom0 = 0x16000000
custom1 = 0x17000000

exynos9820-beyond0lte_eur_open_24.dtbo
custom0 = 0x18000000
custom1 = 0x18000000

exynos9820-beyond0lte_eur_open_25.dtbo
custom0 = 0x19000000
custom1 = 0xff000000

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

and for each one file for G970F like *_18.dts _19.dts , ect. must be the same numbers.

You have to check all configs and files for corect write numbers start and end. So a lot of files to check.
[Android Software/Hacking General [Developers Only]] Darkmasterhk:
Getting a bunch of

right after the first few seconds

Bigger example:

Spoiler content hidden.

I'm trying to compile the kernel for my Xiaomi Tab 5 using clang.

Anyone an idea, what I do wrong? It looks like it tries to check something and recognizes the quote as junk?

But why / what is this file in /tmp anyway?

Kinda messed up my toolchains there, used the wrong assembler (sbin one) after fixing it I got at least something compiled
[Android Software/Hacking General [Developers Only]] Darkmasterhk:
Might be a stupid question.. but how do I do a test boot of my kernel?

I have an image and a dtbo.dtb file in arch/arm64/boot

When I try the classic method using fastboot boot Image I just end up on a blank screen

It also comes without a ramdisk(?).
[Android Software/Hacking General [Developers Only]] applesucksLmao:
@nalas if you don't mind me asking, how can i implement the higher CPU/GPU frequencies on Thunderstorms kernel (which is no longer supported and no longer works due to upgrade bit vl) on another S10/S10+ kernel? (like cruel or the stock kernel)

thanks
[Android Software/Hacking General [Developers Only]] nalas:
Hi, you have to edit exynos9820.dts or exynos9825.dts in arch/arm64/boot/dtb/ or exynos-acme.c in drivers/cpufreq/ file in kernel source.
[Android Software/Hacking General [Developers Only]] applesucksLmao:
alright, thanks for the info, will try and get back to you with the results!
[Android Software/Hacking General [Developers Only]] applesucksLmao:
after doing my research on the kernel and exploring the files, I saw a github repo ThunderStorms21th/S10-Samsung-source that is from thunderstorms and and seems (?) to be compatible with one ui 4.1/bit15, but well, i got kinda confused, is it the thunderstorms kernel with all the tweaks and higher freqs? is it actually compatible?

and also, lets suppose i'm running Ubuntu 22 and i want to build a kernel, be it thunderstorms or cruel, how can i do that using proton or whatever is available?

I appreciate the answer
[Android Software/Hacking General [Developers Only]] nalas:
You can find a lot of commits for OC cpu, on my github or another devs
[Android Software/Hacking General [Developers Only]] applesucksLmao:
@nalas if you could help i appreciate it // specific thread: https://xdaforums.com/t/error-while-trying-to-compile-a-samsung-galaxy-kernel.4539527/
[Android Software/Hacking General [Developers Only]] lupin 3rd:
Hi to all, I'm trying to compile kernel of klabit for galaxy s9 g9600 (this is the related thread https://xdaforums.com/t/kernel-q-g9650-g9600-klabit-kernel.3900816/ and this is the repository https://github.com/klabit87/android_kernel_samsung_sdm845). There are compiler, and/or some tips and tricks to do compared to first post procedure to build a kernel?

Another thing: as I have written here https://xdaforums.com/t/kernel-q-g9650-g9600-klabit-kernel.3900816/post-88050831 I want add 2 drivers to kernel: ext4 and uvc. How should I do?
[Android Software/Hacking General [Developers Only]] fastbootoem:
Hi y'all I'm getting an error when compiling Kernel

Firstly I downloaded 'Kernel' and 'aarch64-linux-android-4.9' and put them in the same folder named 'Ker0'

I did cd aarch64-linux-android-4.9

I executed 'export CROSS_COMPILE=$(pwd)/bin/aarch64-linux-android-'

then export ARCH=arm64 && export SUBARCH=arm64

Moved to Kernel directory ( cd Kernel)

then executed sudo make clean

Here is what i get :

make: ../PLATFORM/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-gcc: Command not found

make: ../PLATFORM/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-gcc: Command not found

Help me please

Thanks in advance
[Android Software/Hacking General [Developers Only]] nalas:
Try use not (pwd) but full path for gcc looks like it wants /platform/prebuilds/.../ use Ker0 folder
[Android Software/Hacking General [Developers Only]] fastbootoem:
Still facing the same issue

What am I doing wrong ?
[Android Software/Hacking General [Developers Only]] nalas:
Try to use with crosscompile : .../bin/aarch64-linux-android- without gcc
[Android Software/Hacking General [Developers Only]] fastbootoem:
Still the same error
[Android Software/Hacking General [Developers Only]] lupin 3rd:
nobody?
[Android Software/Hacking General [Developers Only]] lupin 3rd:
nobody can help me?
[Android Software/Hacking General [Developers Only]] bksvc:
I'm really sorry for the late reply

I learned how to create a dtbo file using dts with the mkdtimg tool, but then I realized that the osmosis mkbootimg tool is more functional and detailed, so I cloned the official on github page and repackaged the newly compiled "Image" file.

As a result, my new kernel has been installed perfectly, but I want to disable selinux according to the desired situation because I want to have full access to the network card of my note20 device, but when I set the selinux value to 0 via adb with root in the new kernel, my device freezes and restarts itself and selinux is turned on again. continues to work

NOTE: notoriously my camera and auto-rotate don't work on the new kernel

Footnote: I want to install modules on repackaged kernel

For example: I want it to see the network card connected with otg or I want to provide additional features such as active kvm (virtualization technology) to my device. Can you please tell me where or which directories I should put such additional options when I develop them as modules?

info: I will share my kernel .config file and screenshots of the path I followed as soon as possible. ^^

-- MKBOOTIMG TOOL REFERENCE --

GitHub - osm0sis/mkbootimg: mkbootimg + unpackbootimg, forked and updated

mkbootimg + unpackbootimg, forked and updated. Contribute to osm0sis/mkbootimg development by creating an account on GitHub.

github.com

-- MKDTIMG REFERENCE --

DTB and DTBO partitions | Android Open Source Project

source.android.com

I am sincerely grateful to you for your previous help.

UPDATE : My .config file

UPDATE 2 : mkbootimg parameters I use ->

mkbootimg --kernel latestSource/boot.img-kernel
--ramdisk latestSource/boot.img-ramdisk
--dtb latestSource/boot.img-dtb
--cmdline "androidboot.hardware=exynos990 loop.max_part=7"
--base 0x10000000
--kernel_offset 0x00008000
--ramdisk_offset 0x01000000
--dtb_offset 0x00000000
--os_version 11.0.0
--os_patch_level 2023-02-06
--board SRPTC30B005KU
--pagesize 2048
--header_version 2
--hashtype sha1
-o bootTest2.img
[Android Software/Hacking General [Developers Only]] Noah Allen:
Hello People. I hope you guys are doing well. I tried to compile an android kernel from source and I'm getting this error.

aarch64-linux-gnu-ld.gold: --thinlto-cache-dir=.thinlto-cache: unknown option

aarch64-linux-gnu-ld.gold: use the --help option for usage information

Here is the log file.

I used proton clang to compile the kernel.

This is my kernel source code : https://github.com/camellian-devs/kernel_xiaomi_camellia

This is my compilation script link

Hastebin

Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.

hastebin.com

Thank you all of you guys.
[Android Software/Hacking General [Developers Only]] Noah Allen:
(In some cases I can't add log file)

But I added Hastebin link: https://hastebin.com/share/udezaqamop.bash
[Android Software/Hacking General [Developers Only]] nalas:
Looks you have old kernel base and newer samsung firmware in rom or newer kernel base then rom firmware. Its normal behavior. You have to use the same kernel and firmare base.
[Android Software/Hacking General [Developers Only]] nalas:
Did you added commits for newer clang? Lto and thinlto? If not ... so this clang build options are not avaliable.... you have to add this commits. Look on github similar kernels...