FORUMS

[REFERENCE] How to compile an Android kernel

13,736 posts
Thanks Meter: 50,809
 
By nathanchance, Recognized Developer / Recognized Contributor on 26th June 2017, 05:38 AM
Post Reply Email Thread
5th February 2020, 01:48 AM |#681  
onliner's Avatar
Senior Member
Flag Sydney
Thanks Meter: 995
 
More
Quote:
Originally Posted by CupangTerbang

can i update asus zenfone x86 version kernel to higher than 3.10 ??

cause it was bug on wifi if it always connect & disconnect.

if yes where i can find that kernel source ??

---------- Post added at 10:30 PM ---------- Previous post was at 10:28 PM ----------

can i update asus zenfone x86 version kernel to higher than 3.10 ??

cause it was bug on wifi if it always connect & disconnect phpne got hang due kernel bug.

if yes where i can find that kernel source ??

Theoretically yes, but it depends on some factors, it's necessary that CAF has published a new kernel version for that soc (For example, sd 625 received 4.9 last year), and then you must rewrite the device-specific kernel drivers to be compatible with the new kernel version.
10th February 2020, 05:54 PM |#682  
Senior Member
Flag Dublin
Thanks Meter: 94
 
More
I have a problem which I though had nothing to do with the build process but after hours of going though the code and not being able to sort a problem I'm having I'm beginning to thing I've done something wrong i.e not done something that was required therefore the question may be relevant in this thread.

So, I built successfully from source for my LG fone (Qualcomm Snapdragon 820 MSM8996). I didn't make any changes at all, just built it, and the touchscreen does not work.

I put the Image.gz-dtb in a flashable zip and I unpacked the boot.img and repacked it as an alternative method. Still no go.

I see I have 15 modules. I didn't do anything with them. Should I have. One of them is a lcd.ko file. Those files would already exist on the device anyway.

There are other files created in /arch/arm64/boot where the image.gz-dtb file is created. What are they for?

I see in the compilation output process something happens with generating keys. Could this in any way be relevant to my issue?

That'll do for now.
12th February 2020, 12:30 PM |#683  
Switching to Clang
Tried to pick up where I left off and getting the following error...
Quote:

Android GCC has been deprecated in favor of Clang, and will be removed from
Android in 2020-01 as per the deprecation plan in:
https://android.googlesource.com/pla...DEPRECATION.md

...so I've tried switching to Clang as described here - https://github.com/nathanchance/android-kernel-clang. I've added the top 5 commits for 4.4 but that results in the following...

Code:
make[1]: Entering directory '/home/sxusr/Android/kernel-copyleft/out'
  GEN     ./Makefile
scripts/kconfig/conf  --silentoldconfig Kconfig
drivers/input/misc/Kconfig:871:warning: leading whitespace ignored
  CHK     include/config/kernel.release
  Using .. as source for kernel
  GEN     ./Makefile
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CC      kernel/bounds.s
Android GCC has been deprecated in favor of Clang, and will be removed from
Android in 2020-01 as per the deprecation plan in:
https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+/master/GCC_4_9_DEPRECATION.md

921d9846-a815-11e9-84ea-ff8bce1b90b6: error: Android: No such file or directory
921d9846-a815-11e9-84ea-ff8bce1b90b6: error: GCC: No such file or directory
921d9846-a815-11e9-84ea-ff8bce1b90b6: error: has: No such file or directory
921d9846-a815-11e9-84ea-ff8bce1b90b6: error: been: No such file or directory
921d9846-a815-11e9-84ea-ff8bce1b90b6: error: deprecated: No such file or directory
921d9846-a815-11e9-84ea-ff8bce1b90b6: error: in: No such file or directory
921d9846-a815-11e9-84ea-ff8bce1b90b6: error: favor: No such file or directory
921d9846-a815-11e9-84ea-ff8bce1b90b6: error: of: No such file or directory
921d9846-a815-11e9-84ea-ff8bce1b90b6: error: Clang,: No such file or directory
921d9846-a815-11e9-84ea-ff8bce1b90b6: error: and: No such file or directory
921d9846-a815-11e9-84ea-ff8bce1b90b6: error: will: No such file or directory
921d9846-a815-11e9-84ea-ff8bce1b90b6: error: be: No such file or directory
921d9846-a815-11e9-84ea-ff8bce1b90b6: error: removed: No such file or directory
921d9846-a815-11e9-84ea-ff8bce1b90b6: error: from: No such file or directory
921d9846-a815-11e9-84ea-ff8bce1b90b6: error: Android: No such file or directory
921d9846-a815-11e9-84ea-ff8bce1b90b6: error: in: No such file or directory
921d9846-a815-11e9-84ea-ff8bce1b90b6: error: 2020-01: No such file or directory
921d9846-a815-11e9-84ea-ff8bce1b90b6: error: as: No such file or directory
921d9846-a815-11e9-84ea-ff8bce1b90b6: error: per: No such file or directory
921d9846-a815-11e9-84ea-ff8bce1b90b6: error: the: No such file or directory
921d9846-a815-11e9-84ea-ff8bce1b90b6: error: deprecation: No such file or directory
921d9846-a815-11e9-84ea-ff8bce1b90b6: error: plan: No such file or directory
921d9846-a815-11e9-84ea-ff8bce1b90b6: error: in:: No such file or directory
921d9846-a815-11e9-84ea-ff8bce1b90b6: error: https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+/master/GCC_4_9_DEPRECATION.md: No such file or directory
.././Kbuild:44: recipe for target 'kernel/bounds.s' failed
make[2]: *** [kernel/bounds.s] Error 1
/home/sxusr/Android/kernel-copyleft/Makefile:1042: recipe for target 'prepare0' failed
make[1]: *** [prepare0] Error 2
make[1]: Leaving directory '/home/sxusr/Android/kernel-copyleft/out'
Makefile:150: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2
Am I missing a commit?

