U-Boot

From wiki.openedev
Jump to: navigation, search

Loading files via

Serial NOR flash

Zynq> sf probe
SF: Detected S25FL128S_64K with page size 256 Bytes, erase size 64 KiB, total 16 MiB
Zynq> sf erase 0xE00000 0x100000
SF: 1048576 bytes @ 0xe00000 Erased: OK
Zynq> mw.b 0x100 0xaa 0x100000
Zynq> sf write 0x100 0xE00000 0x100000
device 0 offset 0xe00000, size 0x100000
SF: 1048576 bytes @ 0xe00000 Written: OK
Zynq> sf read 0x3000000 0xE00000 0x100000
device 0 offset 0xe00000, size 0x100000
SF: 1048576 bytes @ 0xe00000 Read: OK

Zynq> cmp.b 0x3000000 0x100 0x100000
Total of 1048576 byte(s) were the same
Zynq> mw.b 0x100 0xbb 0x100000           
Zynq> sf update 0x100 0xE00000 0x100000
device 0 offset 0xe00000, size 0x100000
1048576 bytes written, 0 bytes skipped in 24.625s, speed 43598 B/s

Others Features

buildman

bash> HOME=

dtc

bash> apt-get install flex bison
bash> git clone git://git.kernel.org/pub/scm/utils/dtc/dtc.git
bash> cd dtc
bash> make && make install PREFIX=/path/to/install
Set the dtc path 

Sandbox

bash> sudo apt-get install libsdl2-dev libssl-dev

Sandbox test setup

bash> cd /path/to/u-boot
bash> sudo apt-get install python python-virtualenv
bash> virtualenv venv
bash> . ./venv/bin/activate
bash> pip install pytest

To test sandbox

bash> ./test/py/test.py --bd sandbox --build

To test driver model test in sandbox

bash> ./test/py/test.py --bd sandbox --build -k ut_dm

SPL

U-Boot SPL(Secondary Program Loader) is a small binary, generated from U-Boot source, that fits in the SRAM and loads the main U-Boot into system RAM.

Suppose in Xilinx Zynq U-Boot SPL will replaces FSBL means we don't need to use FSBL for booting zynq boards. We need to have zynq u-boot that capable of handling SPL, where you can create boot.bin using spl binary and the spl oriented boot image (boot.bin) will load u-boot-dtb.img

  • Clone zynq u-boot
bash> git clone https://github.com/openedev/u-boot-zynq.git
  • Build for zynq microzed board
bash> make zynq_microzed_defconfig
bash> make DEVICE_TREE=zynq-microzed
  • Generate boot.bin
bash> ./tools/zynq-boot-bin.py -o boot.bin -u spl/u-boot-spl.bin
Input file is: spl/u-boot-spl.bin
Output file is: boot.bin
Using /media/jagan/u-boot-zynq/spl/u-boot-spl.bin to get image length - it is 43884 (0xab6c) bytes
After checksum waddr= 0x13  byte addr= 0x4c
Number of registers to initialize 0
Generating binary output  /media/jagan/u-boot-zynq/boot.bin
  • Boot the SPL and main u-boot
 Copy boot.bin and u-boot-dtb.img onto SD card and set microzed board as
 SD bootmode and Rreset the board.
U-Boot SPL 2015.07-rc3-00064-g8097cba (Jul 12 2015 - 02:06:05)
mmc boot
reading system.dtb
spl_load_image_fat_os: error reading image system.dtb, err - -1
reading u-boot-dtb.img
reading u-boot-dtb.img


U-Boot 2015.07-rc3-00064-g8097cba (Jul 12 2015 - 02:06:05 +0530)

Model: Zynq MicroZED Board
I2C:   ready
DRAM:  ECC disabled 1 GiB
MMC:   zynq_sdhci: 0
Using default environment

In:    serial
Out:   serial
Err:   serial
Model: Zynq MicroZED Board
Net:   Gem.e000b000
Error: Gem.e000b000 address not set. 

Hit any key to stop autoboot:  0 
zynq-uboot>