How To Build Asus Zenfone Custom Kernel
NOTICE: if you copy this First Every tutorial for How to building Custom kernel for you Asus Zenfone, I hope I deserve to get a Credit for this Article Pinaslang Zenfone Blog
This day we will try to post a tutorial on how to build your Own Asus Zenfone Custom Kernel for your Asus Zenfone Android devices.
In this Tutorial i Will use a Asus Zenfone 5 as the base tutorial of this topic for day
In This build we need Android Kitkat source since our device in now running android kitkat 4.4.2 we the Android Source code for this in order to build kernel
Download source
cd [working dir]
repo init -u https://android.googlesource.com/platform/manifest -b android-4.4.2_r2
repo sync -j4
In my past tutorial I show here Android Build Environment For Your Ubuntu Linux with this guide will help you to prepare your Linux machine and help you to download the source so now we need the above android source in order to build Custom Kernel for our device like Asus Zenfone 5
After downloading the source we need to set our Tool chain to build this kernel
in your working directory open a CLI Terminal and follow this command below
cd prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.7
git checkout tools_r22.2
cd [working dir]
The above command is to checkout the tools_r22.2 this is the require toolchain for our tutorial so please be guide that not all android is some on toolchain if your advance user you can use different toolchain that you love in this tutorial i just want to give you the basic and idea of building this kernel for you
if you got error in your linux CLI Terminal about the tool chain you can download it manually
Download
tool_r22.2.tgz
and place in /workingdir/prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.7/[source here]
Now we have the Android source and we have the tool chain this time we the Android kernel source from the manufactories release
For Asus Zenfone 5
Dwonlaod -> kernel0130.zip
After you download extract in your working DIR in you Android source over write other files if needed
This time we will star the real build
open a CMD windows in your Working directory android source and follow the command bellow
source build/envsetup.sh
lunch aosp_x86-eng
make minigzip openssl -j4
The Above code is preparing the environment setup of your android source and lunch the x86 build structure and make minigzip and openssl by the speed on -j4
I hope you don't understand the above command code if you have problem you can search on google to learn more
the above command will take time to build the minigzip and openssl so better get some coffee and wait until finish
After all done build the minigzip and openssl build, this time we will now build the source code we download from the Asus Kernel follow the command below
make -f KernelMakefile TARGET_DEVICE=a500cg build_bzImage -j4
or
make -f KernelMakefile modules_install -j4
Note the the above TARGET_DEVICE=a500cg is for asus zenfone 5 T00J and T00F for asus Zenfone 6 TARGET_DEVICE=a600cg or other one is TARGET_DEVICE=a502cg
Note Asus Zenfone 5 T00f/t00f use the command that i post above
This will take time, depend on your computer / laptop speed always check the Linux terminal CLI if you got error so you need to fix it on your own but if you just use the provided source from Asus you will not get any error for building kernel so just follow this Guide so we don't get any problem
After the build is finish an youe're done building the bzimage this the kernel for our downloaded source you need to copy this bzimage and place in new folder for packing bzimage of Asus Zenfone to boot.img the location of this bzimage is
/workingDIR/out/target/product/a500cg/bzimage
Copy the bzimage now let procces to How to Pack and Repack boot.img or recovery.img of Asus Zenfone
Note: That this is working on Asus Zenfone 5 and 6 you if Your devices in other Asus Zenfone Find your Pack repack tools
Download Pack/Repacktool -> demofile.zip
credit to Shaka Huang
Now create new folder in you Desktop and name it to demo
in demo folder copy the bzimage after you copy this bzimage extract the Pack/Repacktool.zip to /demo folder
and set the permission of unpack_intel and pack_intel to 777 in order to use this tool will allow to execute and do the job we command
For unpacking boot.img you need to copy a Stock boot.img from the firmware note that we must use stock boot image boot.img from official firmware
create a folder inside demo folder name it stock and copy the boot.img and unpack_intel in stock folder open new CLI Terminal in Stock Folder and copy this command below
./unpack_intel boot.img bzImage ramdisk.cpio.gz
The above command will unpack the boot.img inside stock folder and it file give us ramdisk.cpio.gz and bzimage from stock kernel we just only need is the ramdisk.cpio.gz so we can pack the custome bzimage we made later and the stock ramdisk.cpio.gz
So copy the stock boot.img and ramdisk.cpio.gz in /demo folder which together with out custom bzimage we build later the structure of folder is
/demo/stock
/demo/boot.img
/demo/bzimage
/demo/pack
as you can see above folder structure so now open new Linux CLI Terminal inside the demo folder and follow the CLI Terminal command below
pack_intel boot.img bzImage ramdisk.cpio.gz new_boot.img
The above comand is to pack the ramdisk.cpio.gz + custom bzimage = new_boot.img by using the stock boot.img
i hope you get the idea of this the Custom kernel is new_boot.img Your done in Building custom kernel first is building from source new is upack the stock boot.img to get the ramdisk last is to pack the custome bzimage and stock ramdisk.zpio.gz and the product is the new custom kernel boot.img
For flashing the boot img for testing is you need to unlock your bootload this is needed in order to boot you must unlock your Bootloader and open new Linux CLI Terminal and reboot you phone in Droid boot or Bootloader and follow the flas h command bellow
fastboot flash boot new_boot.img
and reboot and check you android system if the new custom kernel is done Well job guys if you have problem with this let me know im glad to help you.
NOTICE: if you copy this First Ever tutorialof How to building Custom kernel for you Asus Zenfone I hope I deserve to get a Credit for this Article
0 comments:
Post a Comment