How to build U-Boot for ultra96 V2 Based on Avnet BSP 2018.3

Updated: Apr 27



Build Steps


# Setup PetaLinux Environment

cd ~petalinux-install-directory

source peta/settings.sh


# go to BSP source code directory

cd ultra96v2_oob_2018_3


# In order to clean up build temp files By running following command:

petalinux-build -c u-boot -x distclean


# You should see following debug messages:

​petalinux-build -c u-boot -x distclean

[INFO] building u-boot

[INFO] sourcing bitbake

INFO: bitbake virtual/bootloader -c cleansstate Loading cache: 100% |##################################################################################################################################################| Time: 0:01:48 Loaded 3468 entries from dependency cache. Parsing recipes: 100% |################################################################################################################################################| Time: 0:04:24 Parsing of 2577 .bb files complete (2542 cached, 35 parsed). 3469 targets, 133 skipped, 0 masked, 0 errors. NOTE: Resolving any missing task queue dependencies Initialising tasks: 100% |#############################################################################################################################################| Time: 0:00:00 NOTE: Executing RunQueue Tasks NOTE: Tasks Summary: Attempted 2 tasks of which 0 didn't need to be rerun and all succeeded. [INFO] successfully built u-boot

# In order to fetch source ode, please run following command:

petalinux-build -c u-boot-x fetch


# You will see following debug messages:

​petalinux-build -c u-boot -x fetch

[INFO] building u-boot

[INFO] sourcing bitbake

INFO: bitbake virtual/bootloader -c fetch Loading cache: 100% |##################################################################################################################################################| Time: 0:01:21 Loaded 3468 entries from dependency cache. Parsing recipes: 100% |################################################################################################################################################| Time: 0:04:04 Parsing of 2577 .bb files complete (2542 cached, 35 parsed). 3469 targets, 133 skipped, 0 masked, 0 errors. NOTE: Resolving any missing task queue dependencies Initialising tasks: 100% |#############################################################################################################################################| Time: 0:00:00 NOTE: Executing RunQueue Tasks NOTE: Tasks Summary: Attempted 1 tasks of which 0 didn't need to be rerun and all succeeded. INFO: Copying Images from deploy to images [INFO] successfully built u-boot

# In order to unpack source ode, please run following command:

petalinux-build -c u-boot -x unpack

# You will see following debug messages:


​petalinux-build -c u-boot -x unpack

[INFO] building u-boot

[INFO] sourcing bitbake

INFO: bitbake virtual/bootloader -c unpack Loading cache: 100% |##################################################################################################################################################| Time: 0:01:24 Loaded 3468 entries from dependency cache. Parsing recipes: 100% |################################################################################################################################################| Time: 0:04:56 Parsing of 2577 .bb files complete (2542 cached, 35 parsed). 3469 targets, 133 skipped, 0 masked, 0 errors. NOTE: Resolving any missing task queue dependencies Initialising tasks: 100% |#############################################################################################################################################| Time: 0:00:06 NOTE: Executing RunQueue Tasks NOTE: Tasks Summary: Attempted 2 tasks of which 1 didn't need to be rerun and all succeeded. INFO: Copying Images from deploy to images [INFO] successfully built u-boot


# Modify U-Boot Source Code

# U-Boot Source Code Location

cd build/tmp/work/ultra96_zynqmp-xilinx-linux/u-boot-xlnx/

# Modify source code

vi ./git/board/xilinx/zynqmp/zynqmp.c


# Change following line of code

puts("Watchdog: Started\n");

# to (Add By Jimmy)

puts("Watchdog: Started By Jimmy\n");


# In order to rebuild source ode, please run following command:

petalinux-build -c u-boot -x build

# You will see following debug messages:


​petalinux-build -c u-boot -x build

[INFO] building u-boot

[INFO] sourcing bitbake

