/[gentoo]/xml/htdocs/proj/en/gentoo-alt/prefix/bootstrap-solaris.xml
Gentoo

Contents of /xml/htdocs/proj/en/gentoo-alt/prefix/bootstrap-solaris.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.13 - (show annotations) (download) (as text)
Fri Sep 7 15:38:27 2007 UTC (6 years, 10 months ago) by grobian
Branch: MAIN
Changes since 1.12: +2 -2 lines
File MIME type: application/xml
Fix self links

1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
3 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/proj/en/gentoo-alt/prefix/bootstrap-solaris.xml,v 1.12 2007/08/15 17:04:25 grobian Exp $ -->
4
5 <guide link="/proj/en/gentoo-alt/prefix/bootstrap-solaris.xml" lang="en">
6 <title>Gentoo Prefixed Portage Bootstrap Process for Solaris</title>
7
8
9 <author title="Author">
10 <mail link="grobian@gentoo.org">Fabian Groffen</mail>
11 </author>
12
13 <abstract>
14 How to bootstrap Prefixed Portage on your Solaris system
15 </abstract>
16
17
18 <!-- The content of this document is licensed under the CC-BY-SA license -->
19 <!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
20 <license/>
21
22 <version>1.3</version>
23 <date>2007-08-15</date>
24
25 <chapter>
26 <title>Bootstrapping on Solaris 10</title>
27
28 <section><!-- {{{ Introduction -->
29 <title>Introduction</title>
30 <body>
31 <p>
32 Bootstrapping on Solaris 10 is relatively simple, if you
33 compare it to its predecessors. It comes with bash3 and a
34 gcc-3.4.3 compiler by default, and with the download manager
35 wget. If you still are in the process of installing Solaris
36 10, make sure you install wget, to make things easier later on.
37 </p>
38 <p>
39 Solaris is one of the more "Spartan" platforms to bootstrap
40 on, and for sure not as easy as for instance a Linux
41 distribution or Mac OS X. However, don't despair when things
42 go wrong, it's just known to be hard(er), but not impossible.
43 </p>
44 </body>
45 </section><!-- }}} -->
46
47 <section><!-- {{{ Bootstrapping -->
48 <title>Bootstrapping</title>
49 <body>
50 <p>
51 As prerequisite, you have to have <c>gcc</c> and <c>wget</c>
52 installed. If you didn't install <c>wget</c>, you have to
53 acquire the necessary files in another way, e.g. via a brower,
54 NFS, or <c>scp</c>.
55 </p>
56 <note>
57 <c>wget</c> and <c>gcc</c> are usually located in
58 <path>/usr/sfw/bin</path>.
59 </note>
60 <p>
61 The first step is to chose a path to install into. We refer
62 to this path as "prefix path", stored in the variable
63 <c>$EPREFIX</c>. Some suggestion for your prefix path is
64 <path>$HOME/gentoo</path>.
65 Whatever you chose, make sure you set it in your environment:
66 </p>
67 <pre caption="Export EPREFIX variable">
68 $ <i>export EPREFIX="$HOME/gentoo"</i>
69 </pre>
70 <note>
71 tcsh users can use <c>setenv EPREFIX "$HOME/gentoo"</c>
72 instead.
73 </note>
74 <p>
75 Next, add the following paths in your soon to be prefix to
76 your <c>PATH</c> environment.
77 <path>$EPREFIX/bin</path>,
78 <path>$EPREFIX/usr/bin</path>,
79 <path>$EPREFIX/tmp/bin</path> and
80 <path>$EPREFIX/tmp/usr/bin</path>.
81 Adding these paths makes sure that they will be available
82 later on in the process.
83 Additionally, you need the following paths to find the gnu
84 compiler, linker, make and some other tools:
85 <path>/usr/sfw/bin</path>,
86 <path>/usr/sfw/i386-sun-solaris2.10/bin</path>,
87 <path>/usr/bin</path> and <path>/bin</path>.
88 </p>
89 <pre caption="Add prefix and utility paths to your PATH">
90 $ <i>export PATH="$EPREFIX/usr/bin:$EPREFIX/bin:$EPREFIX/tmp/usr/bin:$EPREFIX/tmp/bin:/usr/sfw/bin:/usr/sfw/i386-sun-solaris2.10/bin:/usr/bin:/bin"</i>
91 </pre>
92 <note>Solaris 10/Sparc users need
93 <path>/usr/sfw/sparc-sun-solaris2.10/bin</path> instead of
94 <path>/usr/sfw/i386-sun-solaris2.10/bin</path></note>
95 <p>
96 Now the path is set, start with downloading the bootstrap
97 script from
98 <uri>http://overlays.gentoo.org/proj/alt/browser/trunk/prefix-overlay/scripts/bootstrap-prefix.sh?format=txt</uri>.
99 From the directory where the bootstrap script was stored execute
100 the following commands:
101 </p>
102 <pre caption="Use the bootstrap script">
103 $ <i>chmod 755 bootstrap-prefix.sh</i>
104 $ <i>./bootstrap-prefix.sh $EPREFIX tree</i>
105 $ <i>./bootstrap-prefix.sh $EPREFIX/tmp wget</i>
106 $ <i>./bootstrap-prefix.sh $EPREFIX/tmp sed</i>
107 $ <i>./bootstrap-prefix.sh $EPREFIX/tmp python</i>
108 $ <i>./bootstrap-prefix.sh $EPREFIX/tmp coreutils</i>
109 $ <i>./bootstrap-prefix.sh $EPREFIX/tmp findutils</i>
110 $ <i>./bootstrap-prefix.sh $EPREFIX/tmp tar</i>
111 $ <i>./bootstrap-prefix.sh $EPREFIX/tmp patch</i>
112 $ <i>./bootstrap-prefix.sh $EPREFIX/tmp grep</i>
113 $ <i>./bootstrap-prefix.sh $EPREFIX/tmp gawk</i>
114 $ <i>./bootstrap-prefix.sh $EPREFIX portage</i>
115 </pre>
116 <note>Please note that <c>wget</c>, <c>sed</c>, etc. are
117 installed in <path>$EPREFIX/tmp</path>!</note>
118 <p>
119 The script will setup the <path>$EPREFIX</path>
120 directory, download a portage tree snapshot, unpack it and
121 download and install portage. Afterwards it will try to setup
122 some sane defaults. We continue with a little hack necessary
123 for a successful bootstrap:
124 </p>
125 <pre caption="Setup ld directions">
126 $ <i>export LDFLAGS="-L${EPREFIX}/usr/lib -R${EPREFIX}/usr/lib -L${EPREFIX}/lib -R${EPREFIX}/lib"</i>
127 $ <i>export CPPFLAGS="-I${EPREFIX}/usr/include"</i>
128 </pre>
129 <p>
130 Because we installed some new applications, we will instruct
131 bash to reconsider all paths we have:
132 </p>
133 <pre caption="rehash in bash">
134 $ <i>hash -r</i>
135 </pre>
136 <note>
137 tcsh users can use the <c>rehash</c> command.
138 </note>
139 <p>
140 We continue adding some necessary tools which will deal with
141 many errors and warnings you might see during emerging.
142 </p>
143 <pre caption="emerge sed">
144 $ <i>emerge --oneshot "=sys-apps/sed-4.1.4*"</i>
145 </pre>
146 <p>
147 Next, we emerge the <c>bash</c> shell and its dependency
148 ncurses. <c>bash</c> is used extensively within portage and
149 other applications.
150 </p>
151 <pre caption="emerge bash">
152 $ <i>emerge --oneshot bash</i>
153 </pre>
154 <note>
155 It is safe to ignore the "1 config files in XXX need updating"
156 message that appears till the end of the bootstrap process.
157 </note>
158 <p>
159 Because Solaris has a real <c>sh</c>, which is not bash, some
160 packages -- in particular <c>gcc</c> starting from version
161 4.1.2 -- will fail to configure. Now we have a real
162 <c>bash</c>, we will use it.
163 </p>
164 <pre caption="set config shell">
165 $ <i>export CONFIG_SHELL="${EPREFIX}/bin/sh"</i>
166 </pre>
167 <p>
168 Now, we will emerge a compiler which will use the gnu linker.
169 This is a requirement for many packages that follow in the
170 bootstrap process. The gcc compiler shipped by Sun uses the
171 Solaris native linker, which is as "Spartan" as the whole
172 system. The packages to emerge include the <c>baselayout</c>
173 package. Some, if not many, scripts and tools within a Gentoo
174 system assume the availability of the <c>baselayout</c>
175 package for all communication using the Gentoo colour scheme.
176 </p>
177 <pre caption="emerge linker and compiler">
178 $ <i>emerge --oneshot --nodeps sys-devel/m4</i>
179 $ <i>emerge --oneshot --nodeps sys-apps/baselayout-prefix</i>
180 $ <i>emerge --oneshot --nodeps sys-devel/flex</i>
181 $ <i>emerge --oneshot --nodeps sys-devel/binutils-config</i>
182 $ <i>emerge --oneshot --nodeps "=sys-devel/binutils-2.16*"</i>
183 $ <i>emerge --oneshot --nodeps sys-devel/gcc-config</i>
184 $ <i>emerge --oneshot --nodeps sys-devel/gcc</i>
185 </pre>
186 <p>
187 We continue getting some autotools stuff into our prefix.
188 </p>
189 <pre caption="emerge autotools">
190 $ <i>emerge --oneshot --nodeps "=autoconf-2.1*" "=autoconf-2.6*" "autoconf-wrapper"</i>
191 $ <i>emerge --oneshot --nodeps "=automake-1.4*" "=automake-1.5*" "=automake-1.6*" "=automake-1.7*" "=automake-1.8*" "automake-wrapper"</i>
192 </pre>
193 <note><c>>=automake-1.9</c> and <c>libtool</c> are not (yet)
194 installed at this stage.</note>
195 <p>
196 Next, we have to get some tools in order to finalise getting
197 the autotools in our prefix. Because we installed <c>wget</c>
198 in a temporary location, let's not forget to install it
199 properly by emerging it now:
200 </p>
201 <pre caption="emerge wget">
202 $ <i>env USE="-ssl" emerge --oneshot --nodeps wget</i>
203 </pre>
204 <p>
205 After this we can emerge texinfo, which <c>automake-1.9</c>
206 needs.
207 </p>
208 <pre caption="emerge texinfo">
209 $ <i>emerge --oneshot --nodeps texinfo</i>
210 </pre>
211 <p>
212 Now we can finish installing the autotools:
213 </p>
214 <pre caption="finalise emerge autotools">
215 $ <i>emerge --oneshot --nodeps "=automake-1.9*" "=automake-1.10*"</i>
216 $ <i>emerge --oneshot --nodeps libtool</i>
217 </pre>
218 <p>
219 Now we have some decent autotooling stuff around, we can get
220 some decent core utilities in our prefix.
221 </p>
222 <pre caption="emerge coreutils">
223 $ <i>emerge --oneshot --nodeps sys-apps/coreutils</i>
224 </pre>
225 <p>
226 Same goes for GNU patch.
227 </p>
228 <pre caption="emerge patch">
229 $ <i>emerge --oneshot patch</i>
230 </pre>
231 <p>
232 Finally we emerge python and some other utilities in our
233 prefix. These are the remaining packages that we temporarily
234 installed to bootstrap our system.
235 </p>
236 <pre caption="emerge remaining temporarily installed packages">
237 $ <i>emerge --oneshot --nodeps python</i>
238 $ <i>emerge --oneshot --nodeps findutils</i>
239 $ <i>emerge --oneshot --nodeps tar</i>
240 $ <i>emerge --oneshot --nodeps grep</i>
241 $ <i>emerge --oneshot --nodeps make</i>
242 $ <i>emerge --oneshot --nodeps bison</i>
243 </pre>
244 <p>
245 Before we continue to emerge all ebuilds from <c>system</c>,
246 we first install <c>portage</c>. We need to overwrite the
247 version that was installed by the bootstrap script.
248 Installing a new portage will make sure it uses the tools
249 provided by the prefix, and forget about the temporary
250 installed tools.
251 </p>
252 <pre caption="emerge portage">
253 $ <i>env FEATURES="-collision-protect" emerge --oneshot --nodeps portage</i>
254 </pre>
255 <p>
256 Next, we get GNU <c>awk</c>, as most ebuilds expect this
257 <c>awk</c> when they use it.
258 </p>
259 <pre caption="emerge gawk">
260 $ <i>emerge --oneshot gawk</i>
261 </pre>
262 <p>
263 Now we're about to start the big work, we remove the temporary
264 directory and its use as we got it all in our prefix now.
265 </p>
266 <pre caption="remove tmp directory">
267 $ <i>rm -Rf $EPREFIX/tmp/*</i>
268 $ <i>hash -r</i>
269 </pre>
270 <p>
271 Next, we do the real work where all packages get reemerged in
272 such an order that they make use of packages in the prefix
273 itself.
274 </p>
275 <pre caption="emerge system">
276 $ <i>env USE="berkdb" emerge -e system</i>
277 </pre>
278 <p>
279 This will happily install a lot of stuff and reinstall what
280 you emerged before. This is necessary to avoid compilation
281 failures due to dependencies.
282 </p>
283 <p>
284 Since we have some basic stuff now, we might want the benefit
285 of an updated tree. To use it, emerge <c>subversion</c>:
286 </p>
287 <pre caption="emerge subversion">
288 $ <i>emerge subversion</i>
289 </pre>
290 <p>
291 We can now update the tree. Since snapshots now are actually
292 (anonymous) SVN checkouts of the tree, we can immediately use
293 SVN commands on the tree instead of checking a tree out first.
294 Because Portage knows how to deal with the SVN tree, and the
295 bootstrap script has set a correct <c>SYNC</c> variable in
296 your <path>etc/make.conf</path>, updating the tree is done
297 using:
298 </p>
299 <pre caption="Updating the tree">
300 $ <i>emerge --sync</i>
301 </pre>
302 <p>
303 To really do this properly, after emerging <c>system</c>, one
304 should re-emerge <c>world</c>, because now all packages can
305 be compiled with all tools from the prefix, instead of based
306 on tools in the system root. Before you do though, this is
307 the good time to set your general <c>USE</c>-flags, such as
308 <c>nls</c> to get localised messages in
309 <path>$EPREFIX/etc/make.conf</path>. In that file, you
310 can also set <c>CFLAGS</c> for your compilation. Be
311 conservative with <c>CFLAGS</c>! Note that the code below is
312 an example, and is meant for inspiration only.
313 </p>
314 <pre caption="Customising the prefix installation - example">
315 $ <i>echo 'USE="unicode nls"' >> $EPREFIX/etc/make.conf</i>
316 $ <i>echo 'CFLAGS="-O2 -pipe"' >> $EPREFIX/etc/make.conf</i>
317 </pre>
318 <p>
319 Since we're about to rebuild our system for the last time, we
320 can unset all hacks we made to help the bootstrap process.
321 This time we emerge <c>world</c> to include the packages
322 necessary for <c>subversion</c>.
323 </p>
324 <pre caption="Unsetting LDFLAGS and CPPFLAGS variables">
325 $ <i>unset LDFLAGS</i>
326 $ <i>unset CPPFLAGS</i>
327 $ <i>emerge -e world</i>
328 </pre>
329 <note>
330 tcsh users can use <c>unsetenv LDFLAGS</c> and alike for
331 <c>CPPFLAGS</c>.
332 </note>
333 <p>
334 After <c>world</c> has emerged successfully, your prefix will
335 be set up properly, and you can emerge the whichever tools you
336 choose from the prefix tree.
337 </p>
338 </body>
339 </section><!-- }}} -->
340
341 <section><!-- {{{ Using the Prefix -->
342 <title>Using the Prefix</title>
343 <body>
344 <p>
345 To use your bootstrapped prefix environment, you best start a
346 shell from the prefix, such that your path and other
347 environment variables are set correctly. To facilitate in
348 this, a small helper script can be created by the bootstrap
349 script.
350 </p>
351 <pre caption="Creating a start-script">
352 $ <i>cd $EPREFIX/usr/portage/scripts</i>
353 $ <i>./bootstrap-prefix.sh $EPREFIX startscript</i>
354 </pre>
355 <p>
356 After running this, a script <c>startprefix</c> will be
357 present in <c>$EPREFIX</c>. You can freely move the script to
358 e.g. your homedir for convenience. Running the script will
359 drop you into a prefix shell, where for example <c>emerge</c>
360 is directly at your disposal. Enjoy your prefix!
361 </p>
362 </body>
363 </section>
364
365 </chapter>
366
367 </guide>
368
369 <!-- vim: set expandtab ts=2 sw=2 foldmethod=marker foldenable spell spelllang=en_gb: -->
370 <!-- kate: space-indent on; indent-width 2; replace-tabs on; -->

  ViewVC Help
Powered by ViewVC 1.1.20