LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices


Reply
  Search this Thread
Old 04-25-2011, 03:04 AM   #1
CollieJim
Member
 
Registered: Mar 2005
Distribution: Gentoo, Kubuntu
Posts: 582

Rep: Reputation: 28
build new kernel with patches


I need to build a new kernel. I was directed to
http://fedoraproject.org/wiki/Docs/CustomKernel in another forum.

I tried following the instructions but I think I may have ended up with way more than I wanted. After just over 3 hours the build exhausted the 5.2GB I had available and fell over. The .config file used was nearly twice the size of the one I supplied. Why was it changed?

I don't need an rpm.

Are the patches supplied with the 2.6.38 sources required or nice to have?

If required, how do I apply them so I can do a simple build?

TIA
Jim
 
Old 04-25-2011, 04:21 AM   #2
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
@ Reply

Hi Jim,

Here are the steps by which you can build up custom kernel (Just had a look at the link you mentioned in the post) not sure if the steps I will mention will be as efficient as that one but I always do this:

1. Get the kernel from www.kernel.org
2. Usually it get downloaded to /user/Desktop location.
3. Copy it to the location where you have enough space.
3. If it is a .bz file use tar -xjvf file_name else go with tar -zxvf file_name.
4. Once the above file is extracted go in the extracted directory and check if you see any .config file
5. If not the next step is to run make config or make menu config or make gconfig or make xconfig depend which tool you want to use to create custom kernel. I prefer using make gconfig.
6. Once the tool is launched you can select which options you want there in the custom kernel. Make sure that your custom kernel is modular so that you can load device drivers as module instead of compiling them with kernel. This also enhances performance.
7. Once done with building up the configuration save it and exit the tool. This will create .config file in that location which will contain custom settings that you did with the tool (make config or make menuconfig etc)
8. Go to the file with the name MakeFile which will be in the same location as that of extraction. Change the EXTRAVERSION parameter in that file to the name that you would like to give to your custom kernel, save and exit. Do not change anything else.
9. Now before going with make rpm. Make sure that you have enough space on /usr directory. If you have anything important there then copy it to some other location. For me it worked even with 2 GB. But you can go with a little more say 3-4 GB.
10. Run the make rpm from the location where you have .config file.
11. After running the above command you will find the rpm in usr/src/RPMS/i386 if you have built it for i386 architecture else look under the appropriate architecture directory under /usr/src/RPMS
12. Run rpm -ivh rpm_filename (Do not run rpm -Uvh as this will upgrade your existing kernel and what if this new kernel didn't work for you)
13. After installing the new kernel make appropriate changes in /boot/grub/grub.conf file to reflect the new kernel load script.
14. Make initial RAM disk image for your new kernel. This you can do by going in /boot directory and then issuing makeinitrd /xyzkernel.img kernel_name. Where xyz will be the name of your custom kernel.
15. Reboot the system and see you see a new kernel entry at the startup in grub :-) If you find any issues with new kernel then we can always boot in old kernel to get it fixed :-)

Note:

If you are using make menuconfig, make gconfig or make xconfig then make sure that you have following packages installed:

ncurses
ncurses-devel
glibc-headers
glibc-devel
cpp
binutils
gcc
tcl
gtk2-devel
qt-devel
glib2-devel
libglade2-devel

Last edited by T3RM1NVT0R; 04-25-2011 at 04:22 AM.
 
Old 04-25-2011, 08:47 PM   #3
CollieJim
Member
 
Registered: Mar 2005
Distribution: Gentoo, Kubuntu
Posts: 582

