1 |
From: John Poole <jlpoole@×××.net> |
2 |
Subject: [gentoo-embedded] Embedded Handbook (5)(b) clarification |
3 |
Date: Mon, 05 Oct 2009 19:18:08 -0700 |
4 |
|
5 |
> I'd like to get some clarification on the Embedded Handbook, |
6 |
> particularly Chapter 5, subsection 5(b) "Filesystem Setup" |
7 |
|
8 |
[cut] |
9 |
> |
10 |
> From |
11 |
> http://www.gentoo.org/proj/en/base/embedded/handbook/index.xml?part=1&chap=5 |
12 |
> |
13 |
> vvvvvvvvvv |
14 |
> 5.b. Filesystem Setup |
15 |
> |
16 |
> Cross-compiling a system generally involves two directory trees. The |
17 |
> first is where all development files are normally installed. This is |
18 |
> your sysroot. The other tree is where only your runtime files are |
19 |
> installed. You emerge all of your fun packages into your sysroot |
20 |
> (without trimming down any files), and then either install via binary |
21 |
> packages or copying files by hand all the stuff you need in your |
22 |
> runtime tree. |
23 |
> |
24 |
> The common convention is to use your /usr/CTARGET/ tree as your |
25 |
> sysroot as the include/library directories in this tree are already |
26 |
> encoded into the gcc cross-compiler for searching. You could use |
27 |
> another directory and then add custom -I/-L paths to your |
28 |
> CPPFLAGS/LDFLAGS, but this has historically proven to be |
29 |
> problematic. Yes, it works most of the time, but the corner cases are |
30 |
> why this method is discouraged. In the embedded handbook, we'll assume |
31 |
> you're using the sysroot as your development ROOT. |
32 |
> |
33 |
> For your runtime system, you'll need a much slimmer/trimmed-down |
34 |
> setup. The files you remove from a normal installed package is why |
35 |
> this tree is not suitable for compiling against. If you build binary |
36 |
> packages while installing into your sysroot, then you can use those |
37 |
> binary packages in conjunction with the INSTALL_MASK variable to trim |
38 |
> out most things. See man make.conf for more information. |
39 |
> |
40 |
> ^^^^^^^^^^ |
41 |
> |
42 |
> In my case, I have a CTARGET of "arm-softfloat-linux-gnueabi" so |
43 |
> "/usr/arm-softfloat-linux-gnueabi" is my sysroot. My |
44 |
> "arm-softfloat-linux-gnueabi-gcc" compiler knows to look under |
45 |
> $CTARGET. |
46 |
> |
47 |
> All questions below reference paragraph 3. |
48 |
> |
49 |
> Question #1: What does "runtime system" mean? Is that the directory |
50 |
> tree underneath /usr/$CTARGET? |
51 |
> |
52 |
"Runtime system" mean a tree containing only files required at runtime. |
53 |
Since we are doing embedded, we usually reduce as much as possible the disk |
54 |
space used by the system. |
55 |
As explain in 5.b, this is usually done with 2 trees. |
56 |
Tree 1: "sysroot": contains everything required for building packages |
57 |
Tree 2: "runtime system": contains only files required at runtime. |
58 |
|
59 |
Directory tree /usr/$CTARGET is "sysroot" |
60 |
|
61 |
> Question #2: I don't understand what you mean by "files you remove |
62 |
> from a normal installed package". |
63 |
> |
64 |
E.g: when you install a gentoo package, you have some headers files. |
65 |
Headers files are not required at runtime, so you can remove it in the "runtime |
66 |
system" tree. |
67 |
|
68 |
> Question #3: "this tree is not suitable..." What tree? |
69 |
> |
70 |
The "runtime system" tree is not suitable for compiling since usually you remove |
71 |
headers and other files not required at runtime. |
72 |
|
73 |
|
74 |
|
75 |
Regards, |
76 |
Patrice |