openwrt compilation experience【2021-01-28】

openwrt compilation experience【2021-01-28】

Compiler Environment

Kubuntu 20.10 (theoretically the same is true for other Ubuntu distributions)
first refer to the Openwrt Readme of L and install it

build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch python3 python2.7 unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler g+±multilib antlr3 gperf wget curl swig rsync

These bags (some systems come with them)
Also, it’s a good idea to have a ladder ready.

Compile repository

I use the official source code of openwrt. If the speed in China is slow, you can use gitee to speed up the clone.
Not only the openwrt source code needs to be accelerated, but the warehouses in openwrt/feed.conf.defaults also need to be accelerated. You can modify it to the warehouse directory under gitee or use other methods to speed up.

Compile configuration

Just use make menuconfig to select the package you need.
Refer to L's plug-in instructions.
In addition, in the generated .config file, the two user packages libustream-wolf and dnsmasq will report errors and need to be commented out.

Compilation process

  1. Install compilation tools
    sudo apt install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch python3 python2.7 unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler g++-multilib antlr3 gperf wget curl swig rsync -y
    
  2. Download the openwrt repository
    git clone https://git.openwrt.org/openwrt/openwrt.git/
    
    The git address can be replaced with your own openwrt warehouse.
  3. Enter the warehouse and switch to the version you need
    cd openwrt
    git checkout remotes/origin/openwrt-19.07
    
  4. Edit feeds.conf.defaults repository to speed up
    nano feeds.conf.default
    
    Replaced with your own accelerated repository.
  5. Then update with feeds first
    ./scripts/feeds update -a
    ./scripts/feeds install -a
    
  6. Generate configuration file
    make menuconfig
    
  7. Modify .config file
    nano .config
    
    Comment out these two lines

    CONFIG_PACKAGE_libustream-wolfssl
    CONFIG_PACKAGE_dnsmasq

  8. To prevent errors during parallel compilation, run make download first
    make -j8 download V=s
    
    A lot of things will be downloaded here. It is recommended to use a proxy, but please note that there is a problem with the proxy, that is, pip cannot connect through socks when pysocks is not installed.
  9. compile
    make -j1 V=s
    
    Although the tutorial says that make download can prevent parallel compilation errors, I still have some inexplicable packages that cannot be compiled successfully during parallel compilation. There should be mutual dependencies. If the compilation is idle for a long time, it is recommended to compile with a single thread, otherwise it can be repeated several times. .

Guess you like

Origin blog.csdn.net/u013943146/article/details/113353790