[Zedboard u-boot Linux系统移植]-ZYBO Zync-7000 Development Board Work Booting Linux on the ZYBO

ZYBO Zync-7000 Development Board Work Booting Linux on the ZYBO

本文翻译自:http://www.dbrss.org/zybo/tutorial4.html

本文主要是详细讲解zybo硬件系统搭建,u-bootlinux-kernel移植,linaro文件系统移植。

Introduction

  If you are new to linux I would recommend reading through some of the references at the bottom of the page. For this tutorial I am working on a Linux Ubuntu 14.04 vm. Figure 1 is an important overview of the entire design process and how everything comes together to create the necessary components to boot linux on the Zynq-7000 SoC. The end goal of this tutorial is to cover the steps from the beginning stages all the way to booting a Linaro Linux distribution with a graphical user interface on the ZYBO. At this point the tutorial only covers the stages up to booting to a Linaro root shell.

Things you will need!!

Xilinx Vivado 2014

Xilinx SDK 2014

Digilent’s ZYBO board

Linux-Digilent-Dev master-next branch obtained here.

u-boot-Digilent-Dev master-next branch obtained here.

Step 1: Obtaining necessary files and repositories

I would recommend making a project folder to work from. I am working from zee-bow on the desktop but it is up to you as to where you want to setup. Also create two more folders to put the boot files and root system files as we create them. I named these folders sd_boot and sd_fs.

1) Download the zybo base system from the Digilnets ZYBO product page.

2) Download the Digilent Inc. u-boot-Digilent-Dev and Linux-Digilent-Dev repositories. Make sure to get the master-next branch as these contain the necessary zybo config and dts files. These will be used to create the kernel and u-boot.elf.

Figure 2: Cloning Linux-Digilent-Dev and u-boot-Digilent-Dev into my working folder.

注意:一定要在master-next branch中下载zybo相应的配置文件,u-boot和kernel默认不包含这些文件的

Step 2: Compiling U-Boot

In order to compile the U-Boot and later the kernel we need to set up the tools and extend the $PATH environment variable to find the tools. I would recommend moving the first two exports and the source into your .bashrc so you don’t have to set them again after closing the terminal.

Figure 3: Setting up the tools and the $PATH environment variable

The next step is to configure and compile the U-Boot. Navigate to the u-boot-Digilent-Dev folder in the terminal. before compiling the u-boot we need to change the zynq_zybo.h file to prevent the u-boot from loading the ramdisk. Instead we want it to pass to the root filesystem.

Figure 4: Configure and building U-Boot for ZYBO.

Now lets compile the u-boot. Run make with the specific board zynq_zybo_config file and then run make and the execute and link u-boot should compile.

Figure 5: Configure and building U-Boot for ZYBO.

If you get an error during this step your $PATH environment variable most likely can not find the tools necessary to compile the u-boot. If the u-boot compiled correctly you should see a u-boot in the top level of the u-boot-Digilent-Dev folder. Lets move this to the sd_boot folder and add an elf extenstion. This will be used to generate the BOOT.bin in the following step.

Figure 6: Adding the elf extension to U-Boot.

Step 3: Building the base design

Now on to the base design. Open your chosen version of Vivado, I am working with Vivado 2014.4 and the corresponding SDK. Open the base design project under zybo_base_system/source/vivado/hw/zybo_bsd/zybo_bsd.xpr. If you are using the version that the base design was created with then this next part does not pertain to you and you can go ahead and generate the bitstream. If you are not using the version that it was created on then you will be prompted with an Older Project Version warning and an option to automatically upgrade to the current version. Select okay to automatically upgrade. A second warning will apear saying Vivado no longer uses ‘work’, select okay. The third warning is notify you that some Xilinx IP’s have undergone changes in this version of Vivado, select report ip status. Select the Upgrade Selected at the bottom of the design tool. It will ask if you wish to proceed, select ok.

Figure 7: Upgrading IPs in Vivado 2014.4.

The tool will notify you that there were six critical warning messages, select ok. These will not cause an issue with the system. The next step is to generate the bitstream. There are no implementations available so the tool will ask to launch synthesis and implementation before generating the bitstream, select yes. There will be warnings that appear during the sysnthesis and implementation, select ok do not worry about those for now. I would recommend reading up on some of the references as this may take some time depending on the processing power of your computer. Once the tool has finished you will need to export hardware.

Figure 8: Exporting hardware for SDK.

Include the bitstream when exporting the hardware and then launch the SDK

Figure 9: Include Bitstream when exporting hardware.

Step 4: First Stage Boot Loader

Once the SDK loads create a new application project. Make sure the hardware platform has selected the hardware you previously exported from Vivado. Select C and standalone for the target software language and OS platform. Name the project fsbl and select next.

Figure 10: New application project specification

