LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Fedora (https://www.linuxquestions.org/questions/fedora-35/)
-   -   rpm spec file help (https://www.linuxquestions.org/questions/fedora-35/rpm-spec-file-help-617036/)

AutoC 01-29-2008 12:11 AM

rpm spec file help
 
here is the rpm spec file i've written so far
Quote:

Version: 1.0
Release: 1
License: GPL
Group: Applications/Office

Source0: mmi-1.0-1.tar.gz
URL: NA
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
%description
The Multi-Modal Interface reads input from a file and feeds it to the tty buffer
which displays it in the current window
#
# Prep Section
#
%prep
%setup -q
#
# Build Section
#
%build
make clean
make
#
# Install Section
#
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/lib/modules/$(shell uname -r)/kernel/drivers/char/
cp mmiModule.ko $RPM_BUILD_ROOT/lib/modules/$(shell uname -r)/kernel/drivers/char/
mkdir -p $RPM_BUILD_ROOT/etc/
echo "rm -rf /dev/char_device &> /dev/null" >> $RPM_BUILD_ROOT/etc/rc.local
echo "/bin/mknod /dev/char_device c 101 0" >>$RPM_BUILD_ROOT/etc/rc.local
echo "chmod 777 /dev/char_device" >>$RPM_BUILD_ROOT/etc/rc.local
echo "modprobe -a mmi" >> $RPM_BUILD_ROOT/etc/rc.local
echo "alias mmi mmiModule" >> $RPM_BUILD_ROOT/etc/modprobe.conf
mkdir -p $RPM_BUILD_ROOT/bin/
mkdir -p $RPM_BUILD_ROOT/dev/
$RPM_BUILD_ROOT/bin/mknod $RPM_BUILD_ROOT/dev/char_device c 101 0
chmod 777 $RPM_BUILD_ROOT/dev/char_device
depmod
modprobe -a mmi
#
# Clean Section
#
%clean
rm -rf $RPM_BUILD_ROOT
Usually its not that difficult but this is a character driver rpm.So any help with the install section is appreciated.All the commands to install the driver are in there.
Because it does everything in virtual directories,it created new versions of rc.local and modprobe.conf and says mknod couldnt be found.

unSpawn 01-29-2008 07:42 PM

Please post your build log.

AutoC 01-29-2008 10:28 PM

Quote:

Originally Posted by unSpawn (Post 3039430)
Please post your build log.

Ive modified my spec file..this is the one

Quote:

#
# Preamble in spec file for Multi-Modal Interface
#
Summary: A Multi-Modal Interface to the computer.
Name: mmi
Version: 1.0
Release: 1
License: GPL
Group: System Environment/Kernel

Source0: mmi-1.0-1.tar.gz
URL: NA
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
%description
The Multi-Modal Interface reads input from a file and feeds it to the tty buffer
which displays it in the current window
#
# Prep Section
#
%prep
%setup -q
#
# Build Section
#
%build
make clean
make
#
# Install Section
#
%install
rm -rf $RPM_BUILD_ROOT
#
# Clean Section
#
%clean
rm -rf $RPM_BUILD_ROOT
#
# Post Section
#
%post
kversion =`uname -r`
mkdir -p /lib/modules/$(kversion)/kernel/drivers/char/
cp mmiModule.ko /lib/modules/$(kversion)/kernel/drivers/char/
mkdir -p /etc/
mkdir -p /usr/lib/debug/
mkdir -p /bin/
mkdir -p /dev/
mknod /dev/mmi-1.0 c 101 0
chmod 777 /dev/mmi-1.0
echo "rm -rf /dev/mmi-1.0 &> /dev/null" >> /etc/rc.local
echo "mknod /dev/mmi-1.0 c 101 0" >> /etc/rc.local
echo "chmod 777 /dev/mmi-1.0" >> /etc/rc.local
echo "modprobe -a mmiModule" >> /etc/rc.local
depmod
modprobe -a mmiModule
#
# Files Section
#
%files
%defattr(-,root,root)
/lib/modules/$(kversion)/kernel/drivers/char/mmiModule.ko
/dev/mmi-1.0
my log is as follows

Quote:

Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.18105
+ umask 022
+ cd /usr/src/redhat/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /usr/src/redhat/BUILD
+ rm -rf mmi-1.0
+ /usr/bin/gzip -dc /usr/src/redhat/SOURCES/mmi-1.0-1.tar.gz
+ tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd mmi-1.0
++ /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.18105
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd mmi-1.0
+ LANG=C
+ export LANG
+ unset DISPLAY
+ make clean
make -C /lib/modules/2.6.11-1.1369_FC4/build M=/usr/src/redhat/BUILD/mmi-1.0 clean
make[1]: Entering directory `/usr/src/kernels/2.6.11-1.1369_FC4-i686'
CLEAN /usr/src/redhat/BUILD/mmi-1.0/.tmp_versions
make[1]: Leaving directory `/usr/src/kernels/2.6.11-1.1369_FC4-i686'
+ make
make -C /lib/modules/2.6.11-1.1369_FC4/build M=/usr/src/redhat/BUILD/mmi-1.0 modules
make[1]: Entering directory `/usr/src/kernels/2.6.11-1.1369_FC4-i686'
CC [M] /usr/src/redhat/BUILD/mmi-1.0/mmiModule.o
Building modules, stage 2.
MODPOST
CC /usr/src/redhat/BUILD/mmi-1.0/mmiModule.mod.o
LD [M] /usr/src/redhat/BUILD/mmi-1.0/mmiModule.ko
make[1]: Leaving directory `/usr/src/kernels/2.6.11-1.1369_FC4-i686'
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.1587
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd mmi-1.0
+ LANG=C
+ export LANG
+ unset DISPLAY
+ rm -rf /var/tmp/mmi-1.0-1-root
+ /usr/lib/rpm/find-debuginfo.sh /usr/src/redhat/BUILD/mmi-1.0
find: /var/tmp/mmi-1.0-1-root: No such file or directory
0 blocks
find: /var/tmp/mmi-1.0-1-root/usr/lib: No such file or directory
+ /usr/lib/rpm/redhat/brp-compress
+ /usr/lib/rpm/redhat/brp-strip /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
Processing files: mmi-1.0-1
error: File not found: /var/tmp/mmi-1.0-1-root/lib/modules/$(kversion)/kernel/drivers/char/mmiModule.ko
error: File not found: /var/tmp/mmi-1.0-1-root/dev/mmi-1.0
Processing files: mmi-debuginfo-1.0-1


RPM build errors:
File not found: /var/tmp/mmi-1.0-1-root/lib/modules/$(kversion)/kernel/drivers/char/mmiModule.ko
File not found: /var/tmp/mmi-1.0-1-root/dev/mmi-1.0
thanks for any help

unSpawn 01-30-2008 08:25 AM

Ah. You don't %install anything. Make %install install the %_builddir/mmiModule.ko into $RPM_BUILD_ROOT/lib/modules/$(kversion)/kernel/drivers/char/.


All times are GMT -5. The time now is 09:43 AM.