FORUMS
Remove All Ads from XDA

[REFERENCE] How to compile an Android kernel

13,720 posts
Thanks Meter: 50,725
 
By nathanchance, Recognized Developer / Recognized Contributor on 26th June 2017, 04:38 AM
Post Reply Email Thread
11th June 2019, 01:03 PM |#561  
Junior Member
Thanks Meter: 12
 
More
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
 
 
11th June 2019, 01:24 PM |#562  
Quote:
Originally Posted by 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

This is a screenshot of the github kernel source. This is the makefile you are referring to?
Attached Thumbnails
Click image for larger version

Name:	Screenshot_20190611-081937.jpg
Views:	112
Size:	105.1 KB
ID:	4775042  
11th June 2019, 01:48 PM |#563  
Junior Member
Thanks Meter: 12
 
More
Quote:
Originally Posted by palmbeach05

This is a screenshot of the github kernel source. This is the makefile you are referring to?

Yes, this is the file I am referring to.
Are you sure this is an Android kernel and not a normal Linux kernel?
11th June 2019, 01:55 PM |#564  
Quote:
Originally Posted by ramast_

Yes, this is the file I am referring to.
Are you sure this is an Android kernel and not a normal Linux kernel?

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
11th June 2019, 02:05 PM |#565  
Junior Member
Thanks Meter: 12
 
More
Quote:
Originally Posted by 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

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.
11th June 2019, 02:10 PM |#566  
Quote:
Originally Posted by 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.

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.
13th June 2019, 03:32 AM |#567  
Member
Flag Rasipuram,Namakkal,Tamil Nadu
Thanks Meter: 17
 
Donate to Me
More
How to fix this error...I m trying to build stock kernel with gcc 4.7

[email protected]:~/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
[email protected]:~/android/kernel/erax$
15th June 2019, 03:39 AM |#568  
Junior Member
Thanks Meter: 1
 
More
What is different between these two toolchain (big-endian-linux-gnu and linux-gnu)?
how to choose
https://developer.arm.com/tools-and-...nu-a/downloads
18th June 2019, 04:58 PM |#569  
nathanchance's Avatar
OP Recognized Developer / Recognized Contributor
Flag Mesa, AZ
Thanks Meter: 50,725
 
More
Quote:
Originally Posted by 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-...nu-a/downloads

All Android devices are little endian so you want the regular aarch64-linux-gnu one.
The Following 2 Users Say Thank You to nathanchance For This Useful Post: [ View ]
Yesterday, 09:48 AM |#570  
Member
Thanks Meter: 6
 
More
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
Yesterday, 04:06 PM |#571  
Member
Thanks Meter: 6
 
More
Quote:
Originally Posted by vish97

I tried to compile the kernel using the given steps but ended up with unkown makefile error.

Code:
[email protected]:~/oreo/kernel/bacon$ ./b_build.sh 
/home/cleoz/oreo/kernel/bacon/scripts/gcc-version.sh: line 25: /home/cleoz/oreo/arm-linux-androideabi-4.9: Is a directory
/home/cleoz/oreo/kernel/bacon/scripts/gcc-version.sh: line 26: /home/cleoz/oreo/arm-linux-androideabi-4.9: Is a directory
/home/cleoz/oreo/kernel/bacon/scripts/gcc-version.sh: line 25: /home/cleoz/oreo/arm-linux-androideabi-4.9: Is a directory
/home/cleoz/oreo/kernel/bacon/scripts/gcc-version.sh: line 26: /home/cleoz/oreo/arm-linux-androideabi-4.9: Is a directory
/home/cleoz/oreo/kernel/bacon/scripts/gcc-version.sh: line 25: /home/cleoz/oreo/arm-linux-androideabi-4.9: Is a directory
/home/cleoz/oreo/kernel/bacon/scripts/gcc-version.sh: line 26: /home/cleoz/oreo/arm-linux-androideabi-4.9: Is a directory
/home/cleoz/oreo/kernel/bacon/scripts/gcc-version.sh: line 25: /home/cleoz/oreo/arm-linux-androideabi-4.9: Is a directory
/home/cleoz/oreo/kernel/bacon/scripts/gcc-version.sh: line 26: /home/cleoz/oreo/arm-linux-androideabi-4.9: Is a directory
  CLEAN   scripts/basic
  CLEAN   scripts/dtc
  CLEAN   scripts/kconfig
  CLEAN   scripts/selinux/genheaders
  CLEAN   scripts/selinux/mdp
  CLEAN   include/config include/generated arch/arm/include/generated
  CLEAN   .config include/linux/version.h
  HOSTCC  scripts/basic/fixdep
  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
#
scripts/kconfig/conf --silentoldconfig Kconfig
  WRAP    arch/arm/include/generated/asm/auxvec.h
  WRAP    arch/arm/include/generated/asm/bitsperlong.h
  WRAP    arch/arm/include/generated/asm/cputime.h
  WRAP    arch/arm/include/generated/asm/emergency-restart.h
  WRAP    arch/arm/include/generated/asm/errno.h
  CHK     include/linux/version.h
  WRAP    arch/arm/include/generated/asm/ioctl.h
  UPD     include/linux/version.h
  WRAP    arch/arm/include/generated/asm/irq_regs.h
  WRAP    arch/arm/include/generated/asm/kdebug.h
  WRAP    arch/arm/include/generated/asm/local.h
  WRAP    arch/arm/include/generated/asm/local64.h
  WRAP    arch/arm/include/generated/asm/poll.h
  WRAP    arch/arm/include/generated/asm/resource.h
  WRAP    arch/arm/include/generated/asm/sections.h
  WRAP    arch/arm/include/generated/asm/siginfo.h
  WRAP    arch/arm/include/generated/asm/simd.h
  WRAP    arch/arm/include/generated/asm/sizes.h
  CC      scripts/mod/empty.o
  HOSTCC  scripts/dtc/checks.o
  HOSTCC  scripts/selinux/genheaders/genheaders
/home/cleoz/oreo/arm-linux-androideabi-4.9 [Errno 13] Permission denied
scripts/Makefile.build:307: recipe for target 'scripts/mod/empty.o' failed
make[2]: *** [scripts/mod/empty.o] Error 13
scripts/Makefile.build:443: recipe for target 'scripts/mod' failed
make[1]: *** [scripts/mod] Error 2
make[1]: *** Waiting for unfinished jobs....
  HOSTCC  scripts/dtc/data.o
  HOSTCC  scripts/selinux/mdp/mdp
  SHIPPED scripts/dtc/dtc-lexer.lex.c
  SHIPPED scripts/dtc/dtc-parser.tab.h
  SHIPPED scripts/dtc/dtc-parser.tab.c
  HOSTCC  scripts/dtc/dtc.o
  HOSTCC  scripts/dtc/flattree.o
  HOSTCC  scripts/dtc/fstree.o
  HOSTCC  scripts/dtc/livetree.o
  HOSTCC  scripts/dtc/srcpos.o
  HOSTCC  scripts/dtc/treesource.o
  HOSTCC  scripts/dtc/util.o
  HOSTCC  scripts/dtc/dtc-lexer.lex.o
  HOSTCC  scripts/dtc/dtc-parser.tab.o
  HOSTLD  scripts/dtc/dtc
Makefile:510: recipe for target 'scripts' failed
make: *** [scripts] Error 2
make: *** Waiting for unfinished jobs....
Device: One plus one
Kernel tree used : https://github.com/LineageOS/android...neplus_msm8974 cm-14.1 branch
I have tried changing toolchain and also re-clone the kernel tree.Any assistance is much appreciated.
Vishal

You have to run it as root.
Sudo su
Type password if asking.
I faced the same issue like permission denied.
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