UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

Adam Taylor’s MicroZed Chronicles Part 139: Linux File System and Single Board Computer

by Xilinx Employee ‎07-18-2016 10:20 AM - edited ‎07-18-2016 10:22 AM (18,686 Views)

 

By Adam Taylor

 

In the build we used last week for our Linux example, we placed the ZedBoard’s required boot files on an SD Card. One of these files was a RAMdisk image of the file system needed for Linux. This file loads into RAM each time we boot the ZedBoard. Changes we make within the file system while the board is operating—e.g. transferred files, etc—are lost the next time we reboot.

 

If we actually want to keep these changes between power cycles, we need to put a file system on non-volatile memory such as the SD Card. Boards like the Snickerdoodle and Parallela use a file system in place of the RAMdisk. Although it is possible to update the RAMdisk contents as this blog shows, it requires a number of steps.

 

Going forward I want to look at image processing and Open CV so it is important that we have a file system we can save changes in.  I also want to use the ZedBoard as a single bard computer so I need to use the HDMI outout to generate a display of the desktop. That’s another reason we need a file system.

 

To do this we need a file system and we need to format the SD Card correctly. Looking first at the SD Card, we need to create two paritions. One partition is FAT formatted and that’s where we store the following files:

 

  • bin
  • zimage
  • Device Tree Blob
  • Any other files needed for boot

 

The second SD Card partition is where we store the file system. This is normally the larger of the two paritions and it’s formated for a Linux file format (e.g. EXT2 or EXT4).

 

We will need to use a Linux-based OS to create the partitions and then the install the file system. This is where our virtual machine comes in very handy.

 

With the Linux OS up and running, insert the SD Card into its reader, open a disk utility, and format the SDCard. Once it’s formatted, we create two partitions called boot and rootfs, sized and formatted as follows:

 

  • Boot, 512 Mb, FAT 32 (bootable)
  • Rootfs, 3.5 Gb, EXT4 or EXT2

 

 Image1.jpg

 

 

Typically, the file system will be distributed as a compressed folder which you must extract onto the file system partition.

 

One of the most commonly used file systems for the Zynq-7000 SoC is Linaro, which can be obtained from linaro.org. This is this file system used for this example. I will be using the Zedboard.org desktop Ubuntu Linux example available here.

 

Should we need to build a system from scratch, we use u-boot to ensure it knows where the file system resides.

 

While the example comes with the device tree, kernel image, and Boot.bin file necessary to boot the system, we need to download the filesystem.

 

With the file system downloaded the next step is to unzip the contents of the filesystem to the SD card rootfs partition. We do this using the command in a Linux terminal window:

 

sudo tar - - strip-components=3 -C <path to rootfs>/rootfs -xzpf <path to downloaded fs>/linaro-precise-ubuntu-desktop-20121124-560.tar.gz binary/boot/filesystem.dir

 

 

Image2.jpg

 

 

This may take some time (5 to 15 minutes or even longer). The final step is to move the DTB, kernel image, and boot.bin files onto the boot partition of the SD Card. We should then be ready to boot the system.

 

When I did this I was presented with the following desktop on my HDMI Monitor:

 

 

Image3.jpg

 

 

 

The code is available on Github as always.

 

If you want E book or hardback versions of previous MicroZed chronicle blogs, you can get them below.

 

 

 

  • First Year E Book here
  • First Year Hardback here.

 

 

 MicroZed Chronicles hardcopy.jpg

 

 

 

  • Second Year E Book here
  • Second Year Hardback here

 

 

MicroZed Chronicles Second Year.jpg 

 

 

Note: The Amazon ebooks have been listed at $0.00 for a long time. That’s about to end on July 20 so you might want to download them today or tomorrow before the price changes.

 

Labels
About the Author
  • Be sure to join the Xilinx LinkedIn group to get an update for every new Xcell Daily post! ******************** Steve Leibson is the Director of Strategic Marketing and Business Planning at Xilinx. He started as a system design engineer at HP in the early days of desktop computing, then switched to EDA at Cadnetix, and subsequently became a technical editor for EDN Magazine. He's served as Editor in Chief of EDN Magazine, Embedded Developers Journal, and Microprocessor Report. He has extensive experience in computing, microprocessors, microcontrollers, embedded systems design, design IP, EDA, and programmable logic.