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

[GUIDE]Building a Kernel from source{Mediatek}

Search This thread

ranchu-panchu

Senior Member
Nov 16, 2016
144
4
Yes, I think you're right and I have mistaken.
It is mtk6580, android 5.1
I am trying now to check with NO.1 if they can provide the source code.
Aren't they obliged to provide kernel source code (GPL) ?


It is using android 5.1? I thought it was 6.0 and I thought the chipset was mt6580.

If no kernel sources, then you would have to use prebuilt kernel.
 

kirito9

Inactive Recognized Contributor
Oct 30, 2013
3,125
1,361
Yes, I think you're right and I have mistaken.
It is mtk6580, android 5.1
I am trying now to check with NO.1 if they can provide the source code.
Aren't they obliged to provide kernel source code (GPL) ?

Yeah, they're supposed to but welcome to Mediatek devices, where source code for devices is few and sometimes incomplete.

Ahh 5.1, yes I remember now. CM 13 is an upgrade to the OS.
 

Nonta72

Senior Member
Mar 27, 2013
1,547
740
Speed Force
Can this guide be used on 3.18 kernel mt6580 chipset?
I can't find:
Code:
cp mediatek/config/devicename/autoconfig/kconfig/platform .config
in the kernel source.
@MasterAwesome @Nonta72

You do not need to cp the defconfig.
If everything is properly set up (export the toolchain and the arch especially).
You just move to kernel directory and do
Code:
make device-codename_defconfig
That will generate the .config file in the root of the kernel directory.
 
  • Like
Reactions: Mysteryagr

ranchu-panchu

Senior Member
Nov 16, 2016
144
4
Hi,

Do we need to build the device tree too ?
If not - how does the build knows the biard settings, in other words does mtk 6572 kernel source should work with any device which uses mtk6572 ?
How should I determine what to put in TARGET_PRODUCT ?
Thanks,
Ran
 
Last edited:

ranchu-panchu

Senior Member
Nov 16, 2016
144
4
I've made many trials, but it always fails in something else.
I wander if anyone can please give good example with some mediatek kernel source , which we can try and see if it works. That's really frustrating, if anyone had success with it (with mediatek!) ,then a good tutorial will help so much.
 

RX1901

Member
Jan 14, 2017
15
2
Hi all,
how "generic" is the kernel? E.g. when building it for a mt6753, will it boot all phones with that chipset? Or are individual settings for each phone necessary?

Thanks.

Best regards,

RX1901
 

kirito9

Inactive Recognized Contributor
Oct 30, 2013
3,125
1,361
Hi all,
how "generic" is the kernel? E.g. when building it for a mt6753, will it boot all phones with that chipset? Or are individual settings for each phone necessary?

Thanks.

Best regards,

RX1901

Each kernel for each device is different and there is no "generic" kernel.

---------- Post added at 05:13 PM ---------- Previous post was at 05:02 PM ----------

Hi,

Do we need to build the device tree too ?
If not - how does the build knows the biard settings, in other words does mtk 6572 kernel source should work with any device which uses mtk6572 ?
How should I determine what to put in TARGET_PRODUCT ?
Thanks,
Ran

No you do not need the device tree when building the kernel. One mt6572 source will not work for another device, that's not how kernels work. The TARGET_PRODUCT is what the codename of your device is. It's usually in the readme of the source or in the "config" folder.
 

RX1901

Member
Jan 14, 2017
15
2
Each kernel for each device is different and there is no "generic" kernel.

That's clear. But when compiling it for a specific chipset (e.g. mt6753) it should boot every phone with that chipset, right?
I haven't found any kernel-config-hints on my phone (no config.gz or similar) that I could use. So I'm bound to the generic (chipset-specific) approach. That's all I know...
 

kirito9

Inactive Recognized Contributor
Oct 30, 2013
3,125
1,361
That's clear. But when compiling it for a specific chipset (e.g. mt6753) it should boot every phone with that chipset, right?
I haven't found any kernel-config-hints on my phone (no config.gz or similar) that I could use. So I'm bound to the generic (chipset-specific) approach. That's all I know...

Still saying it should boot every phone with that chipset is wrong. Open your build.prop and search for this line "from/out/target/product/mt6753/obj/CUSTGEN". Look for the string of text after product. That's the name of your defconfig that you use to compile the kernel. Mt6753 is just an example.
 

RX1901

Member
Jan 14, 2017
15
2
Still saying it should boot every phone with that chipset is wrong. Open your build.prop and search for this line "from/out/target/product/mt6753/obj/CUSTGEN". Look for the string of text after product. That's the name of your defconfig that you use to compile the kernel. Mt6753 is just an example.

There is no similar line in build.prop. But there are some lines that point to two devices:
ro.board.platform=mt6753
ro.wtk.board.platform=mt6753
mediatek.wlan.module.postfix=_consys_mt6735
Any ideas why one is set to 6753 and the other to 6735?

Thanks.
 

kirito9

Inactive Recognized Contributor
Oct 30, 2013
3,125
1,361
There is no similar line in build.prop. But there are some lines that point to two devices:
ro.board.platform=mt6753
ro.wtk.board.platform=mt6753
mediatek.wlan.module.postfix=_consys_mt6735
Any ideas why one is set to 6753 and the other to 6735?

Thanks.

Hmmm, send me your build.prop and I'll check it.
 

kirito9

Inactive Recognized Contributor
Oct 30, 2013
3,125
1,361
There is no similar line in build.prop. But there are some lines that point to two devices:
ro.board.platform=mt6753
ro.wtk.board.platform=mt6753
mediatek.wlan.module.postfix=_consys_mt6735
Any ideas why one is set to 6753 and the other to 6735?

Thanks.

That isn't the correct place to download mediatek kernel sources as I said, each device has it's own source. You need to google search your device name+kernel source.

I got this from your build.prop....
Code:
# from device/maisui/x5613_dg_a35_5365u/system.prop

So that means your defconfig is x5613_dg_a35_536u.
 

Suvam Mondal

Senior Member
Jan 3, 2017
198
16
Error while compiling Kernel from source

I was compiling kernel from source for my Meizu m2 note and I encountered this error

Code:
In file included from /home/suvam/RRMM/kernel/meizu/m2note/arch/arm64/include/asm/io.h:243:0,
                 from /home/suvam/RRMM/kernel/meizu/m2note/include/linux/clocksource.h:19,
                 from /home/suvam/RRMM/kernel/meizu/m2note/include/clocksource/arm_arch_timer.h:19,
                 from /home/suvam/RRMM/kernel/meizu/m2note/arch/arm64/include/asm/arch_timer.h:27,
                 from /home/suvam/RRMM/kernel/meizu/m2note/arch/arm64/include/asm/timex.h:19,
                 from /home/suvam/RRMM/kernel/meizu/m2note/include/linux/timex.h:65,
                 from /home/suvam/RRMM/kernel/meizu/m2note/include/linux/jiffies.h:8,
                 from /home/suvam/RRMM/kernel/meizu/m2note/include/linux/ktime.h:25,
                 from /home/suvam/RRMM/kernel/meizu/m2note/include/linux/timer.h:5,
                 from /home/suvam/RRMM/kernel/meizu/m2note/include/linux/workqueue.h:8,
                 from /home/suvam/RRMM/kernel/meizu/m2note/include/linux/pm.h:25,
                 from /home/suvam/RRMM/kernel/meizu/m2note/include/linux/device.h:25,
                 from drivers/misc/mediatek/mach/mt6735/camera_isp_D1.c:11:
/home/suvam/RRMM/kernel/meizu/m2note/include/asm-generic/iomap.h:31:21: note: expected 'void *' but argument is of type 'long unsigned int'
 extern unsigned int ioread32(void __iomem *);
                     ^
drivers/misc/mediatek/mach/mt6735/camera_isp_D1.c:99:26: warning: passing argument 1 of 'ioread32' makes pointer from integer without a cast
 #define ISP_RD32(addr)   ioread32(addr)
                          ^
/home/suvam/RRMM/kernel/meizu/m2note/include/linux/printk.h:248:38: note: in expansion of macro 'ISP_RD32'
  no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
                                      ^
drivers/misc/mediatek/mach/mt6735/camera_isp_D1.c:87:37: note: in expansion of macro 'pr_debug'
 #define LOG_DBG(format, args...)    pr_debug(MyTag format, ##args)
                                     ^
drivers/misc/mediatek/mach/mt6735/camera_isp_D1.c:10828:3: note: in expansion of macro 'LOG_DBG'
   LOG_DBG("0x%08X %08X", (unsigned int)(ISP_TPIPE_ADDR + 0x00a8), (unsigned int)ISP_RD32(ISP_ADDR + 0x00a8));
   ^
