====== Android ====== This page introduce how you can download and compile the Android kernel for **ODROID-U3/X2**. To build the Android Kernel, we strongly recommend the **gcc version 4.4.1** . ===== Toolchain ===== Click one of the site to download toolchain to build Linux kernel. * [[http://www.mdrjr.net/odroid/toots/arm-2010q1.tar.xz|Download Linux Kernel Toolchain(arm-2010q1)]] * [[http://dn.odroid.com/toolchains/arm-2010q1.tar.xz|Download Linux Kernel Toolchain(arm-2010q1)]] Once the download is done, extract the tarball to **/opt/toolchains/**. $ sudo mkdir -p /opt/toolchains $ unxz arm-2010q1.tar.xz $ tar xvf arm-2010q1.tar $ sudo mkdir /opt/toolchains $ sudo mv arm-2010q1 /opt/toolchains/ In order to add the toolchain path to PATH, paste below lines to **$HOME/.bashrc**. export PATH=$PATH:/home/odroid/adt-bundle-linux-x86_64-20140702/sdk/platform-tools:/opt/toolchains/arm-2010q1/bin export ARCH=arm export CROSS_COMPILE=arm-none-linux-gnueabi- You can apply the change if you login again or import to apply this change, login again or evaluate **$HOME/.bashrc** with source command. $ source ~/.bashrc You can check if the toolchain installed above works properly while checking the version of toolchain. If you can find **(Sourcery G++ Lite 2010q1-202) 4.4.1** at the end of the line, the toolchain is well installed. $ source ~/.bashrc $ $ arm-none-linux-gnueabi-gcc --version arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2010q1-202) 4.4.1 Copyright (C) 2009 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ===== Checkout ===== You can checkout **Kernel** source tree from **[[https://github.com/hardkernel/linux|Hardkernel's Github]]**, **Android platform** source tree from **[[https://github.com/hardkernel/android|Hardkernel's Github]]**. Please note that we distribute the Linux kernel in different branches for Android and other Linux distributions. ==== Android Kernel ==== $ git clone --depth 1 https://github.com/hardkernel/linux.git -b odroid-3.0.y-android $ cd linux ==== Android Platform ==== == android-4.1.2 == $ mkdir $ cd $ repo init -u https://github.com/hardkernel/android.git -b 4412_4.1.2_master $ repo sync $ repo start 4412_4.1.2_master --all == android-4.4.4 == $ mkdir $ cd $ repo init -u https://github.com/hardkernel/android.git -b 4412_4.4.4_master $ repo sync $ repo start 4412_4.4.4_master --all ==== ==== * Visit this link to install the repo. [[http://source.android.com/source/downloading.html]] ===== Compile ===== Before compiling, you must configure for **ODROID-U3** with following command. ==== Android Kernel ==== === Android-4.1.2 === == ODROID-U2/U3 == $ make odroidu_android_422_defconfig $ make == ODROID-X2 == $ make odroidx2_android_422_defconfig $ make === Android-4.4.4 === We've merged the Kernel source into the Android repo. Android build-script also includes the Kernel compile. If you still want to compile only the kernel, $ make odroidXX_android_442_defconfig $ make ==== Android Platform ==== === ODROID-U2/U3 === $ ./build_android.sh odroidu === ODROID-X2 === $ ./build_android.sh odroidx2 ===== Installation ===== There are different instructions to install Linux kernel image for Android and Linux. Since Android loads both from a kernel partition, we have to use **fastboot** to install into the dedicated partition. Please refer the partition table from [[http://odroid.com/dokuwiki/doku.php?id=en:u3_partition_table|here]]. In contrast, Linux boots by the instructions described in **boot.ini** the 1st FAT partition. This is the instruction to install kernel image, **zImage**, to the boot card. $ sudo fastboot flash kernel This is to install android platform files, **system.img**, **userdata.img**, **cache.img**. $ sudo fastboot flash system $ sudo fastboot flash userdata $ sudo fastboot flash cache If you want to initialize the FAT partition, run this command. $ sudo fatboot erase fat [[http://codewalkerster.blogspot.kr/search?q=cross_compile]]