# Installing Gentoo on an AMD-K6 system

## alpage2

I have been using Lubuntu 10.04 on an old AMD K6 laptop - 400MHz cpu and 192MB RAM. It has been great to extend the life of this ex-Windows 98 laptop, but it does suffer from a couple of problems. Software bloat is making it gradually slower, and less able to handle more than one application at a time, and I am unable to upgrade to a more recent Lubuntu distro because from ver. 10.10 onwards, support has been required for cmov - which this processor does not have.

Having been a (basic) gentoo user some years ago, I felt sure that Gentoo would have the answer, so would be grateful for some advice as to what compile options I would need, and kernel configuration options. The full info for the CPU is:

//

Name	 : AMD-K6(tm) 3D processor

Family, model, stepping	 : 5, 8, 12 (AMD K6-2)

Vendor	 : AuthenticAMD

-Configuration-

Cache Size	 : 64kb

Frequency	 : 400.94MHz

BogoMIPS	 : 801.87

Byte Order	 : Little Endian

-Features-

FDIV Bug	 : no

HLT Bug	 : no

F00F Bug	 : no

Coma Bug	 : no

Has FPU	 : yes

-Cache-

Cache information not available

-Capabilities-

fpu	 : Floating Point Unit

vme	 : Virtual 86 Mode Extension

de	 : Debug Extensions - I/O breakpoints

pse	 : Page Size Extensions (4MB pages)

tsc	 : Time Stamp Counter and RDTSC instruction

msr	 : Model Specific Registers

cx8	 : CMPXCHG8 instruction

pge	 : Page Global Enable

mmx	 : MMX technology

syscall	 : SYSCALL and SYSEXIT instructions

3dnow	 : 3DNow! Technology

k6_mtrr	 : AMD K6 nonstandard MTRRs

up	 : smp kernel running on up

//

Any pointers would be most helpful - thanks in anticipation

Alan

----------

## i92guboj

I *think* that current Gentoo x86 Live DVDs are compiled for i686, that means that they'll probably fail to boot on your machine. The good news is that you don't need a Gentoo live disk to install Gentoo. You can use any distro of your choice, so finding a valid boot media shouldn't be a problem.

The rest is just a matter of following the x86 Handbook, but be aware that compiling a modern system will no doubt take some time in that hardware. If you have a small home network you might be interested in distcc as a way to speed up compilations.

http://www.gentoo.org/doc/en/handbook/handbook-x86.xml

----------

## alpage2

Thanks, i92guboj. I was anticipating using a minimal install CD, followed by the stage 3 tarball.

Any advice on whether I need to set any CFLAGS or other FLAGS for this processor, or any specific kernal configuration options, would be much appreciated - but otherwise I'll go with the defaults, and see what happens.

Thanks for the advice on the compile time - the last time I used Gentoo it was a 130MHz processor, so I know what you mean  :Wink: 

This is a spare machine, so a long compile is no problem  :Smile: 

Many thanks

Alan

----------

## Jaglover

I've installed Gentoo on this kind of hardware in past. I started with i486 tarball and changed CHOST to i586. 

OTOH, if you feel adventurous FreeBSD can be installed in almost same way as Gentoo, IE you install the bare base system and set up your make.conf and rebuild the world. And unlike Linux FreeBSD considers your CPU as an i686.

----------

## i92guboj

Settings your CFLAGS to -march=native should effectively use all the capabilities of your cpu. You could also explicitly set it to -march=k6 (or k6-2, or k6-3). But, I'd just use "native" and let it do its work.

----------

## BillWho

alpage2,

Try 

```
gcc -### -march=native -E /usr/include/stdlib.h 2>&1 | grep "/usr/libexec/gcc/.*cc1"

```

Look for the output that starts with -march to see what it will use

```
"-march=amdfam10" "-mcx16" "-msahf" "-mpopcnt" "-mabm" 
```

----------

## saellaven

My K6II/450 died last year, but here's my old make.conf if it helps you. Note that I used distcc to speed up compiling (if you use distcc, you can't use march=native)

```

CFLAGS="-O2 -mtune=k6-2 -march=k6-2 -pipe"

LDFLAGS="-Wl,-O1  -Wl,--as-needed"

CHOST="i586-pc-linux-gnu"

CXXFLAGS="${CFLAGS}"

MAKEOPTS="-j5"

FEATURES="distcc fixpackages"

LINGUAS="en"

PORTAGE_ELOG_CLASSES="info warn error log"

PORTAGE_ELOG_SYSTEM="save"

ACCEPT_LICENSE="*"
```

----------

## alpage2

Thanks, All, for the very helpful feedback - I'm looking forward to getting back into Gentoo - downloading the min install .iso very shortly.    :Very Happy: 

