Archive for March, 2011

Debian: Building a Linux Kernel from Git

March 6, 2011 Comments off

Building within Debian; steps for building a custom kernel directly from Linus’ Git repository.


  • Git: apt-get install git
  • Compiler and build tools:  apt-get install build-essential
  • ncurses library for menuconfig:  apt-get install libncurses5-dev

Download the Kernel Source

Download the linux git repository to your ~/linux-2.6.git directory.

cd ~
git clone git:// linux-2.6.git
cd linux-2.6.git

Check out a particular kernel version

To list the available kernel version tags:

git tag

Check-out a particular kernel version to compile:

git checkout -b AcerAspire_v2.6.35 v2.6.35

Configure the Kernel

Select the desired kernel options:

make menuconfig

The resulting config file is saved to .config.

Note:  Unless you know your hardware very well, creating a .config file from scratch is a very daunting task.  It is much better to start with an existing .config file from your existing kernel version source package or from another platform that is as close as possible to your desired configuration.

Save a copy of the config file in your repository so that you don’t lose it:

cp .config AcerAspire.config
git add AcerAspire.config
git commit -m “Save custom kernel config file.”

Compile the kernel for use with Debian:

make clean
make KDEB_PKGVERSION=custom.1.0  deb-pkg

Install the kernel

cd ..
ls -al *.deb
dpkg -i linux-image-2.6.35*.deb

Reboot to try the new kernel.

Clean up:

Clean out build files:

make clean

Clean out all generated files including the .config file:

make distclean


Categories: Linux