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

Bicycling
Stockholm by bike

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 here: 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
Comments (7)  

 
Thursday, April 10, 2014
Zynq design from scratch. Part 37.
Convert a virtual machine from VirtualBox to VMware

Some of you may prefer VMware instead of VirtualBox. I have already installed VMware Fusion on my Mac. You PC users can use VMware Workstation or VMware Player. Instead of setting up our virtual machine from scratch we will try to convert the VirtualBox VM to run in VMware. Will it work? Let's see.

Open Virtualization Format (OVF)

VirtualBox and VMware use different virtual machine formats, but each supports the standard Open Virtualization Format. Convert our existing virtual machine to OVF or OVA and you’ll be able to import it into another virtual machine program.

Unfortunately, this may not always work perfectly, as VirtualBox and VMware both seem to use slightly different OVA/OVF implementations that aren’t entirely compatible. If this doesn’t work, we may want to reinstall our virtual machine’s guest operating system from scratch.


VirtualBox to VMware

Before migrating a virtual machine from VirtualBox to VMware, ensure it’s “powered off” in VirtualBox and not suspended. If it’s suspended, launch the virtual machine and shut it down.





1. Click the File menu in VirtualBox and select Export Appliance. We will export the Ubuntu 64bit VM.





2. Select settings. We will keep the defaults.






3. Don't touch.






4. Click Export to start the conversion. This may take some time, depending on the size of our virtual machine’s disk file.





5. Here is the result.




Import the OVA file in VMware

6. Start VMware and select Import from the File menu.





7. Click "Choose File" and browse to our OVA file. Click Continue and specify where to store the imported and converted VMware virtual machine (Ubuntu 64bit.vmwarevm).





8. Click "Save" to start the import. VirtualBox and VMware aren’t perfectly compatible, so we’ll probably receive a warning message saying the the file “did not pass OVF specification performance” �" but if we click Retry, the virtual machine should import and function properly.





9. The import starts.





10. When the import has finished we can start our virtual machine.





11. Uninstall VirtualBox guest additions.

->sudo /opt/VBoxGuestAdditions-4.3.10/uninstall.sh





Install VMware Tools

12. Select "Install VMware Tools" from the Virtual Machine menu.





13. Copy the file VMwareTools-9.6.1-1378637.tar.gz to a temporary directory.

14. Unzip and untar
VMwareTools-9.6.1-1378637.tar.gz





15. Execute the perl script vmware-install.pl from the vmware-tools-distrib directory.

->sudo ./vmware-install.pl


16. Restart the virtual machine to enable the full screen view.






Top   Previous   Next


Posted at 16:46 by
Make a comment  

 
Tuesday, April 08, 2014
Zynq design from scratch. Part 36.

Building a web enabled application

Web serving embedded applications become a lot more useful when the web interface can be used to control the device, or monitor sensor inputs. In this step, we will build and experiment with a simple web-enabled application controlling the LEDs on the ZedBoard.

Create an application

We will create a CGI script called LEDcontrol by running the petalinux-create command from inside a PetaLinux project on our workstation.

->cd Projects/PetaLinux/Avnet-Digilent-ZedBoard-2013.3
->petalinux-create -t apps --name LEDcontrol

Download the program code

The program code can be downloaded from here. I would like to thank John Williams (the father of PetaLinux) at Xilinx for providing me with the source code.

Copy the code to the application directory

Unzip, unpack and copy the downloaded files to the LEDcontrol directory. Here is the result.



Build and install the application program

For more information see part 29 and part 35.

->petalinux-build -c rootfs/LEDcontrol -x build


Controlling hardware from the web browser

We can now control the LEDs on the ZedBoard from our web browser.

  1. Make sure the web server is running in PetaLinux: ->httpd -p 8080 -h /home/httpd
  2. Open a web browser on the host
  3. Enter the webaddress: <IP address of the board>:8080/cgi-bin/LEDcontrol
  4. ZedBoard LED Control window will open
  5. Enter the LED GPIO ID. In our case it is 243
  6. Click the ON/OFF links to turn on/off the LEDs on the ZedBoard







This is just one small example. We could include much more control from our web application. It is up to your imagination.


Top   Previous   Next



Posted at 17:09 by
Make a comment  

 
Sunday, April 06, 2014
Zynq design from scratch. Part 35.
Using CGI scripts

The Common Gateway Interface (CGI) is a standard method for web servers software to delegate the generation of web pages to executable files. Such files are known as CGI scripts; they are programs, often stand-alone applications, usually written in a scripting language like Perl. In this example we will write the CGI script using the C language.

