[GUIDE]A Noob Guide On Building Your Own Custom Kernel (ARM & ARM64 & MTK)

What does the thread need ?


  • Total voters
    41
  • Poll closed .

JovanSijacki

Senior Member
Oct 14, 2014
334
91
48
Beograd
Can someone explain path to gcc toolchain because in ops example he used linaro which file should i link
I have something like this
/home/user/Projects/Kernel1/arm-eabi-4.7/bin
 

3lambda

Recognized Contributor
Dec 6, 2012
1,751
1,457
133
Clermont-Ferrand
Can someone explain path to gcc toolchain because in ops example he used linaro which file should i link
I have something like this
/home/user/Projects/Kernel1/arm-eabi-4.7/bin
Look how the end path look
Yours missing "/arm-eabi-"
So it should look like this "/home/user/Projects/Kernel1/arm-eabi-4.7/bin/arm-eabi-”
 

3lambda

Recognized Contributor
Dec 6, 2012
1,751
1,457
133
Clermont-Ferrand
Thread Updated with mediatek support !
Keep in mind that's a basic guide on how to compile kernel :)
It will be better over time, with more details, tips and tricks etc
Also arm64 support is coming soon

I'll make video soon too, I need to train my english accent before
And thanks to all people who contributed or helped this guide ! ;)
stay tuned
 

RendyAK

Senior Member
Sep 28, 2014
472
276
0
Depok
Yet another correction, I guess?
Please be more specify about things..
Like..

ARCH_MTK_PLATFORM
The variable to be specified with the SoC of the mediatek CPU, like.. MT6582, MT6580, etc.

I'll point out other things if I found any.
*anyway its RendyAK not randyAk lmao

Edit: about -j4, Its recommended to change 4 with number of CPU + 1

Edit 2: in make command, O=<things> is used as the output folder, this is not really needed, but if you want the source to clean, use this. This is also can be used in mediatek building.
If O is specified, then the output will be in the fder specified by O in the command.

Edit 3: Did you forget "chmod +x build.sh"?
It will cause "Permission denied" if you didnt so

Edit 4: for mediatek, It is recommended to use zImage-dtb, if avaible.
 
Last edited:
  • Like
Reactions: 3lambda

3lambda

Recognized Contributor
Dec 6, 2012
1,751
1,457
133
Clermont-Ferrand
Yet another correction, I guess?
Please be more specify about things..
Like..

ARCH_MTK_PLATFORM
The variable to be specified with the SoC of the mediatek CPU, like.. MT6582, MT6580, etc.

I'll point out other things if I found any.
*anyway its RendyAK not randyAk lmao

Edit: about -j4, Its recommended to change 4 with number of CPU + 1

Edit 2: in make command, O=<things> is used as the output folder, this is not really needed, but if you want the source to clean, use this. This is also can be used in mediatek building.
If O is specified, then the output will be in the fder specified by O in the command.

Edit 3: Did you forget "chmod +x build.sh"?
It will cause "Permission denied" if you didnt so

Edit 4: for mediatek, It is recommended to use zImage-dtb, if avaible.
Thanks for the correction :p

Sorry for the bad name writing :) (had problem when trying to tag you as it have tagged someone else :) )

For -j4 some people say that's okay other says what you said
I'll put in tips and tricks the command to know which number of job the CPU is able to use it will be better i think

For chmod +x build.sh I don't have problem of permission but i can add it if people encounter this problem

For zimage-dtb I'll update the post too as it can apply to arm too :)

Thanks again for these correction :)
 
  • Like
Reactions: RendyAK

RendyAK

Senior Member
Sep 28, 2014
472
276
0
Depok
Thanks for the correction :p

Sorry for the bad name writing :) (had problem when trying to tag you as it have tagged someone else :) )

For -j4 some people say that's okay other says what you said
I'll put in tips and tricks the command to know which number of job the CPU is able to use it will be better i think

For chmod +x build.sh I don't have problem of permission but i can add it if people encounter this problem

For zimage-dtb I'll update the post too as it can apply to arm too :)

Thanks again for these correction :)
If you have a single core PC with 2GB ram and then you'll use -j4, you'll burn your laptop/PC entirely ?

And You're welcome.
 
  • Like
Reactions: 3lambda

VecH

Member
Aug 22, 2006
42
3
0
I downloaded the archive GT-N7100_KK_Opensource.zip with the source code for my firmware / kernel N7100XXUFPF1
Unpacked README_Kernel.txt, inside contains:
################################################################################
HOW TO BUILD KERNEL FOR GT-N7100_ALL_KK_WW

1. How to Build
- get Toolchain
download and install arm-2010q1 toolchain for ARM EABI.
Extract kernel source and move into the top directory.

$ export CROSS_COMPILE=/opt/toolchains/arm-2010q1/bin/arm-none-linux-gnueabi-
$ make t0_04_defconfig
$ make -j64

2. Output files
- Kernel : Kernel/arch/arm/boot/zImage
- module : Kernel/drivers/*/*.ko

3. How to Clean
$ make clean

4. How to make .tar binary for downloading into target.
- change current directory to Kernel/arch/arm/boot
- type following command
$ tar cvf GT-N7100_ALL_KK_WW.tar zImage
################################################################################
I want to compile the module xt_HL.ko (NETFILTER_XT_TARGET_HL) I want to add to the system to modify TTL on the fly for smartphone Samsung Galaxy Note 2

There were several questions:
1. Which Linux distribution should I use? (Will there be any problems in Ubuntu 16.04 x64?)
2. Where to download arm-2010q1 toolchain for ARM EABI for kernel / module assembly
 

sunilpaulmathew

Recognized Developer
Nov 7, 2015
1,820
5,553
153
Kochi (Currently in Prague)
smartpack.github.io
I downloaded the archive GT-N7100_KK_Opensource.zip with the source code for my firmware / kernel N7100XXUFPF1
Unpacked README_Kernel.txt, inside contains:
I want to compile the module xt_HL.ko (NETFILTER_XT_TARGET_HL) I want to add to the system to modify TTL on the fly for smartphone Samsung Galaxy Note 2

There were several questions:
1. Which Linux distribution should I use? (Will there be any problems in Ubuntu 16.04 x64?)
2. Where to download arm-2010q1 toolchain for ARM EABI for kernel / module assembly
Where can I get the arm-2010q1 toolchain for ARM EABI to build a module for my kernel
You can use any 64 bit Linux distro or even the bash inside windows 10 (ofcourse, Ubuntu is the choice of many including me).
I couldn't find the exactly same toolchain recommended in your text. However, you may try any other arm toolchains (I guess) like Google's arm-linux-androideabi-4.9 or arm-linux-androideabi-4.9-linaro etc (or an older version if the new one failed to build). As long as it succeed buikding and you are able to use the output, no need to worry...

Anyone, but the recomendation of Google it's the Ubuntu.
 

RendyAK

Senior Member
Sep 28, 2014
472
276
0
Depok
You can use any 64 bit Linux distro or even the bash inside windows 10 (ofcourse, Ubuntu is the choice of many including me).
I couldn't find the exactly same toolchain recommended in your text. However, you may try any other arm toolchains (I guess) like Google's arm-linux-androideabi-4.9 or arm-linux-androideabi-4.9-linaro etc (or an older version if the new one failed to build). As long as it succeed buikding and you are able to use the output, no need to worry...
I have tried Bash on W10, lul it doesnt work. They dont wont to execute DrvGen, which is really needed for mtk devices :(
 

VecH

Member
Aug 22, 2006
42
3
0
I can collect the necessary module separately and substitute it for the existing kernel if the compiler will have a different version?