Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Get the kernel source. First create the directory structure, then get the source from the RPM. Create a .rpmmacros file to install the kernel source in our user dir.

    Code Block
    # cd $HOME
    # mkdir -p kernel/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
    # cd kernel
    # echo '%_topdir %(echo $HOME)/kernel/rpmbuild' > ~/.rpmmacros
    
  2. Install the kernel source:

    Code Block
    # rpm -ivh http://ftp.redhat.com/pub/redhat/linux/enterprise/6Server/en/os/SRPMS/kernel-2.6.32-431.5.1.el6.src.rpm 2>&1 | grep -v mockb
     
    NOTE: For RHEL 7, you can use
    # rpm -ivh http://vault.centos.org/7.2.1511/updates/Source/SPackages/kernel-3.10.0-327.22.2.el7.src.rpm 
    Note
    titleRHEL kernel versions

    Red Hat periodically release updates to their distributed kernel. The Lustre Master attempts to stay up-to-date with the most recent kernel from Red Hat. In the event that the link above is not completely up-to-date, you should visit the Red Hat source RPM download site and ensure you are downloading the most recent kernel. The most recent supported kernel is recorded in lustre/kernel_patches/which_patch.

  3. Prepare the source using rpmbuild.

    Code Block
    # cd ~/kernel/rpmbuild
    # rpmbuild -bp --target=`uname -m` ./SPECS/kernel.spec
    


    This will end with:

    Code Block
    ...
    gpg: Total number processed: 1
    gpg:               imported: 1
    + gpg --homedir . --export --keyring ./kernel.pub Red
    gpg: WARNING: unsafe permissions on homedir `.'
    + gcc -o scripts/bin2c scripts/bin2c.c
    + scripts/bin2c ksign_def_public_key __initdata
    + cd ..
    + exit 0
    

...

  1. Go into the kernel source directory and issue the following commands to build a kernel rpm.

    Code Block
    # cd ~/kernel/rpmbuild/BUILD/kernel-2.6.32-431.5.1.el6/linux-2.6.32-431.5.1.el6.x86_64/
    # make oldconfig || make menuconfig
    # make include/asm
    # make include/linux/version.h
    # make SUBDIRS=scripts
    # make include/linux/utsrelease.h
    # make rpm
     
    NOTE: with RHEL 7, just do the following
    # make oldconfig
    # make -j4 rpm
    
  2. A successful build will return:

    Code Block
    ...
    ...
    Wrote: /home/build/kernel/rpmbuild/SRPMS/kernel-2.6.32lustremaster-1.src.rpm
    Wrote: /home/build/kernel/rpmbuild/RPMS/x86_64/kernel-2.6.32.lustremaster-1.x86_64.rpm
    Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.f73m1V
    + umask 022
    + cd /home/build/kernel/rpmbuild/BUILD
    + cd kernel-2.6.32lustremaster
    + rm -rf /home/build/kernel/rpmbuild/BUILDROOT/kernel-2.6.32.lustremaster-1.x86_64
    + exit 0
    rm ../kernel-2.6.32lustremaster.tar.gz
    

...