Can not install kernel source code!!!

General support questions including new installations
lnthai2002
Posts: 8
Joined: 2005/12/05 23:25:12

Can not install kernel source code!!!

Post by lnthai2002 » 2005/12/17 01:28:06

I have downloaded the kernel-2.6.9-22.0.1.EL.src.rpm from centos server but when i try to install it :

rpm -ihv kernel-2.6.9-22.0.1.EL.src.rpm

I received a lot of error (warning):

warning: user buildcentos does not exist - using root
warning: group buildcentos does not exist - using root

(around 200 lines like that)
and finally, i saw this

########################################### [100%]

I though the kernel source code has been installed so i can do the compilation but after make menuconfig, make clean produced this error:

[root@darkportal 2.6.9-22.0.1.EL-i686]# make dep && make clean && make bzImage
*** Warning: make dep is unnecessary now.
CHK include/linux/version.h
CHK include/asm-i386/asm_offsets.h
/bin/sh: arch/i386/kernel/asm-offsets.s: No such file or directory
UPD include/asm-i386/asm_offsets.h
mv: cannot stat `include/asm-i386/asm_offsets.h.tmp': No such file or directory
make: *** [include/asm-i386/asm_offsets.h] Error 1

I read some threads in this forum and all i understand is that i am missing the kernel source code. However, i did he installation for the source code, so what 's wrong with make clean???
Please help

theorist
Posts: 121
Joined: 2005/05/19 15:09:45

Re: Can not install kernel source code!!!

Post by theorist » 2005/12/18 16:38:59

The centos kernel has many patches installed over the vanilla version. If you are trying to build a kernel from the centos sources then you should use rpmbuild to do so. Also you would be wise not do this as root user but as a less priviledged one so there is no danger of over writing you present kernel.

I followed the instructions I found in:http://qa.mandrivalinux.com/twiki/bin/view/Main/RpmHowTo . Essentially, you create an /usr/src/redhat/rpm file structure in your own file system: ~/rpm/SPEC ~/rpm/SOURCES etc and then create a file in your home directory called .rpmmacros which tells the system where to find this directory. I added an entry %debug_package %{nil} which I hope will stop the automatic debuginfo builds.

You need to install redhat-rpm-config which was in the CentOS addons directory.

Then to rebuild the kernel rpm as a user (not root).

* Install the latest kernel-*-src.rpm
* Modify the kernel-2.6.spec script in SPECS to
o build only the kernel type you want (eg UP)
o change EL to EL.custom in the extraversion.
* In the SPECS directory run: rpmbuild -bp --target=i686 kernel-2.6.spec
(this will apply all the kernel patches)
* In the directory ~/rpm/BUILD/kernel-2.6.9/linux-2.6.9: cp configs/kernel-2.6.9-XXX.config ./.config (where XXX is the kernel architecture you are compiling.
* Run: make gconfig and select any new options you want (eg you may want NTFS file system as a module).
* Save and then cp ./.config SOURCES/kernel-2.6.9-XXX.config
* Rebuild the whole thing: rpmbuild -ba --target=i686 kernel-2.6.spec
* you will find you new kernel rpm in the ~/rpm/RPMS/i686 directory (or whichever architecture you are building for.
* You can remove the sources at the end by doing rpmbuild --rmsource kernel-2.6.spec.

Takes about 1.6GB of disk space to compile the kernel.

node
Posts: 5
Joined: 2007/04/03 17:00:07

Re: Can not install kernel source code!!!

Post by node » 2007/04/05 05:04:13

I am running CentOS4.4 and my Kernel is 2.6.9-42.0.8.0.plus.c4 the arch is i586. I am trying to load ndiswrapper 1.41 drivers. But I am getting can't find /lib/modules/2.6.9-42.0.8.0.plus.c4/build. I looked in /usr/src and it was not there either. I have the kernel on the CentOS CD but when I try and rpm it said that the kernel is on my system already.

Is there a way to put the kernel source code in build so I can get ndiswrapper to load. I am newbie so any help would be appreciated.

node

Lenard
Posts: 2283
Joined: 2005/11/29 02:35:25
Location: Indiana

Re: Can not install kernel source code!!!

Post by Lenard » 2007/04/05 09:13:27

See:

http://www.centos.org/modules/newbb/viewtopic.php?viewmode=flat&topic_id=7498&forum=27

node
Posts: 5
Joined: 2007/04/03 17:00:07

Re: Can not install kernel source code!!!

Post by node » 2007/04/05 13:01:25

Lenard,

I need you to walk me through this please. I read the pages over and over plus the links. Do I have to download an upgraded Kernel version from my existing one; extract the source code alone and I will get ndiswrapper to compile the drivers I need, or do I extract the source code, then compile the kernel, then make it the active kernel on my drive.

Is there away that I can use my existing kernel, I have the rpm of it, but the source is just not on my drive in the /lib/moudles/2.6.9-42.0.8.plus.c4/Build but trying to extract it, getting kernel already exist on my drive.

Lenard
Posts: 2283
Joined: 2005/11/29 02:35:25
Location: Indiana

Re: Can not install kernel source code!!!

Post by Lenard » 2007/04/05 16:53:54

[quote]
node wrote:
Lenard,

I need you to walk me through this please. I read the pages over and over plus the links. Do I have to download an upgraded Kernel version from my existing one; extract the source code alone and I will get ndiswrapper to compile the drivers I need, or do I extract the source code, then compile the kernel, then make it the active kernel on my drive.

Is there away that I can use my existing kernel, I have the rpm of it, but the source is just not on my drive in the /lib/moudles/2.6.9-42.0.8.plus.c4/Build but trying to extract it, getting kernel already exist on my drive.[/quote]

No you can download the same kernel source that you already have installed, you will have to do some work still.

Link to the source rpm file: http://isoredirect.centos.org/centos/4.4/centosplus/SRPMS/kernel-2.6.9-42.0.8.plus.c4.src.rpm

Install the source rpm file: rpm -ivh kernel-2.6.9-42.0.8.plus.c4.src.rpm

Prep the source:
cd /usr/src/redhat/SPECS
rpmbuild -bp --target i586 kernel-2.6.spec

The kernel source after prepping will be in the /usr/src/redhat/BUILD/kernel-2.6.9/linux-2.6.9 directory which is where to start building your custom kernel.

make mrproper
cp /boot/config- .config
make menuconfig

This is the important step, you need goto the kernel hacking section and disable the config 4k stack option (CONFIG_4KSTACKS) otherwise you will not be able to build ndiswrapper later. Then when done continue on:

make
make modules_install
make install

When done reboot the system to the new kernel (something like 2.6.9-42.0.8custom)

You could try either the prebuilt or the kernel source packages from here instead;
http://www.linuxant.com/driverloader/wlan/full/downloads-rhel40-kernel-i586.php

If you get the built kernel package also get the matching kernel-devel package also.

node
Posts: 5
Joined: 2007/04/03 17:00:07

Re: Can not install kernel source code!!!

Post by node » 2007/04/06 15:00:39

Lenard,

First let me say thanks for taking the time out to help, and point me in the right direction to getting me started. I am stuck at not having "rpm-build" installed on my drive. I tried rpm -e rpm-build and rpm -e rpmbuild and got "package rpm-build/rpmbuild not installed"

I want to build the kernel the way you showed me, that way I get the confidence, and feel the joy. I google rpm-build all night but did not find the package for CentOS 4.4; I downloaded one for Redhat 9 but got an error message when trying to install it with rpm -ivh.

The one I got was "rpm-build-4.2-0.69.i386.rpm" I got "Failed Dependencies" and a bunch of missing rpm directories. Can you advised where I can get the rpm-build for the CentOS 4.4 and am I issuing the correct command to install it.

node

User avatar
WhatsHisName
Posts: 1547
Joined: 2005/12/19 20:21:43
Location: /earth/usa/nj

Re: Can not install kernel source code!!!

Post by WhatsHisName » 2007/04/06 16:23:22

[code]# [b]yum whatprovides rpmbuild[/b]

rpm-build.i386 4.3.3-18_nonptl base

# [b]yum install rpm-build[/b]

Dependencies Resolved

=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
rpm-build i386 4.3.3-18_nonptl base 456 k

Transaction Summary
=============================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 456 k
Is this ok [y/N]:[/code]
...but aren’t you really looking for:

[code]# [b]yum --enablerepo=centosplus install kernel-2*c4 kernel-devel-2*c4[/b]

Dependencies Resolved

=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
kernel i686 2.6.9-42.0.10.plus.c4 centosplus 13 M
kernel-devel i686 2.6.9-42.0.10.plus.c4 centosplus 3.8 M

Transaction Summary
=============================================================================
Install 2 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 17 M
Is this ok [y/N]:

# [b]yum --enablerepo=centosplus info kernel-devel-2*c4[/b]

Summary: Development package for building kernel modules to match the kernel.

Description:
This package provides kernel headers and makefiles sufficient to build modules
against the kernel package.[/code]

Lenard
Posts: 2283
Joined: 2005/11/29 02:35:25
Location: Indiana

Re: Can not install kernel source code!!!

Post by Lenard » 2007/04/06 17:41:43

Errr.........

[quote]
...but aren’t you really looking for:

[code]
# yum --enablerepo=centosplus install kernel-2*c4 kernel-devel-2*c4

Dependencies Resolved

=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
kernel i686 2.6.9-42.0.10.plus.c4 centosplus 13 M
kernel-devel i686 2.6.9-42.0.10.plus.c4 centosplus 3.8 M
[/code]
[/quote]

No, this will not take care of the 4k stack issue with ndiswrapper and other such things......

User avatar
WhatsHisName
Posts: 1547
Joined: 2005/12/19 20:21:43
Location: /earth/usa/nj

Re: Can not install kernel source code!!!

Post by WhatsHisName » 2007/04/06 18:30:54

You can tell I’ve never done ndiswrapper. Wireless just isn’t my thing (too many bad experiences), but who knows, maybe “N” will turn out to be more than marketing hype.

Post Reply

Return to “CentOS 4 - General Support”