Compile openwrt in Centos7
1. download the latest openwrt source code
git clone https://github.com/openwrt/openwrt.git
2. Download feeds
Run $./scripts/feeds update-a $./scripts/feeds install-.
3. Configure the environment
Make defconfig check required dependencies $ sudo yum-y install gcc binutils patch bzip2 flex bison make autoconf gettext texinfo unzip sharutils libncurses5-dev ncurses-term zlib1g-dev wget perl-Thread-Queue openssl-devel zlib- static ncurses-devel gcc-c ++ $ make prereq $ make menuconfig
You can configure options in the text dialog box. The most important configuration items are:
Target system (Target system type)
Package selection)
Build system settings (compile system settings)
Kernel modules (Kernel module)
[*] Indicates that the package is selected for compilation and installed in firmware;
[M] indicates that the software package is selected for compilation but not installed in firmware.
When you exit Menuconfig, the system prompts whether to save the configuration.
4. Compile
Generally, use a simple command:
$ make
To speed up a multi-core processor system (for example, a 3-core processor ):
$ make –j 3
Compile in the background and use idle I/O resources and CPU performance (for example, using a dual-core processor)
$ onice -c 3 nice -n 20 make -j 2
Compile a separate software package (for example, in the cups Software Package ):
$ make package/cups/compile V=99
If you need to analyze the compilation error information for special reasons:
$ make V=99 2>&1 |tee build.log |grep -i error
Note: Save all compiled output information in build. log and print the error information on the screen.
An Application of Complex commands
$ 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)'
Note: Save all compiled output information in build. log, and print the error and warning information on the screen. The compilation process uses a dual-core CPU, occupying background resources.
5. Image Generation location
The newly generated image is stored in the new bin directory by default.
$ ls bin/*
6. Cleanup
$ make clean
In addition to clearing the generated directory, you also want to clear the cross-compilation tool (and tool chain directory)
$ make dirclean
Clear all related items, including downloaded software packages, configuration files, and feed content:
$ make distclean
7. Install openwrt