summaryrefslogtreecommitdiff
path: root/README
blob: 9e15ef04642ca075b527b5452597b3854c4a3d61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
SCRATCHBOX 2 README

author: Lauri Leukkunen <lle@rahina.org>
date:   2007-07-23



LICENSING

All files are licensed under GNU LGPL version 2.1 unless specifically 
stated otherwise in the file itself.



GENERAL NOTICE

This is development code, it is broken. Don't expect to use it for
anything resembling production use. However, I firmly believe this is
infinitely more functional than Scratchbox 1.x can ever be.



INSTALLATION

You need git to work with sbox2, get it from http://git.or.cz/.

Clone the scratchbox 2 repository:
$ git clone git://anongit.freedesktop.org/git/sbox2

Build using:
$ cd sbox2
$ make install prefix=$HOME/scratchbox


You need Qemu for cpu-transparency. Current (2007-06-18) CVS version
of Qemu works fine, earlier versions lack the -drop-ld-preload option.
Here are basic instructions for installing qemu:

1. Get a CVS snapshot from http://qemu-forum.ipi.fi/qemu-snapshots/
2. Extract that somewhere, change into the created directory
3. ./configure --prefix=$HOME/qemu --target-list=arm-linux-user
4. make && make install
5. Add $HOME/qemu/bin to your PATH

Qemu has many issues on amd64 host systems, at least when trying to
do user-space emulation of ARM. Better results can be achieved on 32bit
i386 hosts.

If you're targeting ARM and are on a 32bit x86 machine, you can get a 
good toolchain from CodeSourcery:
http://www.codesourcery.com/gnu_toolchains/arm/download.html

For amd64 systems there's a quite functional toolchain available here:
http://people.freedesktop.org/~lle/arm-lltc-gcc412-glibc25.tar.bz2

Notice! Old Scratchbox 1 toolchains don't work with sb2.

To use sb2 you need to get a rootfs for your target and put it into
some useful directory, alternatively you can copy the necessary files
into right places from your toolchain. The essential thing is that
sb2 needs FHS compliant target directory structure to work. For an example
of such a system you can look at the Maemo example later in this README.

To complete sb2 target setup:

$ mkdir $HOME/buildroot
$ cd $HOME/buildroot
[extract or copy your rootfs contents into place]
$ $HOME/scratchbox/bin/sb2-init /path/to/compiler/bin/arm-linux-gcc

That will automatically generate a working sb2.config for the compiler
given on the command line and run sb2-build-libtool script to get you a
nice working libtool for your compiler. If the sb2-build-libtool part
fails for some reason (incorrect http proxy or something similar), you
can always run it manually later.

At this point you can simply run sb2:

$ $HOME/scratchbox/bin/sb2

To make sb2 default to the $HOME/buildroot sandbox, you can put this in
your $HOME/.sb2rc:
-- snip --
SBOX_TARGET_ROOT=~/buildroot
-- snip --

Perhaps adding $HOME/scratchbox/bin to your PATH is also a good idea, put
this in your $HOME/.bashrc:
-- snip --
export PATH=$PATH:$HOME/scratchbox/bin
-- snip --

After that you can run sb2 easily from anywhere and it'll just do its magic.



MAEMO DEVELOPMENT

First install sb2 as described above, or if you're using debian testing or
unstable you can simply "apt-get install scratchbox2".

Download the latest rootstrap from:

http://repository.maemo.org/stable/3.1/armel/maemo-sdk-rootstrap_3.1_armel.tgz

Extract that to $HOME/buildroot

Edit $HOME/buildroot/etc/apt/apt.conf so that it looks like this:
-- snip --
APT {
Architecture armel;
}
-- snip --

Then get a nice toolchain from the locations mentioned above.

Edit $HOME/.sb2rc as described earlier in this README.

After that you can setup sb2 by running:

$ cd $HOME/buildroot
$ sb2-init /path/to/compiler/bin/arm-none-linux-gnueabi-gcc

Now you should have a fully functioning development environment.
To try it out you can build for example fontconfig like this:

$ sb2 apt-get source fontconfig
$ cd fontconfig-2.4.1
$ sb2 dpkg-buildpackage -rfakeroot

You don't need to be in $HOME/buildroot to do that, I typically do all
development work in $HOME/src.


That's all folks, enjoy!