LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-03-2010, 01:21 PM   #1
mbwallace
LQ Newbie
 
Registered: Feb 2010
Posts: 3

Rep: Reputation: 0
Questions on how to compile a Linux Kernel


I am trying to address an issue, which I believe I can resolve through a recompile of the Linux Kernel. However, I have run into some road bumps in this process; and having limited exposure to Linux previously obviously does not help. I've been following what documents I can find online, but many just list a set of commands to walk through and don't tell you how to handle these road bumps.

THE PROBLEM

The Problem I am trying to address is one regarding SCSI devices, or rather programs that access these SCSI devices causing the following Kernel Warning Message:

sg_write: data in/out 4204/4204 bytes for SCSI command 0xd--guessing data in;
program java not setting count and/or reply_len properly

These messages are being caused by the IBM ServeRAID agent. Upon investigation, I found that this is not a problem unique to the ServeRAID agent, but that other programs that access SCSI devices also trigger this message. More information on this are at the following pages:

http://www.ibm.com/developerworks/fo...ageID=13940265
http://lists.xiph.org/pipermail/para...ly/001438.html
http://lists.xiph.org/pipermail/para...ly/001524.html

This new message/problem was introduced after linux kernel 2.6.9

IBM and Red Hat claim that these messages are benign, and should just be lived with. However, as per the postings in the above links, they can cause performance issues. For me, these messages occur about every five seconds. I know I can suppress these messages from displaying on the console, but then I will also be suppressing messages that I may want to know about. Also, suppressing these messages from the console doesn't stop them from flooding the logs. Again, I would rather keep the console and logs clean for legitimate warnings and errors.

WHAT I WOULD LIKE TO DO

I would like to recompile the Linux Kernel in the same exact configuration that my current kernel is in, except with a modified sg.c that omits this warning generating code, code that wasn't there in 2.6.9.

Prior to this, I would like to compile the Kernel exactly as I have it now, so I can compare it with the current Kernel files and know that I am indeed compiling it exactly as it is installed.

WHAT I'VE DONE SO FAR

I installed the Development Tools, so I have gcc.
I did a "yum install kernel-devel kernel-headers"
I downloaded kernel-2.6.18-164.11.1.el5.src.rpm
I tried to install this rpm in su, but came up with the following error

error: can not create %sourcedir /usr/src/redhat/SOURCES

I manually created the redhat and SOURCES directory
Tried to install the RPM again - this time it did, however with warnings
"user mockbuild does not exist - using root
group mockbuild does not exist - using root"
I'm not particularly worried about these warnings.

When I was done with this there was a directory /usr/src/SOURCES that was empty that was generated by this process. Don't know if this was the error in the original rpm or what. But I went into /usr/src/redhat/SOURCES and did a

tar -xjvf linux-2.6.18.tar.bz2 -C /usr/src

This created a directory ./linux-2.6.18 in /usr/src.

I went into this directory and tried #make oldconfig

From this, I got an onslaught of warnings: trying to assign nonexistant symbol ...

And then it started asking me about "NEW" options. I find this interesting, because this is supposed to be the same exact version of the kernel that I have now.

CONCERNS AND QUESTIONS

The nonexistent symbol warnings concern me. Not sure if they are expected or not. Do I have the correct directory structure? Are the .patch and some other files that are in /usr/src/redhat/SOURCES part of this? Are they supposed to be in the same directory? Or where are these symbols/modules expected to be?

Most of the tutorial documents I've read assume that you are compiling a new or different version of linux, and that you're just going to drop it into the /boot directory with "make install" and update grub. I would like to have these files separate. The first set so I can compare what I've compiled with the currently installed to see if I indeed compiled the exact same kernel, (and that I have this process down correctly). What do I need to do, modify a make file, change version number or some such to identify the different builds?

...as my experience is limited, I kind of need to be led step by step, and would like to know what each step does, rather than just going through a series of motions.

Thanks for the time and help in advance.

Extra Info:
I'm running Red Hat Enterprise Linux 5.4
IBM xSeries 250
4GB Ram
4MX RAID Controller

When I installed RHEL 5.4, I chose to install virtualization
The purpose of this server will be to run a Lotus Domino Server
We may also use the server as a file server in the future - to replace our OS/2 file server.
2NICs
Only other regular software we'll be using - Microlite BackupEdge and IBM's Raid_Agent.

Thanks,

Mack
 
Old 02-03-2010, 02:42 PM   #2
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by mbwallace View Post
The nonexistent symbol warnings concern me. Not sure if they are expected or not. Do I have the correct directory structure? Are the .patch and some other files that are in /usr/src/redhat/SOURCES part of this? Are they supposed to be in the same directory? Or where are these symbols/modules expected to be?
To answer your questions, the patched source for your kernel will be in

Code:
/usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.i386
I would make a copy of that directory using

Code:
cp /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.i386 /usr/src
Then make a symlink to "/usr/src/linux" using

Code:
ln -s /usr/src/linux-2.6.18.i386 /usr/src/linux
After those changes, you can follow almost any tutorial for building a 2.6 kernel and they will work. I think RedHat has some special tools for building kernels, but I have never used them.
 
Old 02-03-2010, 03:57 PM   #3
mbwallace
LQ Newbie
 
Registered: Feb 2010
Posts: 3

