User Tools

Site Tools




minimal file upload using cgi script from stdin to /dev/null (or usb)
<form target="frm" action="" enctype="multipart/form-data" method="post">
<input type="file" name="datafile" size="40">
<input type="submit" value="Send">
<iframe name="frm" width="100%" height="300">
echo "Content-type: text/plain"
echo ""
- > /dev/null  # or cat > /dev/null
echo "ok"
echo ""
echo ""
tail logs through netcat

on router:
logread -f | nc 8081

on pc:
nc -l 8081

system.lua source
How to transfer a file from OpenWrt to your computer in Failsafe mode

On OpenWrt

sysupgrade --create-backup /tmp/backup.tar.gz   # create the file
nc 3333 < /tmp/backup.tar.gz        # push the file to the netcat server on your computer

On your computer:

nc -l 3333 > backup.tar.gz          # run a server to receive the file from the router
Flash new firmware in failsafe mode (via netcat)
read sliding switch on boot to select network configuration
info about file upload/post to openwrt
image generator osx
docker run -it ubuntu /bin/bash
apt-get update
apt-get install subversion build-essential libncurses5-dev zlib1g-dev gawk git ccache gettext libssl-dev xsltproc
make image PROFILE=TLMR3020 PACKAGES="kmod-usb-storage block-mount kmod-fs-ext4 kmod-usb-serial-ftdi kmod-usb-serial kmod-usb-acm uclibcxx liblua libuci luafilesystem libuci-lua libiwinfo-lua uhttpd uhttpd-mod-lua libusb-1.0 libncurses openssh-sftp-server -luci"
#last step fails
minimale aanpak

verbind met internetverbinding van je router

uci set network.lan.ipaddr=
uci delete wireless.@wifi-device[0].disabled #enable radio
uci set wireless.@wifi-iface[0].network=wan
uci set wireless.@wifi-iface[0].mode=sta
uci set wireless.@wifi-iface[0].ssid=Baksteen
uci set wireless.@wifi-iface[0].key=...
uci set wireless.@wifi-iface[0].encryption=psk2
uci set network.wan=interface 
uci set network.wan.proto=dhcp #get ip from router
uci commit

avahi voorbeelden toevoegen voor Bonjour/zeroconf:

opkg update
opkg install avahi-daemon-service-ssh avahi-daemon-service-http

uhttpd installeren

opkg update
opkg install uhttpd
echo hoi > /www/index.html
mkdir /www/cgi-bin
#plaats een cgi script zie

standaard zit er al wget op. dat zit in busybox. maar het ondersteund geen SSL.

tmpfs heeft ongeveer 13MB RAM vrij. dus wget zou in principe een bestand van die grootte moeten kunnen bewaren in /tmp. (getest met een GIFje, dat gaat goed). Maar beter wat ruimte overlaten.


opkg update
opkg install ser2net
#wat info hier:
#en hier een filmpje:
vi /etc/ser2net.conf
#alle /dev devices uitcommenten behalve degene van jouw seriele poort, of die toevoegen:
# 1234:raw:0:/dev/ttyACM0:9600

eerst misschien nog driver voor USBserieel installeren:

opkg install kmod-usb-acm

