Category:Openwrt

From ElectroDragon Wiki
Revision as of 22:32, 31 January 2020 by Chao (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Compile

branch openwrt-18.06: git clone -b openwrt-18.06 https://github.com/openwrt/openwrt.git
branch chaos_calmer is legacy: git clone -b chaos_calmer https://github.com/openwrt/openwrt.git
  • update
cd openwrt          //enter into openwrt folder
./scripts/feeds update -a     // update install package
./scripts/feeds install -a      //install updates
  • make menuconfig
  • Predownload: make download
  • Make it - make V=s
  • Make sure do not select buid in kernel or libaries, otherwise firmware image is boo big to be generated!!

Compile a Single Package

  • For package wifidog: make package/wifidog/compile -j V=99

output

Firmware

  • /openwrt/bin/ramips/openwrt-ramips-mt7628-mt7628-squashfs-sysupgrade.bin
  • /openwrt/bin/targets/ar71xx/generic/openwrt-ar71xx-generic-tl-wr710n-v2.1-squashfs-factory.bin

IPK packages

  • /openwrt/ bin/ramips/packages/
  • /openwrt/bin/targets/ar71xx/generic/packages/”
  • /openwrt/bin/packages/

Flash

Via web interface

  • Firmware could be updated via LUCI webpage

Via CLI command sysupgrade

  • use SCP copy file to openwrt /tmp folder, and run command: sysupgrade -v openwrt-ar71xx-generic-tl-wr842n-v3-squashfs-sysupgrade.bin
  • For the following error, run -F to force update:
Invalid image, hardware ID mismatch, hw:07200103 00000001 image:08420003 00000001.

Via CLI command mtd

  • mtd -r write /tmp/original_firmware.bin firmware
  • mtd -r write /tmp/original_firmware.bin linux

Via B-boot and TFTP network

  • Set PC ethernet ip address to 192.168.1.111 first
  • Connect PC and target by ethernet cable
ping 192.168.1.111
setenv serverip 192.168.1.111
tftp 0x80002000 lede-ar71xx-generic-tl-wr720n-v3-squashfs-sysupgrade-20170808.bin
erase 0x9f020000 +0x400000
cp.b 0x80002000 0x9f020000 0x400000

Openwrt Folder List

  • Hostname, timezone, ip address: /package/base-files/files/bin/config_generate
  • Wifi information: /package/kernel/mac80211/files/lib/wifi/mac80211.sh
  • SSH login info: /package/base-files/files/etc/banner
  • Router connection: /package/base-files/files/etc/sysctl.conf
  • Luci depends: /feeds/luci/collections/luci/Makefile

Menuconfig

  • * for build-in, M for modules
  • / for search box
 │ │                            Target Profile (Default Profile (all drivers))  --->                                       │ │   
 │ │                            Target Images  --->                                                                        │ │   
 │ │                            Global build settings  --->                                                                │ │   
 │ │                        [ ] Advanced configuration options (for developers)  ----                                      │ │   
 │ │                        [ ] Build the OpenWrt Image Builder                                                            │ │   
 │ │                        [ ] Build the OpenWrt SDK                                                                      │ │   
 │ │                        [ ] Package the OpenWrt-based Toolchain                                                        │ │   
 │ │                        [ ] Image configuration  --->                                                                  │ │   
 │ │                            Base system  --->                                                                          │ │   
 │ │                            Administration  --->                                                                       │ │   
 │ │                            Boot Loaders  ----                                                                         │ │   
 │ │                            Development  --->                                                                          │ │   
 │ │                            Extra packages  ----                                                                       │ │   
 │ │                            Firmware  --->                                                                             │ │   
 │ │                            Fonts  --->                                                                                │ │   
 │ │                            Kernel modules  --->                                                                       │ │   
 │ │                            Languages  --->                                                                            │ │   
 │ │                            Libraries  --->                                                                            │ │   
 │ │                            LuCI  --->                                                                                 │ │   
 │ │                            Mail  --->                                                                                 │ │   
 │ │                            Multimedia  --->                                                                           │ │   
 │ │                            Network  --->                                                                              │ │   
 │ │                            Sound  --->                                                                                │ │   
 │ │                            Utilities  --->                                                                            │ │   
 │ │                            Xorg  ---> 

Base System

  • base-files
  • busybox
  • dnsmasq
  • dropbear
  • firewall
  • fstools
  • fwtool
  • jsonfilter
  • lede-keyring
  • libc
  • libgcc
  • libpthread
  • logd
  • mtd
  • netifd
  • opkg
  • procd
  • rpcd
  • swconfig
  • ubox
  • ubus
  • ubusd
  • uci
  • usign

Multimedia

   Streaming  --->                                                                            │ │   
 │ │                        < > crtmpserver.............................................. C++ RTMP Server
 │ │                        < > ffmpeg.................................................... FFmpeg program                  │ │   
 │ │                        < > ffprobe...................................... FFmpeg CLI media identifier                  │ │   
 │ │                        < > ffserver......................................... FFmpeg streaming server                  │ │   
 │ │                        < > fswebcam........................................................ fswebcam                  │ │   
 │ │                        < > gphoto2.................................... Gphoto Digital Camera Control                  │ │   
 │ │                        < > grilo.............................................................. grilo                  │ │   
 │ │                        < > grilo-plugins............................ Plugins for the Grilo framework  ----            │ │   
 │ │                        < > gst1-libav........................................ GStreamer Libav plugin                  │ │   
 │ │                        < > gstreamer1-libs................................. GStreamer core libraries                  │ │   
 │ │                        < > gstreamer1-plugins-bad................ GStreamer plugins collection (bad)                  │ │   
 │ │                        < > gstreamer1-plugins-base.............. GStreamer plugins collection (base)                  │ │   
 │ │                        < > gstreamer1-plugins-good.............. GStreamer plugins collection (good)                  │ │   
 │ │                        < > gstreamer1-plugins-ugly.............. GStreamer plugins collection (ugly)                  │ │   
 │ │                        < > gstreamer1-utils..................................... GStreamer utilities                  │ │   
 │ │                        < > icecast.... A streaming media server for Ogg/Vorbis and MP3 audio streams                  │ │   
 │ │                        < > lcdgrilo........................................................ lcdgrilo                  │ │   
 │ │                        < > minidlna.................................... UPnP A/V & DLNA Media Server                  │ │   
 │ │                        < > mjpg-streamer.............................................. MJPG-streamer  ----            │ │    for use camera 
 │ │                        < > motion................................. webcam motion sensing and logging                  │ │   
 │ │                        < > tvheadend................... Tvheadend is a TV streaming server for Linux                  │ │   
 │ │                        < > v4l2rtspserver............................................ v4l2rtspserver                  │ │   
 │ │                        < > vips....................................... An image manipulation library                  │ │   
 │ │                        < > xupnpd............................................. eXtensible UPnP agent                  │ │   
 │ │                        < > youtube-dl................... Utility to download videos from YouTube.com                  │ │   
 │ │                        < > youtube-dl-src..... Utility to download videos from YouTube.com (sources)


Build and Use Toolchain

  • in menuconfig, tick option "Build the OpenWrt based Toolchain"
  • Toolchain can be found at "/bin/ramips/OpenWrt-Toolchain-ramips-mt7628_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-i686.tar.bz2"
  • Install toolchain: sudo tar -jxvf ./bin/ramips/OpenWrt-Toolchain-ramips-mt7628_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-i686.tar.bz2 -C /opt/

C application

  • Compile use mipsel-openwrt-linux-gcc
  • mipsel-openwrt-linux-gcc hello_world.c -o hello_world

Run the complied application

  • chmod +x /tmp/hello_world //add executable rights
  • /tmp/hello_world //run“hello_world”application


System Setup

Wireless Config /etc/config/wilress

config wifi-device 'radio0'
        option type 'mac80211'
        option channel '11'
        option hwmode '11g'
        option path 'platform/10300000.wmac'
        option htmode 'HT20'
        option disabled '0'

config wifi-iface 'default_radio0'
        option device 'radio0'
        option network 'lan'
        option mode 'ap'
        option ssid 'Electrodragon'
        option encryption 'none'
  • After using LUCI config, connect to local AP as openwrt client:

Wireless Config /etc/config/wilress

config wifi-device 'radio0'
        option type 'mac80211'
        option hwmode '11g'
        option path 'platform/10300000.wmac'
        option htmode 'HT20'
        option disabled '0'
        option channel '10'
        option country '00'
        option legacy_rates '1'

config wifi-iface 'default_radio0'
        option device 'radio0'
        option network 'lan'
        option mode 'ap'
        option ssid 'Electrodragon'
        option encryption 'none'

config wifi-iface
        option network 'wwan'
        option ssid '123'
        option encryption 'psk2'
        option device 'radio0'
        option mode 'sta'
        option bssid 'F0:0F:EC:FD:95:84'
        option key 'electrodragon'

Wifi

  • vi /etc/config/network

Restart network

  • #/etc/init.d/network restart
  • #ifconfig br-lan
  • If error "radio0' is disabled"
uci set wireless.radio0.disabled=0
wifi
  • Compile to default turn on, and SSID, file at nano ./package/kernel/mac80211/files/lib/wifi/mac80211.sh
set wireless.radio${devidx}.disabled=0
set wireless.default_radio${devidx}.ssid=Electrodragon
        uci -q batch <<-EOF
            set wireless.radio${devidx}=wifi-device
            set wireless.radio${devidx}.type=mac80211
            set wireless.radio${devidx}.channel=${channel}
            set wireless.radio${devidx}.hwmode=11${mode_band}
            ${dev_id}
            ${ht_capab}
            set wireless.radio${devidx}.disabled=0
 
            set wireless.default_radio${devidx}=wifi-iface
            set wireless.default_radio${devidx}.device=radio${devidx}
            set wireless.default_radio${devidx}.network=lan
            set wireless.default_radio${devidx}.mode=ap
            set wireless.default_radio${devidx}.ssid=Electrodragon
            set wireless.default_radio${devidx}.encryption=none
  • Default wifi configuration find at : vi /etc/config/wireless

Reset

  • firstboot

Hardware Remap Reset Pin

  • TL-WR710N check the remap settings
  • Find openwrt raw definition file at ./target/linux/ar71xx/files/arch/mips/ath79/
  • find .|xargs grep -ri "WR710N" to find mach-tl-wr703n.c file which is associated
  • Edit

Usage

  • No need to setup anything for firewall
  • Apps list can check on this page category: Linux
  • Use Transmission
  • change mode to STA-client -> wifi -> find SSID:openwrt -> edit -> mode -> client -> scan -> join network -> enter password -> save

Luci

Programming tutorial in chinese

Relvant connector can check this page: feeds/luci/modules/luci-base/luasrc/

Reference

Pages in category "Openwrt"

The following 7 pages are in this category, out of 7 total.