Prerequisites for building OpenWrt: RAM + HDD space

Seems like is a bit outdated:

To generate a flashable firmware image file with a size of e.g. 8MB, you need:

  • ca. 200 MB of hard disk space for the build system
  • ca. 300 MB of hard disk space for the build system + package feeds
  • ca. 2.1 GB of hard disk space for source packages downloaded during build from package feeds
  • ca. 3-4 GB of available hard disk space to build (i.e. cross-compile) and generate the firmware file
  • ca. 1-4 GB of RAM are needed for the compilation stage.(4GB of RAM are required for compilation of x86 firmwares)

Does someone want to update this?

The big problem with defining those figures is how many (and which) additional packages are enabled (e.g., I'm building with a limited set of additional packages (the largest additions being openssl+strongswan/ asterisk_on_lantiq) on a 30 GB scratch partition, I can comfortably do two (different target) builds within that, but a third will fill up that space). However if you do buildbot like builds, enabling all packages, you end up in the high 3-figure range of GBs, the requirements are just this volatile depending on your build options.

1 Like

python2-dev > python-future

OK, doing a "what you might expect build" on a two-core, 2 GB VM running Debian.


apt install sudo
usermod -a -G sudo jeff
apt install build-essential git gitk libncurses5-dev gawk unzip wget curl ccache rsync zlib1g-dev


then select

  • luci-ssl-nginx
  • luci-app-samba4
  • luci-app-sqm
  • luci-app-wireguard

Looks like 2 GB RAM for two cores is reasonable, hasn't pushed anything significant into swap (43 MB).

Of course, memory will scale somewhat with threads.

Took just under an hour for a from-scratch build.

real	59m4.629s
user	85m53.528s
sys      8m54.356s

/dev/sda1        30G   13G   16G  45% /

Now testing adding openssh-client, openssh-server, openvpn-openssl, luci-app-openvpn as an "incremental build"

real	5m28.424s
user	6m1.436s
sys	    0m42.772s

and with

make -j3 clean download world

(Shoot, laptop went to sleep during that meeting)

real	28m54.926s
user	39m55.432s
sys 	 5m18.392s

"First build, an hour; incremental packages, 5-10 minutes; clean build after first build, half an hour."

I don't have the exact numbers but Alpine Linux (extended) and prerequisites takes up less than 1G of space and at least on my build box (old T430 laptop) feels quite a bit snappier and lighter than Debian 9 but that may be placebo.

apk add git build-base bash ncurses-dev perl tar findutils patch coreutils gawk grep unzip bzip2 wget python2-dev linux-headers curl diffutils bsd-compat-headers less diffutils

The download dir is ~3.3G but that's including 18(!) kernel tarballs (about 100Mbyte each) and 4 different versions of GCC (about 250Mbyte in total) so 4G will be more than enough even over time in most cases.

2G RAM is probably fine in general usage for 4-6 jobs unless there's a lot of LTO operations which eats a lot more memory.

In comparison to the required scratch area for the actual build, the size of the host OS of VM is less relevant (yes, it matters for things like docker, but not really for the on-disk requirements, unless you want to virtualize a whole buildfarm). RAM requirements for C tools aren't that out of line either, this changes dramatically once you touch C++ sources or link-time optimizations.

1 Like

I use to build new openwrt firmware for my router once in a month. I always update sources.
Currently it takes 12 GB of SSD space.

 ~/Desktop/git du -sh openwrt/
12G     openwrt/