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.


wrote up through the "running" section
[palacios.git] / manual / manual.tex
1
2 \documentclass[11pt]{article}
3
4 \usepackage{calc}
5 \usepackage{graphics}
6 %\usepackage{latex8}
7 \usepackage{times}
8 \usepackage{epsf}
9 \usepackage{epsfig}
10 \usepackage{graphicx}
11 \usepackage{changebar}
12 \usepackage{portland}
13 \usepackage{lscape}
14
15 \setlength{\textheight}{8.50in}
16 \setlength{\textwidth}{6.5in}
17 \setlength{\topmargin}{-0.3in}
18 %\setlength{\leftmargin}{2.9in}
19 %\setlength{\rightmargin}{-2.9in}
20 \setlength{\oddsidemargin}{0in}
21 \setlength{\parindent}{0.5in}
22
23
24 \begin{document}
25
26 \title{
27 \includegraphics[height=1.5in]{v3vee.pdf}
28 \includegraphics[height=1.5in]{logo6.png} \\
29 \vspace{0.5in} 
30 Palacios Internal Developer Manual
31 }
32
33
34 \maketitle
35
36
37 This manual is written for Internal Palacios developers. It contains
38 information on how to obtain the palacios code base, how to go about
39 the development process, and how to commit those changes to the
40 mainline source tree.  This assumes that the reader has read {\em An
41 Introduction to the Palacios Virtual Machine Monitor -- Release 1.0}
42 and also has a slight working knowledge of {\em git}.
43
44
45 \section{Overview}
46
47
48 Both Palacios and Kitten follow a hybrid development process that
49 uses both the centralized repository and distributed development
50 models. A central repository exists that holds the master version of
51 the code base. This central repository is cloned by multiple people
52 and in multiple places to support various development efforts. A
53 feature of git is that every developer actually has a fully copy of
54 the entire repository, and so can function independently until such
55 time as they need to resync with the master version. 
56
57 There are typically multiple levels of access to the central
58 repository, that are granted based on the type of developer being
59 granted access. The three basic developer types and their access
60 privileges are:
61
62 \begin{itemize}
63 \item Core Developers: These are the lead developers and are in
64 charge of managing the master repository. They have full read/write
65 access permissions to the central repository.
66
67 \item Internal Developers: Formal members of the development
68 team. These people are capable of pulling directly from the central
69 repository, but lack the ability to write directly to it. 
70
71 \item External Developers: People who are not actual members of the
72 development team. These people can only access the public repository
73 which is only updated to contain the release versions. 
74 \end{itemize}
75
76 Because internal and external developers cannot write directly to the
77 master repository, they need to first submit their changes to a core
78 developer before they can be added to the mainline. We will discuss
79 that process in Section~\ref{sec:submission}.
80
81
82 \section{Checking out Palacios}
83 The central palacios repository is located on {\em
84 newskysaw.cs.northwestern.edu} in {\em /home/palacios/palacios}. All
85 internal developers have read access to the directory. Each developer
86 must create their own local version of the repository, this is done
87 with {\em git clone}.
88
89 \begin{verbatim}
90 git clone /home/palacios/palacios
91 \end{verbatim}
92
93 This creates a local copy of the repository at {\em ./palacios/}.
94
95
96 All development work is done in the {\em devel} branch of the
97 repository. The developer can access this branch via:
98
99 \begin{verbatim}
100 git checkout --track -b devel origin/devel
101 \end{verbatim}
102
103 or 
104
105 \begin{verbatim}
106 /opt/vmm-tools/bin/checkout_branch devel
107 \end{verbatim}
108
109 {\em Important:}
110 Note that palacios is very actively developed so the contents of the
111 {\em devel} branch are frequently changing. In order to keep up to
112 date with the latest version, it is necessary to periodically pull the
113 latest changes from the master repository by running \verb.git pull..
114
115
116
117 \section{Checking out Kitten}
118
119 Kitten is available from Sandia National Labs, and is the main host OS
120 we are targetting with Palacios. Loosely speaking core Palacios
121 developers are internal Kitten developers, and internal Palacios
122 developers are external Kitten developers. Because we have limited
123 access to the Kitten repository, we are maintaining a local mirror
124 copy in {\em /home/palacios/kitten}. 
125
126 Kitten uses Mercurial for their source management, so you will have to
127 make sure the local mercurial version is configured correctly.
128 Specifically you should add the following python path to your shell environment.
129
130 \begin{verbatim}
131 export PYTHONPATH=/usr/local/lib64/python2.4/site-packages/
132 \end{verbatim}
133
134 You can then clone Kitten from the local mirror:
135 \begin{verbatim}
136 hg clone /home/palacios/kitten
137 \end{verbatim}
138
139 Both the Kitten and Palacios clone commands should be run from the
140 same direcotyr. This means that both repositories should be located at
141 the same directory level. The Kitten build process depends on this.
142
143 {\em Important:} Like Palacios, Kitten is very actively developed so
144 source tree is frequently changing. In order to keep up to date with
145 the latest version, it is necessary to periodically pull the latest
146 changes from the mirror repository by running \verb.hg pull. followed
147 by \verb.hg update..
148
149 \section{Compiling Palacios}
150 Palacios is capable of targeting 32 and 64 bit operating systems, and
151 includes a build process that supports both these
152 architectures. Furthermore, Palacios has multiple build locations,
153 with multiple makefiles: a top level build directory and a Palacios
154 specific build directory. The Palacios build process first generates a
155 static library that includes the Palacios VMM. This static library is
156 then linked into a host operating system. Palacios internally supports
157 GeekOS and can generate a complete OS image via a unified build
158 process. To combine Palacios with Kitten, it is necessary to first
159 compile Palacios and then to compile Kitten externally link it with
160 Palacios. The output of the compilation process is a bit more complex
161 and generates multiple binaries, and the specifics can be found in the
162 Makefiles.
163
164 The top level build directory provides a number of high level make
165 targets, and is located in {\em palacios/build/}. It supports building
166 32 and 64 bit versions of the Palacios library independently as well
167 as building an integrated version of GeekOS.   The basic targets are:
168 \begin{itemize}
169 \item \verb.make palacios-full32. -- Generates a 32 bit version of the Palacios static library 
170 \item \verb.make palacios-full64. -- Generates a 64 bit version of the
171 Palacios static library
172 \item \verb.make geekos. -- Compiles the GeekOS kernel, and link it with the
173 Palacios static library 
174 \item \verb.make geekos-iso. -- Generate an ISO boot disk image from the
175 GeekOS kernel that has been compiled
176 \end{itemize}
177
178 The second build directory is located at {\em palacios/palacios/build}
179 and handles only the Palacios compilation process. It supports a
180 differnt set of targets and arguments:
181 \begin{itemize}
182 \item \verb.make ARCH=32. -- iteratively compiles a 32 bit version of Palacios
183 \item \verb.make ARCH=64. -- iteratively compiles a 64 bit version of
184 Palacios
185 \item \verb.make ARCH=32 world. -- fully recompiles a 32 bit version of
186 Palacios
187 \item \verb.make ARCH=64 world. -- fully recompiles a 64 bit version of
188 Palacios
189 \end{itemize}
190
191 Both build levels support compilation directives that control the
192 debugging messages that are generated by Palacios. These are specified
193 by appending a \verb.DEBUG_<COMPONENT>=1. to the end of the
194 \verb.make. command. The components that are currently supported are:
195 \begin{itemize}
196 \item \verb.DEBUG_ALL=1. -- enables debugging for all the VMM components
197 ({\em Warning:} this generates a {\em lot} of debug information.
198 \item \verb.DEBUG_SHADOW_PAGING=1.
199 \item \verb.DEBUG_CTRL_REGS=1.
200 \item \verb.DEBUG_INTERRUPTS=1.
201 \item \verb.DEBUG_IO=1.
202 \item \verb.DEBUG_KEYBOARD=1.
203 \item \verb.DEBUG_PIC=1.
204 \item \verb.DEBUG_PIT=1.
205 \item \verb.DEBUG_NVRAM=1.
206 \item \verb.DEBUG_GENERIC=1.
207 \item \verb.DEBUG_EMULATOR=1.
208 \item \verb.DEBUG_RAMDISK=1.
209 \item \verb.DEBUG_XED=1.
210 \item \verb.DEBUG_HALT=1.
211 \item \verb.DEBUG_DEV_MGR=1.
212 \item \verb.DEBUG_APIC=1.
213 \end{itemize}
214
215
216
217 \section{Compiling Kitten}
218 Kitten requires a 64 bit version of Palacios, so make sure that
219 Palacios has been correctly compiled before compiling Kitten.
220
221 \subsection{Configuration}
222 Kitten borrows a lot of concepts from Linux, including the Linux build
223 process. As such it must be configured before it is actually compiled.
224 The Kitten configuration process is the same as Linux, and can be
225 accessed via any of these make targets.
226 \begin{itemize}
227 \item \verb.make xconfig.
228 \item \verb.make config.
229 \item \verb.make menuconfig.
230 \end{itemize}
231
232 There are some specific configuration options that should be disabled
233 to work with Palacios. Because Palacios is configured by default to
234 provide a guest with direct access to the VGA console, the {\em VGA
235 console} device driver should be disbabled in the Kitten
236 configuration. Similarly the {\em VM console} driver should be
237 disabled as well.
238
239 Furthermore, because the VGA console is not being used the {\em Kernel
240 Command Line Arguments} must be modified to remove the {\em VGA}
241 device from the console list.
242
243 The guest OS that is booted as a VM is included as an ISO image in raw
244 binary format inside Kitten's {\em init\_task}. To change the guest
245 ISO, you must change the makefile for the init\_task. This is located
246 in {\em user/hello\_world/Makefile} and the syntax is well commented.
247 On {\em newskysaw} a collection of guest ISO images are located in
248 {\em /opt/vmm-tools/isos/}. 
249
250
251 \subsection{Compilation}
252 After Kitten has been configured the compilation can be done. The
253 general process is to compile a reference build of Kitten, followed by
254 compiling Palacios support as a kernel module, and then doing a new
255 full recompilation of Kitten.
256
257 The specific compilation steps are run from the top level Kitten directory:
258 \begin{verbatim}
259 make
260 cd palacios
261 make -C .. M=`pwd`
262 cp built-in.o ../modules/palacios-mod.o
263 cd ..
264 make
265 make isoimage
266 \end{verbatim}
267
268 This generates an ISO boot image containing Kitten, Palacios, and the
269 guest that will be run as a VM. The ISO image is located at {\em
270 ./arch/x86\_64/boot/image.iso}.
271
272
273 \section{Running Palacios/Kitten}
274 Kitten and Palacios are capable of running under Qemu, which makes
275 debugging much simpler.
276
277 The basic form of the command to start the Qemu emulator is:
278 \begin{verbatim}
279 /usr/local/qemu/bin/qemu-system-x86_64 -smp 1 -m 1024 \
280         -serial file:./serial.out \
281         -cdrom ./arch/x86_64/boot/image.iso  \
282         < /dev/null
283 \end{verbatim}
284
285 The command starts up a single processor emulated machine, with 1gig
286 of RAM and a cdrom drive loaded with the Kitten ISO image. Furthermore
287 all output to the serial port is written directly to a file called
288 {\em serial.out}. This command can be copied into a shell script for easy access.
289
290 \section{Development Guidelines}
291
292 32/64 bit compatibility
293 name space
294 coding guidelines
295
296
297 \section{Code Submission}
298 \label{sec:submission}
299 \subsection{Palacios}
300
301 \includegraphics[height=3.5in]{dev_chart.pdf}
302
303 stacked git
304
305 \subsection{Kitten}
306
307 mercurial queues
308
309 \section{Networking}
310
311 \section{Configuring the development host's Qemu network}
312 Set up Tap interfaces:
313
314 /root/util/tap\_create tapX
315
316 Bridging tapX with eth1 will only work (work = send packet and also make packet visible on localhost) if the IP address is set correctly (correctly = match network it is connected to  e.g., network of eth1)  so bring up the network inside of the VM / QEMU as 10-net, and it should route through the eth1 rule and be visible both on the host and in the physical network
317
318
319 \subsection{Configuring Kitten}
320
321 To enable networking in Qemu, networking needs to be enabled in the configuration.
322
323 Make sure turn on the network device driver, networking, and input
324 kernel command 'console=serial net=rtl8139'
325
326 How to set ip address in kitten:
327
328 Kitten ip address setting is in file drivers/net/ne2k/rtl8139.c, in the code below which is located in function rtl8139\_init.
329
330   struct ip\_addr ipaddr = { htonl(0 | 10 << 24 | 0 << 16 | 2 << 8 | 16 << 0) }; 
331   struct ip\_addr netmask = { htonl(0xffffff00) }; 
332   struct ip\_addr gw = { htonl(0 | 10 << 24 | 0 << 16 | 2 << 8 | 2 << 0) };
333
334 This sets the ip address as 10.0.2.16, netmask 255.255.255.0 and gateway address 10.0.2.2, change it as you need.
335
336
337
338 \subsection{Running with networking}
339
340 \paragraph*{Tap Interface}
341 In which, the command line: 
342
343 -net tap, ifname=tap2
344
345 specifies Qemu to use the host's tap0 as its network interface, then Qemu can access the host's physical network.
346
347 \paragraph*{Redirection}
348
349 Also you can use the following command instead to redirect host's 9555 port to Qemu's 80 port.
350
351 -net user -net nic,model=rtl8139  -redir tcp:9555::80
352
353 In this case, you can access Qemu's 80 port in the host like:
354
355 telnet localhost 9555
356
357 Qemu has many options to build up a virtual or real networking. See http://www.h7.dion.ne.jp/~qemu-win/HowToNetwork-en.html for more information.
358
359
360
361
362
363
364 For more questions, talk to Jack or Lei.
365
366 \end{document}