Das U-Boot source

Our U-Boot source tree is on Gitlab.

At the time of writing we are working on the 'ls1043s_take_1' branch, please check the repository to see if you have our latest work. We intend to upstream these patches once LS1043-S Rev 1 arrives.

U-Boot loading

On power on/reset, the LS1043 will load the bootloader from NAND flash.

For customers who need to customize the bootloader, it is possible to load U-Boot from SD card, this is done by modifying the 'Reset Configuration Word (RCW)' source, either by changing the hardware strap resistors, a test fixture, or through JTAG.

U-Boot configurations

Cross compiling U-Boot

Note that U-Boot >= v2018.3requires GCC 6 or later. Linaro's cross compile toolchain works, as does the toolchain produced by recent versions of OpenWrt in its staging_dir.

git clone --branch ls1043s_take_1 https://gitlab.com/traversetech/qoriq-uboot/
cd u-boot-latest
make ls1043s_defconfig
make CROSS_COMPILE=/opt/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-

Flashing U-Boot to NAND

From U-Boot itself

Copy u-boot-with-spl-pbl.bin into your TFTP folder:

cp u-boot-with-spl-pbl.bin /tftproot/

You will also need the FMan uCode (i.e fsl_fman_ucode_ls1043_r1.1_108_4_5.bin) on your TFTP server as well.

On a blank board run:

tftp 82000000 u-boot-with-spl-pbl.bin; nand erase.chip; nand write 82000000 0 100000; tftp 83000000 fsl_fman_ucode_ls1043_r1.1_108_4_5.bin; nand erase 160000 $filesize; nand write 83000000 160000 $filesize;

On a board which already has a u-boot environment and partitions:

tftp 82000000 u-boot-with-spl-pbl.bin && nand erase.part nand_uboot && nand write 82000000 nand_uboot 100000

On Linux

This assumes the mtdparts is set correctly in your kernel, see NAND for details.

From Linux you can also do:

mtd erase nand_uboot && mtd write u-boot-with-spl-pbl.bin nand_uboot

Building a SD card U-Boot

Use the sdcard defconfig:

make ls1043s_sdcard_defconfig
make clean
make CROSS_COMPILE="aarch64-openwrt-linux-musl-"

You can copy it to SD card from u-boot:

tftpboot $kernel_load u-boot-with-spl-pbl.bin
mmc erase 8 0x800; mmc write $kernel_load 8 0x800
tftpboot $kernel_load fsl_fman_ucode_ls1043_r1.1_108_4_5.bin
mmc erase 0x820 0x80; mmc write $kernel_load 0x4800 0x80

To copy u-boot to SD card from a PC:

dd if=u-boot-with-spl-pbl-sd.bin of=/dev/sdcard bs=512 seek=8
dd if=fsl_fman_ucode_ls1043_r1.1_108_4_5.bin of=/dev/sdc bs=512 seek=18432

(Note: u-boot-with-spl-pbl.bin for SD card and u-boot-with-spl-pbl.bin for NAND are not the same)

Hybrid (SD boot/NAND environment) configuration

As it can be troublesome to fix a bricked board in NAND mode, one way to develop u-boot safely is to boot the board from SD, but load the u-boot from NAND.

The trick in this method is that the first stage bootloader (SPL) doesn't have to load U-Boot (proper) from the same media it was loaded from, so we can put the NAND SPL on an SD card. The board will load U-Boot SPL from SD, which will subsequently load U-Boot itself from NAND.

  1. Install U-Boot into NAND on the target board
  2. On your SD card, copy the NAND version of 'u-boot-with-spl-pbl.bin' to the SD card, as per above:
dd if=u-boot-with-spl-pbl-nand.bin of=/dev/sdcard bs=512 seek=8

Editing u-boot environment from Linux

fw_printenv/fw_setenv from the u-boot tools are required.

For NAND, the settings for /etc/fw_env.config are:

/dev/mtd1       0x40000 0x2000  0x20000 1

Embedding a u-boot environment on the SD card

(when board is in SD boot mode)

You might wish to embed your own u-boot environment on the SD card - so it will run a predefined sequence immediately (rather than searching for boot.scr or running the default bootcmd). An example of how to do this is in the recovery image:

~/five64-recovery$ cat target/linux/layerscape/image/uboot.env.txt
bootargs=console=ttyS0,115200 earlycon=uart8250,mmio,0x21c0500 ubi.mtd=4 root=/dev/ram0 rootwait mtdparts=7e800000.flash:1m(nand_uboot),384k(nand_uboot_env),128k(fman_fw),128k(dtb),400m(nandubi)
bootcmd=fatload mmc 0 $kernel_load kernel.itb && bootm $kernel_load
ethaddr=0a:0a:fa:00:00:01
eth1addr=0a:0a:fa:00:00:02
eth2addr=0a:0a:fa:00:00:03
eth3addr=0a:0a:fa:00:00:04
eth4addr=0a:0a:fa:00:00:05
eth5addr=0a:0a:fa:00:00:06

This environment file is then compiled (see target/linux/layerscape/image/Makefile: Build/recovery-sdcard)

mkenvimage -s 0x2000 -o $(STAGING_DIR_IMAGE)/force_boot_sd.env.bin uboot.env.txt

And then embedded onto the SD card image (see target/linux/layerscape/image/generate_recovery_sdcard.sh)

dd bs=512 if="$BOOTFS" of="$OUTPUT" seek="$BOOTOFFSET" conv=notrunc