Development with Zynq – Part 3 – Build boot files

This blog series describe the selection, set-up and usage of a development environment for Zynq.

The following instructions use the development environment described in Part 2.

I am not interested in Desktop Linux like Ubuntu support. For  Desktop Linux at least VGA support is needed. Therefore components in Programmable Logic, an adjusted Device Tree and Kernel patches are needed. Link to a good  guide under  yet-another-guide-to-running-linaro-ubuntu-desktop-on-xilinx-zynq-on-the-zedboard

Overview of needed files

For booting from SD Card following files are needed.

  • Boot.bin
    The boot file includes:

    • FSBL
      A file with the first stage boot loader
    • Bitfile
      File with code for the Program Logic
    • U-boot
      Boatloader file to load the Kernel with the device Tree
  • udev.txt
    u-boot Parameter file
  • Kernel
    uImage with the Linux kernel
  • Device Tree
    dtb file with information about hardware system. The file is needed by the kernel
  • Linux distribution
    A second partition with the Linux distribution file system

First Stage Boot Loader

Xilinx SDK use the command gmake not make. A symbolic link is needed to solve this problem.

Now we can start the SDK by double-clicking the icon „Xilinx SDK 2013.2“. Open the „New project“ wizard with „File“=>“New“=>“Application Project“ and use the following settings.

FSBL1

FSBL2

Finish the wizard and select „Project“=>“Build All“ to generate the file  FSBL.elf.

I use the zedboard. For a other platform select the correct „Hardware Platform“. If your platform is missing use the Vivado export function to generate it.

Bitfile

For bitfile generaton Vivado is used. Step-by-step instructions to generate a bitfile without extra logic  can be found under http://zedboard.org/content/creating-base-zynq-design-vivado-ipi-20132.

U-boot

Open a terminal in home folder. Clone the U-boot source with

The U-boot version from Xilinx extract the Linux distribution from a file in RAM and boot it. We want to define the boot options in device tree. Therfore we need a „udev.txt“ file.

I want to work with DMA without usage of a device driver. Therefore I need a free memory block at the end of adress range. The device tree is loaded to memory, too. I reduce the fdt_high value so the device tree is not loaded to the end of memory address range.

The Xilinx U-Boot version is not configured for hard float. I have to change compiler flags for a successful build.

In file u-boot-xlnx/config.mk replace

with

It is necessary to disable the soft float flags. A search with grep -rnw ‚.‘ -e „msoft“ shows the file to change. In file u-boot-xlnx/arch/arm/cpu/armv7/config.mk replace

with

I am not a makefile guru. I am sure that better solutions exists.

All is prepared for build U-boot. We need to expand the PATH variable temporary so that make find the toolchain.

It is possible define path changes permanently by appending /etc/profile with this commands. The available configurations are listed in board.cfg. Open the file or grep lines from interest with

I use the zedboard therefore I define the hardware with

After hardware is configured, we build U-boot with

Rename the result u-boot in e-boot.elf.

Boot.bin

All files needed for boot.bin are generated. We can use the Xilinx SDK to build the file. Select „Xilinx Tools“=>“Create Zynq Boot Image“ and select your files. Press „Create Image“ to buid it.

GenerateBoot_bin

Another way is to use the bootgen without the gui. You can find a desktop script and the for bootgen needed bif file in buildBoot_bin.

Kernel

Open a terminal in home folder. Clone the U-boot source with

Change directory to the new folder linux-xlnx.

Print the PATH variable with command

For building a uImage mkimage is needed. mkimage is part of U-Boot. We need to define the path so make can find it. If the toolchain is not part of the PATH variable anymore insert it again.

The available configs are listed in arch/arm/configs. Vor Zynq I use xilinx_zynq_defconfig.

Now we can build the uImage

The uImage is located in /arch/arm/boot

Device Tree

Examples for device tree files are located under arch/arm/boot/dts in Kernel sources. I use zynq-zed.dts for Zedboard. I want to boot the Linux distribution from a partition. Therefore I change the bootargs to

This change only work with the modified U-boot.

I want to use a part of memory for a DMA without driver support. Therefore I reduce the memory managed by Linux

For booting the dts file have to be converted in a dtb file. The kernel tool dtc is used for that. I write shellscripts for dts to dtb and  back. All files in the defined folder are converted. Download dts_dtb

 

Diskutiere über "Development with Zynq – Part 3 – Build boot files"

  1. eactor sagt:

    Did you notice a difference when using the vfpu for u-boot instead of the soft-float implemtation? And why didn’t you do any changes to the Kernel so it uses the vfpu?
    cheers
    eactor

  2. Prof. Dr. Rüdiger Heintz Prof. Dr. Rüdiger Heintz sagt:

    I seem to recall that I get a kernel panic with mixed soft-float uboot and hard-float kernel.

    I had big problems with soft-float libs on a hard-float linux distribution. Therefore I decide to build a consistent hard-float environment.

    I did not notice a difference. I dare say there is no change in boot time. Benchmarks to compare hard-float and soft-float would be nice, but I have currently no time to generate them.

  3. mackalli sagt:

    hello, I’m using the zedboard, I want to start from SD card,I also modefied the zynq-common.h fdt_high and initrd_high value, but failed. can you give some suggestion for making uboot? thank you!

  4. psimon sagt:

    Hello, I am currently learning embedded linux on zed-boards and find your tutorial very interesting.
    I have a question regarding the „udev.txt“ file you mention here. I do not know where to put it and do not find any mentioning of this file apart from this page. Could it be that you meant the „uEnv.txt“ which is also included in the ./include/configs/zynq-common.h header?

    • Prof. Dr. Rüdiger Heintz Prof. Dr. Rüdiger Heintz sagt:

      Put the udev.txt direct on your sd card. U-boot reads it on startup at execute the commands, so no console input is needed.
      It is very useful. I have different kernels and device tree files on my sd card and in udev.txt I can define which kernel and device tree files are used by u-boot.

  5. Ramachandra sagt:

    Hello,i am currently using zed board, Actually in buildroot tool where i can select the Boot Device options because through JTAG only i am sending images not usind SD card.

  6. Marco sagt:

    Your tutorials have been a great help so far. But which DTS file should I use for the Zedboard? I tried zynq-zed.dts and zynq-zed-adv7511-fmcmotcon1.dts, but neither gave me an ethernet adapter. Thanks for your help.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.