Alan

----------

## destroyedlolo

Hi

I did recently an install on a K7 500 Mhz ( so, fortunately, an i686 arch   :Very Happy:  ).

It's working fine with distcc (but don't use -march, set explicitly the processor as you did), with several P4, Athlon and Celeron participant.

But the CPU will remain the bottleneck for awk, m4 and other local stuffs will make compilation age to complete. Building a binhost will save valuable time  :Smile: 

Bye

----------

## pigeon768

System rescue CD can boot a 586, or a 486 for that matter.

Use a 486 stage3 and change the CHOST to 586. Set CFLAGS="-march=native -O2 -pipe -fomit-frame-pointer" or do "-march=k6-2" if you plan on using distcc. If you set your -march manually, test to make sure you actually have a K6-2; the cpuinfo you posted early just seems to be specifying the K6 family, it doesn't specify a specific processor.

----------

## alpage2

Again, many thanks to everyone for the great advice - just what I was hoping for.   :Very Happy: 

----------

## ksp7498

Make sure you're prepared for how long it will take to compile anything. You could put the hard drive in another (faster) computer and build everything, then move the disk over, but that's difficult with a laptop unless you have another laptop that takes the same kind of disk. Honestly I would run OpenBSD -RELEASE on it instead because it's well suited for old hardware and it has a good packages system so you don't have to compile anything.

----------

## depontius

I ran a K6-III server for quite a while, and you've hit the fact that missing "cmov" is the biggest pain about it.  The other thing is having the right CHOST.  I just took a quick look, and see that there are indeed i486 stage3 tarballs still available.  Problem is, especially with an older processor, you need every bit you can get, and there really is some benefit to getting your CHOST up to i586 from i486.  That's why I always used Stage1 instead of Stage3 on my K6-III - because you need to drop back there, in order to change the CHOST.

But somewhere here on the Gentoo forums I've seen a thread called "Stage1 on a Stage3 tarball".  IIRC, you essentially load up a conventional Stage3 tarball, change the CHOST, rebuild the toolchain, then rebuild everything else.  (I'm sure that there's more to it than that, but I believe that's the essence of it.)

The i486 had floating point, but was single-issue.  The i586 introduced dual-issue and the i686 added multi-issue.  (really an internal RISC with an x86 CISC instruction decoder up-front)  I believe that internally the K6 actually resembles the i686 more, but it lacks that critical "cmov" instruction.  But I also believe that the difference between i486 and i586 is worth capturing.

I did a quick search against "stage1" and couldn't find the old thread, but did find these:

https://forums.gentoo.org/viewtopic-t-830228-highlight-stage1.html

https://forums.gentoo.org/viewtopic-t-880157-highlight-stage1.html

https://forums.gentoo.org/viewtopic-t-854927-highlight-stage1.html

----------

## i92guboj

Oh, that reminded me that there's a guide about "changing CHOST". As you say, it's non-trivial. It's long since I had to resort to this so I don't know if all the info in it still applies, but sure it's better than nothing.

http://www.gentoo.org/doc/en/change-chost.xml

----------

## NeddySeagoon

I don't think I would bother with the CHOST change. All that is affected is the toolchain.

Sure - builds may take a little longer with an i484 toolchain instead of a i586 toolchain but you won't notice.

My first Gentoo install was on a k6-2 450Mz box, which is long retired but not yet disposed of. That would be a stage1 install just about 10 years ago now.

The CHOST changing guide dates from the days when glibc dropped i386 support around version 2.3, IIRC.

At that time gentoo provided i386 and i686 stage tarballs.  Many users installed the i386 stages on i686 class hardware and suddenly had no glibc upgrade path.

Its still correct today.  

If you set your CFLAGS for a k6 or march -native, all of the emitted code will be correct for your CPU.

You can do a stage1 install using the stage3 tarball if you want, then you can set CHOST as you wish, right at the start and ignore the CHOST chnaging guide.

The stage1 install guide is hard to find now but its still there.

Its only two extra commands for you but its a lot of extra CPU time.

----------

## depontius

 *NeddySeagoon wrote:*   

> I don't think I would bother with the CHOST change. All that is affected is the toolchain.
> 
> Sure - builds may take a little longer with an i484 toolchain instead of a i586 toolchain but you won't notice.
> 
> 

 

Does the i486 toolchain generate i586+ optimized code?  At some point it becomes cross-compiling, but maybe that's not until you get to amd64?

----------

## NeddySeagoon

depontius,

The CHOST=i486 toolchain generates code for whatever you put in CFLAGS -march, within reason.

All of the Intel 32 bit CPUs and there clones are very close in that respect.

----------

