I'm think about what could be the minimal distribution for virtualbox/vmware to build openwrt image. Ubuntu server ? Debian Server ? Or maybe it is possible to build image for router in x86 openwrt environment ?
I would install a minimal edition (definitively not "server") of any major distribution (Fedora, Ubuntu, Debian, ...).
I think that Graphical interface is not needed. When you write minimal distro Debian or Ubuntu - it suggest minimal server.
Debian 9 without GUI builds OpenWrt just fine. All required packages (build essentials, gcc and other) are in standard repositories.
For the (newer) OpenWrt buildslaves we also use a base Debian 9 Docker image with the following packages:
RUN apt-get update && \ apt-get install -y \ pwgen \ locales \ buildbot-slave \ build-essential \ git-core \ subversion \ libncurses5-dev \ gawk \ unzip \ wget \ curl \ ccache \ rsync
This can be trimmed down some more since
rsync are not really required to build OpenWrt.
This looks like Dockerfile to me, how about build the image in Docker container?
I can get a VirtualBox image running Debian in just a few minutes. I haven’t looked into redistribution restrictions though.
Personally, I’d retain ccache as it will speed subsequent builds on similar source greatly.