Openwrt: Difference between revisions

From Halfface
Jump to navigation Jump to search
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Small linux for routers=
=Small linux for routers=
==Router==
==Router==
  http://wiki.openwrt.org/inbox/tp-link.tl-wr1043nd
  http://wiki.openwrt.org/toh/tp-link/tl-wr1043nd
  https://forum.openwrt.org/viewtopic.php?id=22742&p=15
  https://forum.openwrt.org/viewtopic.php?id=22742&p=15


Line 10: Line 10:
  mtd -e firmware write /tmp/openwrt-ar71xx-tl-wr1043ndv1-squashfs-universal.bin firmware
  mtd -e firmware write /tmp/openwrt-ar71xx-tl-wr1043ndv1-squashfs-universal.bin firmware
  reboot
  reboot
==standard config changes==
# Disable firewall
/etc/init.d/firewall disable
# Change password
passwd
# change banner
vim /etc/banner
# change hostname and timezone
  config 'system'
        option 'hostname' 'openwrt'
        option 'timezone' 'CET-1CEST,M3.5.0,M10.5.0/3'
        option 'zonename' 'Europe/Stockholm'
# Add ssh public key to authorized_keys.
vim /etc/dropbear/authorized_keys
# fix network
vim /etc/config/network
vim /etc/config/wireless


==Which version of openwrt is installed.==
==Which version of openwrt is installed.==
Line 21: Line 39:
  opkg update  
  opkg update  
install openvpn
install openvpn
  opkg install http://downloads.openwrt.org/kamikaze/8.09.2/brcm-2.4/packages/zlib_1.2.3-5_mipsel.ipk
  opkg install zlib libopensslliblzo openvpn
opkg install http://downloads.openwrt.org/kamikaze/8.09.2/brcm-2.4/packages/libopenssl_0.9.8i-3.2_mipsel.ipk
luci webinterface
opkg install http://downloads.openwrt.org/kamikaze/8.09.2/brcm-2.4/packages/liblzo_2.03-1_mipsel.ipk
opkg install http://downloads.openwrt.org/kamikaze/8.09.2/brcm-2.4/packages/openvpn_2.0.9-5.1_mipsel.ipk
install luci webinterface
  opkg update
  opkg update
  opkg install luci-admin-full
  opkg install luci-admin-full luci-theme-openwrt uhttpd


==mount jffs2==
==mount jffs2==
Line 35: Line 50:
*mac address
*mac address
  cat /sys/class/ieee80211/phy0/macaddress
  cat /sys/class/ieee80211/phy0/macaddress
*wireless information
iw wlan0 info
*which clients are connected.
iw dev wlan0 station dump
*scan for networks
iw dev wlan0 scan


==serial cable==
==serial cable==
Line 50: Line 71:
==openwrt==
==openwrt==
  http://eko.one.pl/openwrt/
  http://eko.one.pl/openwrt/
http://ecco.selfip.net/tl-wr1043nd-luci/
  http://openwrt.groov.pl
  http://openwrt.groov.pl
==recover tp-link wr1043nd==
==recover tp-link wr1043nd==


Line 72: Line 95:
Connect cables to wr1043nd and plug usb in computer. Start terminal emulator.
Connect cables to wr1043nd and plug usb in computer. Start terminal emulator.
  screen /dev/ttyUSB0 115200
  screen /dev/ttyUSB0 115200
===Strip firmware===
you can use any hexeditor to delete the first 0x20200 byte, it will start with 01 00 00 00 54 50 after delete. Or use dd as in this example.
dd if=wr1043nv1_en_3_9_17_up_boot.bin of=code.bin skip=257 bs=512
==put firmware on server==
put stripped firmware code.bin in /tftproot/ on tftp server
code.bin


===Flash with working flash===
===Flash with working flash===

Latest revision as of 19:42, 24 June 2010

Small linux for routers

Router

http://wiki.openwrt.org/toh/tp-link/tl-wr1043nd
https://forum.openwrt.org/viewtopic.php?id=22742&p=15

Write firmware

mtd write /tmp/openwrt-brcm47xx-squashfs.trx linux
reboot
mtd -e firmware write /tmp/openwrt-ar71xx-tl-wr1043ndv1-squashfs-universal.bin firmware
reboot

standard config changes

# Disable firewall
/etc/init.d/firewall disable
# Change password
passwd
# change banner
vim /etc/banner
# change hostname and timezone
 config 'system'
        option 'hostname' 'openwrt'
        option 'timezone' 'CET-1CEST,M3.5.0,M10.5.0/3'
        option 'zonename' 'Europe/Stockholm'
# Add ssh public key to authorized_keys.
vim /etc/dropbear/authorized_keys
# fix network
vim /etc/config/network
vim /etc/config/wireless

Which version of openwrt is installed.

cat /etc/banner

read /var/log/messages

logread

packages

update package list

opkg update 

install openvpn

opkg install zlib libopensslliblzo openvpn

luci webinterface

opkg update
opkg install luci-admin-full luci-theme-openwrt uhttpd

mount jffs2

mount -t jffs2 /dev/mtdblock3 /jffs/

list wireless

iw phy
  • mac address
cat /sys/class/ieee80211/phy0/macaddress
  • wireless information
iw wlan0 info
  • which clients are connected.
iw dev wlan0 station dump
  • scan for networks
iw dev wlan0 scan

serial cable

chips PL2303 FT232 max3232
standard ftdi
http://www.nslu2-linux.org/wiki/HowTo/AddASerialPort
http://wiki.openwrt.org/oldwiki/openwrtdocs/customizing/hardware/serial_console
http://wiki.openwrt.org/inbox/tp-link.tl-wr1043nd#oem.installation.using.the.tftp.and.rs232.method
http://jethomson.wordpress.com/2010/02/21/diy-usb-to-serial-cable-for-3usd/

When you have failed to create serial cable buy one that just works.

  • TTL-232R-AJ

TTL-232R-AJ pinout.jpg

openwrt

http://eko.one.pl/openwrt/
http://ecco.selfip.net/tl-wr1043nd-luci/
http://openwrt.groov.pl

recover tp-link wr1043nd

Create a serial cable from a nokia ca-42 datacable.

  • Cut cable of ca-42 and locate the four cables. gnd, rx, tx, ttl

Ca-42 dku-5 pinout.jpg Serial port cummunication values.

115200 8n1

open tp-wr1043nd

  1. Remove the two screws from under the rubber feet at the back of the device.
  2. Unscrew all three retaining nuts on the SMA connectors and carefully push them into the housing.
  3. Push one of the bottom screws back into place to separate the top from the outer frame.
  4. With the top slightly open, push the bottom plastic away from the outer frame.
  5. Remove outer frame.
  6. With a flathead screwdriver or similar tool, gently pry the two front clips apart.
  7. Carefully separate the bottom guide posts from the top of the unit, then pull the top section forward.
  • Connect cables to PCB.

Wr1043ndserial.jpg

Connect computer and router

Connect cables to wr1043nd and plug usb in computer. Start terminal emulator.

screen /dev/ttyUSB0 115200

Strip firmware

you can use any hexeditor to delete the first 0x20200 byte, it will start with 01 00 00 00 54 50 after delete. Or use dd as in this example.

dd if=wr1043nv1_en_3_9_17_up_boot.bin of=code.bin skip=257 bs=512

put firmware on server

put stripped firmware code.bin in /tftproot/ on tftp server

code.bin

Flash with working flash

Start router and look at terminal. When waiting for 1 second press

tpl 
  • when it show autobooting, it will let you get into U-boot.
  • you can set the router ip address by
setenv ipaddr 192.168.1.1
  • tftpd server address by
setenv serverip 192.168.1.100

What to write in ubootin

erase 0xbf020000 +7c0000
7c0000: size of the firmware (be aware that u can have diffrent size so u will brick your router) 
tftpboot 0x81000000 code.bin
cp.b 0x81000000 0xbf020000 0x7c0000
bootm 0xbf020000