petalinux installation and basic compilation environment

 

Over the past two months due to work to use the zynq, it took some effort to learn to use petalinux, here to do some recording

1, petalinux environment installation

  According to the official website of the introduction, the required petalinux operating systems have special requirements, other versions of the operating system, try not to use, inexplicable error occurs, not my kind of white can be resolved, and then install the required system above petalinux environment, the specific list can be seen in the face of official documents online, shots are as follows

I installed environment is ubuntu16.04, Ubuntu here, be sure to use 64-bit, the beginning I installed a ubuntu16.4 32-bit, the installation of what is not always the final prompt, and then the installation failed, the former before and after it took a month to understand why other people do not click on the installation was successful, I really failed, until I want to install eclipse, download a 64-bit installation prompts me to fail, I found myself in ubuntu turned out to be 32-bit, tears ah.

Note: ubuntu install disk space requires a minimum of 50G, behind patalinux file a bit big, is also a great after installation, generate project files are large, so make sure enough space

Then install petalinux environment in the ubuntu, use the command

#sudo apt-get install xxxx, the ubuntu software that column all the online installation, there are some online that can teach you how to install all at once up command

After installing, the need to dash into the instruction command Run #sudo dpkg-reconfigure bash, after a pop-up window on the list is selected from the NO

You can install a petalinux, petalinux installation package is a .run, for example, I installed the petalinux-v2017.4-final-installer.run, ubuntu in the path / home / username / folder under the new petalinux, and so all petalinux all relevant documents in this folder.

The following files petalinux-v2017.4-final-installer.run on petalinux, run directly in the path of this

#./petalinux-v2017.4-final-installer.run ./     将patalinux安装在这个文件夹下面,这里需要时间久一点,要检查这个安装包是否完整,系统是否可用,检查完之后就会让你同意一些乱七八糟的协议,依次按下q y enter q y enter q y enter q y enter就可以跳过了,跟据提示来,先是给你显示一堆协议,然后按q退出,然后y同意,enter输入,差不多是这个流程。

下面开始检查你的环境是否安装完整,如果有些和他要求的不一样,他就会安装失败,然后给你生成一个log文件,那你可以直接在终端中看或者看log文件,看完之后按照他的要求接着安装就可以了。这一步应该就能保证你安装完成了。

2、petalinux使用

  在文件夹下面创建一个文件夹project,专门用来放置你的工程文件,现在上一级文件夹,按照我的操作绝对路径应该是/home/username/petalinux/ 下面有一个文件setting.sh,这个文件应该是初始化petalinux和进入petalinux的环境,在终端中运行命令

#source setting.sh

稍等一会会打印一些列信息,说明就进入了petalinux的环境中了

保持这个终端不要关闭,下面的一系列都要在这个终端中执行,如果退出,需要重新source这个.sh文件

执行命令#cd project ,创建一个工程,命令为#petalinux-create --type project --template zynq --name projectname

这个命令中zynq需要根据自己的需求选择,zynq或者zynqMP ,projectname自己命名工程名,这样在你的project文件夹下面就产生一个projectname的文件夹,这就是你的工程文件

获取一个描述硬件的文件XXX.hdf,放在你的工程文件夹下面,执行命令

petalinux-config --get-hw-description=./  ,peatlinux就会根据这个硬件描述文件生成一堆内核和设备文件了,接下来会弹出来一个窗口供你定制化你自己需要的linux系统, 

直接save,exit,稍等一会就成成了linux内核源文件。在路径

/home/username/petalinux/project/test/components/plnx_workspace/device-tree/device-tree下你可以看到设备树信息,根据自己需要修改

然后执行命令

#petalinux-build,根据自己计算机的性能等上半个小时到一个小时不等的时间,patlinux就编译好了,在路径/../image/linux下面就能看到自己编译生成的文件

然后使用打包命令patalinux-package  后面加上打包参数,就可以将自己需要的东西打包进去了

通常打包命令是petalinux-package --boot --fsbl zynqmp_fsbl.elf --u-boot,偶尔也需要将system.bit打包进去

petalinux-package --boot --fsbl zynqmp_fsbl.elf --u-boot --fpga system.bit

 

Guess you like

Origin www.cnblogs.com/xiashuai-future/p/11145140.html