Fedora Linux Support Community & Resources Center
  #1  
Old 28th June 2008, 09:43 AM
phe Offline
Registered User
 
Join Date: Nov 2006
Location: halleatbe
Posts: 360
kernel

Hello,

I have F8 running with a "standard" kernel 2.6.24.4-64.
I now want to build one of my own.
Who can help/guide me in this process ?

I have read already a lot of docs on the web.
But the whole process is not clear to me.
DO I REALLY NEED RPMBUILD to build my kernel? (I only need this new kernel for testing on 1 machine)

Before start, source rpm must be installed.
How can I check if these are already present?
When I do "$ rpm -qa | grep kernel" I do not get any line with kernel-sources . . . . .

I have installed them with "$ rpm -ivh kernel-2.6.24.4-64.fc8.src.rpm"
Afterwards I checked again with "$ rpm -qa | grep kernel", and I still do not get any line with "kernel-sources . . .".
Are my kernels-sources now installed? How to check this?

I wanted to do $make menuconfig" but I also got errors.
=> Must this command started in fix directory?
=> Can I run this command as a regular user? Or must this be done as root ?


Phe

Last edited by phe; 28th June 2008 at 10:00 AM.
Reply With Quote
  #2  
Old 28th June 2008, 10:18 AM
markkuk Offline
Registered User
 
Join Date: Apr 2005
Location: Finland
Posts: 5,075
Source RPMs aren't registered in the RPM database, that's why they never show up in "rpm -q". If the source tarball, patches and the .spec file appear under your RPM build directory, then the source RPM was installed.
"make menuconfig" must be run in the kernel source directory, and you should do it as a regular user.
Reply With Quote
  #3  
Old 28th June 2008, 12:26 PM
ppesci Offline
Registered User
 
Join Date: May 2006
Location: Caracas, Venezuela
Posts: 1,858
I disagree. If you have a package kernel-devel, that package has the sources.

HTH
__________________
Pietro Pesci Feltri

PowerBook 15" G4 and
MacBook Pro 17" Intel Core 2 Duo
Intel I5 Desktop
Reply With Quote
  #4  
Old 28th June 2008, 12:33 PM
phe Offline
Registered User
 
Join Date: Nov 2006
Location: halleatbe
Posts: 360
Quote:
Originally Posted by markkuk
Source RPMs aren't registered in the RPM database, that's why they never show up in "rpm -q".
. . . .
OK
This is clear to me.

Quote:
Originally Posted by markkuk
. . . . If the source tarball, patches and the .spec file appear under your RPM build directory, then the source RPM was installed. . . . .
RPM build directory ?
Do I need to build a RPM for a new kernel ? ?


Is this a STANDARD place and name ?
/usr/src/kernels/2.6.24.3-50.fc8-i686 , /usr/src/kernels/2.6.24.4-64.fc8-i686 . . . .
or
/usr/src/redhat/ (here I have SOURCES and SPECS)
or
/lib/kernel
or
. . . .

? ?? ? ?


.spec file ? (/usr/src/redhat/SPECES/kernel.spec )
What is this? What is it good for ?


Quote:
Originally Posted by markkuk
. . . . .
"make menuconfig" must be run in the kernel source directory, and you should do it as a regular user.
Kernel source directory :
I guess this is in function of the kernel-version, or not ?

(= /usr/src/redhat/SOURCES ) ? ?
But : is there a standard place where Fedora put its kernel sources ?


When I am as a regular user, in /usr/src/redhat/SOURCES, and I type in
Code:
"make menuconfig"
I get :
Code:
make: *** No rule to make target 'menuconfig'. Stop.
Why? What is wrong?


Regards,

phe

Last edited by phe; 28th June 2008 at 12:43 PM.
Reply With Quote
  #5  
Old 29th June 2008, 07:26 AM
ppesci Offline
Registered User
 
Join Date: May 2006
Location: Caracas, Venezuela
Posts: 1,858
If you wan to compile your own kernel, see:

http://fedoraproject.org/wiki/Docs/CustomKernel

I think is very complete.

HTH
__________________
Pietro Pesci Feltri

PowerBook 15" G4 and
MacBook Pro 17" Intel Core 2 Duo
Intel I5 Desktop
Reply With Quote
  #6  
Old 29th June 2008, 08:43 AM
phe Offline
Registered User
 
Join Date: Nov 2006
Location: halleatbe
Posts: 360
Quote:
Originally Posted by ppesci
If you wan to compile your own kernel, see:

http://fedoraproject.org/wiki/Docs/CustomKernel

I think is very complete.

HTH

Quote:
Originally Posted by http://fedoraproject.org/wiki/Docs/CustomKernel
Before starting, make sure the system has all the necessary packages installed, including the following:

* rpmdevtools
* yum-utils
. . . .
What is this good for?

I want to make 1 simple new kernel?
I do not need to redistribute the kernel.
Reply With Quote
  #7  
Old 29th June 2008, 09:38 AM
ppesci Offline
Registered User
 
Join Date: May 2006
Location: Caracas, Venezuela
Posts: 1,858
This is if you want to make kernel a package for install in your system.

if you only want to compile and install without package, you can compile directly. Last time I did, there was the method:

1) you must be root
2) go to kernel source directory, something like: /usr/src/kernel/2.6.24-92
3) execute the commands:
Quote:
make xconfig
make
make modules
make install
make modules_install
HTH
__________________
Pietro Pesci Feltri

PowerBook 15" G4 and
MacBook Pro 17" Intel Core 2 Duo
Intel I5 Desktop
Reply With Quote
  #8  
Old 29th June 2008, 11:09 AM
markkuk Offline
Registered User
 
Join Date: Apr 2005
Location: Finland
Posts: 5,075
Quote:
Originally Posted by phe
RPM build directory ?
Do I need to build a RPM for a new kernel ? ?
Source RPMs are used to build RPMs. If you don't want to build a kernel RPM, don't use the src.rpm package. Download a tarball from kernel.org instead.


Quote:
Originally Posted by phe
.spec file ? (/usr/src/redhat/SPECES/kernel.spec )
What is this? What is it good for ?
The .spec file tells the rpmbuild command how to build the RPM package.


Quote:
Originally Posted by phe
Kernel source directory :
I guess this is in function of the kernel-version, or not ?
It's the place where you unpacked the kernel sources and can be in any directory where you have write access.

Quote:
Originally Posted by phe
When I am as a regular user, in /usr/src/redhat/SOURCES, and I type in
Code:
"make menuconfig"
I get :
Code:
make: *** No rule to make target 'menuconfig'. Stop.
Why? What is wrong?
First of all, if you are a regular user you should build the kernel in a directory under your $HOME or in /tmp, not in a system directory. Second, you gave the command in a place that doesn't contain the kernel sources (and the Makefile).
Reply With Quote
  #9  
Old 29th June 2008, 11:44 AM
phe Offline
Registered User
 
Join Date: Nov 2006
Location: halleatbe
Posts: 360
Hi Markkuk,

Thanks for your feedback.

It becomes step by step more clear.
Bust there are still questions :

Quote:
Originally Posted by markkuk
Source RPMs are used to build RPMs. If you don't want to build a kernel RPM, don't use the src.rpm package. Download a tarball from kernel.org instead.



The .spec file tells the rpmbuild command how to build the RPM package.



It's the place where you unpacked the kernel sources and can be in any directory where you have write access.


First of all, if you are a regular user you should build the kernel in a directory under your $HOME or in /tmp, not in a system directory. Second, you gave the command in a place that doesn't contain the kernel sources (and the Makefile).
Regular user : how to build kernel in $HOME or /tmp ?

Is it enough to enter the command "$make menuconfig" in $HOME ? or /tmp ?
Must kernelsources not be located there ?


Where are my kernelsources located ?
In /usr/src/kernels/2.6.24.3-50.fc8-i686
or
/usr/src/redhat/SOURCES


Would it be better to do #make menuconfig as root in /usr/src/redhat/SOURCES ?
Or must it be in /usr/src/kernels/2.6.24.3-50.fc8-i686 ?
Reply With Quote
  #10  
Old 29th June 2008, 12:01 PM
SteveGYBE Offline
Registered User
 
Join Date: Jun 2007
Location: Lytham St Annes, Lancashire, UK
Posts: 338
phe - SOURCES contain the Linux 2.6.24 kernel source code as a tarball (linux-2.6.24.tar.bz2) and a patch file to raise it to kernel 2.6.24.4 (patch-2.6.24.4.bz2). All the other linux*.patch files are Fedora patches raise the kernel to Fedora 2.6.24.4-64.fc8. You will need to untar the actual Linux source before anything else.

It does depend on what sort of kernel you want to build. If you want to build a version of the Fedora kernel, then it is easiest to use "rpmbuild" to unpack and patch your source tree -

Create a "BUILD" directory alongside your SOURCES and SPECS directories,
CD to SPECS
Run rpmbuild -bp --target i686 kernel.spec

When (if??) this succeeds, go to /BUILD/kernel-2.6.24/linux-2.6.24.i686, and you can start with your "make menuconfig"...
Reply With Quote
  #11  
Old 29th June 2008, 01:40 PM
phe Offline
Registered User
 
Join Date: Nov 2006
Location: halleatbe
Posts: 360
Hello Steve,

So when I resume :

I have the kernel sources installed (from "$ rpm -ivh kernel-2.6.24.4-64.fc8.src.rpm")

and I have
/usr/src/kernels/2.6.24.4-64.fc8-i686
/usr/src/redhat/SOURCES
/usr/src/redhat/SPECS


