u-boot build procedure

Document created by jorge_plascencia Employee on Apr 25, 2016Last modified by ebiz_ws_prod on Dec 13, 2017
Version 5Show Document
  • View in full screen mode

Before building u-boot, you'll need a machine that can run Linux (such as Fedora or Ubuntu). You can setup a Virtual Machine and install Linux on it if you don't have access to a physical Linux machine.

Start by downloading the u-boot source code at http://www.denx.de/wiki/U-Boot/WebHome. Unzip the source code into a directory on your machine. The patch has been built against the 2011.06 version of the u-boot source, so be sure to get the correct version.

Get the LPC177x_8x u-boot patch the attached file.

3. Apply the patch to the u-boot source code using the following command in the u-boot source directory.
ubuntu:~/dev/lpc1788/u-boot-2011.06$ patch -p1 < u-boot-2011.06-ea1788_v1_00.patch
patching file arch/arm/cpu/cortex-m3/config.mk
patching file arch/arm/cpu/cortex-m3/cpu.c
patching file arch/arm/cpu/cortex-m3/lpc17xx/clocks.c
patching file arch/arm/cpu/cortex-m3/lpc17xx/common.c
patching file arch/arm/cpu/cortex-m3/lpc17xx/flash.c
patching file arch/arm/cpu/cortex-m3/lpc17xx/gpio.c
patching file arch/arm/cpu/cortex-m3/lpc17xx/iaplib.c
patching file arch/arm/cpu/cortex-m3/lpc17xx/iocon.c
patching file arch/arm/cpu/cortex-m3/lpc17xx/Makefile
patching file arch/arm/cpu/cortex-m3/lpc17xx/serial.c
patching file arch/arm/cpu/cortex-m3/lpc17xx/timer.c
patching file arch/arm/cpu/cortex-m3/Makefile
patching file arch/arm/cpu/cortex-m3/mpu.c
patching file arch/arm/cpu/cortex-m3/nvic.c
patching file arch/arm/cpu/cortex-m3/start.S
patching file arch/arm/cpu/cortex-m3/u-boot.lds
patching file arch/arm/include/asm/arch-cortex-m3/cortex-m3.h
patching file arch/arm/include/asm/arch-lpc17xx/hardware.h
patching file arch/arm/include/asm/arch-lpc17xx/lpc17_clock_checks.h
patching file arch/arm/include/asm/arch-lpc17xx/lpc17_clocks.h
patching file arch/arm/include/asm/arch-lpc17xx/lpc17_gpio.h
patching file arch/arm/include/asm/arch-lpc17xx/lpc17_iaplib.h
patching file arch/arm/include/asm/arch-lpc17xx/lpc17_iocon.h
patching file arch/arm/include/asm/arch-lpc17xx/lpc17_mac.h
patching file arch/arm/include/asm/arch-lpc17xx/lpc17_regs.h
patching file arch/arm/lib/board.c
patching file board/nxp/ea1788/config.mk
patching file board/nxp/ea1788/ea1788.c
patching file board/nxp/ea1788/Makefile
patching file board/nxp/ea1788/mem.c
patching file board/nxp/ea1788/mpu_setup.c
patching file board/nxp/ea1788/nand.c
patching file board/nxp/ea1788/net.c
patching file board/nxp/ea1788/pins.c
patching file include/configs/ea1788.h
patching file Makefile

Download the Code Sourcery GNU Lite tools for Linux (http://www.lpcware.com/content/tools/code-sourcery-codebench) and untar the tools into a directory.

Add the Code Sourcery GNU tools to your path as follows. Change the directory to where your tools have been installed.
export PATH=$PATH:$/home/user/dev/arm-2011.03/bin

Add several environment variables to your shell with the following commands. Like the path above, make sure the CROSS_COMPILE path is correct.
export CROSS_COMPILE=/home/user/dev/arm-2011.03/bin/arm-none-eabi-
export ARCH=arm

Switch into the u-boot directory and type 'make ea1788_config' to configure u-boot for the EA1788 board.
ubuntu:~/dev/lpc1788/u-boot-2011.06-lpc1788$ make ea1788_config
awk '(NF && $1 !~ /^#/) { print $1 ": " $1 "_config; $(MAKE)" }' boards.cfg > .boards.depend
Configuring for ea1788 board...

Before building the u-boot binary, an additional tool must be added to your path to generate the word 7 checksum value in the u-boot binary. Without this, u-boot won't boot on the board. You can get this tool at attached files.
Add the path that the tool is located in to your PATH environment variable similar to step 5 above.

Type 'make to build the u-boot binaries.
ubuntu:~/dev/lpc1788/u-boot-2011.06-lpc1788$ make
Generating include/autoconf.mk
Generating include/autoconf.mk.dep
/home/usb10132/dev/lpc1788/arm-2011.03/bin/arm-none-eabi-gcc -DDO_DEPS_ONLY \
-g  -Os   -fno-common -ffixed-r8 -msoft-float   -D__KERNEL__ -DCONFIG_SYS_TEXT_BASE=0xA1F80000 -I/home/usb10132/dev/lpc1788/u-boot-2011.06-lpc1788/include -fno-builtin -ffreestanding -nostdinc -isystem /home/usb10132/dev/lpc1788/arm-2011.03/bin/../lib/gcc/arm-none-eabi/4.5.2/include -pipe  -DCONFIG_ARM -D__ARM__ -marm  -mabi=aapcs-linux -mno-thumb-interwork -march=armv7-m -mthumb -Os -static-libgcc -fpic -mtune=cortex-m3 -nostdlib -Wall -Wstrict-prototypes -fno-stack-protector   \
-o lib/asm-offsets.s lib/asm-offsets.c -c -S
/home/usb10132/dev/lpc1788/arm-2011.03/bin/arm-none-eabi-objcopy -O srec u-boot u-boot.srec
/home/usb10132/dev/lpc1788/arm-2011.03/bin/arm-none-eabi-objcopy --gap-fill=0xff -O binary u-boot u-boot.bin
./lpc17_fcg u-boot.bin u-boot-lpc.bin
File u-boot.bin loaded with size 125572 bytes
Word 0: 0x1000ff90
Word 1: 0x00000161
Word 2: 0x00000135
Word 3: 0x00000139
Word 4: 0x0000013d
Word 5: 0x00000141
Word 6: 0x00000145
Word 7: 0xeffef8de (cksum total: 0x00000000)
File u-boot-lpc.bin created with size 125572 bytes
/home/usb10132/dev/lpc1788/arm-2011.03/bin/arm-none-eabi-objcopy --gap-fill=0xff -O ihex u-boot-lpc.bin u-boot-lpc.hex -I binary
/home/usb10132/dev/lpc1788/arm-2011.03/bin/arm-none-eabi-objdump -d u-boot > u-boot.dis

After about a minute, you should get the binary and hex file used for programming the board. The hex file is used with the Flash Magic tool, while the binary can be used directly with u-boot to update itself after u-boot has been installed. The files are called u-boot-lpc.hex and u-boot-lpc.bin

Original Attachment has been moved to: lpc17xx_cksum_insert.tar.bz2

Original Attachment has been moved to: u-boot-2011.06-ea1788_v1_00_0.patch.zip