openwrt compile

For GL.inet box

Requirements

You need the following tools to compile OpenWrt, the package names vary between distributions. A complete list with distribution specific packages is found in the Build System Setup documentation

OS

  • Ubuntu >= 18.04 (16.04 python3 is 3.5, need > python 3.6)
  • Debian >= 10

packages install

1
2
3
4
5
6
sudo apt update -y
sudo apt install build-essential ccache ecj fastjar file g++ gawk \
gettext git java-propose-classpath libelf-dev libncurses5-dev \
libncursesw5-dev libssl-dev python python2.7-dev python3 unzip wget \
python3-distutils python3-setuptools python3-dev rsync subversion \
swig time xsltproc zlib1g-dev -y

Quickstart

Clone repository

1
git clone https://github.com/gl-inet/gl-infra-builder.git
1
cd gl-infra-builder

Download OpenWRT 21.02

Setup, the command will auto download openwrt-21.02 by default and auto config, and then patch all the the GL product Patches

1
python3 setup.py -c config-21.02.0.yml
1
2
3
4
5
6
7
8
9
$ more config-21.02.0.yml
repo: https://github.com/openwrt/openwrt.git
branch: v21.02.0
git_clone_dir: openwrt-21.02/openwrt-21.02.0
openwrt_root_dir: openwrt-21.02/openwrt-21.02.0
revision: b2ae4233149dfd78f2ac00bb5327695bcacdc255

patch_folders:
- patches-21.02.0/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
~/gl-infra-builder/patches-21.02.0$ ls -l
total 172
-rw-r--r-- 1 lab lab 15930 Jan 29 16:47 0001-ath79-add-support-for-gl-xe300.patch
-rw-r--r-- 1 lab lab 49979 Jan 29 16:47 0002-ath79-add-support-for-gl-mifi.patch
-rw-r--r-- 1 lab lab 14045 Jan 29 16:47 0003-add-modem-support.patch
-rw-r--r-- 1 lab lab 3514 Jan 29 16:47 0004-add-RS485-support.patch
-rw-r--r-- 1 lab lab 3481 Jan 29 16:47 0005-add-spinand-support.patch
-rw-r--r-- 1 lab lab 2223 Jan 29 16:47 0006-led-netdev-trigger-by-wwanx.patch
-rw-r--r-- 1 lab lab 7408 Jan 29 16:47 0007-ath79-add-support-for-gl-ar300m.patch
-rw-r--r-- 1 lab lab 8408 Jan 29 16:47 0008-ath79-add-support-for-gl-x300b.patch
-rw-r--r-- 1 lab lab 6330 Jan 29 16:47 0009-ath79-add-support-for-gl-ar150.patch
-rw-r--r-- 1 lab lab 8705 Jan 29 16:47 0010-ath79-add-support-for-gl-usb150.patch
-rw-r--r-- 1 lab lab 7017 Jan 29 16:47 0011-add-support-gl-ar750-ar750s.patch
-rw-r--r-- 1 lab lab 13400 Jan 29 16:47 0012-ath79-add-support-for-gl-x750.patch
-rw-r--r-- 1 lab lab 11790 Jan 29 16:47 0013-support-fast-forward.patch

Update feeds and install frr vxlan feeds

1
./scripts/feeds update -a
1
./scripts/feeds install frr vxlan libpam liblzma libnetsnmp

Make config file

create the default config file

1
make defconfig

make config file. select which kernel model and package you need to add to OpenWRT

1
make menuconfig

Select target system

1644454983595.png

Kernel model

1
2
3
4
Kernel modules ---> Network Support --->
enable kmod-vlxan
enable kmod-veth
enable kmod-tun

1644455181686.png

Add frr

1
Network ---> Routing and Redirection ---> frr

1644455358487.png

add some tools

1
Network ---> Routing and Redirection
1
2
3
4
enable ip-bridge ## MUST vxlan forwording plane will use this tool
enable ip-full ## MUST create vxlan interface will use this tool
enable ss
enable tc-full

add vxlan

1
Network --->
1
enable vxlan ## MUST vxlan forwording plane will use this script

1644455697606.png

Make the image

1
make -j$(nproc) V=s