Page 1 of 21 12311 ... LastLast
Results 1 to 10 of 209

Thread: HOWTO: Kernel compilation

  1. #1
    Join Date
    Apr 2005
    Beans
    514

    HOWTO: Kernel compilation

    I thought to write this HowTo, since the kernel compile process on Ubuntu is made easier because this distro is debian-based.
    First of all, download the kernel package you like from kernel.org or from the Ubuntu repositories.
    If you want the official kernel patched by the Ubuntu Team, just type:
    Code:
    sudo apt-get install linux-tree
    In this case we'll use the latest stable vanilla kernel version available.
    For the compile process you'll need the following packages on Ubuntu:
    Code:
    sudo apt-get update
    sudo apt-get install build-essential
    sudo apt-get install kernel-package
    sudo apt-get install gcc
    sudo apt-get install libncurses5
    sudo apt-get install libncurses5-dev
    sudo apt-get install libqt3-mt-dev
    Now untar the package:
    Code:
    cd /usr/src
    sudo tar --bzip2 -xvf linux-2.6.12.tar.bz2
    Create the following symlink:
    Code:
    sudo ln -s /usr/src/linux-2.6.12 /usr/src/linux
    cd /usr/src/linux
    Now you can start customizing your kernel configuration; there two way, the first one is graphical, the second one pseudo-graphical:
    Code:
    sudo make xconfig
    Or:
    Code:
    sudo make menuconfig
    Then, after having finished the customization, we have to start the compile process:
    Code:
    sudo make-kpkg clean
    sudo make-kpkg --append-to-version=-custom kernel_image modules_image
    The revision flag is optional and is just useful to edit the kernel name showed through uname -r. You can write whatever you want instead of "-custom".

    There's also another interesting and useful flag, that is --initrd. The vanilla kernel is not enable yet to make use of initrd properly, and in fact there's a patch for this. The Ubuntu official kernel is a vanilla kernel patched with some patches among which there's the one for initrd. So, if you are compiling a vanilla kernel, you should take --initrd out; otherwise, if you are compiling a Ubuntu kernel, you can make use of initrd and you probably would that.

    Note that now you'll have a .deb package in /usr/src ready to be installed as any other package through a simple double-click.
    Grub will be updated automatically.
    So, just type:
    Code:
    sudo dpkg -i kernel-image-2.6.12-custom_10.00.Custom_i386.deb
    Enjoy.
    Last edited by luca_linux; July 24th, 2005 at 11:10 PM.

  2. #2
    Join Date
    Apr 2005
    Location
    France
    Beans
    16
    Distro
    Ubuntu 6.10 Edgy

    Re: HOWTO: Kernel compilation

    Very nice HOWTO, clear and precise. Thanks !

  3. #3
    Join Date
    Apr 2005
    Location
    Miami, FL
    Beans
    39
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: HOWTO: Kernel compilation

    Code:
    :/usr/src$ sudo make xconfig
    make: *** No rule to make target `xconfig'.  Stop.
    :/usr/src$ sudo make menuconfig
    make: *** No rule to make target `menuconfig'.  Stop.
    :/usr/src$
    I don't know what to do. =\

  4. #4
    Join Date
    Apr 2005
    Beans
    514

    Re: HOWTO: Kernel compilation

    Yes, you're right. You need to:
    Code:
    cd /usr/src/linux
    HowTo fixed.

  5. #5
    Join Date
    Apr 2005
    Location
    Frequent Flyer Underworld
    Beans
    508

    Re: HOWTO: Kernel compilation

    Great howto. If you're going to include the '--initrd' switch in there, it probably wouldn't hurt to point out what kernel options are needed in order to do so. Otherwise, a lot of people will get 'kernel panic' if they build some essential options as modules (and not statically linked).

    CONFIG_BLK_DEV_RAM=y
    CONFIG_BLK_DEV_INITRD=y

    You'll probably need 'CONFIG_CRAMFS=y' as well since by default '/etc/mkinitrd/mkinitrd.conf' uses it (although you can change that). I don't remember the exact steps or options since I didn't write them down during my own compile, but I believe you'll need those for the initial ramdisk.

    \\//_

  6. #6
    Join Date
    Apr 2005
    Location
    Miami, FL
    Beans
    39
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: HOWTO: Kernel compilation

    You should also add that they need the QT development packages in order to use the graphical configuration.

    Code:
    sudo apt-get install libqt3-dev
    There is also a multi threaded version.

  7. #7
    Join Date
    Apr 2005
    Beans
    514

    Re: HOWTO: Kernel compilation

    Ok, I've made some changes: first of all I've added the package "libqt3-mt-dev" (that I prefer to "libqt3-dev") as needed, then I've decided to keep out the "--initrd" flag at all because I realized it also needs a kernel patch included in the Ubuntu Official kernel patches, but not in the vanilla kernel, so it could have been a bit confusing for newbee.
    Last edited by luca_linux; June 20th, 2005 at 11:40 PM.

  8. #8
    Join Date
    Apr 2005
    Location
    Miami, FL
    Beans
    39
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: HOWTO: Kernel compilation

    Question for xconfig. When customizing I am assuming a checkmark is yes, and a empty box is no. What then is a filled square box mean?

  9. #9
    Join Date
    Apr 2005
    Beans
    514

    Re: HOWTO: Kernel compilation

    It means to compile that option as a module.

  10. #10
    Join Date
    Apr 2005
    Location
    Miami, FL
    Beans
    39
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: HOWTO: Kernel compilation

    Quote Originally Posted by Original Poster
    Code:
    sudo make-kpkg clean
    sudo make-kpkg --revision=-custom kernel_image modules_image
    The revision flag is optional and is just useful to edit the kernel name showed through uname -r. You can write whatever you want instead of "-custom".
    I'm not sure what this means or wants me to do.

    Code:
     I note you are using a hyphen in the revision number.
     Please ensure that the upstream and debian revision
     numbers are policy compliant enough that dpkg and
     shall not choke on them at the end of the compile
     The revision -custom fails policy compliance, aborting
    My only guess is that we have a bad hyphen somewhere in the filename.

    edit: Changing custom to the kernel number (2.6.12) worked.
    Last edited by TheRealEdwin; June 21st, 2005 at 12:44 AM.

Page 1 of 21 12311 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •