Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Howto create a crosscompiler/64bits kernel on 32bit install.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
okapi
n00b
n00b


Joined: 11 Feb 2003
Posts: 42
Location: Bromont, Canada

PostPosted: Sun Dec 04, 2005 10:50 pm    Post subject: Howto create a crosscompiler/64bits kernel on 32bit install. Reply with quote

Here's a little howto on how to create a crosscompiler and a 64bits kernel on a 32bit install running on amd64.
Code:
emerge sys-devel/crossdev

Build your crosscompiler.
Code:
crossdev -t x86_64-pc-linux-gnu

Clean up your kernel source tree. (This step is very important because 32bits configs are different than 64bits)
Code:
make ARCH=x86_64 CROSS_COMPILE=x86_64-pc-linux-gnu- mrproper

Configure your kernel.
Code:
make ARCH=x86_64 CROSS_COMPILE=x86_64-pc-linux-gnu- menuconfig

Note:

It is a good idea to use the option General Setup ---> Local version - append to kernel release with somthing like -x86_64 if you dont want to overwrite you running kernel and modules.

Don't forget to set Executable file formats / Emulations --->IA32 Emulation or be a fool!


Compile your kernel.
Code:
make ARCH=x86_64 CROSS_COMPILE=x86_64-pc-linux-gnu-

Code:
make ARCH=x86_64 CROSS_COMPILE=x86_64-pc-linux-gnu- modules_install

Code:
make ARCH=x86_64 CROSS_COMPILE=x86_64-pc-linux-gnu- install


Create a new Grub or Lilo entry.

And Voila! You now have a 64bits Kernel and a 64bits crosscompiler.
_________________
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS d++(-) s: a40 C+++>++++$ ULS++++$ P- L+++ E--- W+++ N+ o++ K? w---
!O M- V-- PS+ PE- Y+(++) PGP++>+++ t+ 5 X+++ R tv b+ DI++ D G e++ h--
r++ y+++
------END GEEK CODE BLOCK------
Back to top
View user's profile Send private message
satanskin
Guru
Guru


Joined: 25 Apr 2005
Posts: 353

PostPosted: Wed Dec 07, 2005 7:49 am    Post subject: Reply with quote

Just to make things extremely clear, is this for running on a 64-bit processor or a 32-bit processor to compile 64-bit binaries?
Back to top
View user's profile Send private message
okapi
n00b
n00b


Joined: 11 Feb 2003
Posts: 42
Location: Bromont, Canada

PostPosted: Wed Dec 07, 2005 12:22 pm    Post subject: Reply with quote

satanskin wrote:
Just to make things extremely clear, is this for running on a 64-bit processor or a 32-bit processor to compile 64-bit binaries?


I recently changed my MoBo and Cpu. I have a Athlon64 running in 32bit on my old athlon-xp install.
_________________
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS d++(-) s: a40 C+++>++++$ ULS++++$ P- L+++ E--- W+++ N+ o++ K? w---
!O M- V-- PS+ PE- Y+(++) PGP++>+++ t+ 5 X+++ R tv b+ DI++ D G e++ h--
r++ y+++
------END GEEK CODE BLOCK------
Back to top
View user's profile Send private message
Skotlex
Guru
Guru


Joined: 13 Mar 2004
Posts: 306

PostPosted: Mon Apr 04, 2011 8:16 pm    Post subject: Reply with quote

*brushes dust off topic* Ahem, it's been five years, but this guide is exactly what I was looking for. I've been searching for a while on a way to test out a 64-bit kernel on an otherwise pure 32-bit system.

I hope the guide still works (I will try it in a while), but I have two questions that should be addressed for those who want to follow this:

  • Will using modules work as normally, or must this kernel be static and have all modules compiled in?
  • What about nvidia graphic cards users? Is there some guide/right method of compilation, or you shouldn't even try? Or is nouveau the only way?


EDIT: So here are my findings:

1. If you want a crosscompiler ONLY for building your 64bit kernel, you can change the command:
Code:
crossdev -t x86_64-pc-linux-gnu

for
Code:
crossdev -t x86_64-pc-linux-gnu -s1

