rpmbuild实际上正在安装我正在构建的软件包吗?我正在尝试构建内核模块的rpm包。它运行良好,直到它到达(%install)
。该错误声称没有权限。看起来它正在尝试安装模块。假设我做错了,或者我的SPEC
文件不正确,这是否安全?
输出错误:
[arozar@buildhost SPECS]$ rpmbuild -bb bypass.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.SbBJbR
+ umask 022
+ cd /home/arozar/rpmbuild/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /home/arozar/rpmbuild/BUILD
+ rm -rf bypass-9.0.6
+ /usr/bin/gzip -dc /home/arozar/rpmbuild/SOURCES/bypass-9.0.6.tar.gz
+ /bin/tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd bypass-9.0.6
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.nsuldT
+ umask 022
+ cd /home/arozar/rpmbuild/BUILD
+ '[' /home/arozar/rpmbuild/BUILDROOT/bypass-9.0.6-1.el6.x86_64 '!=' / ']'
+ rm -rf /home/arozar/rpmbuild/BUILDROOT/bypass-9.0.6-1.el6.x86_64
++ dirname /home/arozar/rpmbuild/BUILDROOT/bypass-9.0.6-1.el6.x86_64
+ mkdir -p /home/arozar/rpmbuild/BUILDROOT
+ mkdir /home/arozar/rpmbuild/BUILDROOT/bypass-9.0.6-1.el6.x86_64
+ cd bypass-9.0.6
+ LANG=C
+ export LANG
+ unset DISPLAY
+ rm -rf /home/arozar/rpmbuild/BUILDROOT/bypass-9.0.6-1.el6.x86_64
+ cd lib
+ make DESTDIR=/home/arozar/rpmbuild/BUILDROOT/bypass-9.0.6-1.el6.x86_64
make -C /lib/modules/2.6.32-504.23.4.el6.x86_64/build SUBDIRS=/home/arozar/rpmbuild/BUILD/bypass-9.0.6/lib modules
make[1]: Entering directory `/usr/src/kernels/2.6.32-504.23.4.el6.x86_64'
CC [M] /home/arozar/rpmbuild/BUILD/bypass-9.0.6/lib/bplib.o
LD [M] /home/arozar/rpmbuild/BUILD/bypass-9.0.6/lib/bypass.o
Building modules, stage 2.
MODPOST 1 modules
CC /home/arozar/rpmbuild/BUILD/bypass-9.0.6/lib/bypass.mod.o
LD [M] /home/arozar/rpmbuild/BUILD/bypass-9.0.6/lib/bypass.ko.unsigned
NO SIGN [M] /home/arozar/rpmbuild/BUILD/bypass-9.0.6/lib/bypass.ko
make[1]: Leaving directory `/usr/src/kernels/2.6.32-504.23.4.el6.x86_64'
+ '[' 2.6.32-504.23.4.el6.x86_64 '!=' 2.6.32-504.23.4.el6.x86_64 ']'
+ make install DESTDIR=/home/arozar/rpmbuild/BUILDROOT/bypass-9.0.6-1.el6.x86_64/lib/modules/2.6.32-504.23.4.el6.x86_64/kernel/lib/bypass.ko
make -C /lib/modules/2.6.32-504.23.4.el6.x86_64/build SUBDIRS=/home/arozar/rpmbuild/BUILD/bypass-9.0.6/lib modules
make[1]: Entering directory `/usr/src/kernels/2.6.32-504.23.4.el6.x86_64'
Building modules, stage 2.
MODPOST 1 modules
make[1]: Leaving directory `/usr/src/kernels/2.6.32-504.23.4.el6.x86_64'
# remove all old versions of the driver
find /lib/modules/2.6.32-504.23.4.el6.x86_64 -name bypass.ko -exec rm -f {} \; || true
find /lib/modules/2.6.32-504.23.4.el6.x86_64 -name bypass.ko.gz -exec rm -f {} \; || true
install -D -m 644 bypass.ko /lib/modules/2.6.32-504.23.4.el6.x86_64/kernel/lib/bypass/bypass.ko
install: cannot create directory /lib/modules/2.6.32-504.23.4.el6.x86_64/kernel/lib/bypass: Permission denied
make: *** [install] Error 1
error: Bad exit status from /var/tmp/rpm-tmp.nsuldT (%install)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.nsuldT (%install)
这是我的.rpmmacros
:
%_topdir %(echo $HOME)/rpmbuild
SPEC文件:
%define build_kernel 2.6.32-504.23.4.el6.x86_64
%define current_kernel %(uname -r)
%define destdir /lib/modules/%{current_kernel}/kernel/lib
%define realname bypass
%define lib lib
Name: %{realname}
Version: 9.0.6
Release: 1%{?dist}
Summary: Silicom Bypass Kernel Level Library
Group: Silicom Ltd.
License: GPLv2+
URL: http://www.silicom-usa.com
Source0: http://www.silicom-usa.com/ProductDrivers.aspx/%{realname}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
# BuildRequires:
# Requires:
%description
Silicom’s Quad Port Copper Gigabit Ethernet PCI Express Bypass server adapter is a PCI-Express X8 network interface card that contains four ports on a PCI-E adapter.
Silicom’s Quad Port Gigabit Ethernet Bypass server adapter supports Normal, Disconnect and Bypass modes.
%prep
%setup -q
%install
rm -rf $RPM_BUILD_ROOT
cd %{lib}
make DESTDIR=$RPM_BUILD_ROOT
if [ "%{build_kernel}" != "%{current_kernel}" ]; then
echo "This RPM is for %{build_kernel} kernel version. Ensure that you are usining the right module/kernel combo"
exit 1
fi
make install DESTDIR=$RPM_BUILD_ROOT%{destdir}/bypass.ko
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
# %doc
# %changelog