How to produce openMosix's Kernel RPM files

How to produce openMosix's Kernel RPM files

A step-by-step guide for the dumb release manager and the adventurous "do it yourself" RPM packager , by Mirko Caserta

  1. 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

  2. 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

  3. 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

  4. Unpack the kernel tarball under /usr/src, ie:

       # cd /usr/src
       # tar vxjf redhat/SOURCES/linux-2.4.20.tar.bz2

  5. Make a symbolic link to the directory where you've checked out the linux-openmosix module, for instance:

       # ln -s /home/mcaserta/src/linux-openmosix/linux-openmosix \
                    /usr/src/linux-openmosix

  6. copy the .spec file and all the .config files which are found in this directory under /usr/src/redhat/SOURCES, ie:

       # cp /usr/src/linux-openmosix/configs/openmosix-kernel.spec \
            /usr/src/redhat/SOURCES
    
       # cp /usr/src/linux-openmosix/configs/*.config \
            /usr/src/redhat/SOURCES

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

    
   /usr/src/linux-openmosix/Makefile and
       /usr/src/redhat/SOURCES/openmosix-kernel.spec have the correct
    kernel version and openMosix revision number

  8. 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):

       # 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

  9. At this point your /usr/src/redhat/SOURCES directory should look like:

       # 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

  10. Now you only need to rpmbuild the whole thing - what I usually do is:

       # 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
    but you can easily build all rpms by calling:
     # rpmbuild -ba --target all_x86  openmosix-kernel.spec

  11. After rpmbuild has done its job, you should have the following files under the /usr/src/redhat directory:

      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
    where:
      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

  12. The magic spell to obtain all the files back from the .src.rpm file is: # rpm2cpio openmosix-kernel-....src.rpm | cpio -di

Special thanks to Martin Høy for the help while I was trying to get the whole thing together.

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 :)

* UP = UniProcessor (i.e. one CPU) ** SMP = Symmetric Multi Processing (i.e. more than one CPU)