Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Moving a Gentoo install from AMD64 to Intel Core 2 Duo
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on AMD64
View previous topic :: View next topic  
Author Message
Dakeyras
n00b
n00b


Joined: 31 May 2007
Posts: 17

PostPosted: Mon Jul 23, 2007 6:14 pm    Post subject: Moving a Gentoo install from AMD64 to Intel Core 2 Duo Reply with quote

Hello everyone,

I'll be upgrading my faithful Athlon64 3500+ to a Core 2 Duo CPU in about a month and I'm willing to keep my system bootable on both architecture while transitionning. First off, is this even feasible ? My current build settings are :

Code:
CHOST="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -msse3 -march=athlon64"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j2"

Will a system built from the ground up with those switches boot on a Core 2 Duo chip without changing anything ? I don't think it will because of the -march flag, but I'm asking just in case.

I thought about making the switch that way :

1. re-emerge the whole system (and kernel) with CFLAGS compatible on both platforms while still running on AMD
2. switch CPU
3. re-emerge the whole system (and kernel) with CFLAGS tuned for Intel's architecture

The crucial step is of course the first one. From what I could gather, -march=i686 would seem to do what I want.

As an added question, I have a few unmasked ~amd64 packages on my system, will those cause problem ? I know the -march setting and the keywords are two different things, but I wouldn't want to break anything.

Thanks in advance for the help.
Back to top
View user's profile Send private message
Sadako
Advocate
Advocate


Joined: 05 Aug 2004
Posts: 3792
Location: sleeping in the bathtub

PostPosted: Mon Jul 23, 2007 6:42 pm    Post subject: Reply with quote

march=athlon64 will include 3dnow extensions, which aren't available on intel.

Unfortunately, there doesn't appear to be a simple "march=x86_64".

What you could try is either changing the march to something which only includes the extensions available on both cpus (nocona seems like a good bet, as your athlon64 seems to supports sse3/pni),
or adding "-mno-3dnow" to your cflags, however I really don't know if either will work right, and both would require rebuilding everything.

The problem with march=i686 is you'll completely lose the 64-bit extension support, so I don't think it'll be of any use to you.

The ~amd64 won't be an issue.

My advice?
Change your march to nocona, then (re)compile something and see if it runs or returns "illegal instruction".

mplayer would be perfect for this, however it is the only package I've come across that actually enables support for your cpu regardless of what you have in make.conf.
_________________
"You have to invite me in"
Back to top
View user's profile Send private message
Dakeyras
n00b
n00b


Joined: 31 May 2007
Posts: 17

PostPosted: Mon Jul 23, 2007 7:30 pm    Post subject: Reply with quote

