Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Write an article for LinuxForums Today! Win Great Prizes!
Find the answer to your Linux question:
New to Linux Forums? Register here for free!
    Linux Forums > GNU Linux Zone > The Linux Kernel > How to compile kernel?(Problem)

Forgot Password?
 The Linux Kernel   Compiling, theory, programming or other discussion about the linux kernel

Site Navigation
Linux Articles
Linux Forums
Linux Downloads
Linux Hosting
Free Magazines
Job Board
IRC Chat
RSS Feeds
Linux Forum Topics
Linux Forums
Your Distro
Linux Resources
GNU Linux Zone
The Community
Reply
 
Thread Tools Display Modes
Old 09-08-2009   #1 (permalink)
Just Joined!
 
Join Date: Nov 2008
Posts: 57
How to compile kernel?(Problem)

Hi everybody i am trying to compile the kernel of xubuntu 9.04 but i have some problems with it.
according to below instructions i must be able to do it.but when i use fakeroot make-kpkg – -initrd – -append-to-version=-mw4 kernel_image kernel_headers command it gives error
the error is Error: Unknown target – Unknown target –
use --targets to display help on valid targets

how can i solve this problem has anybody come across with this problem before?




link:How to Compile an Ubuntu 9.04 Kernel | EasyLinuxCDs.com



Compile an Ubuntu 9.04 Kernel

The purpose of this tutorial is to show you how to set up a kernel that is highly tuned for your CPU, in this case a Pentium 4 with hyperthreading for a workstation.

Caution: If you do something wrong..it happens…be sure to reboot and select an alternative kernel. You should always have several kernels in case of trouble. DO THIS ON A TEST MACHINE or make sure you have a good backup.

Step #1: Download and install the necessary tools.
Download the necessary tools so that you have everything ready.

# apt-get install kernel-package libncurses5-dev fakeroot wget bzip2

You must have the source available to create a new kernel.

# apt-get install linux-source

You must be in the /usr/src directory to work or copy the source,
linux-source-2.6.28.tar.bz2, to the directory you want to work in. Either move into the /usr/src directory to work or into the alternative directory you will make the build in.

# cd /usr/src

This directory will contain the necessary headers to build the kernel. These are the source files.

You need to unpack the source that was downloaded.

# bzip2 -d linux-source-2.6.28.tar.bz2
# tar xvf linux-source-2.6.28.tar

Now you should have a directory that looks like this:

linux-source-2.6.28

Create a symbolic link to this source directory and name it linux.

# ln -s linux-source-2.6.28 linux

Move into the directory, you can use the term linux as it is now a link to that folder.

# cd linux

The config file is a hidden file that has the configuration from the kernel that is installed. You will need to copy that because it has already determined your hardware devices.

# cp /boot/config-`uname -r` ./.config

When you copy this config file over, it is a file represents the hardware that the kernel discovered at boot and set up. It also reflects many default settings.

Step #2: Now the fun begins….

You are ready to start menuconfig which will allow you to choose your kernel specifics.

make menuconfig

This opens the menu to start configuration.

Here you see it detected the .config file.

Now work your way through the menus and make the selections that you want to add or subtract. For example, here KVM is changed from being a module to load to actually being made a part of the kernel. It has been unchecked so modular support will not be available, thus saving space in your kernel. The “*” indicates that it will be loaded into the kernel and an empty option means that no support for that option will be placed in the kernel.

If you know about your hardware you can increase your speed by making the kernel smaller by removing those modules that you do not need. It is important that you make changes slowly so that if you have problems you have fewer places to troubleshoot.

Once you have all of your modifications complete save the new .config file.

Run this command to clean up.

# make-kpkg clean

The next thing you want to do is create a kernel extension so that as you make kernels you are able to tell the versions apart. What I usually do is place my initials and a number so that I can keep track.

# fakeroot make-kpkg – -initrd – -append-to-version=-mw4 kernel_image kernel_headers

After –append-to-version= you write a string that will help you keep track of your kernel changes, it must begin with a minus (-) and must not contain whitespace.

This will take awhile. This can take 3-6 hours depending on your CPU and memory.

After the successful kernel build, you can find two .deb packages in the directory you built the kernel in. If you were located in the linux directory, look in the directory above for the two .deb packages.

