Prepare Boot Medium


This how-to describes the process of preparing a medium as boot device. This how-to is focused on Zynq SD and JTAG boot. Depending on your platform other options for boot mediums may be available and SD boot might not be an option. Please refer to the appropriate documentation for use cases beyond the scope of this page.  For details on how to boot the device from different boot devices, refer to Chapter 5 of the Zynq-7000 AP SoC: Concepts, Tools and Techniques (CTT) document.


Table of Contents

SD Boot

Input Files Required

or

Output Files Produced

  • bootable SD card

Task Description

The following instructions are taken from the OMAPPedia wiki.
The following instructions assume a Linux system. Furthermore, most commands require root permissions. After completing this steps the SD card holds two partitions which can be read/written under Linux. Windows can - if at all - only access the FAT partition; but even this seems to depend on the card reader/driver used.

Insert SD card and figure out the corresponding device. The last lines of the dmesg output should tell you under which device file the inserted SD card is available in the system.

Warning: The following commands will use '/dev/sdX' to refer to the SD card device. Replace this with the actual device on your system. Executing the following commands on the wrong device may corrupt your data on other file systems. Also, all data on your SD card will be destroyed.

The fdisk utility does not seem to erase the first few bytes of the first sector in the card when the partition table is saved. Use dd to erase the first sector.

Calculate the new_cylinders value
The output should look similar to this

Look for the size of the device in bytes and calculate the new number of cylinders using the following formula, dropping all fractions:
new_cylinders = <size> / 8225280
For the example output given above, we would write down new_cylinders = 8068792320 / 8225280 = 980

Partition the SD card. We will create two partitions on the SD card. One 200 MB sized boot partition. And a second partition taking the remaining space on the SD card.

The dd command should have wiped all existing partition tables, if this is not the case, delete all existing partitions on the SD card.
Repeat this for all valid partitions numbers.

Now configure the sectors, heads and cylinders of the SD card.

Now the actual partitions can be created

Now, set the bootable flag and partition IDs

Check the new partition table and write the changes

Create file systems on the new partitions

Mount the boot partition

Copy the boot.bin or contents of the release archive to the SD card, e.g.

Unmount the SD card

The SD card can now be removed and transferred over to the target platform.

Configure Boot Mode

To boot from SD card the boot mode pins have to be configured accordingly, as shown in the image below.

zc702 & zc706

SD boot mode switch setting

The picture shows a zc702, but the same switch positions apply to the zc706.

JTAG Boot

Tools Required


Input Files Required

The required input files can be obtained from a provided release or build from source.

Task Description

Configure boot mode
To boot from JTAG the boot mode pins have to be configured accordingly, as shown in the image below.
zc702 & zc706
A zc706 configured for JTAG boot


Additionally the correct JTAG mode has to be selected, according to the used interface. The JTAG mode is controlled by switch SW10 on the zc702 and SW4 on the zc706. The settings are listed in the following table.
JTAG ModeSwitch 0Switch 1
Invalidoffoff
Digilent USB JTAGoffon
Xilinx Platform Cableonoff
20-pin Headeronon
SW4 on a zc706 set to use Digilent USB JTAG


Connect the JTAG debugger to the processor

Download and run the FSBL

Download the Linux image

Download and run U-Boot

This executes U-Boot, which will try booting the system. Interrupt U-Boots automatic boot attempt and boot the system with

Scripting JTAG Boot

The whole process of booting Linux can be done by a simple script for xmd. The only requirement for this is, that the default action U-Boot executes for JTAG boot is executing 'bootm' with addresses matching those from the 'dow -data' commands. To achieve this alignment it might be necessary build a custom U-Boot.
U-Boot's default action for JTAG boot should be

Then a script with the following content would download and boot Linux

The script can be executed in xmd with

QSPI Boot

Tools Required


Input Files Required

The required input files can be obtained from a provided release or build from source.

Task Description

To boot from QSPI a boot.bin must be written to the flash memory. This can happen in various ways, a few examples are given below.

Program the QSPI through zynq_flash Tool

The tool zynq_flash can be used to program the QSPI on Zynq platforms (alternatively the flash can be programmed through other flows, e.g. using U-Boot or Linux). Zynq_flash requires a working JTAG connection to the board.
The correct JTAG mode has to be selected, according to the used interface. The JTAG mode is controlled by switch SW10 on the zc702 and SW4 on the zc706. The settings are listed in the following table.
JTAG ModeSwitch 0Switch 1
Invalidoffoff
Digilent USB JTAGoffon
Xilinx Platform Cableonoff
20-pin Headeronon
SW4 on a zc706 set to use Digilent USB JTAG


Once the JTAG connection is set up, the flash can be programmed by running

Program the QSPI through U-Boot

To use this method, U-Boot must be booted through some way and the boot.bin must reside in DDR memory. From that state the QSPI can be programmed from U-Boot using the following command sequence:

Program the QSPI through Linux

To use this method, Linux must be booted through some way, the boot.bin must reside on the file system and the flashcp utility (part of mtd-utils) must be available. Furthermore, MTD partitions must be defined. The boot image needs to be written to the beginning of the flash memory. The list of partitions can be obtained through
Usually /dev/mtd0 is the partition starting at offset 0.

From that state the QSPI can be programmed from Linux using the following command sequence:

Set Bootmode

After the is programmed the boot mode should be changed to QSPI by setting the boot mode pins accordingly, as shown below for some example platforms.
zc702 & zc706
Boot mode set for QSPI boot on a zc706


After power cycling the board, it will boot from the image in QSPI

Build Steps


Related Links