[Watford] Linux New Starter Advice (Was: Lug Update)

Walter walter at helvatron.co.uk
Sun Apr 2 21:47:08 BST 2006


Hi Matt,

I have finally got round to digesting your details email re debian kernel
install.  Since I currently run Redhat 9 I assume I will have to install
debian first before the apt-get command will run. Redhat use use their own
program manager, rpm or something.

I have the distros for Debian, debian-30r2-i386, which I can use for this.
I'll use a spare HDD to get a clean install.  I'll then keep you posted of
progress and I may well need your help again.  Also the driver installs for
some of the pci cards I want to use can be tackled after I get this kernel
up and running.

Thanks again for all your help.  Considering its all from memory I am very
impressed.

Regards, Walter

-----Original Message-----
From: Matt Marsh [mailto:matt at mattmarsh.net] 
Sent: 01 April 2006 16:13
To: Walter
Subject: Re: [Watford] Linux New Starter Advice (Was: Lug Update)

Hi Walter,

I assume that you did intend to send this directly to me and not to the
mailing list? I don't mind you contacting me directly at all, though keeping
things on the mailing list might give other poeple the opportunity to learn
from your experiences and also give others chance to correct my mistakes or
give their opinions also :) If you're happier contacting me directly instead
like this though, that is fine either, whatever you're most comfortable
with.

> I have all the books I need. I have downloaded and mostly printed & 
> read all the stuff on the web that I thought was relevant.  But I 
> still come unstuck when trying to compile a driver for a pci card.  I 
> certainly have not managed to compile a new kernel as yet.  I am 
> really keen to get to know the system at the lowest level because that is
the interesting bit.

I certainly agree that getting to know the system at the lowest level is
very interesting, and with Linux you definitely get the opportunity to do
that. Is the PCI card that you're talking about the sound card that you talk
about later? Or is this a different card?

> I can fix a Windows machine (W3.11 to Server 2003) in minutes (or at 
> least figure out where the problem is) and before that in DOS. But 
> with Linux I don't know the commands yet, I don't know what tools are 
> available and how to use them so, to get some experience, I thought if 
> I start with the kernel and build my own using debian and follow the 
> instrtuctions in LFS.  But alas I keep failing. I am beginning to get 
> an inferiority complex.  Maybe I am trying to run before I can walk. 
> At this point I installed Redhat 9 and that went in, no problem.

Whilst there are generic instructions for building a kernel, no doubt as
those in LFS are, you can often find specific instructions for building a
kernel for a particular distribution too.

Many distros, Debian included, don't ship with a plain "vanilla" kernel,
instead they ship with a kernel which has many patches. As such it is
usually better to start with kernel sources available from that particular
distro and to follow the instructions they provide.

Unfortunately this does mean that the instructions of what you should do to
easily build a kernel on each distro do vary somewhat. To give you an idea
of how to easily build, and install, a kernel on Debian here is what I do:

The lines starting with # are the commands that need to be run, and they all
need to be run as root.

   First we fetch the (debian patched) kernel source:

# apt-get install kernel-source-2.6.8

   That command fetches the kernel source package and puts it at the
   following location on your system:
   /usr/src/kernel-source-2.6.8.tar.bz2

   And you can unpack that file by doing this:

# cd /usr/src
# tar -jxvf kernel-source-2.6.8.tar.bz2

   That will create a directory called /usr/src/kernel-source-2.6.8
   containing many directories with all the kernel source. For a
   kernel build however, many tools etc expect the source to be in
   a directory of /usr/src/linux. So we can create a "symlink" to
   that directory, which is like a windows shortcut. You can do this
   with the following command.

# ln -s /usr/src/kernel-source-2.6.8 /usr/src/linux

   now, whenever you do "cd /usr/src/linux" it will be equivalent
   to if you did "cd /usr/src/kernel-source-2.6.8". So now change
   to that directory:

# cd /usr/src/linux

   The kernel uses a configuration file called .config to tell it
   how to be built, what modules to build etc. You could create
   one of these from scratch using one of the tools available,
   but that's tough as you need to figure out what all the settings
   should be. It's a lot easier to use a base debian one and then
   make any modifications to that if you need to. So for now you
   just take the base one from your system that was used to build
   your current kernel:

# cp /boot/config-2.6.8-2-386 .config

   Debian provides some tools for building the kernel easily and
   installing it. So first we get those tools and install them:

# apt-get install kernel-package

   Right, now we're ready to go. Build the kernel by running
   the following:

# make-kpkg kernel_image kernel_headers

   That will take a while, probably more than an hour at least,
   so make a cup of tea now :) Once that's complete there will
   be a couple of Debian packages that will have been built
   and placed in /usr/src. So now you can install those, they
   contain the kernel plus modules etc.

# cd /usr/src
# dpkg -i kernel-headers-2.6.8_10.00.Custom_i386.deb
# dpkg -i kernel-image-2.6.8_10.00.Custom_i386.deb

   Now you can reboot and it should boot your new kernel by
   default, the old kernel should still be selectable from
   the boot loader should you need to get back to it.

This all was done from memory so hope I haven't missed anything.
Let me know if you decide to give it a go and I'll try to help if you have
any problems. As I said though, this is Debian specific, I don't really have
RedHat experience I'm afraid, but I'm sure there must be a similar procedure
for RedHat too. If you're really interested in getting a kernel built on
RedHat then you could ask on the mailing list for someone with RedHat
experience to point you in the right direction.

Having said all this, building a kernel these days is not often necessary
these days. Most moderen distros have many, many drivers already built as
modules that can be then loaded when needed and so it is rare that you need
to build your own kernel except for some highly specialised reason, or to
support some cutting edge device. Though having said that, it is a fun and
interesting thing to do.

> So far I have not found any blow by blow instructions to all the steps 
> required in order for a compilation to work,  eg where do all the 
> source files go etc, with explanations as to why it fails when it 
> does.  Most of the simple driver files obtained from manufacturers ftp 
> sites contain a readme or installation instruction file which is over 
> my head (as yet).  And
> 9 times out of 10 a get some cryptic error message telling me 
> something is incrrect or missing but not what or where etc.
 >
> My current distro is redhat 9 running on an old PIII/1000Mhz which is 
> working very well. As an excerecise I changed the sound card, got the 
> correct driver source files and I am now attempting to get that to 
> work by conpiling the driver and then get the kernel to accept it as
module.

I have to say sound support on Linux is an area that can still be a bit of a
battle. We're still in a bit of a transition period between the old set of
drivers known as OSS (Open Sound System) and the new set of drivers known as
ALSA (Advanced Linux Sound Architecture), and then on top of that there are
all sorts of sound deamons and things.

Anway, with must recent distros ALSA is the standard set of sound drivers
used and ALSA provides an OSS emulation layer that allows apps written to
use the OSS drivers to still work as it gets routed through to ALSA.

Most distros actually include ALSA modules for lots of different sound cards
so it's not usually needed to build one yourself. If you have changed your
sound card then I would try and find out which ALSA module supports that
sound card (you should be able to find that out from the ALSA website:
http://www.alsa-project.org/) and then see if you have a module for that
sound card on your system.
Modules are usually held in the /lib/modules/... hierarchy. You can view the
list of currently loaded modules by running "lsmod"
as root, and insert a module by running "modprobe <modulename>"
where <modulename> is the name of the module, without its file extension,
which is usually .o or .ko.

> Once I get beyond the basics and I understand how to setup up and fix 
> Linux I will use it as my main OS, probably with X.  One tends to be 
> reluctant to ask questions of experts like you because the answers are 
> obious to you guys but since I don't do any coding (as yet) they are not
to me.

Linux and the whole Free Open Source Software community is built from a
spirit of people wanting to help each other. We were all new to Linux at
some point and I certainly don't call myself an expert yet, I suppose I'm
somewhat an intermediate user. I think you'll find most people willing to
help, with a few exceptions here and there as always.

The whole philosophy of the FOSS community is that if we all help each other
then we'll all move forward as a result of that.

So try not to be too intimidated asking for help and advice. Most of us are
friendly and try to be helpful. Things like the new Watford LUG will
hopefully help all of us learn new things.

> Using Redhat 9, which is running kernel v2.6, I will attempt another 
> driver install in the next few days and then post questions with
LUG-Watford.

Good luck with it and let us know if you need any help.

Matt

--
Matt N. Marsh
Email: matt at mattmarsh.net         GoogleTalk: marshmn at gmail.com
   Web: http://www.mattmarsh.net/       Yahoo: marshmn
                                       Jabber: mattmarsh at jabber.org
                                          MSN: matt at mattmarsh.net
                                          ICQ: 250467363
                                          AIM: MattMarshUK




More information about the Watford mailing list