vervolgens kun je als ser2net draait letterlijk via telnet ontvangen en versturen.
maar ja.. je wil het liefst een groot bestand in stukje gaan binnenhalen vanaf het web en ook in stukjes sturen vanaf de box zelf naar de seriele poort… Dus misschien is UltiFi ( of iets anders zelf geschreven nog niet zo gek.

minimal settings for internet and lan
uci set network.lan.ipaddr=
uci delete wireless.@wifi-device[0].disabled #enable radio
uci set wireless.@wifi-iface[0].network=wan
uci set wireless.@wifi-iface[0].mode=sta
uci set wireless.@wifi-iface[0].ssid=........
uci set wireless.@wifi-iface[0].key=........
uci set wireless.@wifi-iface[0].encryption=psk2
uci set network.wan=interface 
uci set network.wan.proto=dhcp #get ip from router
uci commit
settings from Doodle3D WiFi-Box
Disabling default route and DNS server for lan network interface

This way you don't have to set the order of WiFi and Ethernet.

uci set dhcp.lan.dhcp_option='3 6'
uci commit dhcp
/etc/init.d/dnsmasq reload
add custom Bonjour/mDNS/zeroconf etc service


<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
 <name replace-wildcards="yes">%h</name>

/etc/init.d/avahi-daemon reload

discussion about doodle3d network module
dev tutorials
own packages
clone package source

to have the make file clone from the PKG_SOURCE_URL update the PKG_VERSION

./up3dload: line 1: syntax error: unexpected "("

Cause: When you get this error on the binary you try to run on your OpenWrt device has the wrong architecture. Run file up3dload to see the architecture.

Solution: Make sure the .o files and the osx executable are not copied to the build_dir. Perform a make clean in the src/ folder of the package before make package/up3dload/compile when you did a make in your src folder to test locally.

get all strings from a binary
strings testscript
/bin/ash: testscript: not found
/bin/ash: testscript: not found

file not found usually means that a dependant library wasn't found.

file /Volumes/OpenWrt/openwrt/build_dir/target-mips_34kc_musl-1.1.14/testscript/ipkg-ar71xx/testscript/bin/testscript
/Volumes/OpenWrt/openwrt/build_dir/target-mips_34kc_musl-1.1.14/testscript/ipkg-ar71xx/testscript/bin/testscript: ELF 32-bit MSB executable, MIPS, MIPS32 rel2 version 1, 
dynamically linked (uses shared libs), corrupted section header size

this was caused by having installed the downloaded binary of OpenWrt 15.05 instead of the one I compiled against. Maybe the difference between uClibC vs musl?

default_postinst: not found

probably because trying to install a package compiled on 15.05 to a 14.07.

build single package


(different snippets)

./scripts/feeds update customfeeds
./scripts/feeds install up3dload

# ? ./scripts/feeds update -a
# ? ./scripts/feeds install testscript
make package/testscript/prepare
make package/testscript/compile -j1 V=s
make package/testscript/install
make package/print3d/prepare
make package/print3d/compile
make package/print3d/install
make package/index
[Howto](AAP) Automated Wifi network change if the current fails
AP + STA at the same time
Stappen Image Builder
  • staat op : rick@ubuntu:~/Desktop/OpenWrt-ImageBuilder-15.05-ar71xx-generic.Linux-x86_64

tar -xvjf OpenWrt-ImageBuilder-15.05-ar71xx-generic.Linux-x86_64.tar.bz2

  • zorg voor dependencies:

apt-get install subversion build-essential libncurses5-dev zlib1g-dev gawk git ccache gettext libssl-dev xsltproc

  • voeg customfeeds toe aan de packages folder (maak een mapje customfeeds met daarin ipk bestanden van je customfeeds dus die moet je wel eerst ergens bouwen)

mkdir packages/customfeeds

  • run image generator

make image PROFILE=TLMR3020 PACKAGES="wifibox -ppp -kmod-ipv6"

  • creates image in bin/ar71xx folder. scp ….squashfs-sysupgrade.bin file to the /tmp folder of the box and run

sysupgrade -v- n /tmp/openwrt….squashfs-sysupgrade.bin

  • Er was nog een probleem met dat er iets niet geconfigureerd was als je het gemaakte image op een wifibox plaatste. Volgens mij werd de print3d niet automatisch opgestart of herstart. inotify ging niet goed ofzo omdat dat een SETTING was ipv een DEPENDENCY.
ch340 driver info
updated sources list for barrier_breaker


dest root /
dest ram /tmp
lists_dir ext /var/opkg-lists
option overlay_root /overlay
src/gz barrier_breaker_base
src/gz barrier_breaker_telephony
src/gz barrier_breaker_oldpackages
src/gz barrier_breaker_packages
src/gz barrier_breaker_routing
src/gz barrier_breaker_luci
src/gz barrier_breaker_management
set baudrate in uboot baudrate: a decimal number that selects the console baudrate (in bps). Only a predefined list of baudrate settings is available.
When you change the baudrate (using the “setenv baudrate …” command), U-Boot will switch the baudrate of the console terminal and wait for a newline which must be entered with the new speed setting. This is to make sure you can actually type at the new speed. If this fails, you have to reset the board (which will operate at the old speed since you were not able to saveenv the new settings.)
If no “baudrate” variable is defined, the default baudrate of 115200 is used.

  • connect to serial: screen /dev/tty.usbserial 115200
  • type tpl when 'Autobooting' message is visible
  • printenv to see variables
  • setenv baudrate 9600 gives error Baudrate 9600 bps not supported
Allow SSH on WAN interface

Add to /etc/config/firewall

config rule
        option name             allow-SSH-wan
        option src              wan
        option proto            tcp
        option dest_port        22
        option target           ACCEPT
        option family           ipv4

restart firewall service

/etc/init.d/firewall reload
Allow HTTP on WAN interface

Add to /etc/config/firewall

config rule
        option name             allow-HTTP-wan
        option src              wan
        option proto            tcp
        option dest_port        80
        option target           ACCEPT
        option family           ipv4

restart firewall service

/etc/init.d/firewall reload
documentation for 'iw'
change ip temporary
ifconfig eth0
failsafe tftp
wifi status
wifi status
netwerk status
cat /var/state/network
openwrt mirror op github
setup wireless AccessPoint & connect as a station to an existing WiFi network (simultaneously)
# remove default OpenWrt AccessPoint
uci delete wireless.@wifi-device[0].disabled
uci delete wireless.@wifi-iface[0]

# Wireless AccessPoint
uci set wireless.ap=wifi-iface
uci set wireless.ap.device=radio0
uci set
uci set wireless.ap.mode=ap
uci set wireless.ap.encryption=none
uci set wireless.ap.ssid=Doodle3D

# Wireless Station
uci set wireless.sta=wifi-iface
uci set
uci set wireless.sta.mode=sta
uci set wireless.sta.ssid=Baksteen
uci set wireless.sta.encryption=psk2
uci set wireless.sta.device=radio0

# Setup network interface ‘lan’ to be used by Wireless AccessPoint
uci delete network.lan.ifname
uci set network.wan=interface
uci set network.wan.proto=dhcp
uci set network.lan.ipaddr=

# Save settings
uci commit
restore from rom

mtd -r erase rootfs_data better solution: firstboot

uci defaults

create /etc/uci-defaults/my-uci-defaults. It will be executed once when the router boots. When it exits with 0 the file will be deleted.

uci set network.lan.ipaddr=
uci commit network
exit 0
AP+STA tegelijk
ubus over http
  • uhttpd-mod-ubus
  • /usr/share/rpcd/acl.d
  • /etc/init.d/rpcd restart
  • curl -d '{ "jsonrpc": "2.0", "id": 1, "method": "call", "params": [ "00000000000000000000000000000000", "network.interface.lan", "status", { } ] }' http://wifibox/ubus
  • how to join a network with ubus?
  • how to open een AP with ubus?
  • ubus list
  • ubus -v list network.interface.lan
  • ubus call iwinfo scan '{"device":"wlan0"}'
  • ubus call network.interface.lan up
  • ubus call network.interface.wan up
buildroot is een losstaand project

Build dependency: Please install the openssl library (with development headers)

(in doodle3d buildroot with ubuntu when trying to make menuconfig after deleting Barrier Breaker trunk and cloning 15.05 Chaos Calmer)

sudo apt-get update
sudo apt-get install libssl-dev
get list of installed packages
echo $(opkg list_installed | awk '{ print $1 }')
openwrt sdk
./scripts/feeds update
./scripts/feeds install -a
image generator / imagebuilder

make info

(geeft naam van de PROFILES en welke Packages daar standaard bij zitten. Daar kun je packages aan toevoegen en verwijderen met bijv `-luci`
make image PROFILE=.... PACKAGES="........ openssh-sftp-server -luci"
octoprint on OpenWrt
serial pins on the mr3020

buttons on the mr3020
opkg update
opkg install kmod-button-hotplug --force-depends
mkdir /etc/hotplug.d/button

create a file /etc/hotplug.d/button/my-script with your script:

sleep 1
logger "log: $BUTTON -- $ACTION  -- $SEEN"
lua serial on openwrt
veel handige info
USB-drive support on a Doodle3D WiFi-Box
  • have the box join an existing WiFi network to get internet access
  • opkg update
  • opkg install block-mount
  • opkg install kmod-usb-storage

collected errors:
satisfydependenciesfor: Cannot satisfy the following dependencies for kmod-usb-storage:
kernel (= 3.10.49-1-0114c71ed85677c9c1e4911437af4743) - kernel (= 3.10.49-1-0114c71ed85677c9c1e4911437af4743)
opkginstallcmd: Cannot install package kmod-usb-storage.

This is because Doodle3D creates a custom firmware image. Because of this the kernel version/id is different. kmod-usb-storage needs the exact right kernel version.

1) Install all the Doodle3D packages on a clean OpenWrt image.
2) Add the kmod-usb-storage package to the firmware (in make menuconfig)

mDNS, ZeroConf, Bonjour etc...
Multiple Access Points per radios (Multiple SSID's)
replace dropbear by openssh-server

Accessing utilities like iwinfo through ubus might also be interesting, see:

De nieuwe Luci (LuCI2) lijkt ook ubus over http te gebruiken?

steps to get started with extroot
  • flash the wifibox with a regular OpenWrt image (May be one be without LUCI to save diskspace)
  • connect an ethernet cable between the wifibox and your computer
  • setup your computer's ethernet interface to (/24 means subnetmask
  • telnet to
  • set a password with passwd to enable ssh
  • exit telnet
  • ssh root@
  • vi /etc/config/network
  • optional: choose another static ipaddress for the LAN connection (for example
  • add an interface for wlan setting the protocol to dhcp

config interface wlan option proto 'dhcp'

  • exit vi (ESC, :, w, q)
  • vi /etc/config/wireless
  • remove the disabled option (in vi use dd to remove a line)
  • add the country option and set to NL (or other country code) (don't know why this is needed but otherwise 'Network is unreachable')
  • change the mode of the wifi-iface to 'sta' (to become a WiFi client/station instead of an accesspoint)
  • change the wifi-iface network to wlan
  • set the ssid option to that of your home WiFi network.
  • set the key to your network's password.
  • choose the right encryption for example psk2.
  • exit vi
  • reboot
  • set your computer's ethernet interface to receive a DHCP address.
  • connect with ssh
  • update the packages list: opkg update
  • opkg install block-mount kmod-usb-storage kmod-fs-ext4
  • in case you get this error: kmod: failed to insert /lib/modules/3.10.49/ext4.ko reboot your OpenWRT device
  • on your computer setup a ext3 or ext4 filesystem on a USB drive
diskutil list
diskutil unmount /dev/disk#s#
#brew install e2fsprogs   
sudo /usr/local/opt/e2fsprogs/sbin/mkfs.ext4/mkfs.ext4 /dev/disk#s#              
  • connect the usb drive to the OpenWrt and type block info to get info about the block devices. Check if /dev/sda1 is listed.
  • create a folder to mount the drive to mkdir /mnt/usb
  • mount sda1 to the new folder mount /dev/sda1 /mnt/usb
  • (if you get a Segmentation Fault reboot the box first)
  • copy all files on the device to the usb drive:
mkdir -p /tmp/cproot
mount --bind / /tmp/cproot
tar -C /tmp/cproot -cvf - . | tar -C /mnt/usb -xf -
umount /tmp/cproot
  • mount the drive on boot by adding settings to /etc/config/fstab:
cat >> /etc/config/fstab << EOF
config mount
        option target        /
        option device        /dev/sda1
        option fstype        ext4
        option options       rw,sync
        option enabled       1
        option enabled_fsck  0
  • reboot the device.
  • type mount to see if your usb drive (/dev/sda1) is mounted to /
  • use df -h to see the large amount of space available now!
  • note that the contents of /etc/config/fstab is now different. This is normal because the contents of the file on the device is different then the one on the usb drive. The usb drive is installed 'on top of' the original filesystem. When booting the device without the usb drive you will get your original files.
image generator
boot from USB
list installed packages
opkg list
make & scp & sysupgrade
scp /Volumes/OpenWRT/trunk/bin/ar71xx/openwrt-ar71xx-generic-tl-mr3020-v1-squashfs-sysupgrade.bin wifibox:/tmp
ssh wifibox sysupgrade -v -n /tmp/openwrt-ar71xx-generic-tl-mr3020-v1-squashfs-sysupgrade.bin

oneliner: cat & make & scp & ssh sysupgrade

cat ~/.ssh/ | ssh wifibox 'cat >> /etc/dropbear/authorized_keys' && make V=s && scp /Volumes/OpenWRT/trunk/bin/ar71xx/openwrt-ar71xx-generic-tl-mr3020-v1-squashfs-factory.bin wifibox:/tmp && ssh wifibox sysupgrade -n -v /tmp/openwrt-ar71xx-generic-tl-mr3020-v1-squashfs-factory.bin
add public key to authorized_keys on openwrt
cat ~/.ssh/ | ssh root@ 'cat >> /etc/dropbear/authorized_keys'


cat ~/.ssh/ | ssh wifibox 'cat >> /etc/dropbear/authorized_keys'

after that it easy to scp files without entering passwords.

scp /Users/rick/Documents/Doodle3D/3dprintserver/doodle3d-firmware/src/rest/api/api_sketch.lua wifibox:/usr/share/lua/wifibox/rest/api
scp file when local file changes


while true    
   ATIME=`stat -f %Z $1`
   #echo $ATIME --- $LTIME
   if [[ "$ATIME" != "$LTIME" ]]
       echo "scp $1 $2"
       scp $1 $2
   sleep 1
error building package
make[3]: *** No targets specified and no makefile found.  Stop.
make[2]: *** [/Volumes/OpenWRT/trunk/build_dir/target-mips_34kc_uClibc-] Error 2
make[2]: Leaving directory `/Users/rick/Documents/VechtclubXL/door-bell'
make[1]: *** [package/feeds/bell/door-bell/compile] Error 2
make[1]: Leaving directory `/Volumes/OpenWRT/trunk'

in our case the folder-name containing the package did not match the package name.

while adding packages: Ignoring feed 'bell' - index missing


./scripts/feeds update -a

instead of:

./scripts/feeds update
tip van Ruben over mr3020
opkg update fails
~# opkg update
wget: server returned error: HTTP/1.1 404 Not Found
Collected errors:
* opkg_download: Failed to download, wget returned 1.

In a live Openwrt system, the last lines in /etc/opkg.conf should be:

src/gz chaos_calmer_base
src/gz chaos_calmer_luci
src/gz chaos_calmer_management
src/gz chaos_calmer_packages
src/gz chaos_calmer_routing
src/gz chaos_calmer_telephony

instead of that one line src/gz something  )


controlling LEDs through GPIO
cd /sys/class/leds/tp-link\:green\:3g/
echo 1 > brightness
#echo 0 > brightness
wifi repeater
Hidden Sound System
 <li><a href="javascript:play('')">Pinguin Radio</a>
function play(url) {
function stop() {
function get(url) {
  var xmlhttp = new XMLHttpRequest();"GET", url, false);


  textarea {
    width: 100%;
    height: 90%;
    font-family: monospace;
    font-size: 1em;
<form action="cgi-bin/save" method="POST">
<input type="submit" value="Save">
<input type="button" value="Cancel" onclick="location.href='/'">
<textarea id="txt" name="txt"></textarea>
var xmlhttp, text;
xmlhttp = new XMLHttpRequest();'GET', 'index.html?'+Math.random(), false);
document.getElementById('txt').value = xmlhttp.responseText;


echo "Content-type: text/plain"
echo ""
killall madplay -q
eval $(echo "$QUERY_STRING"|awk -F'&' '{for(i=1;i<=NF;i++){print $i}}')
url=`uhttpd -d $url`
wget -O - $url | madplay - & 
echo "ok"
echo ""
echo ""


#echo "Content-type: text/plain"
#echo ""
eval $(echo "$QUERY_STRING"|awk -F'&' '{for(i=1;i<=NF;i++){print $i}}')
cp index.html index.bak
uhttpd -d $txt > index.html
#cat index.html
echo "Status: 301 Moved"           
echo "Location: /"                   
echo ""                            
echo ""


echo "Content-type: text/plain"
echo ""
killall madplay -q
echo ""
echo ""
FAT-fs (sda1): IO charset iso8859-1 not found (while mounting a usb device)
/sbin/insmod nls_iso8859-1
environment variables including hostname in cgi-bin
echo "Content-type: text/plain"
echo ""
echo ""                                                             
echo ""  
uci show
create a dumb AP
config interface lan
        option type     'bridge'
        option ifname   'eth0 eth1'
        option proto    'dhcp'
config wifi-iface
        option device   radio0
        option network  lan
        option mode     ap
        option ssid     OpenWrt
        option encryption none
authorized keys instructions with dropbear
  • put your public key string in '/etc/dropbear/authorized_keys'
AirPlay on the MR3020
uci on ubuntu
usb over IP

draait geen OpenWrt maar kan wel als Arduino shield gebruikt worden:

cgi-bin read GET QueryString
echo "Content-type: text/plain"
echo ""
#echo $QUERY_STRING     
#read QUERY_STRING                                                      
eval $(echo "$QUERY_STRING"|awk -F'&' '{for(i=1;i<=NF;i++){print $i}}') 
#txtOutput=`uhttpd -d $b`         
echo $b > /dev/ttyACM0
echo ""
echo ""
arduino connected to internal serial port
wifi settings


config wifi-device  radio1
	option type     mac80211
	option channel  11
	option macaddr	ec:88:8f:dc:c6:4e
	option hwmode	11ng
	option htmode	HT20
	list ht_capab	SHORT-GI-20
	list ht_capab	SHORT-GI-40
	list ht_capab	RX-STBC1
	list ht_capab	DSSS_CCK-40

config wifi-iface
	option device   radio1
	option network  wan
	option mode     sta
	option ssid     Globe4D
	option encryption psk2
	option key	.........
toggle USB power on MR3020
ON: echo 1 >/sys/class/gpio/gpio8/value
OFF: echo 0 >/sys/class/gpio/gpio8/value
voip on openwrt
opencv on openwrt
dit nog uitproberen:
flash existing openwrt install from remote

create a shell script:

if [ $# -eq 1 ]; then
	FILENAME=`basename $IMAGE`
	scp $IMAGE root@wifibox:/tmp
	ssh -t root@wifibox "sysupgrade -v -n /tmp/$FILENAME"
restart uhttpd
/etc/init.d/uhttpd restart
scp a doodle3d file to the box
scp /Users/rick/Documents/Doodle3D/3dprintserver/doodle3d-firmware/src/conf_defaults.lua wifibox:/usr/share/lua/wifibox/
scp /Users/rick/Documents/Doodle3D/3dprintserver/doodle3d-firmware/src/util/* wifibox:/usr/share/lua/wifibox/util/
stop a (doodle3d) process and start manually in verbose mode
/etc/init.d/print3d stop
print3d -v
updating firmware


scp openwrt-ar71xx-generic-tl-mr3020-v1-squashfs-sysupgrade.bin root@


mtd -r write openwrt-ar71xx-generic-tl-mr3020-v1-squashfs-sysupgrade.b
in firmware
usb over IP
save contents of form variable to file in /tmp


<form method="post" action="cgi-bin/">
<textarea name="txtOutput" rows=50 cols=100></textarea>
<input type="submit">


echo "Content-type: text/plain"
echo ""
eval $(echo "$QUERY_STRING"|awk -F'&' '{for(i=1;i<=NF;i++){print $i}}')
txtOutput=`uhttpd -d $txtOutput`
echo $txtOutput > /tmp/file.txt
echo ""
echo ""
restore original MR3020 firmware
get mac address
ifconfig wlan0 | awk '/HWaddr/ { print $5 }'
replace dropbear by open-ssh-server
mount usb disk on startup

in /etc/config/fstab

config 'mount'
        option 'target'   '/mnt'
        option 'device'   '/dev/sda1'
        option 'fstype'   'ext2'
        option 'enabled'  '1'
        option 'enabled_fsck' '0'
on osx to prepare a ext2 usbstick
locate mke2fs
diskutil list
diskutil unmount /dev/disk{...}
mke2fs /dev/disk{...}
mkfs.ext2 /dev/disk{...}

(not tested: or install and use the Mac OSX Disk Utility to erase the usb-drive using fuse-ext2)


follow log file

logread -f
network/wireless config files gemaakt op ohm2013


config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr ''
option netmask ''

config interface 'lan'
option ifname 'eth0'
option type 'bridge'
option proto 'static'
option netmask ''
option ipaddr ''

config interface 'wan'
option _orig_ifname 'wlan0'
option _orig_bridge 'false'
option proto 'dhcp'


config wifi-device  radio1
	option type     mac80211
	option channel  11
	option hwmode	11ng
	option path	'platform/ar933x_wmac'
	option htmode	HT20
	list ht_capab	SHORT-GI-20
	list ht_capab	SHORT-GI-40
	list ht_capab	RX-STBC1
	list ht_capab	DSSS_CCK-40
#	option disabled 1

config wifi-iface
	option device   radio1
	option network  wan
	option mode     sta
	option ssid     OHM2013
	option proto	dhcp
	option encryption none
start up script

not finished….

#!/bin/sh /etc/rc.common
start() {
        /Doodle3D/Doodle3D > /dev/null 2> /dev/null &
enable wireless

By default the wireless is OFF. You can turn it on in the /etc/config/wireless by changing disabled 1 to disabled 0
In UCI CLI you do this with:

uci set wireless.@wifi-device[0].disabled=0; uci commit wireless; wifi
scan script
ifconfig wlan0 down
iw phy phy0 interface add scan0 type station
ifconfig scan0 up
iwlist scan0 scan | grep ESSID  | cut -c 27- | tr -d '"'
iw dev scan0 del
ifconfig wlan0 up
connect script
uci set wireless.@wifi-iface[0].ssid=$1
uci set wireless.@wifi-iface[0].encryption=$2
uci set wireless.@wifi-iface[0].key=$3
uci set wireless.@wifi-iface[0].mode=sta
uci set wireless.@wifi-iface[0].network=wan
uci commit wireless
accesspoint script
uci set wireless.@wifi-iface[0].ssid=Doodle3D
uci set wireless.@wifi-iface[0].encryption=none
uci set wireless.@wifi-iface[0].key=''
uci set wireless.@wifi-iface[0].mode=ap
uci set wireless.@wifi-iface[0].network=lan
uci commit wireless
scan for wireless networks
Failsafe mode
  1. take a fixed ip on your computer: (mask:
  2. Power on device
  3. Wait for blinking led
  5. wait a minute
  6. telnet
  7. you're in.

to find out your ip:

uci get network.lan.ipaddr
Regenerate Wireless Configuration

To rebuild the configuration file, e.g. after installing a new wireless driver, remove the existing wireless configuration (if any) and use the wifi detect command with stdout redirected to the /etc/config/wireless file:

rm -f /etc/config/wireless
wifi detect > /etc/config/wireless
bootstrap skin for OpenWrt by nut&bolt
  • download and install the 'luci-theme-bootstrap' package
press for connect

more from batman

uci delete wireless.wifi0.disabled
uci delete wireless.@wifi-iface[0].network
uci set
uci set wireless.@wifi-iface[0].mode=adhoc
uci set wireless.@wifi-iface[0].ssid=afrimesh
uci set network.lan.mtu=1500
uci set network.lan.ifname="eth0 bat0"
uci set network.lan.proto=dhcp
uci delete network.lan.ipaddr
uci delete network.lan.netmask
uci set network.wifi0=interface
uci set network.wifi0.ifname=ath0
uci set network.wifi0.proto=none
#uci set network.wifi0.mtu=1524
uci set network.wifi0.mtu=1548
uci set network.bat0=interface
uci set network.bat0.ifname=bat0
uci set network.bat0.proto=none
uci set network.bat0.mtu=1500
uci set batman-adv.bat0.interfaces=ath0
uci commit
forward all DNS traffic to device


list address            '/#/'
uci add_list dhcp.@dnsmasq[0].address='/#/'
uci commit dhcp
wifi scan and show in list
echo "Content-type: text/plain"
echo ""
iwlist wlan0 scan | grep ESSID  | cut -c 27- | tr -d '"'
  <script src=""></script>
    $.get("cgi-bin/wifi-scan", function(data) {
      data = data.split("\n");
      var options = $("#boxNetwork");
      $.each(data, function(index,value) {
	if (value!="") options.append($("<option />").val(value).text(value));
	<select id="boxNetwork">
		<option value="" disabled selected>Scanning for neworks...</option>
	<input id="txtPassword" placeholder="password" value="" type="password">
	<input id="btnConnect" type="button" value="Connect">
cross compile on Mac

Create case sensitive HFS:

hdiutil create -size 15g -fs "Case-sensitive HFS+" -volname OpenWRT ~/OpenWRT.sparsebundle
hdiutil attach OpenWRT.sparsebundle 

Checkout OpenWRT source:

cd /Volumes/OpenWRT && svn co svn://;

Run 'feeds update' script:

cd trunk; scripts/feeds update -a

selfupdate & subversion

sudo port -v selfupdate; sudo port install subversion

install dependencies:

sudo port install coreutils e2fsprogs ossp-uuid asciidoc binutils bzip2 fastjar flex getopt gtk2 intltool jikes \ zlib openssl p5-extutils-makemaker python26 rsync ruby sdcc unzip gettext libxslt bison gawk autoconf wget \ gmake ncurses findutils

make menu

make prereq; make defconfig; make menuconfig

install everything for cross-compiler…

make V=s
uci get wireless.@wifi-iface[0].key
uci set wireless.@wifi-iface[0].key=YOURKEY
uci set$wifichannel
uci set wireless.wificlient.ssid="$wifissid"
uci set wireless.wificlient.encryption=$wifimode
uci set wireless.wificlient.key=$wifipass
uci commit wireless
wifi down
how to debrick
show login intro text
cat /etc/banner
How do I access the syslog messages?
list connected dhcp clients
cat /tmp/dhcp.leases
scan for wifi networks
iwlist wlan0 scan | grep ESSID  | cut -c 27- | tr -d '"'
get current wifi configuration
iwconfig wlan0
ideale setup voor doodle3d box zou zijn

- eerst proberen te verbinden met een het laatst verbonden netwerk
- als die niet beschikbaar is dan proberen te verbinden met vorige etc.
- als geen enkel netwerk zichtbaar is dan zelf een AP starten waarmee in een vriendelijke webpagina (die automatisch toont via dns route) gescand kan worden naar beschikbare netwerken.

network restart
/etc/init.d/network restart
settings with cat

config interface 'loopback'
	option ifname 'lo'
	option proto 'static'
	option ipaddr ''
	option netmask ''

config interface 'lan'
	option ifname 'eth0'
	option type 'bridge'
	option proto 'static'
	option netmask ''
	option ipaddr ''

config interface 'wan'
	option _orig_ifname 'wlan0'
	option _orig_bridge 'false'
	option proto 'dhcp'

config wifi-device 'radio0'
	option type 'mac80211'
	option channel '11'
	option macaddr 'ec:88:8f:c6:10:a6'
	option hwmode '11ng'
	option htmode 'HT20'
	list ht_capab 'SHORT-GI-20'
	list ht_capab 'SHORT-GI-40'
	list ht_capab 'RX-STBC1'
	list ht_capab 'DSSS_CCK-40'
	option txpower '27'
	option country 'US'

config wifi-iface
	option device 'radio0'
	option mode 'sta'
	option ssid 'Blendid'
	option encryption 'psk2'
	option key '...................................'
	option network 'wan'
cat <<
cat << EOM >> tmp.txt
.... paste text here
getting started
running in wifi client mode


config interface 'wan'
        option ifname 'wlan0'
        option proto 'dhcp'


config wifi-iface                  
        option device radio0 
        option network wan   
        option mode sta      
        option ssid ...
        option encryption psk2
        #or psk instead of psk2
        option key ....
scan for wifi networks
iwlist scanning
iwlist wlan0 scan
useful wiki by acemonstertoys
list serial devices
ls -1 /dev/ttyACM*
process ID
echo $$
echo "Content-type: text/html"
echo ""
echo "Sample CGI Output"
echo ""
echo ""
echo ""
echo ""
cgi script extracting POST variables
echo "Content-type: text/plain"
echo ""
#???? read QUERY_STRING
eval $(echo "$QUERY_STRING"|awk -F'&' '{for(i=1;i<=NF;i++){print $i}}')
#echo $txtOutput
txtOutput=`uhttpd -d $txtOutput`
echo $txtOutput
serial port

Alleen opkg install kmod-usb-acm lijkt nodig.

opkg update
opkg install coreutils-stty 
opkg install kmod-usb-serial
opkg install kmod-usb-serial-ftdi
#opkg install kmod-usb-serial-cp210x 
opkg list | grep -i acm
kmod-usb-acm - - Kernel support for USB ACM devices (modems/isdn controllers)
opkg install kmod-usb-serial
opkg install coreutils-stty 
opkg install kmod-usb-acm

By default everything that comes to WR703N serial port is echoed back.
If you also want to send commands to Arduino, the buffer will be full with echoed data.
Need to set no echo option in sstty.

/usr/bin/stty -F /dev/ttyACM0 raw speed 115200 -echo

Arduino is reset every time it is read by command “head” To disable reset by DTR pin add option to stty

/usr/bin/stty -F /dev/ttyACM0 raw speed 115200 -echo
cat /dev/ttyACM0
sh scripting for serial
echo "Content-type: text/html"                                               
echo ""                                                                      
echo "test"                                                                  
if  [ -c $PORT ]; then                                                       
      /usr/bin/stty -F $PORT raw speed 115200 -echo -hupcl                   
      while [ 1 ]; do                                                        
              if [ -c $PORT ]; then                                          
                      head -n 8 $PORT                                        
                      sleep 1                                                
                      # USB dissapeared.                                     
                      echo "Arduino no longer attached"                      
      echo "Arduino not attached"                                            
disk usage
du * -sh
ln -s /mnt/ www2
install opkg packages on usb-stick


dest usb /mnt/


export USB=/mnt
export PATH=$PATH:$USB/usr/bin:$USB/usr/sbin
export LD_LIBRARY_PATH=$USB/lib:$USB/usr/lib
opkg install unzip -d usb
compilen vanaf windows of linux voor openwrt
scp (secure copy)

scp from to

scp root@ 
create large file with zeros (10MB)
dd if=/dev/zero of=/mnt/largefile bs=1024 count=10240
usb storage

opkg install kmod-usb-storage block-mount kmod-fs-vfat  kmod-nls-cp437 kmod-nls-iso8859-1 
mount /dev/sda1 /mnt
writable permanent store
for humans diskfree info
df -h

bevat textfiles met info over je systeem zoals

cat /proc/filesystems 
mount usb drive

flush firewall settings
iptables -F
iptables -L


captive portals
opkg update
opkg install openssh-sftp-server
  • ??? <code>gcom info -d /dev/ttyUSBx</code>
  • use 'kmod-usb-storage' for usb drive support
  • config
cross compiling

using SourceryCodeBenchLiteforMIPSGNULinux on Windows

 mips-linux-gnu-gcc -static -s -msoft-float -muclibc hello.c -o hello
openwrt.txt · Last modified: 2017/03/24 01:47 by rick