Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
186 views

Compile Your Own Kernel - XDA Forums

The document provides instructions for compiling a custom kernel for the Asus Zenfone 2 smartphone. It outlines downloading the necessary tools like the Java JDK and kernel sources. It then details the steps to configure, compile, and build a bootable image file that can be flashed to the device using a custom recovery like TWRP. The goal is to help others customize and improve the kernel for their device.

Uploaded by

宛俊
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
186 views

Compile Your Own Kernel - XDA Forums

The document provides instructions for compiling a custom kernel for the Asus Zenfone 2 smartphone. It outlines downloading the necessary tools like the Java JDK and kernel sources. It then details the steps to configure, compile, and build a bootable image file that can be flashed to the device using a custom recovery like TWRP. The goal is to help others customize and improve the kernel for their device.

Uploaded by

宛俊
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

2022/6/28 12:21 Compile your own kernel | XDA Forums

Check out the Oppo Ambassador Program Highlights and WIN! 󰅖

Compile your own kernel


󰀓
say99
· 󰅐
Feb 4, 2016

󰚡 󰅂 Forums 󰅂 Asus 󰅂 Asus ZenFone 2 󰅂 ZenFone 2 General

1 2 3 󰍟 Search This thread

say99
Senior Member
󰚼

Feb 4, 2016 󱔔 #1

COMPILE IT YOURSELF​
Hey everyone, you might be knowing me well

so here I am to give a guide on compiling your own kernels

I will not go into basics, like setting up linux in your pc or lappy

we will start from setting up the build environment

Installing the JDK​

Java 8: For the latest version of Android

For Unbuntu >= 15.04

Run the following:

Code:

https://forum.xda-developers.com/t/compile-your-own-kernel.3307932/ 1/15
2022/6/28 12:21 Compile your own kernel | XDA Forums
sudo apt-get update

sudo apt-get install openjdk-8-jdk

For Ubuntu LTS 14.04

Download the .deb packages for your architecture from http://packages.ubuntu.com/vivid/openjdk-8-jdk

openjdk-8-jre-headless : http://packages.ubuntu.com/vivid/openjdk-8-jre-headless

openjdk-8-jre : http://packages.ubuntu.com/vivid/openjdk-8-jre

openjdk-8-jdk : http://packages.ubuntu.com/vivid/openjdk-8-jdk

Install the packages:

󰍜 󰍉 Log in

Code:
New posts Manufacturers What's new 󰍝 Search forums Members 󰍝
sudo apt-get update

sudo dpkg -i {downloaded.deb file}

sudo apt-get -f install

Install required packages :

Code:

sudo apt-get install git-core gnupg flex bison gperf build-essential \

zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \

lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \

libgl1-mesa-dev libxml2-utils xsltproc unzip

installing and learn using git is your own task ​

clone the sources​

my kernel sources(flareM) : git clone https://github.com/Zenfone2-Dev/android_kernel_asus_moorefield

AEL kernel sources : git clone https://github.com/friedrich420/Ael-Zen-Kernel-Asus-Zenfone2-

thessj's project_T : git clone https://github.com/TheSSJ/android_kernel_asus_moorefield

stock cyanogen sources : git clone https://github.com/CyanogenMod/android_kernel_asus_moorefield

stock ASUS sources : http://dlcdnet.asus.com/pub/ASUS/ZenFone/ZE551ML/zenfone2MR912_2_20_40.zip #Download


and extract

ok now we need a toolchain to compile our kernel​

MY GCC 5.3.0 toolchain : https://github.com/Zenfone2-Dev/x86_64-toolchain-GCC-5.3.0 # run ./setup to finally setup


my toolchain

googles gcc 4.9 toolchain : https://github.com/Zenfone2-Dev/x86_64-linux-android-4.9

hyper linaro gcc 4.9 toolchain : https://github.com/Zenfone2-Dev/x86_64-linux-linaro4.9

