Refactor mknkboot in preparation for beastpatcher integration.