Original Poster
Rep: Reputation: 28
Thanks. This is what I get:
Code:
/devel/kernel/linux-2.6.37 $ make rpm
make clean
set -e; cd ..; ln -sf /devel/kernel/linux-2.6.37 kernel-2.6.3704
/bin/sh /devel/kernel/linux-2.6.37/scripts/setlocalversion --save-scmversion
set -e; cd ..; tar -cz --exclude SCCS --exclude BitKeeper --exclude .svn --exclude CVS --exclude .pc --exclude .hg --exclude .git -f kernel-2.6.3704.tar.gz kernel-2.6.3704/.
set -e; cd ..; rm kernel-2.6.3704
rm -f /devel/kernel/linux-2.6.37/.scmversion
set -e; \
	/bin/sh /devel/kernel/linux-2.6.37/scripts/mkversion > /devel/kernel/linux-2.6.37/.tmp_version
set -e; \
	mv -f /devel/kernel/linux-2.6.37/.tmp_version /devel/kernel/linux-2.6.37/.version
rpmbuild  --target i386 -ta ../kernel-2.6.3704.tar.gz
Building target platforms: i386
Building for target i386
error: Name field must be present in package: (main package)
error: Version field must be present in package: (main package)
error: Release field must be present in package: (main package)
error: Summary field must be present in package: (main package)
error: Group field must be present in package: (main package)
error: License field must be present in package: (main package)
make[1]: *** [rpm] Error 1
make: *** [rpm] Error 2
Where do I supply these fields?

I also tried 'make binrpm-pkg', and got
Code:
...
  DEPMOD  2.6.37-04
+ cp arch/x86/boot/bzImage /var/tmp/kernel-2.6.3703-root/boot/vmlinuz-2.6.37-03
+ cp System.map /var/tmp/kernel-2.6.3703-root/boot/System.map-2.6.37-03
+ cp .config /var/tmp/kernel-2.6.3703-root/boot/config-2.6.37-03
+ cp vmlinux vmlinux.orig
+ bzip2 -9 vmlinux
+ mv vmlinux.bz2 /var/tmp/kernel-2.6.3703-root/boot/vmlinux-2.6.37-03.bz2
+ mv vmlinux.orig vmlinux
+ /usr/lib/rpm/brp-compress
Processing files: kernel-2.6.3703-3
Provides: kernel-2.6.37-03 kernel-drm
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Checking for unpackaged file(s): /usr/lib/rpm/check-files /var/tmp/kernel-2.6.3703-root
error: Installed (but unpackaged) file(s) found:
   /lib/modules/2.6.37-04/build
   /lib/modules/2.6.37-04/kernel/arch/x86/kernel/test_nx.ko
   /lib/modules/2.6.37-04/kernel/crypto/gf128mul.ko
   /lib/modules/2.6.37-04/kernel/crypto/ghash-generic.ko
   ...
   /lib/modules/2.6.37-04/source

RPM build errors:
    Installed (but unpackaged) file(s) found:
   /lib/modules/2.6.37-04/build
   /lib/modules/2.6.37-04/kernel/arch/x86/kernel/test_nx.ko
   ...
   /lib/modules/2.6.37-04/modules.symbols.bin
   /lib/modules/2.6.37-04/modules.usbmap
   /lib/modules/2.6.37-04/source
make[1]: *** [binrpm-pkg] Error 1
make: *** [binrpm-pkg] Error 2
I'm a bit low on download quota ATM so I used the sources and .config from my gentoo system.
 
Old 04-26-2011, 01:19 PM   #4
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
@ Reply

Source code is fine but don't use the same .config.

Create one with the steps I mentioned. Select and de-select the things during that modules as required.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: OLS: Kernel documentation, and submitting kernel patches LXer Syndicated Linux News 0 07-26-2008 12:40 AM
Which is the kernel build directory? I Can't find kernel build files crabsody Debian 7 01-09-2007 04:48 AM
usefulness of mandriva-patches in kernel, or just new 2.614. kernel from source? Emmanuel_uk Mandriva 6 12-20-2005 08:56 PM
upgraded kernel, won't let me compile kernel once Suspend2 patches are applied microsoft/linux Linux - Laptop and Netbook 3 10-02-2005 02:37 PM
kernel patches dominant Slackware 7 08-26-2004 09:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora

All times are GMT -5. The time now is 05:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration