当前位置:网站首页>Compile your own openwrt firmware using Tencent cloud lightweight application server

Compile your own openwrt firmware using Tencent cloud lightweight application server

2022-06-23 03:10:00 Qingyang

Use Tencent cloud lightweight application server to compile your own Openwrt The firmware

Preface

Some time ago, I used my old notebook at home to create a one arm route to play , Limited by the performance limitation of single arm routing as the master routing , So I started with a USB3.0 To Gigabit network card , To form the primary route of the dual network cards , Realize my own needs , But the firmware used by the big guys in the group is incompatible bug The network card runs for more than ten hours usb The network card will restart , So I compiled a firmware myself , I don't have any suitable tutorials on the Internet , There are certain twists and turns in the middle . So here I will record the use Tencent cloud Of Lightweight application servers Compilation process , Let us not go into the pit .

compile OpenWrt I spent most of my time building the compilation environment , Because compiling requires a lot of dependencies , Fortunately Lean Big has helped me tidy up , Just follow the steps .

Preparation

  1. One server ( It's OK to have no virtual machine ) It is recommended to buy a server . The address is in the relevant link .
  2. lean What is recommended is Ubuntu 20.04 LTS x64 System , Pay attention to the system when purchasing or installing virtual machines .
  3. Have a certain practical ability , Reach for the party 、 If the disabled see here, they can stop looking .

Environment building

Here we use the lightweight application server of Tencent cloud in Hong Kong , You don't have to follow the system steps , Remember to select the image as required . adopt ssh Tools login ubuntu. After logging in, you need to update the source , Tencent is its own source by default , Very fast .

This is the server configuration I selected .

If you use it for a short time, you can buy it for one month , The higher the configuration, the faster the compilation ( It mainly depends on the number of cores )

Be careful :

  1. Do not use root The user compiles !!!
  2. Compiled firmware , Default login IP 192.168.1.1, password password

Dependent installation

sudo apt update 
sudo apt-get -y 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

When the installation is complete , It takes a little time , Just a few minutes .

Source download

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

Download the source code , then cd lede Entry directory . Here again , It is recommended to use the lightweight application server of Tencent cloud in Hong Kong , Or you can open a global agent by yourself ( There is no explanation here ). If you do not use a server or agent in Hong Kong, the compilation may fail because some sources are blocked .

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

make defconfig It will check whether the required compilation tools are complete , And generate the default compilation configuration file .config

Configure compile options

Input... At the terminal :

make menuconfig

The interface looks like this .

In the later stage, I will see if the students' needs are explained

After entering, you can use the up and down keys on the keyboard to select the platform you want to compile , such as X86 platform , Or other platforms , Then select some necessary software packages . In the selection process , Press Enter Is to enter the configuration , English input method press Y Is to determine the choice , Press N Yes deselect , After all selections are configured , Press two Esc Is to opt out , Finally, save and exit to generate .config The configuration file .

Download the source code

After the configuration is completed, you need to download the software you selected and the necessary files ,OpenWrt Only compile and configure instructions , Various dependent code packages are stored in upstream websites and code warehouses , Compiling will download a lot of source code

make -j8 download V=s  ---- download dl library 

In this step, if an agent is used, the network speed and stability of the agent will determine the time , If it is a server in Hong Kong , Just a minute .

Compiling system

install screen

It is recommended to use screen To hang the compiled process in the background , Prevent the terminal from being disconnected for various reasons ( It is usually network fluctuation or misoperation ) Losing session compilation will break , Use screen There will be no such problem if it is hung in the background .

install screen:

sudo apt install screen

screen Use -S Command to create a session :

screen -S openwrt

Press on the keyboard Ctrl +A +D It can be attached to the background , If you need to view the background session input :

screen -ls

Execute the above command and you will see that we are attached to the background openwrt conversation , Switch to openwrt conversation :

screen -r openwrt

If you have only one conversation, you can omit the following openwrt, Default to the first , If more than one is compiling , When you create a new window , Use different names to distinguish .

Compilation and thread

make V=s -j1

-j1 Followed by the number of threads . Single thread is recommended for the first compilation , If you have confidence in yourself , There are only a few cores in the server configuration , Start compiling the firmware you want , Whether it is simple or complex is up to you the final say .

Last

Author site

The personal blog address is :https://www.hipyt.cn/

Links to this article

Lean Big LEDE The firmware

Tencent cloud lightweight server

原网站

版权声明
本文为[Qingyang]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/01/202201212252505587.html