In file included from /home/suvam/RRMM/kernel/meizu/m2note/arch/arm64/include/asm/io.h:243:0,
                 from /home/suvam/RRMM/kernel/meizu/m2note/include/linux/clocksource.h:19,
                 from /home/suvam/RRMM/kernel/meizu/m2note/include/clocksource/arm_arch_timer.h:19,
                 from /home/suvam/RRMM/kernel/meizu/m2note/arch/arm64/include/asm/arch_timer.h:27,
                 from /home/suvam/RRMM/kernel/meizu/m2note/arch/arm64/include/asm/timex.h:19,
                 from /home/suvam/RRMM/kernel/meizu/m2note/include/linux/timex.h:65,
                 from /home/suvam/RRMM/kernel/meizu/m2note/include/linux/jiffies.h:8,
                 from /home/suvam/RRMM/kernel/meizu/m2note/include/linux/ktime.h:25,
                 from /home/suvam/RRMM/kernel/meizu/m2note/include/linux/timer.h:5,
                 from /home/suvam/RRMM/kernel/meizu/m2note/include/linux/workqueue.h:8,
                 from /home/suvam/RRMM/kernel/meizu/m2note/include/linux/pm.h:25,
                 from /home/suvam/RRMM/kernel/meizu/m2note/include/linux/device.h:25,
                 from drivers/misc/mediatek/mach/mt6735/camera_isp_D1.c:11:
/home/suvam/RRMM/kernel/meizu/m2note/include/asm-generic/iomap.h:31:21: note: expected 'void *' but argument is of type 'long unsigned int'
 extern unsigned int ioread32(void __iomem *);
                     ^
drivers/misc/mediatek/mach/mt6735/camera_isp_D1.c: At top level:
drivers/misc/mediatek/mach/mt6735/camera_isp_D1.c:175:22: warning: 'g_isp_base_dase' defined but not used [-Wunused-variable]
 static void __iomem *g_isp_base_dase;
                      ^
drivers/misc/mediatek/mach/mt6735/camera_isp_D1.c:176:22: warning: 'g_isp_inner_base_dase' defined but not used [-Wunused-variable]
 static void __iomem *g_isp_inner_base_dase;
                      ^
drivers/misc/mediatek/mach/mt6735/camera_isp_D1.c:177:22: warning: 'g_imgsys_config_base_dase' defined but not used [-Wunused-variable]
 static void __iomem *g_imgsys_config_base_dase;
                      ^
drivers/misc/mediatek/mach/mt6735/camera_isp_D1.c: In function 'compat_put_isp_read_register_data':
drivers/misc/mediatek/mach/mt6735/camera_isp_D1.c:8407:6: warning: 'err' is used uninitialized in this function [-Wuninitialized]
  err |= get_user(count, &data->Count);
      ^
drivers/misc/mediatek/mach/mt6735/camera_isp_D1.c: In function 'ISP_DONE_Buf_Time.isra.4':
drivers/misc/mediatek/mach/mt6735/camera_isp_D1.c:5522:49: warning: 'out' may be used uninitialized in this function [-Wmaybe-uninitialized]
    pstRTBuf->ring_buf[i_dma].img_cnt = sof_count[out];
                                                 ^
drivers/misc/mediatek/mach/mt6735/camera_isp_D1.c: In function 'ISP_Buf_CTRL_FUNC':
drivers/misc/mediatek/mach/mt6735/camera_isp_D1.c:4447:34: warning: 'out' may be used uninitialized in this function [-Wmaybe-uninitialized]
     deque_buf.sof_cnt = sof_count[out];
                                  ^
  LD      drivers/misc/mediatek/mach/mt6735/built-in.o
  LD      drivers/misc/mediatek/mach/built-in.o
make[4]: *** [drivers/misc/mediatek] Error 2
make[3]: *** [drivers/misc] Error 2
make[2]: *** [drivers] Error 2
make[1]: *** [sub-make] Error 2
make[1]: Leaving directory `/home/suvam/RRMM/kernel/meizu/m2note'
make: *** [TARGET_KERNEL_BINARIES] Error 2

#### make failed to build some targets (09:32 (mm:ss)) ####

Can somebody please help me out ?
 

naman1208

Senior Member
Aug 5, 2015
72
10
i am getting error while using make menu config.
1. I have mt6589 kernel sources for my canvas A117.
2. i have my kernel sources in kernel folder and toolchain in home, so i used this command to link my toolchain to kernel sources
export CROSS_COMPILE=/home/arm-eabi-4.6/bin/arm-eabi-
3. then i used-
cp mediatek/config/mt6589/autoconfig/kconfig/platform .config
and then when i use menuconfig it gives me this error-
make: *** No rule to make target 'menuconfig'. Stop.
i am in my kernel source directory while running these commands then what is going wrong please help.:crying:
 

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.