Kernel building help - Redhat

This is a discussion on Kernel building help - Redhat ; I'm new to linux and was wondering if somebody could validate what I'm trying to do... I need to re-build, into an RPM, the kernel which ships with RHEL AS2.1 (update 3) so that it is identical to what is ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Kernel building help

  1. Kernel building help

    I'm new to linux and was wondering if somebody could validate what I'm
    trying to do...

    I need to re-build, into an RPM, the kernel which ships with RHEL AS2.1
    (update 3) so that it is identical to what is originally shipped from
    RedHat. Once I have this down, I am then going to apply a patch to the
    kernel source and rebuild it, knowing that the *only* difference between
    what I use and what is shipped from RedHat is my patch. This, by the way, is
    for the i686 architecture.

    I've successfully built the kernel, packaged it into an RPM, and have
    installed it onto another system. I have included the steps I used below.
    I've hightlighted several questions (annotated by references of the form
    "[n]"). Any help in answering these questions is greatly appreciated.

    Thanks!
    Mark

    Building the kernel
    -------------------
    >cd /usr/src/linux-2.4.9-e.34 [1]
    >make mrproper
    >cp configs/kernel-2.4.9-i686.config ./.config [2]
    >make oldconfig
    >make dep
    >make clean
    >vi Makefile (edit the "EXTRAVERSION" line; change "-e.34custom" to

    "-e.34-test1").
    >make bzImage
    >make modules
    >make modules_install
    >make install [3]
    >ls -l /boot/vmlinuz-2.4.9-e.34 (1007712 bytes) [4]
    >ls -l /boot/vmlinuz-2.4.9-e.34-test1 (1007435 bytes) [4]
    >vi /etc/grub.conf (add new entry for test1 kernel; re-use

    initrd-2.4.9-e.34.img)


    Prepare the RPM's "source" tarball [5]
    --------------------------------------
    >mkdir -p /tmp/kernel-test1-2.4.9/boot
    >mkdir -p /tmp/kernel-test1-2.4.9/lib/modules
    >cp /boot/System.map-2.4.9-e.34-test1 /tmp/kernel-test1-2.4.9/boot
    >cp /boot/vmlinuz-2.4.9-e.34-test1 /tmp/kernel-test1-2.4.9/boot
    >cp -r /lib/modules/2.4.9-e.34-test1 /tmp/kernel-test1-2.4.9/lib/modules
    >cd /tmp
    >tar -cvf /usr/src/redhat/SOURCES/kernel-test1-2.4.9.tar kernel-test1-2.4.9
    >gzip /usr/src/redhat/SOURCES/kernel-test1-2.4.9.tar
    >\rm -r /tmp/kernel-test1-2.4.9



    Building the RPM
    -----------------
    >cd /usr/src/redhat
    >rpmbuild -bb SPECS/kernel-test1-2.4.9-e.34.spec [6]



    Referenced Questions
    --------------------

    [1] This directory is installed from the RPM package
    "kernel-source-2.4.9-e.34.i386.rpm".
    - Is this the kernel source with all of the RedHat modifications /
    patches (as opposed
    to the stock kernel from kernel.org)?

    - How does this compare to the kernel source found in
    "linux-2.4.9.tar.bz2" in the
    source RPM "kernel-2.4.9-e.34.src.rpm"? My guess is that since that
    RPM
    has a whole bunch of patch files included, the source in
    "linux-2.4.9.tar.bz2"
    is the stock kernel from and the patches are all the modifications
    which RedHat
    has made.

    [2] It does not seem to make a difference whether or not I do this copy. The
    resulting
    ".config" after running "make oldconfig" is the same whether or not I
    do this copy.
    What does "make oldconfig" actually do?

    [3] This simply adds the two new files to /boot:
    - system.map-2.4.9-e.34-test1
    - vmlinuz-2.4.9-e.34-test1

    [4] My test kernel is 277 bytes smaller in size that the one shipped from
    RedHat. Is this
    a cause for concern (i.e., not *exactly* the same)? Note that the source
    I'm compiling
    here does NOT have my patch applied.

    [5] The following two files are in "kernel-2.4.9-e.34.i686.rpm", but the
    equivalent versions
    for this "test1" build do not seem to get generated. Whey are they not
    generated? Are
    they really required?

    - cp /boot/module-info-2.4.9-e.34-test1
    - cp /boot/vmlinux-2.4.9-e.34-test1

    [6] The resulting RPM file is "kernel-test1-2.4.9-e.34.i386.rpm". Why is the
    architecture in this file name "i386" when I am building it on an "i686"
    machine?
    (ie., "uname -a" gives the output
    "Linux asrpm1 2.4.9-e.34 #1 Wed Dec 10 17:01:48 EST 2003 i686
    unknown")



    The SPEC file ("kernel-test1-2.4.9-e.34.spec")
    ----------------------------------------------
    Summary: Test kernel for RHEL AS2.1 U3 2.4.9-e.34
    Name: kernel-test1
    Version: 2.4.9
    Release: e.34
    Source: %{name}-%{version}.tar.gz
    License: ABC Corporation
    Group: Systems Management/Base
    Packager: ABC Corp. Packagers
    BuildRoot: /tmp/%{name}-%{version}

    %description
    This is a test build of the RHEL AS2.1 U3 kernel (2.4.9-e.34).

    %prep
    %setup

    %build
    echo

    %install
    cp -R $RPM_BUILD_DIR/%{name}-%{version} $RPM_BUILD_ROOT/

    %clean
    cd $RPM_BUILD_DIR
    rm -rf %{name}-%{version}
    rm -rf $RPM_BUILD_ROOT

    %files
    /boot
    /lib




  2. Re: Kernel building help

    In article , Mark wrote:
    > I'm new to linux and was wondering if somebody could validate what I'm
    > trying to do...
    >
    > I need to re-build, into an RPM, the kernel which ships with RHEL AS2.1
    > (update 3) so that it is identical to what is originally shipped from
    > RedHat. ...
    > Building the kernel
    > -------------------
    >>...
    >>make bzImage


    If you ever build a kernel for an architecture other than
    X86, you'd want to use 'make boot'. The 'bzImage' target is
    a kludge specific to X86, while (many/most/all) other
    architectures use the 'boot' target. (My first Linux
    machine was an Alpha, but the mobo got sick.)

    Good luck.

    Robert Riches
    spamtrap42@verizon.net
    (Yes, that is one of my email addresses.)

+ Reply to Thread