Repository navigation
Expand file tree
/
Copy pathBuildingLinux.html
More file actions
67 lines (55 loc) · 2.36 KB
/
Copy pathBuildingLinux.html
File metadata and controls
67 lines (55 loc) · 2.36 KB
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
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.11: http://docutils.sourceforge.net/" />
<title>Compiling the Linux Kernel</title>
<link rel="stylesheet" href="./s2e.css" type="text/css" />
</head>
<body>
<div class="document" id="compiling-the-linux-kernel">
<h1 class="title">Compiling the Linux Kernel</h1>
<p>Although S2E can run any Linux kernel, it is often convenient to recompile it to suit particular needs,
e.g., to enable Kprobes, add debug information, etc.</p>
<p>This sections explains how to compile S2E on a Debian system using a <tt class="docutils literal">chroot</tt> environment.</p>
<pre class="literal-block">
$ # Install the bootstrapping environment
$ sudo apt-get install debootstrap
$ # Create the directory with the chroot environment
$ mkdir ~/debian
$ # From now on, we need root rights
$ sudo -s
$ # Create the basic chroot environment
$ debootstrap lenny debian/ http://mirror.switch.ch/ftp/mirror/debian/
$ mount -t proc proc debian/proc
$ # Activate the chroot
$ chroot ~/debian
$ # Setup devices
$ cd /dev; MAKEDEV generic; cd ..
$ # Set the locale to UTF-8, otherwise perl will complain
$ export LANGUAGE=en_US.UTF-8
$ export LANG=en_US.UTF-8
$ export LC_ALL=en_US.UTF-8
$ locale-gen en_US.UTF-8
$ dpkg-reconfigure locales
$ # Install build tools and developer's libraries for ncurses
$ apt-get install build-essential kernel-package locales libncurses-dev
$ # Download the kernel
$ mkdir /root/kernel && cd /root/kernel
$ wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.26.8.tar.bz2
$ tar xjvf linux-2.6.26.8.tar.bz2
$ cd linux-2.6.26.8
$ # Select your options
$ make menuconfig
$ # Compile and generate kernel packages (that will be located in ../)
$ make-kpkg --append-to-version=-s2e --rootcmd fakeroot --cross-compile --initrd kernel_image kernel_headers
</pre>
<p>The result of the process is two <tt class="docutils literal">*.deb</tt> files that you can upload to your VM image.</p>
</div>
<div class="footer">
<hr class="footer" />
<a class="reference external" href="BuildingLinux.rst">View document source</a>.
</div>
</body>
</html>