Reusing the build folder for a faster release of a newer build?

Hi, this is a question for more experienced people with git and complex builds that could know how to use the leftovers of the OpenWrt build folder to reduce the build time of an upgraded version. I am not talking about going from 22.02 to 22.03, I am just talking about going from a snapshot commit state to a newer state.

Now, I always start from scratch: git cloning OpenWrt, processing feeds, adding my config file, my custom files and patches, and doing a make -j16 defconfig download world to get the binaries. The problem is that this takes more than 80 minutes and puts a lot of stress on the computer when usually the changes between commits are very small.

So, I would like to reuse the folder as it is after a build process, and do whatever it needs to be done to reuse the useful, not modified, compiled folders. Has anyone done this? This way I hope I could get a build done sooner and with less stress on the computer.

Thanks

There is no need to start from scratch. Usually the toolchain is quite usable.

I usually do "make clean" to clean the previous build. That leaves the build tools and toolchain intact. A "make" after that compiles the firmware itself from srcatch, but much faster as the toolchain compilation is the slow part. (Sure, you need to update the sources before the make, "git pull" for the main sources and feeds update for the feeds, but the toolchain is already there.)

When tools/ or the key toolchain components (like musl, gcc, etc.) change, you may need to use "make dirclean" to cleanup also tools & toolchain. I need to do that rarely, maybe once per 2-3 months.

One key part to long-term sanity is to make sure that your .config does not collect unnecessary garbage, as the dependencies of the core packages may change. I use a recipe approach. See example in

3 Likes

I would also enable ccache as it will often speed re-builds significantly.