Initial README version
[oweals/u-boot_mod.git] / README.md
1 U-Boot 1.1.4 modification for TP-Link, and not only, routers
2 ==========
3
4 # Introduction #
5
6 In short, this project is a deep modification of **U-Boot 1.1.4** sources from **TP-Link**, which you can download from their **[GPL Code Center](http://www.tp-link.com/en/support/gpl/ "TP-Link GPL Code Center")**.
7
8 The concept for this project came from another U-Boot modification, dedicated to small and very popular TP-Link router - model **TL-WR703N**, which includes web fail safe mode: **[wr703n-uboot-with-web-failsafe](http://code.google.com/p/wr703n-uboot-with-web-failsafe/)**. I was using it and decided to make my own version, which could have some improvements, additional capabilities and support for different models.
9
10 First version of this modification was introduced on **OpenWrt** forum in [this thread](https://forum.openwrt.org/viewtopic.php?id=43237), at the end of March 2013 and it was dedicated only for TP-Link routers with **Atheros AR9331** SoC. Now, it supports also models with **Atheros AR9344** (like **TP-Link TL-WDR3600** and **TL-WDR43x0**) and other (in the near future **Atheros AR9341**) are under development.
11
12 # Supported devices #
13
14 Currently supported devices (default FLASH/RAM size):
15
16 - **Atheros AR9331**:
17     - (16/64 MiB) [8devices Carambola 2](http://8devices.com/carambola-2) (version with development board!)
18     - (4/32 MiB) [TP-Link TL-MR3020 v1](http://wiki.openwrt.org/toh/tp-link/tl-mr3020)
19     - (4/32 MiB) [TP-Link TL-MR3040 v1 and v2](http://wiki.openwrt.org/toh/tp-link/tl-mr3040)
20     - (4/32 MiB) [TP-Link TL-WR703N v1](http://wiki.openwrt.org/toh/tp-link/tl-wr703n)
21     - (4/32 MiB) [TP-Link TL-WR720N v3](http://wiki.openwrt.org/toh/tp-link/tl-wr720n) (version for Chinese market)
22     - (8/32 MiB) [TP-Link TL-WR710N v1](http://www.tp-link.com/en/products/details/?model=TL-WR710N) (version for European market)
23     - (4/32 MiB) [TP-Link TL-MR10U v1](http://wiki.openwrt.org/toh/tp-link/tl-mr10u)
24     - (4/32 MiB) [TP-Link TL-WR740N v4](http://wiki.openwrt.org/toh/tp-link/tl-wr740n) (and similar, like TL-WR741ND v4)
25     - (4/32 MiB) [TP-Link TL-MR3220 v2](http://wiki.openwrt.org/toh/tp-link/tl-mr3420)
26
27 - **Atheros AR9344**:
28     - (8/128 MiB) [TP-Link TL-WDR3600 v1](http://wiki.openwrt.org/toh/tp-link/tl-wdr3600)
29     - (8/128 MiB) [TP-Link TL-WDR43x0 v1](http://wiki.openwrt.org/toh/tp-link/tl-wdr4300)
30
31 I tested this modification on most of these devices, with OpenWrt and OFW firmware. If you are not sure about the version of your device, please contact with me *before* you try to make an upgrade. Changing bootloader to a wrong version will probably damage your router and you will need a serial FLASH programmer to fix it, so be *very* careful.
32
33 # Modifications, changes #
34
35 ## Web server  ##
36
37 The most important change is an inclusion of a web server, based on **[uIP 0.9 TCP/IP stack](http://www.gaisler.com/doc/net/uip-0.9/doc/html/main.html)**. It allows to upgrade **firmware**, **U-Boot** and **ART** (**Atheros Radio Test**) images, directly from your web browser, without need to access serial console and running a TFTP server. You can find similar firmware recovery mode, also based on uIP 0.9 TCP/IP stack, in **D-Link** routers.
38
39 Web server contains 7 pages:
40
41 1. index.html (allows to upgrade firmware image)
42 2. uboot.html (U-Boot image)
43 3. art.html (ART image)
44 4. flashing.html
45 5. 404.html
46 6. fail.html
47 7. style.css
48
49 ![](http://www.tech-blog.pl/wordpress/wp-content/uploads/2013/08/uboot_mod_firmware_upgrade.jpg)
50
51 ## Network Console ##
52
53 Second, very useful modification is a network console. It allows you to communicate with U-Boot console over the Ethernet, using UDP protocol (default UDP port: 6666, router IP: 192.168.1.1).
54
55 ![](http://www.tech-blog.pl/wordpress/wp-content/uploads/2013/04/u-boot_mod_for_tp-link_with_ar9331_netconsole.jpg)
56
57 ## Other ##
58
59 Moreover:
60
61 - faster boot up,
62 - unnecessary information from boot up sequence were removed,
63 - flash chip is automatically recognized (using JEDEC ID),
64 - Ethernet MAC is set from flash (no more "No valid address in Flash. Using fixed address"),
65 - automatic kernel booting can be interrupted using any key,
66 - press and hold reset button to run:
67     - web server (min. 3 seconds),
68     - U-Boot serial console (min. 5 seconds),
69     - U-Boot network console (min. 7 seconds),
70 - additional commands (in comparison to the default version; availability depends on router model):
71     -  httpd
72     -  printmac
73     -  setmac
74     -  printmodel
75     -  printpin
76     -  startnc
77     -  startsc
78     -  eraseenv
79     -  ping
80     -  dhcp
81     -  sntp
82     -  iminfo
83 - overclocking possibilities (for now, only TP-Link routers with AR9331)
84
85 ## Supported flash chips ##
86
87 Flash type detection may be very useful for people who has exchanged the flash chip in their routers. You will not need to recompile sources, to have access to overall flash space in U-Boot console.
88
89 If you use flash type which is not listed below, this version of U-Boot will use default size for your router.
90
91 Currently supported flash types:
92
93 **4 MiB**:
94
95 - Spansion S25FL032P (4 MiB, JEDEC ID: 01 0215)*
96 - Atmel AT25DF321 (4 MiB, JEDEC ID: 1F 4700)
97 - EON EN25Q32 (4 MiB, JEDEC ID: 1C 3016)*
98 - Micron M25P32 (4 MiB, JEDEC ID: 20 2016)
99 - Windbond W25Q32 (4 MiB, JEDEC ID: EF 4016)
100 - Macronix MX25L320 (4 MiB, JEDEC ID: C2 2016)
101
102 **8 MiB**:
103
104 - Spansion S25FL064P (8 MiB, JEDEC ID: 01 0216)
105 - Atmel AT25DF641 (8 MiB, JEDEC ID: 1F 4800)
106 - EON EN25Q64 (8 MiB, JEDEC ID: 1C 3017)*
107 - Micron M25P64 (8 MiB, JEDEC ID: 20 2017)
108 - Windbond W25Q64 (8 MiB, JEDEC ID: EF 4017)*
109 - Macronix MX25L64 (8 MiB, JEDEC ID: C2 2017, C2 2617)
110 - SST 25VF064C (8 MiB, JEDEC ID: BF 254B)
111
112 **16 MiB**:
113
114 - Winbond W25Q128 (16 MB, JEDEC ID: EF 4018)*
115 - Macronix MX25L128 (16 MB, JEDEC ID: C2 2018, C2 2618)
116
117 (*) tested
118
119 If you want to use other type, please contact with me or make changes in code, test them and send a pull request.
120
121 # How to install it? #
122
123 [TODO]
124
125 # How to compile the code? #
126
127 You can use one of the free toolchains:
128
129
130 - [Sourcery CodeBench Lite Edition for MIPS GNU/Linux](https://sourcery.mentor.com/GNUToolchain/subscription3130?lite=MIPS),
131 - [OpenWrt Toolchain for AR71xx MIPS](http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2.tar.bz2),
132 - [ELDK (Embedded Linux Development Kit)](ftp://ftp.denx.de/pub/eldk/),
133 - or any others...
134
135 I am using **Sourcery CodeBench Lite Edition for MIPS GNU/Linux** on **Ubuntu 12.04 LTS** and all released binary images were/will be built using this set.
136
137 # FAQ #
138
139 1. My device is not supported but has the same hardware as one in the list, can I use this modification?
140
141         *It could be dangerous! I know that a lot of routers uses the same hardware - for example, TP-Link has a battery powered routers set, which contains: TL-MR10U, TL-MR11U (TL-MR3040 in Europe) TL-MR12U and TL-MR13U. All of them has the same platform: Atheros AR9331 with 32 MiB of DDR RAM and 4 MiB of SPI NOR FLASH. But, there may exist a slight difference, like GPIO pin number for reset button or LED(s), that may cause problems.*
142
143         *You can try, but remember that you are doing this only at your own risk!*
144
145 2. I want to overclock my router, how can I do this?
146
147         *Currently, this option is available only for TP-Link routers with Atheros AR9331 (please, see *ap121.h* file inside *u-boot/inlude/configs* folder. What more, you will need to compile the code, because I do not want to publish images with non-default clocks.*
148
149         *And again, remember that you are doing this only at your own risk!*
150
151 # License, outdated sources etc. #
152
153 **[U-Boot](http://www.denx.de/wiki/U-Boot/WebHome "U-Boot")** project is Free Software, licensed under version 2 of the **GNU General Public License**. All information about license, contributors etc., are included with sources, inside *u-boot* folder.
154
155 You should know, that most routers, especially those based on Atheros SoCs, uses very old versions of U-Boot (1.1.4 is from 2005/2006). So, *these sources are definitely outdated* (do not even try to merge them with official release), but it was easier for me to modify them, than move TP-Link/Atheros changes to the current version. Moreover, lot of unnecessary code fragments and source files were removed for ease of understanding the code.