# Is building world+kernel on target machine required?



## arader (Mar 15, 2020)

quick question, when doing a `make buildworld` and `make kernel` is it necessary to do that on the specific machine that will be running that kernel/world?

I have a beefy amd64 machine and a anemic one that both run freebsd. It would be great if I can just build src on the beefy one then `zfs send` /usr/obj to the weak one.

I’m worried though that the build makes certain optimizations depending on the machine it’s built on. is this the case? or is my plan a good one?

alternatively, is there a better way to do this, assuming I want to keep building from source?


----------



## JohnnySorocil (Mar 15, 2020)

If you don't customize CFLAGS in make.conf then building world for same architecture should work on multiple hosts with that same architecture.
I had one PC which built custom kernel and custom world with optimizations for another and it worked - both were same architecture.


----------



## PMc (Mar 16, 2020)

Works. Obviousely, if you want cpu optimizations, and the targets are different, you should configure the proper cpu during the build (and run multiple builds, appropriately). You should also be able to build for a downward compatible architecture, if the building host can run these executables.


----------



## SirDice (Mar 16, 2020)

arader said:


> It would be great if I can just build src on the beefy one then  zfs send /usr/obj to the weak one.


I use NFS for this. I just export /usr/src/ and /usr/obj (can be read-only). Then mount it on the "destination" host and run install{world,kernel} there.


----------



## T-Daemon (Mar 16, 2020)

There is a chapter in the handbook dealing with that topic: 23.6. Tracking for Multiple Machines


----------



## PMc (Mar 17, 2020)

PMc said:


> Works. Obviousely, if you want cpu optimizations, and the targets are different, you should configure the proper cpu during the build (and run multiple builds, appropriately). You should also be able to build for a downward compatible architecture, if the building host can run these executables.



I have to correct myself: You can build on any architecture for any architecture (that is supported). Just set TARGET and TARGET_ARCH when calling make.


----------

