[ale] Kernel cross compilation

Michael H. Warfield mhw at WittsEnd.com
Tue Sep 18 14:39:37 EDT 2012


On Tue, 2012-09-18 at 14:35 -0400, Michael H. Warfield wrote:
> On Tue, 2012-09-18 at 17:26 +0000, Boris Borisov wrote:
> > Never done it that is why I'm asking.
> 
> > If you build kernel for MIPS CPU on x86 host but you are using debian
> > 6 installation on host for example and build the same kernel but on
> > different distro ( Ubuntu ) are these two kernel will be indentical ?

> I'm not totally sure I understand the question.

> Are you asking if you build on Debian vs Ubuntu vs Fedora vs CentOS on
> the same arch will the kernels be identical?

> Are you asking if you cross compile a MIPS or ARM kernel on an x88_64
> platform will it be identical to the one built natively on it's target
> arch?  You specifically mention "cross compile" in the subject but that
> is generally taken to mean compiling on one architecture with another
> architecture as a target and that's not what you described above.

Actually, I see you say above that you are cross compiling but I
realized I mistated my question.  Are you varying the processor you are
compiling on or merely varying the distro.  The answer below remains the
same...

> Either way...  The answer depends heavily by what you mean by
> "identical".  Binaries do have timestamps in them and a variety of data
> that may vary.  If you build two "identical" kernels at two different
> times, you will get two different binaries that will not have a matching
> hash.  Just the fact that the binaries will contain the build date and
> time insure that they can not be identical if you were to hash them.  It
> may (WILL) depend on variations and versions of the compilers you use.
> So, two different versions of Ubuntu with two different versions of gcc
> can result in different code which is, most of the time, equivalently
> functional.  There have been times where "compiler bugs" have resulted
> in non-functional kernel builds but the kernel stresses the limits of
> what a compiler can do with volatile data and varieties of interrupts,
> concurency, multiprocessing, and timing.
> 
> If everything, EVERYTHING, is held consistent, then you should get a
> consistent kernel regardless of the distribution you use.  That means
> the same gcc and development tools, libraries, and headers.  Will it be
> "identical"?  Not by my definition of the word identical in that you
> would not be able to run a sha1 / sha256 / sha512 hash on the two and
> get the same numbers.  They may be functionally identical but they will
> not be identical binaries.
> 
> Regards,
> Mike

-- 
Michael H. Warfield (AI4NB) | (770) 985-6132 |  mhw at WittsEnd.com
   /\/\|=mhw=|\/\/          | (678) 463-0932 |  http://www.wittsend.com/mhw/
   NIC whois: MHW9          | An optimist believes we live in the best of all
 PGP Key: 0x674627FF        | possible worlds.  A pessimist is sure of it!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 482 bytes
Desc: This is a digitally signed message part
Url : http://mail.ale.org/pipermail/ale/attachments/20120918/035fbe10/attachment-0001.bin 


More information about the Ale mailing list