§2023-08-23

¶1.0 Obtaining the source

alexlai@hc4Bookworm:~/build$ pwd
/home/alexlai/build
$ git clone https://source.denx.de/u-boot/u-boot.git
alexlai@SurfacePro:~/build$ mv u-boot/ Das-u-boot
alexlai@SurfacePro:~/build$ cd Das-u-boot/
alexlai@SurfacePro:~/build/Das-u-boot$ git checkout v2023.07.02 -b v2023.07.02
Switched to a new branch 'v2023.07.02'
# The released versions are available as tags which use the naming scheme:
# v<year>.<month>
$ git checkout v2023.07.02 -b v2023.07.02
Switched to a new branch 'v2023.07.02'

¶2. Debian based¶

On Debian based systems the cross compiler packages are named gcc--linux-gnu.

You could install GCC and the GCC cross compiler for the ARMv8 architecture with sudo apt-get install gcc gcc-aarch64-linux-gnu for cross compiling.

$ sudo apt-get install gcc gcc-aarch64-linux-gnu
alexlai@SurfacePro:~$ aarch64-linux-gnu-gcc --version
aarch64-linux-gnu-gcc (Ubuntu 12.2.0-3ubuntu1) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ sudo apt install bison flex

¶3. make menuconfig (for odroid-hc4)

$ export CROSS_COMPILE=aarch64-linux-gnu-
$ make odroid-hc4_defconfig
#
# configuration written to .config
#
$ make
$ ls
Kbuild       Makefile    arch   cmd        disk     env       lib   scripts  u-boot-dtb.bin    u-boot.bin  u-boot.lds
Kconfig      README      bin    common     doc      examples  net   test     u-boot-elf.lds    u-boot.cfg  u-boot.map
Licenses     System.map  board  config.mk  drivers  fs        post  tools    u-boot-elf.o      u-boot.dtb  u-boot.srec
MAINTAINERS  api         boot   configs    dts      include   py    u-boot   u-boot-nodtb.bin  u-boot.elf  u-boot.sym