 |
JamMo - Jamming mobile game for kids. |
 |
Setting crosscompiling environment
This instructions are for installing scratchbox2 on Ubuntu 9.10.
Prerequirements: Ubuntu 9.10 (On virtual machine or real computer, doesn't matter,
Live-CD doesn't have enough free disk space.)
What you should know before: With Ubuntu do not log in as root (administrator). When making
maintenance use user which belongs to adm-group and all time 'sudo' is used, give your own password.
Purpose of all these: After these steps you can compile applications that will work on Nokia N900.
Step 1: 'maemo-sdk'
Step 1A: Install 'maemo-sdk'
#add one repository to your Ubuntu (you can do it via package manager as well)
echo 'deb http://maemo-sdk.garage.maemo.org/download/host ubuntu-karmic free' | sudo tee -a /etc/apt/sources.list
#update lists
sudo apt-get update
#Install maemo-sdk (you will get also: maemo-sdk-libs, maemo-libtool,sbrsh, sb2-qemu-arm, scratchbox2)
#Total amount of download: ~70MB (depending what you have installed on your system).
sudo apt-get install maemo-sdk
Step 1B: Testing 'maemo-sdk'
Now you have application named 'maemo-sdk' installed, it is commandline tool and can be started
with regular user, but some function needs sudo.
Start it by typing 'maemo-sdk'.
It looks almost this: (different versions have different entries)
maemo SDK v. 0.9.99.37
(C) Copyright 2008 by Nokia Corporation
0 ... exit to exit the command selection
1 ... install to install a rootstrap, tools, toolchain etc.
2 ... remove to remove a roostrap, tools, toolchain etc.
3 ... show to show value of a setting
4 ... set to set the default rootstrap, toolchain, tool etc.
5 ... start to start simulated graphical user interface
6 ... stop to stop simulated graphical user interface
7 ... enter to enter runtime, tools environment etc.
8 ... reload to reload rootstrap index, tools configurations etc.
9 ... list to list installed rootstraps, tools or toolchains
10 ... check to check updates for an index (rootstrap, tools etc.)
11 ... backup to take a backup of a rootstrap or tools environment
12 ... restore to restore a backup
13 ... help to show help
Which maemo SDK command you would like to execute (0..13)?
And then you can give your choise with typing numbers. But you can also start it
with: "maemo-sdk install", which is equivalent as starting it with "maemo-sdk" and give '1' in first menu.
It looks like this:
0 ... exit To exit selection
1 ... rootstrap To install a rootstrap
2 ... toolchain To install a toolchain
3 ... tools To install build tools environment
4 ... binaries To install binary-only packages
5 ... sbrsh To install sbrsh configuration
And you can continue this shortcutting "maemo-sdk install toolchain"
is equivalent as starting it with "maemo-sdk" and give '1' in first menu and '2' in second menu.
Step 2: Tools, Toolchain, Rootstrap
Crosscompiler needs three things to be installed: Tools, Toolchain, Rootstrap
Step 2A: Install Tools
#Tools (installed size over 700MB) are installed with sudo:
sudo maemo-sdk install tools lenny-2009-1
Step 2B: Install Toolchain
#Toolchain (Download size 75MB) is installed with sudo:
sudo maemo-sdk install toolchain arm-2007q3
Step 2C: Install Rootstrap
#Rootstrap (Download size 37mb) is installed without sudo:
maemo-sdk install rootstrap fremantle5.0minimal_armel
Step 2D: Checking status
You can have many rootstrap/tools/toolchain installed, but only one use in a time.
You can check all these values with maemo-sdk show:
maemo-sdk show rootstrap
maemo-sdk show tools
maemo-sdk show toolchain
And you change them with 'maemo-sdk set'.
If you had already installed maemo-sdk and there are no fremantle rootstrap in list use:
maemo-sdk reload catalogue
Step 3: Testing it is working
Step 3A: First test
Go 'inside scratchbox2':
sb2
It should say: [SB2 emulate fremantle5.0minimal_armel] user@host $
If you type 'ls' you see same files than you see 'outside sb2'. So this is not virtualmachine, do not mess with it.
Type 'exit' to go back.
Step 3B: Second test
sb2 -R
#'R' means root access. You don't need sudo. Actually: never start sb2 with sudo!
Now it says: [SB2 emulate fremantle5.0minimal_armel] root@host $
You are root of this emulated environment, not your Ubuntu.
Type 'exit' to go back.
Step 3C: Package management test
Maemo uses 'apt' like your Ubuntu, don't be confused where you are installing packages.
You don't need to go inside box, you can execute commands from outside.
This is good place to update package list for scratchbox.
sb2 -e apt-cache search maemopad
sb2 -eR apt-get update
sb2 -e apt-cache search maemopad
-e stands for 'emulate' and should be used.
Step 4: Compile HelloWorld
#Make hello.c
echo 'int main(){ printf("Hello\n"); return 0;}' > hello.c
#compile it with sb2
sb2 -e gcc hello.c -o hello.out
#check what type of file is produced
file hello.out
#it should say: hello.out: ELF 32-bit LSB executable, ARM, version 1 (SYSV), ...
Now you have working crosscompiler environmet installed!
Contacts
Aapo.Rantalainen
(at)gmail.com