Skip to content

Compile packages from sources

yoyoma2 edited this page Jun 13, 2024 · 42 revisions
⚠️ 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 a 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

Additional steps if you are working with deprecated armv7sf-k2.6 or x86-k2.6 feed:

git fetch
git switch k2.6

Additional steps if you are working with deprecated armv5sf-k3.2 feed:

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. Premade configurations for most of the major target architectures are stored in the configs directory also located in the SDK's root directory. To make use of them, you need only to copy the configuration file you require to the root directory and rename it as .config. The example below demonstrates how this would be accomplished for the MIPSEL platform:

cp -v 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 in their forum.

Tips

You can build one package (squid, for example) with all its dependencies with the command:

make package/squid/compile

If something goes wrong, turn on verbose mode to view more detailed progress and error messages by appending V=s to the make command you're using:

make package/tmux/compile V=s

You can speed up compilation on multiprocessor systems by running several build threads simultaneously by adding -j$(nproc) after the make command:

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 last command with the command to build the package you need. You may have to modify it a little. For instance, if you're getting a error during the compilation of a package:

...
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

You can follow the advice and run 'make -j1 V=s' to see what happened. But you'll have to wait a lot until the build system gets through all the already built packages. It's much more convenient to proceed directly to the package that failed:

make -j1 package/feeds/rtndev/totd/compile V=s

Sometimes you have to omit the package section, e.g. 'make[3] -C feeds/packages/utils/ttyd compile' -> 'make package/feeds/packages/ttyd/compile'. You can run 'make printdb >log.txt' and then search the exact target name of the package you're interested in.

Error in tools or toolchain

In case there is an error in the tools/install or toolchain/install phase, and you change your configuration, remember to run a make dirclean instead of make clean. To clean only one specific part you can run make toolchain/uClibc/headers/clean instead.

Clone this wiki locally