<appendix id="rpm"><title>How to produce openMosix's Kernel RPM files</title>

<sect1>
<title>How to produce openMosix's Kernel RPM files</title>
<para>

A step-by-step guide for the dumb release manager and the adventurous
"do it yourself" RPM packager , by Mirko Caserta
</para>
<orderedlist>
<listitem><para>Install a RedHat 8 (psyche) on your machine. This is so far the
   platform used to produce the rpms and it's known to do its job
   well
</para></listitem>

<listitem><para>Get an updated copy of the "linux-openmosix" module from oM's CVS
   repository - details can be found at 
   http://sourceforge.net/cvs/?group_id=46729
</para></listitem>
<listitem><para>
Get the tarball for the Linux Kernel sources which we are going to
   patch and put it in /usr/src/redhat/SOURCES - supposing we're
   talking about a 2.4.20 Kernel, get the linux-2.4.20.tar.bz2 file
   from one of the many http://www.kernel.org/ mirrors worldwide
</para></listitem>
<listitem><para>
Unpack the kernel tarball under /usr/src, ie:
<programlisting>
   # cd /usr/src
   # tar vxjf redhat/SOURCES/linux-2.4.20.tar.bz2
</programlisting>
</para>
</listitem>

<listitem><para>Make a symbolic link to the directory where you've checked out the
   linux-openmosix module, for instance:
<programlisting>
   # ln -s /home/mcaserta/src/linux-openmosix/linux-openmosix \
                /usr/src/linux-openmosix
</programlisting>
</para>
</listitem>
<listitem>
<para>
copy the .spec file and all the .config files which are found in
   this directory under /usr/src/redhat/SOURCES, ie:

<programlisting>
   # cp /usr/src/linux-openmosix/configs/openmosix-kernel.spec \
        /usr/src/redhat/SOURCES

   # cp /usr/src/linux-openmosix/configs/*.config \
        /usr/src/redhat/SOURCES
</programlisting>

</para>
</listitem>
<listitem>
<para>

 Now it's time to check the version numbers before we make the patch
   file: make sure the very first lines in
<programlisting>

   /usr/src/linux-openmosix/Makefile and
   /usr/src/redhat/SOURCES/openmosix-kernel.spec have the correct
</programlisting>

   kernel version and openMosix revision number
</para>
</listitem>
<listitem>
<para>

 Good, time to make the patch (suppose we're releasing a patch for
   the 2.4.20 Linux Kernel and the 3rd release of openMosix):

<programlisting>
   # cd /usr/src
   # diff -Naur --exclude=CVS --exclude=configs \
          linux-2.4.20 linux-openmosix > \
          /usr/src/redhat/SOURCES/openMosix-2.4.20-3
   # bzip2 /usr/src/redhat/SOURCES/openMosix-2.4.20-3
</programlisting>

</para>
</listitem>
<listitem>
<para>
 At this point your /usr/src/redhat/SOURCES directory should look like:

<programlisting>
   # ls /usr/src/redhat/SOURCES
   kernel-2.4.20-athlon.config      kernel-2.4.20-i686-smp.config
   kernel-2.4.20-athlon-smp.config  linux-2.4.20.tar.bz2
   kernel-2.4.20-i386.config        openMosix-2.4.20-3.bz2
   kernel-2.4.20-i686.config        openmosix-kernel.spec
</programlisting>

</para>
</listitem>
<listitem>
<para>
 Now you only need to rpmbuild the whole thing - what I usually do is:

  <programlisting>
   # cd /usr/src/redhat/SOURCES
   # rpmbuild -ba --target   i386   openmosix-kernel.spec
   # rpmbuild -bb --target   i686   openmosix-kernel.spec
   # rpmbuild -bb --target athlon   openmosix-kernel.spec
</programlisting>

   but you can easily build all rpms by calling:

  <programlisting>
 # rpmbuild -ba --target all_x86  openmosix-kernel.spec
</programlisting>

</para>
</listitem>
<listitem>
<para>
 After rpmbuild has done its job, you should have the following
    files under the /usr/src/redhat directory:

  <programlisting>
  a) RPMS/i386/openmosix-kernel-2.4.20-openmosix3.i386.rpm
    b) RPMS/i686/openmosix-kernel-2.4.20-openmosix3.i686.rpm
    c) RPMS/i686/openmosix-kernel-smp-2.4.20-openmosix3.i686.rpm
    d) RPMS/athlon/openmosix-kernel-2.4.20-openmosix3.athlon.rpm
    e) RPMS/athlon/openmosix-kernel-smp-2.4.20-openmosix3.athlon.rpm
    f) RPMS/i386/openmosix-kernel-source-2.4.20-openmosix3.i386.rpm
    g) SRPMS/openmosix-kernel-2.4.20-openmosix3.src.rpm
    h) SOURCES/openMosix-2.4.20-3.gz
</programlisting>

    where:

  <programlisting>
  a) binary kernel package for i386 UP* machines
    b) binary kernel package for i686 UP* machines
    c) binary kernel package for i686 SMP** machines
    d) binary kernel package for athlon UP* machines
    e) binary kernel package for athlon SMP** machines
    f) source kernel package for any x86 machine (basically this is
       useful if you need to have the openMosix kernel headers)
    g) source kernel package (see point 11)
    h) kernel patch file compressed with gzip
</programlisting>

</para>
</listitem>
<listitem>
<para>
 The magic spell to obtain all the files back from the .src.rpm file is:

    # rpm2cpio openmosix-kernel-....src.rpm | cpio -di
</para>
</listitem>

</orderedlist>
<para>
Special thanks to Martin Høy for the help while I was trying to get
the whole thing together.

</para>
<para>
I hope you find this document useful. At least it is for me since I
tend to forget things a few minutes after I've accomplished them :)
</para>
<para>
*  UP = UniProcessor (i.e. one CPU)
** SMP = Symmetric Multi Processing (i.e. more than one CPU)
</para>
</sect1>
</appendix>
