Building the NEEK toolchain

From Crashcourse Wiki

Jump to: navigation, search

Building a basic cross-compile toolchain for the NEEK requires downloading and configuring a number of software components. IMPORTANT: All of the components described below must be downloaded and installed at the same directory level, so you might consider creating a whole new directory called neek_toolchain or something like that, then cding into it before you get started.

Contents

The SOPC server

A good deal of the software components come from the SOPC server, whose repositories you can examine [here]. However, don't blindly download what you find there -- follow the instructions on this page carefully to minimize the load on that server.

The first few (easy) components

The first components are the easy ones; just use git and:

$ git clone git://sopc.et.ntust.edu.tw/git/binutils.git
$ git clone git://sopc.et.ntust.edu.tw/git/gcc3.git
$ git clone git://sopc.et.ntust.edu.tw/git/uClibc.git
$ git clone git://sopc.et.ntust.edu.tw/git/elf2flt.git
$ git clone git://sopc.et.ntust.edu.tw/git/toolchain-build.git

The next couple of components are going to require a little more work.

Getting uClinux-dist for the NEEK

This component is rather sizable so you are strongly discouraged from just cloning it from the SOPC server. Instead, you're encouraged to download a tarball that contains the git contents as of a given date, then using git to simply pull and checkout the difference.

Get the current tarball [here] and untar it into the same directory as all of the other components above, then

$ cd uClinux-dist
$ git fetch
$ git branch --track test-nios2 origin/test-nios2
$ git checkout test-nios2

NOTE: Newer tarballs may already have the remote test-nios2 branch defined, so you might be able to bypass the fetch and branch steps for those newer tarballs. But make sure you're working with the test-nios2 branch, regardless of the tarball.

Getting the kernel

As with the uClinux-dist component, you should clone the stock Linux kernel, then use the SOPC server to add the NIOS-specific enhancements to that tree to minimize the load on the SOPC server. Once again, in the main toolchain directory:

$ git clone -n git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
$ cd linux-2.6
$ git remote add sopc git://sopc.et.ntust.edu.tw/git/linux-2.6.git
$ git fetch sopc
$ git branch --track test-nios2 sopc/test-nios2
$ git checkout test-nios2

Note that the Makefile in the toolchain-build directory expects to find the Linux source directory at this level and also named "linux-2.6", but you can override that via the KERNEL_SRC variable in the Makefile if you really want.

Optional components

Depending on whether you want to build any of the optional components, you can also:

$ git clone git://sopc.et.ntust.edu.tw/git/insight.git
$ git clone git://sopc.et.ntust.edu.tw/git/u-boot.git

Building the toolchain

Depending on what you want to build, you can build any of the following make targets:

$ make all          [toolchain + extras]
$ make toolchain    [toolchain only]

The default installation directory will be .../toolchain_build/build/nios2/, so you should add the directory .../toolchain_build/build/nios2/bin/ to your search path.

Updating your software components

On a regular basis, you might want to do a git pull on any or all of your software components, and rebuild anything that now needs to be rebuilt.

Return to the main NEEK page.

Personal tools