Thanks for the quick reply (I didn't even have the time to finish eating :) ).

Hopeless wrote:
The problem with march=i686 is you'll completely lose the 64-bit extension support, so I don't think it'll be of any use to you.

My technical knowledge being limited, what would be the implications of this ? Would that make the system unusable at all except for very basic tasks ?

Hopeless wrote:
Change your march to nocona, then (re)compile something and see if it runs or returns "illegal instruction".

mplayer would be perfect for this, however it is the only package I've come across that actually enables support for your cpu regardless of what you have in make.conf.

Even without the runtime flag "cpudetection" ?
Anyway, I think I can try this if it involves just a few "test" packages. I have other candidates besides mplayer. From my "world" file :

Code:
net-www/apache
media-gfx/feh
media-sound/mpg123
media-sound/audacious
media-video/vlc
dev-lang/php
net-analyzer/nmap
net-im/pidgin
net-irc/xchat
app-arch/unrar
app-text/epdfview
app-editors/vim
app-emulation/wine
www-client/elinks

See any useful candidate ?
Back to top
View user's profile Send private message
Sadako
Advocate
Advocate


Joined: 05 Aug 2004
Posts: 3792
Location: sleeping in the bathtub

PostPosted: Mon Jul 23, 2007 9:52 pm    Post subject: Reply with quote

With i686, you would basically be running a 32 bit system.

I'm really not sure what it would involve, there might be some way to make it work, but I think it'd be kinda messy, I'd say nocona has more potential.

Also, as nocona is probably what you'd be using after switching cpu, it makes a lot more sense if it works.

xchat has the mmx USE flag, so out of what you posted I think that would be a useful test, and I'd try vlc too.
_________________
"You have to invite me in"
Back to top
View user's profile Send private message
loftwyr
l33t
l33t


Joined: 29 Dec 2004
Posts: 970
Location: 43°38'23.62"N 79°27'8.60"W

PostPosted: Tue Jul 24, 2007 12:36 am    Post subject: Reply with quote

You can't compile march=i686, gcc wouldn't accept it on your arch. What you will need to do is rebuild your kernel with processor type set to generic x86-64 and then reboot with your new hardware. Once you've rebooted, set your march to nocona and
Code:
 emerge -e system && emerge -e world


That should work, however, it's all theory until you do it
_________________
My emerge --info
Have you run revdep-rebuild lately? It's in gentoolkit and it's worth a shot if things don't work well.
Celebrating 5 years of Gentoo-ing.
Back to top
View user's profile Send private message
Sadako
Advocate
Advocate


Joined: 05 Aug 2004
Posts: 3792
Location: sleeping in the bathtub

PostPosted: Tue Jul 24, 2007 12:46 am    Post subject: Reply with quote

loftwyr wrote:
What you will need to do is rebuild your kernel with processor type set to generic x86-64 and then reboot with your new hardware. Once you've rebooted, set your march to nocona and
Code:
 emerge -e system && emerge -e world
Shit, I had completely forgotten about the kernel.

However, the problem with what you just posted is that he would be booting into system compiled for an athlon64 on a machine with a core 2 cpu.

As there doesn't seem to be anything in nocona that his athlon64 doesn't support, would it not make more sense to rebuild the entire system with -march=nocona while still using the amd hardware?
_________________
"You have to invite me in"
Back to top
View user's profile Send private message
Dakeyras
n00b
n00b


Joined: 31 May 2007
Posts: 17

PostPosted: Tue Jul 24, 2007 6:44 am    Post subject: Reply with quote

A quick update: I've made a few tests yesterday with '-march=nocona', re-emerging a few applications (audacious, vlc, pidgin) and it seemd to work OK. I've then launched an 'emerge -e world' during the night. I'm now at 543 of 669 packages built, and the system is rolling OK for now. Portage just rebuilt apache2 and PHP, I ran some tests on those two as well, it's going good.

I also had completely forgotten to check my USE flag: it has both '3dnow' and '3dnowext'. However, only two applications on my system use any of those, mplayer and mpg123, so I can probably continue for now and tweak those two later.

One quick question: I've only re-emerged world, will I also have to re-emerge system as well ? Even though it's recommended to do system before world, I hope going the other way around won't screw things up too badly.

Thanks again for the help.
Back to top
View user's profile Send private message
Dakeyras
n00b
n00b


Joined: 31 May 2007
Posts: 17

PostPosted: Thu Jul 26, 2007 9:25 am    Post subject: Reply with quote

After emerging system with the new CFLAGS and rebuilding the kernel for a generic x86-64 architecture, all seems to be functionning smoothly. I'll probably bump this thread back if I encounter some malfunctions, or when I change my hardware.

Later.
Back to top
View user's profile Send private message
Akkara
Bodhisattva
Bodhisattva


Joined: 28 Mar 2006
Posts: 6702
Location: &akkara

PostPosted: Thu Jul 26, 2007 1:19 pm    Post subject: Reply with quote

Quote:
I've only re-emerged world, will I also have to re-emerge system as well ?


My guess is you are very likely OK anyway.

I had occasion to install gentoo on a core2 machine a few months ago. The way I had done it was to bring the system's hard drive home and copy my amd64 system onto it, change CFLAGS and some other configs to match the hardware, built a kernel, brought the drive back to the core2 machine, booted it, emerge the toolchain, and emerge world.

There was the risk that there might have been unsupported opcodes that wouldn't run. But I figured, if there are any, they would probably be in the multimedia stuff, which wouldn't be run before a rebuilt had happened anyway. As far as I know that system is still working fine - no news is good news? :)
Back to top
View user's profile Send private message
norbee
n00b
n00b


