Compile a Specific Module
make package/qos/clean
make package/qos/compile
make package/qos/install
Compile Firmware
# V=99 indicates detailed debug information
make V=99
# Compile everything
make world
# For multi-core CPUs, adding the -j=2 option can theoretically speed up the compilation
# make -j 2 V=99 can speed up the compilation (not recommended)
make j=2 V=99
Skip Unused Packages
IGNORE_ERRORS=1 make
# If everything you are building stops at a package you don't care about,
# you can skip the failed package using IGNORE_ERRORS=1
Compilation Information
make V=99 | tee compile_v1.0.0.log
# The tee command mixes the compilation information into the compile_v1.0.0.log file for easy viewing.
Background Compilation
ionice -c 3 nice -n 20 make -j 2
# Allow idle I/O and CPU to compile firmware in the background (dual-core CPU)
# A software package in Feeds is approximately like this: make package/feeds/packages/ndyndns/compile V=99
Clean Compilation
make clean
# Remove the contents of the /bin and /build_dir directories without removing the toolchain,
# it also avoids cleaning architecture/target
make dirclean
# Remove build-dir and staging-dir tmp
make distclean
## Remove all compilation or configuration and all downloaded content feeds and package sources.
## Caution: This will eliminate your build configuration (<buildroot_dir>/config),
## your toolchain, and all other sources. Use with care!
Compilation Errors
If the compilation fails for some unknown reason, here is a simple way to find out where the compilation went wrong:
make V=99 2>&1 | tee build.log | grep -i error
# The above compilation command means: V=99 parameter, saves error information in build.log,
# generates a complete detailed copy of the output (with stdout piped to stderr),
# only displays errors on the screen.
Example:
ionice -c 3 nice -n 20 make -j 2 V=99 CONFIG_DEBUG_SECTION_MISMATCH=y 2>&1 | tee build.log | egrep -i '(warn|error)'
# The above code saves a complete copy of the build output in build.log (piping stdout to stderr),
# and only outputs warnings and errors while using background resources for building on a dual-core CPU.