• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

stumped by kernel spec file

Felecha

Golden Member
Trying to learn about compiling a new kernel. Just installed FC4, with kernel = 2.6.11-1.1369_FC4. Found a webpage that gave steps for a new kernel, and at one point it says to edit the kernel-2.6.spec file. I cant find any such file anywhere. I gave up and just created a new file with the suggested edits and ran the next command and got errors saying this and that were required from the spec file.

As a rookie, I wish there were more sites where I could read more fully about what's going on with all this. It's sort of like "Here's what you do" bam - bam - bam and youre done. I would like more of "Here's what you're doing". I found one blog site that talked about what some of the pieces are and how they fit and how they work with each other, but it wasn't a tutorial that I could follow.

So I guess I do need both. Step by step, but with more explanation.

I'm not a complete rookie, I've been a programmer for 2 years, but only in Windows (.Net mostly, some Java). Command line and scripts I don't do too much but I'm excited to learn more, and really want to learn Linux.

Any place I can go?
 
And a puzzler right off -- the instructions said to download the new kernel (2.6.14 is what I got) and unpack it and reboot to it after adding it to grub.conf (I have XP on HD1, FC4 on HD2). Then proceed to the compiling.

I sort of grasp the idea of having multiple kernels available and being able to run whichever you choose to boot to. But how can you boot to a kernel before it's compiled?

See what a rookie I am?
 
Well, here's the whole tutorial. I read it as saying

1. unpack it - is that what rpm does?
2. [optional - display the contents]
3. configure grub [ when I opened grub.conf it was already there - rpm did that?]
4. reboot to new kernel
5. edit the spec file with vi
6. rpmbuild the source
7. check version in makefile
8. clean up
9. configure kernel options
10. compile the kernel
11. install the recompiled kernel

So reboot in step 4, compile in step 10???

************************************************************************************

Fedora Core 4 Kernel Compilation mini-HOWTO

Last update: September 19 2005
Compile and installation procedure for the Fedora Core 4 SMP kernel and the Marvell SATA driver module.
Brian Zoller (bkzoller at yahoo dot com)


1) Install the kernel and kernel source.

rpm -ivh i386/kernel-2.6.12-1.1447_FC4.i686.rpm (uniprocessor)
rpm -ivh i386/kernel-devel-2.6.12-1.1447_FC4.i686.rpm (uniprocessor)
rpm -ivh i386/kernel-smp-2.6.12-1.1447_FC4.i686.rpm (SMP)
rpm -ivh i386/kernel-smp-devel-2.6.12-1.1447_FC4.i686.rpm (SMP)
rpm -ivh i386/kernel-doc-2.6.12-1.1447_FC4.noarch.rpm
rpm -ivh SRPMS/kernel-2.6.12-1.1447_FC4.src.rpm

2) OPTIONAL -- Display the contents of the kernel source RPM.

rpm -qpl SRPMS/kernel-2.6.12-1.1447_FC4.src.rpm
(shows a list of kernel source files and patches)

3) Configure the bootloader for the new kernel.

vi /boot/grub/grub.conf (_OR_) vi /etc/lilo.conf
(kernel files should already be listed, otherwise add the new kernel)

4) Reoot the machine and select the new kernel at the boot prompt.

init 6 (or telinit 6 or reboot )

5) Verify SMP options and kernel version numbers.

For uniprocessor, change "buildsmp" to 0 and change "_FC4smp" to "_FC4":
cd /usr/src/redhat/SPECS
vi kernel-2.6.spec
[...]
%define buildup 1
%define buildsmp 1
[...]
%define sublevel 12
%define kversion 2.6.%{sublevel}
[...]
%if %{FC4}
%define release %(R="$Revision: 1.1447 $"; RR="${R##: }"; echo ${RR%%?})_FC4smp
%endif
[...]
perl -p -i -e "s/^SUBLEVEL.*/SUBLEVEL = %{sublevel}/" Makefile
perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{release}/" Makefile

6) Prepare the source code for compilation.

rpmbuild -bp --target i686 kernel-2.6.spec
cd /usr/src
ln -s redhat/BUILD/kernel-2.6.12/linux-2.6.12 linux
ln -s redhat/BUILD/kernel-2.6.12/linux-2.6.12 linux-2.6
ln -s redhat/BUILD/kernel-2.6.12/linux-2.6.12 linux-2.6.12

