# Removing kernel toolchain?



## Phillipe (Oct 3, 2013)

Hey, how's it going? I'm trying to compile 9.2 for using it on an embedded system. It came to my attention that one of the commands is `make kernel-toolchain`, which compiles the tools needed to compile the kernel. Now, my question is what happens with the toolchain once I'm done compiling the kernel and world? Which files does that command create, and how can I remove them safely afterwards? I tried `make clean`, but I'm not sure if it worked.

Thanks a lot!


----------



## ShelLuser (Oct 3, 2013)

Phillipe said:
			
		

> Now, my question is what happens with the toolchain once I'm done compiling the kernel and world?


According to the embedded handbook basically the same as when you issue `# make buildworld`; it ends up in $MAKEOBJDIRPREFIX which I imagine is normally /usr/obj.

This is also where the world gets copied to after building so that when you compile your kernel it'll use the new compiler which is now located here.



			
				Phillipe said:
			
		

> Which files does that command create, and how can I remove them safely afterwards? I tried `make clean`, but I'm not sure if it worked.


`# make clean` usually only cleans up the source tree, not the rest. So my assumption is that the cleaning would have to be done manually. Or not at all since it's common to leave /usr/obj in place after having installed the world for example (though I agree those situations aren't quite comparable).


----------



## phoenix (Oct 3, 2013)

To clean out /usr/obj, you use:
`# make cleanworld`


----------



## Phillipe (Oct 3, 2013)

ShelLuser said:
			
		

> According to the embedded handbook basically the same as when you issue `# make buildworld`; it ends up in $MAKEOBJDIRPREFIX which I imagine is normally /usr/obj.
> 
> This is also where the world gets copied to after building so that when you compile your kernel it'll use the new compiler which is now located here.
> 
> ...



So, does that mean that if I were to remove all of the contents in /usr/obj, the toolchain would be gone as well?


----------



## kpa (Oct 4, 2013)

Phillipe said:
			
		

> So, does that mean that if I were to remove all of the contents in /usr/obj, the toolchain would be gone as well?



Yes, all files created during buildworld/buildkernel are put under /usr/obj, this is to allow a read-only /usr/src shared across multiple machines with for example NFS.


----------



## SirDice (Oct 4, 2013)

If you're looking for ways to remove components from the base to keep the size small, look into src.conf(5). You can disable quite a lot. But be mindful, some components are needed.


----------



## wblock@ (Oct 4, 2013)

phoenix said:
			
		

> To clean out /usr/obj, you use:
> `# make cleanworld`



The fast way is
`# rm -rf /usr/obj`


----------



## Phillipe (Oct 4, 2013)

Thanks a lot everyone!


----------

