{"id":1504,"date":"2014-12-29T20:59:35","date_gmt":"2014-12-29T12:59:35","guid":{"rendered":"http:\/\/www.computersolutions.cn\/blog\/?p=1504"},"modified":"2014-12-30T00:41:04","modified_gmt":"2014-12-29T16:41:04","slug":"flashing-a-mercury-mac1200r-wifi-router","status":"publish","type":"post","link":"https:\/\/www.computersolutions.cn\/blog\/2014\/12\/flashing-a-mercury-mac1200r-wifi-router\/","title":{"rendered":"Flashing a Mercury MAC1200R Wifi Router"},"content":{"rendered":"<p>The Mercury MAC1200R (TPLINK WR6300) is one of the cheapest AC based routers on the planet, as I have a few AC devices I thought I&#8217;d buy one to try out. They&#8217;re available for under RMB120 or so online.<\/p>\n<p>Mercury hardware is TPLink hardware, albeit using a different name.  Same stuff, same factory, different casing.<\/p>\n<p>The router has 64M ram, and 8M flash. CPU \/ Wifi AR9344 \/ QCA9882<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/farm9.staticflickr.com\/8635\/16136322022_86caef809c_o_d.jpg\" alt=\"\" \/><\/p>\n<p>OpenWRT says it has support, so I had a quick go at taking a look at flashing one.<\/p>\n<p>First steps:<\/p>\n<p>Open up the unit (remove the 2 screws underneath, then use a spare credit card or similar to jam open the plastic case).<\/p>\n<p>The serial headers are to the right of the SoC.<br \/>\nYou&#8217;ll need a rs232 to ttl or usb to ttl adaptor.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/farm9.staticflickr.com\/8627\/15951291657_3fa850e915_o_d.jpg\" alt=\"pl2303\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/farm8.staticflickr.com\/7473\/15951289417_fc4de99b81_o_d.jpg\" alt=\"gnd, tx, rx\" \/><\/p>\n<p>Pin 1 is GND<br \/>\nPin 2 is TX (connect to rx)<br \/>\nPin 3 is RX (connect to tx)<br \/>\nPin 4 is VCC (don&#8217;t connect).<\/p>\n<p>Port speeds are 115200,8,n,1<\/p>\n<p>Connect up, and you should see a flurry of activity on boot.<\/p>\n<p>To get into the bootloader (uBoot), you&#8217;ll need to type tpl<br \/>\nMay take a few tries, so prepare to pull power and retry again, and again till you get in.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/farm8.staticflickr.com\/7472\/16136295512_8114dc28b0_o_d.jpg\" alt=\"uboot\" \/><\/p>\n<p>You&#8217;ll need a TFTPD server running on 192.168.1.100 to push files over.  My Mac no haz ethernet (and Thunderbolt to Ethernet is crud), so I use my venerable X40 and tftpd software.<\/p>\n<p>Firmware is up here.  (Or you can compile your own)   ->  <a href=\"http:\/\/pan.baidu.com\/s\/1hqkVOfa\">http:\/\/pan.baidu.com\/s\/1hqkVOfa<\/a><\/p>\n<p>Firmware locations in flash  (see below)<br \/>\n<code>printenv<br \/>\nbootargs=console=ttyS0,115200 root=31:02 rootfstype=jffs2 init=\/sbin\/init mtdparts=ath-nor0:256k(u-boot),64k(u-boot-env),6336k(rootfs),1408k(uImage),64k(mib0),64k(ART)<br \/>\nbootcmd=bootm 0x9f020000<br \/>\nbootdelay=1<br \/>\nbaudrate=115200<br \/>\nethaddr=0xba:0xbe:0xfa:0xce:0x08:0x41<br \/>\nipaddr=192.168.1.111<br \/>\nserverip=192.168.1.100<br \/>\ndir=<br \/>\nlu=tftp 0x80060000 ${dir}u-boot.bin&&erase 0x9f000000 +$filesize&&cp.b $fileaddr 0x9f000000 $filesize<br \/>\nlf=tftp 0x80060000 ${dir}db12x${bc}-jffs2&&erase 0x9f050000 +0x630000&&cp.b $fileaddr 0x9f050000 $filesize<br \/>\nlk=tftp 0x80060000 ${dir}vmlinux${bc}.lzma.uImage&&erase 0x9f680000 +$filesize&&cp.b $fileaddr 0x9f680000 $filesize<br \/>\nstdin=serial<br \/>\nstdout=serial<br \/>\nstderr=serial<br \/>\nethact=eth0<\/p>\n<p>Environment size: 686\/65532 bytes<\/code><\/p>\n<p><code>Upload to the uBoot<\/p>\n<p>U-Boot 1.1.4--LSDK-10.1.389 (Apr  9 2014 - 15:23:02)<\/p>\n<p>U-Boot DB120<br \/>\nWasp 1.2<\/p>\n<p>DRAM:  64 MB<br \/>\nFlash Manuf Id 0xef, DeviceId0 0x40, DeviceId1 0x17<br \/>\nflash size 8MB, sector count = 128<br \/>\nFlash:  8 MB<br \/>\nUsing default environment<\/p>\n<p>In:    serial<br \/>\nOut:   serial<br \/>\nErr:   serial<br \/>\nNet:   ag934x_enet_initialize...<br \/>\nNo valid address in Flash. Using fixed address<br \/>\nNo valid address in Flash. Using fixed address<br \/>\n wasp  reset mask:c02200<br \/>\nWASP ----> S27 PHY<br \/>\ns27 reg init<br \/>\n: cfg1 0x80000000 cfg2 0x7114<br \/>\neth0: ba:be:fa:ce:08:41<br \/>\nathrs27_phy_setup ATHR_PHY_CONTROL 4 :1000<br \/>\nathrs27_phy_setup ATHR_PHY_SPEC_STAUS 4 :10<br \/>\neth0 up<br \/>\nWASP ----> S27 PHY<br \/>\ns27 reg init lan<br \/>\nATHRS27: resetting s27<br \/>\nATHRS27: s27 reset done<br \/>\n: cfg1 0x800c0000 cfg2 0x7214<br \/>\neth1: ba:be:fa:ce:08:41<br \/>\nathrs27_phy_setup ATHR_PHY_CONTROL 0 :1000<br \/>\nathrs27_phy_setup ATHR_PHY_SPEC_STAUS 0 :10<br \/>\nathrs27_phy_setup ATHR_PHY_CONTROL 1 :1000<br \/>\nathrs27_phy_setup ATHR_PHY_SPEC_STAUS 1 :10<br \/>\nathrs27_phy_setup ATHR_PHY_CONTROL 2 :1000<br \/>\nathrs27_phy_setup ATHR_PHY_SPEC_STAUS 2 :10<br \/>\nathrs27_phy_setup ATHR_PHY_CONTROL 3 :1000<br \/>\nathrs27_phy_setup ATHR_PHY_SPEC_STAUS 3 :10<br \/>\neth1 up<br \/>\neth0, eth1<br \/>\nSetting 0xb8116290 to 0x30602d0f<br \/>\nAutobooting in 1 seconds<br \/>\ndb12x><\/p>\n<p>db12x> tftpboot 0x81000000 image.bin<br \/>\neth1 link down<br \/>\nenet0 port4 up<br \/>\ndup 1 speed 100<br \/>\nUsing eth0 device<br \/>\nTFTP from server 192.168.1.100; our IP address is 192.168.1.111<br \/>\nFilename 'image.bin'.<br \/>\nLoad address: 0x81000000<br \/>\nLoading: #################################################################<br \/>\n         #################################################################<br \/>\n         #################################################################<br \/>\n         #################################################################<br \/>\n         #################################################################<br \/>\n         #################################################################<br \/>\n         #################################################################<br \/>\n         #################################################################<br \/>\n         #################################################################<br \/>\n         ##############################<br \/>\ndone<br \/>\nBytes transferred = 3145732 (300004 hex)<br \/>\ndb12x> erase 0x9f020000 +0x3c0000<br \/>\nErasing flash... ............................................................<br \/>\nErased 60 sectors<br \/>\ndb12x> cp.b 0x81000000 0x9f020000 0x3c0000<br \/>\nCopy to Flash... ............................................................done<br \/>\ndb12x> bootm 9f020000<\/p>\n<p><\/code><\/p>\n<p>It should boot into OpenWRT, you can flash from there.  <\/p>\n<p><code><br \/>\n...[long kernel bootlogs redacted]<\/p>\n<p>- init complete -<\/p>\n<p>BusyBox v1.22.1 (2014-12-15 18:46:26 CST) built-in shell (ash)<br \/>\nEnter 'help' for a list of built-in commands.<\/p>\n<p>  _______                     ________        __<br \/>\n |       |.-----.-----.-----.|  |  |  |.----.|  |_<br \/>\n |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|<br \/>\n |_______||   __|_____|__|__||________||__|  |____|<br \/>\n          |__| W I R E L E S S   F R E E D O M<br \/>\n -----------------------------------------------------<br \/>\n BARRIER BREAKER (14.07, r42625)<br \/>\n -----------------------------------------------------<br \/>\n  * 1\/2 oz Galliano         Pour all ingredients into<br \/>\n  * 4 oz cold Coffee        an irish coffee mug filled<br \/>\n  * 1 1\/2 oz Dark Rum       with crushed ice. Stir.<br \/>\n  * 2 tsp. Creme de Cacao<br \/>\n -----------------------------------------------------<\/p>\n<p>cat \/proc\/mtd<br \/>\ndev:    size   erasesize  name<br \/>\nmtd0: 00020000 00010000 \"u-boot\"<br \/>\nmtd1: 0010206c 00010000 \"kernel\"<br \/>\nmtd2: 006cdf94 00010000 \"rootfs\"<br \/>\nmtd3: 004d0000 00010000 \"rootfs_data\"<br \/>\nmtd4: 00010000 00010000 \"art\"<br \/>\nmtd5: 007d0000 00010000 \"firmware\"<\/p>\n<p><\/code><\/p>\n<p>I highly recommend replacing the bootloader with an unlocked one.<br \/>\ni.e. this one &#8211; https:\/\/github.com\/pepe2k\/u-boot_mod<\/p>\n<p>Bootloader sits at 0x9f000000 and is 64kb in size.<br \/>\nSuggest load in ram at 0x80060000 like they do, and flash from there.<\/p>\n<p>eg from the bootloader &#8211; <\/p>\n<p><code>tfpboot 0x80060000 uboot.bin<br \/>\nerase 0x9f000000 +0x20000<br \/>\ncp.b 0x80060000 0x9f000000 0x20000<br \/>\n<\/code><\/p>\n<p>Pray that it didn&#8217;t mess up (or you need an spi flasher&#8230;), and reboot!<\/p>\n<p>Other bits n bobs &#8211;<\/p>\n<p>You&#8217;ll need to adjust the opkg.conf file<\/p>\n<p>ssh into the router @ 192.168.1.1 \/ root \/ root<\/p>\n<p><code>mv \/etc\/opkg.conf \/etc\/opkg.conf.orig<\/p>\n<p>echo 'dest root \/<br \/>\ndest ram \/tmp<br \/>\nlists_dir ext \/var\/opkg-lists<br \/>\noption overlay_root \/overlay<br \/>\nsrc\/gz barrier_breaker_base http:\/\/downloads.openwrt.org\/barrier_breaker\/14.07\/ar71xx\/generic\/packages\/base<br \/>\nsrc\/gz barrier_breaker_management http:\/\/downloads.openwrt.org\/barrier_breaker\/14.07\/ar71xx\/generic\/packages\/management<br \/>\nsrc\/gz barrier_breaker_oldpackages http:\/\/downloads.openwrt.org\/barrier_breaker\/14.07\/ar71xx\/generic\/packages\/oldpackages<br \/>\nsrc\/gz barrier_breaker_packages http:\/\/downloads.openwrt.org\/barrier_breaker\/14.07\/ar71xx\/generic\/packages\/packages<br \/>\nsrc\/gz barrier_breaker_routing http:\/\/downloads.openwrt.org\/barrier_breaker\/14.07\/ar71xx\/generic\/packages\/routing<br \/>\nsrc\/gz barrier_breaker_telephony http:\/\/downloads.openwrt.org\/barrier_breaker\/14.07\/ar71xx\/generic\/packages\/telephony<br \/>\nsrc\/gz barrier_breaker_luci http:\/\/downloads.openwrt.org\/barrier_breaker\/14.07\/ar71xx\/generic\/packages\/luci<\/p>\n<p>#src\/gz barrier_breaker_base http:\/\/downloads.openwrt.org\/snapshots\/trunk\/ar71xx\/packages\/base<br \/>\n#src\/gz barrier_breaker_management http:\/\/downloads.openwrt.org\/snapshots\/trunk\/ar71xx\/packages\/management<br \/>\n#src\/gz barrier_breaker_oldpackages http:\/\/downloads.openwrt.org\/snapshots\/trunk\/ar71xx\/packages\/oldpackages<br \/>\n#src\/gz barrier_breaker_packages http:\/\/downloads.openwrt.org\/snapshots\/trunk\/ar71xx\/packages\/packages<br \/>\n#src\/gz barrier_breaker_routing http:\/\/downloads.openwrt.org\/snapshots\/trunk\/ar71xx\/packages\/routing<br \/>\n#src\/gz barrier_breaker_telephony http:\/\/downloads.openwrt.org\/snapshots\/trunk\/ar71xx\/packages\/telephony' >> \/etc\/opkg.conf<\/code><\/p>\n<p>&#8230;and install Luci (the openwrt webui)<\/p>\n<p><code>opkg update<br \/>\nopkg install luci<br \/>\n<\/code><\/p>\n<p>You should be able to visit http:\/\/192.168.1.1 and start changing settings.<\/p>\n<p><a href=\"http:\/\/www.computersolutions.cn\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-30-at-12.32.24-AM.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.computersolutions.cn\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-30-at-12.32.24-AM-226x300.png\" alt=\"Screen Shot 2014-12-30 at 12.32.24 AM\" width=\"226\" height=\"300\" class=\"aligncenter size-medium wp-image-1516\" srcset=\"https:\/\/www.computersolutions.cn\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-30-at-12.32.24-AM-226x300.png 226w, https:\/\/www.computersolutions.cn\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-30-at-12.32.24-AM.png 596w\" sizes=\"auto, (max-width: 226px) 100vw, 226px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/www.computersolutions.cn\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-30-at-12.32.34-AM.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.computersolutions.cn\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-30-at-12.32.34-AM-300x265.png\" alt=\"Screen Shot 2014-12-30 at 12.32.34 AM\" width=\"300\" height=\"265\" class=\"aligncenter size-medium wp-image-1517\" srcset=\"https:\/\/www.computersolutions.cn\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-30-at-12.32.34-AM-300x265.png 300w, https:\/\/www.computersolutions.cn\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-30-at-12.32.34-AM-1024x905.png 1024w, https:\/\/www.computersolutions.cn\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-30-at-12.32.34-AM.png 1496w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Mercury MAC1200R (TPLINK WR6300) is one of the cheapest AC based routers on the planet, as I have a few AC devices I thought I&#8217;d buy one to try out. They&#8217;re available for under RMB120 or so online. Mercury hardware is TPLink hardware, albeit using a different name. Same stuff, same factory, different casing. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[282,25,4],"tags":[197,241,507],"class_list":["post-1504","post","type-post","status-publish","format-standard","hentry","category-firmware-2","category-technical-mumbo-jumbo","category-useful-info","tag-firmware","tag-hacking","tag-mac1200r"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.computersolutions.cn\/blog\/wp-json\/wp\/v2\/posts\/1504","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.computersolutions.cn\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.computersolutions.cn\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.computersolutions.cn\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.computersolutions.cn\/blog\/wp-json\/wp\/v2\/comments?post=1504"}],"version-history":[{"count":12,"href":"https:\/\/www.computersolutions.cn\/blog\/wp-json\/wp\/v2\/posts\/1504\/revisions"}],"predecessor-version":[{"id":1518,"href":"https:\/\/www.computersolutions.cn\/blog\/wp-json\/wp\/v2\/posts\/1504\/revisions\/1518"}],"wp:attachment":[{"href":"https:\/\/www.computersolutions.cn\/blog\/wp-json\/wp\/v2\/media?parent=1504"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.computersolutions.cn\/blog\/wp-json\/wp\/v2\/categories?post=1504"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.computersolutions.cn\/blog\/wp-json\/wp\/v2\/tags?post=1504"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}