As that will only give you a GCC capable of producing 64bit executables.

2. Current kernels have a 'Cross-compiler tool prefix' (CONFIG_CROSS_COMPILE) which is a good way to store the CROSS_COMPILE variable. By setting CONFIG_CROSS_COMPILE=x86_64-pc-linux-gnu-, you can change the compilation commands from:
Code:
make ARCH=x86_64 CROSS_COMPILE=x86_64-pc-linux-gnu-

to
Code:
make ARCH=x86_64


3. nvidia-drivers seems to be a hassle to compile, because the X11 driver should be compiled in 32bit while the kernel module in 64bit :/ I just dumped that and changed to Nouveau, that was way easier.

All in all, this guide still works.
Back to top
View user's profile Send private message
alex6
Apprentice
Apprentice


Joined: 18 Jul 2011
Posts: 172

PostPosted: Tue Jul 09, 2013 10:10 am    Post subject: Reply with quote

This guide still work 10 years after but I'm surprised in all this time there is still no workaround for nvidia !!!!
Back to top
View user's profile Send private message
fberger
Tux's lil' helper
Tux's lil' helper


Joined: 04 Dec 2006
Posts: 89
Location: Germany

PostPosted: Thu Jun 08, 2017 12:00 pm    Post subject: Reply with quote

The recipe is still working in 2017. Thanks.
Code:
$ uname -a
Linux - 4.10.11-gentoo-x86_64 #1 SMP PREEMPT - x86_64 Intel(R) Core(TM) i5 CPU M 520 @ 2.40GHz GenuineIntel GNU/Linux
Back to top
View user's profile Send private message
kosik
n00b
n00b


Joined: 09 Nov 2007
Posts: 20
Location: 127.0.0.1

PostPosted: Tue Aug 08, 2017 8:29 pm    Post subject: Re: Howto create a crosscompiler/64bits kernel on 32bit inst Reply with quote

okapi wrote:
Here's a little howto on how to create a crosscompiler and a 64bits kernel on a 32bit install running on amd64.
Code:
emerge sys-devel/crossdev

Build your crosscompiler.
Code:
crossdev -t x86_64-pc-linux-gnu

Clean up your kernel source tree. (This step is very important because 32bits configs are different than 64bits)
Code:
make ARCH=x86_64 CROSS_COMPILE=x86_64-pc-linux-gnu- mrproper

Configure your kernel.
Code:
make ARCH=x86_64 CROSS_COMPILE=x86_64-pc-linux-gnu- menuconfig

Note:

It is a good idea to use the option General Setup ---> Local version - append to kernel release with somthing like -x86_64 if you dont want to overwrite you running kernel and modules.

Don't forget to set Executable file formats / Emulations --->IA32 Emulation or be a fool!


Compile your kernel.
Code:
make ARCH=x86_64 CROSS_COMPILE=x86_64-pc-linux-gnu-

Code:
make ARCH=x86_64 CROSS_COMPILE=x86_64-pc-linux-gnu- modules_install

Code:
make ARCH=x86_64 CROSS_COMPILE=x86_64-pc-linux-gnu- install


Create a new Grub or Lilo entry.

And Voila! You now have a 64bits Kernel and a 64bits crosscompiler.


How many headaches has this 12 years old post solved? Many, I guess! After working around the gold linker and some specialities I have in make.conf it worked like a charme in 2017.

Thanks, dude. I owe you a beer...
Back to top
View user's profile Send private message
kosik
n00b
n00b


Joined: 09 Nov 2007
Posts: 20
Location: 127.0.0.1

PostPosted: Tue Aug 08, 2017 8:31 pm    Post subject: Reply with quote

fberger wrote:
The recipe is still working in 2017. Thanks.
Code:
$ uname -a
Linux - 4.10.11-gentoo-x86_64 #1 SMP PREEMPT - x86_64 Intel(R) Core(TM) i5 CPU M 520 @ 2.40GHz GenuineIntel GNU/Linux


Whoa, I didn't read through the whole thread... but this, Sir, is awesome! ...see my post above.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
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