FORUMS

[REFERENCE] How to compile an Android kernel

13,746 posts
Thanks Meter: 50,843
 
By nathanchance, Recognized Developer / Recognized Contributor on 26th June 2017, 04:38 AM
Post Reply Email Thread
15th March 2018, 01:49 AM |#201  
nathanchance's Avatar
OP Recognized Developer / Recognized Contributor
Flag Mesa, AZ
Thanks Meter: 50,843
 
More
Quote:
Originally Posted by milouk

i double checked and it seems fine to me.
i run from the Bullhead_Kernel folder (which contains the source + the toolchain folders)

*i renamed the toolchain folder to "gcc-linaro" so it is shorter.
i read somewhere that i should export the toolchain to the PATH variable. is this the case? if yes how am i supposed to do it?

So if you run

Code:
ls $(pwd)/gcc-linaro/bin/aarch64-linux-gnu-
And

Code:
ls $CROSS_COMPILE
they show the same thing?



Sent from my Google Pixel 2 XL using XDA Labs
15th March 2018, 08:43 AM |#202  
milouk's Avatar
Recognized Developer
Athens
Thanks Meter: 4,855
 
Donate to Me
More
Quote:
Originally Posted by nathanchance

So if you run

Code:
ls $(pwd)/gcc-linaro/bin/aarch64-linux-gnu-
And

Code:
ls $CROSS_COMPILE
they show the same thing?



Sent from my Google Pixel 2 XL using XDA Labs

this is what i get but as you can see the path is correct.Click image for larger version

Name:	Screenshot from 2018-03-15 08-41-24.png
Views:	198
Size:	189.0 KB
ID:	4447696
15th March 2018, 05:33 PM |#203  
nathanchance's Avatar
OP Recognized Developer / Recognized Contributor
Flag Mesa, AZ
Thanks Meter: 50,843
 
More
Quote:
Originally Posted by milouk

this is what i get but as you can see the path is correct.

Well that's fine because you didn't have the 'gcc' at the end but now try using make.

Sent from my Google Pixel 2 XL using XDA Labs
15th March 2018, 05:43 PM |#204  
milouk's Avatar
Recognized Developer
Athens
Thanks Meter: 4,855
 
Donate to Me
More
Quote:
Originally Posted by nathanchance

Well that's fine because you didn't have the 'gcc' at the end but now try using make.

Sent from my Google Pixel 2 XL using XDA Labs

When i run "make clean" i get the same error.
When i run "make" i get a new error
Click image for larger version

Name:	Screenshot from 2018-03-15 17-40-13.png
Views:	146
Size:	241.3 KB
ID:	4448102
15th March 2018, 08:49 PM |#205  
Member
Flag Noida
Thanks Meter: 5
 
More
I tried building a kernel and i am getting make error 2.

this is the error:
Quote:

- Including cert /media/ankk98/int/PROGRAMMING-DEVOLOPMENT/custom-kernel/le2-oreo/android_kernel_leeco_msm8976/signing_key.x509
AS kernel/system_certificates.o
LD kernel/built-in.o
LD drivers/video/fb.o
CC drivers/video/msm/msm_dba/msm_dba.o
drivers/video/msm/msm_dba/msm_dba.c:25:30: fatal error: msm_dba_internal.h: No such file or directory
#include <msm_dba_internal.h>
^
compilation terminated.
scripts/Makefile.build:308: recipe for target 'drivers/video/msm/msm_dba/msm_dba.o' failed
make[4]: *** [drivers/video/msm/msm_dba/msm_dba.o] Error 1
scripts/Makefile.build:455: recipe for target 'drivers/video/msm/msm_dba' failed
make[3]: *** [drivers/video/msm/msm_dba] Error 2
scripts/Makefile.build:455: recipe for target 'drivers/video/msm' failed
make[2]: *** [drivers/video/msm] Error 2
scripts/Makefile.build:455: recipe for target 'drivers/video' failed
make[1]: *** [drivers/video] Error 2
make[1]: *** Waiting for unfinished jobs....
Makefile:825: recipe for target 'drivers' failed

i tried to look into the msm_dba.c file and cannot find the problem.
also msm_dba_internal.h file exists.

Any suggestions?
15th March 2018, 08:56 PM |#206  
nathanchance's Avatar
OP Recognized Developer / Recognized Contributor
Flag Mesa, AZ
Thanks Meter: 50,843
 
More
Quote:
Originally Posted by ankk98

I tried building a kernel and i am getting make error 2.

this is the error:


i tried to look into the msm_dba.c file and cannot find the problem.
also msm_dba_internal.h file exists.

Any suggestions?