INFO: bitbake virtual/bootloader -c build Loading cache: 100% |##################################################################################################################################################| Time: 0:00:02 Loaded 3468 entries from dependency cache. Parsing recipes: 100% |################################################################################################################################################| Time: 0:00:04 Parsing of 2577 .bb files complete (2542 cached, 35 parsed). 3469 targets, 133 skipped, 0 masked, 0 errors. NOTE: Resolving any missing task queue dependencies Initialising tasks: 100% |#############################################################################################################################################| Time: 0:00:00 Checking sstate mirror object availability: 100% |#####################################################################################################################| Time: 0:00:00 NOTE: Executing SetScene Tasks NOTE: Executing RunQueue Tasks NOTE: Tasks Summary: Attempted 752 tasks of which 736 didn't need to be rerun and all succeeded. INFO: Copying Images from deploy to images [INFO] successfully built u-boot


It will generate u-boot.elf and u-boot.bin in images/linux folder.

# Delete old BOOT.bin

rm images/linux/BOOT.bin

# Generate new BOOT.bin

petalinux-package --boot --fsbl images/linux/zynqmp_fsbl.elf --fpga images/linux/system.bit --pmufw images/linux/pmufw.elf --u-boot


# You will see following debug messages:


​U-Boot 2018.01 (Apr 12 2022 - 01:35:13 +0000)

Model: Avnet Ultra96 Rev1

Board: Xilinx ZynqMP

I2C: ready

DRAM: 2 GiB

EL Level: EL2

Chip ID: zu3eg

Watchdog: Started By Jimmy

MMC: mmc@ff160000: 0 (SD), mmc@ff170000: 1

New debug message, watchdog: started By Jimmy



# how to load and debug over JTAG

# We need set device board boot switch to 00, which is booting from JTAG

# start xilinx hardware server

/home/jimmy/petalinux/2018.3/peta/tools/xsct/SDK/2018.3/bin/xsct

# you will see following debug message

​****** Xilinx Software Commandline Tool (XSCT) v2018.3

**** SW Build 2390844 on Thu Nov 15 19:17:20 MST 2018

** Copyright 1986-2018 Xilinx, Inc. All Rights Reserved.



xsct%

# run connect command to start hardware server


​xsct% connect

attempting to launch hw_server

****** Xilinx hw_server v2018.3

**** Build date : Nov 15 2018-19:35:59

** Copyright 1986-2018 Xilinx, Inc. All Rights Reserved.


INFO: hw_server application started

INFO: Use Ctrl-C to exit hw_server application


INFO: To connect to this hw_server instance use url: TCP:127.0.0.1:3121


tcfchan#0

xsct%


# Power on the device, and then run following commands

petalinux-boot --jtag --u-boot --hw_server-url TCP:127.0.0.1:3121 -v


# You will see following debug message from host

​petalinux-boot --jtag --u-boot --hw_server-url TCP:127.0.0.1:3121 -v

XSDB Script:

INFO: Launching XSDB for file download and boot.

INFO: This may take a few minutes, depending on the size of your image.


connect -url TCP:127.0.0.1:3121

targets -set -nocase -filter {name =~ "*PSU*"}

mask_write 0xFFCA0038 0x1C0 0x1C0

targets -set -nocase -filter {name =~ "*MicroBlaze PMU*"}

puts stderr "INFO: Downloading ELF file: /home/jimmy/petalinux/2018.3/ultra96v2_oob_2018_3/images/linux/pmufw.elf to the target."

dow "/home/jimmy/petalinux/2018.3/ultra96v2_oob_2018_3/images/linux/pmufw.elf"

after 2000

con

targets -set -nocase -filter {name =~ "*APU*"}

mwr 0xffff0000 0x14000000

mask_write 0xFD1A0104 0x501 0x0

targets -set -nocase -filter {name =~ "*A53*#0"}


source /home/jimmy/petalinux/2018.3/ultra96v2_oob_2018_3/project-spec/hw-description/psu_init.tcl

