Tux on VM

Last updated on:
Sunday, July 06, 2008







Valid HTML 4.01!
Linux for Big Iron

Patching the Linux/390 2.4 Kernel

This information was originally posted to the Linux-390 mailing list on May 2, 2002, by Mike MacIsaac.

This was originally intended to show how to correct a problem with Samba 2.2 causing a kernel oops, but the method can easily be generalized to applying any kernel patch.

  1. Get the patches.
    • Go to http://www10.software.ibm.com/developerworks/opensource/linux390/index.shtml
    • Under "Downloads for kernel 2.4" in the left frame, click on "Recommended levels (2.4.7 and 2.4.17)."
    • Under "Available recommended downloads:" in the main frame, click on "linux-2.4.7" If you scroll down a little, you should see the patches from November, 2001.
    • Click on linux-2.4.7-s390-3
    • Click on linux-2.4.7-s390-3.tar.gz which brings up a browser panel with the GNU GPL.
    • Click "Accept," and you can download the patch.
    • Do the same for patch 4 (linux-2.4.7-s390-4.tar.gz), and FTP these two files to /usr/src/ on the Linux system to be patched. (You may also consider patches 5 and 6, but they are not needed for the kernel oops.)
  2. Get the kernel source.
    Those which come with the distribution are usually shipped in RPMs. If the RPM is installed, the head of the source tree is almost always in the directory /usr/src/. If you do not have the directory /usr/src/linux-2.4.7.SuSE, it can be added via YaST as follows:
    You should now have a directory /usr/src/linux-2.4.7.SuSE.
  3. Patch the code
    You should now have the patches as tar files named linux-2.4.7-s390-3.tar.gz and linux-2.4.7-s390-4.tar.gz on your Linux system. Untar them:
    # cd /usr/src
    # tar -xzf linux-2.4.7-s390-3.tar.gz
    # tar -xzf linux-2.4.7-s390-4.tar.gz
    You now have .diff files which are also called patches.
    Peek into them using the head command to see the directory structure:
    # ls *.diff
    linux-2.4.7-s390-3.diff  linux-2.4.7-s390-4.diff
    # head -3 *.diff
    ==> linux-2.4.7-s390-3.diff <==
    --- linux-2.4.7/Documentation/s390/chandev.8    Wed Nov  7 11:43:51 2001
    +++ linux-2.4.7-s390/Documentation/s390/chandev.8  Wed Oct 17 14:44:39 2001
    ==> linux-2.4.7-s390-4.diff <==
    diff -urN linux-2.4.7/arch/s390/kernel/entry.S
    --- linux-2.4.7/arch/s390/kernel/entry.S        Fri Nov 23 16:30:58 2001
    +++ linux-2.4.7-s390/arch/s390/kernel/entry.S   Fri Nov 23 16:32:38 2001
    Note that the base directory is named linux-2.4.7 and the directory from which the patch was obtained is linux-2-4-7-s390. To apply a patch cleanly, the base directory must be named correctly, so create two symbolic links - one named linux-2.4.7 because that is what the patch file expects and one named linux because by convention, the directory /usr/src/linux contains the current kernel's source code (If you were to upgrade to a new kernel or IPL a different one, you should update the symbolic link /usr/src/linux). Apply patches 3 and 4:
    # cd /usr/src
    # ln -s linux-2.4.7.SuSE linux-2.4.7
    # ln -s linux-2.4.7.SuSE linux
    # patch -p0 < linux-2.4.7-s390-3.diff
    # patch -p0 < linux-2.4.7-s390-4.diff
  4. To customize the build, you use the make menuconfig command:
    # cd /usr/src/linux
    # make menuconfig
    Just exit and save the values (unless you want to change some build configuration variables).
  5. Now build the kernel.
    # cd /usr/src/linux
    # make dep
    # make modules
    # make modules_install
    # make image
  6. Write the new kernel to the boot DASD. Write the IPL record to cylinder 0 of the DASD that will be IPLed. Look at the [ipl] section of /etc/zipl.conf:
    parameters="dasd=0130-134 root=/dev/dasda1 noinitrd"
  7. Now backup and copy the new kernel files:
    # cd /boot/kernel
    # mv image image.orig
    # mv ipleckd.boot ipleckd.boot.orig
    # mv System.map System.map.orig
    # cd /usr/src/linux-2.4.7/arch/s390/boot
    # cp -p image /boot/kernel/
    # cp -p ipleckd.boot /boot/kernel/
    # cd /usr/src/linux-2.4.7
    # cp -p System.map /boot/kernel/
  8. Now run zipl to write the boot info to DASD and reboot:
    # cp -p System.map /boot/kernel/
    # cd /etc
    # zipl -c zipl.conf
    building bootmap    : /boot/zipl/bootmap
    adding Kernel Image : /boot/kernel/image located at 0x00010000
    adding Parmline     : /boot/zipl/parmfile located at 0x00001000
    Bootloader for ECKD type devices with z/OS compatible layout installed.
    Syncing disks....
  9. Now you can IPL the new kernel:
    # shutdown -r now

Site hosting courtesy of Velocity Software