Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:c2_building_u-boot [2016/09/20 13:31] joy.cho [Installation to blank card] |
en:c2_building_u-boot [2017/07/25 15:15] (current) joy.cho [Installation to blank card] |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== U-boot ====== | ====== U-boot ====== | ||
- | U-boot must be cross-compiled on an x86 box | + | U-boot must be cross-compiled on an x86 Linux PC. |
- | ===== Toolchain (1) ===== | + | ===== Toolchain ===== |
Click one of the site to download toolchain to build U-boot. | Click one of the site to download toolchain to build U-boot. | ||
- | * [[https://releases.linaro.org/14.09/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.9-2014.09_linux.tar.xz|Download #1]] | + | * [[https://releases.linaro.org/archive/14.09/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.9-2014.09_linux.tar.xz|Download #1]] |
* [[http://dn.odroid.com/toolchains/gcc-linaro-aarch64-none-elf-4.9-2014.09_linux.tar.xz|Download #2]] | * [[http://dn.odroid.com/toolchains/gcc-linaro-aarch64-none-elf-4.9-2014.09_linux.tar.xz|Download #2]] | ||
Once the download is done, extract the tarball to **/opt/toolchains/**. | Once the download is done, extract the tarball to **/opt/toolchains/**. | ||
Line 35: | Line 35: | ||
</code> | </code> | ||
- | ===== Toolchain (2) ===== | + | |
- | bl301.bin source code has been merged on HK's Github since 12, Aug, 2016 and it needs a toolchain, arm-none-eabi-. | + | |
- | Click one of the site to download toolchain to build U-boot. | + | |
- | * [[http://dn.odroid.com/toolchains/gcc-linaro-arm-none-eabi-4.8-2014.04_linux.tar.xz|Download #3]] | + | |
- | Once the download is done, extract the tarball to **/opt/toolchains/**. | + | |
- | <code> | + | |
- | $ sudo mkdir -p /opt/toolchains | + | |
- | $ sudo tar xvf gcc-linaro-arm-none-eabi-4.8-2014.04_linux.tar.xz -C /opt/toolchains/ | + | |
- | </code> | + | |
- | In order to add the toolchain path to PATH, paste below lines to **$HOME/.bashrc**. | + | |
- | <code> | + | |
- | export PATH=/opt/toolchains/gcc-linaro-arm-none-eabi-4.8-2014.04_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. | + | |
- | <code> | + | |
- | Using built-in specs. | + | |
- | COLLECT_GCC=arm-none-eabi-gcc | + | |
- | COLLECT_LTO_WRAPPER=/opt/toolchains/gcc-linaro-arm-none-eabi-4.8-2014.04_linux/bin/../libexec/gcc/arm-none-eabi/4.8.3/lto-wrapper | + | |
- | Target: arm-none-eabi | + | |
- | Configured with: /cbuild/slaves/oorts/crosstool-ng/builds/arm-none-eabi-linux/.build/src/gcc-linaro-4.8-2014.04/configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu --target=arm-none-eabi --prefix=/cbuild/slaves/oorts/crosstool-ng/builds/arm-none-eabi-linux/install --with-local-prefix=/cbuild/slaves/oorts/crosstool-ng/builds/arm-none-eabi-linux/install/arm-none-eabi --without-headers --with-newlib --enable-threads=no --disable-shared --with-pkgversion='crosstool-NG linaro-1.13.1-4.8-2014.04 - Linaro GCC 4.8-2014.04' --with-bugurl=https://bugs.launchpad.net/gcc-linaro --disable-__cxa_atexit --with-gmp=/cbuild/slaves/oorts/crosstool-ng/builds/arm-none-eabi-linux/.build/arm-none-eabi/build/static --with-mpfr=/cbuild/slaves/oorts/crosstool-ng/builds/arm-none-eabi-linux/.build/arm-none-eabi/build/static --with-mpc=/cbuild/slaves/oorts/crosstool-ng/builds/arm-none-eabi-linux/.build/arm-none-eabi/build/static --with-isl=/cbuild/slaves/oorts/crosstool-ng/builds/arm-none-eabi-linux/.build/arm-none-eabi/build/static --with-cloog=/cbuild/slaves/oorts/crosstool-ng/builds/arm-none-eabi-linux/.build/arm-none-eabi/build/static --with-libelf=/cbuild/slaves/oorts/crosstool-ng/builds/arm-none-eabi-linux/.build/arm-none-eabi/build/static --enable-lto --enable-linker-build-id --enable-libmudflap --disable-libgomp --enable-libssp --disable-libstdcxx-pch --enable-multilib --enable-languages=c,c++,fortran --with-multilib-list=aprofile | + | |
- | Thread model: single | + | |
- | gcc version 4.8.3 20140401 (prerelease) (crosstool-NG linaro-1.13.1-4.8-2014.04 - Linaro GCC 4.8-2014.04) | + | |
- | </code> | + | |
===== Checkout & compile ===== | ===== Checkout & compile ===== | ||
You can checkout **U-boot** source tree from **[[https://github.com/hardkernel/u-boot/tree/odroidc-v2011.03|Hardkernel's Github]]**. | You can checkout **U-boot** source tree from **[[https://github.com/hardkernel/u-boot/tree/odroidc-v2011.03|Hardkernel's Github]]**. | ||
Line 96: | Line 69: | ||
Click the following site to download the boot loader of final release version | Click the following site to download the boot loader of final release version | ||
- | * [[http://dn.odroid.com/S905/BootLoader/ODROID-C2/c2_boot_ubuntu_release.tar.gz|Download - Ubuntu 16.04 release v2.0 update Sep 08 2016]] | + | * [[http://dn.odroid.com/S905/BootLoader/ODROID-C2/c2_boot_release_ubuntu.tar.gz|Download - Ubuntu (update Feb 27, 2017)]] |
- | * [[http://dn.odroid.com/S905/BootLoader/ODROID-C2/c2_boot_android_release.tar.gz|Download - Android 5.1.1 release v2.2]] | + | * [[http://dn.odroid.com/S905/BootLoader/ODROID-C2/c2_boot_release_android.tar.gz|Download - Android (update Jun 06, 2017)]] |
<code> | <code> | ||
Line 188: | Line 161: | ||
odroidc2# booti 0x11000000 0x13000000 0x1000000 | odroidc2# booti 0x11000000 0x13000000 0x1000000 | ||
</code> | </code> | ||
+ | |||
+ | ===== How to build u-boot with bl301 firmware ===== | ||
+ | |||
+ | Because of the issue of build failure on any platform other than x86-64 and support of buildroot, we've separated bl301 firmware source code from u-boot repository. | ||
+ | |||
+ | In the path, u-boot/fip/gxb/, there is a pre-built bl301.bin binary of the latest version, so you can build just u-boot without a re-build bl301 process. | ||
+ | |||
+ | If you want to modify and update bl301-related source codes by yourself, please refer to the following. | ||
+ | |||
+ | === Checkout and Merge === | ||
+ | |||
+ | You can checkout **bl301 firmware** source tree from **[[https://github.com/hardkernel/u-boot_firmware/tree/odroidc2-bl301|Hardkernel's Github]]**. | ||
+ | <code> | ||
+ | $ git clone https://github.com/hardkernel/u-boot_firmware.git -b odroidc2-bl301 | ||
+ | </code> | ||
+ | You should merge bl301 with u-boot before build it. | ||
+ | <code> | ||
+ | $ git clone https://github.com/hardkernel/u-boot.git -b odroidc2-v2015.01 | ||
+ | $ git clone https://github.com/hardkernel/u-boot_firmware.git -b odroidc2-bl301 | ||
+ | |||
+ | $ cd u-boot | ||
+ | |||
+ | $ git remote add u-boot_firmware ../u-boot_firmware/ | ||
+ | $ git fetch u-boot_firmware | ||
+ | $ git merge --no-commit u-boot_firmware/odroidc2-bl301 | ||
+ | </code> | ||
+ | |||
+ | === Toolchain for bl301 === | ||
+ | |||
+ | bl301.bin source code needs a toolchain, arm-none-eabi-. | ||
+ | Click one of the site to download toolchain to build U-boot. | ||
+ | * [[http://dn.odroid.com/toolchains/gcc-linaro-arm-none-eabi-4.8-2014.04_linux.tar.xz|Download]] | ||
+ | Once the download is done, extract the tarball to **/opt/toolchains/**. | ||
+ | <code> | ||
+ | $ sudo mkdir -p /opt/toolchains | ||
+ | $ sudo tar xvf gcc-linaro-arm-none-eabi-4.8-2014.04_linux.tar.xz -C /opt/toolchains/ | ||
+ | </code> | ||
+ | In order to add the toolchain path to PATH, paste below lines to **$HOME/.bashrc**. | ||
+ | <code> | ||
+ | export PATH=/opt/toolchains/gcc-linaro-arm-none-eabi-4.8-2014.04_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. | ||
+ | <code> | ||
+ | Using built-in specs. | ||
+ | COLLECT_GCC=arm-none-eabi-gcc | ||
+ | COLLECT_LTO_WRAPPER=/opt/toolchains/gcc-linaro-arm-none-eabi-4.8-2014.04_linux/bin/../libexec/gcc/arm-none-eabi/4.8.3/lto-wrapper | ||
+ | Target: arm-none-eabi | ||
+ | Configured with: /cbuild/slaves/oorts/crosstool-ng/builds/arm-none-eabi-linux/.build/src/gcc-linaro-4.8-2014.04/configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu --target=arm-none-eabi --prefix=/cbuild/slaves/oorts/crosstool-ng/builds/arm-none-eabi-linux/install --with-local-prefix=/cbuild/slaves/oorts/crosstool-ng/builds/arm-none-eabi-linux/install/arm-none-eabi --without-headers --with-newlib --enable-threads=no --disable-shared --with-pkgversion='crosstool-NG linaro-1.13.1-4.8-2014.04 - Linaro GCC 4.8-2014.04' --with-bugurl=https://bugs.launchpad.net/gcc-linaro --disable-__cxa_atexit --with-gmp=/cbuild/slaves/oorts/crosstool-ng/builds/arm-none-eabi-linux/.build/arm-none-eabi/build/static --with-mpfr=/cbuild/slaves/oorts/crosstool-ng/builds/arm-none-eabi-linux/.build/arm-none-eabi/build/static --with-mpc=/cbuild/slaves/oorts/crosstool-ng/builds/arm-none-eabi-linux/.build/arm-none-eabi/build/static --with-isl=/cbuild/slaves/oorts/crosstool-ng/builds/arm-none-eabi-linux/.build/arm-none-eabi/build/static --with-cloog=/cbuild/slaves/oorts/crosstool-ng/builds/arm-none-eabi-linux/.build/arm-none-eabi/build/static --with-libelf=/cbuild/slaves/oorts/crosstool-ng/builds/arm-none-eabi-linux/.build/arm-none-eabi/build/static --enable-lto --enable-linker-build-id --enable-libmudflap --disable-libgomp --enable-libssp --disable-libstdcxx-pch --enable-multilib --enable-languages=c,c++,fortran --with-multilib-list=aprofile | ||
+ | Thread model: single | ||
+ | gcc version 4.8.3 20140401 (prerelease) (crosstool-NG linaro-1.13.1-4.8-2014.04 - Linaro GCC 4.8-2014.04) | ||
+ | </code> | ||
+ | |||
+ | === Build === | ||
+ | And finally you can compile u-boot with bl301 firmware. | ||
+ | <code> | ||
+ | $ cd u-boot | ||
+ | $ make distclean | ||
+ | $ make odroidc2_config | ||
+ | $ make | ||
+ | </code> | ||
+ | |||
+ | ===== How to check U-Boot version on User Space ===== | ||
+ | You can check the U-Boot version using **dd** command as following. | ||
+ | |||
+ | === Ubuntu === | ||
+ | <code> | ||
+ | root@odroid64:/home/odroid# vi getUbootVer.sh | ||
+ | |||
+ | #!/bin/sh | ||
+ | dd if=/dev/mmcblk0 of=/tmp/temp.bin bs=512 skip=97 count=1334 status=none | ||
+ | grep -a -r -E -o ".{0,0}U-Boot 2015.01.{0,50}" /tmp/temp.bin | grep -a "(" | ||
+ | rm /tmp/temp.bin | ||
+ | |||
+ | root@odroid64:/home/odroid# chmod a+x getUbootVer.sh | ||
+ | |||
+ | root@odroid64:/home/odroid# ./getUbootVer.sh | ||
+ | U-Boot 2015.01-00167-g095fdbe-dirty (Nov 12 2016 - 16:35:32) | ||
+ | </code> | ||
+ | |||
+ | === Android === | ||
+ | <code> | ||
+ | shell@odroidc2:/ $ su | ||
+ | root@odroidc2:/ # mount -o rw,remount / | ||
+ | root@odroidc2:/ # vi getUbootVer.sh | ||
+ | |||
+ | #!/bin/sh | ||
+ | dd if=/dev/block/mmcblk0 of=/temp.bin bs=512 skip=97 count=1334 | ||
+ | grep -a -r -E -o ".{0,0}U-Boot 2015.01.{0,50}" /temp.bin | grep -a "(" | ||
+ | rm /temp.bin | ||
+ | |||
+ | root@odroidc2:/ # chmod 755 /getUbootVer.sh | ||
+ | |||
+ | root@odroidc2:/ # /getUbootVer.sh | ||
+ | 1334+0 records in | ||
+ | 1334+0 records out | ||
+ | 683008 bytes transferred in 0.014 secs (48786285 bytes/sec) | ||
+ | /temp.bin:U-Boot 2015.01-dirty (Jul 06 2017 - 07:47:27) | ||
+ | </code> | ||
+ |