Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com Sep 8 '12 at 12:35

This question came from our site for professional and enthusiast programmers.

1  
Did you create an initramfs for the new kernel? Without this it might not have all the modules it needs to boot your system. –  cdhowie Jan 7 '11 at 23:43
    
I am a newbie. I did not create that. Whatever was mentioned on that page howtoforge.com/kernel_compilation_ubuntu_p2, I did that. I think .deb package has the initrm file –  pineapple Jan 7 '11 at 23:44
    
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 Jan 7 '11 at 23:46
    
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 Jan 7 '11 at 23:49
    
There is no "best" distribution. You pick the one that is suited for the task, unless you have already chosen one based upon appeal. –  user562374 Jan 8 '11 at 17:05

2 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

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.