OpenWrt Forum Archive

Topic: OpenWRT Kamikaze on TP-link tl-wa501g?

The content of this topic has been archived between 31 Aug 2014 and 5 May 2018. Unfortunately there are posts – most likely complete pages – missing.

i am sorry  i cannot test weather vlan is available..... as i have bricked my wr340g at the moment and cannot access it to test................................. vlan  may not work as this is a minimal image built by xssa he might have dropped  vlan support to save space........ 

could you elaborate you setup....... as in this openwrt image all the lan ports are under one subnet (which means openwrt recognises all the lan ports as one and the same) so just use another lan port and everything will work okay no need to set anything ........

(Last edited by drekthar on 24 Sep 2011, 11:07)

yep vlan dosent work... so I can use LAN port as WAN ?

aslo can you change this on wiki:

BAD:

(custom load address for kernel is 80033800)
fis create -r 0x80033800 -e 0x80033800 vmlinux.bin.l7 ( Write's kernel to flash custom load address for kernel is 80033800 current kernel is 2.6 )

GOOD:

(custom load address for kernel is 80041000 )
fis create -r 0x80041000 -e 0x80041000 vmlinux.bin.l7 ( Write's kernel to flash custom load address for kernel is 80041000 current kernel is 2.6 )

(Last edited by l0l on 24 Sep 2011, 13:00)

l0l wrote:

yep vlan dosent work... so I can use LAN port as WAN ?

aslo can you change this on wiki:

BAD:

(custom load address for kernel is 80033800)
fis create -r 0x80033800 -e 0x80033800 vmlinux.bin.l7 ( Write's kernel to flash custom load address for kernel is 80033800 current kernel is 2.6 )

GOOD:

(custom load address for kernel is 80041000 )
fis create -r 0x80041000 -e 0x80041000 vmlinux.bin.l7 ( Write's kernel to flash custom load address for kernel is 80041000 current kernel is 2.6 )

where did you download the kernel ? .....If you downloaded the kernel from this forum the address will be 80041000 (which is default) but if you downloaded the kernel from the wiki it's address is 80033800

(Last edited by drekthar on 24 Sep 2011, 13:30)

Installed from this:

melkman wrote:

New location of the images (thanks mvsroot):

vxkiller made by xssa:
http://www.xs4all.nl/~mettema/TL-340G-Linux_606fe38dda4014fb8f16b9b8a27cee3e.rar

Kernel for openwrt made by xssa:
http://www.xs4all.nl/~mettema/openwrt-atheros-vmlinux.lzma

RootFS for openwrt made by xssa (IP Address is 192.168.1.55 logon with root/ar2317):
http://www.xs4all.nl/~mettema/rootsq.rom

but md5 sum = md5 sum of kernel/files from wiki

(Last edited by l0l on 24 Sep 2011, 13:44)

I dont know how configure... maybe my router is complitly broken after storm, some1 can post etc/config/network config for this conection:

---Internet----
IP: 192.168.1.56
NetMask: 255.255.248.0
Getaway: 192.168.0.1
DNS: 192.168.0.1

thx

please explain your setup.......... i can't help without more information

(Last edited by drekthar on 24 Sep 2011, 16:34)

I want split internet,im  connecting thru static IP from ISP

IP: 192.168.1.56
NetMask: 255.255.248.0
Getaway: 192.168.0.1
DNS: 192.168.0.1

I use this setup:

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

    config 'interface' 'lan'
        option 'ifname' 'eth0'
        option 'type' 'bridge'
        option 'proto' 'static'
        option 'ipaddr' '199.168.1.1'
        option 'netmask' '255.255.255.0'
   
    config 'interface' 'wlan'
        option 'ifname' 'wlan0'
        option 'type' 'bridge'
        option 'proto' 'static'
        option 'ipaddr' '192.168.1.56'
        option 'netmask' '255.255.248.0'
        option 'getaway' '192.168.0.1'
        option 'dns' '192.168.0.1'

But dosent work, what I do wrong ?
There is any wlan0 interface in this kernel ?

(Last edited by l0l on 24 Sep 2011, 17:34)

l0l wrote:

I want split internet,im  connecting thru static IP from ISP

IP: 192.168.1.56
NetMask: 255.255.248.0
Getaway: 192.168.0.1
DNS: 192.168.0.1

I use this setup:

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

    config 'interface' 'lan'
        option 'ifname' 'eth0'
        option 'type' 'bridge'
        option 'proto' 'static'
        option 'ipaddr' '199.168.1.1'
        option 'netmask' '255.255.255.0'
   
    config 'interface' 'wlan'
        option 'ifname' 'wlan0'
        option 'type' 'bridge'
        option 'proto' 'static'
        option 'ipaddr' '192.168.1.56'
        option 'netmask' '255.255.248.0'
        option 'getaway' '192.168.0.1'
        option 'dns' '192.168.0.1'

But dosent work, what I do wrong ?
There is any wlan0 interface in this kernel ?

this whole setup is wrong........... i still don't know what you are trying to achieve .........wlan0 is wifi.......please read all openwrt docs in wiki and all the info of openwrt before posting in a forum

l0l wrote:

Installed from this:

melkman wrote:

New location of the images (thanks mvsroot):

vxkiller made by xssa:
http://www.xs4all.nl/~mettema/TL-340G-Linux_606fe38dda4014fb8f16b9b8a27cee3e.rar

Kernel for openwrt made by xssa:
http://www.xs4all.nl/~mettema/openwrt-atheros-vmlinux.lzma

RootFS for openwrt made by xssa (IP Address is 192.168.1.55 logon with root/ar2317):
http://www.xs4all.nl/~mettema/rootsq.rom

but md5 sum = md5 sum of kernel/files from wiki

this is  because the sizes of the images are the same as the way squashfs files are compressed......
use the kernel and rootfs in the wiki (this is better one as it supports udhcp in busybox XSSA BUILD IT)

(Last edited by drekthar on 25 Sep 2011, 18:29)

ok good to know smile

Anyone succeed in running 340G with marvell switch 80E600 ?
Seems like switch is recognized as eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=0:00)  although in the kernel there are drivers.
I build my own kernel with jff2s only and vlans. Everything works perfectly. I have 300K free space and there is pleny of space of iptables. So if there is any way that router to make use of wan/lan it is good to know how.
I played a little with the source in mvswitch.c and i saw some strange checks like

        if (dev->addr != 0x10)
                return 0;
My switch is detected at 0x0 . Anyone knows what is all about ?
Also commenting that section and
         if (reg != MV_IDENT_VALUE)
                return 0;

makes the kernel recognize my switch correctly as Marvell 80E6060 but it timeouts when set the registers.
Seems like we miss support or something is broken in the openwrt patches.
If anyone have ideas i can test compile everything.

hello sanitariu

welcome to the forum

<quote>I build my own kernel with jff2s only and vlans. Everything works perfectly. I have 300K free space and there is pleny of space of iptables </quote>

yes the same thing happens to me switch is detected as generic phy..... where you able to configure sitch with vlan ? 

could you share your image and both .config files and kernel config files here............. what about wifi...... do u you only want to use the router as a switch ?  did you include wifi driver in your build.... madwifi requires a lot of space

See the wiki if we can create a sd card mod to the router by first detecting gpio pins we can make this router fully functional but first gpio pins need to be found followed by compiling a kernel with sd card support

(Last edited by drekthar on 1 Oct 2011, 08:00)

Hello,
I am able to run the device in bridge mode together with wifi.
So i can easy run hybrid vlan everywhere and run tagged vlan on the ath0 interface.vconfig here.
Works very good.
I would like to be able to use the switch the same way also. So i can choose which port which vlan.
Also that way i will be able to use TP-Link 340G like router. Choose my WAN port run iptables/udhcp etc..
There is plenty of space.
Yes i include madwifi only setup in all my builds. ark5 is not good yet and take too much space. Depends what you like. I personally do not need any wifi security just vlan in the wifi interface.
I noticed on latest kernel versions/ or madwifi patches the device stuck when you download heavy (wifi) 3.0/3.1MB (24Mbit/s) madwifi starts to eat memory very fast and router dies in 1 minute. So i start pulling old versions of openwrt back to 16500 smile
That's the most stable i saw. Downloading days wifi all the time with 3.0MB (24Mbit) seems stable no kernel panics no reboots. Also i erased most of the scripts for detecting network cards and other openwrt stupids which eats immediately memory after you start. I think there is no need for that ! Simple rc.local with wifi setup is enough. No stupid detects and hang on 10 minutes on booting. TP-Link 340 has only 8MB !
May be for that router will be better to compile own libc basic stuff and kernel. I dunno why hotplug stuff is so heavy on boot ?!
Why do you need gpio pins ?
Personally i removed all stuff that control diods on the router and if i find a way to stop them all will be perfect. Extra energy for diods which you look once in a year smile
I am not interrested in SD memory. As I said i need the cheapest router which you can control wifi/switch/vlans.
TP-Link 340GD is perfect in that way and costs only 10 euro smile
I can share configs just let me know which versions you like. 16500 is the most stable for now.


P.S.

if (dev->addr != 0x10)
                return 0;

Makes mvswitch.c exits init immediately and we got Generic PHY because we are detected at 0x00 address.
May be init registers of the switch are not correct. I will try more old kernels. Too bad that kernel.org is hacked and i can not check mailing lists or newer kernels.

(Last edited by sanitariu on 2 Oct 2011, 20:05)

sanitariu wrote:

16500 is the most stable for now.

yes, your configs would be very nice

do you think it is possible for me to run the router in client mode with another router. this setup would require (dnsmasq) i already have a working image in which i can successfully client to another ap with psk encryption in routed client mode with static route's set in main ap router

sanitariu wrote:

I am not interrested in SD memory. As I said i need the cheapest router which you can control wifi/switch/vlans

i have a lot of memory card lying around and thought it would be great do a sd/mmc card mod to this router after finding it's gpio pins ..... so i can have client mode installed ....... i guess the ram will still make it unstable.....

sanitariu wrote:

TP-Link 340GD is perfect in that way and costs only 10 euro smile
I can share configs just let me know which versions you like. 16500 is the most stable for now

i agree these router are the best as they come with 5dbi antennas which have a very good signal strength that's why i wanted to turn one of these into a  client  router over wifi

ps all the images i have built with wifi are very big
rootfs is 704 kb
kernel 868 kb

your config's would be great i can learn a lot in making small images as i don't know so much about linux and i am still learning

thanks in advance

(Last edited by drekthar on 3 Oct 2011, 12:27)

Here is kernel config.
http://www.telnet.bg/openwrt/kernel-config-2.6.28.10-r16500
Note that i put all the madwifi patches from latest revision in patch dir except these for the kernel after 2.6.28 and also excluding 451-ibss_race_fix.patch

Kernel size is 655360.
Also i advise you to cut all hotplug stuff.
Instead make rc.local or other and make things properly.
For the openwrt system you can cut a lot of currently i have 300KB free or more.
It is enough for iptables+dhcp.
But we miss switch control. If someone fix mvswitch drivers we will be able to use as a router.

thnak's a lot sanitariu big_smile


sanitariu wrote:

Also i advise you to cut all hotplug stuff.
Instead make rc.local or other and make things properly

could you explain how to do this if it is not any trouble

thanks you

(Last edited by drekthar on 3 Oct 2011, 14:51)

You can do so by commenting out some sections in /etc/init.d/network.
I forced the detection of marvell switch by commenting out

        if (dev->addr != 0x10)
                return 0;

in mvswitch.c and changing

#define MV_BASE         0x0
in mvswitch.h

Now switch is detected properly at address 0x0 but is not working.
Seems we miss more in the init structures.
I will look more in the pdf sheets.
If someone have more information please share.

thanks you

sanitariu wrote:

Note that i put all the madwifi patches from latest revision in patch dir except these for the kernel after 2.6.28 and also excluding 451-ibss_race_fix.patch

where can i download the madwifi patch from...... sorry for disturbing....

thanks in advance

(Last edited by drekthar on 3 Oct 2011, 16:30)

Download latest svn. Go to package/madwifi/patches.
Copy all of them except these for newer kernels after 2.6.28 and except ibss patch to your old tree.
Remove build_dir/linux-atheros/madwifi-trunk-r3314/ and compile again.

thanks a lot dude......:D   i will keep in touch

I have more news about the switch in Tplink WR-340GD.
According to the manual switch phy can be found on different addresses.

"The 88E6060 device contains five physical layer devices (PHYs). These devices are accessible using SMI device
addresses 0x00 to 0x04 (or 0x10 to 0x14) depending upon the value of the EE_CLK/ADDR4 pin at reset. The
PHYs are fully IEEE 802.3 compliant including their register interface."

mvswitch.c/mvswitch.h need patches for these.

Also i am able to control manually the ports and leds of the switch like putting static lines:
    w16(pdev, MV_PHYREG(LED_OVERRIDE, 1), 0x2a); // stop led on port 2
in mvswitch.c.
0x2a is taken from the manual. You must calculate the bits binary then transfer in hex.
Also i can choose my wan port there too.
Seems like switch is working at address 0x00.
Still i must found a way to work with swconfig. There we fail to connect.
Anyone working on that ?

(Last edited by sanitariu on 3 Oct 2011, 23:53)

sanitaru wrote:

Download latest svn. Go to package/madwifi/patches.
Copy all of them except these for newer kernels after 2.6.28 and except ibss patch to your old tree.

what do you mean by latest svn ?  is it backfire 10.03.1-rc5/?...... I can't find /madwifi/patches in the packages category where is it ? i am looking for it over here http://downloads.openwrt.org/backfire/10.03.1-rc5/atheros/packages/  it isn't there..

also what is the size of your rootfs did you use squashfs or jffs could you share your config for the rootfs as well as...
thanks in advance

i think member xssa in this forum was working on the switch but i don't know how far he had got to fixing the whole issue you should contact him, he made the vxkiller in this forum

ps how did you install openwrt to the router did you use the vxkiller or did you use spipgm and flash a bootloader to the router. Did you compile your own redboot for the 2mb flash and 8mb ram ? or did you just use the vxkiller

(Last edited by drekthar on 4 Oct 2011, 04:29)

This is how you can get latest:
svn co svn://svn.openwrt.org/openwrt/trunk/ openwrt
Size of root is 800-900KB or so. I still did not optimize it because i give more priority on working switch. If we do not have it we do not need more size. I wrote 2-3 times to xssa but still no answer.
I use normal flash from web. Also i put serial on the router so i can see what is going on.
xssa files works only on revisions 2.xx. Check on the backside of your router. If it is 3.x will not work.
As i said before seems switch is working when i put static things in mvswitch.c. We can stop diods/ports etc...
Just swconfig does not seem to work.

More info for TP-Link 340GD.
It is working in router mode with 2 vlans. 1 and 2 where vlan2 is the wan port we can choose in mvswitch.h and fix in mvswitch.c
Also i put dnsmasq + iptables and bridged eth0.1/ath0.
Everything is working but i am not good with the speed it is 1.2MB (10Mbit). It is too slow i need at least 70-80Mbit.
When in the other mode only bridge on the LAN port you can make 7-8MB (60-70Mbit) which is okay and on the wifi interface you can make 3MB (24Mbit).
Seems like iptables is killing the cpu of the router.
Anyone knows some optimizations for iptables or some kind of alternative ?

P.S.
Little improvement using SNAT instead MASQ but still 1.4MB lot's to go until 8-9MB in the other mode.
One note these speeds are in Megabytes not Megabits. This is important.

(Last edited by sanitariu on 5 Oct 2011, 22:55)

wow.... great work ...

sanitaru wrote:

It is working in router mode with 2 vlans. 1 and 2 where vlan2 is the wan port we can choose in mvswitch.h and fix in mvswitch.c
Also i put dnsmasq + iptables and bridged eth0.1/ath0.

how much free space is left....... does everything work fine after the router is restarted. ? Does it work after a power cycle...... ?   the images i made before does not work after a reboot or power cycle 


here is this thread it is a little old but it discusses on 2mb flash router

https://forum.openwrt.org/viewtopic.php?id=4039&p=1
(read both pages)

i can't  do anything to my router currently.. as i need a serial console to access the router after i  acccidentally initialized the redboot config....... so i can't help yet......


take a look at this script below  it is a briiliant hack don't know if it will work for trunk.... it reduces the size of the library (check the link above)

Here's a sample optimize_lib.sh taken from the wrtsl54g firmware source, to save anyone the effort. Again, it does have some drawbacks, but is absolutely necessary if you want a small firmware.

Code:

#!/bin/sh

#set -x

NM=mipsel-uclibc-nm
LD=mipsel-uclibc-ld
STRIP=mipsel-uclibc-strip

DIR=$1
LIB_SO=$2
LIB_A=$3
LIB_SO_M=$4
SEARCHDIR=$5
INSTALLLIB=$6

MAP=${DIR}/.map
SYM=${DIR}/.sybmols
UNR=${DIR}/.unresolved
BINARIES=`find $SEARCHDIR -path $SEARCHDIR/lib -prune -o -type f -print | file -f - | grep ELF | cut -d':' -f1`

if [ ! -f ${DIR}/${LIB_SO} ] ; then
    echo "Cann't find ${DIR}/${LIB_SO}";
    exit 0;
fi

if [ ! -f ${DIR}/${LIB_A} ] ; then
    echo "Cann't find ${DIR}/${LIB_A}";
    exit 0;
fi

rm -f $MAP
rm -f $SYM
rm -f $UNR

$NM -o --defined-only --no-sort ${DIR}/${LIB_SO} | cut -d' ' -f3 > $MAP
$NM --dynamic -u --no-sort $BINARIES | sort -u > $UNR
for symbol in `cat $UNR` ; do
    if grep -q "^$symbol" $MAP ; then echo "-u $symbol" >> $SYM ;
fi ; done

if ls $SYM ; then
    xargs -t $LD -shared -o ${DIR}/${LIB_SO_M} ${DIR}/${LIB_A} < $SYM ;
fi

if [ "a$INSTALLLIB" != "a" -a -f ${DIR}/${LIB_SO_M} ] ; then
    install ${DIR}/${LIB_SO_M} $INSTALLLIB
    $STRIP $INSTALLLIB
fi

(Last edited by drekthar on 6 Oct 2011, 06:31)