New Horizons









Welcome to my blog

My name is Sven Andersson and I
work as a consultant in embedded
system design, implemented in ASIC
and FPGA.
In my spare time I write this blog
and I hope it will inspire others to
learn more about this fantastic field.
I live in Stockholm Sweden and have
my own company

Contact

You are welcome to contact me
and ask questions or make comments
about my blog.



Content

New Horizons
What's new
Starting a blog
Writing a blog
Using an RSS reader

Zynq Design From Scratch
Started February 2014
1 Introduction
Changes and updates
2 Zynq-7000 All Programmable SoC
3 ZedBoard and other boards
4 Computer platform and VirtualBox
5 Installing Ubuntu
6 Fixing Ubuntu
7 Installing Vivado
8 Starting Vivado
9 Using Vivado
10 Lab 1. Create a Zynq project
11 Lab 1. Build a hardware platform
12 Lab 1. Create a software application
13 Lab 1. Connect to ZedBoard
14 Lab 1. Run a software application
15 Lab 1. Benchmarking ARM Cortex-A9
16 Lab 2. Adding a GPIO peripheral
17 Lab 2. Create a custom HDL module
18 Lab 2. Connect package pins and implement
19 Lab 2. Create a software application and configure the PL
20 Lab 2. Debugging a software application
21 Running Linux from SD card
22 Installing PetaLinux
23 Booting PetaLinux
24 Connect to ZedBoad via ethernet
25 Rebuilding the PetaLinux kernel image
26 Running a DHCP server on the host
27 Running a TFTP server on the host
28 PetaLinux boot via U-boot
29 PetaLinux application development
30 Fixing the host computer
31 Running NFS servers
32 VirtualBox seamless mode
33 Mounting guest file system using sshfs
34 PetaLinux. Setting up a web server
35 PetaLinux. Using cgi scripts
36 PetaLinux. Web enabled application
37 Convert from VirtualBox to VMware
38 Running Linaro Ubuntu on ZedBoard
39 Running Android on ZedBoard
40 Lab2. Booting from SD card and SPI flash
41 Lab2. PetaLinux board bringup
42 Lab2. Writing userspace IO device driver
43 Lab2. Hardware debugging
44 MicroZed quick start
45 Installing Vivado 2014.1
46 Lab3. Adding push buttons to our Zynq system
47 Lab3. Adding an interrupt service routine
48 Installing Ubuntu 14.04
49 Installing Vivado and Petalinux 2014.2
50 Using Vivado 2014.2
51 Upgrading to Ubuntu 14.04
52 Using Petalinux 2014.2
53 Booting from SD card and SPI flash
54 Booting Petalinux 2014.2 from SD card
55 Booting Petalinux 2014.2 from SPI flash
56 Installing Vivado 2014.3

Chipotle Verification System
Introduction

EE Times Retrospective Series
It all started more than 40 years ago
My first job as an electrical engineer
The Memory (R)evolution
The Microprocessor (R)evolution

Four soft-core processors
Started January 2012
Introduction
Table of contents
Leon3
MicroBlaze
OpenRISC 1200
Nios II

Using the Spartan-6 LX9 MicroBoard
Started August 2011
Introduction
Table of contents
Problems, fixes and solutions

FPGA Design From Scratch
Started December 2006
Introduction
Table of contents
Index
Acronyms and abbreviations

Actel FPGA design
Designing with an Actel FPGA. Part 1
Designing with an Actel FPGA. Part 2
Designing with an Actel FPGA. Part 3
Designing with an Actel FPGA. Part 4
Designing with an Actel FPGA. Part 5

CAD
A hardware designer's best friend
Zoo Design Platform

Linux
Installing Cobra Command Tool
A processor benchmark

Mac
Porting a Unix program to Mac OS X
Fixing a HyperTerminal in Mac OS X
A dream come true

Running
The New York City Marathon

Skiing/Skating
Kittelfjall Lappland

Tour skating in Sweden and around the world
Top
Introduction
SSSK
Wild skating
Tour day
Safety equipment
A look at the equipment you need
Skate maintenance
Links
Books, photos, films and videos
Weather forecasts

Travel
38000 feet above see level
A trip to Spain
Florida the sunshine state

Photo Albums
Seaside Florida
Ronda Spain
Sevilla Spain
Cordoba Spain
Alhambra Spain
KittelfjÀll Lapland
Landsort Art Walk
Skating on thin ice

Books
100 Power Tips for FPGA Designers

Favorites
Adventures in ASIC
ChipHit
Computer History Museum
DeepChip
Design & Reuse
Dilbert
d9 Tech Blog
EDA Cafe
EDA DesignLine
Eli's tech Blog
Embedded.com
EmbeddedRelated.com
FPGA Arcade
FPGA Blog
FPGA Central
FPGA CPU News
FPGA developer
FPGA Journal
FPGA World
Lesley Shannon Courses
Mac 2 Ubuntu
Programmable Logic DesignLine
OpenCores
Simplehelp
SOCcentral
World of ASIC



If you want to be updated on this weblog Enter your email here:



rss feed



 
Saturday, April 12, 2014
Zynq design from scratch. Part 38.
Running Linaro Ubuntu on the ZedBoard

Open-source solution

To use PetaLinux in a commercial product we need to buy a license. Let's look for an open-source solution.

Linaro

Linaro is a not-for-profit engineering organization that works on open-source software for the ARM architecture, including the GCC toolchain, the Linux kernel, ARM power management, graphics and multimedia interfaces
. Linaro focuses on open-source support of the ARM v7 and ARM v8 Architecture, including SoCs that contain ARM Cortex-A9, Cortex-A15, Cortex-A53 and Cortex-A57 processor(s).

Linaro software

We can read more about Linaro and download the software from the Linaro web page.



Where to start

Digilent has published two very informative documents called "Embedded Linux Development Guide" and "Getting Started With Embedded Linux - ZedBoard". The second document describes the Linaro Ubuntu installation. Avnet has written a document called "Ubuntu Desktop Linux" (Register and login to Zedboard.org needed). Probably the best one to use. Let's start there.


Booting Linux on ZedBoard

Booting the Zynq-7000TM All Programmable SoC (Zynq AP SoC) from an SD card, or another form of compatible memory, requires that you first place four items onto your storage device. The four required items are the Linux file system (either Linaro or BusyBox), a Linux kernel image, a BOOT.BIN file, and a compiled device tree.

The Linux file system

The ZedBoard currently supports two different Linux file systems, a BusyBox ramdisk (used by PetaLinux) and a Linaro Ubuntu distribution.
The BusyBox ramdisk is a very small file system that includes basic functionality and runs through RAM. BusyBox is non-persistent, which means it will not save any changes we make during our operating session after we power down the ZedBoard.

The Linaro file system is a complete Linux distribution based on Ubuntu. It includes a graphical desktop that displays via the onboard HDMI port. Linaro executes from a separate partition on the SD card, and all changes made are written to memory. The utility of Linaro is that it will save files even after you power down and reboot the ZedBoard. In this experiment we will use the Linaro file system.

The SD card

I will use a SanDisk SDHC 16GB card (speed grade 4). I tried first using a SanDisk Ultra card (speed grade 10) but couldn't get it work.



Connecting a SD card reader/writer to VirtualBox

1. Shutdown the VirtualBox guest operating system.
2. Connect a SD card reader with the SDcard inserted to one of the USB connectors on the host computer. Make sure the SD card reader is USB 2. VirtualBox can not handle USB 3 memory card readers (for the moment).




3. Open the Settings window in VirtualBox and select Ports->USB. Add the USB Storage device and  click OK.






4. Unmount the SD card reader.
5. Start Ubuntu guest operating system.
6. Connect the SD card reader.
7. If everything works as expected, the SD card will show up in the file browser.





8. The file system is mounted in the /media/<user name> directory.





Formatting the SD card

Booting Linux on the ZedBoard from an SD card requires that we first set up the correct partitions on the SD card. We must format the first two partitions on the SD card to specific parameters. The first partition must have a FAT file system and be at least 52 MB and the second partition must have an ext4 file system and be at least 3.6GB. The second partition is only necessary when using the Linaro file system.

Using GParted

GParted is a free partition editor for graphically managing our disk partitions. It is used for creating, deleting, resizing, moving, checking and copying partitions, and the file systems on them. This is useful for creating space for new operating systems, reorganizing disk usage, copying data residing on hard disks and mirroring one partition with another (disk imaging).

Installing Gparted

Use the following command to install GParted.

->sudo apt-get install gparted

Running Gparted

Use the following command to start GParted:

->sudo gparted

1. When the GParted partitioning window is displayed we select the SD card (/dev/sdb) from the GParted->Devices menu.

2. Before doing any formatting of the card we must unmount the FAT32 partition. Select the partition, right-click and choose Unmount.

3. We will start by deleting the partition.
Select the partition, right-click and choose Delete.





4. To execute the command we have to click  .





5. We now have a completely unallocated SD card. Let's go ahead and add two new partitions. We make the first partition about 52MB and formatted in FAT32. Don't forget to leave 4MB of free space preceding the partition. Click the new button to add a new partition.





We make the second partition 8GB (3.6GB would be enough) with ext4 file system.





6. Here is the result.
Click  the  button to finish the partitioning.





7. The two partitions are mounted in the /media/svenand directory.





Quick check

Let's do a quick check to find out if our newly formatted SD card can boot Linux on the ZedBoard. We will copy the boot files found on the original SD card, to the BOOT partition on the new SD card. Like this:




Now we can follow the instruction in part 21 to boot Linux on the ZedBoard. If this works we can continue and install the Linaro file system. If not we have to go back to the drawing board.


Downloading the Linaro file system

