§2023-08-26

¶cross-compileing @surfacePro

$ 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

alexlai@SurfacePro:~/build/src$ 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) 
git clone https://github.com/hardkernel/u-boot.git -b odroidg12-v2015.01
alexlai@SurfacePro:~/build/src$ mv u-boot u-boot-odroid-n2

alexlai@SurfacePro:~/build/src$ cd u-boot-odroid-n2

alexlai@SurfacePro:~/build/src/u-boot-odroid-n2$ make odroidn2_defconfig
  HOSTCC  scripts/basic/fixdep
  GEN     ./Makefile
  HOSTCC  scripts/kconfig/conf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/zconf.lex.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#
alexlai@SurfacePro:~/build/src/u-boot-odroid-n2$ make
Building /home/alexlai/build/src/u-boot-odroid-n2/build/fip/fip.bin...
Amlogic img found, use new FIP structure!
Creating "/home/alexlai/build/src/u-boot-odroid-n2/build/fip/fip.bin"
Firmware Image Package ToC:
---------------------------
- SCP Firmware BL3-0: offset=0x4000, size=0xD400
- EL3 Runtime Firmware BL3-1: offset=0x14000, size=0x29328
- Non-Trusted Firmware BL3-3: offset=0x40000, size=0xB28E8
---------------------------
# build final bootloader
Building /home/alexlai/build/src/u-boot-odroid-n2/sd_fuse/u-boot.bin...
/home/alexlai/build/src/u-boot-odroid-n2/sd_fuse/u-boot.bin is updated.
alexlai@SurfacePro:~/build/src/u-boot-odroid-n2$ ls sd_fuse/
sd_fusing.sh  u-boot.bin  u-boot.bin.sd.bin  u-boot.bin.usb.bl2  u-boot.bin.usb.tpl

$ sudo dd if=u-boot.bin of=/dev/sda conv=fsync,notrunc bs=512 seek=1