E-Mail:
Get our new Windows 7 eBook (PDF) for $7 with 70+ Tips. Download Now!

Great Kernel Guide

  • No Related Post

The act of compiling a new kernel isn’t as difficult as many people expect. For the most part, you select your kernel options, compile it, copy a few files to appropriate locations, and you’re good to go. The hard part lies in knowing what you need.

I’ve successfully compiled a few kernels for Slackware-based servers in the past. However, building the config file takes time. I’ve always thought it would be a heck of a lot easier to just use the same configure file I used when I first installed the OS rather than having to start from scratch. Given I’m building a new kernel for my new firewall box, I dug for an answer.

That’s when I found JustLinux’s Kernel Compilation guide and the following paragraph:

[make oldconfig] looks in your /usr/src/linux directory for a file named .config This file contains all the compilation options you chose the last time you compiled your kernel. So if you are simply upgrading your kernel, and have the same requirements from your kernel, you can simply use this option to load your default values. Just make sure that your .config file from your old kernel source tree is copied into your new kernel source tree, and you will be able to apply the same values you compiled into your last kernel.

That certainly made my life a lot easier! I found the .config file in the old kernel’s directory with a simple ls -a. Why I hadn’t spotted it before I’ll never know. Gotta love it when a computer makes you feel stupid. I learned kernel compilation from a book, and unfortunately it didn’t mention this option.

I use make menuconfig on the command line to build my server kernels (I don’t put GUIs on ‘em), so rather than using make oldconfig above, I ran make menuconfig and selected the option to load another configuration file. I simply pointed to the .config file in the old tree. This way I could verify the info and make any desired changes without having to exit the menu screen.

The full kernel compilation procedure is outlined in the guide and is very easy to follow. While it was written when 2.2.x kernels were current, it’s still valid for 2.4.x. Things may have changed for 2.6.x, I’m not sure.

The last question is “why build your own kernel?” There are a number reasons: performance, to add support for specialized hardware or network configurations, to strip support for hardware you’ll never use (ie, PCMCIA on a desktop, vid4lin on a GUI-less server), the list goes on.

Remember, this is Linux. It’s YOUR box. Feel free to experiment!

4 Comments

I have installed slackware 12.1 on vmware with xp desktop.

can you send me the steps to compile new kernel for slackware 12.1

I have tired so many times, but getting errors

Here is my configs,

make mrproper
make menuconfig
make -j3 bzImage
make -j3 modules
make modules_install
cp System.map /boot/System.mapnew
cp .config /boot/confignew
cp /usr/src/linux/arch/i386/boot/bzImage /boot/vmlinuznew
mv /boot/vmlinuz /boot/vmlinuz-old

/etc/lilo.conf

lba32
compact
vga=normal

image = /boot/vmlinuznew
root = /dev/sda2
label = linux_2618
read-only

image = /boot/vmlinuz-old
root = /dev/sda2
label = linux_2433
read-only

/sbin/lilo -v

cd /boot
rm System.map
rm config
rm vmlinuz

Errors and resolved:

No filesystem could mount, tried:
kernel panic - not syncing: VFS: unable to mount root fs on unknown-block(8,2)

I have enabled ext3 file system in menconfig

I have done below configurations after rebooting getting L 99 99 99 99 screen

mkinitrd -c -k 2.6.25.4 -m ext3

image = /boot/vmlinuz-custom-2.625.4
root = /dev/sda2
initrd = /boot/initrd.gz
label = newkernel

But not able to get second kernel now

Please help me

Hello. I know this message is nearly a year old, but I have the same problem right now with version 12.2 of Slacware.
Have anybody found a solution for this message yet?
I have googled the net, and have noticed this message appears frequently when compiling a (newer/modified) kernel.
Thanks in advance.

Extra info:
For comparison I have done a ‘file’ command on a working kernel (vmlinuz-huge-smp-2.6.27.7-smp) and my compiled kernel (not booting, vmlinuz-2.6.27-smp)

vmlinuz-huge-smp-2.6.27.7-smp: Linux kernel x86 boot executable bzImage, version 2.6.27.7-smp (root@midas) #2 SM, RO-rootFS, root_dev 0×802, swap_dev 0×4, Normal VGA
vmlinuz-2.6.27-smp: Linux kernel x86 boot executable bzImage, version 2.6.27.7-smp (root@slack) #3 SM, RO-rootFS, root_dev 0×301, swap_dev 0×2, Normal VGA

ls -lh
-rw-r–r–. 1 michael michael 4,6M jul 28 22:05 vmlinuz-huge-smp-2.6.27.7-smp
-rw-r–r–. 1 michael michael 2,3M jul 28 22:07 vmlinuz-2.6.27-smp

Found the solution:
http://www.linuxquestions.org/questions/slackware-14/kernel-panic-not-syncing-vfs-unable-to-mount-root-file-system-441723/
quote
Correct me if I’m wrong, but the Kernel Panic VFS message occurs when you have a kernel that has the filesystem support for the HD that has linux installed, compiled as a module when it should be compiled “into” the kernel, not as a module….

What Do You Think?

 
35 queries / 0.349 seconds.