The first step in preparing the Linaro file system is to obtain the tarball of our preferred Linaro Ubuntu distribution. We can obtain these from Linaro at http://releases.linaro.org/ by clicking the desired version and then traversing to ubuntu/precise-images. Linaro provides several different Ubuntu builds, some of which are very lightweight and do not use a desktop. We can find a version that does contain a graphical desktop and that has been tested on the ZedBoard at: http://releases.linaro.org/12.09/ubuntu/precise-images/ubuntu-desktop.





Creating the Linaro root file system

We create a folder named linaro under /tmp and copy the zipped linaro image there.

->mkdir -p /tmp/linaro
->sudo cp linaro-precise-ubuntu-desktop-20120923-436.tar.gz /tmp/linaro/.
->cd /tmp/linaro

Unpack the disk image using the tar command:

->sudo tar zxf
linaro-precise-ubuntu-desktop-20120923-436.tar.gz

Here is the result.




Observe. The /tmp directory will be cleaned when rebooting the Ubuntu system.


Copy the disk image to the SD card


After unpacking the disk image, the root filesystem lies at /tmp/linaro/binary/boot/filesystem.dir. So the next step to do is to copy the root filesystem into the second partition of our SD Card, mounted already to /media/svenand/rootfs. A lot of files in the root filesystem are special files with special attributes, I would recommend to use rsync to do the copy, which keeps the attibutes for every file. It takes a while to copy the file to SD card, basically depended on our SD card speed.

-> cd binary/boot/filesystem.dir
-> sudo rsync -a --progress ./ /media/svenand/rootfs/



To make sure all the files have been sychronized to the SD card, we need to unmount the /media/svenand/rootfs before we unplug the SD card. It may take several minutes to get everything synchronized onto the SD Card.


-> sudo umount /media/svenand/rootfs/

Adding device tree blob file

We need to change the bootargs defined in the device tree blob (DTB) to let the kernel use the second partition of SD card as root file system. To make our life easier, we can download a precompiled dtb file available at: devicetree_linaro.dtb


Fixing the BOOT files

We will delete the ramdisk8M.image.gz and devicetree_ramdisk.dtb files and add the devicetree_linaro.dtb file.





Prepare the ZedBoard

Once we complete these guide instructions, the SD card will have everything it needs to boot Linux on the ZedBoard. Set the jumpers on the ZedBoard as follows:
  • MIO 6: set to GND (JP7)
  • MIO 5: set to 3V3 (JP8)
  • MIO 4: set to 3V3 (JP9)
  • MIO 3: set to GND (JP10)
  • MIO 2: set to GND (JP11)
  • VADJ Select: Set to 1V8 (JP18)
  • JP6: Shorted
  • JP2: Shorted
  • All other jumpers should be left untouched



Boot Linaro Ubuntu

Insert the SD Card into the ZED Board, connect a monitor to the ZED Board with an HDMI cable, connect the UART port to our computer, open a terminal for it (115200 baud rate, 8 bit, 1 stop bit, no parity, no flow control).

We power up the ZedBoard and after a few seconds the blue LED will light up. However, automatically, the boot loader (U-Boot) will still look for ramdisk by default. So, we need to stop the autoboot by pressing a key during the 3-second count down, and type the command: run sdboot_linaro to boot up the Linaro Ubuntu Desktop.




The boot process will start and after a minute or so the display will show the Linaro home screen.




Here is the Linaro Ubuntu screen.






Connect keyboard and mouse

Linaro Ubuntu has support for both a USB keyboard and a USB mouse. They will be connected to the USB OTG contact.




USB On-The-Go

USB On-The-Go, often abbreviated USB OTG or just OTG, is a specification that allows USB devices such as digital audio players or mobile phones to act as a host, allowing other USB devices like a USB flash drive, digital camera, mouse, or keyboard to be attached to them.


We will start by adding a "USB MicroB to USB A" OTG adapter.






Now we can add a USB hub, a USB keyboard and a USB mouse.





The USB devices will be detected and can be used to control our Linux system.
 

Top   Previous   Next




Posted at 17:21 by svenand

Francisco Gaspar
May 21, 2014   12:49 PM PDT
 
Hello,

I would also like to change the device tree, specifically I'd like to:
- Change the ethernet mac address (I have 2 boards, both with the same address which creates conflicts);
- Automate the boot process.

The second point I was able to accomplish by using the files from the other board (which I didn't configure myself and thus do not know how they were generated), but I'd like some help with the first part.

A second question: Is there any place where I can get a precompiled kernel image? I'm trying to run Linaro 14.04, but since I didn't change the zImage file it is using the old kernel image I got from the other board (running Linaro 12.11, it has kernel 3.10.0 instead of 3.10.37 as I believe 14.04 should)

Thanks!
raph
April 23, 2014   01:34 PM PDT
 
Hi Svenson

how do you generate a dts with vivado 14.1 ?

it lacks xps_lite support and libgen is required in orger to infer .dts from .mss ?

thanks
 

Leave a Comment:

Name


Homepage (optional)


Comments




Previous Entry Home Next Entry