{"id":15132,"date":"2016-09-26T10:31:05","date_gmt":"2016-09-26T17:31:05","guid":{"rendered":"https:\/\/blog.digilentinc.com\/?p=15132"},"modified":"2025-01-30T15:08:11","modified_gmt":"2025-01-30T23:08:11","slug":"my-embedded-linux-adventure-intro-to-petalinux","status":"publish","type":"post","link":"https:\/\/digilent.com\/blog\/my-embedded-linux-adventure-intro-to-petalinux\/","title":{"rendered":"My Embedded Linux Adventure &#8211; Intro to PetaLinux"},"content":{"rendered":"<p>This installment of the Embedded Linux Adventure has come a bit later than I would have liked. However in the meantime, I have traversed quite a bit of new material regarding embedded Linux development. A significant portion of the time since our<a href=\"https:\/\/digilent.com\/blog\/my-embedded-linux-adventure-intro\/\" target=\"_blank\" rel=\"noopener\"> intro to the embedded Linux adventure<\/a> has been dedicated to exploring the <a href=\"http:\/\/www.xilinx.com\/products\/design-tools\/embedded-software\/petalinux-sdk.html\">PetaLinux<\/a> tools and design flow needed for\u00a0building and deploying custom embedded Linux (EL) solutions onto Xilinx hardware. This post will primarily be a short instruction set to get you started with PetaLinux and introduce you to some of the documentation that is available. So let\u2019s start first by addressing the big question: What is PetaLinux?<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-16891 aligncenter\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/blog-600x95.jpg\" alt=\"blog\" width=\"600\" height=\"95\" data-wp-pid=\"16891\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/blog-600x95.jpg 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/blog.jpg 620w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>The short answer is that <a href=\"https:\/\/digilent.com\/reference\/software\/petalinux\" target=\"_blank\" rel=\"noopener\">PetaLinux<\/a> is a set of software tools that allows for streamlined embedded Linux development. The long answer is that the name PetaLinux actually refers to an individual software package, however it is not a standalone embedded Linux\u00a0development solution. The workflow for PetaLinux consists of multiple stages in which it relies on other Xilinx software like Vivado and Xilinx SDK.<\/p>\n<p>Browsing the Xilinx documentation for PetaLinux (of which there is a lot, see the links at the end) reveals a few important things. For instance, while Xilinx provides tool for multiple operating systems, the PetaLinux tools are designed for Linux usage only. Specific Linux-supported distros include Red Hat Enterprise (6.6, 6.7, 7.1, 7.2), CentOS (7.1), SUSE (12), and Ubuntu 14.04.<\/p>\n<p>All the typical expectations of required system specifications are mentioned (decent processor ~2GHz, 4GB RAM), however one thing I need to mention is available storage space. You will need a lot. The minimum recommended space is 20GB free, but I used nearly twice that when developing an embedded Linux\u00a0build for the <a href=\"https:\/\/digilent.com\/shop\/zybo-zynq-7000-arm-fpga-soc-trainer-board\/\">Zybo<\/a>\u00a0my first time around\u00a0(side note, if your interested in getting started with embedded Linux on the Zybo check out this <a href=\"http:\/\/www.instructables.com\/id\/Embedded-Linux-Tutorial-Zybo\/\">Instructable<\/a> and this <a href=\"https:\/\/digilent.com\/blog\/hands-on-online-embedded-linux-training-for-zybo\/\" target=\"_blank\" rel=\"noopener\">hands-on online course for Zybo<\/a> to get started)!<\/p>\n<p>As far as storage goes, your experience may be different but just prepare for massive usage. The last thing you want is to be nearly done with your project and run into road blocks due to a lack of storage space.<\/p>\n<p>Now that we have the introduction out of the way, let\u2019s talk about getting started with PetaLinux and embedded Linux\u00a0development.<\/p>\n<figure id=\"attachment_15162\" aria-describedby=\"caption-attachment-15162\" style=\"width: 600px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-15162 size-medium\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/PLpost1.1-600x453.png\" alt=\"PLpost1.1\" width=\"600\" height=\"453\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/PLpost1.1-600x453.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/PLpost1.1.png 700w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><figcaption id=\"caption-attachment-15162\" class=\"wp-caption-text\">PetaLinux Installer Xilinx Download Page<\/figcaption><\/figure>\n<p>Getting started with PetaLinux is fairly straightforward, though it involves a lot of download and install time. Assuming you already have a version of Vivado and SDK installed (if not, get them <a href=\"http:\/\/www.xilinx.com\/support\/download.html\">here<\/a>), you will need to download the <a href=\"http:\/\/www.xilinx.com\/support\/download\/index.html\/content\/xilinx\/en\/downloadNav\/embedded-design-tools.html\">PetaLinux installer<\/a> of the same version number. The download is over 5GB (between the installer and the final download), so start it, and then go make a sandwich and watch a couple episodes of a show you like; unless you have a blazing fast connection, it will take a while.<\/p>\n<p>The directory you install it into is not of tremendous consequence. Just cd into the directory the installer is located and run petalinux-v20XX.X-final-installer.run (the Xs are whatever version number you downloaded), indicating the directory you wish to install it into.<\/p>\n<figure id=\"attachment_15161\" aria-describedby=\"caption-attachment-15161\" style=\"width: 600px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-15161 size-medium\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/PLpost6.1-600x335.png\" alt=\"PLpost6.1\" width=\"600\" height=\"335\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/PLpost6.1-600x335.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/PLpost6.1-768x428.png 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/PLpost6.1-800x446.png 800w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/PLpost6.1.png 913w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><figcaption id=\"caption-attachment-15161\" class=\"wp-caption-text\">Running the PetaLinux Installer<\/figcaption><\/figure>\n<p>PetaLinux uses the same licensing tools as other Xilinx software, so if you already have your other tools licensed then you should not have any issues. If you do, there are additional\u00a0resources for that. Once the install is complete, you will need to download a few other development libraries, including some 32-bit compatible libraries (even if you already have the 64 bit versions of the same), since some parts of the toolchain are 32-bit executables.<\/p>\n<p>A complete table of all the additional downloads is provided in the PetaLinux Reference Guide (<a href=\"http:\/\/www.xilinx.com\/support\/documentation\/sw_manuals\/xilinx2016_2\/ug1144-petalinux-tools-reference-guide.pdf\">UG1144<\/a>) on page 10 (also linked at the end of the post). I am leaving the whole thing out since it is quite long, but here is a screenshot of what I installed in line.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-15167\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/PLpost10.1-600x49.png\" alt=\"PLpost10.1\" width=\"600\" height=\"49\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/PLpost10.1-600x49.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/PLpost10.1.png 700w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>Once all the installs have been completed, you can set up your tools and create a PetaLinux project directory. \u00a0The required\u00a0shell for running PetaLinux is \u2018Bash.\u2019 If you have it installed but it is not your default terminal, you can run \u2018sudo dpkg-reconfigure dash\u2019 and select \u2018No\u2019 when asked if you would like to use Dash as your default shell. Subsequently, you will need to source the PetaLinux, and possibly the Vivado tool settings within the terminal environment you are using. You can do this by typing in the two following commands:<\/p>\n<p><em>source \/your\/PetaLinux\/Install\/Path\/settings.sh<\/em><\/p>\n<p><em>source \/your\/Vivado\/Install\/Path\/settings64.sh<\/em><\/p>\n<p>Alternatively, you can add the two commands to the .bashrc file, which will run those commands and make the tool settings available to you any time you open a new terminal. The screenshots below show the modifications I made.<\/p>\n<figure id=\"attachment_15163\" aria-describedby=\"caption-attachment-15163\" style=\"width: 600px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-15163 size-medium\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/PLpost8.1-600x550.png\" alt=\"PLpost8.1\" width=\"600\" height=\"550\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/PLpost8.1-600x550.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/PLpost8.1-768x704.png 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/PLpost8.1.png 797w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><figcaption id=\"caption-attachment-15163\" class=\"wp-caption-text\">Modify bash.bashrc to source PetaLinux and Vivado tools<\/figcaption><\/figure>\n<p>Once this is done, change to the directory you want to create your project in and run the command shown in the screenshot below.<\/p>\n<figure id=\"attachment_15164\" aria-describedby=\"caption-attachment-15164\" style=\"width: 600px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-15164 size-medium\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/PLpost9.1-600x83.png\" alt=\"PLpost9.1\" width=\"600\" height=\"83\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/PLpost9.1-600x83.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/PLpost9.1.png 700w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><figcaption id=\"caption-attachment-15164\" class=\"wp-caption-text\">Create your project directory<\/figcaption><\/figure>\n<p>For specific\u00a0options, &#8211;type should just be project, &#8211;template will depend on the platform you are targeting (i.e. a Microblaze design, a Zynq chip or Zynq UltraScale), and the \u2013-name will be whatever you want to call it.<\/p>\n<p>So, now we have installed PetaLinux and created a directory in which we can develop our embedded Linux\u00a0project. In the next post I will go over the steps of configuring and building a project from a board support package (BSP), and adding a custom application into your Linux image.<\/p>\n<p>Here are some additional links to PetaLinux support materials!<\/p>\n<ul>\n<li><a href=\"http:\/\/www.xilinx.com\/support\/documentation\/sw_manuals\/xilinx2016_2\/ug1144-petalinux-tools-reference-guide.pdf\">PetaLinux Tools Reference Guide<\/a><\/li>\n<li><a href=\"http:\/\/www.xilinx.com\/support\/documentation\/sw_manuals\/xilinx2016_2\/ug1156-petalinux-tools-workflow-tutorial.pdf\">PetaLinux Tools Workflow Tutorial<\/a><\/li>\n<li><a href=\"http:\/\/www.wiki.xilinx.com\/PetaLinux+Getting+Started\">Xilinx PetaLinux Getting Started Wiki<\/a><\/li>\n<li><a href=\"https:\/\/digilent.com\/reference\/zybo\/zybo\">Zybo Reference page<\/a> (the board I am using)<\/li>\n<\/ul>\n<p>The above can be reproduced on\u00a0the <a href=\"https:\/\/digilent.com\/shop\/genesys-zu-zynq-ultrascale-mpsoc-development-board\/\">Genesys ZU<\/a>, <a href=\"https:\/\/digilent.com\/shop\/arty-z7-zynq-7000-soc-development-board\/\">Arty Z7<\/a>, <a href=\"https:\/\/digilent.com\/shop\/cora-z7-zynq-7000-single-core-for-arm-fpga-soc-development\/\">Cora Z7<\/a>, <a href=\"https:\/\/digilent.com\/shop\/eclypse-z7-zynq-7000-soc-development-board-with-syzygy-compatible-expansion\/\">Eclypse Z7<\/a>, and <a href=\"https:\/\/digilent.com\/shop\/zybo-z7-zynq-7000-arm-fpga-soc-development-board\/\">Zybo Z7<\/a>. Check out my full PetaLinux <a href=\"http:\/\/www.instructables.com\/id\/Getting-Started-With-PetaLinux\/\">Instructable<\/a> for more information and getting started tips!<\/p>\n<p>To read further in my embedded Linux adventure, check out our post on <a href=\"https:\/\/digilent.com\/blog\/my-embedded-linux-adventure-zybo-gsg-and-the-zynq-book\/\" target=\"_blank\" rel=\"noopener\">Zybo GSG and the Zynq Book<\/a>!<\/p>\n<div class='watch-action'><div class='watch-position align-left'><div class='action-like'><a class='lbg-style6 like-15132 jlk' data-task='like' data-post_id='15132' data-nonce='63a029a1fc' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Like' \/><span class='lc-15132 lc'>+4<\/span><\/a><\/div><div class='action-unlike'><a class='unlbg-style6 unlike-15132 jlk' data-task='unlike' data-post_id='15132' data-nonce='63a029a1fc' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Unlike' \/><span class='unlc-15132 unlc'>0<\/span><\/a><\/div><\/div> <div class='status-15132 status align-left'><\/div><\/div><div class='wti-clear'><\/div>","protected":false},"excerpt":{"rendered":"<p>Nate continues with his Linux journey with PetaLinux! <\/p>\n","protected":false},"author":34,"featured_media":15174,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35,1563],"tags":[],"ppma_author":[4486],"class_list":["post-15132","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-fpga","category-guide"],"jetpack_featured_media_url":"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/southpark_cc.jpg","authors":[{"term_id":4486,"user_id":34,"is_guest":0,"slug":"naeastland","display_name":"Nate Eastland","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/7de23bbc8005955a986e67e7e4d633a7?s=96&d=mm&r=g","author_category":"","user_url":"","last_name":"Eastland","last_name_2":"","first_name":"Nate","first_name_2":"","job_title":"","description":"I am currently a student at Washington State University studying Electrical Engineering. I am originally from Southern California but I have spent most of my life in the Seattle area. Growing up I was always deeply \r\ninterested in the pure sciences like chemistry and physics. Throughout high school I began to look for ways that I could apply the theory I had learned. I chose to pursue engineering so that my interest in applied sciences could be used to solve real world problems."}],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/15132","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/users\/34"}],"replies":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/comments?post=15132"}],"version-history":[{"count":5,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/15132\/revisions"}],"predecessor-version":[{"id":31319,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/15132\/revisions\/31319"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media\/15174"}],"wp:attachment":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media?parent=15132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/categories?post=15132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/tags?post=15132"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=15132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}