Instructions for enabling perfmon on RHAS/AW 2.1, kernel e.25
=============================================================
Alex Tsariounov
Linux and Open Source Lab
Hewlett-Packard Company

1. Download the updated perfmon patch from:

        ftp://ftp.hpl.hp.com/pub/linux-ia64/perfmon-rhas-e25.diff

   The RH e.25 errata comes with perfmon (CONFIG_PERFMON) disabled due
   to a bug in perfmon. This patch fixes the problem and also updates
   RHAS perfmon to perfmon-1.3 as found in 2.4.20 or higher. 

   For the following discussion, we'll assume you've downloaded it to:

        /tmp/perfmon-rhas-e25.diff
    
2. Make sure your e.25 kernel-source rpm is installed.  The name of the
   rpm is: 
        kernel-source-2.4.18-e.25

   This rpm installs the kernel source into the directory:
        
        /usr/src/linux-2.4.18-e.25

3. Do the initial preparation for building the kernel by following these
   steps.  This is for the SMP kernel, a UP kernel should be similar,
   but pay attention to the names:
        
        # cd /usr/src/linux-2.4.18-e.25
        # make mrproper
        # make distclean
        # cp ./configs/kernel-2.4.18-ia64-smp.config .config
        # vi Makefile

            Edit the fourth line in the Makefile
                from: EXTRAVERSION = -e.25custom
                  to: EXTRAVERSION = -e.25smp-perfmon

        # make oldconfig

   Note: We edited the Makefile's EXTRAVERSION to differentiate this
   kernel from the standard installed kernel.  If you do not wish to do
   this but rather want to just replace the standard installed kernel
   with the new one we are building, edit the EXTRAVERSION tag to just
   read: 

        EXTRAVERSION = -e.25smp

   However, we recommend that you change the name.  Also, make sure
   that there is no extra whitespace at the end of this line or make
   will break.

4. Apply the updated perfmon patch:

        # patch -p1 < /tmp/perfmon-rhas-e25.diff | tee perfmon-patch.log

5. Configure in perfmon and the HP zx1 chipset:

        # make menuconfig

            Select "General setup --->" and hit return
            If you have an HP zx1-based system (this is optional):
                (these would be Longs/Wilsons Peak, McKinley,
                 zx2000, zx6000, rx2600, rx5670, and up), then:
                Select "(generic ia64) IA-64 system type" and 
                    press return
                Cursor down to "[ ] HP-zx1" and hit space
                    This activates zx1 and brings you back one
                    level to "General setup"
            Select "[ ] Performance monitor support" and hit space
            Select "< Exit >" with arrow keys and hit return
            Select "< Exit >" with arrow keys and hit return
            Hit return when asked whether to save the new kernel
                configuration (thus answering "Yes")

5.a  Fix kernel source if you enabled HP ZX1 in the step above.

        Edit the file:  arch/ia64/mm/init.c
        Go to line:     567
        Change:         zone = ZONE_NORMAL
            to:         zone = ZONE_NORMAL;
                Note the addition of the semicolon above, this is the
                only edit necessary.
        Exit and save the file.
       
6. Build the kernel:

        # make dep
        # make compressed
        # make modules

7. Install the newly-built modules:

        # make modules_install

8. Make a new initrd disk file for booting:

        # mkinitrd \
            /boot/efi/efi/redhat/initrd-2.4.18-e.25smp-perfmon.img \
            2.4.18-e.25smp-perfmon

   Note: the above command is one command line, the line continuation
   characters "\" illustrate this.

9. Copy the appropriate system files into the appropriate places:

        # cp .config /boot/config-2.4.18-e.25smp-perfmon
        # cp System.map /boot/System.map-2.4.18-e.25smp-perfmon
        # cp /boot/module-info-2.4.18-e.25smp \
            /boot/module-info-2.4.18-e.25smp-perfmon
        # cp vmlinux.gz \
            /boot/efi/efi/redhat/vmlinuz-2.4.18-e.25smp-perfmon

10. Create the appropriate symbolic links:

        # cd /boot
        # ln -sf System.map-2.4.18-e.25smp-perfmon System.map
        # ln -sf module-info-2.4.18-e.25smp-perfmon module-info
        # ln -sf efi/EFI/redhat/vmlinuz-2.4.18-e.25smp-perfmon \
            vmlinuz-2.4.18-e.25smp-perfmon

11. Edit the elilo.conf file:

        # cd /boot/efi/efi/redhat
        # vi elilo.conf
            1. Find the current default linux stanza, typically it
               will look like this:

               image=vmlinuz-2.4.18-e.25smp
                     label=linux
                     initrd=initrd-2.4.18-e.25smp.img
                     read-only
                     root=/dev/sdb2
                     append="hda=ide-scsi

            2. Change the "label" tag to be this:

                    label=e.25smp

            3. Next, copy that entire stanza to above the e.25smp
               stanza and change it to look like this:

               image=vmlinuz-2.4.18-e.25smp-perfmon
                     label=linux
                     initrd=initrd-2.4.18-e.25smp-perfmon.img
                     read-only
                     root=/dev/sdb2
                     append="hda=ide-scsi

             4. Note that the changes above are to the image=...,
                the label=...  and initrd=... lines.  Make sure you
                rename the label to "linux" since you edited it in
                step 2 of this procedure.

                Also note that some of these fields, specifically
                the "root=..." may be different for your system, if
                it is, leave it as it is on your system.

12. Note: If you used a different name for this custom kernel (something
    other than -e.25smp-perfmon for EXTRAVERSION, etc.), then you'll
    need to adjust the names in the instructions above.

13. This is it: sync and reboot to enjoy the new kernel.  

    Note: If boot fails, check the names in the elilo.conf file and
    the boot and /boot/efi/efi/redhat directories.  If you've used
    the names as described above, to boot your old kernel, issue this
    command at the elilo boot prompt:

        ELILO boot: e.25smp 

14. Supplemental:  If you use or would like to use the pfmon tool,
    download the rpm for version 2.0 from here:

        ftp://ftp.hpl.hp.com/pub/linux-ia64/pfmon-2.0-1.ia64.rpm

    More information on perfmon and the pfmon tool can be found on
    the perfmon home page at:

        http://www.hpl.hp.com/research/linux/perfmon

-----