SaberMod gcc 4.8 toolchain : https://github.com/hyper-toolchains/x86_64-linux-SM-4.8

I will focus on my toolchain so all command will be for it​

lets get to work

open home folder, show hidden files and open bash.rc

and paste these lines at the last

Code:

export ARCH=x86_64

export CCOMPILE=$CROSS_COMPILE

export CROSS COMPILE=x86 64-linux-


https://forum.xda-developers.com/t/compile-your-own-kernel.3307932/ 2/15
2022/6/28 12:21 Compile your own kernel | XDA Forums
export CROSS_COMPILE x86_64 linux

#change cross compile as per your toolchain

open terminal and type :

Code:

export PATH=/full path to toolchain/x86_64-toolchain-GCC-5.3.0/bin:$PATH

#I keep changing my toolchains, you can put this line in bash.rc if you dont want to change your toolchain

lets COMPILE ​
cd where ever you cloned your sources

if building from my source or cm sources :

Code:

make cyanogenmod_zenfone2_defconfig

if building for stock :

Code:

make x86_64_moor_defconfig

if you want to explore options :

Code:

make menuconfig

if building AEL or FlareM :

Code:

./buildzf2

#this will produce a flashable zip for all variants and I consider you all to study up the script

if building stock cm or ASUS :

Code:

make -j4

change 4 to no. of threads you got in your cpu


this will produce a bzImage in arch/x86/boot/bzImage

this bzImage need to be converted to flashable boot.img

download bzImage packer by @sorg : http://forum.xda-developers.com/attachment.php?


attachmentid=3383108&d=1435567526

extract it in a different folder

extract original boot.img from cm zip or asus zips

place it in that folder and open terminal there

type : ./extract boot


https://forum.xda-developers.com/t/compile-your-own-kernel.3307932/ 3/15
2022/6/28 12:21 Compile your own kernel | XDA Forums
type : ./extract_boot

delete the orignal boot.img


you will get a folder named boot which contains ramdisk and zImage and files (I dont exactly remeber)

copy your bzImage image in boot folder, delete zImage and rename bzImage to zImage

if you open ramdisk you will notice that the link to charger is broken (I had this problem)

delete that charger link

download this : https://drive.google.com/file/d/0B2DVhZKJ05fLWkdHUEdVdEU4bGs/view?usp=sharing

and paste it in ramdisk (actual charger binary)

and FINALLY lets get a boot.img​


in the same terminal(the previous location)

type :

Code:

./make_boot

and now we have a boot.img

wanna make it flashable via twrp (zip)??​


download any of the project_T kernel extract it, replace boot.img by your boot.img and zip it back

all thanks to @TheSSJ , changing name and all : no I wont tell you, explore the world

flash kernel via twrp

Adding features???​
there are numerous guides on adding features to the kernel google them out and start contributing and make our
zenny grow more

all the best


dreckneck, Raj.S, Axl_Mas and 20 others

kjinx01
Senior Member

Feb 4, 2016 󱔔 #2

Excellent work.. And I really appreciate ur nature for helping noobs..


dimitrakhs1

TheSSJ
Senior Member

Feb 4, 2016 󱔔 #3
https://forum.xda-developers.com/t/compile-your-own-kernel.3307932/ 4/15
2022/6/28 12:21 Compile your own kernel | XDA Forums
󱔔 3

Cool, maybe this helps implementing cool new features to kernels


Aceofzeroz

say99
Senior Member
󰚼

Feb 4, 2016 󱔔 #4

TheSSJ said: 󰕍

Cool, maybe this helps implementing cool new features to kernels

yes I hope that our community grows more and more

Sent from my ASUS_Z00A using Tapatalk


nazagan

Nyks45
Senior Member

Feb 4, 2016 󱔔 #5

great work


Aceofzeroz

https://forum.xda-developers.com/t/compile-your-own-kernel.3307932/ 5/15
2022/6/28 12:21 Compile your own kernel | XDA Forums

Ntrasme
N Senior Member

Feb 8, 2016 󱔔 #6

Hey, I tried compiling AEL Kernel from source. I already fixed an error in the configuration file that was hardcoded as
Fried's home folder, but I can't find the source of my problem.

The compilation stops after "LD drivers/built-in.o and arch/x86/boot/bzImage Does not exist". There aren't any obvious
errors, any help?

say99
Senior Member
󰚼

Feb 8, 2016 󱔔 #7

if you tell us the exact error that will be something like this make error[1] : blah blah

we can help you better

Sent from my ASUS_Z00A using IOS


Ntrasme

Ntrasme
N Senior Member

Feb 8, 2016 󱔔 #8

say99 said: 󰕍

if you tell us the exact error that will be something like this make error[1] : blah blah

we can help you better

Sent from my ASUS_Z00A using IOS

Is there a parameter I can enter to make the compilation more verbose? I didn't get a compilation error, but apparently
the script did not find "bzImage" in the folder. It ended exactly the way I told you. I'm trying it again, maybe it was a
one time thing...

---------- Post added at 09:18 PM ---------- Previous post was at 09:12 PM ----------

https://forum.xda-developers.com/t/compile-your-own-kernel.3307932/ 6/15
2022/6/28 12:21 Compile your own kernel | XDA Forums
Actually, I think I found the error :

"No rule to make target firmware/dfw_sst.bin, needed by firmware/dfw_sst.bin.gen.o"

"Makefile:823: recipe for target 'firmware' failed"

"Make: *** [firmware] Error 2"

say99
Senior Member
󰚼

Feb 8, 2016 󱔔 #9

that's really weird, I don't actually remember any changes made to firmware folder, you can use my make file from
firmware folder and try it out

Sent from my ASUS_Z00A using IOS

Ntrasme
N Senior Member

Feb 8, 2016 󱔔 #10

say99 said: 󰕍

that's really weird, I don't actually remember any changes made to firmware folder, you can use my make file from firmware
folder and try it out

Sent from my ASUS_Z00A using IOS

This is what I got, apparently it makes it automatically if the make fails:

CLICK TO SHOW CONTENT

https://forum.xda-developers.com/t/compile-your-own-kernel.3307932/ 7/15
2022/6/28 12:21 Compile your own kernel | XDA Forums

say99
Senior Member
󰚼

Feb 8, 2016 󱔔 #11

Ntrasme said: 󰕍

This is what I got, apparently it makes it automatically if the make fails:

CLICK TO SHOW CONTENT

I will have a look as soon as I reach home

Sent from my ASUS_Z00A using IOS


Ntrasme

say99
Senior Member
󰚼

Feb 8, 2016 󱔔 #12

Ntrasme said: 󰕍

This is what I got, apparently it makes it automatically if the make fails:

CLICK TO SHOW CONTENT

no worries bro, I am home now, will see what all need to be done ASAP

Sent from my ASUS_Z00A using IOS


Ntrasme

https://forum.xda-developers.com/t/compile-your-own-kernel.3307932/ 8/15
2022/6/28 12:21 Compile your own kernel | XDA Forums

harpreet.s
H Senior Member

Feb 8, 2016 󱔔 #13

Ntrasme said: 󰕍

Is there a parameter I can enter to make the compilation more verbose? I didn't get a compilation error, but apparently the
script did not find "bzImage" in the folder. It ended exactly the way I told you. I'm trying it again, maybe it was a one time
thing...

---------- Post added at 09:18 PM ---------- Previous post was at 09:12 PM ----------

Actually, I think I found the error :

"No rule to make target firmware/dfw_sst.bin, needed by firmware/dfw_sst.bin.gen.o"

"Makefile:823: recipe for target 'firmware' failed"


Click to expand...

It fails with same error for me also.

say99
Senior Member
󰚼

Feb 8, 2016 󱔔 #14

harpreet.s said: 󰕍

It fails with same error for me also.

@Ntrasme here's the fix :

download this file https://drive.google.com/file/d/0B2DVhZKJ05fLYTJWOU9BalpYUUk/view?usp=sharing

and paste it in firmware folder thn do a build

correct way to use build script is ./buildzf2 1


where 1 is the version no.

Last edited: Feb 8, 2016


Ntrasme and harpreet.s
https://forum.xda-developers.com/t/compile-your-own-kernel.3307932/ 9/15
2022/6/28 12:21 Compile your own kernel | XDA Forums
p

~cyandrew
Senior Member

Feb 8, 2016 󱔔 #15

Sir, will this method work for compiling an alps kernel ? My device is Lenovo A536 and it uses alps as source, which
came with my ROM source

say99
Senior Member
󰚼

Feb 8, 2016 󱔔 #16

~cyandrew said: 󰕍

Sir, will this method work for compiling an alps kernel ? My device is Lenovo A536 and it uses alps as source, which came
with my ROM source

set up your toolchain for mediatek i.e. arm if I am right, you get the correct toolchain on hyper-linaro toolchain repo,
and setting up correct path will work for sure

Sent from my ASUS_Z00A using IOS

Ntrasme
N
https://forum.xda-developers.com/t/compile-your-own-kernel.3307932/ 10/15
2022/6/28 12:21 Compile your own kernel | XDA Forums

N Senior Member

Feb 8, 2016 󱔔 #17

say99 said: 󰕍

@Ntrasme here's the fix :

download this file https://drive.google.com/file/d/0B2DVhZKJ05fLYTJWOU9BalpYUUk/view?usp=sharing

and paste it in firmware folder thn do a build

correct way to use build script is ./buildzf2 1

where 1 is the version no.

Thank you, I'll try it when I get home.

harpreet.s
H Senior Member

Feb 8, 2016 󱔔 #18

Ntrasme said: 󰕍

Thank you, I'll try it when I get home.

It worked .. booted my phone with AEL kernel successfully..


Ntrasme

say99
Senior Member
󰚼

Feb 8, 2016 󱔔 #19

harpreet.s said: 󰕍

It worked .. booted my phone with AEL kernel successfully..

just post here if you have any prob

Sent from my ASUS_Z00A using IOS


https://forum.xda-developers.com/t/compile-your-own-kernel.3307932/ 11/15
2022/6/28 12:21 Compile your own kernel | XDA Forums


harpreet.s

harpreet.s
Senior Member
H

Feb 8, 2016 󱔔 #20

say99 said: 󰕍

@Ntrasme here's the fix :

download this file https://drive.google.com/file/d/0B2DVhZKJ05fLYTJWOU9BalpYUUk/view?usp=sharing

and paste it in firmware folder thn do a build

correct way to use build script is ./buildzf2 1

where 1 is the version no.

Thank you bro , it worked.. successfully booted .. I had left hope after so much effort ... thanks 4 ur support through PM
and this guide..

1 2 3 󰍟 You must log in or register to reply here.

Share: 󰈌 󰕄 󰑍 󰖣 󰇰 󰌷

Similar threads

[Guide][Lollipop] How to Compile Your own ROM's for the Zenfone 2 Z00A/Z008
Niropa
· Sep 19, 2015
Replies
91 Views
25K󰼠 kjinx01 replied Oct 7, 2016

[LIGHTS!★CAMERA!★ACTION!] Post your Picture taken with Zenfone 2!


Cloudus91
· Apr 3, 2015
Replies
176 Views
54K󰼠 ashis.kyal replied Jan 5, 2016

[Z008/Z00A/Z00D/Z00X] RAW FW Collection


RealYoti
· Aug 27, 2016
Replies
69 Views
197K󰼠 AngeloXD replied Jul 13, 2019

【android m 6.0】everything you want about it. Comments, suggestion and expectations.
livewire168
· Nov 17, 2015
Replies
162 Views
39K󰼠 smokinjoe2122 replied Jan 23, 2016

