The purpose of this page is to explain the process of how to unpack, modify, and rebuild an rpm file. A useful reference is http://www.rpm.org/max-rpm/
RPM requires a set of directories in which to perform the build. The normal directory layout consists of a single top-level directory (the default name is /usr/src/redhat), with five subdirectories. The five subdirectories and their functions are:
At this point, I'll explain the process quickly for those who just want the command syntax, and below I'll explain the process in more depth. To begin, you will need an rpm package. As an example, I'll be using ddd-3.3-1.src.rpm .
rpm -Uvh memtest86-2.6-1medusa.src.rpmBuild from source RPM:
cd /usr/src/redhat/SPECSMake copy of original source code directories and tree
rpm -ba memtest86-2.6.spec
cd /usr/src/redhat/BUILDModify source code:
cp -r memtest86-2.6 memtest86-2.6-orig
cd memtest86-2.6/Generate a diff file to use as a patch:
[I then edited the file config.h. Note: this edit disabled the serial port output. You will do something different when you modify the source files for whatever change you are making.]
cd /usr/src/redhat/BUILD/Copy the patch file into the SOURCES directory:
diff -uNr memtest86-2.6-orig/ memtest86-2.6/ > memtest86-2.6-serial.patch
cp /usr/src/redhat/BUILD/memtest86-2.6-serial.patch /usr/src/redhat/SOURCESEdit the spec file (warning - this is the longest part of this description):
cd /usr/src/redhat/SPECSRebuild the SRPM and RPM
[The file to edit is called memtest86-2.6.spec. Here is a summary of the changes:
After Source: changePatch0: memtest86-2.6.patchto read
Patch1: memtest86-2.6-unsupervised.patchPatch0: memtest86-2.6.patchChange
Patch1: memtest86-2.6-unsupervised.patch
Patch2: memtest86-2.6-serial.patchto read
%setup
%patch0 -p1 -b .buildroot
%patch1 -p1Change
%setup
%patch0 -p1 -b .buildroot
%patch1 -p1
%patch2 -p1Release: 1medusato:Release: 2medusaAdd additional lines to the %build section of the SPEC file if needed. In my case I added:
cat test.h.save | sed 's/#define MAXPASS 4/#define MAXPASS 144/' > test.hat the appropriate point. This changed the number of iterations of the memtest from 4 to 144, and
make
mv -f memtest.bin memtest.bin-week
make clean
saved the resulting executable in memtest.bin-week.I also edited the %install section of the .spec file I added a line reading:
cp memtest.bin-week $RPM_BUILD_ROOT/boot/memtest86-week
I also modified the post-installation section of the file. This follows %post. The main change was to modify the script that updateds /etc/lilo.conf, to add extra lines to include this new version of memtest.
I modified the part of the script that defines the file attributes:
%defattr(-,root,root)
/boot/memtest86
/boot/memtest86-unsupervised
/boot/memtest86-weekFinally, I edited the "Changelog" at the end of the .spec file to put in come comments about what I had done. I added
%changelog
* Sun Dec 2 2001 Bruce Allen <ballen@uwm.edu>
- changed number of unsupervised runs to 144 (one week + 30 min) since without serial IO it is faster.END OF EDITING SPEC FILE]
cd /usr/src/redhat/SPECThe new SRPM and RPM should now be tested then checked into the CVS archive. They can be found in:
rpm -ba memtest86-2.6.spec