yashsingh1/xdaforums huggingface dataset:
[Miscellaneous Android Development] MasterAwesome:
Instead of hardcoding it into a file, you can add it in the BoardConfig.mk and its not a dummy file; If your recovery is more than this size it wont proceed. And you have to give the value in bytes or hexadecimal.. And, for recovery kernel no need to push modules.. for my mtk device its like this

# partition info
BOARD_BOOTIMAGE_PARTITION_SIZE := 6291456
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 1611661312
BOARD_USERDATAIMAGE_PARTITION_SIZE:= 4830789632
BOARD_RECOVERYIMAGE_PARTITION_SIZE := 6291456
BOARD_KERNEL_PAGESIZE := 2048
BOARD_FLASH_BLOCK_SIZE := 512

partition sizes are basically 6*1024*1024=6291456.

Regards

MasterAwesome
[Miscellaneous Android Development] shutt1e:
bootimage and recoveryimage sizes are the same on mine,while system and data are different, i have the values on the device repository not on the kernel source tree anyway. does this matter?

what i'm doing is to compile just the kernel using the commands on this post, then i build the recovery.img manually using repack-MT65xx.pl

i'm afraid i'm doing something wrong because the recovery.img (i dd it on the phone) boot and crash, then automatically reboot

Could i see a .config generated for your phone just for reference?

i'm coming from a qualcomm kernel and this mtk one give me headaches,its structure is so different

also i miss the fastboot. i was used to test compiled kernels using fastboot boot boot.img to avoid to have to flash it everytime.

ah a last question, the kernel source tree i am using (the wiko stairway sources) was missing of some drivers, touch and camera surely, possibly others. i have found the code on other mtk sources then added on mediatek/custom/devicename/kernel/<device>/ and then modified the mediatek/config/devicename/Projectconfig.mk changing the device names with my own.

i do not see on the generated .config any reference to the changes i made on this file. it is wrong?

n.b. an interesting finding

on my phone there is a ProjectConfig.mk on /etc. i wish is the same file used to compile the original kernel. could be gold
[Miscellaneous Android Development] CODE_WORKX:
[MENTION=5321417]MasterAwesome[/MENTION] As you know i am trying to make a custom kernal

I am getting this error

[avenger@MatriX ~]$ TARGET_PRODUCT=s9081 MTK_ROOT_CUSTOM=../mediatek/custom/ make -j5

make: *** No targets specified and no makefile found. Stop.

[avenger@MatriX ~]$ cd ~/KICK/kernel

[avenger@MatriX kernel]$ exprt ARCH=arm

bash: exprt: command not found

[avenger@MatriX kernel]$ export ARCH=arm

[avenger@MatriX kernel]$ export PATH=~/toolchain/Arm_A9_linaro_4.8.3/bin:$PATH

[avenger@MatriX kernel]$ TARGET_PRODUCT=s9081 MTK_ROOT_CUSTOM=../mediatek/custom/ make -j5

make: arm-linux-androideabi-gcc: Command not found

[DELETE] ../mediatek/custom/out/s9081/kernel/usb/modules.builtin

[DELETE] ../mediatek/custom/out/s9081/kernel/modules.builtin

CHK include/linux/version.h

CHK include/generated/utsrelease.h

/bin/sh: line 0: [: too many arguments

CC scripts/mod/empty.o

/bin/sh: arm-linux-androideabi-gcc: command not found

scripts/Makefile.build:307: recipe for target 'scripts/mod/empty.o' failed

make[2]: *** [scripts/mod/empty.o] Error 127

scripts/Makefile.build:443: recipe for target 'scripts/mod' failed

make[1]: *** [scripts/mod] Error 2

Makefile:518: recipe for target 'scripts' failed

make: *** [scripts] Error 2

please help me Master
[Miscellaneous Android Development] MasterAwesome:
You haven't used your tool chain properly it's arm-eabi- for kernel not arm-linux-androideabi-.
[Miscellaneous Android Development] CODE_WORKX:
ok Thanks master also do i need to edit my toolchain path in makefile

i am using linaro 4.8.3 does it require patches......

can please come on teamviewer

thanks
[Miscellaneous Android Development] MasterAwesome:
You need to export the cross compile prefix. Please refer to the Original Post
[Miscellaneous Android Development] CODE_WORKX:
can please come on teamviewer....:D

Ok i will refer to it..
[Miscellaneous Android Development] ANKIT RAWAT:
[MENTION=5321417]MasterAwesome[/MENTION]

My Phone Specs Are:

512 Mb Ram

5MP Camera

4.6/4.7 screen Size

Dual Sim

Front Camera

MTK6577

can u provide Me Some Kernal sources Which matches Specs Of My Phone?

I devices Are Canvas 2 And Canvas Music.

Their Are Many Kernals For Canvas2

so i m thinking To build Kernal For My Canvas Music

regards
[Miscellaneous Android Development] I.nfraR.ed:
How to properly clean the source tree befre distribution?

Even I do "make clean", "make distclean", "make mrproper" there are stil some .o, .o.cmd and .ko files left.
[Miscellaneous Android Development] MasterAwesome:
If your downloaded from github or a mercurial you'd have base files.. To put in simple words, try, git reset --hard in the directory with the .git folder
[Miscellaneous Android Development] I.nfraR.ed:
git reset --hard will clean it to the stage it is in the github and what I want to do is to remove all generated files from the build process and not loose the changes I made (not committed yet). Imagine I want to make a full compare to another mtk source. I want it as clean as possible.

This is the Makefile I'm using https://github.com/infraredbg/Lenovo_A820_kernel_proton/blob/master/kernel/Makefile

You can check the distclean on line #1248.
[Miscellaneous Android Development] MasterAwesome:
Manually search for the .o files and delete them usually if make clean is given it automatically cleans is it. Besides, if make is given it will generate pre compiled c files again. It try creating a github patch then reset it, apply the patch again.
[Miscellaneous Android Development] I.nfraR.ed:
Thanks. I started from scratch. Managed to break the accelerometer and it would be easier to start over.
[Miscellaneous Android Development] MasterAwesome:
Looks like the header file and/or the source file has multiple definitions

#define "var_name"

or the function itself is defined both in the .c and the .h causing multiple definitions. or probably the .c is including itself while compilation. before actual usage the driver source code looks bad and needs some modifying. I had a similar issue some time ago and modified the files. try the ones in the attachment(

Replace only files which cause error!

)
[Miscellaneous Android Development] Al3XKOoL:
Thanks for reply!

EDIT!

Finally solved!
[Miscellaneous Android Development] MasterAwesome:
If fixed please link the files modified along with the device name so it can help the XDA community.
[Miscellaneous Android Development] Al3XKOoL:
Finally, there is bootloop after alcatel logo.

Mainly just looked blank screen, now loads the driver lcm, but not work.

I need some time to test and learn a little about source code.

Alcatel does not release the jb source code to my device (X'POP 5035X) but if the ics source.

Is possible to adapt the Ics project to a source code of another device?

I've been doing this with Newman-N1 3.4.11 and now loads the lcm driver but I'm really noob about kernel sources.
[Miscellaneous Android Development] ponnex:
Im new to cooking kernel, I just have a question. I have a phone MyPhone A919 Duo which is also has a clone and sister Micromax A110, Micromax A110 has tons of custom kernel here in XDA, whichever custom kernel I flash it boots successfully but has one common problem, the proximity sensors are not working, so I figured out that MyPhone A919 Duo and Micromax A110 although they are the same they have a slight difference in hardware therefore the drivers proximity differs in both phone, how can I modify (given I have a kernel source of the entire custom kernel) or make patches for my proximity sensors to work? and additionally I have a stock boot.img of my stock rom. Can you help me with this? I just need guidance, and I can make the rest ;) THANKS for all that can help!

Here's the Kernel Sources --> https://github.com/bindassdost/BindassBoost_a110
[Miscellaneous Android Development] MasterAwesome:
If other kernels work and this one doesn't is because bindassbost kernel is for kitkat ROMs. Although, that shouldn't affect your proximity, so I'm guessing the calibration is different.

However similar your device maybe, the calibrations may vary

"some calibrations settings are on the device itself.

Search with an root explorer under /sys/devices/platform and check under the MT-IC's (eg MT-i2C.0)

Under those IC's you'll find most of the devices (sensors,, etc), that are being used.

Example

/sys/devices/platform

MT-I2C.0

0-0039 - s3202 ---> s3202 is the TouchPanel

MT-I2C.1

1-0018 - FM50AF ---> Camera Lens

MT-I2C.2

2-0018- BMA222 ---> Accelerometer

etc, etc.

Some sensors special configs, can be found on those IC's, others are under /proc."

Or,

The ramdisk is bad. Make sure you are using your stock Rom's ram disk instead of the ram disk provided by the developer. Since the init binaries may be different and affect the proximity.

Or,

Your proximity sensor itself is faulty( check this first).

Good luck.
[Miscellaneous Android Development] ponnex:
THANKS FOR THE VERY DETAILED REPLY! :D

I already checked my proximity driver it is cm36283 whereas in the BindassBoost kernel and all other kernels uses cm3602(?)

Is it okay If I changed that cm3602(?) in the root explorer in to cm36283?

Im sure my proximity sensor is not faulty cause I've flash back stock rom with stock kernel and proximity and light sensors working fine not sure how to address this problem either to make patch or build my own custom kernel?

Hoping for positive feedback! and THANKS!
[Miscellaneous Android Development] ponnex:
Cannot open file /home/ponnex/Ponnex_a110/kernel/arch/arm/boot/zImage

what possible error could this be? :confused:

I got a flashable zip already containing boot.img only 600 kb (?) and zImage of 0 bytes :crying:
[Miscellaneous Android Development] MasterAwesome:
It could be because

Using wrong toolchains

Ignoring warnings and errors

Bad kernel source.
[Miscellaneous Android Development] superdragonpt:
Makefile

toolchain

original reply:

http://xdaforums.com/showpost.php?p=54438549&postcount=2517

I advise you to check and read that thread, the title is about CM on MTK devices, but that thread has become the main thread about MTK development.

Becouse i don't want to repeat myself all over again, read that thread, there's a lot you can learn there .

Regards
[Miscellaneous Android Development] ponnex:
Thanks sire :)
[Miscellaneous Android Development] :
Hi MasterAwesome

post 1 Step 1(Setting up the build environment)

export in code box

maybe edit to 4.7?

cheers
[Miscellaneous Android Development] MasterAwesome:
4.7 is not full compatible with kernel source of mediatek yet so 4.6 is preferred.
[Miscellaneous Android Development] :
Thanks for quick reply

In that case maybe change your post 1 step 1 to link to 4.6 instead of 4.7.

It currently shows as

The PATHThis sets your toolchain executables to your path. Download toolchain from arm-eabi-4.7

I am guessing it should show 4.6

https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6

cheers
[Miscellaneous Android Development] superdragonpt:
Mtk stock kernel compiles ONLY with GCC-eabi 4.6.x

Yes

Of course, you can fix the sources to compile with gcc/linaro 4.7 + toolchains.

Done that on two different SoC's.

Main reason are the inline and memsets errors caused by the "rather old" mtk source.

Currently, my MT6577 / mt6582 / mt8125 kernels are being compiled with linaro 4.9.x latest toolchains.

And the improvements are obvious.

Regards
[Miscellaneous Android Development] MasterAwesome:
Just noticed it, thanks :)
[Miscellaneous Android Development] :
right I have read post one. I have compiled Linux kernel but this is my first cross compile attempt

When I downloaded the Kernel source I shorted the name to MT and noticed the following

ls -al /home/gordon/MT/kernel/mediatek/custom/
total 12
drwxrwxr-x 2 gordon gordon 4096 Aug 28 20:46 .
drwxrwxr-x 3 gordon gordon 4096 Aug 28 20:46 ..
lrwxrwxrwx 1 gordon gordon 64 Aug 28 20:46 out -> ../../../out/target/product/bird82_tb_td_a_kk/obj/CUSTGEN/custom

file out
out: broken symbolic link to `../../../out/target/product/bird82_tb_td_a_kk/obj/CUSTGEN/custom'

I could not find an "out" folder in the unpack

Question

Am I supposed to delete that stale sym link and create a new one manually or is some export command supposed to fix it up automatically

Thanks for reading

I shall stand in the naughty corner for not knowing the answer in advance
[Miscellaneous Android Development] superdragonpt:
Let me guess you broke the symlink from kernel/mediatek/custom/out ? :)

First mistaques people do, is when they download the sources:

Do NOT download as .zip --> when extracting it will break the sources symlinks ( and MTK's kernel is an mess, with a lot of symlinks and harcoded paths )

Do NOT rename Dirs --> Specially on MTK sources where theres an bunch of hardcoded Paths there ...

Just do an git clone reponamehere

Then you may start working

Regards
[Miscellaneous Android Development] :
thanks for quick reply but that does not work either, yes I won't rename it but broken sym link exists so its not me....well I don't think so

git clone https://github.com/kashifmin/MT6582-KK-KERNEL.git
Cloning into 'MT6582-KK-KERNEL'...
remote: Counting objects: 48898, done.
remote: Total 48898 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (48898/48898), 158.71 MiB | 385.00 KiB/s, done.
Resolving deltas: 100% (5298/5298), done.
Checking connectivity... done.
Checking out files: 100% (46723/46723), done.
gordon@asus:~$ ls -al /home/gordon/MT6582-KK-KERNEL/kernel/mediatek/custom/
total 12
drwxrwxr-x 2 gordon gordon 4096 Aug 29 19:14 .
drwxrwxr-x 3 gordon gordon 4096 Aug 29 19:14 ..
lrwxrwxrwx 1 gordon gordon 64 Aug 29 19:14 out -> ../../../out/target/product/bird82_tb_td_a_kk/obj/CUSTGEN/custom
gordon@asus:~$ file /home/gordon/MT6582-KK-KERNEL/kernel/mediatek/custom/out
/home/gordon/MT6582-KK-KERNEL/kernel/mediatek/custom/out: broken symbolic link to `../../../out/target/product/bird82_tb_td_a_kk/obj/CUSTGEN/custom'
[Miscellaneous Android Development] :
Hi

while waiting for a reply for reply to previous, I thought I would change to

make prepare

as a way to trouble-shoot some errors as I am keen to get started

Rather than put in code box....it is a link to a text file so its easy to read in browser

Key points in case you miss it

1) I chose export TARGET_PRODUCT=A9CL as that was the string in my current phone's build info file

2) I am not sure of all my export stuff so feel free to suggest/question

3) fatal error: mach/timex.h is current error and yet there a number of sub-folders with mach/timex.h to choose from

Any help will be greatly appreciated

MasterAwesome

Can I suggest you add the extra export?

export ARCH_MTK_PLATFORM=<your-input> eg mt6582

So to anyone here is link

https://www.dropbox.com/s/9efrupsv1jyc65i/make-prepare.txt?dl=0

All the time.h hits are in separate text file here

https://www.dropbox.com/s/206z5qvqfd1pa94/timex-h.txt?dl=0

thanks for reading and we are getting there

#######

trivia

######

Initially I did not do any export commands in shell and ran make prepare to get each error and resolve it

----so this is the best so far, that I have progressed to.
[Miscellaneous Android Development] neomanu:
mediatek/platform/mt6582/kernel/core/include/mach/timex.h is the one you need.

Your includes might be broken. Check your Makefile.

You can either export before building (as in the OP), or you can pass them to the make command.

(eg. make TARGET_BUILD_VARIANT=user TARGET_PRODUCT=devicename MTK_ROOT_CUSTOM=../mediatek/custom/ TARGET_KERNEL_VERSION=devicename)

ARCH, PATH & CROSS_COMPILE have to still be exported before.
[Miscellaneous Android Development] :
Thanks for reply.....EDIT tidy up code box

I have now attempted linaro tool chain but there are a number of missing headers fixed by sym link and one missing header currently unresolved

dfo_boot.h does not appear anywhere in MTK kernel source.

details

KS=MT6582-KK-KERNEL
DN=mt6582

# fix errors in Linaro bin
cd /home/gordon/android-toolchain-eabi/bin
ln -s arm-linux-androideabi-ld.bfd arm-eabi-ld.bfd
ln -s arm-linux-androideabi-gcc arm-eabi-gcc
cd ~

# fix missing headers
cd $KS/mediatek
S1=platform/mt6582/kernel/core/include/mach
L2=kernel/include/mach
ln -s $S1/timex.h $L2/timex.h
ln -s $S1/memory.h $L2/memory.h
ln -s $S1/irqs.h $L2/irqs.h
ln -s $S1/mt_irq.h $L2/mt_irq.h
ln -s $S1/x_define_irq.h $L2/x_define_irq.h
ln -s $S1/mt_spm_idle.h $L2/mt_spm_idle.h
ln -s $S1/mt_devinfo.h $L2/mt_devinfo.h
ln -s $S1/entry-macro.S $L2/entry-macro.S
cd ~

# commands done in same shell, no persistence at this stage
export TARGET_PRODUCT=A9CL
export PATH=/home/gordon/android-toolchain-eabi/bin:$PATH
export ARCH_MTK_PLATFORM=mt6582
export TARGET_BUILD_VARIANT=user
export TARGET_PRODUCT=A9CL
export MTK_ROOT_CUSTOM=/home/gordon/$KS/mediatek/custom/
export TARGET_KERNEL_VERSION=mt6582
export CROSS_COMPILE=arm-eabi-
export ARCH=arm
cd $KS
cp mediatek/config/$DN/autoconfig/kconfig/platform kernel/.config
cd kernel
make prepare
# do not proceed unless no errors
# make menuconfig # no changes at this stage
# make zImage

# unresolved error no dfo_boot.h
# google and borrow the header from mt6572
# inject it and sym link it

even with the cheat....make zImage is borking with another dfo* related error
[Miscellaneous Android Development] andrman1:
I'm using bbqlinux.

