{"id":1046,"date":"2016-08-17T13:12:10","date_gmt":"2016-08-17T21:12:10","guid":{"rendered":"http:\/\/www.beyond-circuits.com\/wordpress\/?p=1046"},"modified":"2016-10-31T13:23:55","modified_gmt":"2016-10-31T21:23:55","slug":"petalinux-for-the-picozed","status":"publish","type":"post","link":"https:\/\/www.beyond-circuits.com\/wordpress\/2016\/08\/petalinux-for-the-picozed\/","title":{"rendered":"PetaLinux for the PicoZed"},"content":{"rendered":"<p>I recently ran into a SNAFU when trying to build a PetaLinux image for a PicoZed board on a rev 2 FMC carrier board. The instructions assume that you have built an FPGA image and exported it from Vivado. You can check out my <a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/tutorial\/tutorial23\/\">tutorial on PetaLinux<\/a> for more background information, just in case you&#8217;re unfamiliar with the process.<\/p>\n<p>You&#8217;re going to need to make sure that you have the board support package for the PicoZed board and carrier board you are using, which can download\u00a0<a href=\"http:\/\/microzed.org\/support\/design\/1519\/10\">here<\/a>. I like to keep the BSP in my Xilinx tool area, but you can store it anywhere you like. Be sure to unzip the download file.<\/p>\n<h1>Create the project<\/h1>\n<p>First, I source the settings file for PetaLinux. Don&#8217;t worry about the tftp warnings.<\/p>\n<pre>% . \/tools\/xilinx\/petalinux-v2015.4-final\/settings.sh\r\n<\/pre>\n<p>Now create your PetaLinux project. I created it as a sibling of the Vivado project directory.<\/p>\n<pre>% petalinux-create --type project --name pz_linux --source \/tools\/xilinx\/pz_7015_2015_4.bsp\r\n<\/pre>\n<h1>Configure the project<\/h1>\n<p>Next, you configure the project with the FPGA export. This sets the device tree for the build:<\/p>\n<pre>% petalinux-config --get-hw-description my_fpga\/my_fpga.sdk --project pz_linux<\/pre>\n<p>Then, configure your filesystem:<\/p>\n<pre>% petalinux-config -c rootfs --project pz_linux<\/pre>\n<h1>PetaLinux build fails<\/h1>\n<p>If we run petalinux-build right now, we run in to some trouble:<\/p>\n<pre>% petalinux-build --project pz_linux\r\nINFO: Checking component...\r\nINFO: Generating make files and build linux\r\nINFO: Generating make files for the subcomponents of linux\r\nINFO: Building linux\r\n[INFO ] pre-build linux\/rootfs\/fwupgrade\r\n[INFO ] pre-build linux\/rootfs\/gpio-demo\r\n[INFO ] pre-build linux\/rootfs\/httpd_content\r\n[INFO ] pre-build linux\/rootfs\/iperf3\r\n[INFO ] pre-build linux\/rootfs\/peekpoke\r\n[INFO ] pre-build linux\/rootfs\/weaved\r\n[INFO ] build system.dtb\r\n[ERROR] ERROR (phandle_references): Reference to non-existent node or label \"usb_phy0\"\r\n[ERROR] ERROR: Input tree has errors, aborting (use -f to force output)\r\n[ERROR] make[1]: *** [system.dtb] Error 255\r\nERROR: Failed to build linux\r\n<\/pre>\n<h1>Fixing the device tree<\/h1>\n<p>The problem is that the device tree was overwritten by the petalinux-config. To fix that, we need to add the following lines to the <code>system-conf.dtsi<\/code> file located in <code>pz_linux\/subsystems\/linux\/configs\/device-tree<\/code>. Place the text following the entry for memory:<\/p>\n<pre>usb_phy0:phy0 {\r\n  compatible=\"ulpi-phy\";\r\n  #phy-cells = ;\r\n  reg = ;\r\n  view-port = ;\r\n  drv-vbus;\r\n};<\/pre>\n<p>With this change in place, we can go ahead and run petalinix-build again, and the build will complete. I&#8217;m not exactly sure why this procedure is required or how to patch the PetaLinux install to fix this. I will explore that later.<\/p>\n<h1>Packaging<\/h1>\n<p>After building, you will need to package the distribution.<\/p>\n<pre>% petalinux-package --boot --format BIN --project pz_linux --fsbl pz_linux\/images\/linux\/zynq_fsbl.elf --fpga my_fpga\/impl_1\/my_fpga.bit --u-boot\r\n<\/pre>\n<p>Copy the <code>BOOT.BIN<\/code> and <code>pz_linux\/images\/linux\/image.ub<\/code> files to your MicroSD care and boot your PicoZed board.<\/p>\n<p>Let me know if you have any ideas why this problem exists or how you can fix it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently ran into a SNAFU when trying to build a PetaLinux image for a PicoZed board on a rev 2 FMC carrier board. The instructions assume that you have built an FPGA image and exported it from Vivado. You &hellip; <a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/2016\/08\/petalinux-for-the-picozed\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,15,5,14],"tags":[],"class_list":["post-1046","post","type-post","status-publish","format-standard","hentry","category-fpga","category-petalinux","category-xilinx","category-zynq"],"_links":{"self":[{"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/posts\/1046","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/comments?post=1046"}],"version-history":[{"count":8,"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/posts\/1046\/revisions"}],"predecessor-version":[{"id":1161,"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/posts\/1046\/revisions\/1161"}],"wp:attachment":[{"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/media?parent=1046"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/categories?post=1046"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/tags?post=1046"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}