summaryrefslogtreecommitdiffstats
path: root/build_tools/larch8/larch0/docs/html/larchify.html
blob: 290c4b02dc6b7d34a9dee0a9a446e7bef66d6bc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Building the live system</title>
<!-- (en) Add your meta data here -->

<link href="css/larchdocs.css" rel="stylesheet" type="text/css"/>
<!--[if lte IE 7]>
<link href="css/yaml/core/iehacks.css" rel="stylesheet" type="text/css" />
<![endif]-->
</head>

<body>
<!-- skip link navigation -->
<ul id="skiplinks">
    <li><a class="skip" href="#col1">Skip to main content (Press Enter).</a></li>
</ul>

<div class="page_margins">
  <div class="page">
    <div id="top"><div id="tm"></div></div>
     <!-- begin: #col1 -->
      <div id="col1" role="main">
        <div id="col1_content">
          <div id="header" role="banner">
            <h1><span><em>live Arch Linux</em> builder</span></h1>
          </div>

      <!-- begin: #col3 navigation column -->
      <div id="col3" role="complementary">
        <div id="col3_content">
          <img class="indent2" alt="larch logo" src="css/screen/larch150x.png" width="150" height="150" />
              <div class="vlist">
                <ul>
                  <li><a href="index.html"><h6>Table Of Contents</h6></a></li>
                  <li><a href="medium.html"><h6>Next:</h6>
                    <div class="indent1">Preparing the larch live medium</div></a></li>
                  <li><a href="archin.html"><h6>Previous:</h6>
                    <div class="indent1">Installation of the base Arch system</div></a></li>
                </ul>
              </div>
        </div>
      </div>
      <!-- end: #col3 -->

<div class="larchdocs">
<h2 id="pagetitle" level="1">Building the <em>live</em> system</h2>


<p>Once we have an <em>Arch Linux</em> installation and have specified our
customizations in the profile, we can put together the basic ingredients of a
live medium. Firstly there is the '/boot' directory, containing the kernel, the
<em>initramfs</em> (a small compressed file-system into which the kernel
boots initially) and files belonging to the bootloader. The bulk of the
system will be in a single squashfs archive, 'system.sqf', residing on the
medium in the /larch directory. This archive contains the essentially untouched
<em>Arch</em> installation. A further - much smaller - <em>squashfs</em> archive
('mods.sqf') is built containing the configuration defined in the selected
<em>larch</em> profile. This latter will 'overlay' the underlying system as a
branch of the <em>aufs</em> root file-system used when running <em>live</em>.
Various other data and configuration files
special to the <em>larch live</em> system are also kept in the /larch directory.
</p>
<p>The standard way of supporting data persistence in this version of <em>larch</em>
is to use the boot medium as a writeable overlay branch in the root ('/')
<em>aufs</em> file-system. This can of course only work if the boot medium
is writeable and is formatted with a linux file-system (standard is 'ext4').
In this case the 'mods.sqf' file will not exist, its contents being unpacked
onto the medium.
When running without data persistence a temporary writeable layer, in
<em>tmpfs</em> (a memory based file-system), is used as the top layer.
</p>
<p>Let's call this step, preparing these components so that they can be
installed on a suitable medium, 'larchification' (from the verb 'larchify').
At the end of the 'larchification' process, the basic ingredients of the
<em>live</em> medium have been created, but the bootloader files are not
yet finalized (and nothing has been written to any medium).
</p>

<p>For details of the structure of the <em>live</em> system which is built
by this stage see <a href="larch_live_system.html">this page</a>.
A description of the main possibilities
for customizing the build process are covered in
<a href="profiles.html">the profiles documentation</a>.
</p>

<h3><a name="mkinitcpio"></a><em>mkinitcpio</em> and the <em>initramfs</em></h3>

<p>In order to build a suitable <em>initramfs</em> for a <em>larch</em>
system, a customized version of 'mkinitcpio.conf' is required. How
<em>larch</em> handles this is quite complicated because it aims to retain
the normal files so that the <em>live</em> system can later be installed
as a normal <em>Arch Linux</em> system, whilst at the same time offering
the capability of updating (with 'pacman -Syu') the <em>live</em> system,
including the kernel (thus requiring regeneration of the <em>initramfs</em>
for the system).
The consequence of this ambition is that modifications are made
to the 'preset' file within '/etc/mkinitcpio.d' (which are reversible when
the <em>live</em> system is installed as a normal <em>Arch Linux</em> system)
and a special <em>mkinitcpio</em>' configuration file, '/etc/mkinitcpio.conf.larch'
must be provided (there is a default version supplied in the larch-live package
which should be adequate in most cases).
If you need to know more see the method 'Builder.gen_initramfs' in
'cli/larchify.py'.
</p>

<h3><a name="reuseSystem"></a>Rebuilding using an existing 'system.sqf'</h3>

<p>In order to aid experimentation with profile tweaks which do not affect
the underlying installation, it is possible to repeat the 'larchify' step
without rebuilding the 'system.sqf' archive, which saves quite a bit of time
(this is achieved by passing the '-o' option to 'larch-larchify' when running
from the command line).
</p>

<h3><a name="existingSystem"></a>Making a <em>live</em> system from an
existing <em>Arch</em> installation</h3>

<p>By setting the installation path (with the '-i' option if using the
command line) to an existing <em>Arch</em> installation,
a <em>live</em> medium can be made from it. One convenient way of doing this
is to run the build process from a <em>live</em> system. A <em>larch live</em>
system is of course particularly well suited, but most others should work
too.
</p>
<p>To use an existing system as source, this system must already be mounted,
including any sub-mounts (e.g. /home on another partition).
The main mount must be with options 'exec,dev', because most of the
building is done via a <em>chroot</em> to the installation.
This approach to <em>live</em> system generation is
probably not a good idea if the installation contains a lot of data -
consider how big the result will be ...
</p>

<p>Note that some things in '/var' will not be included in the 'live' system.
Firstly, the standard <em>pacman</em> package cache ('/var/cache/pacman/pkg')
will be excluded.
Also the log files (in '/var/log') and '/var/tmp' (temporary files, like '/tmp')
are not saved. As some files in '/var/log' are required for certain aspects of
logging to function, these are recreated in the <em>initramfs</em>.
</p>

<h3><a name="kernel"></a>Kernel and Initramfs</h3>
<p>The larchify script assumes the kernel is the standard
one from Arch Linux. It is quite possible to use a custom kernel with
<em>larch</em>, so long as it supports <em>squashfs</em> and <em>aufs</em>,
but you must tell the script the name of the kernel binary file and the name
of the mkinitcpio 'preset', by placing these with a space-separator in a
file called 'kernel' in the profile directory. The defaults are supplied
in  the larch package's 'data' directory, in the file 'kernel'. Check that
you understand how the mkinitcpio system handles kernel updates before you
try <em>larch</em> with a custom kernel.
</p>

</div>


          <div class="topref"><a href="#top">Top</a></div>
        </div>
    <!-- begin: #footer -->
    <div id="footer">
      <div id="footer-content" role="contentinfo">© 2010 Michael Towers<br />
        Page layout assisted by <a href="http://www.yaml.de/">YAML</a> and
        <a href="http://www.kuwata-lab.com/tenjin/">pyTenjin</a>
      </div>
    </div>
    <!-- end: #footer -->
      </div>
      <!-- end: #col1 -->
    <div id="bottom"><div id="bl"><div id="bm"></div></div></div>
  </div>
</div>
<!-- full skiplink functionality in webkit browsers -->
<script src="css/yaml/core/js/webkit-focusfix.js" type="text/javascript"></script>
</body>
</html>