Did you follow the advice about the out flag?
15th March 2018, 08:57 PM |#207  
Senior Member
Thanks Meter: 1,235
 
More
Hi @nathanchance, thanks for the great guide.
I was just wondering, are the errors below affecting my kernel build, or can I ignore them.
/home/thepiguy/kernel/kernel/scripts/Makefile.fwinst:45: target '/lib/firmware/sic/p1/L0L55P1_1_11.img' given more than once in the same rule
/home/thepiguy/kernel/kernel/scripts/Makefile.fwinst:45: target '/lib/firmware/sic/p1/p1_limit_mfts_flat.txt' given more than once in the same rule
/home/thepiguy/kernel/kernel/scripts/Makefile.fwinst:45: target '/lib/firmware/sic/p1/p1_limit.txt' given more than once in the same rule
/home/thepiguy/kernel/kernel/scripts/Makefile.fwinst:45: target '/lib/firmware/sic/p1/p1_limit_mfts_curved.txt' given more than once in the same rule
/home/thepiguy/kernel/kernel/scripts/Makefile.fwinst:45: target '/lib/firmware/sic/p1/p1_limit_mfts_folder.txt' given more than once in the same rule
CAT arch/arm64/boot/Image.gz-dtb
Is this normal (lots of guides say you end with a zImage)?

Also, how would you integrate a custom built kernel into a custom built os (e.g. homebuilt lineage)
15th March 2018, 09:39 PM |#208  
nathanchance's Avatar
OP Recognized Developer / Recognized Contributor
Flag Mesa, AZ
Thanks Meter: 50,843
 
More
Quote:
Originally Posted by ThePiGuy

Hi @nathanchance, thanks for the great guide.
I was just wondering, are the errors below affecting my kernel build, or can I ignore them.
/home/thepiguy/kernel/kernel/scripts/Makefile.fwinst:45: target '/lib/firmware/sic/p1/L0L55P1_1_11.img' given more than once in the same rule
/home/thepiguy/kernel/kernel/scripts/Makefile.fwinst:45: target '/lib/firmware/sic/p1/p1_limit_mfts_flat.txt' given more than once in the same rule
/home/thepiguy/kernel/kernel/scripts/Makefile.fwinst:45: target '/lib/firmware/sic/p1/p1_limit.txt' given more than once in the same rule
/home/thepiguy/kernel/kernel/scripts/Makefile.fwinst:45: target '/lib/firmware/sic/p1/p1_limit_mfts_curved.txt' given more than once in the same rule
/home/thepiguy/kernel/kernel/scripts/Makefile.fwinst:45: target '/lib/firmware/sic/p1/p1_limit_mfts_folder.txt' given more than once in the same rule
CAT arch/arm64/boot/Image.gz-dtb
Is this normal (lots of guides say you end with a zImage)?

Also, how would you integrate a custom built kernel into a custom built os (e.g. homebuilt lineage)

It looks like you can just ignore them, it means they are defined twice in your Makefile, for whatever reason.

It usually just involves syncing the source via a local manifest then adjusting the defconfig target in BoardConfig.mk in your device tree.
The Following User Says Thank You to nathanchance For This Useful Post: [ View ]
15th March 2018, 09:46 PM |#209  
Senior Member
Thanks Meter: 1,235
 
More
Quote:
Originally Posted by nathanchance

It looks like you can just ignore them, it means they are defined twice in your Makefile, for whatever reason.

It usually just involves syncing the source via a local manifest then adjusting the defconfig target in BoardConfig.mk in your device tree.

How about using one you prepared earlier (or a prebuilt one). Can you add it into the build process so it doesn't need to be built again (I heard something about incorporating a zImage)
16th March 2018, 06:39 PM |#210  
Member
Flag Noida
Thanks Meter: 5
 
More
Quote:
Originally Posted by nathanchance

Did you follow the advice about the out flag?

Specifying out flag did fix my problem but i did not understand why this happened.
If it needed a out directory than why it ran some part of make process and then gave some error.
I want to understand how it works and why it gave such behaviour?
Can u help?
18th March 2018, 11:55 PM |#211  
milouk's Avatar
Recognized Developer
Athens
Thanks Meter: 4,855
 
Donate to Me
More
@nathanchance i fixed the previous error with the 7.2.1 linaro compiler but i have another issue now.

when trying to compile i get a lot of warnings and compilation stops at
Code:
Makefile:817: recipe for target 'drivers' failed
make: *** [drivers] Error 2
any ideas?

Click image for larger version

Name:	Screenshot from 2018-03-18 23-52-38.jpg
Views:	306
Size:	194.8 KB
ID:	4451193
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes