1. 编译环境准备

环境 Ubuntu 14 / 16 / 18, Debian 8 / 9 / 10 等 Linux 虚拟机。WSL 应该也可以。

apt-get install subversion build-essential libncurses5-dev zlib1g-dev gawk git ccache gettext libssl-dev xsltproc unzip

2. 检出代码

git clone -b openwrt-19.07
cd openwrt
./scripts/feeds update  -a
./scripts/feeds install -a


To build your own firmware you need a Linux, BSD or MacOSX system (case
sensitive filesystem required). Cygwin is unsupported because of the lack
of a case sensitive file system.

You need gcc, binutils, bzip2, flex, python3.5+, perl, make, find, grep, diff,
unzip, gawk, getopt, subversion, libz-dev and libc headers installed.

  1. Run "./scripts/feeds update -a" to obtain all the latest package definitions
    defined in feeds.conf / feeds.conf.default

  2. Run "./scripts/feeds install -a" to install symlinks for all obtained
    packages into package/feeds/

  3. Run "make menuconfig" to select your preferred configuration for the
    toolchain, target system & firmware packages.

  4. Run "make" to build your firmware. This will download all sources, build
    the cross-compile toolchain and then cross-compile the Linux kernel & all
    chosen applications for your target system.

Typical build procedure

git checkout <branch/revision/tag> when you don't want HEAD.
make menuconfig and set target.
make defconfig to set default config for build system and device.
make kernel_menuconfig (optional :!: it's highly likely that kernel modules from the repositories won't work when you make changes here).
make menuconfig and modify set of package.
make download (download all dependency source files before final make, enables multi-core compilation).
scripts/ >mydiffconfig (save your changes in the text file mydiffconfig).
make start the build process.

Build single package

make package/cups/compile V=s

For a rebuild:

make package/cups/{clean,compile,install} V=s


make target/linux/compile V=s

Last update: 2020-06-05 04:13:51 UTC