Skip to content

Instantly share code, notes, and snippets.

@mariotpc
Last active August 20, 2020 19:41
Show Gist options
  • Save mariotpc/0fd120dd0b5fcb42a5ba5ff1964c94f1 to your computer and use it in GitHub Desktop.
Save mariotpc/0fd120dd0b5fcb42a5ba5ff1964c94f1 to your computer and use it in GitHub Desktop.
Compile U-BOOT for raspberry pi B+
My Raspberry Pi B+ comes from 5 years ago, this was bought by me on my travel to Boston,
Fist all, you must have a GCC Cross Compiler, this could be the Linaro or some made by you using crosstool, as in my case.
Add your toolchain to your environment
PATH=${HOME}/x-tools/armv6-rpi-linux-gnueabi/bin/:$PATH
export CROSS_COMPILE=armv6-rpi-linux-gnueabi-
export ARCH=arm
[mariotpc@fedora31 u-boot]$ ls ~/x-tools/armv6-rpi-linux-gnueabi/
armv6-rpi-linux-gnueabi/ build.log.bz2 lib/ libexec/
bin/ include/ lib64/ share/
[mariotpc@fedora31 u-boot]$ make CROSS_COMPILE=armv6-rpi-linux-gnueabi- rpi_defconfig
#
# configuration written to .config
#
The rpi_defconfig has inside.
CONFIG_ARM=y
CONFIG_ARCH_CPU_INIT=y
CONFIG_ARCH_BCM283X=y
CONFIG_SYS_TEXT_BASE=0x00008000
CONFIG_TARGET_RPI=y
CONFIG_NR_DRAM_BANKS=1
CONFIG_ENV_SIZE=0x4000
CONFIG_DEFAULT_DEVICE_TREE="bcm2835-rpi-b"
Let try to compile
[mariotpc@fedora31 u-boot]$ make CROSS_COMPILE=armv6-rpi-linux-gnueabi-
..
..
..
OBJCOPY examples/standalone/hello_world.bin
LDS u-boot.lds
LD u-boot
OBJCOPY u-boot.srec
OBJCOPY u-boot-nodtb.bin
COPY u-boot.bin
SYM u-boot.sym
===================== WARNING ======================
CONFIG_OF_EMBED is enabled. This option should only
be used for debugging purposes. Please use
CONFIG_OF_SEPARATE for boards in mainline.
See doc/README.fdt-control for more info.
====================================================
CFGCHK u-boot.cfg
..
..
..
OBJCOPY u-boot-nodtb.bin
COPY u-boot.bin
SYM u-boot.sym
The results of the compilation are:
: U-Boot in ELF object format, suitable for use with a debugger
u-boot.map : The symbol table
u-boot.bin : U-Boot in raw binary format, suitable for running on your device
u-boot: This is u-boot.bin with a U-Boot header added, suitable for
uploading to a running copy of U-Boot
u-boot.srec : U-Boot in Motorola S-record (SRECORD or SRE) format,
suitable for transferring over a serial connection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment