FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 01-22-2010, 12:10 AM
Praseen Preman
 
Default Kernel modification environment

Hi guys,
**************** I currently have Ubuntu 8.04 LTS-Hardy running on my machine. I am learning about linux device drivers and hence I have to compile and run the kernel after modifications, also I have to insert my own custom built modules. Please suggest how to create an environment that does not mess up with existing running setup, when I compile and boot into my custom built kernel.The issue here probably is that for all my custom compiled kernels and the currently stable kernel, the filesystem is the same and as a result when the custom kernel boots up, it probably screws up my driver nodes in the /dev directory. I would like to keep the filesystem for the custom compiled kernels seperate from the stable kernel installed from the CD. Please suggest, how to proceed.



Thanks and Regards,
Praseen

PS: I have already lost my current stable installation of the kernel after I booted into my custom compiled kernel
 
Old 01-22-2010, 12:38 AM
Stephen Powell
 
Default Kernel modification environment

On 2010-01-21 at 20:10:49 -0500, Praseen Preman wrote:
> I currently have Ubuntu 8.04 LTS-Hardy running on my
> machine. I am learning about linux device drivers and hence I have to
> compile and run the kernel after modifications, also I have to insert my own
> custom built modules. Please suggest how to create an environment that does
> not mess up with existing running setup, when I compile and boot into my
> custom built kernel.The issue here probably is that for all my custom
> compiled kernels and the currently stable kernel, the filesystem is the same
> and as a result when the custom kernel boots up, it probably screws up my
> driver nodes in the /dev directory. I would like to keep the filesystem for
> the custom compiled kernels seperate from the stable kernel installed from
> the CD. Please suggest, how to proceed.
>
> Thanks and Regards,
> Praseen
>
> PS: I have already lost my current stable installation of the kernel after I
> booted into my custom compiled kernel

Forgive me for stating the obvious, but I must start with the disclaimer that
this forum provides user-to-user assistance for Debian, not Ubuntu. While
Ubuntu is Debian-based, it is not Debian. I have no experience with Ubuntu
proper, and advice that I may give based on my Debian experience may not work
with Ubuntu. As always, use at your own risk.

Second, I'm not sure what you mean by "the filesystem is the same". Do you
mean that the custom kernels and the stock kernel are sharing each other's
modules (i.e. /lib/modules/...) and are therefore interfering with each other?
That I can understand and recommend a fix for, at least under Debian.
But from your description, it doesn't sound like it. You seem to be
concerned that the device nodes in /dev are getting messed up somehow.
In modern kernels, most of the device nodes are created dynamically by udev
anyway. I guess I'm really not sure what you're asking. You can control,
in the boot loader (lilo, grub, etc.) what partition, or more rigorously,
what file system residing on a partition, gets mounted as /, but that may
not be what you're asking either. For a general tutorial on building
custom kernels in Debian, I can point you to
http://www.wowway.com/~zlinuxman/Kernel.htm.
How well that will adapt to Ubuntu, I don't know.
I really wish I understood your question better.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-22-2010, 02:26 PM
Stephen Powell
 
Default Kernel modification environment

On 2010-01-22 at 07:54:05 -0500, Praseen Preman wrote:
> Hi Stephen,
> Thanks a lot for the reply. I put my query in the debian
> distributions list since internally Ubuntu is a debian based distribution.
> Well I had installed a version of Ubuntu Hardy 8.04 LTS from an installation
> CD. The version of the linux kernel in the package was 2.6.24-26 and I was
> not able to get the source for the above mentioned kernel version. In the
> kernel source tree I saw versions with only 4 sub classes like 2.6.24.6 and
> 2.6.24.7. Later on I checked out the version of the installed kernel in the
> /boot/config and found out that it was 2.6.24.6. So I compiled the source
> for 2.6.24.6 on my 2.6.24-26 kernel and later installed it using the dpkg
> command. Later I did "sudo update-grub" to modify the menu.lst file so that
> I can boot into the 2.6.24.6 kernel. Now since we had seen that the
> 2.6.24-26 kernel was actually the 2.6.24.6 version kernel, I tried to build
> a "hello world" module in the 2.6.24.6 source and insert it into the
> 2.6.24-26 kernel which was currently running. The insmod and the modprobe
> commands failed. The insmod failed with a struct_module version mismatch
> error.
>
> So I rebooted into the 2.6.24.6 kernel from GRUB and I noticed that my
> devices like NVIDIA which worked on the 2.6.24-26 kernel refused to work on
> the new kernel.After a few days, these devices failed to work even in my
> first 2.6.24-26 kernel too. I infer that this issue could be as a result of
> the fact that both my 2.6.24.6 and 2.6.24-26 grub entries use the same
> filesystem. Please let me know how to solve such an issue. Let me know how
> to use a different filesystem for a different kernel version so that such
> conflicts can be avoided.
>
> Thanks a ton in advance,
> Praseen
>
> On 22 January 2010 07:08, Stephen Powell <zlinuxman@wowway.com> wrote:
>
> > On 2010-01-21 at 20:10:49 -0500, Praseen Preman wrote:
> > I currently have Ubuntu 8.04 LTS-Hardy running on my
> > machine. I am learning about linux device drivers and hence I have to
> > compile and run the kernel after modifications, also I have to insert my
> > own
> > custom built modules. Please suggest how to create an environment that
> > does
> > not mess up with existing running setup, when I compile and boot into my
> > custom built kernel.The issue here probably is that for all my custom
> > compiled kernels and the currently stable kernel, the filesystem is the
> > same
> > and as a result when the custom kernel boots up, it probably screws up my
> > driver nodes in the /dev directory. I would like to keep the filesystem
> > for
> > the custom compiled kernels seperate from the stable kernel installed
> > from
> > the CD. Please suggest, how to proceed.
> >
> > Thanks and Regards,
> > Praseen
> >
> > PS: I have already lost my current stable installation of the kernel
> > after I
> > booted into my custom compiled kernel
>
> Forgive me for stating the obvious, but I must start with the disclaimer
> that
> this forum provides user-to-user assistance for Debian, not Ubuntu. While
> Ubuntu is Debian-based, it is not Debian. I have no experience with Ubuntu
> proper, and advice that I may give based on my Debian experience may not
> work
> with Ubuntu. As always, use at your own risk.
>
> Second, I'm not sure what you mean by "the filesystem is the same". Do you
> mean that the custom kernels and the stock kernel are sharing each other's
> modules (i.e. /lib/modules/...) and are therefore interfering with each
> other?
> That I can understand and recommend a fix for, at least under Debian.
> But from your description, it doesn't sound like it. You seem to be
> concerned that the device nodes in /dev are getting messed up somehow.
> In modern kernels, most of the device nodes are created dynamically by udev
> anyway. I guess I'm really not sure what you're asking. You can control,
> in the boot loader (lilo, grub, etc.) what partition, or more rigorously,
> what file system residing on a partition, gets mounted as /, but that may
> not be what you're asking either. For a general tutorial on building
> custom kernels in Debian, I can point you to
> http://www.wowway.com/~zlinuxman/Kernel.htm<http://www.wowway.com/%7Ezlinuxman/Kernel.htm>
> .
> How well that will adapt to Ubuntu, I don't know.
> I really wish I understood your question better.
>

A few logistical items first. (1) Please do not "top post". It is confusing.
Instead, use the "usenet" style of in-line quoting. (2) Please reply to the
list, not to the person from whom you expect to receive help. See the mailing
list policy at http://www.debian.org/MailingLists/index.html#codeofconduct.
Strictly speaking, I should not be quoting you here, since it was received
in a private e-mail; but I'm assuming that you intended to reply to the list
and replied to me alone by mistake. (And there is nothing of a personal or
confidential nature in it.) I normally quote only the portions of the
original post to give my replies a context; but since your e-mail never
made it to the list, I quoted the entire thing.

OK, that said, I will try to address your questions.