Create a CGI script

Create a user application by running petalinux-create -t apps from inside a PetaLinux project on our workstation.

->cd Projects/PetaLinux/Avnet-Digilent-ZedBoard-2013.3
->petalinux-create -t apps --name HelloWorld



HelloWorld C program

As usual when starting work with some new programming technology, we should probably first make a trivial program work. This avoids fighting with many potential problems at a time and concentrating first on the issues specific to the environment, here CGI.

We will use the following program that just prints Hello world but preceded by HTTP headers as required by the CGI interface. Here the header specifies that the data is plain ASCII text.


#include <stdio.h>

int main(void) {
  printf("Content-Type: text/plain;charset=us-ascii ");
  printf("Hello world ");
  return 0;
}



HelloWorld makefile

The CGI script will be installed in directory: /home/httpd/cgi-bin


APP = HelloWorld

# Add any other object files to this list below
APP_OBJS = HelloWorld.o

all: build install

build: $(APP)

$(APP): $(APP_OBJS)
    $(CC) $(LDFLAGS) -o $@ $(APP_OBJS) $(LDLIBS)

clean:
    -rm -f $(APP) *.elf *.gdb *.o

.PHONY: install image

install: $(APP)
    $(TARGETINST) -d $(APP) /home/httpd/cgi-bin/$(APP)

%.o: %.c
    $(CC) -c $(CFLAGS) -o $@ $<



Build and boot PetaLinux

Follow the instructions in part 29 to add a new appliction, build and boot PetaLinux.

Start the web server

Login to PetaLinux and start httpd (Hypertext Transfer Protocol Daemon) using port 8080:

->httpd -p 8080 -h /home/httpd


Displaying the web page

Open a web browser on the host machine and enter the following web address: 192.168.33.3:8080/cgi-bin/HelloWorld



The CGI script will execute on the server side and display the text: Hello world.


Modifying the HelloWorld program

Writing C programs normally means we have to do a number of iterations including bug fixing and adding more code, which means we have to go through this process every time.
  1. Change the source code
  2. Rebuild the Linux kernel
  3. Load and boot the kernel

This will take several minutes to be completed and we will spend a lot of time waiting for things to finish. Let's find a faster way to modify and test a C program. Here is the modification:

printf("Hello world from Zoocad Consulting ");

Build the the application

To find out what other possibilities we have to build our application we use the command:

->petalinux-build --help





We will use this command to build only the HelloWorld application:

->petalinux-build -c rootfs/HelloWorld -x build





The result from the build is stored in the directory: build/linux/rootfs/apps/HelloWorld





Copy the HelloWorld application


As we have the Ubuntu file system NFS mounted on our host we can copy the executable file HelloWorld to PetaLinux using the curl command (see part 34).

-> cd ..../build/linux/rootfs/apps/HelloWorld
-> curl -T HelloWorld -u root:root ftp://192.168.33.3

On the PetaLinux side:

->cd /var/ftp
->chmod 755 HelloWorld
->cp HelloWorld /home/httpd/cgi-bin/.






Top   Previous   Next



Posted at 19:15 by
Make a comment  

 
Saturday, April 05, 2014
Zynq design from scratch. Part 34.
Installing custom web server content

By default, system images built with PetaLinux SDK include a web application demo built using the uWeb (MicroWeb) framework from WorkWare Systems. If we prefer to create our own Embedded Web interfaces, PetaLinux also includes the BusyBox httpd server.  This tutorial describes how to configure the BusyBox web server and create/install our own custom web content into a PetaLinux system image.

Create a new application

We will create a dummy application to hold the web content. We call it TourSkating, you will soon see why.

->cd Projects/PetaLinux/Avnet-Digilent-ZedBoard-2013.3
->petalinux-create -t apps --name TourSkating


Building a new application

Once we have created the new application, the next step is to compile and build it. The required steps are shown below.

2.
Select your new application to be included in the build process. The application is not enabled by default. Launch the rootfs configuration menu:

->petalinux-config -c rootfs


3. We will include the TourSkating app and exclude the uWeb app.





4. We need to include the built-in web server (httpd). It can be found in base->busybox->busybox-httpd










5. Exit and save the configuration.





Build a new PetaLinux kernel

6. Execute the command:

->petalinux-build


Create the index.html file

The web page will display two pictures.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
 <title>Tour skating in Sweden and around the world</title>
</head>
<body>
 <h3> The ice is like a mirror</h3>
 <img src="MirrorLike.png">
 <br><br>
 <h3> On the ice</h3>
 <img src="TourStart.png">
 <br><br>
 <a href="http://www.wildskating.com">For more information see my blog</a>
 <br>
