7

I have started reading the book Essential Linux Device Drivers. I am following the process for compiling and booting into a new kernel. However I am unable to boot into the newly compiled kernel - I select the new kernel in grub and then ..nothing...the screen just stays the same.

Here are the steps I am taking, as described in the book (I am using kernel 2.6.24 as that is what the book is based on):

cd /usr/src/linux-2.6.24 # the base dir of the kernel I downloaded
make clean
cp arch/x86/configs/i386_defconfig .config
make bzImage
cp arch/x86/boot/bzImage /boot/vmlinuz

The book says that:

You might need to alert your bootloader about the arrival of the new boot image. If you are using the GRUB bootloader, it figures this out automatically.

Well it didn't figure it out automatically in my case as there was no option to select this kernel in GRUB. So I did it manually by typing update-grub in the terminal. And this didn't work either. However once I changed the filename from vmlinuz to vmlinuz-2.6.24 and type update-grub it picked it up. So on page 11 of the book there seems to already be multiple things left out.

The book says to then reboot the machine.

Anyway, I am now able to select this kernel in GRUB but as I said above it doesn't boot properly, the screen just goes blank and never changes. So am I missing something? I have followed the instructions in the book exactly. I am after spending €50 on this book and now I cannot go past page 11 because of this issue.

I take it the fact that I am using Ubuntu on VirtualBox is not an issue? I just go into grub during the boot of the virtual machine Ubuntu and then select the newly compiled kernel, I can't see how that could be an issue.

4
  • 1
    Following distro-specific guides is the right way to go if you don't know where you're going. wiki.ubuntu.com/KernelTeam/GitKernelBuild or help.ubuntu.com/community/Kernel/Compile for Ubuntu. It's near impossible to debug your issue for you, so many things could be wrong (esp. initramfs stuff). (This doesn't block you from reading the rest of the book, it's a "minor detail", you'll get it to work eventually, and run into much trickier problems if you actually start touching kernel code.)
    – Mat
    Commented Jun 24, 2012 at 15:45
  • 1
    BTW, I don't know what kernel version your Ubuntu install is running, but it might not be compatible with 2.6.24. Use at least the same version (or newer) that your distro ships.
    – Mat
    Commented Jun 24, 2012 at 15:47
  • Ok, ill have a go at compiling the current kernel. I hope I can still get some use out of that book and that I have't thrown away €50. Really want to learn about writing device drivers.
    – Jim_CS
    Commented Jun 24, 2012 at 16:48
  • 2
    As I said, getting your first kernel to boot is just a detail. I don't know that book, but you shouldn't even count this "incident" against it - I'm pretty sure it's about writing device drivers, not compiling your first kernel (which the authors probably assume you're in fact familiar with prior to buying their book). Use your distro's stuff until you're familiar enough with the process to debug your setup yourself (and know which config options to use).
    – Mat
    Commented Jun 24, 2012 at 17:23

3 Answers 3

3

Ubuntu has a script imported from Debian which does the install for you. After compiling the kernel just run sudo make modules_install install and your kernel will be installed correctly.

Later edit: Here is the script which Ubuntu and Debian use. It is automatically called by the kernel Makefile when you issue the above install commands and does the distro specific install.

0

Your grub.conf file should have the entry similer to this

title My Linux Kernel
root (hd0,0)
kernel /boot/gentoo-kernel root=/dev/sda1

your Ubuntu kernel might have something like

initrd /boot/initrd.img

you should not need this when compiling a kernel on your hardware. This could be causing your problem.

You should comment me your grub.conf file and I will take a look at it. otherwise you configuration may be to blame.

The older kernel may also not have the drivers you need for newer hardware.

A newer ubuntu system will not go back to that old of a kernel version with out a bunch of trouble.

you could try an older ubuntu that runs a version near that kernel version or the newest kernel version from kernel.org.

0

Each linux distributions have their own mechanism and policy about package deployement. This is the same with Kernel. Most of distro are hidding the compiling process with their tools which mostly provides binary packages.

If you want to compile a custom kernel on a specific linux distribution you have to follow this distribution how-to on how to do it their way without breaking your system.

Ubuntu has its specific way, same for Achlinux, same for Redhat, or Gentoo.

So for Ubuntu follow the documentation here https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .