HP: Command line kernel creation/modificationΒΆ

Title:HP: Command line kernel creation/modification
Author:Douglas O’Leary <dkoleary@olearycomputers.com>
Description:HP: Command line kernel creation/modification
Date created:09/2008
Date updated:10/2010
Disclaimer:Standard: Use the information that follows at your own risk. If you screw up a system, don’t blame it on me...

NOTE: The directions below are for 10.X. With the advent of 11.X, kernel modifications became much simpler. kmtune for 11.11, kctune for 11.23 and above. With each successive OS iteration, more and more kernel parameters are dynamic so there’s less rebooting. Querying the kernel parameter will tell you which parameters are dynamic and which require a reboot.

Source: Chapter 1, System Admin Tasks, Reconfiguring the kernel

To use HP-UX commands to reconfigure the kernel:

  • Log in as superuser on the machine for which a new kernel is being generated. You can log in remotely from another location by using the /usr/bin/rlogin command.

  • Change directories to the build environment (/stand/build). There, execute a system preparation script, /usr/lbin/sysadm/system_prep, which extracts the system file from the current kernel, as follows:

    # cd /stand/build
    # /usr/lbin/sysadm/system_prep -v -s system
    

    The system_prep script creates the system file /stand/build/system in your current directory. The -v option provides explanation as the script executes.

  • Update the kernel information:

    • (<= HPUX 10.X)Edit the /stand/build/system file to perform your task.

      • The system file contains configuration information. The first part of the file lists the driver specifications while the second part identifies modifiable kernel parameters. man config to get a more detailed description of the system file.
      • Consult HP’s kernel parameters documentation to obtain valid parameters and associated ranges. (NOTE: docs.hp.com doesn’t exist anymore. w/11.X, you can get kernel parameter documentation via the kmtune/kctune commands. You’ll have to search for the 10.X parameters)
    • (>= HPUX 11.X) Update kernel modules and parameters:

      • Modules:

        • To display preselected kernel modules:

          /usr/sbin/kmsystem -S /stand/build/system
          
        • To add additional kernel modules:

          /usr/sbin/kmsystem -S /stand/build/system -c -Y ${driver}
          
      • Parameters:

        • To display existinng kernel parameters:

          /usr/sbin/kmtune -l -S /stand/build/system
          
        • To update kernel parameters:

          /usr/sbin/kmtune -s ${name}=${param} -S /stand/build/system
          
  • Build the kernel:

    # mk_kernel -s system
    

    The mk_kernel command creates /stand/build/vmunix_test, a kernel ready for testing.

    If you get this message when executing mk_kernel:

    ERROR:    Kernel is too large to boot.
            Actual:    15605892 bytes
            Limit:     13580288 bytes
    

    eliminate optional subsystems or drivers and decrease the tunable parameters. The actual bytes will vary with each instance. The limit will also vary depending on the HP-UX release.

  • Copy the old system file and kernel so if anything goes wrong, you still have a bootable kernel.

    # cp /stand/system /stand/system.prev
    # cp /stand/vmunix /stand/vmunix.prev
    
  • Move the new kernel into place:

    • (<= HPUX 10.X) Move the new system file and new kernel into place, ready to be used when you reboot the system.

      # mv /stand/build/system /stand/system
      # mv /stand/build/vmunix_test /stand/vmunix
      
    • (>= HPUX 11.X) Execute /usr/sbin/kmupdate

  • Notify users that the system will be shut down. You can use the /usr/sbin/wall command and/or the interactive capabilities of the /usr/sbin/shutdown command to broadcast a message to users before the system goes down. For details, see wall(1M), shutdown(1M), and “Shutting Down the System” in Chapter 2 of this manual.

    NOTE: You only need to do the next steps if you are changing hardware, such as adding new peripherals. If you are simply changing a kernel parameter, reboot the system to active the new kernel with shutdown -r.

  • Bring the system to a halt using the shutdown command.

  • Turn off the power to all peripheral devices and then to the SPU.

  • Install the hardware or remove interface cards or peripheral devices. Refer to the documents shipped with the products being installed and to Configuring HP-UX for Peripherals for specific instructions.

  • Turn on the power to all peripheral devices. Wait for them to become “ready”, then turn on power to the SPU. The system will attempt to boot the new kernel.