FORUMS
Remove All Ads from XDA

[REFERENCE] How to compile an Android kernel

13,721 posts
Thanks Meter: 50,736
 
By nathanchance, Recognized Developer / Recognized Contributor on 26th June 2017, 04:38 AM
Post Reply Email Thread
5th October 2017, 10:54 PM |#61  
Uzephi's Avatar
Recognized Contributor
Flag Phoenix
Thanks Meter: 1,789
 
More
from source, same build errors. When I do my make o=out msm-perf_defconfig I do see odd errors that might be contributing to the erros I had to correct and maybe I corrected them wrong. Below is the error.

Code:
warning: (SND_SOC_MSM8996) selects SND_SOC_MODS_CODEC_SHIM which has unmet direct dependencies (SOUND && ~N68K && !UNL && SND && SND_SOC && MODS_CODEC_BUS)
drivers/video/fbdev/slimport/Kconfig:1:warning: multi-line strings not supported
When I try to build with an output now I get the error:

Code:
drivers/built-in.o: In function 'dwc3_msm_remove':
/home/uzephi/android/kernel/Nash_Kernel/drivers/usb/dwc3/dwc3-msm.c:3759: undefined reference to 'usb_ext_unregister_notifier'
/home/uzephi/android/kernel/Nash_Kernel/drivers/usb/dwc3/dwc3-msm.c:3759:(,text+0x351f98): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol 'usb_register_notifier'
Others in same file and a file in "sound/soc/codecs/mods_codec_shim" call26. different symbol, but same error besides that. Seems there is a file missing in source, or is it something else? If pointed in the right direction, I can fix it.

Original source: https://github.com/MotorolaMobilityL...1-release-nash only edits I did were to bad sym links (<> or " " incorrectly called, if I didn't fix that it would give me an error file not found, so I had to change those calls)

Edit: I used your toolchain and Google's 4.9 toolchain, both give that same error.
Attached Thumbnails
Click image for larger version

Name:	IMG_20171005_145806371.jpg
Views:	328
Size:	274.1 KB
ID:	4293590   Click image for larger version

Name:	IMG_20171005_150227933.jpg
Views:	328
Size:	264.3 KB
ID:	4293593  
 
 
6th October 2017, 12:37 AM |#62  
nathanchance's Avatar
OP Recognized Developer / Recognized Contributor
Flag Mesa, AZ
Thanks Meter: 50,736
 
More
Quote:
Originally Posted by Uzephi

from source, same build errors. When I do my make o=out msm-perf_defconfig I do see odd errors that might be contributing to the erros I had to correct and maybe I corrected them wrong. Below is the error.

Code:
warning: (SND_SOC_MSM8996) selects SND_SOC_MODS_CODEC_SHIM which has unmet direct dependencies (SOUND && ~N68K && !UNL && SND && SND_SOC && MODS_CODEC_BUS)
drivers/video/fbdev/slimport/Kconfig:1:warning: multi-line strings not supported
When I try to build with an output now I get the error:

Code:
drivers/built-in.o: In function 'dwc3_msm_remove':
/home/uzephi/android/kernel/Nash_Kernel/drivers/usb/dwc3/dwc3-msm.c:3759: undefined reference to 'usb_ext_unregister_notifier'
/home/uzephi/android/kernel/Nash_Kernel/drivers/usb/dwc3/dwc3-msm.c:3759:(,text+0x351f98): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol 'usb_register_notifier'
Others in same file and a file in "sound/soc/codecs/mods_codec_shim" call26. different symbol, but same error besides that. Seems there is a file missing in source, or is it something else? If pointed in the right direction, I can fix it.

Original source: https://github.com/MotorolaMobilityL...1-release-nash only edits I did were to bad sym links (<> or " " incorrectly called, if I didn't fix that it would give me an error file not found, so I had to change those calls)

Edit: I used your toolchain and Google's 4.9 toolchain, both give that same error.

Sigh... I see what's going on here. Open arch/arm64/configs/ext_config/moto-msmcortex.config. They have added all of their changed config options to this file, so you need to copy them into the msmcortex-perf_defconfig file. This would be a great time to create your own defconfig (copy msmcortex-perf_defconfig to whatever name you want to give your defconfig, open that file, copy the contents of the Motorola specific file to the end, and save it). I don't recommend regenerating the full defconfig like most kernel developers do as it can become difficult to see what was changed from the default value and what was changed specifically by the OEM.

I was able to just compile the kernel successfully with Google's stock toolchain, using only an out folder (no header edits needed).
Attached Thumbnails
Click image for larger version

