# Migration from Athlon X2 64 to Intel Core i7 (w/o reinstall)

## ikshaar

I have a failing motherboard on this computer (not yet dead but soon) K9N Platinum with an Athlon X2 4200+. Gentoo 64bits on it for years.

Currently on gcc-4.1.2 and:

```
CHOST="x86_64-pc-linux-gnu"

CFLAGS="-march=athlon64 -O2 -fomit-frame-pointer"

CXXFLAGS="${CFLAGS}"

```

I am moving to an Asus P6T with Core i7 920.

I would like to migrate without reinstalling because it would take a while to redo all settings. What I am not sure is does my current CFLAGS compatible with i7 ? ( I read gcc docs 3.17.13 and i still don't get it between march/mtune)

So far what I am thinking of doing is:

set CFLAGS to -mxxxx=nocona <- unclear which -mxxxx is there

building a temp kernel for i7 with those flags and include drivers for Asus MB.  Put in on grub menu.

replace hardware

boot temp kernel (and pray)

if gcc chain works and networks drivers works I can then re-emerge -e system and tune kernel more if needed.

Does that make sense ? 

Am I correct to assume that gcc chain will be compatible once on the i7 ?

ps: i run mostly stable amd64 so no gcc-4.3.3

Inspired from https://forums.gentoo.org/viewtopic-t-494873-highlight-migration+athlon+core.html but it was only Core2 and I cannot do an emerge -e world before hardware changes. My MB won't survive it.

----------

## poly_poly-man

Steps:

1. move the hard drive/partitions

2. boot a livecd

3. edit your make.conf for CFLAGS to be "-O2 -pipe"

4. chroot in - If this fails, you pretty much need a reinstall.

5. emerge gcc-4.3.2-r3 (stable on amd64)

6. Change your CFLAGS to "-march=native -O2 pipe"

7. emerge -eav system world

8. grab dinner, sleep, and breakfast at least.

9. don't forget the kernel.

----------

## DaggyStyle

 *ikshaar wrote:*   

> I have a failing motherboard on this computer (not yet dead but soon) K9N Platinum with an Athlon X2 4200+. Gentoo 64bits on it for years.
> 
> Currently on gcc-4.1.2 and:
> 
> ```
> ...

 

what settings?

all you need to change is part of make.conf, it should look like this:

```
CFLAGS="-march=native -O2 -pipe -msse4.1 -fomit-frame-pointer"

CHOST="x86_64-pc-linux-gnu"

CXXFLAGS="${CFLAGS}"

MAKEOPTS="-j12"
```

and if you don't use genkernel, then you will have to compile the needed modules into the kernel.

from there, you should not have any problems. notice tha the native march needs >=gcc-4.2.3

do the following, update the gcc, add the relevant config and recompile your kernel, switch h/w and boot, remove all unneeded entries from the kernel and recompile it. then run emerge -e world.

----------

## poly_poly-man

-march=native will autodetect sse4.1, btw.

----------

## ikshaar

thanks a lot ... gcc 4.2.3-r3 was already installed (just not config). I thought 4.3.3 was needed - my mistake.

moved to -march=native. recompiling kernel now. hopefully h/w will be here Monday. Will post results if anyone else upgrading this way.

----------

## poly_poly-man

 *ikshaar wrote:*   

> thanks a lot ... gcc 4.2.3-r3 was already installed (just not config). I thought 4.3.3 was needed - my mistake.
> 
> moved to -march=native. recompiling kernel now. hopefully h/w will be here Monday. Will post results if anyone else upgrading this way.

 nono - compiling with -march=native on your old hardware will not help you - you will still need to recompile later. native auto-detects your cpu's features, and enables the use of them all. So, compiling with march=native on your old hardware will still leave a system built for your old hardware.

Even if you switch CFLAGS to core2 or whatever it really is, your system will not work on the old hardware until then (unsupported instructions).

Change to march=native, and recompile on your new hardware.

----------

## ikshaar

oh so there is no way to do it w/o livecd ?

I was thinking of having a kernel for the old hardware (current kernel is fine) and one for the new one. Or a way to build one that only use common set of instructions of both Athlon64 and i7.

----------

## cach0rr0

couldnt he change his cflags to something very generic, emerge -eDNv world, make a stage4, and port it over? 

granted that's not far off from a reinstall, but still.

----------

## Jaglover

I've done this. From Athlon to VIA-C7. I just rebuilt the base system with "-march=i686 -O2 -pipe", built a kernel for new hardware, pulled the hard drive and rebuilt the world with "-march=i686 -O2 -pipe -mmmx -msse -msse2 -msse3 -fomit-frame-pointer".

----------

## ikshaar

current h/w is shutting down randomly (every hour or so)... I cannot rebuild whole system...

I will do the livecd version from poly_poly-man post... I just hope the chroot works. that's the iffy part...

----------

## Jaglover

You may find critical system files are not affected by Athlon optimization, the system actually may work under Intel. I'd give it a try, you need a new kernel indeed.

----------

## poly_poly-man

 *Jaglover wrote:*   

> You may find critical system files are not affected by Athlon optimization, the system actually may work under Intel. I'd give it a try, you need a new kernel indeed.

 this is what I'm hoping - chrotting in and not trying to boot minimizes chances of failing - less programs have to run.

----------

## DaggyStyle

 *poly_poly-man wrote:*   

>  *Jaglover wrote:*   You may find critical system files are not affected by Athlon optimization, the system actually may work under Intel. I'd give it a try, you need a new kernel indeed. this is what I'm hoping - chrotting in and not trying to boot minimizes chances of failing - less programs have to run.

 

why not use the ctrl+I, boot the network and do the job?

----------

## ikshaar

Well hardware arrived.  And poly_poly-man got it right  :Wink:  Really easy with the livecd which I used just to recompile the kernel.

gcc-4.3.2-r3 was already installed.

boot livecd

chroot to my gentoo partition

remake kernel (of course failed few times to get all drivers correct e.g. Intel sata drivers) with march=native

rebooted and voila

I have not done the emerge -e system & world yet... I wonder if it's even needed.

Only thing not working is lm_sensors so no CPU temp... I got 3.0.3 but I think i7 need more recent one (3.1.0 which is not yet in portage)

thanks all for an easy rescue  :Wink: 

drivers details for Asus P6T WS:

network: r8169

sound: snd_hda_intel

sata/sas: I put both the Intel ICH and the Marvell as the SAS chip is Marvell but not tested if SAS works.

----------

## Timbers2k

Sensors should work fine for the core temps using CONFIG_SENSORS_CORETEMP, and if you use a recent kernel just select the W83667HG driver to get all the other temps, fans, and voltages. I'm using gkrellm to display all the values, so it doesn't matter if lm_sensors is up to date. I' using the 2.6.30-gentoo-r6 kernel and very happy with my i7 system.

----------

## ikshaar

That worked. Thanks.

----------

## ikshaar

Some extra notes for Asus P6T users. Although my hard drives were working fine, I had a nasty bug causing call trace from kernel each time I was plugging a USB device.

Fixed by adding some modules from the PCI/IDE/ATA/SATA sections... (and not from USB section)

```
CONFIG_BLK_DEV_PIIX=y

CONFIG_ATA_PIIX=y

CONFIG_SATA_MV=y
```

Anyway it's part of shifting all devices support from AMD, nVidia & co to Intel, Marvell & co.

----------

## Buddha001

Glad I stumbled upon this thread - I have a dead computer (mb/video card dead) but I believe the hard drive is still alive. I won't know until my new Core i7 machine arrives. I would like to migrate my system from the old hard drive (compiled using march=native on an Intel P4) to the new hard drive on the Core i7 machine.  How should I modify the above steps? Is it just a matter of:

1. Install old hard drive in new system

2. Boot with LiveCD

3. Setup partitions on new hard drive

4. Install grub on new hard drive???

5. Copy over contents of old hard drive to new hard drive to appropriate partitions

6. Chroot in and follow rest of steps in post above?

I need to switch 64bits as well, so I think I need to change my CHOST, is that right? Is that all I need to do to switch to 64 bits?

Or is it just easier to do it with a stage4 where I would copy over the stage4 and expand it after booting with the LiveCD? (I might have to do this if the hard drive is dead).

Thanks!

----------

## poly_poly-man

 *Buddha001 wrote:*   

> Glad I stumbled upon this thread - I have a dead computer (mb/video card dead) but I believe the hard drive is still alive. I won't know until my new Core i7 machine arrives. I would like to migrate my system from the old hard drive (compiled using march=native on an Intel P4) to the new hard drive on the Core i7 machine.  How should I modify the above steps? Is it just a matter of:
> 
> 1. Install old hard drive in new system
> 
> 2. Boot with LiveCD
> ...

 the change to 64-bits is pretty hard, actually - try to find the thread about that. It probably makes more sense to reinstall.

----------

## Buddha001

 *Quote:*   

> the change to 64-bits is pretty hard, actually - try to find the thread about that. It probably makes more sense to reinstall.

 

Sigh - I just read that myself in the docs. What's the best way of migrating all my settings (e.g. conf files, apache webserver, mysql db)? Any way? Or is it just copy/paste from old file to new file as I notice issues?

----------

## ikshaar

At least you should use the world file of your previous install to redo new one.  After a basic 64bits install, copy your /etc/portage/* files, then use the previous world file to feed into emerge.

But because amd64 and x86 may not have same packages version marked stable, it might be risky to copy your config file in brute force.  You might still copy /home of course, and then do your config files one at time (meld is a nice visual diff/merge tool). However you should look into other specific thread for website migration and mysql migration, to ease these two.

Of little comfort may be now, but unless we move to 128bits CPU soon, it would be the last time you have to do that. As shown in this thread to start with, Gentoo can then handle almost all hardware change after that.

----------

## Buddha001

 *ikshaar wrote:*   

> At least you should use the world file of your previous install to redo new one.  After a basic 64bits install, copy your /etc/portage/* files, then use the previous world file to feed into emerge.
> 
> But because amd64 and x86 may not have same packages version marked stable, it might be risky to copy your config file in brute force.  You might still copy /home of course, and then do your config files one at time (meld is a nice visual diff/merge tool). However you should look into other specific thread to website migration and mysql migration, to ease this two.
> 
> Of little comfort may be now, but unless we move to 128bits CPU soon, it would be the last time you have to do that. As shown in this thread to start with, Gentoo can then handle almost all hardware change after that.

 

Well, I was planning on getting 2^65 bytes of RAM with this machine - so I guess I'll need that 128 bit OS.  :Smile:  Thanks for the response though, I will attempt to do just as you say using the world file and hope it's not too much work after that.

----------

## Timbers2k

I just upgraded my kernel to 2.6.31-gentoo, and the sensors stopped working. The w83627ehf module would no longer load because of resource conflicts, so I could get the cpu temperatures, but nothing else. I found out that this conflict had also occurred with the older kernels, but had been allowed. You can go back to the old behavior by adding acpi_enforce_resources=lax to the kernel command line. This may cause some issues, so it's up to you to determine the risk. I've been using it for a few days now without any problems.

Tim

----------

