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

Re: Is it possible to simply copy the kernel from one machine to another and use it?




--- anoop aryal <aaryal@foresightint.com> wrote:

> On Friday 07 April 2006 02:39 pm, Yu,Glen [Ontario]
> wrote:
> > Hello everyone,
> >
> > I was wondering if it's possible to copy the
> vmlinuz-x.y.z from one machine
> > to another and have the other machine run properly
> with it.  Here's the
> > scenario:
> >
> > I have 2 systems, both running Debian 3.1 (Sarge),
> and their hardware is a
> > little different from each other.  Suppose my
> machine is running a 2.4.x
> > kernel and the other a 2.6.x kernel, can I simply
> copy the
> > /boot/vmlinuz-2.6.x kernel over to my machine's
> /boot directory, make the
> > appropriate changes to /boot/grub/menu.lst and
> have it work as if I had
> > installed it through apt or dpkg?
> >
> > If anyone has actually tried this and got their
> machines to work, I would
> > like to know what and how you did it.
> 
> i am in the process of doing it to a machine where i
> had to use debootstrap to 
> install the system from an ide drive to a scsi drive
> (long story).
> 
> it is pretty easy to get it to work as long as the
> root filesystem on both 
> machine reside on similar hardware
> (best-case/simplest-case scenario is both 
> machines use IDE  drives to boot). if that's the
> case, copy the kernel, the 
> modules directory (look in /lib/modules/), the
> initrd file and you should be 
> set.
> 
> if the root fs resides on dissimilar hardware (eg.
> one has IDE and another 
> machine has SCSI or even different SCSI cards etc..)
> then you'll need to fix 
> your initrd to load the correct modules (or
> recompile the kernel to inline 
> all needed modules). while this is doable, it is
> slightly more complicated to 
> give a generic howto. google cramfs and initrd and
> you should find some 
> discussion on the subject.
> 
> 
> >
> > Thanks,
> > -Glen
> >
> >
>
----------------------------------------------------------------------
> > Glen Yu | 416-739-4861 | glen.yu@ec.gc.ca
> >
>
----------------------------------------------------------------------
> 
> -- 
> 
> 
> anoop aryal
> aaryal@foresightint.com
> 
> 
> -- 
> To UNSUBSCRIBE, email to
> debian-user-REQUEST@lists.debian.org 
> with a subject of "unsubscribe". Trouble? Contact
> listmaster@lists.debian.org
> 
> 

Bear in mind if you do this, your target machine will
have to have hardware that's at least similar enough
to your source machine's hardware that the correct
drivers will be available, either compiled in as
modules or built into the kernel. If the kernel you
wish to copy is a stock kernel, then you are more
likely to get away with this on dissimilar hardware
than if you built your own -- but then if it's a stock
kernel, just dpkg it on the target machine!!!

Also your target machine will need to have the same or
better CPU to avoid CPU instruction-set assumptions in
the source kernel causing weird effects on the
lower-spec target machine.

If your hardware is wildly different then this is
going to be troublesome.

In general it's better to build your kernel on the
machine you intend to use it on, or at least on a
machine that's so close in spec it might as well be
the same machine. Failing that, use a stock kernel
that's been put together by Debian kernel packaging
folks who Know What They Are Doing (TM). These are
designed to run on a wide variety of hardware.

Assuming you're still set on doing it -- if it's a
stock kernel dpkg the .deb file on your target machine
instead of copying over. If it's not and you still
have the source tree you built the kernel from
originally, then use make-kpkg to build your kernel
image and modules into a .deb file on your source
machine and then dpkg THAT on the target machine. If
you don't still have the sources, you need to copy the
kernel image in /boot, and the modules for this kernel
from /etc, and you probably need to do something to
System.map in /boot as well but I'm not sure what
you'd need to do there. Best of luck...

Mark



Reply to: