Find the answer to your Linux question:
Results 1 to 6 of 6
Hi All, I am trying to compile a kernel 2.6.31-12 in my machine which is running ubuntu 9.0 (kernel version 2.6.31-14). I don't have internet connection on that machine. I ...
  1. #1
    Just Joined!
    Join Date
    Mar 2010
    Posts
    1

    recompiling ubuntu kernel

    Hi All,

    I am trying to compile a kernel 2.6.31-12 in my machine which is running ubuntu 9.0
    (kernel version 2.6.31-14). I don't have internet connection on that machine. I somehow downloaded the kernel sources on some other machine and copied it the my PC which is running ubuntu.

    I have installed the kernel sources (.gz file) by un-zipping and un-tarring the archive. For compiling the kernel I am following the traditional approach:
    1. make oldconfig ( make menu config is not working )
    2. make dep
    2. make clean
    3. make bzImage
    4. make modules
    5. make modules_install
    6. make install
    7. Modify the /boot/grub/grub.cgf

    I didnt encounter any error in the above steps till step no. 6. However in the
    step 7, I am not getting the /boot/initrd.img-2.6.31.12 file which is needed for the ramfs. However I am getting the vmlinuz file in the /boot.

    Pls help me out in figuring out where I did the mistake.

    Regards
    Shubhadeep

  2. #2
    Just Joined! Leppie's Avatar
    Join Date
    Feb 2010
    Posts
    72

  3. #3
    Just Joined! gtphonehome's Avatar
    Join Date
    Mar 2010
    Location
    Minnesota
    Posts
    6

    Thumbs up recompile ubuntu kernel

    You will have to make an initrd. Fun Fun! Follow these Instructions on easy streamlining and installing of the new kernel, generating the corresponding initrd, and configuring your grub boot loader.

    ------------------------------------------------------------------------------------------------------------------------------
    I suggest downloading a stable kernel from kernel.org or you can just install linux-source(version) package from Synaptic Package Manager...

    ################################################## #

    switch to user root....

    Open a terminal....

    su (hit enter) --> give password


    ### Move downloaded kernel to source directory if from kernel.org

    mv /path/to/linux/kernel/linux-(version).tar.gz /usr/src


    ############################################
    ###.....for menuconfig you need to install libncurses5-dev

    apt-get install libncurses5-dev


    ### Change to directory with sources

    cd /usr/src


    ### Extract the kernel source if not already done

    tar -xvjf linux-(version).tar.gz


    ### Create a soft link to your new kernel source directory

    ln -s linux-(version) linux


    ### Change to new work directory

    cd linux


    ### Clone the old .config file from the stock kernel

    make oldconfig

    #Select no for all new options since your old kernel works fine (some noobie friendly advice) ....


    ### Now for some optimizations

    make menuconfig

    Processor type and features --->
    Processor Family--->
    (*) your processor type

    Processor type and features --->
    (*) High Resolution Timer Support

    Processor type and features --->
    Preemption Mode (Complete Preemption (Real-Time)) --->
    ( ) No Forced Preemption (Server)
    ( ) Voluntary Kernel Preemption (Desktop)
    ( ) Preemptible Kernel (Low-Latency Desktop)
    (X) Complete Preemption (Real-Time)

    Processor type and features --->
    Timer frequency (1000 HZ) --->
    (X) 1000 HZ

    Power management options --->
    ACPI --->
    (*) ACPI Support
    (*) Power Management Timer Support

    Device drivers --->
    Character devices --->
    <*> Enhanced Real Time Clock Support

    Device drivers --->
    Sound --->
    Advanced Linux Sound Architecture --->
    <*> RTC Timer support[*] Use RTC as default sequencer timer

    Kernel hacking --->[*] Magic SysRq key #that one is always good to have
    [ ] Kernel debugging

    Security options --->[*] Enable different security models
    <M> Default Linux Capabilities
    <M> Realtime Capabilities

    #Hit escape until you have exited all menus and choose to save your new kernel configuration.


    ### Compile and Install Kernel

    make && make modules_install && make install


    ### Make your initrd... -o selects output file

    mkinitramfs -o /boot/initrd.img-$(uname -r)


    ### Check the output files for existence

    ls /boot


    ### If output files do not exist then do:

    mount /boot && make install && mkinitramfs -o /boot/initrd.img-$(uname -r)


    ### Update your boot loader configuration

    update-grub #(or update-grub2 depending on which version you have installed)


    ### Set some priority limitations (rt)

    nano /etc/security/limits.conf # Make sure it contains the following...

    # rtprio
    @audio - rtprio 90
    @audio - nice -5
    @audio - memlock 500000

    #for memlock- however much ram you wish to dedicate (1024=1meg). do not use "unlimited" option due to risk of locking up your entire system

    Control+x (save and exit)

    ##################################################


    ### Finishing up

    Make sure your user is in the group "audio"
    ----------------------------------------------------------------------------

    System --> Administration --> Users and Groups

    Unlock with administrator password...

    Select "groups"

    Add your user to the group "audio"

    ---------------------------------------------------------------------------

    Note: Your not preempting the whole system, you are enabling the ability to assign real-time priorities to specific threads.

    Now you have a streamlined responsive rt-kernel built for your processor with the same modules available as you had before. Reboot and Enjoy
    Last edited by gtphonehome; 03-12-2010 at 12:14 AM. Reason: cleaning up my suggestion

  4. #4
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,316
    Hi and Welcome !

    This HowTo is complete and one of the best on Kernel Compilation. I would suggest you to take a look into it.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  5. #5
    Just Joined! gtphonehome's Avatar
    Join Date
    Mar 2010
    Location
    Minnesota
    Posts
    6
    if he doesnt know how to make an initrd what makes you think he can follow that and be successful?

  6. #6
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,316
    Quote Originally Posted by gtphonehome View Post
    if he doesnt know how to make an initrd what makes you think he can follow that and be successful?
    Have you checked the link I posted? There is no need to install libncurses5-dev or any other package because thread starter has compiled kernel already. Everything has been done except initial Ramdisk creation.
    That step has been explained very well in the link I posted.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

Posting Permissions

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