OW2
OpenWRT step by step building with comments for TP-LINK MR3020 and MR3040
Install / Use
/learn @cruxx/OW2README
OW2 Project
A step by step guide for building an OpenWRT firmware, installing and configuring it for TP-LINK MR3020 or MR3040 devices
Our objective is to obtain fully configured small device based on TP-LINK MR3020 or MR3040 router hardware with OpenWRT as firmware. It can be used for:
- Compact router with 3G/4G modem support
- Video surveillance (by USB web cam) device with ethernet, wifi or 3G/4G connectivity
- Remote, internet control of lighting, heating, automating etc. (need hardware hacks and additional components)
- Remote measure of temperature, air humidity, pressure and/or some other sensor reading (again need hw works)
- A lot of other things that can be powered by 400 MHz MCU and linux inside
Below are steps to build and configure OpenWRT:
- If you start from scratch, first you need to install all required packets on your host. Check http://wiki.openwrt.org/doc/howto/buildroot.exigence for prerequisites for your exact system. Below is Ubuntu-1404LTS-64bit example:
sudo apt-get install git-core build-essential subversion libncurses5-dev zlib1g-dev gawk intltool gcc-multilib flex libssl-dev
- Download the latest OpenWRT repo snapshot and all feeds by following commands:
git clone git://git.openwrt.org/openwrt.git
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a
-
Perform
make menuconfigand go to "Target Profile" in the main menu. Select "TP-LINK TL-MR3020" or "-3040", according to your hardware. Exit by pressing ESC ESC two time and confirm saving the config. -
Perform
make defconfig(that creates general configuration of the build system including a check of dependencies and prerequisites for your selected system -
Now you can already build your system with default settings/environment (it can take from 1 to 3 hours depend on your host performance, internet connection speed and other factors...
time make
make menuconfigand select:
- Base System -> block-mount (*)
- Boot Loaders -> uboot ( ) <-- remove selection
- Kernel Modules -> Filesystems -> kmod-fs-ext4 (*)
- Kernel Modules -> USB Support -> kmod-usb-storage-extras (*), kmod-usb-uhci (*)
Also you can select a lot of additional items depend of what you need for your exact system. Below are some examples:
- Kernel Modules -> USB Support -> kmod-usb-serial -> (M) <-- for 3G modems and other usb to serial converters
- Kernel Modules -> USB Support -> kmod-usb-serial-option -> (M) <-- for 3G modems
- Kernel Modules -> I2C support -> (M) <-- if you need i2c support - put (M) on required items
- Kernel Modules -> W1 support -> (M) <-- if you need 1-wire support - put (M) on required items
- Kernel Modules -> Video support -> (M) <-- if you need webcam support - put (M) on required items
- Multimedia -> mjpg-streamer (M)
- Multimedia -> motion (M)
- Network -> File Transfer -> curl (M)
- Network -> File Transfer -> wget (M)
- Network -> IP Addresses and Names -> ddns-scripts (M)
- Network -> Web Servers/Proxies -> lighttpd (M) -> lighttpd-mod-* (M) <-- put (M) on all lighttpd modules that you need
- Network -> wpad (*) if you need full IEEE 802.1x Authenticator/Supplicant for enterprise Wi-Fi networks, otherwise select wpad-mini (*)
- Utilities -> mc (M)
- Utilities -> comgt (M) <-- for 3G modems
- Utilities -> digitemp (M) (? - no in latest OpenWRT, need to check ?)
- Utilities -> haserl (M)
- Utilities -> oww (M) (? - no in latest OpenWRT, need to check ?)
- Utilities -> usb-modeswitch (M) <-- for 3G modems
time make V=s > build.log 2>errors.log it will create also build log and errors log in corresponding files
-
(optional) Create file
~openwrt/files/etc/config/fstaband ...(will be updated soon)... in order to have overlay filesystem (pivot overlay) on USB flash drive -
time make V=s > build.log 2>errors.logit will create also build log and errors log in corresponding files If build process aborts with error (of course not related with unavailable downloads) - sometimes it helps full rebuild:make dircleanand thenmakeagain -
After the build process completed successfully - you can install OpenWrt "*-squashfs-factory.bin" firmware from
~/youpathtoprojects/OW2/openwrt/bin/ar71xx/using manufacturer's WebGUI like a regular firmware update. Wait for the progress bar to finish twice (the device will reset itself in the process).
If your device is already on OpenWrt - just copy the firmware .bin file to/tmpand performmtd -r write /tmp/your_firmware_file.bin firmware -
Connect ethernet directly to you device and perform
telnet 192.168.1.1. After that usepasswdcommand to set a password to be able to connect throughsshand to copy files by usingscp -
Copy all files from
files/directory to corresponding places on your device. Check all shell scripts have execution permission, performchmod +x scriptnameif not. Enable init script by/etc/init.d/button_slider enable. If your device is MR3040 v1 (without slider) - need to correct the script in/etc/init.d/with only one option and also no need to copy to/etc/hotplug.d/button -
Copy all packages from
~/youpathtoprojects/OW2/openwrt/bin/ar71xx/packagesto ext4-formatted USB flash, insert it to your device, mount it and install all package you need byopkg update; opkg install thepackageswhatyouneed(remember to check free space on device's flash or use overlay filesystem on USB flash as in step #6). The file/etc/opkg.confshould be corrected properly to point to your USB flash. -
for 3G/4G usb modem support need to install the following:
opkg install comgt usb-modeswitch kmod-usb-serial-option(don't forget to update package list for opkg first:opkg update -
to be continued...
Related Skills
node-connect
351.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
110.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
351.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
351.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
