0

我正在为带有busybox的嵌入式设备而不是普通的GNU系统打包rpm。当我使用busybox安装时,它会安装模块,但甚至不尝试运行脚本。在常规系统上,它运行它们并失败(ofc,另一个版本的内核)。

问题:我哪里错了,如何解决?这是我的规范文件:

# The kernel version you are building for  
%define kernel 3.4.0-rc6-01292-g9b8149d  

# The name of the module you are supplying  
%define modname ktgrabber  
# The path to the module, after it is installed  
%define modpath /lib/modules/%{kernel}/kernel/net/ipv4  

# Which revision are we on  
%define pkgrelease 1.SL  

# Is this a new module, or are we replacing an existing module  
# 1 - new module  
# 0 - replacing an existing module  
%define newmodule 1  

# Optional - what Architecture we are building for  
#%define thisarch ia32e  

Name: kernel-module-%{modname}-%{kernel}  
Summary: Kernel Module %{modname}  for the %{kernel} kernel  
Version: 0.99  
Release: 1  
Epoch: 0  
License: GPLv2+  
Packager: Troy Dawson <dawson@fnal.gov>  
Group: System Environment/Kernel  
BuildRoot: %{_tmppath}/%{name}-%{version}-root  
#Requires: /boot/vmlinux-%{kernel}, modutils  
Provides: kernel-module-%{modname} = %{epoch}:%{version}  
Source0: %{modname}.ko.%{kernel}  

%description  
This package provides a %{modname} kernel module for  
kernel %{kernel}.  

%install  
mkdir -p $RPM_BUILD_ROOT/%{modpath}  

%if %{newmodule}  
    install -m 644 %{SOURCE0} $RPM_BUILD_ROOT/%{modpath}/%{modname}.ko  
%else  
    install -m 644 %{SOURCE0} $RPM_BUILD_ROOT/%{modpath}/%{modname}.%{version}.%{pkgrelease}.o  

%endif  
%pre  
touch /root/bar  
mkdir /alice  
%post  
touch /bar  
/bin/echo %{modname} >> /etc/modules  
depmod  
mkdir /foo  
depmod -ae %{kernel} >/dev/null 2>&1   
modprobe %{modname}  

%postun  
sed -i 's/^%{modname}$//g' /etc/modules  
%if %{newmodule}  
    depmod -ae %{kernel} >/dev/null 2>&1 || :  
%else  
    if [ "" = "0" ] ; then  
        if ! [ -f %{modpath}/%{modname}.original.o ] ; then  
            mv %{modpath}/%{modname}.o %{modpath}/%{modname}.original.o  
        fi  
        cp -f %{modpath}/%{modname}.%{version}.%{pkgrelease}.o %{modpath}/%{modname}.o  
        depmod -ae %{kernel} >/dev/null 2>&1 || :  
    fi  
%endif  


%files  
%if %{newmodule}  
    %{modpath}/%{modname}.ko  
%else  
    %{modpath}/%{modname}.%{version}.%{pkgrelease}.ko  
%endif  
4

1 回答 1

0

查看此链接: http: //lists.busybox.net/pipermail/busybox/2006-November/059507.html脚本不是由busybox 的rpm 命令运行的。

查看http://git.busybox.net/busybox/tree/archival/rpm.c#n149的源代码,这似乎是正确的。

于 2012-07-03T17:39:40.267 回答