Gentoo Archives: gentoo-embedded

From: Jason <gentoo@××××××××××.net>
To: gentoo-embedded@l.g.o
Subject: Re: [gentoo-embedded] multiple projects, one toolchain, on same host
Date: Sat, 20 Oct 2007 20:33:56
Message-Id: 471A62D6.4000603@lakedaemon.net
In Reply to: Re: [gentoo-embedded] multiple projects, one toolchain, on same host by Mike Frysinger
1 Mike Frysinger wrote:
2 > On Friday 19 October 2007, Jason wrote:
3 >> If I have two projects which use the same toolchain, is it sufficient to
4 >> do the following?
5 >>
6 >> crossdev --target armeb-softfloat-linux-gnu
7 >> SYSROOT=/usr/armeb-softfloat-linux-gnu
8 >>
9 >> Set up SYSROOT with make.globals, and so on
10 >>
11 >> mkdir /usr/armeb-softfloat-linux-gnu-nslu2
12 >> cp -ax /usr/armeb-softfloat-linux-gnu/* \
13 >> /usr/armeb-softfloat-linux-gnu-nslu2/
14 >>
15 >> Then repeat for the second armeb project.
16 >
17 > mmm not quite ... the SYSROOT is for the system packages which implies no
18 > tailoring should really be done. TGTROOT is where all customization should
19 > be done. if you want to do the customization in the SYSROOT, then it'd be
20 > better to have separate sysroots ... so something like:
21 > /usr/armeb-booga1_softfloat-linux-gnu/
22 > /usr/armeb-booga2_softfloat-linux-gnu/
23 > these are tuples that'll work with crossdev:
24 > crossdev --target armeb-booga1_softfloat-linux-gnu
25
26 So, my xmerge script (based on [1]) should look like this:
27
28 ###############
29 #!/bin/bash
30 CBUILD=$(portageq envvar CHOST)
31 PORTAGE_CONFIGROOT="${TGTROOT}"
32 ROOT="${TGTROOT}"
33 export CBUILD PORTAGE_CONFIGROOT ROOT
34
35 emerge $*
36 ###############
37
38 And when I set up my environment, I do the following:
39 # mkdir -p ${TGTROOT}/etc/portage/profile
40 # vim ${TGTROOT}/etc/make.conf
41 # cp /etc/make.globals ${TGTROOT}/etc/
42 # ln -sn /usr/portage/profiles/path/to/profile \
43 ${TGTROOT}/etc/make.profile
44
45 Finally, xkmake:
46
47 ##########
48 #!/bin/bash
49 source ${TGTROOT}/etc/make.conf
50 XARCH="${ARCH}"
51 XCC="${CHOST}-"
52 make ARCH="${XARCH}" CROSS_COMPILE="${XCC}" \
53 INSTALL_MOD_PATH="${TGTROOT}" $*
54 ##########
55
56 And my target image building script can strip out
57 ${TGTROOT}/usr/{src,include} and ${TGTROOT}/etc/portage from the image
58 since I don't need them at runtime.
59
60 Would this configuration mean I don't have to xmerge build dependencies
61 twice (Once to SYSROOT and then the TGTROOT)?
62
63 It's good to know that crossdev will handle '*-booga1_softfloat-*-*'
64 correctly, but I don't see the point of building three copies of the
65 exact same toolchain for three different projects. Unless there's
66 something else crossdev is doing for me that I'm missing in the above.
67 Am I?
68
69 If I set PORTAGE_CONFIGROOT=TGTROOT, will portage look at TGTROOT for
70 build dependencies or still go to SYSROOT?
71
72 It looks like this boils down to me wanting to have multiple, unique
73 target images (and portage configs) for a given cross toolchain and by
74 default, crossdev sets up SYSROOT as a single target image and portage
75 config per toolchain. Does what I've outlined above correctly work
76 around this?
77
78 I think I'm missing something magical about SYSROOT. :-)
79
80 thx,
81
82 Jason.
83
84 [1] - http://www.gentoo.org/proj/en/base/embedded/cross-development.xml
85 --
86 gentoo-embedded@g.o mailing list