ZYNQ Linux Linaro System image making SD card boot

Source: Internet
Author: User
Tags reserved git clone vivado

ZYNQ Linux Linaro System image made SD card boot 0. Overview

Zynq generated uboot and normal arm device is not the same, Zynq belongs to two secondary boot uboot and then by the Uboot boot the kernel, probably means that there is a mechanism inside the ZYNQ, the mechanism can not be modified by the dial switch to control the startup mode, For example, starting from an SD card or booting from QSPI, the SD card should contain uboot image information. The biggest difference is that Uboot is not ready to be used directly, but also needs to use vivado Design pl, and then use the SDK to synthesize the uboot and design pl files, and then copy the resulting files to the SD card and start them.

I will not FPGA, this article also only outlines on Linux side, SD card How to do, how to make a brand-new Linux system.

Image files Boot.bin generally include: Fsbl,bitstream and SSBL These three files, wherein bitstream is the configuration PL terminal program, is optional, we do not need when we make the Linaro system. FSBL is the first stage boot loader, which requires the use of the Vivado environment, SSBL is second stage boot loader, which uses the u-boot provided by Xilinx Corporation.

From references 1

1. Environment and Materials 1.1 development environment
    • Software Environment: Vivado 2017.02 Linux version

    • System environment: Ubuntu 16.04 AMD64

    • Cross compiler: GCC-LINARO-7.3-2018.05.TAR.XZ

      My cross-compilation environment is under/opt/toolschain/linaro/bin/arm-linux-gnueabihf-, I like to specify the absolute compiler path when I compile

1.2 Preparation Materials
    • Arm-side Linux kernel Source: https://github.com/Xilinx/linux-xlnx
    • Arm end of the uboot source code: HTTPS://GITHUB.COM/XILINX/U-BOOT-XLNX
    • Arm-side Linaro file system: https://releases.linaro.org/archive/12.07/ubuntu/precise-images/ubuntu-desktop/ Linaro-precise-ubuntu-desktop-20120723-305.tar.gz (I'm using Ubuntu 12.07)
2. Making uboot2.1 compilation Uboot
    • Get Xilinx's Uboot source code:git clone https://github.com/Xilinx/u-boot-xlnx.git

    • Clear compile:make CROSS_COMPILE=/opt/toolschain/linaro/bin/arm-linux-gnueabihf- ARCH=arm clean

    • Configure Board Level information: make CROSS_COMPILE=/opt/toolschain/linaro/bin/arm-linux-gnueabihf- ARCH=arm zynq_zc702_defconfig board level information in the location, my is zc701 board, but no, I choose one and this closest.

    • Menuconfig Write configuration information:make CROSS_COMPILE=/opt/toolschain/linaro/bin/arm-linux-gnueabihf- ARCH=arm menuconfig

    • Compile Uboot:make CROSS_COMPILE=/opt/toolschain/linaro/bin/arm-linux-gnueabihf- ARCH=arm -j8

    • The Uboot is produced after successful compilation, so you need to rename the Uboot:mv uboot uboot.elf

After getting the uboot.elf, the Uboot.elf file is required to retain the backup and then synthesize the final boot program.

2.2 FSBL, bit file production

The general process is to create a new project with Vivado, then add the IP design, configure the clock, configure some basic peripherals (SD card, serial, Ethernet, etc.) required by Linux, and use wrap The HDL feature generates a top-level design. v file, and then compiles a. v file to generate a. bit file, generate a hardware profile, Launch SDK software, automatically generates a project, compiles and gets the FSBL file.

The specific process a lot of Bo friends have written very clearly, I posted a better speaking, you can follow this method: in the future of multi-core communication mechanism, PS and PL Communication, then the PL file is so designed and then we re-synthesize uboot file.

78643258

We get the bit file generated by the Vivado compilation in this way, and we have built the project in the SDK, generated a hardware platform, and then we get the FSBL file. The FSBL file needs to build a FSBL project in the SDK and is based on the hardware platform that we just built.

After the establishment of the direct compilation, you can get the FSBL file.

To the current position, got:

    • Vivado compile-generated: bit file
    • SDK generated: FSBL file
    • Just compiled Uboot generated by: Uboot.elf file

You can start synthesizing boot.bin files.

2.3 Synthetic Boot.bin

This operation is still done in the SDK software.

Using the Create Boot image feature:

This completes the synthesis of the boot.bin.

2.4 File permissions (Linux development users only)

There is a very important thing, I tried many times, ZYNQ platform is not to start, Uboot also do not output any information. This little question stuck with me for a long time, but when I washed it this morning, it occurred to me that Xilinx Vivado and the SDK were started in root, and that generating boot.bin might also have permissions issues. So....

I get the board, and then in the SD card, given sudo chmod 777 BOOT.bin then eject SD card, put SD on Zynq, incredibly successfully started. If you are under a Linux system, do not forget to give Boot.bin permissions.

