How to compile a new kernel *without* installing LILO
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
How to compile a new kernel *without* installing LILO
Hi,
Most of the newbie guides for kernel compiles say that LILO must be installed for it to work. Well I don't have LILO.
I already have GRUB installed on my system.
What steps should I take to install a new 2.6 kernel from source without the LILO updates? I just want a new kernel with a boot image and everything else properly configured. Nothing more. I know how to add this to GRUB.
Please help me because the instructions are rather confusing. I don't know which steps to perform and which to avoid, especially the bzimage part?
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 2,612
Rep:
it should work without too much problem
for linux 2.6 kernels, the sequence is
make menuconfig (or Xconfig in X11)
make
make modules
make install
make modules_install
I am really confused here? Should it be make install or make bzimage?
I think I should use make bzimage, copy it to /boot. Then I think I must edit the grub configuration file from my Debian installation to add the new boot image.
So for me the steps would be same but without running /sbin/lilo at the end and also editing the grub config file to include my new kernel image, right? All other steps are the same?
Originally posted by Harishankar I tried the precompiled kernel 2.6.7 from my testing folder and now I get a kernel panic when I boot:
Something similar to:
Code:
Kernel panic: cannot mount filesystem on /dev/hdb1
That is because you didn't compile the filesystem you are using INTO the kernel. Maybe you compiled it as module. That will not work. You need to recompile the kernel and bring in the filesystem your root partition (/ ) is using into the kernel.
How do I get back to my 2.4.26 kernel? And then do the compile from scratch.
Can I mount my Slackware partition from Debian and change the files? I have to change the links from vmlinuz -> vmlinuz-2.6 to vmlinuz -> vmlinuz-2.4.26
Can I mount the partition from my Debian configuration?
basically you just have multiple kernels lying around (usually in /boot), and you can create as many entries in your boot loader for as many kernels as you like. when you run make install a kernel image is created in /arch/1386/kernel/bzImage (read INSTALL, it'll be much more accurate about this than me). so you copy that to /boot, and hopefully name it something descriptive like vmlinuz-2.6.10, then you have to make a new entry in your boot loader (lilo or grub, either one) so next time you reboot, you get to choose between them.
whatever you decide to build as a module gets created and installed during make modules and make modules_install into /lib/modules/2.6.10/xxxx/xxxx/xxxx, pick a module that's listed when you type lsmod. slocate the module, and you should see module.o in your original kernel source directory (for me, 2.4.26) as well as a module.ko in /lib/modules/2.6.10/xxxxx. any of these modules that are executable can be inserted with modprobe.
now, these are not instructions. this is just to give you a general outline of what has to happen. make sure you read INSTALL and README in the kernel build directory, as well as the sticky threads on compiling kernels. those will tell you exactly which commands to type and all that.
It looks like this is pretty well covered. Just wanted to show how I compile 2.6.x kernels, which is slightly different than some, but works great. I'll assume that you already have the source and have cd into the source directory:
Code:
make xconfig
Optionally, replace xconfig with menuconfig, config, gconfig, etc. This is of course where you choose all the options for your kernel, like what goes in, what stays out, what is compiled as a module. When you are done, a file called .config is created in your source directory. You can further tune your .config file manually with a text editor, but I don't recommend that method. Just something handy to know.
Code:
make bzImage
Creates a kernel based on your .config file and places it in arch/1386/kernel/bzImage .
Code:
cp arch/1386/kernel/bzImage /boot/vmlinuz-2.6.x
Copies your newly created kernel to /boot/vmlinuz-2.6.x
2.6.x is the name of the kernel I just compiled. Actually, any name will work. I just find that it is easiest to name a 2.6.10 kernel vmlinuz-2.6.10. Use any naming convention you like, just be consistent in naming the kernel, System.map, and config.
Code:
make modules
Creates all the modules that were specified in your .config file.
Code:
make modules_install
Moves all of the modules that you created over to /lib/modules/kernel_name where kernel_name is specified in your Makefile. kernel_name is actually $VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION . This can be handy to know, since $EXTRAVERSION can be used to make sure that you leave another compile of the same version kernel alone.
Code:
cp System.map /boot/System.map-2.6.x
Copies your System.map file to /boot/System.map-2.6.x. Again, this naming can be arbitrary, but should be the same convention that you used for the kernel.
Code:
cp .config /boot/config-2.6.x
Copies your .config file to /boot/config-2.6.x. Again, this naming can be arbitrary, but should be the same convention that you used for the kernel. This is not a required step, but it does put your config file somewhere easy to rememder in case you want to compile the same kernel again in the future. Some people even place a copy in their home directory with a more descriptive name. A handy use of this is the ability to quickly compile a custom kernel on a fresh install. You can always copy the config file over to your kernel source directory as .config and skip the first step.
If you like, at this point you are free to make symbolic links in /boot. It isn't necessary, and if it is done, care should be taken to make sure that your boot loader is configured properly, i.e. the stock kernel may have been pointing to symlinks, so make sure that the boot loader still points to valid kernel images.
All that is left at this point is to configure your boot loader. For LILO, that would mean editing /etc/lilo.conf and running /sbin/lilo. For GRUB, ????. That's the part I figure you know, right?
Originally posted by frieza it should work without too much problem
for linux 2.6 kernels, the sequence is
make menuconfig (or Xconfig in X11)
make
make modules
make install
make modules_install
What do you mean?
The sequence was:
make menuconfig
make
make modules_install
make install
Im starting to get a little bit confused right now.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.