PDA

View Full Version : The easiest kernel install yet and no xfs patch either!



rickenbacherus
06-16-2003, 05:22 AM
After reading and trying some of the various methods I've seen for recompiling a Knoppix hdinstalled kernel, I have simplified it just a bit and we won't be using the xfs patch. This is more or less just the standard Debian way of installing a new kernel.

*NOTE* I (not wishing to tempt fate) am behind a very secure firewall and do not concern myself with logging in as root to get things done when necessary. You can log in as user, become root, apt-get install kernel-source blah and then relog in as root to build your new kernel if it makes you more comfortable.

You need to log in as root or you risk having permission problems. You can use fakeroot but this is one less thing to bother with in the process.

# apt-cache search ^ kernel-source
# apt-get install debhelper modutils kernel-package libncurses5
# apt-get install kernel-source-2.4.21

or whichever kernel you'd like to use.

# mcedit /etc/kernel-pkg.conf
Enter your name and email.
# cd /usr/src
# tar --bzip2 -xvf kernel-source-2.4.21.tar.bz2
# cd kernel-source-2.4.21

Now you have a choice. You can do this:

# cp /boot/config-2.4.20xfs.config

A) You can either keep the 2.4.20xfs.config file you just copied as it is or change it as you like. Then go on to the make xconfig step.

-OR- (my preference) you can skip that cp step and create your own .config file from scratch (from the default configuration actually). This can be a time consuming, hair yanking process but it is a very worthwhile effort that will produce a slimmer, trimmer, faster, tailor-made kernel.
Take your time and read about anything that you aren't familiar with. You can save the file and return to it later too.

# make xconfig

*NOTE* Make sure to select cramfs and initrd!!!

Of course do not forget to save your configuration.

# make-kpkg clean
# make-kpkg --initrd --revision=custom.1.0 kernel_image modules

*NOTE* adding the modules target to the above line is critical or your new kernel will fail to boot because the existing modules were compiled for 2.4.20xfs instead of 2.4.21 Also it eliminates making another kpkg and installing another kpkg.

# cd ..

(yes that IS cd<single space>..)
# dpkg -i kernel-image-2.4.21_custom.1.0_i386.deb

Make the boot floppy if you can. It is possible that your kernel will be too big to fit on a floppy(if you copied the xfs.config for example) Select yes to Install LILO. I cannot guide you specifically as I don't know what your setup is like. I can however briefly explain how my system boots as an example:

In /dev/hda1 I have installed GRUB. I highly recommend it as a boot manager. I never install anything else to /dev/hda1, instead I only edit the grub.conf file as necessary and add or remove partitions I would like to boot. You should be safe choosing to use the /etc/lilo.conf file that you already have. Just be sure to add your new kernel to /etc/lilo.conf. Here's mine:


# Boot up Linux by default.
#
default=Linux

image=/boot/vmlinuz-2.4.20-xfs
label=Linux
initrd=/boot/initrd.gz
read-only

Then, just add the new kernel like this:


image=/boot/vmlinuz-2.4.21
label=NewKernel
initrd=/boot/initrd.img-2.4.21
read-only


Now do /sbin/lilo and if there are no errors it's time to reboot! Select "NewKernel" (or whatever you have called your new kernel) and see if it boots. By not removing the original you can reboot and select it instead so that you aren't left with an unbootable system.

What if after I do make-kpkg --revision=custom.1.0 kernel_image modules it errors and fails to compile?

# make-kpkg clean

*TIP* If it fails while making the modules then change your command to this:

make-kpkg --revision=custom.1.0 kernel_image

This way, you can build the kernel package and then the modules. If it fails on the modules a second time you won't be recompiling the kernel too.

If it failed compiling the kernel then continue...

Then try again from make xconfig. Enter the error into G4L (http://www.google.com/linux) to find out what it is in your configuration that isn't working if you can't figure it out. Sometimes if you select option A you must also select option B and visa-versa. There's really only one way to learn and that's by just doing it.

Remember- you don't have to finish it, you can always come back to it later.

Recommended reading: man make-kpkg

*HINT* If you installed Knoppix to a 3G partition and haven't at least moved your /home directory to another partition you might run out of room when compilng this kernel. Make sure you have enough room before you start.

gluck

Ghandalfar
06-16-2003, 02:17 PM
Do not make the mistake of thinking that logging in as root is equivalent to suing to root- they are not the same thing! You need to log in as root or you will have nasty permissions problems

tried 'su -' instead of just 'su' .. that works for me and no nasty permission problems..

rickenbacherus
06-16-2003, 03:41 PM
tried 'su -' instead of just 'su' .. that works for me and no nasty permission problems..

I certainly won't argue with you but it is possible that these permission problems could show up at a later date. You never know.

At any rate- I presume everything else worked out ok?

aay
06-16-2003, 03:57 PM
Pardon me, but how is "su -" different from "su" I enjoy finding out about helpful things like this, but I'm just wondering what's the difference.

Stephen
06-16-2003, 06:29 PM
Pardon me, but how is "su -" different from "su" I enjoy finding out about helpful things like this, but I'm just wondering what's the difference.

IIRC su - keeps your environment when you become super user also adding yourself to the group src should solve most problems when compiling.

aay
06-17-2003, 05:51 AM
Ok. Thanks. "man su" says "su -" "makes this a login shell." Helpful.

rickenbacherus
06-17-2003, 04:11 PM
Well guys (& gals) I am having a minor major difficulty after my recompile. I have a Radeon 7200 and of course wish to use the radeon Xserver BUT- it seems that on recompile the old radeon.o module is used. So........off to Xfree86.org, dl their latest drivers from the cvs tree, and replace the radeon.o driver. Still tho- the problem persists. Still working the issue. I'll post some more specific errors when I get home- anybody else having module problems?

Fabianx
07-22-2003, 07:37 AM
Thats a nice tutorial!

Thanks, for mailing me :-).

I have however some additions:

First in the config you should have: CRAMFS=Y as its used by the Debian initrd or even better builtin the Filesystem of your choice. (ext3/reiserfs) So you won't need an initrd at all ...

Btw. You config is problematic:

initrd=/boot/initrd.gz is at old and new kernel ...

So one kernel will get difficulty ...

Perhaps make a backup of the initrd.gz before ?

Withe the radeon-drivers, just get the tree from http://dri.sf.net and compile it for your kernel.

Also don't forget: pcmcia-modules, wlang-ng-modules and perhaps alsa. If you need any of these things ...

cu

Fabian

Coume
07-23-2003, 08:10 AM
Thxs for this!!!
Know I now how to recompil kernel :)

but I found somewhere, that you have to apply a patch before recompiling kernel, knoppix-kernel.patch
Is it really important or there is no need to do that??

Thxs
Ludo

Coume
07-23-2003, 08:24 AM
And I forgot to ask!!

If I want to add the patch to have the acpi for my latop, when do I need to patch in this process?
And what is the command line: patch -p0 acpi*****

Argh, I'm sure I will soon be able to use linux :)
eheh
ludo

SUOrangeman
08-25-2003, 02:24 PM
Has anyone tried a 2.6 test kernel with these instructions? I'll give it a whirl, if I can find the time.

-SUO

jduff
08-30-2003, 08:02 AM
I got and used a vanilla kernel from kernel.org and had no problems upgrading to get to 2.4.22 and it took fewer commands than this.

Maybe I'm just not as paranoid? Whatever, you find what works for you and run with it.

There is also more than one way to do these things, obviously.

Nigel_Tufnel
10-31-2003, 03:26 PM
Thanks for the tips. I tried upgrading using the standard Debian method and my system couldn't find the new modules setup. This did the trick. :)

dovidbaron
01-20-2004, 03:39 PM
Having no success with initrd to get ext3 up, decided to follow your procedure and redo the kernel. Downloaded the 2.4.22 package, first tried making a fresh xconfig but had to edit its result anyway since ext3 and jbd were not even choices there so reverted back to the existing config and edited that. All this was not so terrible. After editing it, read it into the xsonfig and then saved.

First tried to make-kpkg with the modules (not necessary, since they were all there--same version as I have, but). This proceded, left a 3meg vmlinuz on the src directory but did produce anything usable. I was no really looking, I suppose. Cleaned and did it again with out the modules (I am not trying to make an initrd but activated the cramfs as well). Where it fails (it took longer this time!!), is that it cannot open a ....\extra\module... file for writing and exited error=255. I was not out of disk space. The "extra" subdirectory was not there. Made it, repeated (without cleaning, it passes everything already done--tell us that!), the same error.

Afraid I was out of diskspace, I removed the package (everything already compiled). Repeat the make-dpkg which failed at the same point. So another 30meg did not help. I ended up deleting the whole business--will try again when I know more, probably with 2.6.

1. There were compiler warnings--long too small for integer constant !!!, deprecated operations, result always true/false because of size of variable, etc. Don't like that.

2. How much disk space IS really needed to do this.

3. How does one recover from the error and procedes.

4. That too-large vmlinuz? What is it? Too big for lilo.