Difference between revisions of "Hawkboard/Sandbox"

From eLinux.org
Jump to: navigation, search
(1. Using Ubuntu Rootfs)
Line 64: Line 64:
 
   *apt-get intasll rootstock
 
   *apt-get intasll rootstock
  
   sudo rootstock --fqdn MyRootFS --login <user> --password <password> --imagesize 2G --dist jaunty --serial ttyS2 --seed    ubuntu-minimal,gcc,vim,g++,openssh
+
   sudo rootstock --fqdn MyRootFS --login <user> --password <password> --imagesize 2G --dist jaunty --serial ttyS2 --seed    ubuntu-minimal,gcc,vim,g++,openssh,subversion,apt
  
 
<user> is user name
 
<user> is user name

Revision as of 23:38, 29 April 2010

Linux Programmer’s Guide

Prereusitive

This guide assume ,basic knowlege of Kernel(uImage) and RootFS Please go through Beginners guide ,if you arent aware of this term


Introduction to Toolchain

Toolchain are Chain or set of programming tools for building an apps , it could include following :

  • Editor for writing program
  • Assembler
  • Compiler
  • Preprocessor
  • Linker loader
  • Debugger
  • Binutils etc.


Toolchain Type

a)Native toolchain

Native toolchains are tools which makes binaries for the environment where it toolchain itself is being run.i.e Host and target are same platform. This type of Compilation process is called Native compilation .Meaning that the program is compiled on same platform where it has to be run. Similar to normal PC based program ,they are compiled and run on same machine.

It is much easier to program using this method as it doesn’t involve any Makefile changes.

Earlier embedded devices had very less memory and space and also limited supports of Input-output peripherals, hence Native compilation was not possible or very difficult. But with the advent of powerful embedded ARM processor its now possible to make application on the platform itself. Same can be done in Hawk board too. But still it will be slower to compile as in X86 machine.

e.g. Normal GCC Toolchain in x86 Linux machine is a Native toolchain.

b)Croos Toolchain

Toolchain which are used to compile the application that will run of different machine(architecture) .This is usually used for embedded apps (e.g ARM programming) You program in x86 environment and run in ARM Board. This type of compiling is called cross compiling

Since native compilation is either not possible or very slow ,Cross compilation present a better alternative for faster development .Only drawback is to properly set build environment and Makefiles.

c)Hybrid Toolchain

It similar to native toolchain,but infact toolchain run in virtualised environment on Host.Simple example is QEMU -ARM Running on X86 Linux & you are developing application on this Virtual environment.

This has advantage of both Native and Cross compilation.Speed of cross compilation & Ease of Native development.

Various solution exists, One is scratchbox ,another is ChrootEABI feature in Ubuntu.


Native Toolchain & Compilation

There are various ways solution to compile the application natively on hawkboard.

1. Using Ubuntu Rootfs

Rootstock script in Ubuntu provides a easy way of making Root Filesystem give gcc,vi,g++ as 'seed parameter to rootstock command and you will have a GNU Toolchain inside the rootfs.

Then like write/compile/run as you do for x86 program.

This needs rootstock to installed on Ubuntu (9.10)

 *apt-get intasll rootstock
 sudo rootstock --fqdn MyRootFS --login <user> --password <password> --imagesize 2G --dist jaunty --serial ttyS2 --seed    ubuntu-minimal,gcc,vim,g++,openssh,subversion,apt

<user> is user name <password> is password that will be required once this rootfs is booted on hawkboard

imagesize is max size allocated to rootfs.you can keep it same as ur USB Drive /SD card .

Seed parameter tells which packages to be included in rootfs.include atleast gcc,vim (any editor),build-essential packages.

This will take couple of hours to completely download packages you have mentioned and to make a rootfs.

After completion of command it will create some file such as

armel-rootfs-2010xxxxxxxx.tgz 

This is compressed rootfilesytem extract it on a SD card or NFS Folder and boot using one of the method described in beginners/guide

sudo tar xfp armel-rootfs-**********.tgz
sudo chown -R root.root *
sudo chmod -R 777