Novell Home

Creating a Kernel Module Source RPM

Overview

When requesting KMPs through the Driver Process Build Service, partners should provide source rpms that have been tested to build correctly on the target platform. This document provides information on how to build a kernel module source rpm.

Partners who plan to build their own driver kits and KMPs also should employ the following steps to ensure that they build KMPs which will function correctly on SLES platforms.

NOTE: KMPs built by Novell result in a support flag of 'external' being set in the driver. If this flag is not set the KMP will not be considered supported by Novell. Setting the 'external' flag without Novell authorization may result in the kernel module not being supported by Novell.

Definitions

Please see Driver Process Terminology.

Rationale - "Why does Novell need a source rpm to create a KMP?"

When receiving a KMP build request from a partner, Novell needs to ensure that the source provided with the request will build successfully in Novell's build system, and that the build will create a binary rpm which functions as the partner expects. A source rpm is fully structured so that Novell Partner Engineers can be certain that they are building the correct source code and that the final binary will install in a way that the partner wishes and has tested. Although Novell has worked with KMP build requests where the source code is provided as a tarball or in another format, providing a source rpm significantly reduces problems or communication difficulties w/ regards to the request.

How to Create a Kernel Module Source RPM for Code 9 (SLES 9, OES 1, NLD 9)

Preparing the Build System

  1. Using YaST->"Software Management", install the kernel-source and kernel-syms packages. These packages provide the kernel build environment.
  2. Using YaST->"Software Management", install the build package, which contains the SUSE build tool. Note that the build package is contained in the SLES9 SDK, therefore you will need to set up an installation source to the SLES 9 SDK in order for YaST to see the build package. The SLES 9 SDK can be obtained from http://developer.novell.com.

Building the KMP and Source RPM

The Novell Linux University for Developers demonstrates the following steps in a visual introduction to kmp building.

  1. Create a staging directory on your local system.
  2. In your staging directory, create a driver source directory named <vendor>-<driver>-<version>. (Example: novell-sampledriver-1.0)
  3. In your source directory, place all your driver source code (*.c and *.h files) and a "Kbuild" file. The "Kbuild" file serves as the Makefile; information on how to create a Kbuild file is contained in the document /usr/src/linux/Documentation/kbuild/modules.txt. A sample Kbuild file is contained in the /usr/share/doc/packages/kernel-source/novell-kmp/novell-example-1.1.tar.bz2 file.
  4. In your staging directory, create a compressed tar file containing your driver source directory and all its contents. Name this compressed tar file "<vendor>-<driver>-<version>.tar.gz" (or "<vendor>-<driver>-<version>.tar.bz2"). A sample compressed tar file is /usr/share/doc/packages/kernel-source/novell-kmp/novell-example-1.1.tar.bz2.
  5. In your staging directory, create a <vendor>-<driver>.spec file as detailed in Kernel Module Packages Manual for Code 9. A sample spec file is /usr/share/doc/packages/kernel-source/novell-kmp/novell-example.spec.
  6. From within your staging directory, build your source and binary rpms by using the "build" command. Use "man build" for more information on options to the "build" command. Ensure that the build completes successfully.
  7. The build process will place your binary rpm in the /var/rpm/build-root/usr/src/packages/RPMS directory. Install this binary on a test system and ensure that it functions as expected.
  8. The build process will place your source rpm in the /var/rpm/build-root/usr/src/packages/SRPMS directory.

How to Create a Kernel Module Source RPM for Code 10 (SLES 10, SLED 10, OES 2)

Preparing the Build System

  1. Using YaST->"Software Management", install the kernel-source and kernel-syms packages. These packages provide the kernel build environment.
  2. Using YaST->"Software Management", install the build package, which contains the SUSE "build" command. Note that the build package is contained on the SLES10 SDK, therefore you will need to have an installation source pointing to the SDK in order for YaST->"Software Management" to see the build package. The SLES10 SDK can be obtained from http://developer.novell.com.

Building the KMP and Source RPM

