Difference between revisions of "OpenWrt"

From ElectroDragon
Jump to navigation Jump to search
(Menuconfig)
(Menuconfig)
Line 36: Line 36:
 
== Menuconfig ==
 
== Menuconfig ==
 
* * for build-in, M for modules
 
* * for build-in, M for modules
 +
* / for search box
 
   │ │                            Target Profile (Default Profile (all drivers))  --->                                      │ │   
 
   │ │                            Target Profile (Default Profile (all drivers))  --->                                      │ │   
 
   │ │                            Target Images  --->                                                                        │ │   
 
   │ │                            Target Images  --->                                                                        │ │   

Revision as of 07:42, 9 October 2019

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
  • Setup for MicroSD card & IOT Device mode or IOT gateway modes
Kernel modules    ---> 
 Other modules    ---> 
   <*> kmod-sdhci-mt7620 
  • Make it - make V=s

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/

Update

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

Openwrt Folder List

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  ---> 

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)

For AR9331

  • Target System (Atheros AR7xxx/AR9xxx) ---> │ │
  • Subtarget (Generic) --->
  • Target Profile (TP-LINK TL-WR720N v3) --->
  • Target Images ---> squashfs --->
  • Necessary options: uhttpd, luCi, libiwinfo-lua

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

IPK Application

  • Save src file at ./package/utils
  • In menuconfig -> Utilities , add this package

Compile

  • cd ./package/utils //enter into package/utils folder
  • mkdir hello_world //make“hello_world” folder for source code
  • cd hello_world
  • mkdir src //make src folder for source code
  • nano src/hello_world.c //create hello_world.c file in src
  • nano src/Makefile // add a new Makefile
  • make menuconfig
  • Utilities --->
<M> hello_world.................... Hello world -prints a hello world message 
  • make V=s
  • find installation file at openwrt/ bin/ramips/packages/base/hello_world_1.0_ramips_24kec.ipk

Install

  • opkg install /tmp/usbutils_007-1_ramips_24kec.ipk

Applications

  • 4G network card: kmod-mii, kmod-usb-net, kmod-usb-wdm, kmod-usb-net-qmi-wwan, uqmi
  • USB file system: ntfs-3g, kmod-fs-ext4, kmod-fs-vfat
  • Audio play: kmod-usb-audio, madplay-alsa
  • Audio Misc: zlib, libffi, libattr, libpthread, glib2, libflac, libmad, libcurl, libogg, libvorbisidec, mpd-mini
  • libmpdclient, mpc
  • USB webcamera: libjpeg, mjpg-streamer
  • Web SIP Call: zlib, libopenssl, libpthread, libre, librem, baresip, kmod-sound-core, kmod-usb-audio, librt, alsa-lib, baresip-mod-alsa

Luci Web Interface

  • Must install
uhttpd_2018-11-28-cdfc902a-3_mips_24kc.ipk
luci-theme-bootstrap_git-19.275.23087-48f58d9-1_all.ipk

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/