Skip to content

Building

Kees Jongenburger edited this page Aug 25, 2014 · 5 revisions

Building the fairphone kernel

  • Build the kernel.
  • Convert the kernel to a mediatek image.
  • Replace the ramdisk.
  • Test the kernel.
  • Recovering from failure

Building a kernel for the Fairphone.

export PATH=~/opt/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin:$PATH
cd kernel
#
# Normal kernel configuration to architecture and compiler to use
#
export ARCH=arm 
export CROSS_COMPILE=arm-linux-androideabi-

#
# Mediatek things
#
export MTK_PATH_SOURCE=../mediatek/kernel/
export MTK_PROJECT=ahong89_wet_jb2
export MTK_ROOT=../mediatek
export MTK_ROOT_CUSTOM=../mediatek/custom/
export TARGET_BUILD_VARIANT=user
export TARGET_PRODUCT=ahong89_wet_jb2
time make V=1

Converting the kernel to a flashable image

./mediatek/build/tools/mkimage kernel/arch/arm/boot/zImage KERNEL > ./zImage.img

Replacing the ramdisk

You will need some tools to rework the generated image into something that can be flashed get the mtk-tools from https://github.com/bgcngm/mtk-tools

First you need to get hold of the ramdisk this can be done by downloading the published binary image. After downloading it create a directory called ramdisk and copy the boot.img into that directory and unpack the ramdisk unsing the unpack tool.

../mtk-tools/repack-MT65xx.pl \
    -boot zImage.img \
    ../ramdisk/boot.img-ramdisk boot.img

Testing the kernel.

Using fastboot ??

fastboot flash:raw boot boot.img
fastboot reboot

dd boot.img it to /dev/bootimg and copied the modules.

Recovering from failure

Download the correct image binary from https://fairphone.zendesk.com/hc/en-us/articles/201189497-Fairphone-OS-multiple-versions-

The windows method

Download and install the SP Flashtool and SP Flashtool drivers http://forum.xtreamer.net/topic/35487-firmware-recovery-process-for-ban-g-and-q-with-pictures/ and use the flasher to flash your device.

If you have a fastboot enabled device

Starting the 1.6 release fastboot is included in the image binary. People upgrading will not have this feature enabled because the updater does not replace the necessary components.

Get boot.img from the download above and flash it to the device

fastboot flash:raw boot boot.img.
sending 'boot' (4778 KB)...
OKAY [  0.197s]
writing 'boot'...
OKAY [  2.135s]
finished. total time: 2.333s


keesj@yoga:$ fastboot reboot
rebooting...
finished. total time: 0.003s
Clone this wiki locally