This is the code I'm using to initiate compiling...
export ARCH=arm64
export PATH="/home/sxusr/clang/bin:${PATH}"
export CC=clang
export KBUILD_DIFFCONFIG=lilac_diffconfig
export KBUILD_BUILD_USER=Build
export KBUILD_BUILD_HOST=Host
make msmcortex-perf_defconfig O=./out
make O=./out


EDIT: Fixed by using an older version of GCC.
12th February 2020, 05:57 PM |#684  
Junior Member
Thanks Meter: 1
 
More
Hi thanks for this great resource and advice in this thread so far.
I'm hoping someone can help.

I'm definitely a noob when it comes to compiling any kind of kernel.
I'm working on an experiment to take a dump of volatile memory from a device using LiME and to do this, I need to compile an identical kernel to the one in my test device, using the same compiler used for the running kernel in the device.For my project, I'm working with an original gen Google Pixel, arm64 architecture, running NDE63H android-7.1.0_r1.

In adb, "cat /proc/version" returns;
Quote:

Linux version 3.18.31-g19caf23 ([email protected]) (gcc version 4.9.x-google 20140827 (prerelease) (GCC) ) #1 SMP PREEMPT Sat Sep 3 00:12:36 UTC 2016

So I've downloaded android-msm-marlin-3.18-nougat-dr1 source and the compiler aarch64-linux-android-gcc (GCC) 4.9 20150123 (prerelease).

I'm getting to the stage I'm getting to the point of 3.4. "Build the kernel" and receive the following error for the "make clean" command;
Quote:

make: *** No rule to make target 'clean'. Stop.

Similarly, if I skip this and jump straight to "make marlin_defconfig", I receive this;
Quote:

make: Nothing to be done for 'marlin_defconfig'.

Sorry if there is an obvious error staring me in the face or if I haven't provided enough information but I feel like I'm going in circles trying to troubleshoot and would be extremely grateful for some advice!

Thanks!
14th February 2020, 05:47 PM |#685  
kevintm78's Avatar
Senior Member
Flag Bluegrass State
Thanks Meter: 2,386
 
Donate to Me
More
Quote:
Originally Posted by Matrid

Hi thanks for this great resource and advice in this thread so far.
I'm hoping someone can help.

I'm definitely a noob when it comes to compiling any kind of kernel.
I'm working on an experiment to take a dump of volatile memory from a device using LiME and to do this, I need to compile an identical kernel to the one in my test device, using the same compiler used for the running kernel in the device.For my project, I'm working with an original gen Google Pixel, arm64 architecture, running NDE63H android-7.1.0_r1.

In adb, "cat /proc/version" returns;


So I've downloaded android-msm-marlin-3.18-nougat-dr1 source and the compiler aarch64-linux-android-gcc (GCC) 4.9 20150123 (prerelease).

I'm getting to the stage I'm getting to the point of 3.4. "Build the kernel" and receive the following error for the "make clean" command;


Similarly, if I skip this and jump straight to "make marlin_defconfig", I receive this;


Sorry if there is an obvious error staring me in the face or if I haven't provided enough information but I feel like I'm going in circles trying to troubleshoot and would be extremely grateful for some advice!

Thanks!

If it's your first build attempt then I would skip the <make clean> and <make mrproper> commands since there's nothing to clean (I assume). I would also suggest building to an <out> folder if you're not already, just remember the <make> commands change to this <make 0=out (option)>
The Following 2 Users Say Thank You to kevintm78 For This Useful Post: [ View ] Gift kevintm78 Ad-Free
21st February 2020, 05:10 PM |#686  
So frustrated.
Hi all.

I'm trying to upstream my kernel from 4.4.78 but have once again run in to an issue. I am able to compile that version and cherry pick a DRM mod to it successfully. I compiled and flashed 4.4.79 successfully so thought I would carry on for as long as time permitted, merging, resolving conflicts, adding and commiting and got to 4.4.87. I've tried to flash that but it gets stuck on the Sony logo. I also get two warnings about the BL being unlocked which I don't ordinarily.

I've attached the log but have no clue what I'm supposed to be looking for that would tell me what the issue is. Also, if anyone reading this knows how to do an "OEM import" I'd appreciate the info.

Thanks.
Attached Thumbnails
Click image for larger version

Name:	Screenshot from 2020-02-21 02-04-39.png
Views:	86
Size:	41.8 KB
ID:	4955523  
Attached Files
File Type: log dmesg.log - [Click for QR Code] (152.0 KB, 2 views)
22nd February 2020, 02:34 AM |#687  
kevintm78's Avatar
Senior Member
Flag Bluegrass State
Thanks Meter: 2,386
 
Donate to Me
More
Quote:
Originally Posted by SXUsr

Hi all.

I'm trying to upstream my kernel from 4.4.78 but have once again run in to an issue. I am able to compile that version and cherry pick a DRM mod to it successfully. I compiled and flashed 4.4.79 successfully so thought I would carry on for as long as time permitted, merging, resolving conflicts, adding and commiting and got to 4.4.87. I've tried to flash that but it gets stuck on the Sony logo. I also get two warnings about the BL being unlocked which I don't ordinarily.

I've attached the log but have no clue what I'm supposed to be looking for that would tell me what the issue is. Also, if anyone reading this knows how to do an "OEM import" I'd appreciate the info.

Thanks.

I'm wanting to try an OEM import myself and unfortunately don't know much about it yet but I thought I would bring up git bisect in case you were unaware of it. If you are unfamiliar with it its a very handy git command for narrowing down the commit(s) thats causing the boot issue.

This will explain it much better than I can. It helped me numerous times when going through this process. In a nutshell what it does it take the last commit that you know is good and the commit you're at now and will go to the halfway commit between the two so you can build and test. Depending on your results it will split again between the new good/bad commit and work towards the middle to further narrow it down.
The Following User Says Thank You to kevintm78 For This Useful Post: [ View ] Gift kevintm78 Ad-Free
22nd February 2020, 07:27 AM |#688  
Senior Member
Thanks Meter: 492
 
More
Quote:
Originally Posted by SXUsr

Hi all.

I'm trying to upstream my kernel from 4.4.78 but have once again run in to an issue. I am able to compile that version and cherry pick a DRM mod to it successfully. I compiled and flashed 4.4.79 successfully so thought I would carry on for as long as time permitted, merging, resolving conflicts, adding and commiting and got to 4.4.87. I've tried to flash that but it gets stuck on the Sony logo. I also get two warnings about the BL being unlocked which I don't ordinarily.

I've attached the log but have no clue what I'm supposed to be looking for that would tell me what the issue is. Also, if anyone reading this knows how to do an "OEM import" I'd appreciate the info.

Thanks.

It can often be a wrong merge resolution in some driver. If you have, look at another kernel and how it's resolved. Also trying to boot more often is a good idea
The Following User Says Thank You to T1mb3 For This Useful Post: [ View ] Gift T1mb3 Ad-Free
22nd February 2020, 10:13 PM |#689  
Junior Member
Thanks Meter: 1
 
More
NetHunter
I have Sony xperia z5 compact and running os is LineageOS 14.1
I wonder to compile NetHunter kernel but i cant find my kernel source
Anybody can help me for build instructions.?
23rd February 2020, 09:17 AM |#690  
kevintm78's Avatar
Senior Member
Flag Bluegrass State
Thanks Meter: 2,386
 
Donate to Me
More
Quote:
Originally Posted by NetRoot

I have Sony xperia z5 compact and running os is LineageOS 14.1
I wonder to compile NetHunter kernel but i cant find my kernel source
Anybody can help me for build instructions.?

If you're running lineage it's most likely posted in the first post of the rom you're using. If not, I think it's supposed to be. That's my understanding of it anyhow. LineageOS is open sourced so I assume....
The Following User Says Thank You to kevintm78 For This Useful Post: [ View ] Gift kevintm78 Ad-Free
23rd February 2020, 12:23 PM |#691  
Junior Member
Thanks Meter: 1
 
More
Quote:
Originally Posted by kevintm78

If you're running lineage it's most likely posted in the first post of the rom you're using. If not, I think it's supposed to be. That's my understanding of it anyhow. LineageOS is open sourced so I assume....

Quote from this page: https://wiki.lineageos.org/devices/suzuran/build
in this sentence:
"This will download your device’s device specific configuration and kernel."

"kernel' word is linked to: https://github.com/LineageOS/android...l_sony_msm8994
This page.
So that source is yet for the compiling kernel right ?
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