Quote:
Originally Posted by SteveGYBE
It does depend on what sort of kernel you want to build. If you want to build a version of the Fedora kernel, then it is easiest to use "rpmbuild" to unpack and patch your source tree -

Create a "BUILD" directory alongside your SOURCES and SPECS directories,
CD to SPECS
Run rpmbuild -bp --target i686 kernel.spec

When (if??) this succeeds, go to /BUILD/kernel-2.6.24/linux-2.6.24.i686, and you can start with your "make menuconfig"...

There is something that I do not understand : Why using rpmbuild ?
I thought that a kernel could be build/configured only with "make menuconfig". ? ? ?

My first goal is to build a new kernel for my actual running version (so I will not change version !)
I want to get some experiances in creating kernels.
I want to go step by step (small step by small step).
And . . .

I want to understand each step I do (yes, sorry, this is somethings the most difficult)
(That is the reason why I go on on the rpmbuild).

regards,
Reply With Quote
  #12  
Old 29th June 2008, 02:57 PM
SteveGYBE Offline
Registered User
 
Join Date: Jun 2007
Location: Lytham St Annes, Lancashire, UK
Posts: 338
OK - without rpmbuild, all you need to do is:

- Untar the base kernel files: "tar xvf linux-2.6.24.tar.bz2"
- Change to the Linux 2.6.24 directory "cd linux-2.6.24"
- Patch kernel source to 2.6.24.4: "bunzip2 < ../patch-2.6.24.4.bz2 | patch -p1 -F1 -s"
- Apply 147 Fedora patches in the correct sequence (as specified by the ApplyPatch lines in SPECS/kernel.spec): "patch -p1 -F1 -s < ../<xxxxxx>.patch"
(replacing "../<xxxxxx>.patch" with the path and name of each actual patch.)
- Construct the i686 .config file from the relevant bits - config-generic, config-nodebug, config-x86-generic, config-i686 (See Makefile.config)
- Move your .config file to the source root linux-2.6.24
- Run "make oldconfig" to check .config and supply initial values of any new parameters.

Sorry, but at this point I am wondering whether a computer would be able to help with all this (e.g. rpmbuild -bp ...)

Last edited by SteveGYBE; 29th June 2008 at 03:07 PM.
Reply With Quote
  #13  
Old 29th June 2008, 07:00 PM
markkuk Offline
Registered User
 
Join Date: Apr 2005
Location: Finland
Posts: 5,075
Quote:
Originally Posted by phe
Regular user : how to build kernel in $HOME or /tmp ?

Is it enough to enter the command "$make menuconfig" in $HOME ? or /tmp ?
Must kernelsources not be located there ?
You must run the "make menuconfig" or other "make" commands in the directory containing the uncompressed kernel sources. Unpacking a kernel tarball creates a subdirectory, change to that directory and run "make menuconfig" there. See the Kernel Rebuild Guide
Quote:
Originally Posted by phe
Where are my kernelsources located ?
They are located in the place where you put them.
Reply With Quote
  #14  
Old 29th June 2008, 07:37 PM
phe Offline
Registered User
 
Join Date: Nov 2006
Location: halleatbe
Posts: 360
Hi Steve,

Thanks for you explanation.

I seen you start from the vary basic ! (nice !)
OK I am agree with you that rpmbuild could be helpfull for patching.

But what do you say what I have a source kernel of Fedora installed with rpm?
($ rpm -ivh kernel-2.6.24.4-64.fc8.src.rpm")


/usr/src/kernels/2.6.24.4-64.fc8-i686
/usr/src/redhat/SOURCES

phe
Reply With Quote
  #15  
Old 29th June 2008, 08:30 PM
SteveGYBE Offline
Registered User
 
Join Date: Jun 2007
Location: Lytham St Annes, Lancashire, UK
Posts: 338
phe -

kernel-2.6.24.4-64.fc8.src.rpm will try to install its files in /usr/src/redhat/SOURCES (if you haven't used "rpmdev-setuptree" to set up another area). This is where you find the Linux tarball and all the patches to bring the source up to the level required to build the Linux kernel for Fedora 2.6.24.4-64.fc8.

/usr/src/kernels/2.6.24.4-64.fc8-i686 is where the kernel-devel RPM flle puts its files - these are just those required to build kernel modules, not the full source code of the kernel. If you look in the "include/linux" subdirectory you will see these are the header files which describe the data structures used by the kernel which may need to be accessed by a kernel module.

However, the files in /usr/src/redhat/SOURCES will include these header files plus all the C code required to build the kernel itself.
Reply With Quote
Reply

Tags
kernel, kernel update

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
FC6 Kernel >= kernel-2.6.20-1.2962.fc6 = kernel panic Hlingler Using Fedora 3 1st August 2007 09:02 AM


Current GMT-time: 21:17 (Wednesday, 30-07-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat