View previous topic :: View next topic |
Author |
Message |
yassen Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/gallery/Funny_Figure/nuckl.gif)
Joined: 26 Mar 2004 Posts: 194
|
Posted: Wed Apr 05, 2006 12:47 pm Post subject: HELP: Cross-compile a kernel? |
|
|
Hi, I need to install a 64-bit (amd64) system on a machine currently running 32bit Gentoo i386.
This is a server that needs to have a minimal downtime... so I would like to pre-build the 64-bit system in a chroot and then reboot. My 32-bit kernel seems to make problems when trying to chroot into 64-bit environment, however (and that should be expected).
Any general suggestions or specific info what do I need / how to cross-compile a 64-bit kernel? If I do this, will it boot with 32-bit userland?
Thanks a LOT to anyone who would respond.
Yassen _________________ :: Adopt an Unanswered Post :: |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
mdeininger Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/66995691148c2c2e2a14e4.png)
Joined: 15 Jun 2005 Posts: 1740 Location: Emerald Isles, observing Dublin's docklands
|
Posted: Wed Apr 05, 2006 12:58 pm Post subject: |
|
|
the qemu-docs claim you could emulate an x86_64-type processor... you should thus be able to create the new system inside a virtual machine. can you modify the partition table or would you have a free partition? you could safely install a 64-bit system with qemu on a second partition while your server is live, then just reboot.
either way, I believe the 64-bit kernel should work with the 32-bit userland, just not the other way 'round, thus you can't really chroot into the 64-bit instance unless your kernel supports it. there's a flag in the 64-bit kernels to enable support for 32-bit executables. if you want to cross-compile the kernel, you should be able to do so using the ARCH= option behind the make commands, like
Code: |
# make menuconfig ARCH=x86_64
# make bzImage ARCH=x86_64
|
still, I can't guarrantee that the userland will work along... _________________ "Confident, lazy, cocky, dead." -- Felix Jongleur, Otherland
( Twitter | Blog | GitHub ) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
yassen Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/gallery/Funny_Figure/nuckl.gif)
Joined: 26 Mar 2004 Posts: 194
|
Posted: Wed Apr 05, 2006 1:06 pm Post subject: |
|
|
mdeininger: thanks a lot!
Yes, I have a spare partition. It seems that I will need
Code: | CROSS_COMPILE=x86_64-unknown-linux- |
besides the
variable. And I still wonder if my current toolchain will allow this cross-compilation...
Hope anyone will be able to shed more light... _________________ :: Adopt an Unanswered Post :: |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
nixnut Bodhisattva
![Bodhisattva Bodhisattva](/images/ranks/rank-bodhisattva.gif)
![](images/avatars/29856733845fd04c0f3d8c.gif)
Joined: 09 Apr 2004 Posts: 10974 Location: the dutch mountains
|
Posted: Wed Apr 05, 2006 6:13 pm Post subject: |
|
|
Moved from Installing Gentoo to Kernel & Hardware. _________________ Please add [solved] to the initial post's subject line if you feel your problem is resolved. Help answer the unanswered
talk is cheap. supply exceeds demand |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
yassen Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/gallery/Funny_Figure/nuckl.gif)
Joined: 26 Mar 2004 Posts: 194
|
Posted: Thu Apr 06, 2006 6:31 am Post subject: |
|
|
Nope, doesn't work:
Code: |
home linux # make bzImage ARCH=x86_64 CROSS_COMPILE=x86_64-unknown-linux-
CC scripts/mod/empty.o
/bin/sh: line 1: x86_64-unknown-linux-gcc: command not found
make[2]: *** [scripts/mod/empty.o] Error 127
make[1]: *** [scripts/mod] Error 2
make: *** [scripts] Error 2
|
Seems like qemu is the only way to go...? _________________ :: Adopt an Unanswered Post :: |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
yassen Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/gallery/Funny_Figure/nuckl.gif)
Joined: 26 Mar 2004 Posts: 194
|
Posted: Thu Apr 06, 2006 7:18 am Post subject: |
|
|
Found a nice recent post which claims to do the job but alas, it did NOT work for me:
Code: |
home linux # make ARCH=x86_64 CROSS_COMPILE=x86_64-pc-linux-gnu-
CC arch/x86_64/kernel/asm-offsets.s
In file included from include/linux/spinlock.h:16,
from include/linux/capability.h:45,
from include/linux/sched.h:7,
from arch/x86_64/kernel/asm-offsets.c:7:
include/asm/processor.h:79: error: array type has incomplete element type
In file included from include/asm/smp.h:18,
from include/linux/smp.h:17,
from include/linux/sched.h:23,
from arch/x86_64/kernel/asm-offsets.c:7:
include/asm/mpspec.h:79: warning: 'packed' attribute ignored for field of type 'unsigned char[5u]'
In file included from include/asm/smp.h:22,
from include/linux/smp.h:17,
from include/linux/sched.h:23,
from arch/x86_64/kernel/asm-offsets.c:7:
include/asm/apic.h: In function 'apic_write_atomic':
include/asm/apic.h:33: warning: value computed is not used
make[1]: *** [arch/x86_64/kernel/asm-offsets.s] Error 1
make: *** [arch/x86_64/kernel/asm-offsets.s] Error 2
|
And while writing this I think I realize why: my kernel is pached for being a UML host and maybe that breaks the compilation. _________________ :: Adopt an Unanswered Post :: |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
mdeininger Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/66995691148c2c2e2a14e4.png)
Joined: 15 Jun 2005 Posts: 1740 Location: Emerald Isles, observing Dublin's docklands
|
Posted: Thu Apr 06, 2006 8:11 am Post subject: |
|
|
hmmm dseng
yeah I ever only tried this with UML, so I'm really not sure about cross-compiling in general. I think the QEMU-approach should really be the easiest -- at least you can play around with that without powering down the server so that should be a big plus
EDIT: unless... could you maybe download an x86_64 kernel for...well... "bootstrapping" of sorts, boot from that, then continue the installation? _________________ "Confident, lazy, cocky, dead." -- Felix Jongleur, Otherland
( Twitter | Blog | GitHub ) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
yassen Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/gallery/Funny_Figure/nuckl.gif)
Joined: 26 Mar 2004 Posts: 194
|
Posted: Thu Apr 06, 2006 1:43 pm Post subject: |
|
|
mdeininger: thanks again for caring!
I have a double problem (ohh stupid me!) -- the working sever is actually the UML instance running inside the host where I am trying these things. So I will break it if I replace the host kernel... (unless there are patches for UML that allow 64bit kernel to host an UML instance..) _________________ :: Adopt an Unanswered Post :: |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
mdeininger Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/66995691148c2c2e2a14e4.png)
Joined: 15 Jun 2005 Posts: 1740 Location: Emerald Isles, observing Dublin's docklands
|
Posted: Thu Apr 06, 2006 7:02 pm Post subject: |
|
|
oh!
lol, okay, that's gettin tricky =)
well, I don't think you need to patch anything on the host-kernel to run a UML kernel, do you?
that is... you do have direct access to the host, aye? well, I'm not quite sure if there is something like a 64-bit UML, so you really could get into jeopardy if you tried to create one... might depend on the toolchain you use to compile the kernel...
is there any way you can move the complete UML to a different host? -- like, freezing it, then copying things over while it's live, as soon as the other is up, running and working, power the original down and let the new one take over? this would allow you to just do a regular re-install, and UMLs should be "easier" to relocate... _________________ "Confident, lazy, cocky, dead." -- Felix Jongleur, Otherland
( Twitter | Blog | GitHub ) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
yassen Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/gallery/Funny_Figure/nuckl.gif)
Joined: 26 Mar 2004 Posts: 194
|
Posted: Thu Apr 06, 2006 7:44 pm Post subject: |
|
|
mdeininger wrote: | well, I don't think you need to patch anything on the host-kernel to run a UML kernel, do you?
|
There are patches like skas (which I've applied to my host kernel, that was end of 2004) that make UML work better.
Quote: | that is... you do have direct access to the host, aye? |
Sure, I manage the host machine (and the UMLs as well).
Quote: | is there any way you can move the complete UML to a different host? -- like, freezing it, then copying things over while it's live, as soon as the other is up, running and working, power the original down and let the new one take over? |
This was exactly my original plan, but the hosting company wants a full setup fee for running a second machine, even if we give up the old one later... so I went on trying to rebuild the OS onsite (used to think that it should be fairly easy... but is NOT
Thanks for helping me think...! Still need to find out a solution. My current plan: I will migrate all services of the UML that are still in use to another machine, then switch over DNS names to point to that machine, and take the UML down. The rest is (almost) clear (I hope...)
Cheers!
yassen _________________ :: Adopt an Unanswered Post :: |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|