Linuxstamp:Buildroot
Building a Toolchain and Kernel for the Linux Stamp using Buildroot
When the Linux Stamp boots, a tiny little loader called the Darren Loader fires up, which in terms passes control to U-Boot. U-Boot's job is to locate and pass control to the Linux Kernel, which is the piece of software that sticks around, interfacing to the hardware, but at the very beginning it it responsible for locating a root file system, mounting it, and then creating the initial userland processes.
In other words, there are two distinct pieces of code that you need to supply so that the Stamp can be up and running with Linux: these two are (i) the Linux Kernel and (ii) the Linux Root File System (i.e. all the files under "/").
To be able to build any of this stuff though, you can't use the compiler you have on your x86 machine. The gcc on your x86 machine will normally generate x86 code targeted at an x86 machine. Unfortunately, the Linux Stamp doesn't have an x86 processor - it has an ARM processor. To be able to get gcc to create code that will run on the ARM processor on the Linux Stamp, you will need a cross compiler (aka toolchain) i.e. something that runs on a HOST machine and compiles to a different architecture, called the TARGET architecture. In your case, the HOST architecture is presumably x86 and your TARGET architecture is arm (which is what the Linux Stamp has on it).
That brings out list of things we have to create up to three: (i) the cross compiling toolchain (ii) the linux kernel and (iii) the root file system.
For purposes of this discussion, I'm going to assume that your desktop or server (called the "HOST") where you are going to run the compiler is an x86 machine running Ubuntu (or some other Debian based) Linux.
Getting to Hello World
This page will try and get you to the point where you will create a "Hello World" executable that you can run on your newly customized and compiled Kernel and Root File System.
Before we can do that, recaall that you will need to solve three problems: (i) toolchain (ii) kernel and (iii) root file system. Once you have all three, you will use that toolchain to (cross) compile your HelloWorld.c file into a HelloWorld ARM executable, which you can then transfer over to the Stamp's new file system and run it on the Stamp!
The beauty of Buildroot
Buildroot is a very cool set of makefiles and scripts that can do all three of these for you. For a variety of reasons though, we are going to use Buildroot to do just two of the three ... we'll use it to build the toolchain and to build the root file system. We'll build the kernel separately, because, well ... once you have the toolchain ready, recompiling the kernel is pretty straightforward and the tools that come with the kernel to build it are perfectly adequate, and it's nice to keep things simple when we can :-)
Buildroot, as the name suggests, allows you to build a root file system. What's nice about it is that it allows you to build the root file system in a self contained directory, and you wont need to build it as root! The only point where you may need to become root or use 'sudo' is to install any packages that you may not already have installed.
So, lets get started with that ... before you can use buildroot, you need to have a bunch of packages installed. On Ubuntu/Debian, you can do this as follows:
$ sudo apt-get install build-essential libncurses-dev bison flex texinfo zlib1g-dev gettext libssl-dev wget autoconf
While we're at it, let's grab a couple of utilities that will come in handy:
$ sudo apt-get install autoconf dropbear minicom lrzsz
(this is a work in progress ... to be continued)