Project

General

Profile

TL-WR1043ND-v1.patch

Eric Krausser, 01/16/2012 09:11 AM

View differences:

boards/TPLink/TL-WR1043ND-v1/README Mon Jan 16 10:09:56 2012 +0100
1
Further work is in progress, for now the kernel boots and the rootfs mounts.
2

3
This was tested with TL-WR1043ND Ver:1.8, but I expect all 1.x should work.
4

5
Many thanks to Adrian Chadd and Alexandr Rybalko for the kind help with this
6
board definition, which is mostly based on Adrian's work on: 
7
http://code.google.com/p/freebsd-wifi-build/wiki/TpLinkTLWR1043ND
8

9

10

11
How to build
12
--------------------------------------------------------------------------------
13

14
as root:
15
make FREEBSD_SRC_TREE=/your/path/to/ZRouter's/modified/FreeBSD/head TARGET_PAIR=TPLink/TL-WR1043ND-v1
16

17
Find the TPLink_TL-WR1043ND-v1.bin in /usr/obj/... and copy it to
18
your TFTP server.
19

20

21

22
How to flash
23
--------------------------------------------------------------------------------
24

25
erase 0xbf020000 +7c0000
26
tftpboot 0x81000000 TPLink_TL-WR1043ND-v1.bin
27
cp.b 0x81000000 0xbf020000 0x7c0000
28
bootm 0xbf020000
29

30
(hint: you can concatenate the commands by ";")
31

32

33

34
TODO
35
--------------------------------------------------------------------------------
36

37
* scripts which are writing to flash don't work
38
  ("dd: /dev/map/config: Invalid argument")
39

40
* invert LEDs, now `echo 1 > /dev/led/status` switches off
41
 
42

43

44
Eric Kraußer
45

boards/TPLink/TL-WR1043ND-v1/board.hints Mon Jan 16 10:09:56 2012 +0100
1
# from head/sys/mips/conf/TP-WN1043ND.hints by Adrian Chadd
2

3

4
# arge
5
hint.arge.0.at="nexus0"
6
hint.arge.0.maddr=0x19000000
7
hint.arge.0.msize=0x1000
8
hint.arge.0.irq=2
9

10
hint.arge.1.at="nexus0"
11
hint.arge.1.maddr=0x1a000000
12
hint.arge.1.msize=0x1000
13
hint.arge.1.irq=3
14

15
# XXX The ath device hangs off of the AHB, rather than the Nexus.
16
hint.ath.0.at="nexus0"
17
hint.ath.0.maddr=0x180c0000
18
hint.ath.0.msize=0x30000
19
hint.ath.0.irq=0
20

21

22
# Hard-code the PHY for now, until there's switch phy support.
23
hint.arge.0.phymask=0x000c
24
hint.arge.0.media=1000
25
hint.arge.0.fduplex=1
26

27
# Where is the MAC address stored in flash for this particular unit.
28
hint.arge.0.eeprommac=0x1f01fc00
29

30
# This isn't used, but configure it anyway.
31
# This should eventually just not be configured, but the if then
32
# needs to be properly disabled or spurious interrupts occur.
33
hint.arge.1.phymask=0x0
34

35
# Where the ART is
36
hint.ath.0.eepromaddr=0x1fff1000
37

38
#
39
# Define a slightly custom flash layout.
40
# The default flash layout:
41
#
42
# 128k: uboot
43
# 1024k: kernel
44
# 4096k: rootfs
45
# 2816: unknown
46
# 64k: board config?
47
# 64k: ART
48
#
49
# from printenv:
50
# bootargs=console=ttyS0,115200 root=31:02 rootfstype=jffs2 init=/sbin/init
51
# mtdparts=ar9100-nor0:128k(u-boot),1024k(kernel),4096k(rootfs),64k(art)
52
# This isn't a lot of space!
53
# So:
54
# 128k: uboot
55
# ????: kernel
56
# ????: rootfs
57
# 64k: config
58
# 64k: ART
59

60
hint.map.0.at="flash/spi0"
61
hint.map.0.start=0x00000000
62
hint.map.0.end=0x000020000
63
hint.map.0.name="bootloader"
64
hint.map.0.readonly=1
65

66
hint.map.1.at="flash/spi0"
67
hint.map.1.start=0x00020000
68
hint.map.1.end="search:0x00100000:0x10000:.!/bin/sh"
69
hint.map.1.name="kernel"
70
hint.map.1.readonly=1
71

72
hint.map.2.at="flash/spi0"
73
hint.map.2.start="search:0x00100000:0x10000:.!/bin/sh"
74
hint.map.2.end=0x007e0000
75
hint.map.2.name="rootfs"
76
hint.map.2.readonly=1
77

78
hint.map.3.at="flash/spi0"
79
hint.map.3.start=0x00020000
80
hint.map.3.end=0x007e0000
81
hint.map.3.name="upgrade"
82
hint.map.3.readonly=0
83

84
hint.map.4.at="flash/spi0"
85
hint.map.4.start=0x007e0000
86
hint.map.4.end=0x007f0000
87
hint.map.4.name="config"
88
hint.map.4.readonly=0
89

90
# This is radio calibration section. It is (or should be!) unique
91
# for each board, to take into account thermal and electrical differences
92
# as well as the regulatory compliance data.
93
hint.map.5.at="flash/spi0"
94
hint.map.5.start=0x007f0000
95
hint.map.5.end=0x00800000
96
hint.map.5.name="art"
97
hint.map.5.readonly=1
98

99
# GPIO specific configuration block
100
# Don't flip on anything that isn't already enabled.
101
# This includes leaving the SPI CS1/CS2 pins as GPIO pins as they're
102
# not used here.
103
hint.gpio.0.function_set=0x00000000
104
hint.gpio.0.function_clear=0x00000000
105

106
# These are the GPIO LEDs and buttons which can be software controlled.
107
hint.gpio.0.pinmask=0x001c02ae
108
# pin 1 - USB (LED)
109
# pin 2 - System (LED)
110
# Pin 3 - Reset (input)
111
# Pin 5 - QSS (LED)
112
# Pin 7 - QSS Button (input)
113
# Pin 8 - wired into the chip reset line
114
# Pin 9 - WLAN
115
# Pin 10 - UART TX (not GPIO)
116
# Pin 13 - UART RX (not GPIO)
117
# Pin 18 - RTL8366RB switch data line
118
# Pin 19 - RTL8366RB switch clock line
119
# Pin 20 - "GPIO20"
120
# LEDs are configured separately and driven by the LED device
121

122
# the output needs to be inverted (flags=0x????)
123
# on some LEDs or "echo 1 > /dev/led/status" will switch off the LED
124
# see sys/sys/gpio.h in FreeBSD sources
125

126
# USB
127
hint.gpioled.0.at="gpiobus0"
128
hint.gpioled.0.name="usb"
129
hint.gpioled.0.pins=0x0002
130
#hint.gpioled.0.flags=0x????
131

132
# SYS
133
hint.gpioled.1.at="gpiobus0"
134
hint.gpioled.1.name="status"
135
hint.gpioled.1.pins=0x0004
136
#hint.gpioled.1.flags=0x????
137

138
# QSS
139
hint.gpioled.2.at="gpiobus0"
140
hint.gpioled.2.name="qss"
141
hint.gpioled.2.pins=0x0020
142

143
# WLAN
144
hint.gpioled.3.at="gpiobus0"
145
hint.gpioled.3.name="wlan"
146
hint.gpioled.3.pins=0x0200
147
#hint.gpioled.3.flags=0x????
148

boards/TPLink/TL-WR1043ND-v1/board.mk Mon Jan 16 10:09:56 2012 +0100
1

2
###################################################
3
#
4
# Board used hardware/chips
5
#
6
###################################################
7

8
SOC_VENDOR=Atheros
9
SOC_CHIP=AR9132
10
BOARD_FLASH_SIZE=8M
11

12

13
###################################################
14
#
15
# Vars for kernel config
16
#
17
###################################################
18

19
# ident 
20
KERNCONF_IDENT=${TARGET_VENDOR}_${TARGET_DEVICE}
21

22
# Enable the uboot environment stuff rather then the redboot stuff.
23
KERNCONF_OPTIONS+=	AR71XX_ENV_UBOOT
24

25
# Force the board memory - 32MB
26
KERNCONF_OPTIONS+=	AR71XX_REALMEM=32*1024*1024
27

28

29
# Include usb and SoC usb controller drivers
30
WITH_USB=yes
31

32
# Builded modules
33
KERNCONF_MODULES_OVERRIDE+=usb/uplcom usb/u3g usb/umodem usb/umass usb/ucom cam zlib
34

35
KERNCONF_DEVICES+=	switch
36

37
# Additional utilities
38
WORLD_SUBDIRS_ZROUTER+=target/sbin/upgrade
39

40
.if !defined(WITHOUT_WIRELESS)
41
KERNCONF_OPTIONS+=	IEEE80211_DEBUG
42
KERNCONF_OPTIONS+=	IEEE80211_SUPPORT_MESH
43
KERNCONF_OPTIONS+=	IEEE80211_SUPPORT_TDMA
44
KERNCONF_DEVICES+=	wlan
45
# ? not for ath?
46
#KERNCONF_DEVICES+=	wlan_amrr
47
KERNCONF_DEVICES+=	wlan_wep
48
KERNCONF_DEVICES+=	wlan_ccmp
49
KERNCONF_DEVICES+=	wlan_tkip
50
KERNCONF_DEVICES+=	wlan_xauth
51

52
KERNCONF_OPTIONS+=	AH_DEBUG
53
KERNCONF_OPTIONS+=	ATH_DEBUG
54
KERNCONF_OPTIONS+=	ATH_DIAGAPI
55
KERNCONF_OPTIONS+=	AH_SUPPORT_AR5416
56
# Makes other chipsets not function! 
57
KERNCONF_OPTIONS+=	AH_SUPPORT_AR9130
58
KERNCONF_OPTIONS+=	AH_RXCFG_SDMAMW_4BYTES
59
KERNCONF_OPTIONS+=	ATH_ENABLE_11N
60

61
KERNCONF_DEVICES+=	ath
62
KERNCONF_DEVICES+=	ath_rate_sample
63
KERNCONF_DEVICES+=	ath_ahb
64
# not needed anymore?
65
#KERNCONF_DEVICES+=	ath_hal
66
KERNCONF_DEVICES+=	ath_ar5212
67
KERNCONF_DEVICES+=	ath_ar5416
68
KERNCONF_DEVICES+=	ath_ar9130
69
.endif
70

71

72
###################################################
73
#
74
#       Limits
75
#
76
###################################################
77

78
# Image must not be bigger than 'upgrade' geom_map partition
79
FIRMWARE_IMAGE_SIZE_MAX=0x007c0000
80

81
# the hint.map.?.start address from board.hints where hint.map.?.name="kernel"
82
KERNEL_MAP_START=0x00020000
83

84

85
###################################################
86
#
87
#       Firmware Image Options
88
#
89
###################################################
90

91
TARGET_PROFILES+=SMALL_ mpd ssh shttpd dlink.ua.web hostap dhcp nfs_client
92

93
MKULZMA_BLOCKSIZE=65536
94

95
PACKING_KERNEL_IMAGE=kernel.strip.kbin.gz.sync
96
PACKING_ROOTFS_IMAGE=rootfs_clean.iso.ulzma
97

98
TPLINK_BOARDTYPE="TL-WR1043NDv1"
99

100
IMAGE_SUFFIX=bin
101
NEW_IMAGE_TYPE=tplink_image
102

boards/TPLink/TL-WR1043ND-v1/files/etc/rc.d/ADAPTATION Mon Jan 16 10:09:56 2012 +0100
1
#!/bin/sh
2

3
# PROVIDE: ADAPTATION
4

5
. /etc/rc.subr
6
. /etc/network.subr
7

8
name="ADAPTATION"
9
start_cmd="adapt_start"
10
start_precmd="adapt_prestart"
11
start_postcmd="adapt_poststart"
12
stop_cmd="adapt_stop"
13

14
adapt_prestart()
15
{
16
	#ifconfig rt0 name lan0
17
	#ifconfig vlan2 create vlan 2 vlandev lan0
18
	#ifconfig vlan2 name wan0
19
	# name wlan0 will be used when hostap or client are created
20
	#ifconfig rt28600 name wifi0
21
	#hostname `kenv HostName`
22
	#wan_mac_addr=`kenv WAN_MAC_ADDR`
23
	# lan mac wan+1
24
	# wlan mac wan+2
25

26
}
27

28
adapt_start()
29
{
30
}
31

32
adapt_poststart()
33
{
34
}
35

36
adapt_stop()
37
{
38
}
39

40
load_rc_config $name
41

42
run_rc_command $*