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