OpenWrt V22.03.2 Tossing Notes (Compilation)

-- Pole routing 1S (HC5661A)

Many years ago, I compiled an Openwrt V18.06 firmware with Asterisk15 (I used Lua language to develop a web configuration interface according to the gourd painting style) and an openVPN server, which can realize SIP client through the USB interface on the router (HC5661A’s USB self The Huawei E-180 3G network card on the installed) can make and receive calls, forward text messages (transfer to mobile phones, SIP clients, and emails are all possible) and other functions. After OpenVPN is connected, you can access the optical modem on the U disk. But Asterisk15 has a disadvantage, that is, during the call, if both parties are talking, the call quality will be very poor. The poor call quality has little to do with the hardware performance of the router, because I have tried a dual-core CPU router with better performance, and it is the same. Later, this mobile phone card was used in my daughter's phone watch, and it has been used as a switch for TV and TV boxes in the living room.

After many years, now the stable version of OpenWrt has been updated to V22, and Asterisk has also been updated to V18. In addition, because I bought a new WIFI6 router as the main router, (I have been using all cats as the main router before, Huawei HS8145V? I forgot which version ), the U disk inserted in the optical modem cannot be shared, and the function of the private cloud disk cannot be realized, and the old version of Openwrt cannot be installed with NTFS-3G, and cannot be written after sharing with Samba. Therefore, I tossed the V22 version of OpenWrt.

First, install the virtual machine VMware Workstation Pro on the computer. I used the V14 version. I installed Ubuntu and installed 3 versions, namely 18.04.2, 20.04.5 and 22.04.1, and then selected 22.04.1 To compile OpenWrt V22.03.02

Let me talk about the tossing method first. After compiling, the U disk cannot be recognized. The Kmod module to be installed is selected in the configuration menu. After compiling, it is not recognized. The system log and core log cannot see the USB inserted. Any information, it was recognized directly in V18 before, is it not supported by the new version of the Linux kernel? Anyway, it was disassembled for a long time, and later found that in the hardware configuration file of DTS, disable USB, change it to okay, and then compile it normally. In addition, this router actually has an SD card slot, and the DTS configuration file is also disabled, but if it is enabled, the Lan port will not work normally. It is said that the IO port is shared with the Lan, and OpenWrt does not adapt it separately, so temporarily Give up and continue to toss, we have a USB is enough.

I still use the inverted narrative method, first take a look at this DTS configuration file, in the Openwrt/target/Linux/ramips/dts directory: (The step I am talking about now is modified before Make, and I will mention it later )

5586cc7803bc42d785ddb3666beda8cd.png

 

Open it with a text editor, change the status = "disable" in &ehci and &ohci to status = "okay", as shown in the figure.

9f4634191e244e2cad50f219f724b624.png

Regarding the establishment of the compilation environment, I also refer to the official website of OpenWrt, URL: [OpenWrt Wiki] Build system setup

After installing Unbuntu in the virtual machine, start it, enter the desktop, right-click to open the terminal, and first update the software source.

After that, we need to install the tool packages needed to compile OpenWrt

sudo apt update
sudo apt install build-essential clang flex g++ gawk gcc-multilib gettext \
git libncurses5-dev libssl-dev python3-distutils rsync unzip zlib1g-dev

The above applies to compiling packages that support versions 22.03 and 21.02. Compiling them no longer requires python2.7, and python3 is already built in ubuntu 22.04.

If you compile an older version, you need to install the following software packages (I compile the latest version here, so I don’t need to install the following software):

sudo apt update
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 \
python-distutils-extra python3-setuptools python3-dev rsync subversion \
swig time xsltproc zlib1g-dev

After the compilation environment is established, follow these steps also refer to the official website, [OpenWrt Wiki] Build system usage

I'm just a vernacular translator, haha!

Note that the following instructions do not need to be executed as root. If you use root, an error may be reported. After compiling, everything in the firmware belongs to the root user. Moving files and changing files under the window requires root identity, which is not easy to operate.

Start cloning the code from the repository

git clone https://git.openwrt.org/openwrt/openwrt.git
cd openwrt
git pull

git clone can also clone from https://github.com/openwrt/openwrt (it seems that the network speed is slower), after switching to the openwrt directory, use git pull to pull the update. Look at your preferences here, and it's the same if you don't pull updates. It's just official

Then, after git tag, many versions will be listed, press the down key on the keyboard until END appears after the last version, press q to exit, and then git checkout v22.03.2, this step is to chekout the version we need to compile.

git tag
git checkout v22.03.2

 The next step is to update and install feeds, the two instructions are merged and executed together

./scripts/feeds update -a && ./scripts/feeds install -a

After the execution here, we can modify the DTS file. After the modification, proceed to the following steps.

Then enter the configuration menu of openwrt, maximize the virtual machine, so as not to prompt that the ranks and columns are not wide enough to display errors.

make menuconfig

 After the command is executed

818255e34dd843fbbe2e06a4a895008f.png

For this configuration, I won’t go into details about how to choose it, what functions I want to achieve, and what packages I need, you can use Baidu. After the configuration, remember to save it. The one with * is compiled into the firmware, and the one with M is compiled into the IPK installation package, depending on the actual needs.

If necessary, you can also enter the kernel configuration menu, make -j4 kernel_menuconfig V=99, this first entry will be very slow, maybe more than half an hour, depending on the network and computer configuration, this step needs to install and download the compilation chain tool, generally we There is no need to enter here, because it contains the configuration of the Linux kernel, which most people cannot understand. (make -j4 The 4 here means to enable 4-core compilation, see how many CPUs are available for your virtual machine, just fill in -j number, V=99 displays all compiled information, and V=s means the same)

Then you can directly use make -j4 V=99 to compile, and check the configuration and network performance. If no error is reported, the router firmware can be compiled in an hour or two. The generated firmware is saved in /openwrt/bin/targets/directory named by CPU chip architecture file/directory named by CPU chip/, for example, my HC5661A is generated in /openwrt/bin/targets/ramips/mt76x8/.

make -j4 V=99

In addition, before executing make -j4 V=99, we can also use the following command first to download the things that need to be downloaded first, depending on personal preference.

make -j4 download V=99

At this point the entire compilation is complete. Let's share the Samba4 network in the next article!

 

 

Guess you like

Origin blog.csdn.net/dream52/article/details/127485701