Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,785,150 Members 38,282 Now Online
XDA Developers Android and Mobile Development Forum

[GUIDE]Building a Kernel from source{Mediatek}

Tip us?
 
aus9
Old
#61  
Junior Member
Thanks Meter 1
Posts: 18
Join Date: Jan 2014
Location: Perth
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

Code:
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
 
superdragonpt
Old
(Last edited by superdragonpt; 29th August 2014 at 11:07 AM.)
#62  
superdragonpt's Avatar
Recognized Contributor
Thanks Meter 5,338
Posts: 1,725
Join Date: Apr 2013
Location: Lisbon

 
DONATE TO ME
Quote:
Originally Posted by aus9 View Post
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

Code:
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
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
If you like my work press Thanks, and feel free to Donate, and buy me an beer



Latest work:


Mediatek MT8317T SoC: (Acer Iconia B1-710)
Custom Kernel

Mediatek MT6582 SoC: (Wiko DarkMoon)
Custom Kernel
JB 4.2.2 / Carliv Touch Recovery
Unofficial LeWa Os v5

Mediatek MT6577 SoC: (ZTE V970 / v970m)
Custom Kernel

Mediatek MT8125 SoC: (Asus Memo Pad HD 7)
JB 4.2.2 / AOSP /VibeUI / Carliv Touch Recovery

All the other Projects

The Following User Says Thank You to superdragonpt For This Useful Post: [ Click to Expand ]
 
aus9
Old
(Last edited by aus9; 29th August 2014 at 12:19 PM.)
#63  
Junior Member
Thanks Meter 1
Posts: 18
Join Date: Jan 2014
Location: Perth
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

Code:
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'
 
aus9
Old
(Last edited by aus9; 30th August 2014 at 02:12 AM.)
#64  
Junior Member
Thanks Meter 1
Posts: 18
Join Date: Jan 2014
Location: Perth
Hi

while waiting for a reply for reply to previous, I thought I would change to
Code:
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/9efrupsv1j...epare.txt?dl=0

All the time.h hits are in separate text file here
https://www.dropbox.com/s/206z5qvqfd...mex-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.
 
neomanu
Old
#65  
neomanu's Avatar
Senior Member
Thanks Meter 130
Posts: 128
Join Date: Apr 2011
Quote:
Originally Posted by aus9 View Post
Hi

while waiting for a reply for reply to previous, I thought I would change to
Code:
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/9efrupsv1j...epare.txt?dl=0

All the time.h hits are in separate text file here
https://www.dropbox.com/s/206z5qvqfd...mex-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.
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.
The Following User Says Thank You to neomanu For This Useful Post: [ Click to Expand ]
 
aus9
Old
(Last edited by aus9; 31st August 2014 at 12:44 AM.)
#66  
Junior Member
Thanks Meter 1
Posts: 18
Join Date: Jan 2014
Location: Perth
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
Code:
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
Tags
building, guide, kernel, mediatek, source
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes