Table of Contents

GPIO bit-bang driver for OpenWRT

Check-out

Prepare to build OpenWRT.

mkdir -p /embedded/openwrt/
cd /embedded/openwrt/
git clone git://git.openwrt.org/openwrt.git openwrt.git
chown -R nobody:nogroup /embedded/openwrt/openwrt.git
cd /embedded/openwrt/openwrt.git
/bin/su nobody
cp feeds.conf.default feeds.conf.default.orig
echo "src-git openwrtfiles git://github.com/GBert/openwrt-files" >> feeds.conf.default
./scripts/feeds update -a
./scripts/feeds install kmod-bit-bang-gpio picprog-new
./scripts/feeds install nfs-utils

Config

Enable kernel options.

make menuconfig
 [Target System  = Atheros AR7xxx/AR9xxx]
 [Target Profile = TP-LINK TL-WR841N/ND]
 [Kernel Modules] [Other Modules] [kmod-bit-bang-gpio]
 [Kernel Modules] [Wireless Drivers] [kmod-ath] [Force Atheros drivers to respect the
                                                user's regdomain settings]
 [Utilities] [picprog-new]
 [Kernel] [Filesystems] [kmod-fs-nfs-common]
 [Utilities] [Filesystem] [nfs-utils]

Disable kernel options.

 [Global build settings] [IPv6 support in packages]
 [Base system] [dnsmasq]
 [Base system] [firewall]
 [Kernel Modules] [USB Support]
 [Network] [ppp]
 [Kernel Modules] [kmod-ppp]
 [Network] [odhcp6c]
 [Network] [odhcpd]
 [Network] [firewall] [ip6tables]
 [Network] [firewall] [iptables]
 [Kernel Modules] [Netfilter Extensions]
 [Kernel Modules] [kmod-ipv6]

Exit config.

 [Exit] [Yes]

Build

make V=s
 [WAIT FOR A LONG TIME...]

Install

ls -1 bin/ar71xx/*factory*
bin/ar71xx/openwrt-ar71xx-generic-tl-wr841nd-v1.5-squashfs-factory.bin
bin/ar71xx/openwrt-ar71xx-generic-tl-wr841nd-v3-squashfs-factory.bin
bin/ar71xx/openwrt-ar71xx-generic-tl-wr841nd-v5-squashfs-factory.bin
bin/ar71xx/openwrt-ar71xx-generic-tl-wr841nd-v7-squashfs-factory.bin
bin/ar71xx/openwrt-ar71xx-generic-tl-wr841n-v8-squashfs-factory.bin
bin/ar71xx/openwrt-ar71xx-generic-tl-wr841n-v9-squashfs-factory.bin
bin/ar71xx/openwrt-ar71xx-generic-tl-wr847n-v8-squashfs-factory.bin

From the router maintenance page upgrade the firmware using the correct image.
For this example, it's openwrt-ar71xx-generic-tl-wr841n-v8-squashfs-factory.bin

Login

telnet 192.168.1.1
Trying 192.168.1.1...
Connected to 192.168.1.1.
Escape character is '^]'.
 === IMPORTANT ============================
  Use 'passwd' to set your login password
  this will disable telnet and enable SSH
 ------------------------------------------


BusyBox v1.22.1 (2014-11-08 16:13:53 GMT) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 CHAOS CALMER (Bleeding Edge, r43216)
 -----------------------------------------------------
  * 1 1/2 oz Gin            Shake with a glassful
  * 1/4 oz Triple Sec       of broken ice and pour
  * 3/4 oz Lime Juice       unstrained into a goblet.
  * 1 1/2 oz Orange Juice
  * 1 tsp. Grenadine Syrup
 -----------------------------------------------------

Test

ssh -x root@192.168.1.1
rmmod leds_gpio
modprobe gpio-bb && mknod /dev/gpio-bb c 180 0
vi /root/.k8048/config
 [CONFIGURE VPP=2]
ktest vpp 5

TEST MODE VPP|PGD|PGC|PGM

VPP LOW  (ICSP 1) (D-SUB-9 TX 3) [3 seconds]
VPP HIGH (ICSP 1) (D-SUB-9 TX 3) [5 seconds]
VPP LOW  (ICSP 1) (D-SUB-9 TX 3) [3 seconds]

TEST DONE

Upgrade

cd /embedded/openwrt/openwrt.git
/bin/su nobody
scripts/feeds update -a
Updating feed 'packages' from 'git://git.openwrt.org/packages.git' ...
 [WAIT FOR A WHILE...]
make V=s
 [WAIT FOR A WHILE...]
scp bin/ar71xx/openwrt-ar71xx-generic-tl-wr941nd-v3-squashfs-sysupgrade.bin root@192.168.1.1:/tmp/
ssh -x root@192.168.1.1
sysupgrade -v /tmp/openwrt-ar71xx-generic-tl-wr941nd-v3-squashfs-sysupgrade.bin
 [WAIT FOR REBOOT]
ssh -x root@192.168.1.1

BusyBox v1.19.4 (2014-03-17 16:43:34 GMT) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 BARRIER BREAKER (Bleeding Edge, r39935)
 -----------------------------------------------------
  * 1/2 oz Galliano         Pour all ingredients into
  * 4 oz cold Coffee        an irish coffee mug filled
  * 1 1/2 oz Dark Rum       with crushed ice. Stir.
  * 2 tsp. Creme de Cacao
 -----------------------------------------------------