puts stderr "INFO: Downloading ELF file: /home/jimmy/petalinux/2018.3/ultra96v2_oob_2018_3/images/linux/zynqmp_fsbl.elf to the target."

dow "/home/jimmy/petalinux/2018.3/ultra96v2_oob_2018_3/images/linux/zynqmp_fsbl.elf"

after 2000

con

after 4000; stop; catch {stop}; psu_ps_pl_isolation_removal; psu_ps_pl_reset_config

targets -set -nocase -filter {name =~ "*A53*#0"}

puts stderr "INFO: Downloading ELF file: /home/jimmy/petalinux/2018.3/ultra96v2_oob_2018_3/images/linux/u-boot.elf to the target."

dow "/home/jimmy/petalinux/2018.3/ultra96v2_oob_2018_3/images/linux/u-boot.elf"

after 2000

targets -set -nocase -filter {name =~ "*A53*#0"}

puts stderr "INFO: Downloading ELF file: /home/jimmy/petalinux/2018.3/ultra96v2_oob_2018_3/images/linux/bl31.elf to the target."

dow "/home/jimmy/petalinux/2018.3/ultra96v2_oob_2018_3/images/linux/bl31.elf"

after 2000

con

exit

rlwrap: warning: your $TERM is 'xterm-256color' but rlwrap couldn't find it in the terminfo database. Expect some problems.: Inappropriate ioctl for device

INFO: Downloading ELF file: /home/jimmy/petalinux/2018.3/ultra96v2_oob_2018_3/images/linux/pmufw.elf to the target.

Downloading Program -- /home/jimmy/petalinux/2018.3/ultra96v2_oob_2018_3/images/linux/pmufw.elf

section, .vectors.reset: 0xffdc0000 - 0xffdc0007

section, .vectors.sw_exception: 0xffdc0008 - 0xffdc000f

section, .vectors.interrupt: 0xffdc0010 - 0xffdc0017

section, .vectors.hw_exception: 0xffdc0020 - 0xffdc0027

section, .text: 0xffdc0050 - 0xffdd0527

section, .rodata: 0xffdd0528 - 0xffdd266f

section, .data: 0xffdd2670 - 0xffdd66e7

section, .sdata2: 0xffdd66e8 - 0xffdd66e7

section, .sdata: 0xffdd66e8 - 0xffdd66e7

section, .sbss: 0xffdd66e8 - 0xffdd66e7

section, .bss: 0xffdd6700 - 0xffdda78f

section, .srdata: 0xffdda790 - 0xffddb09f

section, .stack: 0xffddb0a0 - 0xffddc09f

section, .xpbr_serv_ext_tbl: 0xffddf6e0 - 0xffddfadf

100% 0MB 0.2MB/s 00:00

Setting PC to Program Start Address 0xffdcfa7c

Successfully downloaded /home/jimmy/petalinux/2018.3/ultra96v2_oob_2018_3/images/linux/pmufw.elf

INFO: Downloading ELF file: /home/jimmy/petalinux/2018.3/ultra96v2_oob_2018_3/images/linux/zynqmp_fsbl.elf to the target.

Downloading Program -- /home/jimmy/petalinux/2018.3/ultra96v2_oob_2018_3/images/linux/zynqmp_fsbl.elf

section, .text: 0xfffc0000 - 0xfffce13b

section, .init: 0xfffce140 - 0xfffce173

section, .fini: 0xfffce180 - 0xfffce1b3

section, .note.gnu.build-id: 0xfffce1b4 - 0xfffce1d7

section, .rodata: 0xfffce200 - 0xfffce63f

section, .sys_cfg_data: 0xfffce640 - 0xfffcee07

section, .mmu_tbl0: 0xfffcf000 - 0xfffcf00f

section, .mmu_tbl1: 0xfffd0000 - 0xfffd1fff

section, .mmu_tbl2: 0xfffd2000 - 0xfffd5fff

