odroid-c4:software:building_u-boot

U-boot

U-boot must be cross-compiled on an x86 Linux PC.

You have to install some essential packages to build our u-boot.

Enter the following command.

Some packages listed in the below might not be essential but it is worth to install since these are also used when you build a kernel.

host
$ sudo apt install git lzop build-essential gcc bc libncurses5-dev libc6-i386 lib32stdc++6 zlib1g:i386

Click one of the site to download toolchain to build U-boot.

Once the download is done, extract the tarball to /opt/toolchains/.

host
$ sudo mkdir -p /opt/toolchains
$ sudo tar xvf gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz -C /opt/toolchains/
$ sudo tar xvf gcc-linaro-arm-none-eabi-4.8-2014.04_linux.tar.xz -C /opt/toolchains/

In order to add the toolchain path to PATH, paste below lines to $HOME/.bashrc.

host
export ARCH=arm64
export CROSS_COMPILE=aarch64-none-elf-
export PATH=/opt/toolchains/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:/opt/toolchains/gcc-linaro-arm-none-eabi-4.8-2014.04_linux/bin:$PATH

You can apply the change if you login again or import to apply this change, login again or evaluate $HOME/.bashrc with source command.

host
$ source ~/.bashrc

You can check if the toolchain installed above works properly while checking the version of toolchain. If you can find gcc version 4.8.3 20140904 (prerelease) at the end of the line, the toolchain is well installed.

host
$ aarch64-none-elf-gcc -v
Using built-in specs.
COLLECT_GCC=aarch64-none-elf-gcc
COLLECT_LTO_WRAPPER=/opt/toolchains/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin/../libexec/gcc/aarch64-none-elf/4.8.3/lto-wrapper
Target: aarch64-none-elf
Configured with: /cbuild/slaves/oorts/crosstool-ng/builds/aarch64-none-elf-linux/.build/src/gcc-linaro-4.8-2013.11/configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu --target=aarch64-none-elf --prefix=/cbuild/slaves/oorts/crosstool-ng/builds/aarch64-none-elf-linux/install --with-local-prefix=/cbuild/slaves/oorts/crosstool-ng/builds/aarch64-none-elf-linux/install/aarch64-none-elf --without-headers --with-newlib --enable-threads=no --disable-shared --with-pkgversion='crosstool-NG linaro-1.13.1-4.8-2013.11 - Linaro GCC 2013.10' --with-bugurl=https://bugs.launchpad.net/gcc-linaro --with-arch=armv8-a --disable-__cxa_atexit --with-gmp=/cbuild/slaves/oorts/crosstool-ng/builds/aarch64-none-elf-linux/.build/aarch64-none-elf/build/static --with-mpfr=/cbuild/slaves/oorts/crosstool-ng/builds/aarch64-none-elf-linux/.build/aarch64-none-elf/build/static --with-mpc=/cbuild/slaves/oorts/crosstool-ng/builds/aarch64-none-elf-linux/.build/aarch64-none-elf/build/static --with-isl=/cbuild/slaves/oorts/crosstool-ng/builds/aarch64-none-elf-linux/.build/aarch64-none-elf/build/static --with-cloog=/cbuild/slaves/oorts/crosstool-ng/builds/aarch64-none-elf-linux/.build/aarch64-none-elf/build/static --with-libelf=/cbuild/slaves/oorts/crosstool-ng/builds/aarch64-none-elf-linux/.build/aarch64-none-elf/build/static --enable-lto --enable-linker-build-id --disable-libmudflap --disable-libgomp --disable-libssp --disable-libstdcxx-pch --enable-multiarch --disable-multilib --enable-languages=c,c++,fortran
Thread model: single
gcc version 4.8.3 20131111 (prerelease) (crosstool-NG linaro-1.13.1-4.8-2013.11 - Linaro GCC 2013.10) 
host
$ ./arm-none-eabi-gcc -v
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)

You can checkout U-boot source tree from Hardkernel's Github.

host
$ git clone https://github.com/hardkernel/u-boot.git -b odroidg12-v2015.01

Before you compile U-boot, you must configure for ODROID-C4 with following command.

host
$ cd u-boot
$ make odroidc4_defconfig

And finally you can compile U-boot.

host
$ make

We provide the script, sd_fuse/sd_fusing.sh, this helps you to install the bootloader into your blank card eMMC or MicroSD.

  1. Insert your card to USB card reader and attach to USB host port of your desktop.
  2. Check the device path of your USB card reader.
  3. Install the bootloader binaries using sd_fuse/sd_fusing.sh.
host
$ cd sd_fuse
$ ./sd_fusing.sh <device/path/of/your/card>

If you can boot your ODROID-C4 already and want to install a new u-boot.bin built by you. Fastboot helps you to install a u-boot.bin into your board.

host
$ sudo fastboot flash bootloader sd_fuse/u-boot.bin

If installation is done, you care reboot your ODROID-C4 with fastboot.

host
$ sudo fastboot reboot
  • You must use the u-boot.bin binary under the folder, “u-boot/sd_fuse/u-boot.bin”
target
$ grep -a -r -E -o "2015.01.{0,50}" sd_fuse/u-boot.bin | grep -a "(" | cut -d' ' -f1
2015.01-01980-gce36c0a
  • odroid-c4/software/building_u-boot.txt
  • Last modified: 2020/04/23 16:00
  • by luke.go