Original Poster
Rep: Reputation: 0
While there is a /usr/src/redhat/BUILD directory, there is nothing in it.

I thought perhaps that you thought the BUILD directory was the one with the .patch files in it, and rather than copying them, just tried to link that directory in the kernel source with

ln -s /usr/src/redhat/SOURCES /usr/src/linux-2.6.18/linux

however, there is already a link in the /usr/src/linux-2.6.18 directory
called SOURCES.

of course, I tried #make oldconfig again, and got the long list of


Quote:
# using defaults found in /boot/config-2.6.18-164.11.1.el5xen
#
/boot/config-2.6.18-164.11.1.el5xen:38:warning: trying to assign nonexistent symbol TASK_IO_ACCOUNTING
/boot/config-2.6.18-164.11.1.el5xen:58:warning: trying to assign nonexistent symbol ANON_INODES
/boot/config-2.6.18-164.11.1.el5xen:63:warning: trying to assign nonexistent symbol TRACEPOINTS
/boot/config-2.6.18-164.11.1.el5xen:64:warning: trying to assign nonexistent symbol MARKERS
/boot/config-2.6.18-164.11.1.el5xen:78:warning: trying to assign nonexistent symbol MODULE_SIG
/boot/config-2.6.18-164.11.1.el5xen:79:warning: trying to assign nonexistent symbol MODULE_SIG_FORCE
/boot/config-2.6.18-164.11.1.el5xen:86:warning: trying to assign nonexistent symbol PTRACE
/boot/config-2.6.18-164.11.1.el5xen:87:warning: trying to assign nonexistent symbol UTRACE
/boot/config-2.6.18-164.11.1.el5xen:114:warning: trying to assign nonexistent symbol X86_XEN
/boot/config-2.6.18-164.11.1.el5xen:160:warning: trying to assign nonexistent symbol TICK_DIVIDER
/boot/config-2.6.18-164.11.1.el5xen:166:warning: trying to assign nonexistent symbol PREEMPT_NOTIFIERS
/boot/config-2.6.18-164.11.1.el5xen:175:warning: trying to assign nonexistent symbol SWIOTLB
/boot/config-2.6.18-164.11.1.el5xen:182:warning: trying to assign nonexistent symbol ISCSI_IBFT_FIND
I also knoticed there are two .bz2 files that I've never unpacked that is is that SOURCES directory with the .patch files.

patch-2.6.18.4.bz2
xen-15502.tar.bz2

What are theses? Should they be extracted? Where should they be extracted to?
 
Old 02-03-2010, 04:07 PM   #4
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by mbwallace View Post
While there is a /usr/src/redhat/BUILD directory, there is nothing in it.
You might want to uninstall and reinstall the source RPM.

The errors about not being able to create the directory are not normal. Make sure you have the right privileges for installing the RPM. For example

Code:
$ sudo rpm -Uvh kernel-2.6.18-164.11.1.el5.src.rpm

Last edited by David1357; 02-03-2010 at 04:09 PM. Reason: Add method for reinstalling source RPM
 
Old 02-03-2010, 07:19 PM   #5
mbwallace
LQ Newbie
 
Registered: Feb 2010
Posts: 3

Original Poster
Rep: Reputation: 0
Thank you for your response...

I uninstalled and cleared out the /usr/src directory to start from scratch.

Typed:
Quote:
# sudo rpm -Uvh kernel-2.6.18-164.11.1.el5.src.rpm
and I just get back...

Quote:
error: cannot create %sourcedir /usr/src/redhat/SOURCES
I've also tried this as "su" as well.

If I create the /usr/src/redhat and the /usr/src/redhat/SOURCES directory, it will unpack. However there are repetitive warnings:
Quote:
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
I don't believe that this is of too much concern. I'm guessing that the rpm was expecting a specific user or group called "mockbuild" - but if it's using root in its place, we should be fine.

This leaves me with the following:
/usr/src/redhat directory, which contains two directories
./SOURCES and ./SPECS

SOURCES contains a couple thousand .patch files, some config files, and three .bz2 files which I've mentioned earlier. One of the .bz2 files containing the actual C language source files. The other two, I'm not sure about.

SPECS contains one file "kernel-2.6.spec"

going back to the SOURCES directory, I can tar -xjvf linux-2.6.18.tar.bz2 to anywhere I specify, and that will be the linux source... that will create a linux-2.6.18 directory from within I can run various make commands. But of course I get all those warnings...
 
Old 02-04-2010, 10:56 AM   #6
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by mbwallace View Post
going back to the SOURCES directory, I can tar -xjvf linux-2.6.18.tar.bz2 to anywhere I specify, and that will be the linux source... that will create a linux-2.6.18 directory from within I can run various make commands. But of course I get all those warnings...
I think you need to follow these instructions to get the patched kernel.
 
  


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
More kernel compile questions Ook Slackware 19 05-10-2007 11:07 PM
Several more questions about kernel compile? BajaNick Slackware 3 01-11-2005 07:59 AM
4 questions on a new 2.6.9 kernel compile? Slovak Linux - General 2 11-29-2004 06:08 AM
kernel compile questions e1000 Slackware 10 10-23-2003 11:14 AM
[SOLVED] Kernel compile questions Bruce Hill Linux - General 11 07-14-2003 05:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:11 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