Archive for the ‘OpenWRT’ Category.

FHZ1000 @ OpenWRT / wl500gP

very basic instructions, still incomplete

for additional resources, see FHZ 1000 for Linux

installation

install the required kernel-modules on your openwrt:

ipkg install kmod-usb-serial
ipkg install kmod-usb-serial-ftdi
insmod usbserial vendor=0x403 product=0xf06f debug=0
insmod ftdi_sio vendor=0x403 product=0xf06f debug=0

NOTE: you have to re-plug the FHZ module after loading the kernel modules!

testing

requires perl, so we need a perl-installation on openwrt. in your buildroot-environment, call

make menuconfig

select “Languages” —> “Perl” and select these packages to be built as modules:

perl perlbase-autoloader perlbase-config perlbase-cpan perlbase-dynaloader
perlbase-errno perlbase-essential perlbase-fcntl perlbase-file perlbase-io
perlbase-posix perlbase-selectsaver perlbase-socket perlbase-symbol
perlbase-term perlbase-tie perlbase-time perlbase-xsloader

build the packages

make

after installing at least the perl and perlbase-time packages, you can use a simple perlscript to talk to the FHZ (for protocol details, see FHZ1000 Protocol ): just download and execute fhztest.pl for a simple handshake-test. note: the script requires stty, so maybe you have to recompile your busybox-binary since the default one (from kamikaze 7.09) doesn’t include it…

as an alternative, you can continue by compiling the perl-module Device-SerialPort which is also required by FHEM . simply create feeds/packages/lang/perl-device-serialport in your buildroot-environment, download the provided Makefile and place it in the created directory. next, you have to create a symlink from package/feeds/packages/ that points to the above directory and update your configuration via

make menuconfig

there should be a new additional entry in “Languages” —> “Perl” called “perl-device-serialport” that has to be selected. save, exit and issue

make package/feeds/packages/perl-compile

after compilation, there should be a new ipkg-package in bin/packages/mipsel/ that has to be installed on your openwrt. doing so, you can use fhztest-serialport.pl to test the communication. calling the script should produce some output like this:

root@OpenWrt:/opt/tools/fhz# perl fhztest-serialport.pl 
Saying hello...
Sending: 8106c98202011f60 -- Result: 8
Got:     810bc97601021f0278071c3780 [0]
Sending: 8105044fc90185 -- Result: 7
Got:     8107c9b3010285012a [1]

to diagnose problems, look at the logfiles, try to un- and reload the kernel modules (don’t forget to un- and replug the FHZ after that!), …

creating openwrt-packages for kamikaze

NOTE: this article is still under construction

a detailed description of setting up the openwrt development environment can be found on the openwrt-wiki: buildroot

as an example, we will create a hello-world-program in standard C and build a package for ipkg that will be provided online in a ready-to-use repository

0: prerequisites

on the host where we setup the buildchain, we need some devel-packages. this list is not quite complete as i didn’t check from a bare system… you definitely need the following stuff, the system will notify you of other packages that are missing…
subversion make flex bison

make help from trunk tells us we need at least those packages:
gcc binutils patch bzip2 flex bison make gettext pkg-config unzip libz-dev libc

on a current ubuntu installation you also need the following packages:
g++ libncurses-dev gawk autoconf

1.1: get the sources

select the right svn-branch for your requirements… usually trunk is fine, but if you want to build kernel-modules for your running kamikaze-installation you’ll need the stable release:

option 1: check out the current svn-trunk:
svn co https://svn.openwrt.org/openwrt/trunk

option 2: check out the stable kamikaze-release:
svn co https://svn.openwrt.org/openwrt/tags/kamikaze_7.09/

1.2: get additional packages

run the following command inside the trunk or kamikaze directory to check out additional source-packages and create the corresponding symlinks:
make package/symlinks

2: create configuration

make menuconfig

3: compile

make

4.1: hello world sources

this is the example code we will use to build a binary (ipkg) package:

#include <stdio.h>
int main()
{
	printf("hello world\n");
}

4.2: the simple version: manual makefile

ATTENTION: make sure the indenting below is done with tabs, not with spaces! this can be achieved by piping it through expand

# build helloworld executable when user executes "make"
helloworld: helloworld.o
        $(CC) $(LDFLAGS) helloworld.o -o helloworld 
helloworld.o:
        helloworld.c $(CC) $(CFLAGS) -c helloworld.c 
# remove object files and executable when user executes "make clean"
clean:
        rm *.o helloworld 

TODO

NOTES: useful commands

compile a specific package:
make package/feeds/packages/<PACKAGENAME>-compile

(re)generate package index:
make package/index