Switch to CMake and small fixes
- Switched to CMake as the build system, it is more common than ninja-build and so more useful for those who build by hand (sysadmins).
- Fix build issues on FreeBSD.
- Fix disk on 4k granularity to avoid overwriting areas that are usable, this is useful on media errors.