I want to reduce build time and wanted to reuse some of the existing directories in a new, clear environment.
I'm trying to reuse the following directories of the build_dir:
host
hostpkg
toolchain
And the following directories of the staging_dir:
host
hostpkg
toolchain
However, when I run the make command, the system starts to recompile everything and seems to ignore that the hosttools and toolchain are allready available.
I tried to put the old packages back in the dl folder, as I found out that the system restarts compiling if he cannot find the package there. But still, this seems not enough.
However, when I run the make command, the system starts to recompile everything and seems to ignore that the hosttools and toolchain are allready available.
Thats because the build system is based on GNU Make so you would need to account for that, probably by fixing the file timestamps and stamp files.
Take a look at the SDK which exists for the same purpose, you can use official Docker images as well.
What do you exactly mean with fixing the timestamps? The timestamps of the files in the directories staging_dir and build_dir are from the time I compiled these tools for the first time (a few days ago).
In the directory staging_dir/host/stamp, files like .libressl_installed are available. When I start compiling, these files are updated with current time.
Are these the files I should modify? I tried to modify the timestamp of these files to an hour ago. But still, the buildsystem seems to ignore this and starts compiling the components again.
Not only that, but unless the toolchain changes (additions, edits, or removal) then the toolchain Openwrt uses shouldn't be rebuilding every time. It's compiled the first time and then used until it needs to be rebuilt.
This modification of timestamps seems to work for the toolchain, but not for the host tools. However, another way of triggering the system to not compile the host tools is to clear the tools/Makefile. Not the most clean way, but it prevents the host tools from being compiled again.
I've only seen rather than used them so may have misunderstood their capabilities, but I wonder if using the "external toolchain" options would allow you to use the already built ones.