1. This time we will use the open-source OPENWRT source code for compilation. OpenWRT is a highly modular and automated embedded Linux system, with powerful network components and extensibility, often used in industrial control devices, telephones, small robots, smart homes, routers, and VOIP devices. It also provides over 100 pre-compiled software packages, and the number continues to increase. It is a fully functional router operating system that is easy to modify and written from scratch.
2. This time, we will use the Phicomm K3 as the adapted router.
3. Compilation Environment: Using Ubuntu 64bit as the firmware compilation environment, recommended Ubuntu 18 LTS x64.
a) System Update
sudo apt-get update
b) Install the necessary basic environment for compilation by executing the following command
sudo apt-get -y install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch python3.5 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
Wait for a while until the installation is complete.
This compilation uses the open-source repository from LEDE: https://github.com/coolsnowwolf/lede
1. Clone the Source Code and Enter the Working Directory
1. Use
git clone https://github.com/coolsnowwolf/lede.git
Command to download the source code, then cd lede to enter the directory. Do not use the root account during the editing process, otherwise, the compilation process may easily go wrong.
2. Update Packages
1. Execute the following command to update feeds (third-party packages)
./scripts/feeds update -a
2. Execute the following command to install feeds (third-party packages)
./scripts/feeds install -a
3. Configure the Firmware Menu
make menuconfig
<*> indicates that the package will be compiled into the firmware, <M> indicates that the package will be compiled but not included in the firmware. <> indicates not selected.
Option DescriptionTarget System Target device chip typeSubtarget Target sub-type, usually specific board typeTarget Profile A specific option parameter made for different router versions, generally default is okayTarget Images The partition format of the generated firmware fileGlobal build settings Some global parameters during compilation, these parameters relate to the Linux kernel or GCC compilerAdvanced configuration options Advanced option parameters, used for OpenWrt developers, generally not usedBuild the OpenWrt Image Builder Besides compiling firmware, compile a firmware compilation environment that can be distributed to other team members. Generally, vendors do not want to open all their source code, providing this to third-party partnersBuild the OpenWrt SDK Generate OpenWrt SDK environment, which is another development environmentBuild the OpenWrt based Toolchain Compile OpenWrt cross-compilation tools separatelyImage configuration Parameters information attached to the compiled firmwarePackage features Some software package featuresBase system Basic system command software packageAdministration Advanced management command software packageBoot Loaders Boot program, teaching board does not need firmware to be attached, so there are no optionsDevelopment Development tool packageFirmware Do not be confused by the name, this means whether the firmware includes certain other peripheral chip firmwareKernel modules Kernel compilation parameters, these parameters come from the chip manufacturer's preset configurationLanguages Programming language software packagesLibraries Library software packagesLuCI The famous LuCI interface package under OpenWrtMail Email-related software packagesMultimedia Multimedia software packagesNetwork Network-related software packagesSound Sound-related software packagesUtilities Utility software packagesVideo Streaming Video streaming service software package
4. Target System Selection
The Phicomm K3 uses the ARM architecture Broadcom BCM4709C processor, so select Broadcom BCM47XX/53XX (ARM).
5. Target Profile Selection
6. Next, Add LUCI
The path is LUCI-collections-LUCI
LuCI Configuration (web management program):-LuCI —> 1. Collections —> luci Enable LuCI-LuCI —> 3. Applications —> luci-app-commands Web Shell-LuCI —> 3. Applications —> luci-app-ddns Dynamic Domain Name-LuCI —> 3. Applications —> luci-app-firewall Firewall-LuCI —> 3. Applications —> luci-app-ntpc Time Synchronization Server-LuCI —> 3. Applications —> luci-app-qos Internet Management-LuCI —> 3. Applications —> luci-app-samba Network Sharing-LuCI —> 4. Themes —> luci-theme-bootstrap Default Theme
Below are my custom selection modules
Select frpc
Select qos
Here are a few selections that might be useful
Themes
Protocols
Below are detailed configuration instructions (please select according to your needs during actual use, otherwise, the firmware may be too large (referring to 4M Flash version) and cannot be generated):
LuCI ---> Applications ---> luci-app-accesscontrol # Access Time ControlLuCI ---> Applications ---> luci-app-adbyby-plus # Ad Blocker PlusLuCI ---> Applications ---> luci-app-arpbind # IP/MAC BindingLuCI ---> Applications ---> luci-app-autoreboot # Support Scheduled RebootLuCI ---> Applications ---> luci-app-ddns # Dynamic Domain Name DNS (integrated Ali DDNS client)LuCI ---> Applications ---> luci-app-filetransfer # File Transfer (can web install ipk package)LuCI ---> Applications ---> luci-app-firewall # Add FirewallLuCI ---> Applications ---> luci-app-flowoffload # Turbo ACC Network Acceleration (integrated FLOW, BBR, NAT, DNS...)LuCI ---> Applications ---> luci-app-frpc # Internal Network Penetration FrpLuCI ---> Applications ---> luci-app-guest-wifi # WiFi Guest NetworkLuCI ---> Applications ---> luci-app-ipsec-virtuald # Virtual Server IPSecLuCI ---> Applications ---> luci-app-mwan3 # MWAN3 Load BalancingLuCI ---> Applications ---> luci-app-mwan3helper # MWAN3 Shunt AssistantLuCI ---> Applications ---> luci-app-nlbwmon # Network Bandwidth MonitorLuCI ---> Applications ---> luci-app-pptp-server # Virtual Server PPTP
Kernel modules (Kernel modules):Kernel modules ---> USB Support ---> kmod-usb-ohci Support USB 1.0Kernel modules ---> USB Support ---> kmod-usb-storage Support USB StorageKernel modules ---> USB Support ---> kmod-usb-uhci Support USB 1.1Kernel modules ---> USB Support ---> kmod-usb2 Support USB 2.0Kernel modules ---> Video Support ---> kmod-video-coreKernel modules ---> Video Support ---> kmod-video-cpia2Kernel modules ---> Video Support ---> kmod-video-gspca-coreKernel modules ---> Video Support ---> kmod-video-pwcKernel modules ---> Video Support ---> kmod-video-uvcKernel modules ---> Video Support ---> kmod-video-videobuf2MultimediaMultimedia---> mjpg-streamerNetworkNetwork---> File Transfer ---> vsftpd FTP ServerNetwork---> ser2net
7. After Configuration, Save
The first compilation will download a large amount of source code, so for speed, the simpler the package, the better. Next, press ESC to exit, then exit again, and finally, it will prompt to save. Now it’s time to start the exciting compilation.
8. Download the DL Library
make -j8 download v=s
Download the DL library (please try to access the internet globally in China)
9. Start Compiling Firmware
Input
make -j1 V=s
( -j1 indicates the number of threads. It is recommended to use a single thread for the first compilation) to start compiling the firmware you want.
Successfully compiled the firmware
openwrt-bcm53xx-phicomm-k3-squashfs.trx
References
https://github.com/coolsnowwolf/lede
https://blog.csdn.net/sensiki/article/details/70271533
https://aisoa.cn/post-2574.html
Original Source: Tide Security Team