XNUXER.OR.ID





XNUXER


Xnuxer Research Laboratory of Internet Security and Open Source

www.xnuxer.or.id - we are concern to research technology about internet security and open source
 How to compile a kernel for Ubuntu Karmic  

I wrote this how to because my laptop has 4GB of internal memory and with the default kernel that ships with
Ubuntu Karmic the entire 4GB is not addressed.

Lets get started building our own custom kernel for Ubuntu Karmic from scratch.

Updates

November 13, 2009: Compilation: The NOEXTRAS is no longer used . CONCURRENCY_LEVEL is automatically
determined in the rules files.
November 10, 2009 : Changed the installation command. Thanks to comment by HotShotDJ
November 8, 2009 : Typo in the installing the kernel section. Only the headers were installed, not the image.

I wrote the follow up article: How to update your custom Ubuntu Karmic kernel after a new kernel release

Introduction

git
I’ll be using git to get the latest kernel version. This is my favorite way to get the sources and it is in my
opinion the fastest way to make changes later on when you want to update your own kernel to the latest
version.
I suggest adding my Launchpad repository to your system. The repository holds the latest version of git
and is usually updated within a day of a new release of git, follow the instructions on the page
Git Packages for Ubuntu to add my repository.

Arch
I am compiling the i386 version, if you want to compile for amd64 you need replace i386 for amd64 throughout
this article.

Flavor
I choose the name core2 as the flavor name as for my personal use I’ll build a kernel for a Core2 processor.
Besides the change of processor type in the configuration I also select support for 64GB as my laptop has
4GB, which is the main reason I started compiling my own kernels. I have some other changes but that’s
beyond this article.

Preparations

Let’s get started by preparing our machine for compiling a kernel for Ubuntu Karmic.
Open a terminal.

sudo su -
apt-get install fakeroot build-essential
apt-get install crash kexec-tools makedumpfile kernel-wedge
apt-get build-dep linux
apt-get install git-core libncurses5 libncurses5-dev

Create a directory where you would like to build your kernel, this directory will hold the kernel source in a
sub directory and all the deb files will end up in this folder. I choose /d1/development/kernel/karmic

Getting the source

cd /d1/development/kernel/karmic
git clone git://kernel.ubuntu.com/ubuntu/ubuntu-karmic.git source

The source code is installed in the directory source.

We will create a branch in which we will be doing our modifications. That way the master branch will stay in
tact which will make future updates a whole lot easier.
To see the latest version:

cd source
cat debian.master/changelog|more

Press q to get back to the prompt.
This results in something like this:

linux (2.6.31-15.50) UNRELEASED; urgency=low

CHANGELOG: Do not edit directly. Autogenerated at release.
CHANGELOG: Use the printchanges target to see the curent changes.
CHANGELOG: Use the insertchanges target to create the final log.

-- Stefan Bader Tue, 03 Nov 2009 09:58:14 +0100

linux (2.6.31-15.49) karmic-proposed; urgency=low

The latest version is the first version after the UNRELEASED section. In this case it is 2.6.31-15.49. Sometime
there is no UNRELEASED section and in that case the latest version is the first version you see.
You could select any version you see in the changelog but for the sake of this article we’ll use the latest
version.

git checkout Ubuntu-2.6.31-15.49 -b core2

This will create a branch called core2.

Creating a new config

I’ll be using the method of creating a new flavor, this adds a bit more work but you can always compile the
original kernels.

We’ll use the generic flavor as the base for our own flavor,core2.

cp debian.master/config/i386/config.flavour.generic debian.master/config/i386/config.flavour.core2
fakeroot debian/rules clean
debian.master/scripts/misc/kernelconfig oldconfig

To make changes to the configuration file we need to edit the configuration file. The kernel developers have
created a script to edit kernel configurations, unfortunately you will have to go through all the flavors for
this script to work properly.

debian.master/scripts/misc/kernelconfig editconfig

This script will show you which configuration is next to be edited. You should not make changes, you can
save the configuration if you like, the only time you have to edit the configuration is when you see

 * Run menuconfig on i386/config.flavour.core2... Press a key.

Make your changes, save the configuration and then keep going until the script ends.

When you’re done, make a backup of the config flavor file.

cp debian.master/config/i386/config.flavour.core2 ../.

Now we need to clean up the git tree

git reset --hard
git clean -xdf

Getting ready for compilation

Because we are going to be creating a new flavor based on a existing flavor (generic in my case) we need
to create some extra files. During compilation the process checks the previous release for some settings, as
we’re creating a local flavor it doesn’t exist in the source, so we’re creating it. The previous release in this
case is 2.6.31-14.48

ls debian.master/abi
cp debian.master/abi/2.6.31-14.48/i386/generic debian.master/abi/2.6.31-14.48/i386/core2
cp debian.master/abi/2.6.31-14.48/i386/generic.modules debian.master/abi/2.6.31-14.48/i386/core2.modules

Copy our flavored configuration file back.