section, .data: 0xfffd6000 - 0xfffd71a7

section, .sbss: 0xfffd71a8 - 0xfffd71bf

section, .bss: 0xfffd71c0 - 0xfffd91bf

section, .heap: 0xfffd91c0 - 0xfffd95bf

section, .stack: 0xfffd95c0 - 0xfffdb5bf

section, .dup_data: 0xfffdb5c0 - 0xfffdc767

section, .handoff_params: 0xfffe9e00 - 0xfffe9e87

section, .bitstream_buffer: 0xffff0040 - 0xfffffc3f

100% 0MB 0.1MB/s 00:00

Setting PC to Program Start Address 0xfffc0000

Successfully downloaded /home/jimmy/petalinux/2018.3/ultra96v2_oob_2018_3/images/linux/zynqmp_fsbl.elf

INFO: Downloading ELF file: /home/jimmy/petalinux/2018.3/ultra96v2_oob_2018_3/images/linux/u-boot.elf to the target.

Downloading Program -- /home/jimmy/petalinux/2018.3/ultra96v2_oob_2018_3/images/linux/u-boot.elf

section, .data: 0x08000000 - 0x0808a567

100% 0MB 0.2MB/s 00:03

Setting PC to Program Start Address 0x08000000

Successfully downloaded /home/jimmy/petalinux/2018.3/ultra96v2_oob_2018_3/images/linux/u-boot.elf

INFO: Downloading ELF file: /home/jimmy/petalinux/2018.3/ultra96v2_oob_2018_3/images/linux/bl31.elf to the target.

Downloading Program -- /home/jimmy/petalinux/2018.3/ultra96v2_oob_2018_3/images/linux/bl31.elf

section, .text: 0xfffea000 - 0xffff1fff

section, .rodata: 0xffff2000 - 0xffff2fff

section, .data: 0xffff3000 - 0xffff6a1f

section, stacks: 0xffff6a40 - 0xffff7b3f

section, .bss: 0xffff7b40 - 0xffff88d3

section, xlat_table: 0xffff9000 - 0xffffdfff

section, coherent_ram: 0xffffe000 - 0xffffefff

100% 0MB 0.2MB/s 00:00

Setting PC to Program Start Address 0xfffea000

Successfully downloaded /home/jimmy/petalinux/2018.3/ultra96v2_oob_2018_3/images/linux/bl31.elf




# You will see following debug message from minicom/hyperterminal


Xilinx Zynq MP First Stage Boot Loader changed by Jimmy

Release 2018.3 Apr 11 2022 - 23:12:08

PMUFW: v1.1

U-Boot 2018.01 (Apr 12 2022 - 01:35:13 +0000)

Model: Avnet Ultra96 Rev1

Board: Xilinx ZynqMP

I2C: ready

DRAM: 2 GiB

EL Level: EL2

Chip ID: zu3eg

Watchdog: Started By Jimmy

MMC: mmc@ff160000: 0 (SD), mmc@ff170000: 1

*** Warning - bad CRC, using default environment


In: serial@ff010000

Out: serial@ff010000

Err: serial@ff010000

Model: Avnet Ultra96 Rev1

Board: Xilinx ZynqMP

Bootmode: JTAG_MODE

Net: Net Initialization Skipped

No ethernet found.

U-BOOT for ultra96v2-oob-2018-3


Hit any key to stop autoboot: 0

Device: mmc@ff160000

Manufacturer ID: 95

OEM: 5355

Name:

Tran Speed: 50000000

Rd Block Len: 512

SD version 3.0

High Capacity: Yes

Capacity: 29.8 GiB

Bus Width: 4-bit

Erase Group Size: 512 Bytes

reading image.ub

9520292 bytes read in 747 ms (12.2 MiB/s)

## Loading kernel from FIT Image at 10000000 ...

Using 'conf-system-top.dtb' configuration




37 views0 comments