``Recipe'' for Building a Kernel

CS 311

We're kernel hackers now. Building a kernel isn't for the faint of heart. Pay attention to everything below and take copious notes when we discuss this material, or you will find yourself starting over from the beginning with a new virtual machine image. Starting from a shell/terminal:

# The following "cd" simply ensures you're in your home directory.


# The following two svn commands perform the initial repository import of
# your kernel source tree and then make the local copy a working copy.
# REPLACE <u> below with YOUR username.

svn -q import linux- https://merlin.goucher.edu/svn/<u>/linux-

svn -q --force co https://merlin.goucher.edu/svn/<u>/linux-

# Location for kernel object files, so we can keep the kernel source
# relatively pristine.

mkdir build

cd linux-

# It's dot dot slash build slash dot config !!!!

cp minimal.config ../build/.config

# In the menuconfig tool, run below in the next step, select 'General
# setup' and then select 'Local
# version'.  Change the local version string to something like _TPK_00 .
# You can use the two digit number as a version number, incrementing it
# each time you add a new kernel feature.
# Exit the tool, saving the new .config file.

make O=/home/kdev/build menuconfig

make -j 3 O=/home/kdev/build

# The following command will install the kernel modules and the kernel.

sudo make O=/home/kdev/build modules_install install

# If you reboot now, your shiny new kernel should be available as one of
# the kernel choices in GRUB.

# This isn't really necessary, since you can use sudo, but here's how you
# gain root from the kdev account: 

su -

# Exiting root, returning to kdev account:


# It's probably best to change the kdev and root passwords.  Run the
# following commands as root:

passwd root
passwd kdev

# The SSH server is disabled.  Unless you know what you're doing, it's best
# to leave it disabled.  If you should want to enable it temporarily,
# run as root:

/etc/init.d/sshd start

# If you want to enable the SSH server permanently, run as root:

chkconfig --level 2345 sshd on
/etc/init.d/sshd start

# If you don't change the root and kdev passwords and you enable the SSH
# server, your machine WILL get pwned.

Thomas P. Kelliher 2012-02-13
Tom Kelliher