3 Linux kernel build 3.1 Linux kernel compiles uimage files
    • Get the Linux kernel:git clone https://github.com/Xilinx/linux-xlnx.git
    • Switch to the Linux kernel source directory and start cleaning the kernel:make CROSS_COMPILE=/opt/toolschain/linaro/bin/arm-linux-gnueabihf- ARCH=arm clean
    • To configure board-level information:make CROSS_COMPILE=/opt/toolschain/linaro/bin/arm-linux-gnueabihf- ARCH=arm xilinx_zynq_defconfig
    • Write a. config file using Menuconfig: make CROSS_COMPILE=/opt/toolschain/linaro/bin/arm-linux-gnueabihf- ARCH=arm menuconfig exit after entering.
    • Compile kernel:make CROSS_COMPILE=/opt/toolschain/linaro/bin/arm-linux-gnueabihf- ARCH=arm -j8
    • Make Uimage file:make CROSS_COMPILE=/opt/toolschain/linaro/bin/arm-linux-gnueabihf- ARCH=arm uImage LOADADDR=0x00008000
    • After the compilation is complete, the Uimage file in Linux-xlnx/arch/arm/boot is reserved.
3.2 Making a device tree file

Create a new Zynq-7010.dts file within the Linux-xlnx/arch/arm/boot/dts directory with the contents of the file:

 /dts-v1/;/include/"Zynq-7000.dtsi"/{model = "HLF";    compatible = "Alinx,zynq", "xlnx,zynq-7000";        aliases {ethernet0 = &gem0;        Serial0 = &uart1;        Spi0 = &qspi;    MMC0 = &sdhci0;    }; [Email protected]        {device_type = "memory";    Reg = <0x0 0x20000000>;    };        chosen {Bootargs = "";    Stdout-path = "SERIAL0:115200N8";    };        usb_phy0:phy0 {compatible = "usb-nop-xceiv";        #phy-cells = <0>;    Reset-gpios = <&gpio0 1>; };}; &CLKC {ps-clk-frequency = <50000000>;};    &gem0 {status = "okay";    Phy-mode = "Rgmii-id";    Phy-handle = <&ethernet_phy>;    Ethernet_phy: [email protected] {reg = <0>; };};    &QSPI {u-boot,dm-pre-reloc; Status = "Okay";};  

Switch to the main directory of the kernel:./scripts/dtc/dtc -I dts -O dtb -o ./arch/arm/boot/devicetree.dtb ./arch/arm/boot/dts/zynq-7010.dts

The Devicetree.dtb file can then be found in the linux-xlnx/arch/arm/boot/directory, as well as reserved.

3.3 Boot Profile Authoring UEnv.txt

Just find a place. To create a new uEnv.txt file, write the boot configuration information in the file:

uenvcmd=run linaro_sdbootlinaro_sdboot=echo Copying Linux from SD to RAM... && fatload mmc 0 0x3000000 ${kernel_image} && fatload mmc 0 0x2A00000 ${devicetree_image} && if fatload mmc 0 0x2000000 ${ramdisk_image}; then bootm 0x3000000 0x2000000 0x2A00000; else bootm 0x3000000 - 0x2A00000; fibootargs=console=ttyPS0,115200 root=/dev/mmcblk0p2 rw earlyprintk rootfstype=ext4 rootwait

Save and keep the spare.

4 SD Card Production

Prepare a blank SD card with more than 8G, reader read the card, we use the Linux system to format , Windows users can be Diskgen and other formatted partition software production.

    • View SD card Format partition: sudo fdisk -l If you see the SD card is/DEV/SDE partition, (Do not format wrong, when I was young I used to format the entire hard disk, very dangerous operation, see whether the/dev/sd* behind is C or D or E or f).
    • Go to partition management:sudo fdisk /dev/sde

    • The following steps follow this OMAPL138 to make an SD card boot disk and reload the Linux system, my blog. Note that the difference is that the size of the boot partition we set up is 100M, and the type of partition that created boot is also Linux.

    • Then format the boot partition:sudo mkfs.vfat -F 32 -n "boot" /dev/sde1

    • To format the ROOTFS partition:sudo mkfs.ext4 -L "rootfs" /dev/sde2

      Here we have completed the SD card production.

5 Burn write SD boot card
    • boot partition for SD card: Use the command to copy boot.bin/devicetree.dtb/uimage/uenv.txt four files to the boot partition.

    • Unzip the Linaro file system: In the first chapter write the arm side of the Linaro file system: Linaro-precise-ubuntu-desktop-20120723-305.tar.gz extract the root partition into the SD card

      sudo tar --strip-components=3 -C /media/delvis/rootfs -xzpf linaro-precise-ubuntu-desktop-20120723-305.tar.gz binary/boot/filesystem.dir

    • It is best to find a reader with knowledge lights, the decompression command is finished, does not mean that the SD card is written, if there is a light, the LED does not blink after the SD card.

To this, a complete Linaro system is written to the SD card, the FPGA Board boot dial switch to the SD card boot location, you can see the Linaro system started.

Reference documents:

[1] long_fly, Zynq run System series (i) traditional way of porting Linux, November 28, 2017

[2] Iococca, Zedboard on Run Linaro System (II): Generated Boot.bin, July 26, 2016

[3] Take you high, 03-ZYNQ study (start) of the process of curing, May 22, 2018

ZYNQ Linux Linaro System image making SD card boot

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.