# How to set the compile directory for the kernel?

## NotQuiteSane

I'm curently building a router, using a 2gb ide flash drive.  For obvious reasons I don't want to run compiles on it.  since i can' access my lan (old linksys died), i've attached a small ide to the system for /usr/portage and /var/tmp/portage.

I wish for the compiling for the kernel to be done in  /var/tmp/portage.  How can I do this?

NQS

----------

## roarinelk

supply "O=<path>" to make:

linux-2.6.git # make O=/path/to/kbuild-output-dir

----------

## NotQuiteSane

 *roarinelk wrote:*   

> supply "O=<path>" to make:
> 
> linux-2.6.git # make O=/path/to/kbuild-output-dir

 

Thanks.  i'm emerging git to grab sources with, and will try that in the morning before i leave for classes

NQS

----------

## Hu

You can do external builds from non-git kernel sources.

If you want to be very sure that you do not write to the Flash device, you could run the build as a non-privileged user who only has permission to write to tmpfs/IDE mounts.  This is not required for correctness.

----------

