Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Edits of user manual and guest builder manual
[palacios.git] / manual / guest_build / Palacios_Guest_Build.tex
1 \documentclass{article}[11pt]
2
3 \usepackage{amsmath}
4 \usepackage{amssymb}
5 \usepackage{verbatim}
6 \usepackage{epsf}
7 \usepackage{graphicx}
8 \usepackage{hyperref}
9
10 \def\colfigsize{\epsfxsize=5in}
11
12 \pdfpagewidth 8.5in
13 \pdfpageheight 11.0in
14
15 \setlength\topmargin{0in}
16 \setlength\evensidemargin{0in}
17 \setlength\oddsidemargin{0in}
18 \setlength\textheight{8.0in}
19 \setlength\textwidth{6.5in}
20
21 \title{Building a bootable guest image for Palacios and Kitten}
22
23 \begin{document}
24 \maketitle
25
26 \section{Getting the guest image build tools}
27
28 In order to build the bootable guest ISO image, we need to build a Linux kernel
29  from source and an initial ramdisk file system containing a set of useful
30 tools. We will use a new directory for demonstration; the root directory for the
31 following examples is ``\verb+test/+":
32
33 \begin{verbatim}
34 [jdoe@newskysaw ~]$ mkdir test/
35 \end{verbatim}
36
37 \noindent
38 There are a set of tools and sources that are useful for the guest image
39 building procedure. You can obtain these resources from our git repositories.
40 Change to the ``\verb+test/+" directory and clone the resources:
41
42 \begin{verbatim}
43 [jdoe@newskysaw test]$ git clone http://hornet.cs.northwestern.edu:9005/busybox
44 [jdoe@newskysaw test]$ git clone http://hornet.cs.northwestern.edu:9005/initrd
45 [jdoe@newskysaw test]$ git clone http://hornet.cs.northwestern.edu:9005/linux-2.6.30.y
46 \end{verbatim}
47
48 \section{Building the ramdisk filesystem}
49 The guest requires an initial ramdisk filesystem. Jack has made one that you can
50 leverage; it is temporarily located in his home directory.  You will need sudo
51 or root access to create the device files when you unpack the archive:
52
53 \begin{verbatim}
54 [jdoe@newskysaw test]$ cp /home/jarusl/initrd/disks/v3vee_initramfs.tar.gz .
55 [jdoe@newskysaw test]$ sudo tar -C initrd -xzf v3vee_initramfs.tar.gz
56 \end{verbatim}
57
58 \noindent
59 If you require a custom initial ramdisk filesystem, change to the
60 ``\verb|initrd/initramfs/|" directory and perform the following steps:
61
62 \begin{verbatim}
63 [jdoe@newskysaw initramfs]$ mkdir -p proc sys var/log
64 \end{verbatim}
65
66 \noindent
67 Edit the ``\verb|init_task|" script and uncomment these lines:
68
69 \begin{verbatim}
70 #mknod /dev/tty0 c 4 0
71 #mknod /dev/tty1 c 4 1
72 #mknod /dev/tty2 c 4 2
73 \end{verbatim}
74
75 \pagebreak
76
77 \noindent
78 Create the ``\verb|console|" device. If you have sudo or root access it is
79 possible to create this device manually:
80
81 \begin{verbatim}
82 [jdoe@newskysaw initramfs]$ sudo mknod dev/console c 5 1
83 [jdoe@newskysaw initramfs]$ sudo chmod 0600 dev/console
84 \end{verbatim}
85
86 \noindent
87 If you do not have sudo or root access it is still possible to create the
88 ``\verb|console|" device indirectly through the kernel build.  Change to the
89 ``\verb|initrd/|" directory and create a file called ``\verb|root_files|". Add
90 the following line:
91
92 \begin{verbatim}
93 nod /dev/console 0600 0 0 c 5 1
94 \end{verbatim}
95
96 \noindent
97 The ``\verb|root_files|" file is used when building the Linux kernel in the
98 section Configuring and building the Linux kernel. Finally, create any
99 additional directories and copy any additional files that you need. Your initial
100 ramdisk filesystem is prepped and ready for installation of the BusyBox tools as
101 described in the section Configuring and installing BusyBox tools.
102
103
104
105 \pagebreak
106 \begin{figure}[ht]
107   \begin{center}
108     \colfigsize\epsffile{busyboxConf1.eps}
109     \caption{BusyBox configuration}
110     \label{fig:busyboxcf1}
111   \end{center}
112 \end{figure}
113
114 \begin{figure}[ht]
115   \begin{center}
116     \colfigsize\epsffile{busyboxConf2.eps}
117   \end{center}
118   \caption{BusyBox configuration}
119   \label{fig:busyboxcf2}
120 \end{figure}
121
122 \section{Configuring and installing BusyBox tools}
123
124 BusyBox is a software application released as Free software under the GNU GPL
125 that provides many standard Unix tools. BusyBox combines tiny versions of many
126 common UNIX utilities into a single, small executable. For more details on
127 BusyBox visit \url{http://busybox.net}. To configure BusyBox, in the
128 ``\verb+busybox/+" directory, type the following:
129
130 \begin{verbatim}
131 [jdoe@newskysaw busybox]$ make menuconfig
132 \end{verbatim}
133
134 \noindent
135 or
136
137 \begin{verbatim}
138 [jdoe@newskysaw busybox]$ make xconfig
139 \end{verbatim}
140
141 \noindent
142 The BusyBox tools will be installed in the guest's initial ramdisk filesystem;
143 you can add any tools that you need. There are two required configuration
144 options. In the
145 ``\verb|BusyBox settings->Build Options|" menu check the
146 ``\verb|Build BusyBox as a static binary (no shared libs)|" option, as shown in
147 figure \ref{fig:busyboxcf1}, and in the
148 ``\verb|BusyBox settings->Installation Options|" menu set the
149 ``\verb|Busybox installation prefix|" to the path of the
150 ``\verb|initrd/initramfs|" directory, as shown in figure \ref{fig:busyboxcf2}.
151 After you finish configuring BusyBox, save your configuration and quit the
152 window. Then, to make the BusyBox tools, type the following:
153
154 \begin{verbatim}
155 [jdoe@newskysaw busybox]$ make
156 \end{verbatim}
157 Install the tools to the guest's initial ramdisk filesystem directory:
158 \begin{verbatim}
159 [jdoe@newskysaw busybox]$ make install
160 \end{verbatim}
161
162 \begin{figure}[ht]
163   \begin{center}
164     \colfigsize\epsffile{linuxConf.eps}
165   \end{center}
166   \caption{Linux Kernel configuration}
167   \label{fig:linuxcf}
168 \end{figure}
169
170
171 \section{Configuring and building the Linux kernel}
172
173 The following procedure demonstrates how to configure and build a 32-bit Linux
174 kernel. Change to the ``\verb|linux-2.6.30.y/|" directory. There is a custom
175 configuration file ``\verb|jrl-default-config|" which is configured with minimal
176 kernel options (all unnecessary options are removed to keep the guest booting
177 process fast). If you are using the custom configuration file type the
178 following:
179
180 \begin{verbatim}
181 [jdoe@newskysaw linux-2.6.30.y]$ cp jrl-default-config .config
182 \end{verbatim}
183
184 \noindent
185 Configure the kernel to meet your requirements. For more on configuring and
186 building Linux kernels, check online. Type the following:
187
188 \begin{verbatim}
189 [jdoe@newskysaw linux-2.6.30.y]$ make ARCH=i386 menuconfig
190 \end{verbatim}
191
192 \noindent
193 or
194
195 \begin{verbatim}
196 [jdoe@newskysaw linux-2.6.30.y]$ make ARCH=i386 xconfig
197 \end{verbatim}
198
199 \noindent
200 The kernel must be configured with the initial ramdisk file system directory
201 (e.g. ``\verb|initrd/initramfs/|"): in the ``\verb|General setup|" menu under
202 option
203 ``\verb|Initial RAM filesystem and RAM disk support|" set the
204 ``\verb|Initramfs source file(s)|" option to the path of the
205 ``\verb|initrd/initramfs/|" directory, as shown in figure \ref{fig:linuxcf}.
206 Additionally, if you are using the ``\verb|root_files|" file to create devices
207 files, add the ``\verb|root_files|" file path, separated by a space, after the
208 initial ramdisk filesystem directory. When you are finished configuring the
209 kernel, save your configuration, and build a bootable ISO image:
210
211 \begin{verbatim}
212 [jdoe@newskysaw linux-2.6.30.y]$ make ARCH=i386 isoimage
213 \end{verbatim}
214
215 \noindent
216 The ISO image can be found here: ``\verb|arch/x86/boot/image.iso|", and will be
217 used in the section Configuring and building the guest image.
218
219
220 \section{Configuring and building the guest image}
221
222 Checkout the updated Palacios repository to the ``\verb|palacios/|" directory.
223 (You can find instructions for checking out the Palacios repository at
224 \url{http://www.v3vee.org/palacios/}). The guest creator utility is required for
225 building the guest image. Change to the ``\verb|palacios/utils/guest_creator|"
226 directory and build the guest creator utility:
227
228 \begin{verbatim}
229 [jdoe@newskysaw guest_creator]$ make
230 \end{verbatim}
231
232 \noindent
233 You will get the ``\verb|build_vm|" utility:
234 \begin{verbatim}
235 [jdoe@newskysaw guest_creator]$ file build_vm
236 build_vm: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked
237 (uses shared libs), for GNU/Linux 2.6.9, not stripped
238 \end{verbatim}
239
240 \noindent
241 The guest configuration file is written in XML. A sample configuration file is
242 provided: ``\verb|default.xml|". Make a copy of the default configuration file
243 named ``\verb|myconfig.xml|" and edit the configuration elements that you are
244 interested in (if a device is included in the guest configuration file, it
245 must be configured in the section Configuring and building Palacios or the guest
246 will not boot). Of particular importance is the ``\verb|files|" element. Comment
247 out this attribute:
248
249 \begin{verbatim}
250 <file id="boot-cd" filename="/home/jarusl/image.iso" />
251 \end{verbatim}
252
253 \noindent
254 Add an attribute that specifies the location of the Linux ISO image:
255
256 \begin{verbatim}
257 <file id="boot-cd" filename="../../../linux-2.6.30.y/arch/x86/boot/image.iso" />
258 \end{verbatim}
259
260 \noindent
261 When you are finished editing the guest configuration save the configuration
262 file. The guest image consists of the guest configuration file and the Linux
263 ISO image. Build the guest image with the guest creator utility:
264
265 \begin{verbatim}
266 [jdoe@newskysaw guest_creator]$ ./build_vm myconfig.xml -o guest.iso
267 \end{verbatim}
268
269 \noindent
270 The guest image, ``\verb+guest.iso+", is embedded in Kitten's
271 ``\verb|init_task|" in the section Configuring and building Kitten.
272
273
274 \pagebreak
275 \begin{figure}[h]
276   \begin{center}
277     \colfigsize\epsffile{kittenConf1.eps}
278   \end{center}
279   \caption{Kitten configuration}
280   \label{fig:kittencf}
281 \end{figure}
282
283 \begin{figure}[ht]
284   \begin{center}
285     \colfigsize\epsffile{kittenConf2.eps}
286   \end{center}
287   \caption{Kitten configuration}
288   \label{fig:kittencf2}
289 \end{figure}
290
291
292 \section{Configuring and building Palacios and Kitten}
293 \subsection*{Configuring and building Palacios}
294
295 You can find the detailed manual of getting and building Palacios and Kitten 
296 from scratch in the Palacios website (\url{http://www.v3vee.org/palacios}). Here
297 we only give the specific requirements related to the procedure of booting the
298 guest. To configure Palacios, change to the ``\verb|test/palacios/|" directory
299 and type the following:
300
301 \begin{verbatim}
302 [jdoe@newskysaw palacios]$ make menuconfig
303 \end{verbatim}
304
305 \noindent
306 or
307
308 \begin{verbatim}
309 [jdoe@newskysaw palacios]$ make xconfig
310 \end{verbatim}
311
312 \noindent
313 Don't forget to include the devices that your guest image requires. When you
314 have configured the components you want to build into Palacios, save the
315 configuration and close the window. To build Palacios type the following:
316
317 \begin{verbatim}
318 [jdoe@newskysaw palacios]$ make
319 \end{verbatim}
320 or
321 \begin{verbatim}
322 [jdoe@newskysaw palacios]$ make all
323 \end{verbatim}
324
325 \noindent
326 Once the Palacios static library has been built you can find the library file,
327 ``\verb+libv3vee.a+", in the Palacios root directory.
328
329 \subsection*{Configuring and building Kitten}
330
331 Configure Kitten. Change to the ``\verb+test/kitten/+" directory and type the
332 following:
333
334 \begin{verbatim}
335 [jdoe@newskysaw kitten]$ make menuconfig
336 \end{verbatim}
337
338 \noindent
339 or
340
341 \begin{verbatim}
342 [jdoe@newskysaw kitten]$ make xconfig
343 \end{verbatim}
344
345 \noindent
346 Under the ``\verb|Virtualization|" menu select the
347 ``\verb|Include Palacios virtual machine monitor|" option. Set the
348 ``\verb|Path to pre-built Palacios tree|" option to the Palacios build tree
349 path, ``\verb|..\palacios|", as shown in figure \ref{fig:kittencf}. Set the
350 ``\verb|Path to guest OS ISO image|" option to the guest image path,\\
351 ''\verb|../palacios/utils/guest_creator/guest.iso|'', as shown in figure
352 \ref{fig:kittencf2}.  When you have finished configuring Kitten, save the
353 configuration and close the window. To build Kitten type the following:
354
355 \begin{verbatim}
356 [jdoe@newskysaw kitten]$ make isoimage
357 \end{verbatim}
358
359 \noindent
360 This builds the bootable ISO image file with guest image, Palacios, and Kitten.
361 The ISO file is located in ``\verb+kitten/arch/x86_64/boot/image.iso+".
362
363 \pagebreak
364 \noindent
365 You have successfully created an ISO image file that can be booted on a machine.
366 You can boot the file on Qemu using the following sample command:
367
368 \begin{verbatim}
369 [jdoe@newskysaw test]$ /opt/vmm-tools/qemu/bin/qemu-system-x86_64 \
370         -smp 1 \
371         -m 2047 \
372         -serial file:./serial.out \
373         -cdrom kitten/arch/x86_64/boot/image.iso \
374         < /dev/null
375 \end{verbatim}
376
377 \noindent
378 We have finished the entire procedure for building a guest image and booting it
379 on the Palacios VMM. For more updated details, check the Palacios website
380 \url{http://www.v3vee.org/palacios} and Kitten website
381 \url{https://software.sandia.gov/trac/kitten} regularly.
382
383 \end{document}