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

Re: Writing a kernel building walkthrough - proofreaders wanted



>>"Kirk" == Kirk Strauser <kirk@strauser.com> writes:

 Kirk> At 2002-09-13T05:33:11Z, Manoj Srivastava <srivasta@debian.org> writes:
 >> Have you looked at /usr/share/doc/kernel-package/README.gz and
 >> /usr/share/doc/kernel-package/Problems.gz ?

 Kirk> Yes, I have.  Those (particularly README.gz) and 'man
 Kirk> make-kpkg' gave me enough information to get the job done, but
 Kirk> I wanted a step-by-step walkthrough of the process.  Between
 Kirk> the LVM2 patches and NVidia module, it seemed that I always
 Kirk> missed a step somewhere.

	Ok. Here is something Kent West <westk@nicanor.acu.edu> has
 created, that shell be going into kernel-package soon (and also
 perhaps into the kernel-source-X.X.XX packages). If you improve on
 it, please let send it in to add in to the kernel-package itself

	manoj


	Kent's 10-Step Procedure to Compiling a Debian Kernel
		  Kent West <westk@nicanor.acu.edu>

(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/local/src"

3. "gunzip /usr/src/kernel-source-2.4.18.tar.gz" (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


X-From-Line: bounce-debian-user=srivasta=datasync.com@lists.debian.org Wed May 22 15:40:07 2002
Received: from pop.datasync.com (srivasta@glaurung.green-gryphon.com [192.168.1.10])
	by glaurung.green-gryphon.com (8.12.3/8.12.3/Debian-9) with ESMTP id g4MKe5KV005769
	for <srivasta@glaurung.green-gryphon.com>; Wed, 22 May 2002 15:40:06 -0500
Received: by mail (mbox srivasta)
 (with Cubic Circle's cucipop (v1.31 1998/05/13) Wed May 22 15:40:08 2002)
X-From_: bounce-debian-user=srivasta=datasync.com@lists.debian.org  Wed May 22 15:39:00 2002
Received: from murphy.debian.org (murphy.debian.org [65.125.64.134])
	by mx.datasync.com (8.11.6/8.11.6) with SMTP id g4MKcxL21185
	for <srivasta@datasync.com>; Wed, 22 May 2002 15:38:59 -0500
Resent-Date: Wed, 22 May 2002 15:38:59 -0500
Received: (qmail 333 invoked by uid 38); 22 May 2002 20:38:50 -0000
X-Envelope-Sender: shalehperry@attbi.com
Received: (qmail 32727 invoked from network); 22 May 2002 20:38:42 -0000
Received: from sccrmhc03.attbi.com (204.127.202.63)
  by murphy.debian.org with SMTP; 22 May 2002 20:38:42 -0000
Received: from one ([12.235.84.58]) by sccrmhc03.attbi.com
          (InterMail vM.4.01.03.27 201-229-121-127-20010626) with ESMTP
          id <20020522203816.YRZE20219.sccrmhc03.attbi.com@one>;
          Wed, 22 May 2002 20:38:16 +0000
Received: from shaleh by one with local (Exim 3.35 #1 (Debian))
	id 17AcsC-0003GV-00; Wed, 22 May 2002 13:38:16 -0700
X-Gnus-Mail-Source: directory:~/var/spool/mail
Message-ID: <XFMail.20020522133816.shalehperry@attbi.com>
X-Mailer: XFMail 1.5.1 on Linux
X-Priority: 3 (Normal)
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0
In-Reply-To: <3CEBFD03.9C7147E4@siltec.lt>
Date: Wed, 22 May 2002 13:38:16 -0700 (PDT)
From: "Sean 'Shaleh' Perry" <shalehperry@attbi.com>
To: DSC Siltec <dscpubl@siltec.lt>
Subject: Re: How to rebuild Woody kernel (Newbie)
Cc: debian-user@lists.debian.org
Sender: Sean Perry <shaleh@one.local>
Resent-Message-ID: <uPUBFD.A.3E.ZHA78@murphy>
Resent-From: debian-user@lists.debian.org
X-Mailing-List: <debian-user@lists.debian.org> archive/latest/212877
X-Loop: debian-user@lists.debian.org
List-Post: <mailto:debian-user@lists.debian.org>
List-Help: <mailto:debian-user-request@lists.debian.org?subject=help>
List-Subscribe: <mailto:debian-user-request@lists.debian.org?subject=subscribe>
List-Unsubscribe: <mailto:debian-user-request@lists.debian.org?subject=unsubscribe>
Precedence: list
Resent-Sender: debian-user-request@lists.debian.org
X-SpamBouncer: 1.4 (8/24/01)
X-SBPass: Legitimate Mailing List (Internal)
X-SBClass: Bulk
X-Folder: Bulk
X-Spam-Status: No, hits=-4.6 required=5.0 tests=IN_REP_TO,AWL version=2.20
X-Spam-Level: 
X-Agent-list: debian-list
X-MYLIST: debian-user.spool
X-Filter: mailagent [version 3.0 PL73] for srivasta@debian.org
Lines: 39
Xref: glaurung.green-gryphon.com debian-user:237063

> 
> Sorry to seem stupid here, but it may be an accurate assessment %-)
> 
> 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?).  
> 
> Any suggestions?
> 

it is a little scary the first few times.

lsmod as root will show you the modules you have loaded right now.  That should
help.  I am going to assume you have the kernel source.

(the '#' means a root prompt)

# apt-get install libncurses5-dev kernel-package alsa-source
# cd /usr/src/
# tar zxvf alsa-source.tar.gz
# cd linux
# make menuconfig
  ...
  ...
# make-kpkg --revision=5:mine.1 kernel_image
# make-kpkg modules_image

Then install the debs that appear in /usr/src.

make menuconfig is easy to use and does not involve X.  Read each item and its
associated help.  It will probably take you two or three hours the first time. 
The actual kernel compile can take anywhere from 30 minutes to 3 hours.


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


X-From-Line: bounce-debian-user=srivasta=datasync.com@lists.debian.org Wed May 22 15:40:06 2002
Received: from pop.datasync.com (srivasta@glaurung.green-gryphon.com [192.168.1.10])
	by glaurung.green-gryphon.com (8.12.3/8.12.3/Debian-9) with ESMTP id g4MKe5KU005769
	for <srivasta@glaurung.green-gryphon.com>; Wed, 22 May 2002 15:40:06 -0500
Received: by mail (mbox srivasta)
 (with Cubic Circle's cucipop (v1.31 1998/05/13) Wed May 22 15:40:07 2002)
X-From_: bounce-debian-user=srivasta=datasync.com@lists.debian.org  Wed May 22 15:35:57 2002
Received: from murphy.debian.org (murphy.debian.org [65.125.64.134])
	by mx.datasync.com (8.11.6/8.11.6) with SMTP id g4MKZuL19379
	for <srivasta@datasync.com>; Wed, 22 May 2002 15:35:56 -0500
Resent-Date: Wed, 22 May 2002 15:35:56 -0500
Received: (qmail 26175 invoked by uid 38); 22 May 2002 20:35:51 -0000
X-Envelope-Sender: dman@dman.ddts.net
Received: (qmail 26132 invoked from network); 22 May 2002 20:35:50 -0000
Received: from unknown (HELO dman.ddts.net) (65.107.69.216)
  by murphy.debian.org with SMTP; 22 May 2002 20:35:50 -0000
Received: from dman by dman.ddts.net (Exim 4.04 #10 (Debian))
	protocol: local
	id 17AcyW-0001rA-00
	for <debian-user@lists.debian.org>
	; Wed, 22 May 2002 15:44:48 -0500
Date: Wed, 22 May 2002 15:44:48 -0500
From: dman <dman@dman.ddts.net>
To: debian-user@lists.debian.org
X-Gnus-Mail-Source: directory:~/var/spool/mail
Message-ID: <20020522204448.GB7015@dman.ddts.net>
Mail-Followup-To: debian-user@lists.debian.org
References: <3CEBFD03.9C7147E4@siltec.lt>
Mime-Version: 1.0
Content-Disposition: inline
In-Reply-To: <3CEBFD03.9C7147E4@siltec.lt>
User-Agent: Mutt/1.3.28i
X-Operating-System: Debian GNU/Linux
X-Kernel-Version: 2.4.18-custom.3
X-Uptime: 15:27:17 up 10 days, 23:45,  6 users,  load average: 0.11, 0.18, 0.09
X-Editor: VIM - Vi IMproved 6.1 (2002 Mar 24, compiled Apr 14 2002 20:44:53)
Subject: Re: How to rebuild Woody kernel (Newbie)
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="E39vaYmALEf/7YXx"
X-Spam-Level: 
Resent-Message-ID: <B4s-JB.A.vYG.nEA78@murphy>
Resent-From: debian-user@lists.debian.org
X-Mailing-List: <debian-user@lists.debian.org> archive/latest/212876
X-Loop: debian-user@lists.debian.org
List-Post: <mailto:debian-user@lists.debian.org>
List-Help: <mailto:debian-user-request@lists.debian.org?subject=help>
List-Subscribe: <mailto:debian-user-request@lists.debian.org?subject=subscribe>
List-Unsubscribe: <mailto:debian-user-request@lists.debian.org?subject=unsubscribe>
Precedence: list
Resent-Sender: debian-user-request@lists.debian.org
X-SpamBouncer: 1.4 (8/24/01)
X-SBPass: Legitimate Mailing List (Internal)
X-SBClass: Bulk
X-Folder: Bulk
X-Spam-Status: No, hits=-3.7 required=5.0 tests=IN_REP_TO,SIGNATURE_DELIM,AWL version=2.20
X-Spam-Level: 
X-Agent-list: debian-list
X-MYLIST: debian-user.spool
X-Filter: mailagent [version 3.0 PL73] for srivasta@debian.org
Lines: 124
Xref: glaurung.green-gryphon.com debian-user:237062


--E39vaYmALEf/7YXx
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, May 22, 2002 at 10:18:11PM +0200, DSC Siltec wrote:
| I've installed Woody, but have discovered that I don't have=20
| (a) ALSA for my sound (alternately ymfpci.o) or=20
| (b) support for my USB (which I assume will be necessary if I want to
| upload my digital camera pictures to my Linux box.)

I don't know about ALSA, but USB support is included in the
prepackaged kernels.  Oh, are you using 2.2 or 2.4?  I don't think the
=2Edebs for 2.2 kernels have USB.  Upgrade to 2.4 :-).

| 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.
|=20
| The stuff looks like greek to me. =20

Debian's kernel-package is much easier to use.  It takes care of
everything but configuration and updating your boot loader for you.
That howto is for building from a tarball distributed by kernel.org
and is probably geared for RH.

| 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.

Yeah, that's kind of important to know when building a kernel.

| 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. =20

They weren't bypassed at all.  You never compiled a kernel during your
woody installation :-).  Herbert Xu has put together a decent default
configuration that works for most people out-of-the-box.

| 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.

You can find that configuration in /boot/config-<kernel version>.  Go
ahead and start building your kernel.  You'll find the option in the
configuration interface for loading an existing config file.  You can
use that as a starting point.

| 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?

You can try reading the documentation in the "kernel-package" package.
Basically use this command to build your kernel :


fakeroot make-kpkg clean  && \
    fakeroot make-kpkg \
        --config=3Dxconfig \
        --append-to-version=3D-custom.${VER} \
        --revision=3Dcustom.${VER} \
        kernel_image \
        modules-image
        kernel_headers

but replace ${VER} with a version number (eg 1, 2, 3) so that you can
keep track of which build attempt you are testing.

This will create a .deb file that you can install with 'dpkg -i'.

| Sorry to seem stupid here, but it may be an accurate assessment %-)
|=20
| 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?). =20

