• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[GUIDE]Building a Kernel from source{Mediatek}

Search This thread

zadanar

New member
Oct 2, 2017
2
0
help MasterAwesome and XDA...

i have acer liquid x1 bricked no recovery, can you help me how to build images? i have kernel source code and i build my kernel with cross compile and success, but i dont`t know how to build boot.img and recovery.img.. please help me XDA people and MasterAwesome.... im using linux ubuntu 16.04 LTS...
 

doulc

Senior Member
Dec 10, 2016
243
87
newbie here, what is this?
[email protected]:~/kernel$ make -j9
make: /home/dpi/toolchain/bin/aarch64-linux-android-aarch64-linux-android-gcc: Command not found
make: /home/dpi/toolchain/bin/aarch64-linux-android-aarch64-linux-android-gcc: Command not found
make[1]: /home/dpi/toolchain/bin/aarch64-linux-android-aarch64-linux-android-gcc: Command not found
scripts/kconfig/conf --silentoldconfig Kconfig
Kconfig:15:warning: environment variable ANDROID_MAJOR_VERSION undefined
drivers/media/mtv/sms3230/Kconfig:51:warning: ignoring type redefinition of 'SMS_USB_DRV' from 'tristate' to 'boolean'
drivers/media/mtv/sms3230/Kconfig:58:warning: ignoring type redefinition of 'SMS_SDIO_DRV' from 'tristate' to 'boolean'
make: /home/dpi/toolchain/bin/aarch64-linux-android-aarch64-linux-android-gcc: Command not found
make: /home/dpi/toolchain/bin/aarch64-linux-android-aarch64-linux-android-gcc: Command not found
INFO: CC is /home/dpi/toolchain/bin/aarch64-linux-android-aarch64-linux-android-gcc
CHK include/config/kernel.release
WRAP arch/arm64/include/generated/asm/bug.h
WRAP arch/arm64/include/generated/asm/clkdev.h
WRAP arch/arm64/include/generated/asm/checksum.h
WRAP arch/arm64/include/generated/asm/current.h
WRAP arch/arm64/include/generated/asm/delay.h
WRAP arch/arm64/include/generated/asm/cputime.h
WRAP arch/arm64/include/generated/asm/bugs.h
WRAP arch/arm64/include/generated/asm/div64.h
WRAP arch/arm64/include/generated/asm/dma.h
WRAP arch/arm64/include/generated/asm/dma-contiguous.h
CHK include/generated/uapi/linux/version.h
WRAP arch/arm64/include/generated/asm/early_ioremap.h
WRAP arch/arm64/include/generated/asm/emergency-restart.h
WRAP arch/arm64/include/generated/asm/ftrace.h
UPD include/generated/uapi/linux/version.h
WRAP arch/arm64/include/generated/asm/hw_irq.h
WRAP arch/arm64/include/generated/asm/hash.h
WRAP arch/arm64/include/generated/asm/ioctl.h
WRAP arch/arm64/include/generated/asm/ioctls.h
WRAP arch/arm64/include/generated/asm/irq_regs.h
WRAP arch/arm64/include/generated/asm/ipcbuf.h
WRAP arch/arm64/include/generated/asm/kmap_types.h
WRAP arch/arm64/include/generated/asm/kvm_para.h
WRAP arch/arm64/include/generated/asm/errno.h
WRAP arch/arm64/include/generated/asm/msgbuf.h
WRAP arch/arm64/include/generated/asm/mcs_spinlock.h
WRAP arch/arm64/include/generated/asm/kdebug.h
WRAP arch/arm64/include/generated/asm/local64.h
WRAP arch/arm64/include/generated/asm/local.h
WRAP arch/arm64/include/generated/asm/mman.h
WRAP arch/arm64/include/generated/asm/pci.h
WRAP arch/arm64/include/generated/asm/mutex.h
WRAP arch/arm64/include/generated/asm/pci-bridge.h
WRAP arch/arm64/include/generated/asm/poll.h
WRAP arch/arm64/include/generated/asm/preempt.h
UPD include/config/kernel.release
WRAP arch/arm64/include/generated/asm/resource.h
WRAP arch/arm64/include/generated/asm/rwsem.h
WRAP arch/arm64/include/generated/asm/scatterlist.h
WRAP arch/arm64/include/generated/asm/sections.h
WRAP arch/arm64/include/generated/asm/segment.h
WRAP arch/arm64/include/generated/asm/sembuf.h
WRAP arch/arm64/include/generated/asm/serial.h
WRAP arch/arm64/include/generated/asm/shmbuf.h
WRAP arch/arm64/include/generated/asm/simd.h
WRAP arch/arm64/include/generated/asm/sizes.h
WRAP arch/arm64/include/generated/asm/socket.h
WRAP arch/arm64/include/generated/asm/sockios.h
WRAP arch/arm64/include/generated/asm/swab.h
WRAP arch/arm64/include/generated/asm/switch_to.h
WRAP arch/arm64/include/generated/asm/termbits.h
WRAP arch/arm64/include/generated/asm/termios.h
WRAP arch/arm64/include/generated/asm/topology.h
WRAP arch/arm64/include/generated/asm/trace_clock.h
WRAP arch/arm64/include/generated/asm/types.h
WRAP arch/arm64/include/generated/asm/unaligned.h
WRAP arch/arm64/include/generated/asm/user.h
WRAP arch/arm64/include/generated/asm/vga.h
WRAP arch/arm64/include/generated/asm/xor.h
CHK include/generated/utsrelease.h
WRAP arch/arm64/include/generated/uapi/asm/kvm_para.h
UPD include/generated/utsrelease.h
HOSTCC scripts/kallsyms
HOSTCC scripts/sortextable
HOSTCC scripts/dtc/flattree.o
CC scripts/mod/empty.o
HOSTCC scripts/dtc/fstree.o
/bin/sh: 1: /home/dpi/toolchain/bin/aarch64-linux-android-aarch64-linux-android-gcc: not found
scripts/Makefile.build:257: recipe for target 'scripts/mod/empty.o' failed
make[2]: *** [scripts/mod/empty.o] Error 127
make[2]: *** Waiting for unfinished jobs....
scripts/Makefile.build:402: 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/dtc/dtc.o
HOSTCC scripts/selinux/mdp/mdp
HOSTCC scripts/selinux/genheaders/genheaders
HOSTCC scripts/dtc/livetree.o
HOSTCC scripts/dtc/treesource.o
HOSTCC scripts/dtc/srcpos.o
HOSTCC scripts/dtc/checks.o
HOSTCC scripts/dtc/util.o
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-lexer.lex.o
HOSTCC scripts/dtc/dtc-parser.tab.o
HOSTLD scripts/dtc/dtc
Makefile:585: recipe for target 'scripts' failed
make: *** [scripts] Error 2
 

kirito9

Inactive Recognized Contributor
Oct 30, 2013
3,125
1,360
newbie here, what is this?
[email protected]:~/kernel$ make -j9
make: /home/dpi/toolchain/bin/aarch64-linux-android-aarch64-linux-android-gcc: Command not found
make: /home/dpi/toolchain/bin/aarch64-linux-android-aarch64-linux-android-gcc: Command not found
make[1]: /home/dpi/toolchain/bin/aarch64-linux-android-aarch64-linux-android-gcc: Command not found
scripts/kconfig/conf --silentoldconfig Kconfig
Kconfig:15:warning: environment variable ANDROID_MAJOR_VERSION undefined
drivers/media/mtv/sms3230/Kconfig:51:warning: ignoring type redefinition of 'SMS_USB_DRV' from 'tristate' to 'boolean'
drivers/media/mtv/sms3230/Kconfig:58:warning: ignoring type redefinition of 'SMS_SDIO_DRV' from 'tristate' to 'boolean'
make: /home/dpi/toolchain/bin/aarch64-linux-android-aarch64-linux-android-gcc: Command not found
make: /home/dpi/toolchain/bin/aarch64-linux-android-aarch64-linux-android-gcc: Command not found
INFO: CC is /home/dpi/toolchain/bin/aarch64-linux-android-aarch64-linux-android-gcc
CHK include/config/kernel.release
WRAP arch/arm64/include/generated/asm/bug.h
WRAP arch/arm64/include/generated/asm/clkdev.h
WRAP arch/arm64/include/generated/asm/checksum.h
WRAP arch/arm64/include/generated/asm/current.h
WRAP arch/arm64/include/generated/asm/delay.h
WRAP arch/arm64/include/generated/asm/cputime.h
WRAP arch/arm64/include/generated/asm/bugs.h
WRAP arch/arm64/include/generated/asm/div64.h
WRAP arch/arm64/include/generated/asm/dma.h
WRAP arch/arm64/include/generated/asm/dma-contiguous.h
CHK include/generated/uapi/linux/version.h
WRAP arch/arm64/include/generated/asm/early_ioremap.h
WRAP arch/arm64/include/generated/asm/emergency-restart.h
WRAP arch/arm64/include/generated/asm/ftrace.h
UPD include/generated/uapi/linux/version.h
WRAP arch/arm64/include/generated/asm/hw_irq.h
WRAP arch/arm64/include/generated/asm/hash.h
WRAP arch/arm64/include/generated/asm/ioctl.h
WRAP arch/arm64/include/generated/asm/ioctls.h
WRAP arch/arm64/include/generated/asm/irq_regs.h
WRAP arch/arm64/include/generated/asm/ipcbuf.h
WRAP arch/arm64/include/generated/asm/kmap_types.h
WRAP arch/arm64/include/generated/asm/kvm_para.h
WRAP arch/arm64/include/generated/asm/errno.h
WRAP arch/arm64/include/generated/asm/msgbuf.h
WRAP arch/arm64/include/generated/asm/mcs_spinlock.h
WRAP arch/arm64/include/generated/asm/kdebug.h
WRAP arch/arm64/include/generated/asm/local64.h
WRAP arch/arm64/include/generated/asm/local.h
WRAP arch/arm64/include/generated/asm/mman.h
WRAP arch/arm64/include/generated/asm/pci.h
WRAP arch/arm64/include/generated/asm/mutex.h
WRAP arch/arm64/include/generated/asm/pci-bridge.h
WRAP arch/arm64/include/generated/asm/poll.h
WRAP arch/arm64/include/generated/asm/preempt.h
UPD include/config/kernel.release
WRAP arch/arm64/include/generated/asm/resource.h
WRAP arch/arm64/include/generated/asm/rwsem.h
WRAP arch/arm64/include/generated/asm/scatterlist.h
WRAP arch/arm64/include/generated/asm/sections.h
WRAP arch/arm64/include/generated/asm/segment.h
WRAP arch/arm64/include/generated/asm/sembuf.h
WRAP arch/arm64/include/generated/asm/serial.h
WRAP arch/arm64/include/generated/asm/shmbuf.h
WRAP arch/arm64/include/generated/asm/simd.h
WRAP arch/arm64/include/generated/asm/sizes.h
WRAP arch/arm64/include/generated/asm/socket.h
WRAP arch/arm64/include/generated/asm/sockios.h
WRAP arch/arm64/include/generated/asm/swab.h
WRAP arch/arm64/include/generated/asm/switch_to.h
WRAP arch/arm64/include/generated/asm/termbits.h
WRAP arch/arm64/include/generated/asm/termios.h
WRAP arch/arm64/include/generated/asm/topology.h
WRAP arch/arm64/include/generated/asm/trace_clock.h
WRAP arch/arm64/include/generated/asm/types.h
WRAP arch/arm64/include/generated/asm/unaligned.h
WRAP arch/arm64/include/generated/asm/user.h
WRAP arch/arm64/include/generated/asm/vga.h
WRAP arch/arm64/include/generated/asm/xor.h
CHK include/generated/utsrelease.h
WRAP arch/arm64/include/generated/uapi/asm/kvm_para.h
UPD include/generated/utsrelease.h
HOSTCC scripts/kallsyms
HOSTCC scripts/sortextable
HOSTCC scripts/dtc/flattree.o
CC scripts/mod/empty.o
HOSTCC scripts/dtc/fstree.o
/bin/sh: 1: /home/dpi/toolchain/bin/aarch64-linux-android-aarch64-linux-android-gcc: not found
scripts/Makefile.build:257: recipe for target 'scripts/mod/empty.o' failed
make[2]: *** [scripts/mod/empty.o] Error 127
make[2]: *** Waiting for unfinished jobs....
scripts/Makefile.build:402: 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/dtc/dtc.o
HOSTCC scripts/selinux/mdp/mdp
HOSTCC scripts/selinux/genheaders/genheaders
HOSTCC scripts/dtc/livetree.o
HOSTCC scripts/dtc/treesource.o
HOSTCC scripts/dtc/srcpos.o
HOSTCC scripts/dtc/checks.o
HOSTCC scripts/dtc/util.o
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-lexer.lex.o
HOSTCC scripts/dtc/dtc-parser.tab.o
HOSTLD scripts/dtc/dtc
Makefile:585: recipe for target 'scripts' failed
make: *** [scripts] Error 2

Check your toolchain path that you're sending you the terminal.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 40
    Guide to Mediatek Building(Guide 1:=Kernel)

    Here, we'll be talking about how to build kernels and how they are different than the ones we've built for Qualcomm.

    Requisites
    A linux machine
    Required Packages(Attached in 2nd post)
    C programming and a knowledge about Makefiles
    NDK


    Lets begin,

    Step 1(Setting up the build environment):=As always we have to set up the build environment so that the linux knows we are building something.
    This is how we do it
    Code:
    export TARGET_BUILD_VARIANT=user TARGET_PRODUCT=devicename MTK_ROOT_CUSTOM=../mediatek/custom/ TARGET_KERNEL_VERSION=devicename &&export PATH=pathToDir/arm-eabi-4.6/bin:$PATH&&export CROSS_COMPILE=arm-eabi-&&export ARCH=arm

    Let me explain what this does
    The BUILD_VARIANT specifies what the kernel is going to be built for. A very good article i came across for explaining the build-variants is here.
    The TARGET_PRODUCT/TARGET_KERNEL_PRODUCT tells the linux machine what "device specific" files to use
    The MTK_ROOT_CUSTOM specifies the directory of the mediatek/custom folder. remember this mide be in the same directory as the kernel source as well.
    The PATHThis sets your toolchain executables to your path. Download toolchain(preferably arm-eabi-4.6) Or, if you want to, you could build your own toolchain from source code
    The CROSS_COMPILE, A cross compiler is a compiler capable of creating executable code for a platform other than the one on which the compiler is running. The toolchain facilitates this function
    ARCH=arm, ARM is a family of instruction set architectures for computer processors based on a reduced instruction set computing (RISC) architecture developed by British company ARM Holdings. ARM is also used in Android. Here by typing
    Code:
    export ARCH=arm
    we are telling linux that we are going to be building for the CPU architecture "ARM".

    Thats enough theory, lets get our hands dirty :cool:

    Step 2(Configuring your kernel):=This is the heart to what your phone does so be careful when you do this if you're doubtful about something dont hesitate to ask me in the thread.. the base config is usually present in the kernel_source/mediatek/config/devicename/autoconfig/kconfig/platform. this is your base config which you will use and build with different requirments(Example:SELinux). You can always build a config from the start, I advice you dont do that until you have compiled a few kernels before. for using existing config as a base
    Code:
    cd kernel_source
    cp mediatek/config/devicename/autoconfig/kconfig/platform .config
    Now,
    Code:
    make menuconfig
    This will give a graphical interface for you to choose what features you want to add to your phone(Example:I/O Schedule,CPU Governors..) More about this here. You're now ready for compiling

    Step 3(Compiling):=This is the moment of truth; This is what youve been waiting for! Now, type
    Code:
    make zImage

    You will get something which says
    Code:
    arch/arm/boot/zImage Ready

    Step 4(Adding MediaTek headers):=[GUIDE]Building Mediatek boot.img{Appending headers}. This is my next guide, follow this to your way to compile a whole ROM for your phone.

    Now, use your source code to build a ramdisk for you by typing make bootimage. in the out folder you'll get a folder called root. This folder is the initramfs or the ramdisk. to this follow my next guide to understand how to append mediatek headers


    Code:
    make modules

    This is almost the most important step or your ROMS wont boot. after this is complete go to your sourcedir then in search type ".ko" you'll get a bunch of .ko files copy these to your device tree/ROM to make the rom to work.

    If you're moving to a device tree make sure to add this to your device_makefile
    Code:
    PRODUCT_COPY_FILES += \
    $(MOD_SRC)/ccci.ko:$(MOD_TGT)/ccci.ko \
    $(MOD_SRC)/ccci_plat.ko:$(MOD_TGT)/ccci_plat.ko \
    $(MOD_SRC)/devapc.ko:$(MOD_TGT)/devapc.ko \
    $(MOD_SRC)/devinfo.ko:$(MOD_TGT)/devinfo.ko \
    $(MOD_SRC)/mtk_fm_drv.ko:$(MOD_TGT)/mtk_fm_drv.ko \
    $(MOD_SRC)/mtk_hif_sdio.ko:$(MOD_TGT)/mtk_hif_sdio.ko \
    $(MOD_SRC)/mtk_stp_bt.ko:$(MOD_TGT)/mtk_stp_bt.ko \
    $(MOD_SRC)/mtk_stp_gps.ko:$(MOD_TGT)/mtk_stp_gps.ko \
    $(MOD_SRC)/mtk_stp_uart.ko:$(MOD_TGT)/mtk_stp_uart.ko \
    $(MOD_SRC)/mtk_stp_wmt.ko:$(MOD_TGT)/mtk_stp_wmt.ko \
    $(MOD_SRC)/mtk_wmt_wifi.ko:$(MOD_TGT)/mtk_wmt_wifi.ko \
    $(MOD_SRC)/mtklfb.ko:$(MOD_TGT)/mtklfb.ko \
    $(MOD_SRC)/pvrsrvkm.ko:$(MOD_TGT)/pvrsrvkm.ko \
    $(MOD_SRC)/scsi_tgt.ko:$(MOD_TGT)/scsi_tgt.ko \
    $(MOD_SRC)/scsi_wait_scan.ko:$(MOD_TGT)/scsi_wait_scan.ko \
    $(MOD_SRC)/sec.ko:$(MOD_TGT)/sec.ko \
    $(MOD_SRC)/vcodec_kernel_driver.ko:$(MOD_TGT)/vcodec_kernel_driver.ko \
    $(MOD_SRC)/wlan_mt6628.ko:$(MOD_TGT)/wlan_mt6628.ko

    This copies your custom built modules to the Module out folder. In BoardConfig.mk add
    Code:
    TARGET_PREBUILT_KERNEL := $(DEVICE_FOLDER)/prebuilt/kernel
    ..

    Remember :If you're building kernel for already existing 4.2 roms disable SELINUX support by going into security options inside menuconfig

    You're done!!

    All Questions and feedbacks are welcome in the thread
    Be sure to drop a thanks if you thought this was usefull

    Happy Building.

    --------------------------------------------------
    Links to my next Guides
    Building the boot.img{MediaTek}
    Building the ROM{MediaTek}
    9
    Build Packages

    Required packages before building



    Python 2.6 -- 2.7, which you can download from python.org.

    GNU Make 3.81 -- 3.82, which you can download from gnu.org,

    JDK 6 if you wish to build Gingerbread or newer; JDK 5 for Froyo or older. You can download both from java.sun.com.

    Git 1.7 or newer. You can find it at git-scm.com.



    #Required packages

    Code:
    sudo apt-get install git gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 git-core lzop ccache gnupg flex bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32ncurses5 lib32z1 lib32bz2-1.0 lib32ncurses5-dev x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 lib32z-dev libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc readline-common libreadline6-dev libreadline6 lib32readline-gplv2-dev libncurses5-dev lib32readline5 lib32readline6 libreadline-dev libreadline6-dev:i386 libreadline6:i386 bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev lib32bz2-dev libsdl1.2-dev libesd0-dev squashfs-tools pngcrush schedtool libwxgtk2.8-dev python gcc g++ cpp gcc-4.8 g++-4.8 && sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

    Go to etc/udev/rules.d/51-android.rules

    Code:
    # adb protocol on passion (Nexus One)
    SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e12", MODE="0600", OWNER="<username>"
    # fastboot protocol on passion (Nexus One)
    SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0fff", MODE="0600", OWNER="<username>"
    # adb protocol on crespo/crespo4g (Nexus S)
    SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e22", MODE="0600", OWNER="<username>"
    # fastboot protocol on crespo/crespo4g (Nexus S)
    SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e20", MODE="0600", OWNER="<username>"
    # adb protocol on stingray/wingray (Xoom)
    SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", ATTR{idProduct}=="70a9", MODE="0600", OWNER="<username>"
    # fastboot protocol on stingray/wingray (Xoom)
    SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="708c", MODE="0600", OWNER="<username>"
    # adb protocol on maguro/toro (Galaxy Nexus)
    SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0600", OWNER="<username>"
    # fastboot protocol on maguro/toro (Galaxy Nexus)
    SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e30", MODE="0600", OWNER="<username>"
    # adb protocol on panda (PandaBoard)
    SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d101", MODE="0600", OWNER="<username>"
    # adb protocol on panda (PandaBoard ES)
    SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="d002", MODE="0600", OWNER="<username>"
    # fastboot protocol on panda (PandaBoard)
    SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d022", MODE="0600", OWNER="<username>"
    # usbboot protocol on panda (PandaBoard)
    SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d00f", MODE="0600", OWNER="<username>"
    # usbboot protocol on panda (PandaBoard ES)
    SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d010", MODE="0600", OWNER="<username>"
    # adb protocol on grouper/tilapia (Nexus 7)
    SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e42", MODE="0600", OWNER="<username>"
    # fastboot protocol on grouper/tilapia (Nexus 7)
    SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e40", MODE="0600", OWNER="<username>"
    # adb protocol on manta (Nexus 10)
    SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee2", MODE="0600", OWNER="<username>"
    # fastboot protocol on manta (Nexus 10)
    SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee0", MODE="0600", OWNER="<username>"




    In bash.rc
    Code:
    export USE_CCACHE=1

    Beter way installing java
    Code:
    sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
    sudo add-apt-repository ppa:webupd8team/java
    sudo apt-get update && sudo apt-get install oracle-java6-installer

    Reuqired package check
    Code:
    sudo apt-get install git-core lzop ccache gnupg flex bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32ncurses5 lib32z1 lib32bz2-1.0 lib32ncurses5-dev x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 lib32z-dev libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc readline-common libreadline6-dev libreadline6 lib32readline-gplv2-dev libncurses5-dev lib32readline5 lib32readline6 libreadline-dev libreadline6-dev:i386 libreadline6:i386 bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev lib32bz2-dev libsdl1.2-dev libesd0-dev squashfs-tools pngcrush schedtool libwxgtk2.8-dev python gcc g++ cpp gcc-4.8 g++-4.8

    THIS
    Code:
    sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so




    You're done
    4
    I think I`m getting error because the toolchain.
    As Grand Prime Duos has a x64 cpu arquitecture, I used this toolschains to compile: aarch64-linux-android-4.9.
    I tried with arm-linux-androideabi-4.9 (x64) too...


    Which toolchain should I have to use to compile the kernel?

    Thanks!

    Arm-eabi 4.4 / 4.6 to until JB 4.2
    Arm-eabi 4.6 for mtk KK 4.4.2
    arm-eabi 4.7 for mtk KK 4.4.4
    arm-eabi 4.8 for mtk LL 5.0/ 5.1

    You can use whatever toolchain, but depending on your source / platform core OS, you may need to fix the source to work with higher toolchains.

    The ones i mention are the recommended for The OS versions

    Linaro toolchains, will also need some work, depending on your OS version / source

    cheers
    4
    @abiolakunle
    You're getting error because
    You're dividing somthing by zero
    3
    @MasterAwesome this went a little bit over my head....:confused:

    i understood till making zimage,,,,,after that how to make it a boot img...:confused:

    After compiling the zImage, move it to your device tree in your source code. under a folder called prebuilts. Look at my git repo for more reference a210_device_tree. As i said add a flag in the BoardConfig.mk
    Code:
    TARGET_PREBUILT_KERNEL:=sourcetokernel
    . then, we use the the PRODUCT_COPY_FILES to copy the kernel specific files. since modules are kernel specific you'd have to use the modules you built or you'll get a boot loop.