Gentoo Archives: gentoo-embedded

From: Bertrand Jacquin <beber@××××××××.net>
To: gentoo-embedded@l.g.o
Subject: Re: [gentoo-embedded] multi-project workflow
Date: Fri, 02 Mar 2012 00:08:37
Message-Id: 20120301231115.GE29220@lemonhead.scabb
In Reply to: [gentoo-embedded] multi-project workflow by Jason
1 Hi,
2
3 This is a good question that I try to resolv for some times, and
4 actually here is the solution I use.
5
6 For my use, this is a bit more complex than one toolchain for multiple
7 projects as I use different toolchains for one project, and have many
8 projects.
9
10 So I decline this in (what I call) PLATFORM and VARIANT that I call
11 PLATFORM-VARIANT.
12
13 PLATFORM is generally a hardware type and VARIANT the main project.
14
15 For exemple I have :
16
17 - PLATFORM=alix3-i586 VARIANT=maintenance that use i586-pc-linux-gnu- toolchain
18 - PLATFORM=alix3-i586 VARIANT=firmware that use i586-pc-linux-uclibc- toolchain
19
20 Toolchains are created with crossdev (without any patches or specific
21 things).
22
23 Then my bunch of scripts. This is a not really completed and some parts
24 are hardcoded (aka ROOT=/data/cross).
25
26 Once toolchains are made, I use variant-init that create :
27
28 $ROOT/$PLATFORM/$VARIANT/etc
29 $ROOT/$PLATFORM/$VARIANT/etc/make.profile -> /usr/portage/profiles/embedded
30 $ROOT/etc/portage/make.conf-$PLATFORM-$VARIANT
31 $PLATFORM-$VARIANT-emerge -> emerge-wrapper
32 $PLATFORM-$VARIANT-q -> wrapper-q
33 $PLATFORM-$VARIANT-etc-update -> wrapper-etc-update
34
35 The ROOT for each project is /data/cross/$PLATFORM/$VARIANT
36
37 $PLATFORM-$VARIANT-q and $PLATFORM-$VARIANT-etc-update are simple
38 wrapper to q and etc-update that performs things in ROOT.
39
40 All the portage configuration goes into $ROOT/etc to simplify things,
41 let's talk later about how to have specific things for PLATFORM and
42 VARIANT.
43
44 $PLATFORM-$VARIANT-emerge (the symlink) is mostly a wrapper to emerge-wrapper from
45 crossdev that export some variables :
46
47 - PORTAGE_CONFIGROOT=/data/cross/$PLATFORM/$VARIANT
48 - ROOT
49 - SYSROOT
50 - original CHOST and ELIBC
51
52 This is also responsible to sync /data/cross/etc/portage to
53 /data/cross/$PLATFORM/$VARIANT/etc/portage with some variances :
54
55 All files in /data/cross/etc/portage that have leading name
56 *-$PLATEFORM-$VARIANT are priorise, then *-$PLATEFORM
57
58 So I get then following in my /data/cross/etc/portage :
59
60 /data/cross/etc/portage/package.use/app-shells
61 /data/cross/etc/portage/make.conf-alix3-i586-firmware
62 /data/cross/etc/portage/make.conf-alix3-i586-maintenance
63 /data/cross/etc/portage/make.conf-desktop-lemonhead
64 /data/cross/etc/portage/make.conf-kvm32-firmware
65 /data/cross/etc/portage/make.conf-kvm32-maintenance
66 /data/cross/etc/portage/package.mask/sys-apps-alix3-i586-firmware
67 /data/cross/etc/portage/package.mask/sys-apps-kvm32-firmware
68 ..
69
70 In this case, if I call alix3-i586-firmware-emerge then only
71 /data/cross/etc/portage/make.conf-alix3-i586-firmware is move in
72 /data/cross/alix3-i586/firmware/etc/portage/make.conf, all other are
73 ignored
74
75 This is to simplify portage configuration tree and avoid effort
76 duplication.
77
78 Then I have a specific make.conf that is sourced by all others for the
79 same reason. Specific things are done in each VARIANT make.conf, generic
80 in main one.
81
82 Specific set CHOST, ARCH, E_MACHINE, ELIBC, USE and CFLAGS
83
84 While generic have all the rest :
85 - CBUILD
86 - HOSTCC
87 - FEATURES : collision-protect sandbox buildpkg noman noinfo nodoc
88 -news -assume-digests fixlafiles
89 - ROOT
90 - SYSROOT
91 - CFLAGS
92 - CXXFLAGS
93 - LDFLAGS
94 - PKGDIR
95 - PORTAGE_TMPDIR
96 - PKG_CONFIG_PATH
97 - PORTDIR
98 - DISTDIR
99 - EMERGE_DEFAULT_OPTS
100 - MAKEOPTS
101 - GENTOO_MIRRORS
102 - FETCHCOMMAND
103 - ...
104
105 SYSROOT is always crossdev tree (for libtool and default gcc options).
106 See #404529
107
108 While packages are build for ROOT with a SYSROOT different to ROOT, I
109 use a specific bashrc that determin package SYSROOT dependencies and
110 unpack .so .a and .h files to $SYSROOT (/usr/<toolchain>) as all my
111 builded packages are FEATURES=buildpkg
112
113 I keep trace of unpacked files and remove them from SYROOT at the end
114 (with some exclusion (glibc, bintuils, linux-headers, gcc ...)).
115
116 And another tool toolchain-clean that list unknown files in SYSROOT to
117 keep things clean.
118
119 It also fix .la files to use the SYSROOT as ROOT
120
121 This bashrc also rsync $PORTAGE_CONFIGROOT/etc/portage/files to $D for
122 generic configuration files or others things that are unrelated to
123 generic gentoo utilisation.
124
125 I added some features to sstrip files and/or upx them, you just have to
126 declare do_upx or do_sstrip in env portage files.
127
128 All the things I use are available in a tar tree here :
129
130 http://people.meleeweb.net/~beber/gentoo/boest-gentoo.tgz
131
132 Comments are welcome !
133 Beber
134
135 D'ar lun 23 a viz Genver 2012 e 00 eur 37, « Jason » he deus skrivet :
136 > All,
137 >
138 > I'm getting back into embedded projects and thus, gentoo/crossdev.
139 > Things have changed a bit since I last used it (~4 years ago). This:
140 >
141 > $ crossdev -S -t arm-none-linux-gnueabi
142 >
143 > worked out of the box. Awesome! It looks like I'll want to use
144 > arm-none-linux-gnueabi-emerge to build the target system, but before I
145 > get started, I have a question.
146 >
147 > How do folks out there handle multiple projects with the same toolchain?
148 > I'm thinking, since crossdev worked so well, to just build a
149 > 'arm-projectA-linux-gnueabi' and then 'arm-projectB-linux-gnueabi' to
150 > keep the roots separate.
151 >
152 > My other idea was use symlinks:
153 >
154 > /usr/
155 > arm-none-linux-gnueabi/ -> projectA/
156 > arm-none-linux-gnueabi.orig/
157 > projectA/
158 > projectB/
159 > ...
160 > projectN/
161 >
162 > with arm-none-linux-gnueabi.orig/ being the original contents after
163 > crossdev built the toolchain. As I create projects, I would 'cp -a
164 > arm....orig/* projectN/'
165 >
166 > What do you guys use?
167 >
168 > thx,
169 >
170 > Jason.
171 >
172
173 --
174 Beber

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-embedded] multi-project workflow Ed W <lists@××××××××××.com>