It's intimidating at first, but really isn't all that bad once you get
the hang of it.  Here's the trick to prevent suicide :
    1)  keep your existing kernel intact, don't wipe it (or the
        modules) off your disk

    2)  Keep an option for loading it in your boot loader's config.
        That way you can revert back to it if (when) you make a
        mistake in configuring your new kernel.  Everyone makes
        mistakes from time to time.  The key isn't to not make a
        mistake but rather to know how and be able to recover from it.

The best way to learn how to build a kernel is to do it and discover
how it works through RTFM, experience, and making mistakes.
=20
HTH,
-D=20

--=20

If your life is a hard drive,
Christ can be your backup.
=20
GnuPG key : http://dman.ddts.net/~dman/public_key.gpg


--E39vaYmALEf/7YXx
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAjzsA0AACgkQO8l8XBKTpRS6wgCfQXhFzxmPN04/8EFdpd9/BoI6
C7sAn3AwnZ/2Juy6wElH5iGE3poUunn7
=zX1A
-----END PGP SIGNATURE-----

--E39vaYmALEf/7YXx--


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


-- 
 How many libertarians does it take to change a light bulb?  None -
 the market will take care of it. Bill Ware (?)
Manoj Srivastava   <srivasta@debian.org>  <http://www.debian.org/%7Esrivasta/>
1024R/C7261095 print CB D9 F4 12 68 07 E4 05  CC 2D 27 12 1D F5 E8 6E
1024D/BF24424C print 4966 F272 D093 B493 410B  924B 21BA DABB BF24 424C

Reply to: