/[gentoo]/xml/htdocs/doc/en/handbook/hb-install-stage.xml
Gentoo

Contents of /xml/htdocs/doc/en/handbook/hb-install-stage.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.29 - (hide annotations) (download) (as text)
Mon Jan 5 08:21:16 2004 UTC (14 years, 6 months ago) by swift
Branch: MAIN
Changes since 1.28: +3 -3 lines
File MIME type: application/xml
Fix issue with make.conf.example

1 swift 1.10 <!-- The content of this document is licensed under the CC-BY-SA license -->
2     <!-- See http://creativecommons.org/licenses/by-sa/1.0 -->
3    
4 swift 1.29 <!-- $Header: /home/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-stage.xml,v 1.28 2004/01/03 09:04:56 swift Exp $ -->
5 swift 1.15
6 swift 1.7 <sections>
7 swift 1.1 <section>
8     <title>Choosing the Right Stage</title>
9     <body>
10    
11     <p>
12 swift 1.2 When we asked you to choose for an installation medium (LiveCDs, existing
13     distribution etc.) we explained you what the pros and cons are. One of those was
14     choosing your stage: do you go for a full compilation (<e>stage1</e>), skip the
15 swift 1.16 bootstrapping (<e>stage2</e>) or start from a precompiled state (<e>stage3</e>)?
16 swift 1.2 </p>
17    
18     <p>
19     Depending on your installation medium, you can still make your choice. Others
20     will already have made the choice at the beginning of the installation. It is
21 swift 1.12 now time to install your choice of stage.
22     </p>
23    
24     <p>
25     The following two parts explain how to install your preferred stage. The default
26     option here is to download your stage of choice from the internet. However, some
27     LiveCDs have these stages available on the CD.
28     </p>
29    
30     <p>
31     If you have a working Internet connection, you are advised to use the default
32     option. If however you do not have a working Internet connection, or you want to
33     install Gentoo using GRP (precompiled packages), then you have to choose for the
34     alternative option.
35     </p>
36    
37     <ul>
38 swift 1.17 <li><uri link="#doc_chap2">Default: Downloading from the Internet</uri></li>
39     <li><uri link="#doc_chap3">Alternative: Using a Stage from the LiveCD</uri></li>
40 swift 1.12 </ul>
41    
42     </body>
43     </section>
44     <section>
45     <title>Default: Downloading from the Internet</title>
46     <subsection>
47     <title>Downloading the Stage Tarball</title>
48     <body>
49    
50     <p>
51     Go to the Gentoo mountpoint at which you mounted your filesystems
52     (most likely <path>/mnt/gentoo</path>):
53     </p>
54    
55     <pre caption="Going to the Gentoo mountpoint">
56     # <i>cd /mnt/gentoo</i>
57     </pre>
58    
59     <p>
60     Depending on your installation medium, you have a couple of tools available to
61     download a stage. If you have <c>lynx</c> available, then you can immediately
62     surf to <uri link="/main/en/mirrors.xml">the Gentoo
63     mirrorlist</uri> and choose a mirror close to you. Then pick the
64     <path>releases/</path> directory, followed by your architecture (for instance
65     <path>x86/</path> and the Gentoo version (<path>1.4/</path>) to finish up with
66     the <path>stages/</path> directory. For there on you should see all available
67     stage files for your architecture. Select one and press <c>D</c> to download.
68     When you're finished, press <c>Q</c> to quit the browser.
69     </p>
70    
71     <pre caption="Surfing to the mirror listing with lynx">
72     # <i>lynx http://www.gentoo.org/main/en/mirrors.xml</i>
73     </pre>
74    
75     <p>
76     If you do not have <c>lynx</c>, you should have <c>links2</c> at your disposal.
77 swift 1.19 <c>links2</c> is more powerful than <c>lynx</c>, but has some drawbacks. One of
78 swift 1.12 them is that it doesn't listen to the proxy variables we have declared
79     previously. If you need to setup a proxy, use <c>links2 -http-proxy
80     proxy.server.com:8080</c>. From there on, you should follow the same steps as
81     with <c>lynx</c> as they are equivalent.
82     </p>
83    
84     <pre caption="Surfing to the mirror listing with links2">
85     <comment>(Without proxy:)</comment> # <i>links2 http://www.gentoo.org/main/en/mirrors.xml</i>
86     <comment>(With proxy:)</comment> # <i>links2 -http-proxy proxy.server.com:8080 http://www.gentoo.org/main/en/mirrors.xml</i>
87     </pre>
88    
89     </body>
90     </subsection>
91     <subsection>
92     <title>Unpacking the Stage Tarball</title>
93     <body>
94    
95     <p>
96     Now unpack your downloaded stage onto your system. We use GNU's <c>tar</c> to
97     proceed as it is the easiest method:
98     </p>
99    
100     <pre caption="Unpacking the stage">
101 swift 1.19 # <i>tar -xvjpf stage?-*.tar.bz2</i>
102 swift 1.12 </pre>
103    
104     <p>
105 swift 1.19 Make sure that you use the same options (<c>-xvjpf</c>). The <c>x</c> stands for
106 swift 1.12 <e>Extract</e>, the <c>v</c> for <e>Verbose</e> (okay, yes, this is optional),
107     the <c>j</c> for <e>Decompress with bzip2</e>, the <c>p</c> for <e>Preserve
108     permissions</e> and the <c>f</c> to denote that we want to extract a file, not
109     standard input.
110     </p>
111    
112     <p>
113     Done? Okay, you are now ready to proceed with the next section on <uri
114     link="#doc_chap4">Configuring the Compile Options</uri>.
115     </p>
116    
117     </body>
118     </subsection>
119     </section>
120     <section>
121     <title>Alternative: Using a Stage from the LiveCD</title>
122     <subsection>
123     <title>Extracting the Stage Tarball</title>
124     <body>
125    
126     <p>
127     The stages on the CD reside in the <path>/mnt/cdrom/stages</path> directory. To
128     see a listing of available stages, use <c>ls</c>:
129     </p>
130    
131     <pre caption="List all available stages">
132     # <i>ls /mnt/cdrom/stages</i>
133     </pre>
134    
135     <p>
136     If the system replies with an error, you may need to mount the CD-ROM first:
137     </p>
138    
139     <pre caption="Mounting the CD-ROM">
140     # <i>ls /mnt/cdrom/stages</i>
141     ls: /mnt/cdrom/stages: No such file or directory
142     # <i>mount /dev/cdroms/cdrom0 /mnt/cdrom</i>
143     # <i>ls /mnt/cdrom/stages</i>
144     </pre>
145    
146     <p>
147     Now go into your Gentoo mountpoint (usually <path>/mnt/gentoo</path>):
148     </p>
149    
150     <pre caption="Changing directory to /mnt/gentoo">
151     # <i>cd /mnt/gentoo</i>
152     </pre>
153    
154     <p>
155     We will now extract the stage tarball of your choice. We will do this with the
156 swift 1.19 GNU <c>tar</c> tool. Make sure you use the same options (<c>-xvjpf</c>)! In the
157 swift 1.12 next example, we extract the stage tarball <path>stage3-20031011.tar.bz2</path>.
158     Be sure to substitute the tarball filename with your stage.
159     </p>
160    
161     <pre caption="Extracting the stage tarball">
162 swift 1.19 # <i>tar -xvjpf /mnt/cdrom/stages/stage3-20031011.tar.bz2</i>
163 swift 1.12 </pre>
164    
165     </body>
166     </subsection>
167     <subsection>
168     <title>Installing a Portage Snapshot and Source Code</title>
169     <body>
170    
171     <p>
172     There is a Portage snapshot available on some LiveCDs. Since you are reading
173     this, we can safely assume you are using such a LiveCD. To install this
174     snapshot, take a look inside <path>/mnt/cdrom/snapshots/</path> to see what
175 swift 1.19 snapshot we have available:
176 swift 1.12 </p>
177    
178     <pre caption="Checking the /mnt/cdrom/snapshots content">
179     # <i>ls /mnt/cdrom/snapshots</i>
180     </pre>
181    
182     <p>
183 swift 1.19 Now extract the snapshot using the following construct. Again,
184 swift 1.12 make sure you use the correct options to <c>tar</c>. Also, the <c>-C</c> is with
185     a capital <c>C</c>, not <c>c</c>. In the next example we use
186     <path>portage-20031011.tar.bz2</path> as the snapshot filename. Be sure to
187     substitute with your snapshot.
188     </p>
189    
190     <pre caption="Extracting a Portage snapshot">
191 swift 1.19 # <i>tar -xvjf /mnt/cdrom/snapshots/portage-20031011.tar.bz2 -C /mnt/gentoo/usr</i>
192 swift 1.12 </pre>
193    
194     <p>
195     You also need to copy over all source code from the CD.
196     </p>
197    
198     <pre caption="Copy over source code">
199 swift 1.26 # <i>mkdir /mnt/gentoo/usr/portage/distfiles</i>
200     # <i>cp /mnt/cdrom/distfiles/* /mnt/gentoo/usr/portage/distfiles/</i>
201 swift 1.12 </pre>
202    
203     <p>
204     If you want to use GRP (precompiled binaries), read on. Otherwise continue with
205     <uri link="#doc_chap4">Configuring the Compile Options</uri>.
206 swift 1.1 </p>
207    
208     </body>
209 swift 1.12 </subsection>
210     <subsection>
211     <title>Optional: Preparing GRP</title>
212     <body>
213    
214     <p>
215     If you want to install Gentoo using GRP (precompiled packages), you need to copy
216     over all packages onto your filesystem so that Portage can use them.
217     </p>
218    
219     <pre caption="Copy over precompiled packages">
220 swift 1.26 # <i>mkdir -p /mnt/gentoo/usr/portage/packages/All</i>
221     # <i>cp /mnt/cdrom/packages/All/* /mnt/gentoo/usr/portage/packages/All/</i>
222 swift 1.12 </pre>
223    
224     <p>
225     Now continue with <uri link="#doc_chap4">Configuring the Compile Options</uri>.
226     </p>
227    
228     </body>
229     </subsection>
230 swift 1.7 </section>
231     <section>
232     <title>Configuring the Compile Options</title>
233 swift 1.1 <subsection>
234 swift 1.3 <title>Introduction</title>
235 swift 1.1 <body>
236    
237     <p>
238 swift 1.3 To optimize Gentoo, you can set a couple of variables which impact Portage
239     behaviour. All those variables can be set as environment variables (using
240     <c>export</c>) but that isn't permanent. To keep your settings, Portage provides
241     you with <path>/etc/make.conf</path>, a configuration file for Portage. It is
242     this file we will edit now.
243 swift 1.1 </p>
244    
245 dertobi123 1.27 <note>
246     A commented listing of all possible variables can be found in
247 swift 1.29 <path>/mnt/gentoo/etc/make.conf(.example)</path>. For a successful Gentoo
248     installation you'll only need to set the variables which are mentioned beneath.
249 dertobi123 1.27 </note>
250    
251 swift 1.3 <p>
252     Fire up your favorite editor (in this guide we use <c>nano</c>) so we can alter
253     the optimization variables we will discuss hereafter.
254     </p>
255    
256     <pre caption="Opening /etc/make.conf">
257 swift 1.12 # <i>nano -w /mnt/gentoo/etc/make.conf</i>
258 swift 1.3 </pre>
259    
260     <p>
261 dertobi123 1.27 As you probably notice now, the <path>make.conf(.example)</path> file is
262     structured in a generic way: commented lines start with "#", other lines define
263     variables using the <c>VARIABLE="content"</c> syntax. Several of those
264     variables are discussed next.
265 swift 1.3 </p>
266    
267     </body>
268 swift 1.7 </subsection>
269     <subsection>
270 swift 1.3 <title>CHOST</title>
271     <body>
272    
273     <warn>
274     Although it might be interesting for non-stage1 users, they should <e>not</e>
275     change the <c>CHOST</c> setting in <path>make.conf</path>. Doing so might render
276 swift 1.4 their system unusable. Again: only change this variable if you use a
277     <e>stage1</e> installation.
278 swift 1.3 </warn>
279 swift 1.4
280     <p>
281     The <c>CHOST</c> variable defines what architecture <c>gcc</c> has to
282     compile programs for. The possibilities are:
283     </p>
284    
285     <table>
286     <tr>
287     <th>Architecture</th>
288     <th>Subarchitecture</th>
289     <th>CHOST Setting</th>
290     </tr>
291     <tr>
292     <ti>x86</ti>
293     <ti>i386</ti>
294     <ti>i386-pc-linux-gnu</ti>
295     </tr>
296     <tr>
297     <ti>x86</ti>
298     <ti>i486</ti>
299     <ti>i486-pc-linux-gnu</ti>
300     </tr>
301     <tr>
302     <ti>x86</ti>
303     <ti>i586</ti>
304     <ti>i586-pc-linux-gnu</ti>
305     </tr>
306     <tr>
307     <ti>x86</ti>
308     <ti>i686 and above (incl. athlon)</ti>
309     <ti>i686-pc-linux-gnu</ti>
310     </tr>
311     <tr>
312     <ti>alpha</ti>
313     <ti></ti>
314     <ti>alpha-unknown-linux-gnu</ti>
315     </tr>
316     <tr>
317     <ti>ppc</ti>
318     <ti></ti>
319     <ti>powerpc-unknown-linux-gnu</ti>
320     </tr>
321     <tr>
322     <ti>sparc</ti>
323     <ti></ti>
324     <ti>sparc-unknown-linux-gnu</ti>
325     </tr>
326     <tr>
327     <ti>hppa</ti>
328 swift 1.13 <ti>(generic)</ti>
329     <ti>hppa-unknown-linux-gnu</ti>
330     </tr>
331     <tr>
332     <ti>hppa</ti>
333     <ti>pa7000</ti>
334     <ti>hppa1.1-unknown-linux-gnu</ti>
335     </tr>
336     <tr>
337     <ti>hppa</ti>
338     <ti>pa8000 and above</ti>
339     <ti>hppa2.0-unknown-linux-gnu</ti>
340 swift 1.4 </tr>
341 swift 1.21 <tr>
342     <ti>mips</ti>
343     <ti></ti>
344     <ti>mips-unknown-linux-gnu</ti>
345     </tr>
346 swift 1.28 <tr>
347     <ti>amd64</ti>
348     <ti></ti>
349     <ti>x86_64-pc-linux-gnu</ti>
350     </tr>
351 swift 1.4 </table>
352    
353     </body>
354 swift 1.7 </subsection>
355     <subsection>
356 swift 1.4 <title>CFLAGS and CXXFLAGS</title>
357     <body>
358    
359     <p>
360     The <c>CFLAGS</c> and <c>CXXFLAGS</c> variables define the optimization flags
361     for the <c>gcc</c> C and C++ compiler respectively. Although we define those
362     generally here, you will only have maximum performance if you optimize these
363 swift 1.18 flags for each program separately. The reason for this is because every program
364 swift 1.4 is different.
365     </p>
366    
367     <p>
368     In <path>make.conf</path> you should define the optimization flags you think
369     will make your system the most responsive <e>generally</e>. Don't place
370     experimental settings in this variable; too much optimization can make
371     programs behave bad (crash, or even worse, malfunction).
372     </p>
373    
374     <p>
375     We will not explain all possible optimization options. If you want to know
376     them all, read the <uri link="http://www.gnu.org/software/gcc/onlinedocs/">GNU
377     Online Manual(s)</uri> or the <c>gcc</c> info page (<c>info gcc</c> -- only
378 swift 1.13 works on a working Linux system). The <path>make.conf</path> file itself also
379     contains lots of examples and information; don't forget to read it too.
380 swift 1.4 </p>
381    
382     <p>
383     A first setting is the <c>-march=</c> flag, which specifies the name of the
384     target architecture. Possible options are described in the
385     <path>make.conf</path> file (as comments). For instance, for the x86 Athlon XP
386     architecture:
387     </p>
388    
389     <pre caption="The GCC march setting">
390     -march=athlon-xp
391     </pre>
392    
393     <p>
394     A second one is the <c>-O</c> flag, which specifies the <c>gcc</c> optimization
395 swift 1.6 class flag. Possible classes are <c>s</c> (for size-optimized),
396 swift 1.4 <c>0</c> (for no optimizations), <c>1</c>, <c>2</c> or <c>3</c> for more
397     speed-optimization flags (every class has the same flags as the one before, plus
398 swift 1.6 some extras). For instance, for a class-2 optimization:
399 swift 1.4 </p>
400    
401     <pre caption="The GCC O setting">
402     -O2
403     </pre>
404    
405     <p>
406     Other popular optimization flags are <c>-pipe</c> (use pipes rather than
407     temporary files for communication between the various stages of compilation) and
408     <c>-fomit-frame-pointer</c> (which doesn't keep the frame pointer in a register
409     for functions that don't need one).
410     </p>
411    
412     <p>
413     When you define the <c>CFLAGS</c> and <c>CXXFLAGS</c>, you should combine
414     several optimization flags, like in the following example:
415     </p>
416    
417     <pre caption="Defining the CFLAGS and CXXFLAGS variable">
418 swift 1.11 CFLAGS="-march=athlon-xp -pipe -O2"
419 swift 1.4 CXXFLAGS="${CFLAGS}" <comment># Use the same settings for both variables</comment>
420     </pre>
421    
422     </body>
423 swift 1.7 </subsection>
424     <subsection>
425 swift 1.4 <title>MAKEOPTS</title>
426     <body>
427    
428 swift 1.6 <p>
429     With <c>MAKEOPTS</c> you define how many parallel compilations should occur when
430     you install a package. The suggested number is the number of CPUs in your system
431     plus one.
432     </p>
433    
434     <pre caption="MAKEOPTS for a regular, 1-CPU system">
435     MAKEOPTS="-j2"
436     </pre>
437    
438 swift 1.4 </body>
439 swift 1.7 </subsection>
440     <subsection>
441 swift 1.6 <title>Ready, Set, Go!</title>
442 swift 1.4 <body>
443 swift 1.3
444 swift 1.6 <p>
445 swift 1.12 Update your <path>/mnt/gentoo/etc/make.conf</path> to your own will and save.
446     You are now ready to continue with <uri link="?part=1&amp;chap=6">Installing the
447     Gentoo Base System</uri>.
448 swift 1.8 </p>
449 swift 1.6
450     </body>
451 swift 1.1 </subsection>
452     </section>
453 swift 1.7 </sections>

  ViewVC Help
Powered by ViewVC 1.1.20