[Fairphone 1] fredflegel:
Cant compile yet

Update: Found the missing header in another directory. Now: How to i reference it correctly without copying?

Hey [MENTION=5382171]joemier[/MENTION], [MENTION=5757561]_keesj[/MENTION] and Community,

here a my results so far:

In downloaded and extrated the tar.gz (the folder is name "alps") and cd into that dir.

I noticed i did not have the the Android prebuilds installed so i got them from here https://source.android.com/source/building-kernels.html:

I created the directory prebuilts/..., and checked out the prebuilts from googles git :

mkdir -p prebuilts/gcc/linux-x86/arm
cd prebuilts/gcc/linux-x86/arm
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6 prebuilts/gcc/linux-x86/arm

I then added the prebuilts bin dir to my path

export PATH=$(pwd)/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin:$PATH

I then opened the included readme which offers a build command i had to modifiy slightly because the prebuilds bins have slightly different names here (bold):

cd kernel
[B]CROSS_COMPILE=arm-eabi-[/B] TARGET_PRODUCT=ahong89_wet_jb2 MTK_ROOT_CUSTOM=../mediatek/custom/ make

That runs for a little while but does not complete because a header file is missing (EDIT or somewhre else then expected): /mediatek/platform/mt6589/kernel/core/include/mach/env.h:3:30: fatal error: partition_define.h:(

Here is the output:

In file included from mediatek/platform/mt6589/kernel/core/mt_spm_idle.c:19:0:
../mediatek/platform/mt6589/kernel/core/include/mach/env.h:3:30: fatal error: partition_define.h: No such file or directory
compilation terminated.
make[1]: *** [mediatek/platform/mt6589/kernel/core/mt_spm_idle.o] Fehler 1
make: *** [mediatek/platform/mt6589/kernel/core] Fehler 2

So i looked in to the file causing the error, env.h which expects the partition_define.h to be in the same folder or the search path (which it is not).

benjamin@ben-desktop:~/Schreibtisch/alps$ less mediatek/platform/mt6589/kernel/core/include/mach/env.h
#ifndef __ENV_H__
#define __ENV_H__
#include "partition_define.h"
...

But find is able to locate that file:

benjamin@ben-desktop:~/Schreibtisch/alps$ find . -name partition_define.h
./mediatek/custom/ahong89_wet_jb2/common/partition_define.h

So how do i get gcc to look there as well? I the include dirs a set in the makefile. That looks ok but very complex using

benjamin@ben-desktop:~/Schreibtisch/alps/kernel$ CROSS_COMPILE=arm-eabi- TARGET_PRODUCT=ahong89_wet_jb2 MTK_ROOT_CUSTOM=../mediatek/custom/ make V=1

i catched the verbose make output and the gcc command that fails (it is very long, so i will not post this here, just an excerpt):

arm-eabi-gcc -Wp,-MD,mediatek/platform/mt6589/kernel/core/.mt_spm_idle.o.d -nostdinc -isystem /home/benjamin/Schreibtisch/alps/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/../lib/gcc/arm-eabi/4.6.x-google/include (...) -I../mediatek/custom/out/ahong89_wet_jb2/common

While i supspected the device specific folders were not included for some reason, this was actually only ture in part. But i did find that in gcc is directed to include from

mediatek/custom/out/ahong89_wet_jb2/ (-I../mediatek/custom/out/ahong89_wet_jb2/common ) which does not contain a folder common, but seems to be a subset of mediatek/custom/ahong89_wet_jb2. I am fairly new to this and have no idea why this includes from "out" and why "out" does not include the folder common.

I am curious so i simply created a simlink to see what happens. And i fact, while that is a wild hack, it seems to build....UNTIL this happens:

mediatek/platform/mt6589/kernel/drivers/dispsys/ddp_drv.c:81:22: fatal error: ddp_dpfd.h: No such file or directory
compilation terminated.

And the story goes on:

benjamin@ben-desktop:~/Schreibtisch/alps$ find . -name ddp_dpfd.h
./mediatek/platform/mt6589/kernel/drivers/dispsys/ddp_dpfd.h

I am quite interested: How to you guys ad Fairphone build your kernels? Or is Ahong doing this for you?