Joined: 24 May 2007
Posts: 3

PostPosted: Sat Aug 25, 2007 9:37 pm    Post subject: Reply with quote

Hello Dakeyras,

Did you changed the hardware? Was everything working for you as it should? I will do the same in few weeks...

Thanks.

n.
Back to top
View user's profile Send private message
piwacet
Guru
Guru


Joined: 30 Dec 2004
Posts: 486

PostPosted: Sun Aug 26, 2007 10:11 pm    Post subject: Reply with quote

Just one other thought on the kernel issue... you could compile a separate kernel with a .config appropriate for core2duo, and keep your current working kernel around, and if need be, you could use grub to select the core2duo kernel when you make the switch.

Maybe you won't need to do this as it sounds like you've made a generic 'x86_64' choice in your kernel config, but just thought.
Back to top
View user's profile Send private message
Alakhai
Apprentice
Apprentice


Joined: 16 Oct 2003
Posts: 151

PostPosted: Tue Sep 04, 2007 7:39 am    Post subject: Reply with quote

Maybe the safest way should be to set
Code:

CFLAGS="-O2 -pipe -mtune=generic"
And
emerge -e world

and then when u change processor
Code:

CFLAGS="-O2 -pipe -mtune=nocona"
emerge -e world

i have a C2D
and those are my flags
Code:

CFLAGS="-O2 -pipe -mtune=nocona -fomit-frame-pointer -funroll-loops"

it is stable for me

btw i repeat this is the longest step but the safest
_________________
Gentoo Linux 64Bit User
Back to top
View user's profile Send private message
Belliash
Advocate
Advocate


Joined: 24 Nov 2004
Posts: 2503
Location: Wroclaw, Poland

PostPosted: Thu Sep 06, 2007 7:30 am    Post subject: Reply with quote

Hopeless wrote:
Unfortunately, there doesn't appear to be a simple "march=x86_64".


8O


Are You joking?

:idea: -march=x86-64 works well :!:
_________________
Asio Software Technologies
Belliash IT Weblog
Back to top
View user's profile Send private message
Sadako
Advocate
Advocate


Joined: 05 Aug 2004
Posts: 3792
Location: sleeping in the bathtub

PostPosted: Thu Sep 06, 2007 3:26 pm    Post subject: Reply with quote

Morpheouss wrote:
Hopeless wrote:
Unfortunately, there doesn't appear to be a simple "march=x86_64".


8O


Are You joking?

:idea: -march=x86-64 works well :!:

No I wasn't joking, I couldn't find any details on this.

I really thought if such a -march option was supported it would be listed here, which it is not.

Do you know what -march=x86-64 implies, ie does include any support for mmx or sse instruction sets which are common to both amd and intel 64-bit cpus?
_________________
"You have to invite me in"
Back to top
View user's profile Send private message
Belliash
Advocate
Advocate


Joined: 24 Nov 2004
Posts: 2503
Location: Wroclaw, Poland

PostPosted: Thu Sep 13, 2007 5:24 pm    Post subject: Reply with quote

Hopeless wrote:
Morpheouss wrote:
Hopeless wrote:
Unfortunately, there doesn't appear to be a simple "march=x86_64".


8O


Are You joking?

:idea: -march=x86-64 works well :!:

No I wasn't joking, I couldn't find any details on this.

I really thought if such a -march option was supported it would be listed here, which it is not.

Do you know what -march=x86-64 implies, ie does include any support for mmx or sse instruction sets which are common to both amd and intel 64-bit cpus?


It's -march=k8 but without 3DNow
_________________
Asio Software Technologies
Belliash IT Weblog
Back to top
View user's profile Send private message
BlackSash
n00b
n00b


Joined: 13 Nov 2004
Posts: 17
Location: The Netherlands

PostPosted: Thu Jan 08, 2009 3:51 pm    Post subject: Running into this now Reply with quote

My apologies for bumping this thread, but I have this same issue and I have an additional question:

I'm now in the process of recompiling my system for generic x86-64 (via the march CFLAG), however I'd like to know if my CHOST would need to change from x86_64-pc-linux-gnu or that I can keep it as is. I've been running the same hardware for 3 years and am bout to switch, so I haven't had to touch this for a long time.

Also there is the problem, that I have not seen mentioned anywhere, of profiles. Back in the day my system was installed from a 2007.0 amd64 installcd. This has set all my available profiles to amd64 variants (enabling the 3dnow flags, for one thing). How do I switch these profiles to either generic x86-64 (if they exist) or regular x86 otherwise.

For the continued health of my installation i think it would be prudent to get everything working nicely, and since I need to upgrade to 2008 anyway, i'd like to switch the profiles around to support my new system as well.

Any tip on this would be appreciated, and if any information is required, ask away.
Back to top
View user's profile Send private message
loftwyr
l33t
l33t


Joined: 29 Dec 2004
Posts: 970
Location: 43°38'23.62"N 79°27'8.60"W

PostPosted: Thu Jan 08, 2009 3:57 pm    Post subject: Reply with quote

Just leave your CHOST as is, the X86_64 is the generic name for all 64bit processors.
_________________
My emerge --info
Have you run revdep-rebuild lately? It's in gentoolkit and it's worth a shot if things don't work well.
Celebrating 5 years of Gentoo-ing.
Back to top
View user's profile Send private message
zyko
l33t
l33t


Joined: 01 Jun 2008
Posts: 620
Location: Munich, Germany

PostPosted: Thu Jan 08, 2009 10:25 pm    Post subject: Reply with quote

Instead of recompiling everything twice, you could just boot the new hardware with a live-CD, chroot into your Gentoo and recompile it (once).
Back to top
View user's profile Send private message
kabage
Guru
Guru


Joined: 31 Jan 2005
Posts: 340

PostPosted: Mon Feb 23, 2009 2:28 am    Post subject: I did this Reply with quote

with a amd3400 to q6600 quad core. Compiled the kernel to include all the drivers for
my new mobo, especially ethernet. (of course what did nt work) ethernet
was the only problem ,

when i pulled my hd from old to new computer, udev still set up my old ethernet
making my new one eth1 instead of eth0. Of course it took me awhile to find that.

I never had a problem running anything. I guessing I had my march set to nocona,
since that is what is at the moment, I dont remember ever changing it on my new computer.
_________________
The solutions are easy. Its finding them that is hard.
Back to top
View user's profile Send private message
minor_prophets
Apprentice
Apprentice


Joined: 07 Oct 2007
Posts: 281

PostPosted: Mon Feb 23, 2009 3:16 am    Post subject: Reply with quote

Also, someone correct me here if I'm wrong, but any system with gcc-4.3.x and up, the CFLAGS could(should?) be set to march=native to all gcc native detection of all your CPU features.
Back to top
View user's profile Send private message
loftwyr
l33t
l33t


Joined: 29 Dec 2004
Posts: 970
Location: 43°38'23.62"N 79°27'8.60"W

PostPosted: Mon Feb 23, 2009 10:55 pm    Post subject: Reply with quote

-march=native selects the right options for your kernel at compile time. If you change hardware then it wil have issues.
_________________
My emerge --info
Have you run revdep-rebuild lately? It's in gentoolkit and it's worth a shot if things don't work well.
Celebrating 5 years of Gentoo-ing.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on AMD64 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