Now you can install and create .deb files so you can take your kernel to another machine with similar hardware. Run these commands as root in order to install them into the boot directory and modify your /boot/grub/menu.lst.

# dpkg -i linux-image-2.6.28.9mw4_2.6.28.9mw4-10.00.Custom_i386.deb

# dpkg -i linux-headers-2.6.28.9mw4_2.6.28.9mw4-10.00.Custom_i386.deb

You should now be able to select and test the new kernel when you reboot.

Now when I look in /boot/grub/menu.lst I see listed my new kernel:

## ## End Default Options ##

title Ubuntu 9.04, kernel 2.6.28.9mw4
uuid 10517256-c276-4517-821a-4986d477bb86
kernel /boot/vmlinuz-2.6.28.9mw4 root=UUID=10517256-c276-4517-821a-4986d477bb86 ro quiet splash
quiet

title Ubuntu 9.04, kernel 2.6.28.9mw4 (recovery mode)
uuid 10517256-c276-4517-821a-4986d477bb86
kernel /boot/vmlinuz-2.6.28.9mw4 root=UUID=10517256-c276-4517-821a-4986d477bb86 ro single

title Ubuntu 9.04, kernel 2.6.28-11-generic
uuid 10517256-c276-4517-821a-4986d477bb86
kernel /boot/vmlinuz-2.6.28-11-generic root=UUID=10517256-c276-4517-821a-4986d477bb86 ro quiet splash
initrd /boot/initrd.img-2.6.28-11-generic
quiet

title Ubuntu 9.04, kernel 2.6.28-11-generic (recovery mode)
uuid 10517256-c276-4517-821a-4986d477bb86
Caution: You will need space in the /boot directory to save kernels as you build them. I typically build my /boot directory with 500 MBs of space.

Tip:

Edit your timeout in the /boot/grub/menu.lst and increase it when you are building and trying kernels. That way it will not fly by so fast.

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 8

Tip:

Comment out the hiddenmenu so that you will see the menu on boot.
muhammedda is offline  



Reply With Quote
Old 09-08-2009   #2 (permalink)
tpl
Linux User
 
Join Date: Jan 2007
Location: cleveland
Posts: 382
try it like this:

fakeroot make-kpkg --initrd -append-to-version=-mw4 kernel_image kernel_headers

there's some extra punctuation in the HOWTO
__________________
the sun is new every day (heraclitus)
tpl is offline   Reply With Quote
Old 09-09-2009   #3 (permalink)
Just Joined!
 
Join Date: Nov 2008
Posts: 57
i did as you sad it worked but at he end of the process it gave the problem that error 255.

by the way what are the differences between make all command and fakeroot i have found lots of command about building the kernel.
muhammedda is offline   Reply With Quote
Old 09-09-2009   #4 (permalink)
Linux Guru
 
coopstah13's Avatar
 
Join Date: Nov 2007
Location: NH, USA
Posts: 2,235
I've found this guide to always work for me, I've used it on ubuntu as well.
8.6.*Compiling a New Kernel
coopstah13 is offline   Reply With Quote
Old 09-11-2009   #5 (permalink)
Just Joined!
 
Join Date: Nov 2008
Posts: 57
i am doing everything but there is no file which has .deb extension after process
muhammedda is offline   Reply With Quote
Old 09-14-2009   #6 (permalink)
Just Joined!
 
Join Date: Aug 2009
Posts: 3
I am thinking compiling kernel myself. I am reading something about it.
hejgelato is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Free Magazines
A Newbie's Getting Started Guide to Linux
Learn the basics of the Linux operating systems. Get to know what it is all about, and familiarize yourself with the practical side. Basically, if you're a complete Linux newbie and looking for a quick and easy guide to get you started this is it.
subscribe
Run Your Own Web Server Using Linux & Apache - Free 191 Page Preview
Learn about everything you'll need to build and maintain your Linux servers, and to deploy Web applications to them.
subscribe
Open Source Security Myths Dispelled
Dispel the five major myths surrounding Open Source Security and gain the tools necessary to make a truly informed decision for your IT organization
subscribe
InformationWeek
InformationWeek is the only newsweekly you'll need to stay on top of the latest developments in information technology.
subscribe



All times are GMT. The time now is 12:13 PM.






© 2000 - - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.3.1