I have error on this: make menuconfig

make: *** No rule to make target 'menuconfig'. Stop.

Do i need to put this on terminal :

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
[Miscellaneous Android Development] Bagoul:
Hello!

First, your tutorial is wonderful!

But when we put the command: make menuconfig

We have an error: Makefile: 2: build / core / main.mk: No such file or directory of this type.

We try to create a custom kernel for our A240 micromax because we have 4.4 rom but no drivers are buttons volume + and volume-.

There are not drivers for the home and Button for the camera ...

How? Can you help us create our kernel?

Thank you in advance for your help!

Sorry if I made the mistake I'm french ...
[Miscellaneous Android Development] Nihal @A-JAX:
Hello

Thanks for your awesome guides for MTK.

While compiling a kernel I'm getting these errors . Please help
[Miscellaneous Android Development] MasterAwesome:
You need to download a toolchain for arm compilation and set it to your environment path.
[Miscellaneous Android Development] Nihal @A-JAX:
Thanks

I have already downloaded the tool chain but how to set it to my environment path
[Miscellaneous Android Development] MasterAwesome:
export PATH="ENTER YOUR PATH HERE":$PATH
[Miscellaneous Android Development] Nihal @A-JAX:
Thanks

It worked but now I'm getting these errors while compiling . I tried to fix it but no success . The link to mach\timex.h was broken and I fixed that but timex.h file was not present in mach folder in any of the sources I used till date

Then I tried to rename time.h present in mach folder and ended up with these errors

Please help
[Miscellaneous Android Development] andrman1:
Anyone can answer me ?

I had error on this: make menuconfig

make: *** No rule to make target 'menuconfig'. Stop.

On this folder my file is different not platform it's called project ?

cp mediatek/config/devicename/autoconfig/kconfig/platform .config

Also Can I compile with bbqlinux it has java 7 ?
[Miscellaneous Android Development] MasterAwesome:
Yeah the path doesn't exactly mean bad. Copy that project config to arch/arm/configs name it yourdevice_defconfig and java has no job here so initialise your build environment my setting your compiler path(arm-eabi-). Just type "make yourdevice_defconfig" or as you suggested ( cp mediatek/config/devicename/autoconfig/kconfig/platform .config ) and your phone's device specific kernel additions should be added into the build process. Then type make zImage.

And I apologise for the late reply.

Regards
[Miscellaneous Android Development] patraanjan23:
I'm trying to build kernel for wiko bloom. But the kernel source came with few proprietary perl scripts for building the kernel. Among them I just took 'kernel' n 'mediatek' folder n trying to build the kernel with [MENTION=5321417]MasterAwesome[/MENTION] your method. I faced the same error as [MENTION=4604663]andrman1[/MENTION]. make has no rules for any config files :( I need to 1st build it n then integrate it to cyanogenmod build environment. So where am I going wrong? The mediatek folder just makes it hard :3 I've built kernel before but mtk is new. Thanks in advance.
[Miscellaneous Android Development] elyts:
Hi,

I'm trying to compile a Kernel based on this source: https://github.com/vo-1/android_kernel_iocean_x7

Since my device is a TCL S950 (same cpu), I used the mediatek/custom files and mediatek/config/device files of the source of my device, found here: http://sourceforge.net/projects/alcatel/files/OT_6040D_20131202.tar.xz/download

When compiling it, all folders (for example mediatek/custom/device/kernel/camera with kd_camera_hw.c and kd_camera.h inside) are moved to a directory called mediatek/custom/out/devicename.

Here is where i get my problems I think. kd_camera_hw.c includes a header called kd_imgsensor.h that has some #defines used in kd_camera_hw.c. The error I get is, that a define called SENSOR_IMX132_MIPI_RAW was first used in a certain function, but not declared. I assume this is some kind of makefile problem, since the dependencies are included correctly. I assume that the object file containing the necessary header files wasnt build first. Do you have any idea what i can do?
[Miscellaneous Android Development] patraanjan23:
silentoldconfig loop

[MENTION=5321417]MasterAwesome[/MENTION] Now that I've fixed make errors (changing to the 'kernel' folder) while trying to build the kernel I face an infinite loop of the text

scripts/kconfig/conf --silentoldconfig kconfig

I've kept it for hours but the kernel did not build. any suggestions?
[Miscellaneous Android Development] MasterAwesome:
Can you upload the source to github or bitbucket where I can view it and check what the problem is?
[Miscellaneous Android Development] patraanjan23:
It's a 7 GB source. But I'll try. You can download it from wikogeek. It's source for wiko bloom. Mt6582.

Sent from my Micromax A106