§2023-06-26

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

$ sudo apt install git lzop build-essential gcc bc libncurses5-dev libc6-i386 lib32stdc++6 zlib1g:i386
$ 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/
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
$  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) 
$ 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

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>