The construction of openwrt compilation environment

  OpenWRT is a highly modular and highly automated embedded Linux system with powerful network components and scalability. It is a fully functional and easy-to-modify router operating system written from scratch.
  The official website of OpenWRT is: https://openwrt.org/
  There are two source codes on github,
  one is lede, the address is: https://github.com/coolsnowwolf/lede
  The other is the official source code of OpenWrt : https://github.com/lede-project

1. Build the environment

  Use Ubuntu in the virtual machine, and set the source of Ubuntu to Ali source.
  The method of downloading the source code of lede is:

git clone https://github.com/coolsnowwolf/lede

  The official source code method for downloading OpenWrt is:

git clone https://github.com/openwrt/openwrt.git

2. Compile the lede source code

2.1. Install and compile dependencies

sudo apt update -y
sudo apt full-upgrade -y
sudo apt install -y ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential \
bzip2 ccache cmake cpio curl device-tree-compiler fastjar flex gawk gettext gcc-multilib g++-multilib \
git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libglib2.0-dev libgmp3-dev libltdl-dev \
libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libreadline-dev libssl-dev libtool lrzsz \
mkisofs msmtp nano ninja-build p7zip p7zip-full patch pkgconf python2.7 python3 python3-pyelftools \
libpython3-dev qemu-utils rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip \
vim wget xmlto xxd zlib1g-dev python3-setuptools

2.2. Update feeds and select configuration

cd lede
./scripts/feeds update -a
./scripts/feeds install -a
make menuconfig

2.3. Download the dl library and compile the firmware (-j is followed by the number of threads, and it is recommended to use a single thread for the first compilation)

make download -j8
make V=s -j1

2.4. Second compilation

cd lede
git pull
./scripts/feeds update -a
./scripts/feeds install -a
make defconfig
make download -j8
make V=s -j$(nproc)

2.5. If reconfiguration is required:

rm -rf ./tmp && rm -rf .config
make menuconfig
make V=s -j$(nproc)

  After the compilation is completed, the output path: bin/targets
  Note: Do not use the root user to compile

3. Compile the official source code of OpenWrt

  Using the above method to compile the official source code of OpenWrt can also be successful.

Guess you like

Origin blog.csdn.net/xxxx123041/article/details/132481271