# Compiling a 32 bit kernel on an amd64 system

## Kingoftherings

I want to use linux 2.6.28 on my ASUS Eee PC 900 running Arch Linux.  The kernel they have in testing doesn't allow me to tap my touchpad to click for some reason, so I tried compiling a vanilla kernel, and after about an hour of compiling on a 900mhz Celeron I accidently hit the power button as I was messing around with, and it shut off.  

So now I want to compile a kernel for it on my Gentoo box, but I'm running amd64, and the Celeron isn't 64-bit I belive.  So is there a way to compile the kernel for x86 on my amd64 box?

Also, I just saw a thread here about getting GEM to work:  https://forums.gentoo.org/viewtopic-t-721583.html

This is mainly what I wanted to try the new kernel for.  I could compile a xorg-server from git, but I don't really want to screw everything up.  So should I just wait for xorg-server 1.6 to go stable, and not waste a bunch of time?   :Razz: 

Edit: The reason why I want to test GEM on my Eee is because my Gentoo box is running an Nvidia gpu, so I can't on this rig.   :Sad: 

----------

## roki942

The only thing different form the Handbook will be how you do your chroot - just follow the example in the 32 bit Chroot Guide http://www.gentoo.org/proj/en/base/amd64/howtos/index.xml?part=1&chap=2 and you'll be all set.

----------

## Kingoftherings

Thanks.  This gave me a great idea.  The only reason I didn't use Gentoo was because compiling stuff on an Eee would suck, but with this I could chroot in from my main gentoo box and compile stuff, and it'd be ready to go.  The only problem is how would I network that.  Networking isn't really my thing.   :Razz: 

----------

## Kingoftherings

Wow, that worked really well.  I'm really surprised it booted, I wasn't really expecting it to.   :Razz: 

And everything, including wifi and tap to click work.

----------

## pappy_mcfae

If you want to strictly compile the kernel (as in NOT configure it), you can use

```
make CC="i486-pc-linux-gnu-gcc"
```

to do the deed. If you want to do it quickly, you can add "-j32" (without quotes) to the end of the above statement, and be amazed at how quickly the kernel will compile.

Blessed be!

Pappy

----------

## Hu

The kernel also has support in its Makefile rules for cross-compilation.  A quick glance through recent sources suggests to use make ARCH=i386 CROSS_COMPILE=i686-pc-linux-gnu-, but I have not tested this.  You would need an i686-pc-linux-gnu-gcc in $PATH for this to work.  I think this would be smart enough to use the host compiler for building menuconfig, so that you can run it locally.

----------

## Corona688

 *pappy_mcfae wrote:*   

> If you want to strictly compile the kernel (as in NOT configure it), you can use
> 
> ```
> make CC="i486-pc-linux-gnu-gcc"
> ```
> ...

  -j32?  That will make it run 32 processes at once...  Unless I missed him saying he was running a bladeserver, 32 processes is pointlessly excessive and no advantage over -j3 for dual core, -j5 for quad core.  Plus any speed advantage will be lost all those simultaneous processes eat up all your ram and start swapping.

----------

## pappy_mcfae

Nothing exceeds like excess! If you think -j32 makes for exciting TV, try using -j. Wow, I never knew a machine could be ground so thoroughly to a halt. Every bit of memory was busy, the CPU was stuck at 100%, and the machine wouldn't respond to anything. 

The final product booted, but it was a bit more effort than it was worth. Someone on this forum snuck that in on me. 

I had a good laugh at my own expense, and I'm sure he did as well.

Seriously, I do that all the time. Considering how much there is to compile to make the kernel, anything that will help things along is ok by me. And, unless I'm completely hallucinating, I have three non-blade computers that use -j32 for kernel compilation all the time, even the old Toshiba laptop.

Blessed be!

Pappy

----------

## zyko

"make -j" (= --jobs without any further arguments) will not limit the number of processes. This might potentially spawn too many jobs, though I think such behaviour would be considered stupid engineering. Running make with unlimited --jobs is only useful with the -l option (--load-average=n). It works just like the Portage option, meaning that no new jobs shall be started unless the system drops below a load average of n.

So you'd want to run "make -j --load-average=5" or something like that. This can also be added to the MAKEOPTS variable in make.conf.

----------

## pappy_mcfae

It does! 

Like I said, it's an amazing site when you see a computer that has compiled its way through the world a half-dozen times be brought to its knees with "-j" while compiling a kernel. Effectively, you tell the machine to compile everything at once. With the kernel, that comes in with at least ten thousand operations at once. Just count the lines in your .config. That's how many separate operations you're looking at (at a very minimum).

Given enough memory and CPU power, you might be able to compile the entire kernel in a minute or less. Personally, I'd love to see the machine that chew on that without choking.

Blessed be!

Pappy

----------

## zyko

I had to try that out... Nice find! Crashing computers is a guilty pleasure of mine   :Smile: 

My desktop box (Core2duo 3GHz + 6GB RAM) froze up within 5 seconds. The last thing displayed by htop was 299 running processes and maxed out RAM.

So I went to the university and tried this on a dual Xeon with 16 GB of RAM (running Debian). I used a stage3 tarball in a chroot within a tmpfs mounted with -o size=15G. It took about 10 seconds to max out the 15GB, then it crashed just as miserably as my desktop. It managed ~600 concurrent processes before freezing up.

I'm looking forward to trying this on stronger systems as technology advances.

----------

## pappy_mcfae

Nice!

Blessed be!

Pappy

----------

## Monkeh

 *pappy_mcfae wrote:*   

> Given enough memory and CPU power, you might be able to compile the entire kernel in a minute or less. Personally, I'd love to see the machine that chew on that without choking.

 

Well I don't know about the entire kernel, but my machines can build a useful kernel in less than a minute.

----------

## pappy_mcfae

Do you have a pic of the machine?  :Smile:   What kind of machine are you running?

Blessed be!

Pappy

----------

## Monkeh

 *pappy_mcfae wrote:*   

> Do you have a pic of the machine?   What kind of machine are you running?

 

You don't want to see it, it's ugly and horrible. It's a Q6600 having a very good day. My Q9450 should be able to beat it.

----------

## pappy_mcfae

Come on, I've seen a BBS system nailed to a particle board! It can't be any uglier than that! 

And yes, said BBS was called, wait for it...The Particle Board. Imaginative, eh? I called my BBS The Pleasure Dome (Kudos to Coleridge). Ah, those were the days.

Blessed be!

Pappy

----------

## Monkeh

 *pappy_mcfae wrote:*   

> Come on, I've seen a BBS system nailed to a particle board! It can't be any uglier than that!

 

You'd be surprised. Anyway, I only just finished a thorough cleanout and recable (among other things) and put it back, I'm too lazy to drag it out from under the desk now.

----------

## pappy_mcfae

 :Smile:  I can accept that. hehehehe

Blessed be!

Pappy

----------

