# Building world/kernel in RAM



## baot (Nov 4, 2012)

Hi. In my /etc/make.conf I have:

```
WRKDIRPREFIX=/ram
```
so that all my ports get built in a tmpfs RAM filesystem, but when I `# make buildworld` or `# make buildkernel` that option is not respected, and everything still goes in /usr/obj. Is there a way to make rebuilding world and kernel also put all the work files there?


----------



## T-Daemon (Nov 4, 2012)

Greetings.

The WRKDIRPREFIX variable targets only the port, not kernel and world builds. Also is /etc/make.conf not the right place for the objects directory environment variable. From build(7)():



> MAKEOBJDIRPREFIX
> 
> Defines the prefix for directory names in the tree of
> built objects.  Defaults to /usr/obj if not defined.
> ...


----------



## baot (Nov 4, 2012)

Thanks for your reply! Is there a reason it can't be set in /etc/make.conf? Seems only natural to put it there instead of specifying it _every single time_ I rebuild.

Though I guess I can just put it in /etc/profile.


----------



## wblock@ (Nov 4, 2012)

Use a tmpfs(5) device for /usr/obj:

/etc/fstab

```
tmpfs                   /usr/obj        tmpfs   rw,mode=01777   0       0
```

This works.  My tests have shown it really makes little difference to speed of buildworld.


----------



## T-Daemon (Nov 5, 2012)

baot said:
			
		

> Is there a reason it can't be set in /etc/make.conf?


I'm not sure. Also I've noticed, that many users set MAKEOBJDIRPREFIX from command line, contrary to the demanding statement in build(7) and /usr/share/examples/etc/make.conf. If you want to look into it deeper, you could contact the author of the build(7) man page, ask here or at the mailing list. 



> Though I guess I can just put it in /etc/profile.


/root/.cshrc would be a better choise. It's more appropiate, since you are root when building kernel/world. In /etc/profile normally you put things for system-wide use, where all users benefit from it, but in this case, because of write permissions, it's useless for others then root.


----------