</body>
</html>

Boot PetaLinux

Follow the instructions in part 28 to boot PetaLinux.


Copying files to the PetaLinux installation

We will use the cURL command to transfer the files from our host to the guest. cURL is a command line tool for doing all sorts of interesting and essential URL manipulations and data transfers. The original goal of the program was to transfer files programmatically via protocols such as http, ftp, gopher, sftp, ftps, scp, tftp, and many others, via a command line interface. The main benefit of using the command line interface is that you can use the program in your Windows batch file or Linux shell scripts to automate many URL related processes. Here are the command to transfer the three files used to display our web page.


->curl -T index.html -u root:root ftp://192.168.33.3
->curl -T MirrorLike.png -u root:root ftp://192.168.33.3
->curl -T TourStart.png -u root:root ftp://192.168.33.3

Moving the files to the httpd directory

The files will be copied to the directory: /var/ftp. We have to move them to the: /home/httpd directory:

->cd /var/ftp
->mv index.html /home/httpd/.
->mv MirrorLike.png /home/httpd/.
->mv TourStart.png /home/httpd/.

Displaying the web page

Enter the web address: 192.168.33.3/index.html in your web browser.


Include the files in the build process

We add the web page files to the httpd directory in the TourSkating apps directory.





We then modify the makefile to include the web page files during the build. Here is the modified makefile:


ifndef PETALINUX
$(error "Error: PETALINUX environment variable not set.  Change to the root of your PetaLinux install, and source the settings.sh file")
endif

include apps.common.mk

APP = TourSkating

# Add any other object files to this list below
APP_OBJS = TourSkating.o

all: build install

build: $(APP)

$(APP): $(APP_OBJS)
    $(CC) $(LDFLAGS) -o $@ $(APP_OBJS) $(LDLIBS)

clean:
    -rm -f $(APP) *.elf *.gdb *.o

.PHONY: install image

install: $(APP)
    $(TARGETINST) -d $(APP) /bin/$(APP)
    $(TARGETINST) httpd/index.html /home/httpd
    $(TARGETINST) httpd/MirrorLike.png /home/httpd
    $(TARGETINST) httpd/TourStart.png /home/httpd
%.o: %.c
    $(CC) -c $(CFLAGS) -o $@ $<



After building and booting PetaLinux we can access the web page without any modifications.


Top   Previous   Next



Posted at 16:15 by
Comments (3)  

 
Saturday, March 29, 2014
Zynq design from scratch. Part 33.
Mounting guest file system

We have already seen that we can login to the Ubuntu guest using ssh and that we can transfer files using sftp. Now let's find out how we can mount a file system from Ubuntu in our host computer.

Using SSHFS

SSHFS (SSH Filesystem) is a filesystem client to mount and interact with directories and files located on a remote server or workstation. SFTP provides secure file transfer and a secure remote file system. While SFTP clients may transfer files and directories, the related file system may not be mounted locally using SFTP alone. Using SSHFS a remote file system may be treated in the same way as other volumes (such as CDs, DVDs, USB flash drives and shared disks). Let's take the easy path and use some available software.

ExpanDrive

ExpanDrive is a Network file system client for Mac OS X and Microsoft Windows that facilitates mapping of local volume to any SFTP server the user can access. It also can connect to FTP, Amazon S3, RackSpace Cloud Files, OpenStack Swift Object Storage, DreamObjects, WebDAV, Dropbox, Google Drive and Box.com. When a server is mounted with ExpanDrive any program can read, write, and manage remote files (that is, files that only exist on the server) as if they were stored locally.




Download and install

We will download a free trial version for a  start.

Setup ExpanDrive


We will fill in the values for our Ubuntu guest and click Connect.





The home directory of our Ubuntu guest is mounted in Mac OS X and visable in the Finder.






Click Reveal to update file system display.





Using sshfs from the command line


SSH’ing to a server and doing all the configuration through terminal is easy and very fast, but when we want to edit files and set a remote development environment on our local machine, mounting a remote filesystem over ssh and editing them as the files were in your computer is the way to go. Right now I’m using OSX Mavericks (OSX 10.9), so for mounting a remote system we will need to do some tricks and tweaks to have it working. I will try to explain step-by-step on how to do it.

Install OSXFUSE

First of all, we will have to install OSX Fuse, the successor of the MacFuse software. Here is the download link: http://osxfuse.github.io/2013/06/17/OSXFUSE-2.6.0.html. With the file downloaded, right click on the dmg file, open and install it.





MacFuse (OSXFuse) can be found in the System Preference pane.





Install sshfs

Click this link to install sshfs 2.4.1: https://github.com/downloads/osxfuse/sshfs/SSHFS-2.4.1.pkg Run through the installer with the default options.





Mount the guest file system


Open a terminal on the host and use the following command to mount a guest file system:

-> sshfs <guest username>@<guest IP address>:<Guest mount directory> <Host mount point>

Mount the guest's Projects directory in the host 's UbuntuShare directory:

->sshfs svenand@192.168.56.101:/home/svenand/Projects /Users/zoocad/UbuntuShare


Displayed in the Finder





Top   Previous   Next




Posted at 12:29 by
Make a comment  

 
Tuesday, March 25, 2014
Zynq design from scratch. Part 32.
VirtualBox Seamless Mode

When we have the Guest Additions up and running it’s time for the real fun, trying out seamless mode. Select “View,” then “Switch to Seamless Mode.” After we done this, our host operating system and our virtual operating system should seem to combine. We’ll have a taskbar from each and programs from each will be visible over our native operating system’s desktop. This a very good solution when we don't have access to an extra display. Here is an example.





Starting a terminal on the host


When in Seamless Mode we can now start a terminal on the host instead of fighting with GTKterm on the guest. Open a Mac terminal window on the host and type the following command:

screen /dev/tty.usbmodemxxx 115200

replacing the xxx with the actual modem number (use tab completion to find the number). Here is what it looks like after PetaLinux has booted.





Type <ctrl a> and then <k> to end the screen session.


Top   Previous   Next



Posted at 10:53 by
Make a comment  

 
Monday, March 24, 2014
Zynq design from scratch. Part 31.
Running an NFS sever on the Mac OS X

Network File System (NFS) is a distributed file system protocol originally developed by Sun Microsystems in 1984, allowing a user on a client computer to access files over a network much like local storage is accessed.


NFS server

An NFS server allows NFS-mount root file system (or NFS mount) on the targeting board. This is normally used during application development stage. The main idea here is to provide application/software developers a rapid turnaround during testing and development environment, because downloading the modified file system image to the target hardware is not necessary.

Windows PC solution

FreeNFS is a solution for all of you using a Windows PC.

Create a directory to share

We will add a directory called NFSshare in our home directory:

cd
mkdir NFSshare

Create the exports file

We will create a file named exports and add the following text line:

/Users/zoocad/NFSshare -mapall=zoocad -network 192.168.33.0 -mask 255.255.255.0

XXX -mapall=YYY -network ZZZ -mask 255.255.255.0

XXX = Path name of our shared directory
yyy = Name of the user account
ZZZ = IP of our network segment, e.g. if the Mac IP Address is 192.168.33.1 so our segnent is 192.168.33.0

If we like we can add more directory to share. When finished we copy this file to the /etc directory:

sudo cp exports /etc/.


Starting the NFS server

There are only a few commands needed to start the built-in NFS server on the Mac host.

To start:

sudo nfsd update

To show status:

sudo nfsd status

To show exported file systems:

showmount -e



The NFS server is up and running.

Mounting NFSshare in PetaLinux

After booting PetaLinux we can mount the NFSshare directory into the PetaLinux file system. Here is the command to mount it under the /mnt directory:

mount -o nolock -t nfs 192.168.33.1:/Users/zoocad/NFSshare /mnt -otcp,rsize=4096,wsize=4096

This is telling mount that

  • we want to mount a file system of NFS type (-t NFS)
  • the host of this file system has IP address 192.168.33.1
  • the directory on that host we wish to mount is /Users/zoocad/NFSshare
  • we want this file system to be mounted underneath the local /mnt directory
  • data transfer uses TCP protocol (-otcp)
  • the read and write operations should use block size of 4096





Running an NFS sever on Ubuntu

We also want to run an NFS server on our Ubuntu Linux OS to enable export of directories to the MaC OS X. First let's make sure we have the following package installed in Ubuntu:

->sudo apt-get install nfs-kernel-server


Here is information on how to setup a Ubuntu server and here is a how-to document.

Edit exports file

In order to export a file system in our host, we need to edit a file called /etc/exports. The file /etc/exports serves as the access control list for file systems which may be exported to NFS clients.

->sudo gedit /etc/exports




Example:

/home/svenand 192.168.56.0/24(rw,sync,insecure,no_subtree_check)


Each line contains an export point and a clients allowed to mount the file system at that point. Each listed client may be immediately followed by a parenthesized, comma-separated list of export options for that client.
  • rw
  • sync
  • insecure (must be used when exporting to Mac OS X)
  • no_subtree_check
The notation 192.168.56.0/24 means that all IP addresses between 192.168.56.0 and 192.168.56.255 are allowed clients.

Start NFS sever

Use this command to start the NFS server:

->sudo service nfs-kernel-server start





Mount the exported file system


We will mount the file system in our Mac OS X client. Open a terminal and type the following commands:

->mkdir /Users/zoocad/linux-vm
->sudo mount -t nfs 192.168.56.101:/home/svenand /Users/zoocad/linux-vm

Where:
  • 192.168.56.101 - IP address of NFS server
  • /home/svenand - File system on the NFS server
  • /Users/zoocad/linux-vm - Mount point on the client

Here is the Finder window showing the svenand file system mounted.





Setting up the TFTP server

Now when we have the Ubuntu file system mounted in Mac OS X we can setup the TFTP server to access the exported file system. Like this:





This means that we never ever have to copy kernel images when we rebuild PetaLinux.


Top   Previous   Next



Posted at 09:04 by
Make a comment  

 
Sunday, March 23, 2014
Zynq design from scratch. Part 30.
Fixing the host computer

As you may remember I started out using MacBook Air, but when I needed an ethernet port I decided to use my MacBook Pro. Now when I have everything setup and running on my MacBook Pro I will give the MacBook Air another chance. The first thing I had to do was buying a Thunderbolt to Gigabit ethernet adapter and connect it to the MacBook Air.





Setup a static IP address

Select System Preferences and then Network. Choose Manually configure IPv4 and fill in the IP address: 192.168.33.1





Find the port name

Open a terminal and type ifconfig.





The ethernet port's logical name is en6. There are only two things we have to change from the MacBook Pro setup:
  • The TFTP server
  • The DHCP server

The TFTP server

Select en6: 192.168.33.1 as the TFTP server host address.





The DHCP server

The server is called bootpd and does both DHCP and BOOTP. These instructions just describe using it for DHCP, however. To start, you need to create a configuration file for the server. The file should be stored in /etc/bootpd.plist.

Here's a sample configuration file (observe en6 instead of en0) :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">
<dict>
<key>bootp_enabled</key>
<false/>
<key>detect_other_dhcp_server</key>
<integer>1</integer>
<key>dhcp_enabled</key>
<array>
<string>en6</string>
</array>
<key>reply_threshold_seconds</key>
<integer>0</integer>
<key>Subnets</key>
<array>
<dict>
<key>allocate</key>
<true/>
<key>lease_max</key>
<integer>86400</integer>
<key>lease_min</key>
<integer>86400</integer>
<key>name</key>
<string>192.168.33</string>
<key>net_address</key>
<string>192.168.33.0</string>
<key>net_mask</key>
<string>255.255.255.0</string>
<key>net_range</key>
<array>
<string>192.168.33.2</string>
<string>192.168.33.254</string>
</array>
</dict>
</array>
</dict>
</plist>

This file sets up the DHCP server to run on the interface named  en6, which is the Thunderbolt Gigabit ethernet port. It assumes that that port has been configured with the IP address 192.168.33.1, and dishes out addresses from 192.168.33.2 to 192.168.33.254

To start the server, run the following command:

->sudo /bin/launchctl load -w /System/Library/LaunchDaemons/bootps.plist

Stopping the server is very similar:

->sudo /bin/launchctl unload -w /System/Library/LaunchDaemons/bootps.plist

System overview





The almost perfect workplace





The perfect workplace

If you happened to have an extra display laying around, you can hook it up and have the host on one display and the guest on the other display. Like this.





Unclutter my desk

My desk started to look a bit messy so I decided to buy a Belkin Thunderbolt dock. It has connections for:
  • Three USB 3 ports
  • Two Thunderbolt ports
  • One Ethernet port

Exactly what I needed and yes it was almost "plug and play". I only had to change the ethernet port name from en5 to en7.





Thunderbolt dock setup





MacBook Air is ready for a ride


From now on I will use MacBook Air in my experiments.


Top   Previous   Next




Posted at 09:55 by
Make a comment  

 
Friday, March 21, 2014
Zynq design from scratch. Changes and updates.

2014-04-08 Added site search.
2014-04-07 Added a PetaLinux custom web server.
2014-04-01 Added a Thunderbolt dock.
2014-03-26 Added a system overview picture.
2014-03-25 Updated the page Connect to the ZedBoard via Ethernet.
2014-03-24 Replaced the USB to ethernet adapter with a Thunderbolt to ethernet adapter.





Posted at 08:35 by
Make a comment  

Previous Page Next Page