Now we will need to modify the fsbl_hooks.c file and set the mac address. Locate the ZYBO specific fsbl_hooks.c file in the zybo_base_system/source/vivado/SDK/fsbl folder and replace the one that was generated in the SDK fsbl project. Once you have replaced the fsbl_hooks clean and build the project. This will generate the fsbl.elf used to create the BOOT.bin in the next step.

Step 5: Building BOOT.bin

Select create Zynq Boot image under the Xilinx Tools tab. We need to add, in order, the fsbl.elf, system_wrapper.bit, and the u-boot.elf in order to create the BOOT.bin. The fsbl can be found in the zybo_base_system/source/vivado/hw/zybo_bsd/zybo_bsd.sdk/fsbl/debug folder. The system_wrapper.bit can be found in the zybo_base_system/source/vivado/hw/zybo_bsd/zybo_bsd.sdk/system_wrapper_hw_platform_0 folder. In an earlier step we moved the u-boot.elf into a the sd_boot folder. Next specify the output path where you want the BOOT.bin to be generated.

Figure 11: Generating BOOT.bin.

Step 6: Building the Linux kernel

The next step is to build the Linux kernel. Navigate to the Linux-Digilent-Dev folder we downloaded earlier. Now we are ready to compile the kernel. Make sure to run make on the xilinx_zynq_defconfig file to set up the configurations for the zynq chip before compiling the kernel.

Figure 12: Uncompressing the zImage kernel image.

Step 7: Generating the Device Tree Blob

Before we generate the device tree blob we need to make some slight adjustments to the zynq_zybo.dts file found Linux-Digilent_dev/arch/arm/boot/dts. Particularly line 44, 53, and 62. changing the clock prevented an error that occured after booting up to the root shell.

Figure 13: Modifying the zynq_zybo.dts.

Now we are ready to generate the dtb file. After this is complete copy it into the sd_boot folder and rename it devicetree.dtb.

Figure 14: Modifying the zynq_zybo.dts.

Step 8: Partitioning your Secure Digital card

There are a couple of ways to do this, the easier way is to use Gparted. A second way is to use the command line tool fdisk. If you do not have gparted it is fairly easy to download and install. Type sudo apt-get install gparted to install it and sudo gparted to run it. Once you have it install plug in your SD card and select it from the drop down window in the top left. If you have any information on the SD card make sure to back it up otherwise select the partition tab and unmount the partition then select and delete the partition. Select the check mark that appears, confirming you wish to delete the partition. Create two new partitions, the first with a beginning offset of 4 MiB. The first partition should be FAT32 and be 1 GiB, the second partition should be ext4 and can take the remaining space.

Figure 15: Partitioning the boot SD card.

Step 9: Obtaining the Linaro file system

Download the Linaro file system tar ball from here. We are interested in the last one in the list. Extract the contents and cd into binary/boot/filesystem.dir. Now we need to sync the contents of this folder with the ROOT_FS partition we just created.

Figure 16: Syncing the Linaro root file system with the ROOT_FS partition on the SD card.

Step 10: Booting the ZYBO

Now we need to put BOOT.bin, devicetree.dtb, and uImage onto the FAT32 boot partition. I would recommend creating a temporary folder, mounting the boot partition to that folder, and then using rsync to copy the files over. Once the files are on the correct partition eject the SD card and put it into your ZYBO. Make sure the JP5 jumper is set to SD and JP7 is set to wall. You can boot it from the usb but I would recommend using the wall to power the board. Connect to a uart port terminal, I use GtkTerm to connect to the hardware. It is available in the Ubuntu Software Center, when running it make sure to use sudo as it will need permission to connect to the usb port. Power on the ZYBO and then in the serial port terminal set the configuration to the port where the ZYBO is connected and set the baud rate to 11500, everything else should stay as defualt.

Figure 17: Booting from SD on the ZYBO to the Linaro root shell.

References

[1] Xilinx Getting Started Wiki

[2] Digilent Embedded Linux Hands-on Tutorial for the ZYBO

[3] What-is-Linux

[4] Device Tree Wiki

[5] Initrd Wiki

时间: 2024-10-29 11:03:31

[Zedboard u-boot Linux系统移植]-ZYBO Zync-7000 Development Board Work Booting Linux on the ZYBO的相关文章

linux系统移植和根文件系统制作

1.1 Linux内核基础知识 在动手进行Linux内核移植之前,非常有必要对Linux内核进行一定的了解,下面从Linux内核的版本和分类说起. 1.1.1  Linux版本 Linux内核的版本号可以从源代码的顶层目录下的Makefile中看到,比如2.6.29.1内核的Makefile中: VERSION = 2 PATCHLEVEL = 6 SUBLEVEL = 29 EXTRAVERSION = .1 其中的“VERSION”和“PATCHLEVEL”组成主版本号,比如2.4.2.5.

嵌入式 Linux 系统移植——BSP分析

嵌入式 Linux 系统移植--BSP分析 一.BSP简介 嵌入式系统由硬件环境.嵌入式操作系统和应用程序组成,硬件环境是操作系统和应用程序运行的硬件平台,它随应用的不同而有不同的要求.硬件平台的多样性是嵌入式系统的主要特点,如何使嵌入式操作系统在不同的硬件平台上有效地运行,是嵌入式系统开发中需要解决的关键问题.解决的方法是在硬件平台和操作系统之间提供硬件相关层来屏蔽这些硬件的差异,给操作系统提供统一的运行环境,硬件相关层就是嵌入式系统中的板级支持包 BSP(Board Support Pack

(一)Linux系统移植之环境搭建

Linux系统移植 环境搭建 交叉编译工具链:为了编译.链接.处理和调试跨平台体系结构的程序代码.配置的步骤: 解压到/usr/local/arm目录下,执行命令"tar -xvf arm-2014.05-29-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 -C /usr/local/arm" 配置系统环境变量,把解压的交叉编译工具链的路径添加到环境变量PATH中,在~/.bashrc中添加一行" export PATH=$

linux系统移植流程

linux系统移植流程   "Ctrl" + "+" :放大:"Ctrl" + "-" :缩小:"Ctrl" + "0" :原始大小. linux系统移植流程,布布扣,bubuko.com

MiniCRT 64位 linux 系统移植记录:64位gcc的几点注意

32位未修改源码与修改版的代码下载: git clone git@github.com:youzhonghui/MiniCRT.git MiniCRT 64位 linux 系统移植记录 MiniCRT是<程序员的自我修养:链接,转载于库>的作者俞甲子写的小型的C运行时库.里面提供了printf,malloc,free,fopen等比较常用的函数实现. 之所以要捣鼓这个东西,是因为要自己写一个链接器,链接标准库的时候出了麻烦,一些符号在整个libc中都找不到定义,标准库又太大,研究源码,翻文档都

嵌入式linux系统移植开发视频教程

深入浅出嵌入式linux系统移植开发(环境搭建.uboot的移植.嵌入式内核的配置与编译) 课程讲师:韩老师 课程分类:Linux 适合人群:中级 课时数量:56课时 用到技术:嵌入式Linux开发模式 涉及项目:基于tftp烧写系统 咨询qq:1840215592 课程介绍: 本课程重点是给大家讲解嵌入式linux系统移植的开发方法,采用理论与实践,硬件与软件相结合的方法. 1.在每节开始之前先简单回顾上一节所讲的主要内容,并对本节所讲的内容先进行概述,讲解概念.技术要点,设计实现思路等内容,

【课程分享】深入浅出嵌入式linux系统移植开发 (环境搭建、uboot的移植、嵌入式内核的配置与编译)

深入浅出嵌入式linux系统移植开发 (环境搭建.uboot的移植.嵌入式内核的配置与编译) 亲爱的网友,我这里有套课程想和大家分享,如果对这个课程有兴趣的,可以加我的QQ2059055336和我联系. 课程内容简介 本课程重点是给大家讲解嵌入式linux系统移植的开发方法,采用理论与实践,硬件与软件相结合的方法. 1.在每节开始之前先简单回顾上一节所讲的主要内容,并对本节所讲的内容先进行概述,讲解概念.技术要点,设计实现思路等内容,最后总结本次课程的要掌握的要点. 2.在讲课的过程中对关键技术

Beaglebone开发板的linux系统移植

我是第一次接触嵌入式系统移植,说下我的学习历程吧.百度了很多beaglebone的资料后大概地了解了beaglebone的参数,交叉编译工具链,以及buildroot系统的移植等信息.这个buildroot系统真是...不知怎么形容了,下载耗费了好长时间,不过学到了很多.其实beaglebone很方便,系统那些全部都在microSD card上,拔插了好多遍.花了两三个星期百度.学习以上信息后基础的知识大概学到了.当然最后移植的系统千万不要用buildroot,还是用ubuntu方便点.下面附上

Linux系统裁减之,制作一个极度精简的Linux-用脚本实现自动拷贝命令和依赖库文件

第2章 用脚本实现自动拷贝命令和依赖库文件 这篇文章主要是对我上一篇博文http://blog.51cto.com/linuxprince/2045703加以完善的,前一篇文章中拷贝命令和依赖库文件的过程是完全手工方式的,显得特别LOW,这章把该过程完善一下,用脚本方式实现. 2.1命令具体实现方法 创建脚本文件bincp.sh输入一下内容: #!/bin/bash # DESPATH=/mnt/sysroot libcp() { LIBPATH=${1%/*} [ ! -d $LIBPATH