===========================================
Tutorials for Running Linux on Xilinx FPGAs
===========================================

.. include:: revision.rst

:Authors: - David Baird
          - Tim Sander
:Contact: dhbaird@gmail.com

.. contents:: Contents

History
=======

2010-05-07 03:54:25 UTC  David Baird <dhbaird@gmail.com>

    I updated `building-linux.html` to contain updated information for
    newer kernel versions.  I updated `Running Xilinx ISE and EDK 10.1
    in Ubuntu 8.10 <edk101-ubuntu810.html>`_ to now also include support
    for Ubuntu 9.10 and 64-bit Linux.  I added the `Crosstool-ng 1.6.1
    <crosstool-ng-1.6.1.html>`_ tutorial because the older tutorial,
    `Crosstool-ng 1.3.2 <crosstool-ng-1.3.2.html>`_, has become defunct.

2009-12-16 03:58:03 UTC  David Baird <dhbaird@gmail.com>

    In the `building-linux.html` tutorial, I corrected the mkdosfs command
    to format exactly 1 reserved sector (which is required by SystemACE).

2009-06-04 16:00:01 UTC  David Baird <dhbaird@gmail.com>

    Tim Sander <tim01@iss.tu-darmstadt.de> contributed the SystemACE
    tutorial `here <building-linux.html>`_.  Thanks!

Overview
========

These tutorials explain how to run Linux on Xilinx FPGAs.  These tutorials
focus on the Xilinx EDK 10.1 SP3 and kernel releases circa January 2009.

These tutorials assume that:

#. You are able to do "hello world" in EDK.

    If you are unable to do "hello world", then you should start with
    this tutorial:

      - `EDK_Tutorial_1.pdf <distfiles/EDK_Tutorial_1.pdf>`_
      - `lib.tar.gz <distfiles/lib.tar.gz>`_ (support files for
        the tutorial; alternatively, these can be downloaded from
        http://digilentinc.com/Data/Products/XUPV2P/EDK-XUP-V2ProPack.zip)

#. You are running Linux and that you are familiar with shell
   concepts.

    More information: Here are some shell concepts you should probably
    be familiar with, at a minimum: pwd, rm, cp, mkdir, cd, wget, sudo,
    su, $HOME, .bashrc, etc..  If you are not 100% familiar with all
    the commands, that may be okay: you might be able to pick these up
    as you go along.

#. You know how to install additional software on your Linux
   computer.

    More information: As an example, you will need "genext2fs" for some
    of the tutorials.  In Debian/Ubuntu, this is accomplished by typing
    "apt-get install genext2fs" as root.

#. You have installed the ISE and EDK tools on your computer.  If you don't
   know how to do this, then this tutorial might help:

    - `Running Xilinx ISE and EDK 10.1 in Ubuntu 8.10 <edk101-ubuntu810.html>`_

   In these tutorials, the tools are assumed to be located installed at:

    - ``/home/xilinx/10.1_sp3/ise/ISE``
    - ``/home/xilinx/10.1_sp3/edk/EDK``
    - (there is an ``x101sp3`` script which you can easily edit if
      your tools are located somewhere else)

You can use "Downloads" to skip over some steps in the tutorials:

    It is possible for you to skip over some steps in some of the
    tutorials.  Look for a "Downloads" section in a particular tutorial
    to see if you can simply download the end (or intermediate) results,
    thereby skipping some of the steps.

The general steps that are required to get Linux running are listed below.
These steps are discussed in more detail by the tutorials:

#. Install cross-development tools, so that you can compile the kernel
   and userspace applications.
#. Create a bitstream (download.bit) using EDK.
#. Generate a device-tree (xilinx.dts) using EDK and the device-tree
   generator.
#. Configure and build the kernel, using the device-tree (xilinx.dts).
#. Build the root filesystem (aka "user space") (this is possibly the
   most complicated part of this whole process).

  - To make this process easier to understand, it is preceded by a
    minimalist tutorial which creates the smallest possible root
    filesystem, containing only two files.

Basic Tutorials
===============

#. Install cross-development tools:
   `Crosstool-ng 1.6.1 <crosstool-ng-1.6.1.html>`_
   (older tutorial here: `Crosstool-ng 1.3.2 <crosstool-ng-1.3.2.html>`_)

#. Create an EDK project:
   `Xilinx EDK 10.1, Virtex-II PRO XUP Board <edk101-xup.html>`_

#. Build the Linux kernel:
   `Just Linux (without Root Filesystem) <building-linux.html>`_

#. Building the root filesystem (aka "user space"):

  - `Minimalist Initramfs and Initrd <minimalist-initramfs.html>`_
  - `Buildroot <buildroot.html>`_

All Tutorials (for Advanced Users)
==================================

- Installing ISE and EDK in Linux

  - `Running Xilinx ISE and EDK 10.1 in Ubuntu 8.10 <edk101-ubuntu810.html>`_

- Creating an EDK project

  - `Xilinx EDK 10.1, Virtex-II PRO XUP Board <edk101-xup.html>`_

- Install cross-development tools

  - `ELDK 4.2 <eldk42-cross.html>`_ (Easier, glibc only?)
  - `Crosstool-ng 1.6.1 <crosstool-ng-1.6.1.html>`_ (Harder, glibc and uClibc)
    (older tutorial here: `Crosstool-ng 1.3.2 <crosstool-ng-1.3.2.html>`_)


- Building the Linux kernel

  - `Just Linux (without Root Filesystem) <building-linux.html>`_

- Building the root filesystem (aka "user space")

  - `Minimalist Initramfs and Initrd <minimalist-initramfs.html>`_
  - `Buildroot <buildroot.html>`_

- Booting Linux with root filesystem

  - initrd method: TODO
  - NFS root method: TODO
  - SystemACE CompactFlash method: TODO

- __log_buf, shell scripts, and more...: TODO

Beyond These Tutorials
======================

Topics Not Yet Covered by These Tutorials
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- File systems beyond just initrd and initramfs.

  If you are using an MTD flash device, you'll probably want to
  investigate JFFS2 and YAFFS;  The drivers for those file systems are
  able to communicate with Linux's MTD interfaces and are aware of how
  to explicitly erase blocks.

More Resources
~~~~~~~~~~~~~~

- http://xilinx.wikidot.com/
- http://lxr.linux.no/linux (useful when debugging the Linux kernel)

Acknowledgements
================

The development of these tutorials has been graciously supported by the
`FPGA Mission Assurance Center <http://www.fpgamac.com/>`_.

|fmac-logo|_

.. _fmac-logo: http://www.fpgamac.com/
.. |fmac-logo| image:: im-edited/fmac-logo.jpg

.. .. image:: im-edited/fmac-logo.jpg
