building a kernel from a mounted partition

Valdis.Kletnieks at vt.edu Valdis.Kletnieks at vt.edu
Sat May 25 16:42:34 EDT 2013


On Sat, 25 May 2013 22:54:56 +0300, Andy Johnson said:
> Hi,
> It seems to me that you are right. It seems that there is no problem
> with the timezone.
> I checked and indeed the gcc is slightly different in version
> is there a work around here ?
> I mean, I have gcc of ubuntu, and gcc of fedora in /mnt/sda3.

Aha. Found it.

THe problem is that the file arch/x86/kernel/asm-offsets.s contains in it
the data for 'struct utsname' - which includes the GCC version used
to compile it (as seen in 'cat /proc/version'.  However, due to what *else*
is in that file, changing it (as happens when you change the compiler) will
basically force a rebuild of the entire tree.  This is somewhat by design -
there have in the past been gcc compiler versions that had a sufficiently
different ABI to cause problems (for instance, around 2.95 or so, some versions
would pass a structure less than 8 bytes long in registers, while other
versions passed a pointer just like all other structs).  Hilarity results
if you have a mix of .o's compiled with the two versions.

Here's the command line I used to do kernel compiles while working around
a few gcc 4.7 and .8 optimizer bugs (4.6.3 worked):

make CC=/opt/gcc-4.6.3/bin/gcc-46 HOSTCC=/opt/gcc-4.6.3/bin/gcc-46

but of course, this assumes that gcc-46 was built with an installdir of /opt/
gcc-4.6.3.  You'll probably need to do something to add a '-B /opt/whatever'
flag to the gcc call so the main gcc program finds cpp, cc1, and the rest from
"the other system's directory", rather than your running /usr/bin.

At some point, maybe it's easier to just decide "I'll do all my builds under
Fedora, even for kernels I'll use for Ubuntu".

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 865 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130525/0937bd33/attachment.bin 


More information about the Kernelnewbies mailing list