14
Juha Tukkinen / November 2007 code in your hands Development Environment Juha Tukkinen / November 2007

Maemo Development Environment

Embed Size (px)

DESCRIPTION

maemo development environment

Citation preview

Page 1: Maemo Development Environment

Juha Tukkinen / November 2007

code in your hands

Development Environment

Juha Tukkinen / November 2007

Page 2: Maemo Development Environment

Juha Tukkinen / November 2007

code in your hands

Content• development

environment overview

• how to install

• tools

• supported runtimes

• software porting examples

Page 3: Maemo Development Environment

Juha Tukkinen / November 2007

code in your hands

Development environment overview

•The problem: Open source projects use GNU configure build system

•a developer creates GNU M4 macros•configure script gets generated by GNU Automake

and GNU Autoconf•…which produce Makefiles and a config.h

Page 4: Maemo Development Environment

Juha Tukkinen / November 2007

code in your hands

Development environment overview

•So what’s wrong with this?•configure assumes that the target environment

will be the same as the compilation host environment

•compilation natively on an Internet Tablet is not… optimal

Page 5: Maemo Development Environment

Juha Tukkinen / November 2007

code in your hands

Development environment overview

•A solution: Scratchbox•a cross-compilation environment•a sandbox put together by wrappers, black magic

and symbolic links•makes use of QEMU as a machine emulator (not

as a virtualizer)

Page 6: Maemo Development Environment

Juha Tukkinen / November 2007

code in your hands

Scratchbox

Page 7: Maemo Development Environment

Juha Tukkinen / November 2007

code in your hands

Scratchbox and maemo SDK

•Scratchbox provides a sandboxed cross-compilation development environment (chroot on steroids)

•maemo SDK is installed inside Scratchbox•maemo SDK provides two targets for Scratchbox:

•X86 used for active development•ARMEL for cross-compilation, QEMU also provides CPU

transparency

•maemo SDK also provides closed Nokia binaries separately

Page 8: Maemo Development Environment

Juha Tukkinen / November 2007

code in your hands

Scratchbox under the hood

• target: has a root file system, uses a toolchain

• devkit: tools native to host

• toolchain: compiler, linker, binutils…

• rootstrap: root file system for the target device

• CPU transparency (cputransp devkit)

• maemo SDK provides two preconfigured targets: SDK_X86 and SDK_ARMEL

Page 9: Maemo Development Environment

Juha Tukkinen / November 2007

code in your hands

Tools inside Scratchbox (to list some)• GNU toolchain for ARM processors• debugger: gdb• tracing tools: strace, ltrace• valgrind: suite of tools for debugging and profiling

• memcheck – memory management detector• cachegrind – cache profiler• callgrind – extra information of call graphs to the above

• massif – heap profiler• helgrind – thread debugger

Page 10: Maemo Development Environment

Juha Tukkinen / November 2007

code in your hands

How to install maemo SDK• SDK depends on Scratchbox that is only available for Linux

• installer script installs both Scratchbox and SDK• alternative solution: VMWare image

• can be used also in Windows• Ubuntu Linux Desktop with maemo SDK installed

• do not get confused: you run a virtualized Linux PC inside a Windows operating system and inside the virtualized Linux you run Scratchbox

Page 11: Maemo Development Environment

Juha Tukkinen / November 2007

code in your hands

Supported runtimes• official supported language is C

• Python

• C++

• C# through Mono

• Java

• Ruby

• …

• ITOS has Gecko 1.9 and Flash 9: “Web 2.0” runtime

Page 12: Maemo Development Environment

Juha Tukkinen / November 2007

code in your hands

Hacking session – see README.TXT1. Install VMware player

2. Unzip Ubuntu-maemo-sdk.zip

3. Start the virtual Ubuntu Gutsy Desktop

4. Start Xephyr (the spring icon in the top toolbar)

5. Start a Terminal

6. Start Scratchbox by typing scratchbox

7. Start the application framework: af-sb-init.sh start

Change targets (SDK_X86 and SDK_ARMEL) with sb-menu

/scratchbox/users/maemo/home/maemo (outside)

/home/maemo (inside Scratchbox)

Page 13: Maemo Development Environment

Juha Tukkinen / November 2007

code in your hands

Hacking session – things to try1. install “xterm” and “ssh server” on the N800

http://maemo.org/download

2. Compile maemo-examples in SDK_X86

make

3. Run some maemo-examples in SDK_X86

run-standalone.sh ./example

4. Compile maemo-examples in SDK_ARMEL

5. Run some examples in SDK_ARMEL

6. Copy binaries to N800 and run them there

7. Examine and try out examples, dosbox and frodo

8. Try out the python environment

python2.5

Page 14: Maemo Development Environment

Juha Tukkinen / November 2007

code in your hands

Thank you!