cp ../config.flavour.core2 debian.master/config/i386/

We need to edit the following files

  • debian.master/scripts/misc/getabis
  • debian.master/rules.d/i386.mk

In the next few parts I’ll explain what you need to change

File: debian.master/scripts/misc/getabis

Search for the line:

getall i386 generic generic-pae 386

Change it in:

 getall i386 generic generic-pae 386 core2

File: debian.master/rules.d/i386.mk

Search for the line:

flavours        = generic generic-pae 386

Change it in:

flavours        = generic generic-pae 386 core2

We need to make the compilation process aware of our own flavor we want to compile.

cp debian.master/control.d/vars.generic debian.master/control.d/vars.core2

You can edit the file and make it your own.

arch="i386 amd64"
supported="Core2"
target="Geared toward Core2 systems."
desc="x86/x86_64"
bootloader="grub | lilo (>= 19.1)"
provides="kvm-api-4, redhat-cluster-modules, ivtv-modules, ndiswrapper-modules-1.9"

We need to commit our changes in the git repository.

git add .
git commit -a -m "Core2 modifications"

The text after -m is the message you add to your commit.

Compilation

It’s finally time for compiling but before we can start the compilation process there is one more step to do.
I didn’t put this in the Preparations section as you need to the following step whether you make changes to
the configuration or not

fakeroot debian/rules clean

To start the compilation.

skipabi=true skipmodule=true fakeroot debian/rules binary-core2

Next you need to run

skipabi=true skipmodule=true fakeroot debian/rules binary-indep

Installation

After the compilation is finished we’ll have several deb files in the parent directory.

linux-doc_2.6.31-15.49_all.deb
linux-headers-2.6.31-15-core2_2.6.31-15.49_i386.deb
linux-source-2.6.31_2.6.31-15.49_all.deb
linux-headers-2.6.31-15_2.6.31-15.49_all.deb
linux-image-2.6.31-15-core2_2.6.31-15.49_i386.deb

To install the files

cd ..
dpkg -i linux-headers-2.6.31-15-core2_2.6.31-15.49_i386.deb linux-headers-2.6.31-15_2.6.31-15.49_all.deb linux-image-2.6.31-15-core2_2.6.31-15.49_i386.deb

Check your bootloader if the newly installed kernel is the default one, for grub check the file
/boot/grub/menu.lst or if you run grub2 check /boot/grub/grub.cfg

Reboot and enjoy your newly installed kernel.


By Peter at blog.avirtualhome.com


Please register, you are currently just a guest here.
 
Similar Articles:
  • Preventing MySQL Injection Attacks With GreenSQL On Debian Etch
  • Install Sun Looking glass Desktop environment in Ubuntu
  • Backtrack 4 Beta - Shmoo Release
  • Installing ISP-fw (Firewall) On Linux
  • Ubuntu: Using apt-p2p For Faster Upgrades From Hardy To Intrepid
  •  (Votes #: 9)
    Comments (2)  Print
     
     #1 Author: antoshka2541  


    Member
    Здарова всем! Нашел рабочий сервис для просмотра гостей Вконтакте - http://vk-guests.com

    Publications: 0 | Comments: 88
       
     
     #2 Author: pirogofftosha88  


    Member

    Publications: 0 | Comments: 1
       
     
     Information  

    Members of Guest cannot leave comments.

     

    Welcome

    Welcome to XNUXER.OR.ID, by visit our site we like to help you to get main information about internet security and opensource so dont forget to update your knowledge every time using our website.

    Archives

    To access file download or private information here you must register, please register here.

    The Best News - Top 10

    Calendar

    «    February 2012    »
     
    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
     

    Site Statistics

    Top Contributors:
      1    webmaster 166


    Articles:
      This Hour: 0
      Today: 0
      This Month: 0
      All Time: 164


    Membership:
      Registered Today :18
      This Hour:1
      This Month:333
      Total:4540
      Banned:0

    Site Survey

    What do you think about our website?

    Excellent
    Good
    Fair
    Poor
    Bad

    Security Tracker

    Vuln: Pligg CMS 'status' Parameter SQL Injection Vulnerability
    Pligg CMS 'status' Parameter SQL Injection Vulnerability

    Vuln: Joomla! Multiple Information Disclosure Vulnerabilities
    Joomla! Multiple Information Disclosure Vulnerabilities

    Vuln: QEMU KVM CVE-2012-0029 Local Privilege Escalation Vulnerability
    QEMU KVM CVE-2012-0029 Local Privilege Escalation Vulnerability

    Vuln: Mozilla Firefox/SeaMonkey/Thunderbird XPConnect Security Check Cross Domain Scripting Vulnerability
    Mozilla Firefox/SeaMonkey/Thunderbird XPConnect Security Check Cross Domain Scripting Vulnerability

    Bugtraq: [ MDVSA-2012:013 ] mozilla
    [ MDVSA-2012:013 ] mozilla

    Visitor


    Translator

    Whois Info

    IP