[G ide][ZE500CL][RECOVER] [Unbrick][Dead] Bring Back to life o r enfone 2 ZE500CL


https://forum.xda-developers.com/t/compile-your-own-kernel.3307932/ 12/15
2022/6/28 12:21 Compile your own kernel | XDA Forums
[Guide][ZE500CL][RECOVER] [Unbrick][Dead] Bring Back to life your zenfone 2 ZE500CL
S sukhwant717
· Nov 19, 2016
Replies
40 Views
29K󰼠 Lostwon replied Feb 6, 2022

󰚡 󰅂 Forums 󰅂 Asus 󰅂 Asus ZenFone 2 󰅂 ZenFone 2 General

TOP LIKED POSTS

24 Hours All time

say99
23
COMPILE IT YOURSELF​
Hey everyone, you might be knowing me well

so here I am to give a guide on compiling your own kernels

I will not go into basics, like setting up linux in your pc or lappy

we will start from setting up the build environment

Installing the JDK​

Java 8: For the latest version of Android


Feb 4, 2016 View

say99
2
harpreet.s said: 󰕍

It fails with same error for me also.

@Ntrasme here's the fix :

download this file https://drive.google.com/file/d/0B2DVhZKJ05fLYTJWOU9BalpYUUk/view?usp=sharing

and paste it in firmware folder thn do a build

Feb 8, 2016 View

kjinx01
1
Excellent work.. And I really appreciate ur nature for helping noobs..
Feb 4, 2016 View

https://forum.xda-developers.com/t/compile-your-own-kernel.3307932/ 13/15
2022/6/28 12:21 Compile your own kernel | XDA Forums

1 TheSSJ

Cool, maybe this helps implementing cool new features to kernels


Feb 4, 2016 View

clan crate
1 C

nutcasev1.5 said: 󰕍

Export your tc path & prefix. Then try

how to export my tc path and prefix?

Aug 20, 2018 View

NE W POSTS

[MIUI Updates Tracker] Redmi 10X 5G (atom)


Latest: yshalsager
· A moment ago
Redmi 10X / 10X Pro Guides, News, & Discussion

How To Guide  [TUTORIAL] How To Unlock & Root Tab A7 Lite T220/T225, & Install LSPosed, Magisk,
Mods
Latest: nirogu325
· A moment ago
Samsung Galaxy Tab A7 Lite

General  [MIUI Updates Tracker] Redmi Note 9 4G / Redmi 9T / Redmi 9 Power (lime)
Latest: yshalsager
· 1 minute ago
Redmi 9 Power / 9T

R [ROM] UNOFFICIAL crDroid v7.19 [Android-11] [H830|H850|RS988]


Latest: ROMSG
· 2 minutes ago
LG G5 ROMs, Kernels, Recoveries, & Other Developme

A [ROM][12][OFFICIAL] crDroid 8.6


Latest: aserraric
· 2 minutes ago
Samsung Galaxy Tab S5e ROMs, Kernels, Recoveries,

XDA Developers was founded by developers, for developers. It is now a valuable resource for people who want to
make the most of their mobile devices, from customizing the look and feel to adding new functionality.

Crafted by Audentio

MORE INFO USEFUL LINKS


https://forum.xda-developers.com/t/compile-your-own-kernel.3307932/ 14/15
2022/6/28 12:21 Compile your own kernel | XDA Forums
MORE INFO USEFUL LINKS

Contact us Best Phones


Advertise Root Any Device

Terms and rules Tutorials


Suggest Content How to install TWRP

How to install a custom ROM


Recognized Developer Program

SUBSCRIBE TO OUR NE WSLET TER

Receive the freshest Android & development news right in your inbox!

your@email 󰁔

󰈌 󰙯 󰋾 󰕄 󰗃 󰔁

XDA - Dark

https://forum.xda-developers.com/t/compile-your-own-kernel.3307932/ 15/15

You might also like