News:

Registered a URL and setup a forum as the IPCam stuff really needed its own site vs my irregular blog posts about IPCam hacking at http://www.computersolutions.cn/blog

Author Topic: Setting up a build environment  (Read 9462 times)

  • No avatar
  • *****
February 03, 2011, 04:28:32 am
While the uClinux developers have done a great job of making an updated embedded OS based on the Linux kernel, they haven't done such a great job on documenting it.

I'm going to assume a debian based OS for the following.

Suggest download a prebuilt Debian GUI based OS if you aren't familiar with Debian, Linux Mint is a good clean version that has its heart in the right place.

Download that here: http://www.linuxmint.com/download_lmde.php

Assuming you now have that installed, we can continue.

In order to compile uClinux, we first need to install a cross compiler.
Unfortunately there are many different incompatible arm gcc cross-compilers, so we need one that works with our uClinux version.  Unfortunately this seems to be a bit trial and error, which is sucky.


The most current arm cross compiler's are located here -
http://ftp.snapgear.org/pub/snapgear/tools/arm-linux/arm-linux-tools-20080623.tar.gz
and here
http://www.codesourcery.com/sgpp/lite/arm/portal/package7795/public/arm-uclinuxeabi/arm-2010.09-58-arm-uclinuxeabi.bin


So, our first step is to download one, and install.
As this is a large file, we're going to use a download accelerator called Axel.
Open up a terminal window, and type in the following


Code: [Select]
sudo su
mkdir /home/downloads
cd /home/downloads
apt-get install axel
axel http://ftp.snapgear.org/pub/snapgear/tools/arm-linux/arm-linux-tools-20080623.tar.gz

sudo su - tells the computer that we want to run as root user.  We need to do this as the tools require us to be root to install.
mkdir /home/downloads, cd /home/downloads - we make our download folder, and change into it.
apt-get install axel - we install axel (our download accelerator).
Lastly, we download the ucLinux compiler tools.  This will take a while as its quite large.

Go have a cup of coffee and come back  :D

As uClinux has changed the way they do their xwindows configuration, we also need to install some extra libraries in our OS to cater for this.  Install tk, ncurses, and libglade2 with the following command.

Code: [Select]
apt-get install tk  libglade2-dev ncurses-dev
This will also add a whole bunch of other prerequisites to be downloaded.  Say yes, and go get another coffee while this all downloads and installs.

Lastly, we need the most current uClinux files.
Go here - http://sourceforge.net/projects/uclinux/files/  and copy the link for the latest version.
At time of writing, this was http://sourceforge.net/projects/uclinux/files/uClinux%20Stable/dist-20090618/uClinux-dist-20101026.tar.bz2/download 
Copy the link, and click back in the terminal window.

Code: [Select]
axel http://downloads.sourceforge.net/project/uclinux/uClinux%20Stable/dist-20090618/uClinux-dist-20101026.tar.bz2?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fuclinux%2Ffiles%2F&ts=1296724513&use_mirror=ufpr
Quote
Note:  You can also get the CVS version of uClinux, but I recommend compiling from the Stable edition.

If you've been following, so far we should have the ARM compiler tools, uClinux distribution in our /home/downloads folder.  We've also installed a few required bits and pieces into our OS.

Our next step is to start installing..
Just to be safe, I make sure that we're root, and in the correct folder prior to starting (the arm-linux-tools expects to be run from the root folder)

Code: [Select]
sudo su
cd /
tar -xzvf /home/downloads/arm-linux-tools-20080623.tar.gz

You'll see a whole lot of lines flying by the terminal window, and eventually it will complete.
This will have installed the arm compiler tools into /usr/local/bin for you.

Next, we'll need to decompress the uClinux distribution somewhere appropriate.  I use /home/uClinux-dist, so lets use that.

Code: [Select]
cd /home
tar -xjvf downloads/uClinux-dist-20101026.tar.bz2

You should have a folder under home called uClinux-dist now.
Lets change into that folder.

Code: [Select]
cd uClinux-dist
ls -al

You should see something similar to the following:

minty uClinux-dist # ls -al
total 152
drwxrwxr-x  17  500  500  4096 Feb  3 13:33 .
drwxr-xr-x   6 root root  4096 Feb  3 13:33 ..
drwxrwxr-x   2  500  500  4096 Oct 26 12:02 bin
drwxrwxr-x   3  500  500  4096 Oct 26 12:02 config
-rw-rw-r--   1  500  500 18007 Nov 22  1999 COPYING
drwxrwxr-x   3  500  500  4096 Oct 26 11:59 Documentation
drwxrwxr-x  11  500  500  4096 Oct 26 12:00 freeswan
drwxrwxr-x   2  500  500  4096 Oct 26 12:00 glibc
drwxrwxr-x   2  500  500  4096 Oct 26 12:01 include
-rw-r--r--   1 root root 26903 Feb  3 13:00 Kconfig
drwxrwxr-x  51  500  500  4096 Oct 26 12:02 lib
drwxrwxr-x  15  500  500  4096 Oct 26 11:59 linux-2.0.x
drwxrwxr-x  16  500  500  4096 Oct 26 11:59 linux-2.4.x
drwxrwxr-x  23  500  500  4096 Oct 26 12:02 linux-2.6.x
-rw-rw-r--   1  500  500 15412 Oct 21 08:28 Makefile
drwxrwxr-x  18  500  500  4096 Oct 26 12:00 openswan
-rw-rw-r--   1  500  500  5613 Apr 10  2008 README
-rw-rw-r--   1  500  500  1743 Jan 21  2004 SOURCE
drwxrwxr-x   8  500  500  4096 Oct 26 12:01 tools
drwxrwxr-x  17  500  500  4096 Oct 26 12:00 uClibc
drwxrwxr-x 283  500  500 12288 Oct 26 12:02 user
drwxrwxr-x  71  500  500  4096 Oct 26 12:02 vendors


Lets check if everything is setup.

Code: [Select]
make xconfig

You should see a few lines of compiler code, and a new window popup on the desktop, saying uClinux Distribution.
If you do, well done, our environment is setup.

Take a look at the configuration options in the window to see whats available (but don't save any changes yet!).

If you don't see a window popup, check you've added the tk and libglade2 libraries, and have downloaded all the items above.  The terminal window should show you what went wrong.  If you're having issues, reply, and I'll see if I can help.

Assuming all went well though, we now have a build environment setup.

Well done!
« Last Edit: February 03, 2011, 09:35:45 am by admin »