> Now since we had seen that the
> 2.6.24-26 kernel was actually the 2.6.24.6 version kernel, I tried to build
> a "hello world" module in the 2.6.24.6 source and insert it into the
> 2.6.24-26 kernel which was currently running. The insmod and the modprobe
> commands failed. The insmod failed with a struct_module version mismatch
> error.

You didn't provide any details of how you built or installed the custom
kernel, but there are two issues here. (1) CONFIG_MODVERSIONS. Here is
the help file for kernel building for this option:

──────────────── ──────────────── ──────────────── ──────────────── ───────────
┌─────────────── ─────── Module versioning support ──────────────── ──────┐
│ CONFIG_MODVERSIONS: │
│ │
│ Usually, you have to use modules compiled with your kernel. │
│ Saying Y here makes it sometimes possible to use modules │
│ compiled for different kernels, by adding enough information │
│ to the modules to (hopefully) spot any changes which would │
│ make them incompatible with the kernel you are running. If │
│ unsure, say N. │
│ │
│ Symbol: MODVERSIONS [=y] │
│ Prompt: Module versioning support │
│ Defined at init/Kconfig:872 │
│ Depends on: MODULES │
│ Location: │
│ -> Enable loadable module support (MODULES [=y]) │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
├─────────────── ──────────────── ──────────────── ────────────────(1 00%)──┤
│ < Exit > │
└─────────────── ──────────────── ──────────────── ──────────────── ───────┘
──────────────── ──────────────── ──────────────── ──────────────── ───────────

Your stock kernel may have this option off, which means that modules not
compiled with the stock kernel probably won't work. (2) Modules reside in
a directory called /lib/modules/xxx, where xxx is the kernel version, and
its subdirectories. If you issued, for example,

modprobe xyz

and got the response

FATAL: Module xyz not found

then there was something different about the kernel versions between your
custom kernel and the stock kernel and the modules went into different
directories. If, on the other hand, you got version mismatch errors,
then I would assume that one of two things happened: (a) you built your
custom kernel with the exact same kernel version as the stock kernel,
in which case your custom modules clobbered the stock ones, or (b)
you copied your custom module into the stock directory. From reading
the man pages, it doesn't look like either modprobe or insmod support
specifying a path name with the module, but I haven't tried that.

> So I rebooted into the 2.6.24.6 kernel from GRUB and I noticed that my
> devices like NVIDIA which worked on the 2.6.24-26 kernel refused to work on
> the new kernel.

In my experience, NVIDIA is a non-free video driver for the X server,
not a kernel module. That is something totally different. It sounds to
me like you may have clobbered your stock kernel module directories with your
custom kernel modules, and that is highly not recommended! I'd reinstall from
scratch if I were you, formatting the disk in the process. Obviously,
copy files that you need to keep somewhere else first.

The web site to which
I referred you earlier gives advice on custom kernel building for
Debian Lenny, which is based on a 2.6.26 kernel. I don't know how well
it will work for Ubuntu. But the key to producing multiple executable
kernels from the same kernel source is the --append-to-version flag
of make-kpkg which is discussed on that page. Again, this is a Debian
forum, not an Ubuntu forum. I have no experience with Ubuntu. Good luck!


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-28-2010, 09:44 PM
Andrew Malcolmson
 
Default Kernel modification environment

On Thu, Jan 21, 2010 at 8:10 PM, Praseen Preman
<praseen.preman@gmail.com> wrote:
> Hi guys,
> **************** I currently have Ubuntu 8.04 LTS-Hardy running on my
> machine. I am learning about linux device drivers and hence I have to
> compile and run the kernel after modifications, also I have to insert my own
> custom built modules. Please suggest how to create an environment that does
> not mess up with existing running setup, when I compile and boot into my
> custom built kernel ...

Once you get a working system back, if necessary by reinstalling as
Stephen suggested, I suggest you look into virtualization software.
Virtual installs are perfect for experimenting and learning without
risk to the 'host' o/s (i.e. actual Linux install running on your
machine). KVM is included in the Linux kernel and I believe is the
preferred choice for Ubuntu. VirtualBox is popular and comes with a
nice GUI for novices.


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

Thread Tools




All times are GMT. The time now is 09:51 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org