LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   rpmbuild and kernel source code problem (https://www.linuxquestions.org/questions/linux-server-73/rpmbuild-and-kernel-source-code-problem-697403/)

gr217 01-14-2009 10:47 PM

rpmbuild and kernel source code problem
 
Hi everyone,

I have a linux kickstart and installing it on HP DL380 servers. On installing rpm for ethernet controller card I am getting the following error

[root ~]# rpm -ivh e1000-7.6.15a-1.src.rpm
error: cannot create %sourcedir /usr/src/redhat/SOURCES

After I create the directory the rpm is installed.

In the instructions for installing this rpm it was mentioned to build the kernel. But I am getting the following error

[root redhat]# rpmbuild -bb SPECS/e1000.spec
-bash: rpmbuild: command not found

[root ~]# cd /usr/src/redhat/
[root redhat]# ll
total 16
drwxr-xr-x 2 root root 4096 Sep 1 20:11 SOURCES
drwxr-xr-x 2 root root 4096 Sep 1 20:11 SPECS

Here is some information about the setup
[root redhat]# uname -r
2.6.9-42.ELsmp

[root ~]# ll /usr/src/
total 8
drwxr-xr-x 4 root root 4096 Sep 1 20:11 redhat

Can you please help me with the above problem and provide the steps to install the kernel source code?

p_s_shah 01-15-2009 12:29 AM

First thing first,
Quote:

[root redhat]# rpmbuild -bb SPECS/e1000.spec
-bash: rpmbuild: command not found
Try below commands for checking whether you are having rpmbuild command installed or not.
which rpmbuild
whereis rpmbuild

If you are not having rpmbuild command, download the necessary rpm and install it. rpmbuild may be part of rpm development packages.

Second thing, I dont think for installing NIC driver, you need to build kernel. It should be something like "Building rpm for ethernet driver using your kernel source." The same is supported at ftp://ftp.hp.com/pub/softlib2/softwa....15a-1.src.txt.

For that, you need to download source rpm for kernel 2.6.9-42.ELsmp and install it, so it will copy necessary directories at required location.
After that build the rpm for ethernet driver.

One strange thing is that, there are not precompiled rpm for the driver.

gr217 01-15-2009 03:17 AM

Hi
Thanks. I was able to get the rpmbuild command by installing the rpmbuild rpm.
As for the second problem I was not able to find kernel-2.6.9-42.ELsmp rpm, but kernel-2.6.9-42.EL is already installed on the server.
I downloaded the linux-2.6.9.tar.gz and extracted it as mentioned in the document. Since the uname -r is 2.6.9-ELsmp so, I copied the linux-2.6.9 to linux2.6.9-42ELsmp .I was able to execute the configure the kernel source code. But in the command
[root redhat]# rpmbuild -bb SPECS/e1000.spec
Some errors are comming. I am attaching the logs of the command

Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.58586
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd /usr/src/redhat/BUILD
+ rm -rf e1000-7.6.15a
+ /usr/bin/gzip -dc /usr/src/redhat/SOURCES/e1000-7.6.15a.tar.gz
+ tar -xvvf -
drwxr-xr-x root/root 0 2008-02-04 22:21:31 e1000-7.6.15a/
-rw-r--r-- root/root 33407 2007-12-12 04:56:46 e1000-7.6.15a/README
drwxr-xr-x root/root 0 2008-02-04 22:20:39 e1000-7.6.15a/src/
-rw-r--r-- root/root 165672 2008-02-04 22:17:02 e1000-7.6.15a/src/e1000_mac.o
-rw-r--r-- root/root 20767 2008-02-04 22:17:05 e1000-7.6.15a/src/.e1000_ethtool.o.cmd
-rw-r--r-- root/root 20596 2008-02-04 22:17:00 e1000-7.6.15a/src/.e1000_82543.o.cmd
-rw-r--r-- root/root 163536 2008-02-04 22:17:04 e1000-7.6.15a/src/e1000_param.o
-rw-r--r-- root/root 58503 2007-12-12 04:56:45 e1000-7.6.15a/src/e1000_phy.c
-rw-r--r-- root/root 136536 2008-02-04 22:16:57 e1000-7.6.15a/src/e1000_82540.o
-rw-r--r-- root/root 153196 2008-02-04 22:16:58 e1000-7.6.15a/src/e1000_82571.o
-rw-r--r-- root/root 234 2008-02-04 22:17:07 e1000-7.6.15a/src/.e1000.ko.cmd
-rw-r--r-- root/root 981 2008-02-04 22:17:06 e1000-7.6.15a/src/.e1000.o.cmd
-rw-r--r-- root/root 20519 2008-02-04 22:17:03 e1000-7.6.15a/src/.e1000_nvm.o.cmd
-rw-r--r-- root/root 11943 2007-12-12 04:56:45 e1000-7.6.15a/src/e1000.h
-rw-r--r-- root/root 148272 2008-02-04 22:16:59 e1000-7.6.15a/src/e1000_82541.o
-rw-r--r-- root/root 75060 2007-12-12 04:56:45 e1000-7.6.15a/src/e1000_ich8lan.c
-rw-r--r-- root/root 40783 2007-12-12 04:56:45 e1000-7.6.15a/src/e1000_80003es2lan.c
-rw-r--r-- root/root 153288 2008-02-04 22:17:03 e1000-7.6.15a/src/e1000_phy.o
-rw-r--r-- root/root 7853 2008-02-04 22:17:06 e1000-7.6.15a/src/e1000.mod.c
-rw-r--r-- root/root 7783 2007-12-12 04:56:45 e1000-7.6.15a/src/e1000_api.h
-rw-r--r-- root/root 2657635 2008-02-04 22:17:07 e1000-7.6.15a/src/e1000.ko
-rw-r--r-- root/root 0 2008-02-04 22:17:06 e1000-7.6.15a/src/Module.symvers
-rw-r--r-- root/root 20594 2008-02-04 22:17:06 e1000-7.6.15a/src/.kcompat.o.cmd
-rw-r--r-- root/root 2599273 2008-02-04 22:17:06 e1000-7.6.15a/src/e1000.o
-rw-r--r-- root/root 7385 2007-12-12 04:56:45 e1000-7.6.15a/src/e1000_phy.h
-rw-r--r-- root/root 59584 2008-02-04 22:17:07 e1000-7.6.15a/src/e1000.mod.o
-rw-r--r-- root/root 4440 2008-02-04 22:17:07 e1000-7.6.15a/src/e1000.7.gz
-rw-r--r-- root/root 20596 2008-02-04 22:16:58 e1000-7.6.15a/src/.e1000_82571.o.cmd
-rw-r--r-- root/root 47951 2007-12-12 04:56:45 e1000-7.6.15a/src/e1000_82543.c
-rw-r--r-- root/root 129516 2008-02-04 22:17:04 e1000-7.6.15a/src/e1000_manage.o
-rw-r--r-- root/root 158440 2008-02-04 22:17:00 e1000-7.6.15a/src/e1000_82543.o
-rw-r--r-- root/root 21368 2008-02-04 22:16:57 e1000-7.6.15a/src/.e1000_main.o.cmd
-rw-r--r-- root/root 43710 2007-12-12 04:56:45 e1000-7.6.15a/src/kcompat.h
-rw-r--r-- root/root 4261 2007-12-12 04:56:45 e1000-7.6.15a/src/e1000_mac.h
-rw-r--r-- root/root 12996 2008-02-04 22:17:07 e1000-7.6.15a/src/.e1000.mod.o.cmd
-rw-r--r-- root/root 20662 2008-02-04 22:17:01 e1000-7.6.15a/src/.e1000_80003es2lan.o.cmd
-rw-r--r-- root/root 208412 2008-02-04 22:17:05 e1000-7.6.15a/src/e1000_ethtool.o
-rw-r--r-- root/root 140832 2008-02-04 22:17:03 e1000-7.6.15a/src/e1000_nvm.o
drwxr-xr-x root/root 0 2008-02-04 22:17:06 e1000-7.6.15a/src/.tmp_versions/
-rw-r--r-- root/root 894 2008-02-04 22:17:06 e1000-7.6.15a/src/.tmp_versions/e1000.mod
-rw-r--r-- root/root 20519 2008-02-04 22:17:06 e1000-7.6.15a/src/.e1000_api.o.cmd
-rw-r--r-- root/root 41450 2007-12-12 04:56:45 e1000-7.6.15a/src/e1000_82571.c
-rw-r--r-- root/root 4270 2007-12-12 04:56:45 e1000-7.6.15a/src/e1000_osdep.h
-rw-r--r-- root/root 59511 2007-12-12 04:56:45 e1000-7.6.15a/src/e1000_mac.c
-rw-r--r-- root/root 3231 2007-12-12 04:56:45 e1000-7.6.15a/src/e1000_manage.h
-rw-r--r-- root/root 19829 2007-12-12 04:56:45 e1000-7.6.15a/src/e1000_82540.c
-rw-r--r-- root/root 22595 2007-12-12 04:56:45 e1000-7.6.15a/src/e1000_nvm.c
-rw-r--r-- root/root 20634 2008-02-04 22:17:04 e1000-7.6.15a/src/.e1000_param.o.cmd
-rw-r--r-- root/root 18389 2007-12-12 04:56:45 e1000-7.6.15a/src/e1000_hw.h
-rw-r--r-- root/root 4116 2007-12-12 04:56:45 e1000-7.6.15a/src/e1000_ich8lan.h
-rw-r--r-- root/root 70944 2007-12-12 04:56:45 e1000-7.6.15a/src/e1000_defines.h
-rw-r--r-- root/root 29498 2007-12-12 04:56:45 e1000-7.6.15a/src/kcompat_ethtool.c
-rw-r--r-- root/root 1640 2007-12-12 04:56:45 e1000-7.6.15a/src/e1000_82543.h
-rw-r--r-- root/root 20519 2008-02-04 22:17:03 e1000-7.6.15a/src/.e1000_phy.o.cmd
-rw-r--r-- root/root 189262 2008-02-04 22:20:39 e1000-7.6.15a/src/e1000_main.c
-rw-r--r-- root/root 140684 2008-02-04 22:17:06 e1000-7.6.15a/src/e1000_api.o
-rw-r--r-- root/root 20549 2008-02-04 22:17:04 e1000-7.6.15a/src/.e1000_manage.o.cmd
-rw-r--r-- root/root 20659 2008-02-04 22:17:00 e1000-7.6.15a/src/.e1000_ich8lan.o.cmd
-rw-r--r-- root/root 20539 2008-02-04 22:16:57 e1000-7.6.15a/src/.e1000_82540.o.cmd
-rw-r--r-- root/root 3459 2007-12-12 04:56:45 e1000-7.6.15a/src/e1000_82541.h
-rw-r--r-- root/root 152232 2008-02-04 22:17:01 e1000-7.6.15a/src/e1000_80003es2lan.o
-rw-r--r-- root/root 67077 2007-12-12 04:56:45 e1000-7.6.15a/src/e1000_ethtool.c
-rw-r--r-- root/root 363608 2008-02-04 22:16:57 e1000-7.6.15a/src/e1000_main.o
-rw-r--r-- root/root 131752 2008-02-04 22:16:58 e1000-7.6.15a/src/e1000_82542.o
-rw-r--r-- root/root 32956 2007-12-12 04:56:45 e1000-7.6.15a/src/e1000_api.c
-rw-r--r-- root/root 169076 2008-02-04 22:17:00 e1000-7.6.15a/src/e1000_ich8lan.o
-rw-r--r-- root/root 20519 2008-02-04 22:17:02 e1000-7.6.15a/src/.e1000_mac.o.cmd
-rw-r--r-- root/root 39449 2007-12-12 04:56:45 e1000-7.6.15a/src/e1000_82541.c
-rw-r--r-- root/root 19641 2007-12-12 04:56:45 e1000-7.6.15a/src/e1000_regs.h
-rw-r--r-- root/root 3919 2007-12-12 04:56:45 e1000-7.6.15a/src/e1000_80003es2lan.h
-rw-r--r-- root/root 20596 2008-02-04 22:16:59 e1000-7.6.15a/src/.e1000_82541.o.cmd
-rw-r--r-- root/root 20539 2008-02-04 22:16:58 e1000-7.6.15a/src/.e1000_82542.o.cmd
-rw-r--r-- root/root 2611 2007-12-12 04:56:45 e1000-7.6.15a/src/e1000_nvm.h
-rw-r--r-- root/root 10440 2007-12-12 04:56:45 e1000-7.6.15a/src/e1000_manage.c
-rw-r--r-- root/root 1564 2007-12-12 04:56:45 e1000-7.6.15a/src/e1000_82571.h
-rw-r--r-- root/root 25799 2007-12-12 04:56:45 e1000-7.6.15a/src/e1000_param.c
-rw-r--r-- root/root 7575 2007-12-12 04:56:45 e1000-7.6.15a/src/kcompat.c
-rw-r--r-- root/root 15001 2007-12-12 04:56:45 e1000-7.6.15a/src/e1000_82542.c
-rw-r--r-- root/root 11297 2007-12-12 04:56:45 e1000-7.6.15a/src/Makefile
-rw-r--r-- root/root 130264 2008-02-04 22:17:06 e1000-7.6.15a/src/kcompat.o
-rw-r--r-- root/root 1112 2007-12-12 04:56:46 e1000-7.6.15a/SUMS
-rw-r--r-- root/root 18671 2007-12-12 04:56:46 e1000-7.6.15a/COPYING
-rw-r--r-- root/root 12584 2007-12-12 04:56:46 e1000-7.6.15a/e1000.7
-rw-r--r-- root/root 11493 2008-02-04 22:21:20 e1000-7.6.15a/e1000.spec
-rw-r--r-- root/root 65 2008-02-04 22:17:07 e1000-7.6.15a/file.list
-rw-r--r-- root/root 7752 2007-12-12 04:56:46 e1000-7.6.15a/pci.updates
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd e1000-7.6.15a
++ /usr/bin/id -u
+ '[' 0 = 0 ']'
+ /bin/chown -Rhf root .
++ /usr/bin/id -u
+ '[' 0 = 0 ']'
+ /bin/chgrp -Rhf root .
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.58586
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd e1000-7.6.15a
+ mkdir -p /var/tmp/e1000-7.6.15a-root
++ uname -r
+ KV=2.6.9-42.ELsmp
+ KA=i386
++ echo 2.6.9-42.ELsmp
++ sed '{ s/hugemem//g; s/smp//g; s/enterprise//g; }'
+ KV_BASE=2.6.9-42.EL
+ '[' -e /usr/src/kernels ']'
++ echo 2.6.9-42.ELsmp
++ sed 's/-.*//'
++ echo 2.6.9-42.ELsmp
++ sed 's/\([0-9]*\.[0-9]*\)\..*/\1/'
+ KSP='/lib/modules/2.6.9-42.ELsmp/build
/usr/src/linux-2.6.9-42.ELsmp
/usr/src/linux-2.6.9
/usr/src/kernel-headers-2.6.9-42.ELsmp
/usr/src/kernel-source-2.6.9-42.ELsmp
/usr/src/linux-2.6
/usr/src/linux'
++ for d in '$KSP'
++ '[' -e /lib/modules/2.6.9-42.ELsmp/build/include/linux ']'
++ echo
++ for d in '$KSP'
++ '[' -e /usr/src/linux-2.6.9-42.ELsmp/include/linux ']'
++ echo /usr/src/linux-2.6.9-42.ELsmp
++ echo
++ for d in '$KSP'
++ '[' -e /usr/src/linux-2.6.9/include/linux ']'
++ echo /usr/src/linux-2.6.9
++ echo
++ for d in '$KSP'
++ '[' -e /usr/src/kernel-headers-2.6.9-42.ELsmp/include/linux ']'
++ echo
++ for d in '$KSP'
++ '[' -e /usr/src/kernel-source-2.6.9-42.ELsmp/include/linux ']'
++ echo
++ for d in '$KSP'
++ '[' -e /usr/src/linux-2.6/include/linux ']'
++ echo
++ for d in '$KSP'
++ '[' -e /usr/src/linux/include/linux ']'
++ echo
+ KSRC='
/usr/src/linux-2.6.9-42.ELsmp

/usr/src/linux-2.6.9'
++ awk '{ print $1 }'
++ echo /usr/src/linux-2.6.9-42.ELsmp /usr/src/linux-2.6.9
+ KSRC=/usr/src/linux-2.6.9-42.ELsmp
+ '[' -e /usr/src/linux-2.6.9-42.ELsmp/include/linux/rhconfig.h ']'
+ make -C src clean
make: Entering directory `/usr/src/redhat/BUILD/e1000-7.6.15a/src'
Makefile:116: *** Linux kernel source not configured - missing version.h. Stop.
make: Leaving directory `/usr/src/redhat/BUILD/e1000-7.6.15a/src'
error: Bad exit status from /var/tmp/rpm-tmp.58586 (%build)


RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.58586 (%build)


Please help me with this problem?

gr217 01-15-2009 03:20 AM

One more thing is that the version.h is being searched in /lib/modules/$(shell uname -r)/build/include/linux/version.h.

[root redhat]# ll /lib/modules/2.6.9-42.ELsmp/
total 672
drwxr-xr-x 9 root root 4096 Sep 1 02:52 kernel
-rw-r--r-- 1 root root 119161 Sep 1 02:52 modules.alias
-rw-r--r-- 1 root root 69 Sep 1 02:52 modules.ccwmap
-rw-r--r-- 1 root root 136140 Sep 1 02:52 modules.dep
-rw-r--r-- 1 root root 73 Sep 1 02:52 modules.ieee1394map
-rw-r--r-- 1 root root 357 Sep 1 02:52 modules.inputmap
-rw-r--r-- 1 root root 235 Sep 1 02:52 modules.isapnpmap
-rw-r--r-- 1 root root 114122 Sep 1 02:52 modules.pcimap
-rw-r--r-- 1 root root 67974 Sep 1 02:52 modules.symbols
-rw-r--r-- 1 root root 155849 Sep 1 02:52 modules.usbmap


There is no build folder

p_s_shah 01-15-2009 11:49 PM

Check out below:
 
1. In this particular codition, don't go for linux-2.6.9.tar.gz. As it may contain different version than 2.6.9-42.
Quote:

As for the second problem I was not able to find kernel-2.6.9-42.ELsmp rpm, but kernel-2.6.9-42.EL is already installed on the server.
Check whether it was Complied kernel rpm or Source kernel rpm.
# rpm -qa | grep kernel
# rpm -ql kernel-2.6.9-42.EL | more ( If this is displaying /lib/modules & /boot directories , then it is complied rpm, not the source one )
# rpm -ql kernel-2.6.9-42.EL.src | more ( If this is showing files in /usr/src/redhat, then it is a source rpm)

2.Have you gone through this steps, mentioned in README ?
<---------------------Start-------------------------->
Red Hat installation:
If the /usr/src/linux-<kernel-version> directory
does not exist, install the kernel source code per
Red Hat instructions. Once installed, follow the
commands listed below to configure the kernel source
to match the running kernel.

# cd /usr/src/linux-<kernel_version>
# make mrproper
# make -e KERNELRELEASE=`uname -r` oldconfig
# make -e KERNELRELEASE=`uname -r` dep

<---------------------End-------------------------->

3.
Quote:

One more thing is that the version.h is being searched in /lib/modules/$(shell uname -r)/build/include/linux/version.h.
Not much sure, but it should not search /lib/modules/, it should search /usr/src/redhat/ directory for the version.h.

Get back to us if still facing problems.

gr217 01-18-2009 02:03 AM

Hi,

Actually why I am doing all this is because earlier in our servers we used to have to have HP NC340T ethernet controller cards and for that our kickstart CD was sufficient, but now the hardware has been changed to HP NC364T and the ethernet ports are not being recognized by the rpm we used to install as part of our kickstart installation.

So if you have any other suggestions how we can detect those ethernet ports please suggest, as I want minimal changes in my kickstart CD?

gr217 01-18-2009 09:57 PM

I checked currently the e1000 driver is available in the kernel and its version is 7.0.33-k2-NAPI. However the hardware doesnot support this. So can you tell me how to upgrade the driver?

gr217 01-19-2009 03:10 AM

I was able to install the e1000 driver and the ethernet ports were also being detected.
But the problem remaining is how to include the rpms's in my kickstart because when I included the required package it didnot install them.
Also another problem that is now occuring is that the ifcfg-eth<2,3,4,5> files are not being created by default at /etc/sysconfig/network-scripts/ .

Please advise me how to include in kickstart and gow to create default files for all the interfaces after OS?


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