Compile packages from sources - entware/entware GitHub Wiki
Compiling Entware packages from source code
[!IMPORTANT] Make sure that the filesystem containing your working directory for compilation has at least 7 GiB of free disk space. You will need ~150 GiB of free space to compile the whole repository.
Install Dependencies
Entware builds packages using the OpenWrt SDK Build system, please install its dependencies first. If you choose to build the packages from Docker, the dependencies are automatically provided so you can move to the next step. Also, there are some package-specific dependencies:
Package | Dependencies |
---|---|
luajit | g++-multilib |
7-zip | p7zip-full |
Clone the Entware Git repository
git clone https://github.com/Entware/Entware.git && cd Entware
Building for deprecated architectures
There are some additional steps required if you are building packages for any of the deprecated architectures.
For armv7sf-k2.6 or x86-k2.6:
git fetch && git switch k2.6
For armv5sf-k3.2:
git fetch && git switch armv5-3.2
Update the package feeds
make package/symlinks
Activate a supported platform configuration
The OpenWRT SDK manages its configuration in a file named .config
, located in
its root directory. Pre-made configurations for most of the major target
architectures are stored in the configs
directory that is also located in the
SDK's root directory. To make use of them, you need only to copy the desired
configuration file into the root directory and rename it to .config
. The
example below demonstrates doing this for the MIPSEL platform:
cp -iv configs/mipsel-3.4.config .config
Rebuild the repository
make -j$(nproc)
Please refer to the OpenWrt Build system documentation for more details, and ask any questions you may have about its use on their forum.
Tips
[!TIP] You can build one package (
squid
, for example) with all its dependencies using only a single command. Example:make package/squid/compile
[!TIP] If something goes wrong during compilation, turn on verbose mode by appending
V=s
to your make invocation for more detailed progress and error messages.make package/tmux/compile V=s
[!TIP] You can speed up compilation on multi-processor systems by running several build threads simultaneously. Just add
-j$(nproc)
to themake
invocation, like this:make -j$(nproc) package/compile
Select only the targets you need to reduce build times
make -j$(nproc) tools/install
make -j$(nproc) toolchain/install
make -j$(nproc) target/compile
make -j$(nproc) package/compile
This can also be used in case you don't need to build all of the packages.
Replace the final command in the sequence above
(make -j$(nproc) package/compile
) with the command required to build the
package you need, though it may require a little modification. For instance, if
you're getting an error during the compilation of a package…
…
root@host~$ make -C feeds/rtndev/telegram-cli host-compile
…
make[3] -C feeds/rtndev/telegram-cli host-compile
make[3] -C feeds/rtndev/totd compile
make -r world: build failed. Please re-run make with -j1 V=s or V=sc for a higher verbosity level to see what's going on
…follow the advice given and run 'make -j1 V=s' to better see what happened. Be aware, though, that you'll have a longer wait until the build system gets through all of the already-built packages. It's much more convenient to proceed directly to the package that failed, like this:
make -j1 package/feeds/rtndev/totd/compile V=s
Sometimes you have to omit the package section, for instance with the error
message make[3] -C feeds/packages/utils/ttyd compile
you would target it for
compilation by invoking make
this way:
make -j1 package/feeds/packages/ttyd/compile V=s
You can also run make printdb >log.txt
and then search the log.txt
file for
the exact target name of the package you're interested in.
tools
or toolchain
phases
Errors in the In the event of an error during the tools/install
or toolchain/install
sections of the compilation that results in changes to your configuration in the
.config
file, remember that you'll need to use make dirclean
rather than the
usual make clean
command. If you only want to clean one specific part of the
tree, you can run make toolchain/uClibc/headers/clean
instead.