7) Check the kernel version in the Makefile.

cd /usr/src/linux
vi Makefile
EXTRAVERSION = -1.1447_FC4smp
If the value of EXTRAVERSION is "-prep", go back to step 5.

8) Clean up old files in the source code directory.

cd /usr/src/linux
cp -p .config config.org
make mrproper

9) OPTIONAL -- Configure the desired kernel options.

cd /usr/src/linux
cp -p /boot/config-2.6.12-1.1447_FC4smp .config
make xconfig (_OR_) make gconfig (_OR_) make menuconfig
(Processor type and features --> Processor family --> Pentium-III/Celeron/Xeon)
(configure additional modules and options, if desired)
(Save & Exit)

10) Compile the kernel.

cd /usr/src/linux
make bzImage
make modules

11) OPTIONAL -- Install the recompiled kernel and modules if any options were changed during step 9.

cp -p arch/i386/boot/bzImage /boot/vmlinuz-2.6.12-1.1447_FC4smp
cp -p .config /boot/config-2.6.12-1.1447_FC4smp
make modules_install

12) OPTIONAL -- After choosing to install the kernel in step 11, reboot the machine and select the new kernel at the boot prompt.

init 6 (or "telinit 6" or "reboot")

13) Download the patched Marvell SATA driver.

http://www.keffective.com/mvsata/FC3/mvsata-3.4.2-1.0_fc4.tgz

14) Compile and install the driver.

cd /tmp
gtar zxvf mvsata-3.4.2-1.0_fc4.tgz
cd mvsata-3.4.2-1.0_fc4/LinuxIAL
make clean
make
insmod mv_sata.ko
cp -p mv_sata.ko /lib/modules/2.6.12-1.1447_FC4smp/kernel/drivers/scsi/
depmod -ae -F /boot/System.map-2.6.12-1.1447_FC4smp 2.6.12-1.1447_FC4smp
mkinitrd -v -f /boot/initrd-2.6.12-1.1447_FC4smp.img 2.6.12-1.1447_FC4smp

15) OPTIONAL -- Load the driver automatically when booting the machine.

echo "alias scsi_hostadapter mv_sata" >> /etc/modprobe.conf
 
And I'm looking for the documentation in the source . . .

I downloaded kernel-smp-2.6.14-1.1637_FC4.i686.rpm from . . . now where did I find it? I googled for the 2.6.14 kernel, and I wanted smp because I have an Athlon 64 X2 and I was told that was the one to get.

I don't yet see docs in there
 
Originally posted by: Felecha
And I'm looking for the documentation in the source . . .

I downloaded kernel-smp-2.6.14-1.1637_FC4.i686.rpm from . . . now where did I find it? I googled for the 2.6.14 kernel, and I wanted smp because I have an Athlon 64 X2 and I was told that was the one to get.

I don't yet see docs in there

I don't think that's a source RPM. Notice one file in the how-to has the letters "src" and yours doesn't.

They seem to have you installing a binary kernel, booting from it, and then building another kernel from the src you installed.
 
Originally posted by: n0cmonkey

I don't think that's a source RPM. Notice one file in the how-to has the letters "src" and yours doesn't.

They seem to have you installing a binary kernel, booting from it, and then building another kernel from the src you installed.

I had begun to wonder that myself. Looks like that's it.

I had also wondered about getting the base source, so to speak. So there's just a config file that makes it an FC4? I thought there would be all kinds of extra stuff to give you the FC features and the look and feel etc.
 
Originally posted by: Felecha
OK, I found a source, I think.

http://yum.math.hmc.edu/os/fedora-core/4/SRPMS/kernel-2.6.14-1.1637_FC4.src.rpm

I have understood that there is a multiprocessor version named "smp" so I wont have that, but that the difference is really pretty minimal.

Good to go?

I think the SMP won't matter as much with regards to the source. You'll just have to add the SMP configuration (which may already be in your spec file).

I had begun to wonder that myself. Looks like that's it.

I had also wondered about getting the base source, so to speak. So there's just a config file that makes it an FC4? I thought there would be all kinds of extra stuff to give you the FC features and the look and feel etc.

I think RedHat uses a customized kernel. I'd stick with their sources.
 
Well, i went through the steps of the how-to above, and this time everything worked (so I guess rpm does create the spec file if it rpm's the source).

And I did add smp to the config as I went along.

Still have to scratch my head, though. Reboot to the new kernel in step 4, compile it in step 10. There must be some piece of the puzzle missing here for me
 
Originally posted by: Felecha
Well, i went through the steps of the how-to above, and this time everything worked (so I guess rpm does create the spec file if it rpm's the source).

And I did add smp to the config as I went along.

Still have to scratch my head, though. Reboot to the new kernel in step 4, compile it in step 10. There must be some piece of the puzzle missing here for me

Those steps installed a new binary kernel (rpm -ivh i386/kernel-2.6.12-1.1447_FC4.i686.rpm and rpm -ivh i386/kernel-smp-2.6.12-1.1447_FC4.i686.rpm). You would boot into one of those kernels. While using that kernel (which may have additions or changes that make compiling that version of the kernel easier for you) you compile and install a custom kernel (from rpm: rpm -ivh SRPMS/kernel-2.6.12-1.1447_FC4.src.rpm).

I think. 😉
 
At least you think. Not just a knee jerk.

So much to learn! So much to figure out. As a programmer in progress I want to know what's going on. It's kind of like being given a car and a bunch of tools and you can learn about cars by trying things, tearing things apart and looking them up on the internet to see what they do, etc. Is there a recommended book on what I'm playing with?

Or does everybody learn this way?
 
Originally posted by: Felecha
At least you think. Not just a knee jerk.

So much to learn! So much to figure out. As a programmer in progress I want to know what's going on. It's kind of like being given a car and a bunch of tools and you can learn about cars by trying things, tearing things apart and looking them up on the internet to see what they do, etc. Is there a recommended book on what I'm playing with?

Or does everybody learn this way?

This is probably the best way to learn. By the time a book makes print, it's 6 months behind.
 
OK, I've set a task for learning. I want to see if I can get a video player installed. FC4 has one called Totem that does not work. So I looked around and thought I would try Xine. This is mostly to see if I can download the files, compile and install and actually get it to work.

Right now I'm up against an environment variable LD_LIBRARY_PATH that seems to be needed and is missing in action.

Trying to remember someone showing me this before. The default shell is bash, and I thought I could create the LD_LIBRARY_PATH variable there.

So, following what I see there for PATH, I added so it now is

***************************************************************
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin:/sbin:/usr/bin:.
export PATH

unset USERNAME

LD_LIBRARY_PATH=/usr/local/lib
export LD_LIBRARY_PATH
***************************************************

But env does not show it. If I do a terminal and say

export LD_LIBRARY_PATH=/usr/local/bin

it shows in env for that terminal. I think I understand the idea of local variables existing only in their shell session if that's the term, but I thought that bash_profile would create it as a global, so to speak.

What am I missing here?
 
Is it that the big guys like PATH are created somewhere else, and only manipulated in /etc/profile and bash_profile? I would have to create LD_LIBRARY_PATH somewhere earlier in the chain of login events?
 
Originally posted by: Felecha
OK, I've set a task for learning. I want to see if I can get a video player installed. FC4 has one called Totem that does not work. So I looked around and thought I would try Xine. This is mostly to see if I can download the files, compile and install and actually get it to work.

Right now I'm up against an environment variable LD_LIBRARY_PATH that seems to be needed and is missing in action.

Trying to remember someone showing me this before. The default shell is bash, and I thought I could create the LD_LIBRARY_PATH variable there.

So, following what I see there for PATH, I added so it now is

***************************************************************
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin:/sbin:/usr/bin:.
export PATH

unset USERNAME

LD_LIBRARY_PATH=/usr/local/lib
export LD_LIBRARY_PATH
***************************************************

But env does not show it. If I do a terminal and say

export LD_LIBRARY_PATH=/usr/local/bin

it shows in env for that terminal. I think I understand the idea of local variables existing only in their shell session if that's the term, but I thought that bash_profile would create it as a global, so to speak.

What am I missing here?

Is it that the big guys like PATH are created somewhere else, and only manipulated in /etc/profile and bash_profile? I would have to create LD_LIBRARY_PATH somewhere earlier in the chain of login events?

This always confuses me a bit. ~/.bash_profile and ~/.bashrc are the two login configuration files (or whatever you want to call them, my brain is goo ATM). IIRC one is used for login shells, and the other for non-login shells. Try adding your changes to ~/.bashrc too, and see if that helps.
 
Sorry about your brain. With ~39000 posts, what else do you do?

Well, bashrc works. I create it there and it comes up in env. So I can get what I want but a new stumper! In bash_profile, PATH is added to, so I tried adding to LD_LIBRARY_PATH and it won't do it. I've tried everything I can think of.

In bashrc I say
****************************************
LD_LIBRARY_PATH=/usr/local/lib
export LD_LIBRARY_PATH
****************************************


and in bash_profile
*************************************************
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin:/sbin:/usr/bin:/usr/lib:.
export PATH

unset USERNAME

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib
export LD_LIBRARY_PATH
*******************************************************

The changes to PATH show in env, but not the changes to LD_LIBRARY_PATH.

 
Originally posted by: Felecha
Sorry about your brain. With ~39000 posts, what else do you do?

Well, bashrc works. I create it there and it comes up in env. So I can get what I want but a new stumper! In bash_profile, PATH is added to, so I tried adding to LD_LIBRARY_PATH and it won't do it. I've tried everything I can think of.

In bashrc I say
****************************************
LD_LIBRARY_PATH=/usr/local/lib
export LD_LIBRARY_PATH
****************************************


and in bash_profile
*************************************************
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin:/sbin:/usr/bin:/usr/lib:.
export PATH

unset USERNAME

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib
export LD_LIBRARY_PATH
*******************************************************

The changes to PATH show in env, but not the changes to LD_LIBRARY_PATH.

If ~/.bashrc works, why bother with ~/.bash_profile?

What does the new LD_LIBRARY_PATH end up as? And why not just add these directories to ld.so.conf or whatever and be done with it? 😛
 
You should only need to change LD_LIBRARY_PATH if you want to replace the directories configured in /etc/ld.so.conf and there's no reason to do that for a simple kernel build.
 
Right, both of you. I see that I can get control of it now the way I want, I was just puzzled that after "editing" the value for LD_LIBRARY_PATH in ~/.bash_profile, it still showed in the terminal as the value set in ~/.bashrc when I ran env. Whereas ~/.bash_profile seems able to "edit" the PATH.

Just wanting to know what's going on in there.

This has been a wonderful weekend, I've learned so much! I had one course in school where we did some RedHat 6, but it was at the level of Here's what you do, not Here's what you're doing. And with what I've learned on the job these last 2 years, it's tons easier now to see things and to know what my questions are and how to go about poking around to answer them. Tip of the iceberg!

And whatever anyone may say about FC4 vs others, it's way ahead of RH 6 in its desktop stuff. The new Nautilus is almost as useful as Windows Explorer now. I want to learn the command line stuff but at times I just want to get to a file and open it and I don't type that well, especially the ~./>|$# kind of typing
 
Still blundering about. After some time not being able to get xine to work, I started all over. Deleted every file that seemed to have anything to do with xine. Had to retrieve libXinerama's from the Trash. So I got new fresh downloads of the tar.gz's, this time I created a directory /usr/src/xine for both the xine and xine-ui. Unpacked them, they created their own directories. Ran ./configure, make, make install on xine first, then xine-ui. All ran through OK as far as I can tell.

So I downloaded a copy of a favorite mpg
Herding Cats

I can't figure out how to get xine to play it.

Months ago I had RedHat 9 and after doing the xine install (with lots less understanding of what I was doing) it was just . . . there. I don't remember any steps needed to get files to play. I was under the impression that once the install was done the install process had finished up lots of housework for you - making links, putting info into startup files, whatever.

The docs I've been able to find only seem to tell you how to install with make, etc. Nothing I can find that says OK, now that you're in, here's how you use it.

I guess I'm used to Windows - install it and click the finish button and an icon is on your desktop and file types are already associated (often aggressively so)

Sorry to be dense here, I just can't find it.
 
Back
Top