The Novell Linux University for Developers demonstrates the following steps in a visual introduction to kmp building.

  1. Create a staging directory on your local system.
  2. In your staging directory, create a driver source directory named <vendor>-<driver>-<version>. (Example: novell-sampledriver-1.0)
  3. In your source directory, place all your driver source code (*.c and *.h files) and a "Kbuild" file. The "Kbuild" file serves as the Makefile; information on how to create a Kbuild file is contained in the document /usr/src/linux/Documentation/kbuild/modules.txt. A sample Kbuild file is contained in the /usr/share/doc/packages/kernel-source/novell-kmp/novell-example-1.1.tar.bz2 file.
  4. In your staging directory, create a compressed tar file containing your driver source directory and all its contents. Name this compressed tar file "<vendor>-<driver>-<version>.tar.gz" (or "<vendor>-<driver>-<version>.tar.bz2"). A sample compressed tar file is /usr/share/doc/packages/kernel-source/novell-kmp/novell-example-1.1.tar.bz2.
  5. In your staging directory, create a <vendor>-<driver>.spec file as detailed in Kernel Module Packages Manual for Code 10. A sample spec file is /usr/share/doc/packages/kernel-source/novell-kmp/novell-example.spec.
  6. From within your staging directory, build your source and binary rpms by using the "build" command. Use "man build" for more information on options to the "build" command. Ensure that the build completes successfully.
  7. The build process will place your binary rpm in the /var/rpm/build-root/usr/src/packages/RPMS directory. Install this binary on a test system and ensure that it functions as expected.
  8. The build process will place your source rpm in the /var/rpm/build-root/usr/src/packages/SRPMS directory.

How to Create a Kernel Module Source RPM for Code 11 (SLES 11, SLED 11)

Prepare the Build System

  • Create repositories of SLE 11 and the SLE 11 SDK:
    • Download SLES 11 DVD1 and SLE 11 SDK Media 1 iso images from http://download.novell.com. (Make sure to download the correct iso images to match the architecture of your build system.)
    • Create directories on which to mount the iso images:
            mkdir -p /work/SLES-11 
            mkdir -p /work/SLE-11-SDK 
  • Mount the iso images
            mount -o loop <full path to SLE 11 DVD 1 iso image> /work/SLES-11 
            mount -o loop <full path to SLE 11 SDK Media 1 iso image> /work/SLE-11-SDK 
  • Install the SUSE build package from the SLE 11 SDK:
            rpm -ihv /work/SLE-11-SDK/suse/<arch>/build-*.rpm
				

Build the KMP and Source RPM

The Novell Linux University for Developers demonstrates the following steps in a visual introduction to kmp building.

  • Create a staging directory on your local system.
  • In your staging directory, create a driver source directory named <vendor>-<driver>-<version>. (Example: novell-sampledriver-1.0)
  • In your source directory, place all your driver source code (*.c and *.h files) and a "Kbuild" file. The "Kbuild" file serves as the Makefile; information on how to create a Kbuild file is contained in the document /usr/src/linux/Documentation/kbuild/modules.txt. A sample Kbuild file is contained in the document Kernel Module Packages Manual for Code 11.
  • In your staging directory, create a compressed tar file containing your driver source directory and all its contents. Name this compressed tar file "<vendor>-<driver>-<version>.tar.gz" (or "<vendor>-<driver>-<version>.tar.bz2").
  • In your staging directory, create a <vendor>-<driver>.spec file as detailed in Kernel Module Packages Manual for Code 11. A sample spec file is included in this document.
  • From within your staging directory (the location containing your *.spec file), build your source and binary rpms by using the "build" command and pointing it at the SLES 11 and SLE 11 SDK repositories:
            build --rpms /work/SLES-11:/work/SLE-11-SDK 
  • The build process will place your binary rpm in the /var/rpm/build-root/usr/src/packages/RPMS directory. Install this binary on a test system and ensure that it functions as expected.
  • The build process will place your source rpm in the /var/rpm/build-root/usr/src/packages/SRPMS directory. The source rpm is in the correct format to be sent to Novell to be re-packaged for the PLDP.

 

© 2014 Novell