Name:	Screen Shot 2017-10-05 at 4.37.15 PM.png
Views:	232
Size:	32.1 KB
ID:	4293631  
The Following User Says Thank You to nathanchance For This Useful Post: [ View ]
6th October 2017, 01:44 AM |#63  
Uzephi's Avatar
Recognized Contributor
Flag Phoenix
Thanks Meter: 1,789
 
More
Quote:
Originally Posted by nathanchance


Sigh... I see what's going on here. Open arch/arm64/configs/ext_config/moto-msmcortex.config. They have added all of their changed config options to this file, so you need to copy them into the msmcortex-perf_defconfig file. This would be a great time to create your own defconfig (copy msmcortex-perf_defconfig to whatever name you want to give your defconfig, open that file, copy the contents of the Motorola specific file to the end, and save it). I don't recommend regenerating the full defconfig like most kernel developers do as it can become difficult to see what was changed from the default value and what was changed specifically by the OEM.

I was able to just compile the kernel successfully with Google's stock toolchain, using only an out folder (no header edits needed).

That was from Motorola's Git? If I go directly from their git. I get flooded with errors on about 20-30 .c files like the attached image. I have to go and fix <> to "". Could it be something in my machine then?

Edit: found my issue. I wasn't specifying branch so it was erring on their current "working" branch since the defconfig for my device isn't the same for the "working" device. Man, Motorola should better separate that.
Attached Thumbnails
Click image for larger version

Name:	IMG_20171005_174358855.jpg
Views:	176
Size:	263.4 KB
ID:	4293672  
The Following User Says Thank You to Uzephi For This Useful Post: [ View ] Gift Uzephi Ad-Free
6th October 2017, 02:04 AM |#64  
nathanchance's Avatar
OP Recognized Developer / Recognized Contributor
Flag Mesa, AZ
Thanks Meter: 50,736
 
More
Quote:
Originally Posted by Uzephi

That was from Motorola's Git? If I go directly from their git. I get flooded with errors on about 20-30 .c files like the attached image. I have to go and fix <> to "". Could it be something in my machine then?

Here's what I did:

Code:
git clone https://github.com/MotorolaMobilityLLC/kernel-msm -b nougat-7.1.1-release-nash
cd kernel-msm
mkdir out
export ARCH=arm64 && export SUBARCH=arm64
export CROSS_COMPILE=blah
cp arch/arm64/configs/msmcortex-perf_defconfig arch/arm64/configs/flash_defconfig
cat arch/arm64/configs/ext_config/moto-msmcortex.config >> arch/arm64/configs/flash_defconfig

make O=out flash_defconfig
make O=out -j(nproc --all)
That should build (it did for me at least).

EDIT: Didn't catch your edit haha. Hopefully it builds without issues now!
6th October 2017, 02:07 AM |#65  
Uzephi's Avatar
Recognized Contributor
Flag Phoenix
Thanks Meter: 1,789
 
More
Quote:
Originally Posted by nathanchance

Here's what I did:

Code:
git clone https://github.com/MotorolaMobilityLLC/kernel-msm -b nougat-7.1.1-release-nash
cd kernel-msm
mkdir out
export ARCH=arm64 && export SUBARCH=arm64
export CROSS_COMPILE=blah
cp arch/arm64/configs/msmcortex-perf_defconfig arch/arm64/configs/flash_defconfig
cat arch/arm64/configs/ext_config/moto-msmcortex.config >> arch/arm64/configs/flash_defconfig

make O=out flash_defconfig
make O=out -j(nproc --all)
That should build (it did for me at least).

EDIT: Didn't catch your edit haha. Hopefully it builds without issues now!

Yes, I didn't specify branch so it was trying to build the 7.1.1-nash config on their "working" branch which is a ICS device since Motorola didn't like doing a repo for each device. That was my stupidity.

Edit: it built and booted! Now to attempt editing it. Thanks again for verifying it was user errors except for those extra lines of code tucked away in a different file, great find.
The Following User Says Thank You to Uzephi For This Useful Post: [ View ] Gift Uzephi Ad-Free
6th October 2017, 12:35 PM |#66  
zurik's Avatar
Senior Member
Flag ΘΕΣΣΑΛΟΝΙΚΗ
Thanks Meter: 283
 
More
I Get error Makefile:796: *** multiple target patterns. Stop.
6th October 2017, 03:35 PM |#67  
nathanchance's Avatar
OP Recognized Developer / Recognized Contributor
Flag Mesa, AZ
Thanks Meter: 50,736
 
More
Quote:
Originally Posted by AFK269

I Get error Makefile:796: *** multiple target patterns. Stop.

The <arch> part is your architecture, which for bullhead is arm64. So go to arch/arm64/configs and find the relevant defconfig to use (probably bullhead_defconfig or whatever a custom kernel has named theirs). It's generally obvious looking at the list of configs in that folder.

Going to have to be more specific with your commands and output for further help though.
6th October 2017, 03:41 PM |#68  
zurik's Avatar
Senior Member
Flag ΘΕΣΣΑΛΟΝΙΚΗ
Thanks Meter: 283
 
More
Quote:
Originally Posted by nathanchance

The <arch> part is your architecture, which for bullhead is arm64. So go to arch/arm64/configs and find the relevant defconfig to use (probably bullhead_defconfig or whatever a custom kernel has named theirs). It's generally obvious looking at the list of configs in that folder.

Going to have to be more specific with your commands and output for further help though.

I typed "make clean" and it gives me this error
6th October 2017, 03:44 PM |#69  
nathanchance's Avatar
OP Recognized Developer / Recognized Contributor
Flag Mesa, AZ
Thanks Meter: 50,736
 
More
Quote:
Originally Posted by AFK269

I typed "make clean" and it gives me this error

Okay... still doesn't tell me much. You're following the guide right?
6th October 2017, 04:01 PM |#70  
zurik's Avatar
Senior Member
Flag ΘΕΣΣΑΛΟΝΙΚΗ
Thanks Meter: 283
 
More
Quote:
Originally Posted by nathanchance

Okay... still doesn't tell me much. You're following the guide right?

What I did:
1. cd /home/user/Kernel
2. git clone -b android-msm-bullhead-3.10-oreo-r4 https://android.googlesource.com/kernel/msm/ bullhead
3. git clone https://android.googlesource.com/pla...ux-android-4.9
4. cd /home/user/Kernel/bullhead
5.
5.1. git remote add jolla https://github.com/jollaman999/jolla-kernel_bullhead
5.1.1. git fetch jolla
5.1.2. git cherry-pick <commit> (around 15 commits for kcal yellow screen fix and 1 for SafetyNet bypass)
5.2. git remote add franco https://github.com/franciscofranco/bullhead
5.2.1. git fetch franco
5.2.2. git cherry-pick <commit> (1 commit for wakelock restriction)
5.3. git remote add shadow https://github.com/mortezadadgar/shadow (Shadow Kernel for Bullhead)
5.3.1. git fetch shadow
5.3.2. git cherry-pick <commit> (1 commit for 2% battery drop fix)
6. cd ... (Moved to "Kernel" folder, not the source)
7. export CROSS_COMPILE=$(pwd)/bin/aarch64-linux-android-
8. export ARCH=arm64 && export SUBARCH=arm64
9. cd /home/user/Kernel/bullhead
10. make clean

and then I get the error Makefile:796: *** multiple target patterns. Stop.
6th October 2017, 04:22 PM |#71  
nathanchance's Avatar
OP Recognized Developer / Recognized Contributor
Flag Mesa, AZ
Thanks Meter: 50,736
 
More
Quote:
Originally Posted by AFK269

What I did:
1. cd /home/user/Kernel
2. git clone -b android-msm-bullhead-3.10-oreo-r4 https://android.googlesource.com/kernel/msm/ bullhead
3. git clone https://android.googlesource.com/pla...ux-android-4.9
4. cd /home/user/Kernel/bullhead
5.
5.1. git remote add jolla https://github.com/jollaman999/jolla-kernel_bullhead
5.1.1. git fetch jolla
5.1.2. git cherry-pick <commit> (around 15 commits for kcal yellow screen fix and 1 for SafetyNet bypass)
5.2. git remote add franco https://github.com/franciscofranco/bullhead
5.2.1. git fetch franco
5.2.2. git cherry-pick <commit> (1 commit for wakelock restriction)
5.3. git remote add shadow https://github.com/mortezadadgar/shadow (Shadow Kernel for Bullhead)
5.3.1. git fetch shadow
5.3.2. git cherry-pick <commit> (1 commit for 2% battery drop fix)
6. cd ... (Moved to "Kernel" folder, not the source)
7. export CROSS_COMPILE=$(pwd)/bin/aarch64-linux-android-
8. export ARCH=arm64 && export SUBARCH=arm64
9. cd /home/user/Kernel/bullhead
10. make clean

and then I get the error Makefile:796: *** multiple target patterns. Stop.

Number 7 should be

export CROSS_COMPILE=$(pwd)/aarch64-linux-android-4.9/bin/aarch64-linux-android-
The Following User Says Thank You to nathanchance For This Useful Post: [ View ]
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