Compiling and installing a new kernel on ubuntu 10.04

0

I have ubuntu 10.04 running on VMware on a windows host. I am learning linux device drivers programming. So in the process, I was trying to set up a linux source tree and build and load a custom kernel. I made the two .deb packages (custom kernel) and installed them using dpkg (http://www.howtoforge.com/kernel_compilation_ubuntu_p2). Then when I rebooted, it says : kernel panic, unable to mount root fs on unknown-block(0,0). Please guide what should I do ?

My system has GRUB2.

Also please tell which is the best linux distribution to learn linux device drivers programming. I am finding Ubuntu somewhat difficult as most of the tutorials that I am finding on internet for building kernels are written for generic linux but Ubuntu has a different way. There is not much help available.

pineapple

Posted 2011-01-07T23:38:40.740

Reputation: 1 724

1Did you create an initramfs for the new kernel? Without this it might not have all the modules it needs to boot your system. – cdhowie – 2011-01-07T23:43:02.487

I am a newbie. I did not create that. Whatever was mentioned on that page http://www.howtoforge.com/kernel_compilation_ubuntu_p2, I did that. I think .deb package has the initrm file

– pineapple – 2011-01-07T23:44:53.930

Deb kernel packages do not contain initramfs files, because these are usually built per-system as part of the install/upgrade process. Have a look at man mkinitramfs and try creating one for the new kernel. – cdhowie – 2011-01-07T23:46:39.943

Could you recommend a simple linux distro which I can use easily for my purpose. I am stuck for a long time just for building up the kernel and still not succeeded – pineapple – 2011-01-07T23:49:39.753

There is no "best" distribution. You pick the one that is suited for the task, unless you have already chosen one based upon appeal. – None – 2011-01-08T17:05:38.030

I share your opinion that Ubuntu does not strike as a serious development platform (after all serving beginners with desktop systems is what they try to do); their components are often outdated as a result. When it comes to the "top five" distros (as determined by distrowatch.org), I can vouch for Fedora, openSUSE and (currently) Debian-6 meeting the requirements for serious developers. – None – 2011-01-08T17:08:17.420

Well, you should be able to work with distro-agnostic tutorials (the mass of them that you seem to have an aversion to), even on Unbunt. After all, that is the point of being generic. It's not like you are required to make distro-specific binary packages. – None – 2011-01-08T17:09:31.710

Answers

2

To config, build, and install new kernel on Ubuntu 10.04 follow these steps:

  1. cd to the directory with the kernel source tree (assuming this is ~/linux):

    cd ~/linux
    
  2. Copy your current kernel configuration to the source tree:

    cp /boot/config-2.6.32-32-generic .config
    
  3. Config additional options (here I just accept defaults):

    yes '' | make oldconfig
    

    Now you can change some options, if you don't want defaults. On my machine I chose 'Processor family' = 'Core 2' and 'Preemption model' = 'Preemptible kernel'. To do this run:

    make menuconfig
    

    and chose options that you like. You can press ? on any option and there will be short description.

  4. Build the kernel:

    make -j4 > /dev/null
    

    change 4 to the (number_of_physical_cores_on_your_machine * 2), this will make building of the kernel a lot faster. Don't be afraid of > /dev/null since all the warnings and errors still will be output.

  5. Install the new kernel:

    sudo -s
    make INSTALL_MOD_STRIP=1 modules_install
    

    you can just make modules_install if you plan to debug the kernel

    make install
    update-initramfs -c -k `make kernelrelease`
    update-grub
    exit
    

This how-to is based on New kernel on Ubuntu 10.04

lyonya20011

Posted 2011-01-07T23:38:40.740

Reputation:

0

I'll recomend Gentoo. It's a little bit harder to install and use then out of the box Ubuntu, but you are getting to know your system from the beginning. Even if you are newbie, installation instructions will guide you through the process, and compiling your own kernel is a part of it.

Poll

Posted 2011-01-07T23:38:40.740

Reputation: