[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to rebuild Woody kernel (Newbie)



WARNING: Much text follows. CC'd to list for archival purposes.
Kent


DSC Siltec wrote:
I've installed Woody, but have discovered that I don't have (a) ALSA for my sound (alternately ymfpci.o) or (b) support for my USB (which I assume will be necessary if I want to
upload my digital camera pictures to my Linux box.)

So I found out I have to rebuild my kernel.  Never having done this
before,
I went to the Linux Kernel HOWTO, and pulled up HOWTO Rebuild the
Kernel.

The stuff looks like greek to me.
For one thing, it starts a person out in BASH, switches to X [do you
really need X to rebuild the kernel???

No.

], loops out to telnet terminals,
and gets me completely lost in the process.

For another thing, I am not at all sure which modules I'll be needing,
and it looks like I'll have to know that.  I can pick up my filesystem
from module okay, and I can figure out my chip, and I can probably
safely assume that I have a PCI motherboard.  But most of these things
were bypassed in the initial woody installation.

Not sure I can help a lot here.


Ideally, it would be nice to get a list of the modules that I already
have and their installation values -- I am sure that they would be
listed somewhere in ETC, if I knew where to look.

"modules" that have been built/installed will be in /lib/modules/[kernel-version]. But that doesn't account for the things that are compiled in (ie not "modules"). You can also look in /usr/src/[kernel-version]/.config for clues, assuming you're not running a pre-compiled kernel (which I suspect you are, since you don't know how to compile a kernel).


So I was wondering -- are there any better howtos out there, possibly
more in line with Woody?  Or is there a newbie guide on rebuilding the
kernel?


Anyhow, this looks like a fairly scary process when I may wreck the
system and have no idea what I am doing (kid at the wheel of a
steamroller syndrome... what's this button do?).

You won't break anything permanently by trying different things in your configuration, so feel free to experiment/learn. As long as you're fairly conservative in your choices, you most likely won't hose the system too badly. You should be able to always fall back to your previous working kernel if necessary.

I make no claims to this being a "better howto", but it should be more Debian-specific.


Kent's 10-Step Procedure to Compiling a Debian Kernel

(I may leave a step or two out, but this is the gist)

1. Run "dselect". Choose "Update". Choose "Select". "space bar" to get out of the Help screens. Use "/" (without the quotes) to start search. Search for "kernel-source". Mark for installation the 2.4.18 or so.

1b. Use "/" to search for "kernel-package". Mark it for installation also. "Enter" to get back to the main dselect menu.

1c. Choose "Install". This will download a file in /usr/src with a .tgz extension, as well as install "kernel-package".

2. "cd /usr/src"

3. "gunzip kernel-source-2.4.18.tar.tgz" (or whatever the file is named). This will unzip (decompress) the file.

4. "tar -xvf kernel-source-2.4.18.tar". This will untar the file (x means extract, v means "be verbose", f means "use the file named ..."). A new subdirectory named kernel-source-2.4.18 will be created with all the untarred files under it. You can also do steps 3 and 4 in one tar command, but I never do; habit is the only reason. I think you just add the "z" switch to tar, such as "tar -xvzf 'filename'".

5. "ln -s kernel-source-2.4.18 linux". This will create a symbolic link ("alias" in Mac-speak; "shortcut" in Windows-speak, but more powerful than either) to the directory "kernel-source-2.4.18"; the symlink is named "linux". This step is not absolutely necessary, but it's the usual way of doing things. "ls -l" will show you that "linux" is a "pointer" to "/etc/src/kernel-source-2.4.18".


Pause and Breathe. You now have the kernel sources installed. You haven't done anything with them yet, but they're installed.


6. "cd /usr/src/linux" (which because linux is a symlink, accomplishes the same thing as "cd /usr/src/kernel-source-2.4.18").

7. "make menuconfig". This will start a curses-based (text-based) menu-driven application. There are a lot of choices here, and many of them won't make sense to you at all. Take the time to look at most all of them (some of them you'll know you don't need, like SCSI support if you have an all-IDE system, or Amateur Radio Support if you're not a ham) and read the HELP on them if they look relevant. A lot of the time the HELP will suggest whether you should include it or not, and generally when in doubt, leave things set the way they are. Some things to check out:
 * the correct processor for your system (AMD vs Pentium vs P4, etc)
 * Symmetric Multi-Processing; "No" if you only have a single processor
 * Loadable module support; "Yes" to all three sub-items.
* Parallel port support; "Yes" if you have a parallel printer. "No" to keep things simple for now if you can live without the printer for a while.
 * Plug-N-Play; "Yes"; ISA P-N-P; only if you have any ISA cards installed.
* Character devices; turn on Direct Rendering if your video card is listed, and turn on agpgart if your video chipset is listed; mice if you have a PS/2 mouse
 * Sound - find the driver for your card
* Input core support (some USB stuff needs this, but I'm hazy on it - use your best guess)
 * USB support (make your best guesses; I'm hazy on it)
 * You probably won't need to touch the following:
        - General Setup
        - Memory Technology
        - Block devices
        - Multi-device support
        - Networking options
        - Telephony support
        - ATA/IDE/MFM/RLL support
        - Fusion MPT device support
        - I20 device support
        - Amateur Radio support
        - Infrared support
        - ISDN subsystem
        - Old CD-ROM drivers (unless you have a non-ATAPI CD-ROM drive
for now; wait till you've compiled a kernel or two)
- Multimedia devices (unless you have a tv tuner, etc; too complicated for now; wait) - File Systems (unless you'll be accessing a DOS/FAT/NTFS/etc partition, or Windows shares via smb, etc)
        - Console Drivers (play with different text modes at bootup)
        - kernel hacking

It's by turning off unneeded stuff that the hackers get their kernels down in size and up in efficiency. But you're not really worried about either at this point.

7b. Exit and save your configuration. This will create a hidden file named ".configure" in the "/usr/src/linux" directory. You could edit this file directly to make changes to your configuration, but I wouldn't. All that this step (7 and 7b)) has done is to set up this configuration file. This file is read by the actual kernel compilation process to compile the options you've specified.


Pause and breathe again. You have now configured your options for the next kernel compilation, but you have not yet compiled it.


8. Compile the kernel: use the command "make-kpkg kernel_image". This will cause a bunch of grinding and text; depending on the speed of your computer and the options you chose, this could take minutes (fast computer) to hours (slow computer). This step is a Debian-way of compiling the kernel. The "other" way is to do it manually, which consists of several steps such as "make dep" and "make modules" and "make modules_install" and manually finding and moving the kernel to where it needs to be and setting up symlinks and configuring lilo.conf and running lilo. The Debian-way is much easier. The result will be a file named something like "kernel-image-2.4.18_1.00.Custom_i386.deb", one level up, in "/usr/src".


Pause and breathe. You have now compiled your kernel and made a .deb file out of it for easy installation.


If you're (re)compiling a kernel with the same version number as your current version, you'll probably want to run the command "mv /lib/modules/2.[whateverversion] /lib/modules/2.[whateverversion].old" to move the old modules out of the way in preparation for the creation of new modules. I don't remember if this needs to be done before step 8 or before step 9, but it'll warn you that you need to do this before it overwrites the old modules, and you can just open a new terminal and do it then without canceling whichever step it concerns. This is only applicable when (re)compiling the same version number of kernel as your existing version.

9. Install the new .deb file. Use the command "dpkg -i /usr/src/kernel-image-2.14.18*.deb". This will install the new kernel to where it needs to be (and I believe configure /etc/lilo.conf) and run lilo.


Pause and breathe. You are ready for a reboot to start running your new kernel. Make sure you have a backup method for getting into your box (a Debian install CD, or boot floppy, etc) in case something goes wrong.


10. Reboot. After the reboot, you should be running the new kernel. Typing "uname -a" will tell you what version of kernel you are running. Test the machine and see if things work properly.


Pause, breathe, celebrate. You've successfully compiled and installed your first kernel! You may not have a working sound card or USB stuff yet, and other things may have broken, but now that you know the basic procedure you can go back and try again.


Have fun!

Kent



--
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: