We're no longer updating This wiki!!

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:c1_building_kernel [2015/02/05 12:13]
charles.park [Linux (Cross build)]
en:c1_building_kernel [2016/12/07 15:40] (current)
brian.kim [Toolchain (4.9.2)]
Line 1: Line 1:
 +====== Installing required packages ======
 +You will need install required packages before you start to build Linux kernel on your Ubuntu desktop.
 +<​code>​
 +$ sudo apt-get update
 +$ sudo apt-get install git
 +$ sudo apt-get install lib32stdc++6 ​ lib32z1 lzop u-boot-tools
 +$ sudo apt-get install build-essential gcc
 +$ sudo apt-get install libncurses5-dev
 +</​code>​
 +====== Kernel ======
 +This page introduce how you can download and compile the Linux kernel for **ODROID-C1**. You can select one of two version, GCC 4.9.2 or GCC 4.7.3. Since Linux release **v1.1**, the official toolchain for **ODROID-C1** is switched to **GCC 4.9.2**.
 +===== Toolchain (4.9.2)=====
 +Click one of the site to download toolchain to build Linux kernel.
 +  * [[http://​releases.linaro.org/​archive/​14.09/​components/​toolchain/​binaries/​gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux.tar.xz|Download #1]]
 +  * [[http://​dn.odroid.com/​toolchains/​gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux.tar.xz|Download #2]]
 +Once the download is done, extract the tarball to **/​opt/​toolchains/​**.
 +<​code>​
 +$ sudo mkdir -p /​opt/​toolchains
 +$ sudo tar xvf gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux.tar.xz -C /​opt/​toolchains/​
 +</​code>​
 +In order to add the toolchain path to PATH, paste below lines to **$HOME/​.bashrc**.
 +<​code>​
 +export ARCH=arm
 +export CROSS_COMPILE=arm-linux-gnueabihf-
 +export PATH=/​opt/​toolchains/​gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/​bin/:​$PATH
 +</​code>​
 +You can check if the toolchain installed above works properly while checking the version of toolchain. If you can find **gcc version 4.9.2 20140904 (prerelease)** at the end of the line, the toolchain is well installed.
 +<​code>​
 +$ arm-linux-gnueabihf-gcc -v
 +Using built-in specs.
 +COLLECT_GCC=/​opt/​toolchains/​gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/​bin/​arm-linux-gnueabihf-gcc
 +COLLECT_LTO_WRAPPER=/​opt/​toolchains/​gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/​bin/​../​libexec/​gcc/​arm-linux-gnueabihf/​4.9.2/​lto-wrapper
 +Target: arm-linux-gnueabihf
 +Configured with: /​cbuild/​slaves/​oorts/​crosstool-ng/​builds/​arm-linux-gnueabihf-linux/​.build/​src/​gcc-linaro-4.9-2014.09/​configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu --target=arm-linux-gnueabihf --prefix=/​cbuild/​slaves/​oorts/​crosstool-ng/​builds/​arm-linux-gnueabihf-linux/​install --with-sysroot=/​cbuild/​slaves/​oorts/​crosstool-ng/​builds/​arm-linux-gnueabihf-linux/​install/​arm-linux-gnueabihf/​libc --enable-languages=c,​c++,​fortran --disable-multilib --enable-multiarch --with-arch=armv7-a --with-tune=cortex-a9 --with-fpu=vfpv3-d16 --with-float=hard --with-pkgversion='​crosstool-NG linaro-1.13.1-4.9-2014.09 - Linaro GCC 4.9-2014.09'​ --with-bugurl=https://​bugs.launchpad.net/​gcc-linaro --enable-__cxa_atexit --enable-libmudflap --enable-libgomp --enable-libssp --with-gmp=/​cbuild/​slaves/​oorts/​crosstool-ng/​builds/​arm-linux-gnueabihf-linux/​.build/​arm-linux-gnueabihf/​build/​static --with-mpfr=/​cbuild/​slaves/​oorts/​crosstool-ng/​builds/​arm-linux-gnueabihf-linux/​.build/​arm-linux-gnueabihf/​build/​static --with-mpc=/​cbuild/​slaves/​oorts/​crosstool-ng/​builds/​arm-linux-gnueabihf-linux/​.build/​arm-linux-gnueabihf/​build/​static --with-isl=/​cbuild/​slaves/​oorts/​crosstool-ng/​builds/​arm-linux-gnueabihf-linux/​.build/​arm-linux-gnueabihf/​build/​static --with-cloog=/​cbuild/​slaves/​oorts/​crosstool-ng/​builds/​arm-linux-gnueabihf-linux/​.build/​arm-linux-gnueabihf/​build/​static --with-libelf=/​cbuild/​slaves/​oorts/​crosstool-ng/​builds/​arm-linux-gnueabihf-linux/​.build/​arm-linux-gnueabihf/​build/​static --enable-threads=posix --disable-libstdcxx-pch --enable-linker-build-id --enable-plugin --enable-gold --with-local-prefix=/​cbuild/​slaves/​oorts/​crosstool-ng/​builds/​arm-linux-gnueabihf-linux/​install/​arm-linux-gnueabihf/​libc --enable-c99 --enable-long-long --with-mode=thumb --disable-multilib --with-float=hard
 +Thread model: posix
 +gcc version 4.9.2 20140904 (prerelease) (crosstool-NG linaro-1.13.1-4.9-2014.09 - Linaro GCC 4.9-2014.09) ​
 +</​code>​
 +===== Toolchain (4.7.3)=====
 +Click one of the site to download toolchain to build Linux kernel.
 +  * [[https://​releases.linaro.org/​13.04/​components/​toolchain/​binaries/​gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux.tar.bz2|Download #1]]
 +  * [[http://​dn.odroid.com/​toolchains/​gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux.tar.bz2|Download #2]]
 +Once the download is done, extract the tarball to **/​opt/​toolchains/​**.
 +<​code>​
 +$ sudo mkdir -p /​opt/​toolchains
 +$ sudo tar jxvf gcc-linaro-arm-linux-gnueabihf-4.7-2012.12-20121214_linux.tar.bz2 -C /​opt/​toolchains/​
 +</​code>​
 +In order to add the toolchain path to PATH, paste below lines to **$HOME/​.bashrc**.
 +<​code>​
 +export ARCH=arm
 +export CROSS_COMPILE=arm-linux-gnueabihf-
 +export PATH=/​opt/​toolchains/​gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux/​bin:​$PATH
 +</​code>​
 +You can apply the change if you login again or import ​
 +to apply this change, login again or evaluate **$HOME/​.bashrc** with source command.
 +<​code>​
 +$ source ~/.bashrc
 +</​code>​
 +You can check if the toolchain installed above works properly while checking the version of toolchain. If you can find **gcc version 4.7.3 20130328 (prerelease)** at the end of the line, the toolchain is well installed.
 +<​code>​
 +$ arm-linux-gnueabihf-gcc -v
 +Using built-in specs.
 +COLLECT_GCC=arm-linux-gnueabihf-gcc
 +COLLECT_LTO_WRAPPER=/​opt/​toolchains/​gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux/​bin/​../​libexec/​gcc/​arm-linux-gnueabihf/​4.7.3/​lto-wrapper
 +Target: arm-linux-gnueabihf
 +Configured with: /​cbuild/​slaves/​oorts/​crosstool-ng/​builds/​arm-linux-gnueabihf-linux/​.build/​src/​gcc-linaro-4.7-2013.04/​configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu --target=arm-linux-gnueabihf --prefix=/​cbuild/​slaves/​oorts/​crosstool-ng/​builds/​arm-linux-gnueabihf-linux/​install --with-sysroot=/​cbuild/​slaves/​oorts/​crosstool-ng/​builds/​arm-linux-gnueabihf-linux/​install/​arm-linux-gnueabihf/​libc --enable-languages=c,​c++,​fortran --enable-multilib --with-arch=armv7-a --with-tune=cortex-a9 --with-fpu=vfpv3-d16 --with-float=hard --with-pkgversion='​crosstool-NG linaro-1.13.1-4.7-2013.04-20130415 - Linaro GCC 2013.04'​ --with-bugurl=https://​bugs.launchpad.net/​gcc-linaro --enable-__cxa_atexit --enable-libmudflap --enable-libgomp --enable-libssp --with-gmp=/​cbuild/​slaves/​oorts/​crosstool-ng/​builds/​arm-linux-gnueabihf-linux/​.build/​arm-linux-gnueabihf/​build/​static --with-mpfr=/​cbuild/​slaves/​oorts/​crosstool-ng/​builds/​arm-linux-gnueabihf-linux/​.build/​arm-linux-gnueabihf/​build/​static --with-mpc=/​cbuild/​slaves/​oorts/​crosstool-ng/​builds/​arm-linux-gnueabihf-linux/​.build/​arm-linux-gnueabihf/​build/​static --with-ppl=/​cbuild/​slaves/​oorts/​crosstool-ng/​builds/​arm-linux-gnueabihf-linux/​.build/​arm-linux-gnueabihf/​build/​static --with-cloog=/​cbuild/​slaves/​oorts/​crosstool-ng/​builds/​arm-linux-gnueabihf-linux/​.build/​arm-linux-gnueabihf/​build/​static --with-libelf=/​cbuild/​slaves/​oorts/​crosstool-ng/​builds/​arm-linux-gnueabihf-linux/​.build/​arm-linux-gnueabihf/​build/​static --with-host-libstdcxx='​-L/​cbuild/​slaves/​oorts/​crosstool-ng/​builds/​arm-linux-gnueabihf-linux/​.build/​arm-linux-gnueabihf/​build/​static/​lib -lpwl' --enable-threads=posix --disable-libstdcxx-pch --enable-linker-build-id --enable-gold --with-local-prefix=/​cbuild/​slaves/​oorts/​crosstool-ng/​builds/​arm-linux-gnueabihf-linux/​install/​arm-linux-gnueabihf/​libc --enable-c99 --enable-long-long --with-mode=thumb
 +Thread model: posix
 +gcc version 4.7.3 20130328 (prerelease) (crosstool-NG linaro-1.13.1-4.7-2013.04-20130415 - Linaro GCC 2013.04)
 +</​code>​
 +===== Checkout =====
 +You can checkout **U-boot** source tree from **[[https://​github.com/​hardkernel/​u-boot/​tree/​odroidc-v2011.03|Hardkernel'​s Github]]**, please note that we distribute the Linux kernel in different branches for Android and other Linux distributions.
 +==== Android ====
 +<​code>​
 +$ git clone --depth 1 https://​github.com/​hardkernel/​linux.git -b odroidc-3.10.y-android
 +$ cd linux
 +</​code>​
 +==== Linux ====
 +<​code>​
 +$ git clone --depth 1 https://​github.com/​hardkernel/​linux.git -b odroidc-3.10.y
 +$ cd linux
 +</​code>​
 +===== Compile =====
 +You must do kernel configuration for **ODROID-C1**,​ then start to build. Adding **-j** option on make command will help you to finish compiling faster.
 +<​code>​
 +$ make odroidc_defconfig
 +$ make <-j4>
 +$ make <-j4> modules
 +</​code>​
 +You have done to compile the Linux kernel (zImage), the device tree file (.dtb) and kernel modules (.ko). But in order to boot on **ODROID-C1**,​ you need **uImage** apart from **zImage** which have boot information and simply can make this.
 +<​code>​
 +$ make uImage
 +</​code>​
 +===== Custom Kernel Build =====
 +If you have some kernel drivers wish to include for your custom build, you can select the drivers easily in Linux kernel tree. **make menuconfig** will show you text based menus help you to select kernel drivers.
 +<​code>​
 +$ make menuconfig
 +</​code>​
 +Once you done selecting the drivers, exit from the menu screen. Then you can start kernel build with **make** again.
 +<​code>​
 +$ make <-j4>
 +$ make <-j4> modules
 +</​code>​
 +When you exit from kernel menu screen, you will have **.config** in the current directory what have changes for your custom build. You can back up this as a file, my_kernel.config for example, or can make a patch if you manage your own git.
 +<​code>​
 +$ cp .config arch/​arm/​configs/​odroidc_defconfig
 +$ git add arch/​arm/​configs/​odroidc_defconfig
 +$ git commit -s -m "​blahblahblah"​
 +$ git push
 +</​code>​
 +===== Installation =====
 +There are different instructions to install Linux kernel image and device tree for Android and Linux. Since Android loads both from a boot 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:​c1_partition_table|here]]. In contrast, Linux boots by the instructions described in **boot.ini** the 1st FAT partition.
 +==== Android ====
 +This is the instruction to install kernel image, **uImage**, to the boot card.
 +<​code>​
 +$ sudo fastboot flash boot <​path/​of/​your/​uImage>​
 +</​code>​
 +This is to install a device tree file, **meson8b_odroidc.dtb**.
 +<​code>​
 +$ sudo fastboot flash dtb <​path/​of/​your/​meson8b_odroidc.dtb>​
 +</​code>​
 +==== Linux (Cross build) ====
 +
 +<WRAP center round important 100%>
 +** This explanation assume that your USB memory CARD reader is assigned at /dev/sdc. Be careful!**
 +</​WRAP>​
 +
 +1. Plug the Boot-Device(eMMC or SD) into the USB memory CARD reader and Connect the USB memory CARD reader to your HOST PC(Linux OS).
 +
 +2. Copy the uImage and DT((meson8b_odroidc.dtb) to the FAT partition(1st partition) in the Boot-Device.
 +<​code>​
 +$ mkdir -p mount
 +$ sudo mount /dev/sdc1 ./mount
 +$ sudo cp arch/​arm/​boot/​uImage arch/​arm/​boot/​dts/​meson8b_odroidc.dtb ./mount && sync && sudo umount ./mount
 +</​code>​
 +
 +3. Copy the driver modules to the EXT4 partition(2nd partition) in the Boot-Device.
 +<​code>​
 +$ sudo mount /dev/sdc2 ./mount
 +$ sudo make modules_install ARCH=arm INSTALL_MOD_PATH=./​mount && sync && sudo umount ./mount
 +$ rm -rf mount
 +</​code> ​
  
CC Attribution-Share Alike 3.0 Unported
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0