§2023-06-26
- [odroid-C4 u-boot] (https://wiki.odroid.com/odroid-hc4/software/building_u-boot)
U-boot must be cross-compiled on an x86 Linux PC.
- Essential packages
- 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.
$ sudo apt install git lzop build-essential gcc bc libncurses5-dev libc6-i386 lib32stdc++6 zlib1g:i386
- Toolchain
- Click one of the site to download toolchain to build U-boot.
- Linaro GCC aarch64-none-elf 4.8 2013.11
- Linaro GCC arm-none-eabi 4.8-2014.04 Once the download is done, extract the tarball to /opt/toolchains/.
- Click one of the site to download toolchain to build U-boot.
$ 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.
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.
$ 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.
$ aarch64-none-elf-gcc -v
組み込み spec を使用しています。
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
ターゲット: aarch64-none-elf
configure 設定: /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
スレッドモデル: single
gcc バージョン 4.8.3 20131111 (prerelease) (crosstool-NG linaro-1.13.1-4.8-2013.11 - Linaro GCC 2013.10)
alexlai@SurfacePro:~/build/src$
$ arm-none-eabi-gcc -v
組み込み spec を使用しています。
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
ターゲット: arm-none-eabi
configure 設定: /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
スレッドモデル: single
gcc バージョン 4.8.3 20140401 (prerelease) (crosstool-NG linaro-1.13.1-4.8-2014.04 - Linaro GCC 4.8-2014.04)
- Checkout & compile You can checkout U-boot source tree from Hardkernel's Github.
$ git clone https://github.com/hardkernel/u-boot.git -b odroidg12-v2015.01
Before you compile U-boot, you must configure for ODROID-HC4 with following command.
$ cd u-boot
$ make odroidc4_defconfig
And finally you can compile U-boot.
$ time make
# build final bootloader
Building /home/alexlai/build/u-boot/sd_fuse/u-boot.bin...
/home/alexlai/build/u-boot/sd_fuse/u-boot.bin is updated.
real 0m53.754s
user 0m46.969s
sys 0m7.560s
- Installation Installation to memory card directly We provide the script, sd_fuse/sd_fusing.sh, this helps you to install the bootloader into your blank card MicroSD.
Insert your card to USB card reader and attach to USB host port of your desktop. Check the device path of your USB card reader. Install the bootloader binaries using sd_fuse/sd_fusing.sh. host $ cd sd_fuse $ ./sd_fusing.sh <device/path/of/your/card>