[OpenWrt-Devel] [RFC PATCH] ar71xx: Support Antminer S1/S3
James Hilliard
james.hilliard1 at gmail.com
Fri May 1 23:08:28 EDT 2015
I did my best to separate this device out, below is my current patch,
comments appreciated. I'm having trouble figuring out how to
differentiate the hwid which seems to be the same as the tp-link
wr743nd-v2. 0x07430002 Is the hardware ID that both seem to have, is
there any other ID's that I may be able to use?
diff --git a/package/base-files/files/lib/functions/uci-defaults.sh
b/package/base-files/files/lib/functions/uci-defaults.sh
index 5a8809d..363c016 100644
--- a/package/base-files/files/lib/functions/uci-defaults.sh
+++ b/package/base-files/files/lib/functions/uci-defaults.sh
@@ -8,7 +8,11 @@ ucidef_set_led_netdev() {
local name=$2
local sysfs=$3
local dev=$4
+ local mode="link tx rx"
+ if [ -n "$5" ]; then
+ mode=$5
+ fi
uci -q get system.$cfg && return 0
uci batch <<EOF
@@ -17,7 +21,7 @@ set system.$cfg.name='$name'
set system.$cfg.sysfs='$sysfs'
set system.$cfg.trigger='netdev'
set system.$cfg.dev='$dev'
-set system.$cfg.mode='link tx rx'
+set system.$cfg.mode='$mode'
EOF
UCIDEF_LEDS_CHANGED=1
}
diff --git a/package/network/config/firewall/files/firewall.config
b/package/network/config/firewall/files/firewall.config
index d149e77..00d6021 100644
--- a/package/network/config/firewall/files/firewall.config
+++ b/package/network/config/firewall/files/firewall.config
@@ -1,177 +1,118 @@
-config defaults
- option syn_flood 1
- option input ACCEPT
- option output ACCEPT
- option forward REJECT
-# Uncomment this line to disable ipv6 rules
-# option disable_ipv6 1
-config zone
- option name lan
- list network 'lan'
- option input ACCEPT
- option output ACCEPT
- option forward ACCEPT
-
-config zone
- option name wan
- list network 'wan'
- list network 'wan6'
- option input REJECT
- option output ACCEPT
- option forward REJECT
- option masq 1
- option mtu_fix 1
-
-config forwarding
- option src lan
- option dest wan
-
-# We need to accept udp packets on port 68,
-# see https://dev.openwrt.org/ticket/4108
-config rule
- option name Allow-DHCP-Renew
- option src wan
- option proto udp
- option dest_port 68
- option target ACCEPT
- option family ipv4
-
-# Allow IPv4 ping
-config rule
- option name Allow-Ping
- option src wan
- option proto icmp
- option icmp_type echo-request
- option family ipv4
- option target ACCEPT
-
-# Allow DHCPv6 replies
-# see https://dev.openwrt.org/ticket/10381
-config rule
- option name Allow-DHCPv6
- option src wan
- option proto udp
- option src_ip fe80::/10
- option src_port 547
- option dest_ip fe80::/10
- option dest_port 546
- option family ipv6
- option target ACCEPT
-
-# Allow essential incoming IPv6 ICMP traffic
-config rule
- option name Allow-ICMPv6-Input
- option src wan
- option proto icmp
- list icmp_type echo-request
- list icmp_type echo-reply
- list icmp_type destination-unreachable
- list icmp_type packet-too-big
- list icmp_type time-exceeded
- list icmp_type bad-header
- list icmp_type unknown-header-type
- list icmp_type router-solicitation
- list icmp_type neighbour-solicitation
- list icmp_type router-advertisement
- list icmp_type neighbour-advertisement
- option limit 1000/sec
- option family ipv6
- option target ACCEPT
-
-# Allow essential forwarded IPv6 ICMP traffic
-config rule
- option name Allow-ICMPv6-Forward
- option src wan
- option dest *
- option proto icmp
- list icmp_type echo-request
- list icmp_type echo-reply
- list icmp_type destination-unreachable
- list icmp_type packet-too-big
- list icmp_type time-exceeded
- list icmp_type bad-header
- list icmp_type unknown-header-type
- option limit 1000/sec
- option family ipv6
- option target ACCEPT
-
-# include a file with users custom iptables rules
-config include
- option path /etc/firewall.user
-
-
-### EXAMPLE CONFIG SECTIONS
-# do not allow a specific ip to access wan
-#config rule
-# option src lan
-# option src_ip 192.168.45.2
-# option dest wan
-# option proto tcp
-# option target REJECT
-
-# block a specific mac on wan
-#config rule
-# option dest wan
-# option src_mac 00:11:22:33:44:66
-# option target REJECT
-
-# block incoming ICMP traffic on a zone
-#config rule
-# option src lan
-# option proto ICMP
-# option target DROP
-
-# port redirect port coming in on wan to lan
-#config redirect
-# option src wan
-# option src_dport 80
-# option dest lan
-# option dest_ip 192.168.16.235
-# option dest_port 80
-# option proto tcp
-
-# port redirect of remapped ssh port (22001) on wan
-#config redirect
-# option src wan
-# option src_dport 22001
-# option dest lan
-# option dest_port 22
-# option proto tcp
-
-# allow IPsec/ESP and ISAKMP passthrough
-#config rule
-# option src wan
-# option dest lan
-# option protocol esp
-# option target ACCEPT
-
-#config rule
-# option src wan
-# option dest lan
-# option src_port 500
-# option dest_port 500
-# option proto udp
-# option target ACCEPT
-
-### FULL CONFIG SECTIONS
-#config rule
-# option src lan
-# option src_ip 192.168.45.2
-# option src_mac 00:11:22:33:44:55
-# option src_port 80
-# option dest wan
-# option dest_ip 194.25.2.129
-# option dest_port 120
-# option proto tcp
-# option target REJECT
-
-#config redirect
-# option src lan
-# option src_ip 192.168.45.2
-# option src_mac 00:11:22:33:44:55
-# option src_port 1024
-# option src_dport 80
-# option dest_ip 194.25.2.129
-# option dest_port 120
-# option proto tcp
+config 'defaults'
+ option 'syn_flood' '1'
+ option 'input' 'ACCEPT'
+ option 'output' 'ACCEPT'
+ option 'forward' 'REJECT'
+
+config 'zone'
+ option 'name' 'lan'
+ option 'network' 'lan'
+ option 'input' 'ACCEPT'
+ option 'output' 'ACCEPT'
+ option 'forward' 'REJECT'
+
+config 'zone'
+ option 'name' 'wan'
+ option 'input' 'REJECT'
+ option 'output' 'ACCEPT'
+ option 'forward' 'REJECT'
+ option 'masq' '1'
+ option 'mtu_fix' '1'
+ option 'network' 'wan wwan'
+
+config 'forwarding'
+ option 'src' 'lan'
+ option 'dest' 'wan'
+
+config 'rule'
+ option 'name' 'Allow-DHCP-Renew'
+ option 'src' 'wan'
+ option 'proto' 'udp'
+ option 'dest_port' '68'
+ option 'target' 'ACCEPT'
+ option 'family' 'ipv4'
+
+config 'rule'
+ option 'name' 'Allow-Ping'
+ option 'src' 'wan'
+ option 'proto' 'icmp'
+ option 'icmp_type' 'echo-request'
+ option 'family' 'ipv4'
+ option 'target' 'ACCEPT'
+
+config 'rule'
+ option 'name' 'Allow-DHCPv6'
+ option 'src' 'wan'
+ option 'proto' 'udp'
+ option 'src_ip' 'fe80::/10'
+ option 'src_port' '547'
+ option 'dest_ip' 'fe80::/10'
+ option 'dest_port' '546'
+ option 'family' 'ipv6'
+ option 'target' 'ACCEPT'
+
+config 'rule'
+ option 'name' 'Allow-ICMPv6-Input'
+ option 'src' 'wan'
+ option 'proto' 'icmp'
+ list 'icmp_type' 'echo-request'
+ list 'icmp_type' 'destination-unreachable'
+ list 'icmp_type' 'packet-too-big'
+ list 'icmp_type' 'time-exceeded'
+ list 'icmp_type' 'bad-header'
+ list 'icmp_type' 'unknown-header-type'
+ list 'icmp_type' 'router-solicitation'
+ list 'icmp_type' 'neighbour-solicitation'
+ option 'limit' '1000/sec'
+ option 'family' 'ipv6'
+ option 'target' 'ACCEPT'
+
+config 'rule'
+ option 'name' 'Allow-ICMPv6-Forward'
+ option 'src' 'wan'
+ option 'dest' '*'
+ option 'proto' 'icmp'
+ list 'icmp_type' 'echo-request'
+ list 'icmp_type' 'destination-unreachable'
+ list 'icmp_type' 'packet-too-big'
+ list 'icmp_type' 'time-exceeded'
+ list 'icmp_type' 'bad-header'
+ list 'icmp_type' 'unknown-header-type'
+ option 'limit' '1000/sec'
+ option 'family' 'ipv6'
+ option 'target' 'ACCEPT'
+
+config 'include'
+ option 'path' '/etc/firewall.user'
+
+config 'zone'
+ option 'name' 'newzone'
+ option 'input' 'ACCEPT'
+ option 'forward' 'REJECT'
+ option 'network' ' '
+ option 'output' 'ACCEPT'
+
+config 'rule'
+ option 'target' 'ACCEPT'
+ option 'src' 'wan'
+ option 'dest_port' '22'
+ option 'name' 'ssh'
+ option 'family' 'ipv4'
+ option 'proto' 'tcp udp'
+
+config 'rule'
+ option 'target' 'ACCEPT'
+ option 'src' 'wan'
+ option 'dest_port' '80'
+ option 'name' 'web'
+ option 'family' 'ipv4'
+ option 'proto' 'tcp udp'
+
+config 'rule'
+ option 'target' 'ACCEPT'
+ option 'src' 'wan'
+ option 'dest_port' '4028'
+ option 'name' 'cgminer'
+ option 'family' 'ipv4'
+ option 'proto' 'tcp udp'
\ No newline at end of file
diff --git a/package/network/services/dnsmasq/files/dhcp.conf
b/package/network/services/dnsmasq/files/dhcp.conf
index a6e7867..3383b346 100644
--- a/package/network/services/dnsmasq/files/dhcp.conf
+++ b/package/network/services/dnsmasq/files/dhcp.conf
@@ -1,32 +1,26 @@
+
config dnsmasq
- option domainneeded 1
- option boguspriv 1
- option filterwin2k 0 # enable for dial on demand
- option localise_queries 1
- option rebind_protection 1 # disable if upstream must serve RFC1918 addresses
- option rebind_localhost 1 # enable for RBL checking and similar services
- #list rebind_domain example.lan # whitelist RFC1918 responses for domains
- option local '/lan/'
- option domain 'lan'
- option expandhosts 1
- option nonegcache 0
- option authoritative 1
- option readethers 1
- option leasefile '/tmp/dhcp.leases'
- option resolvfile '/tmp/resolv.conf.auto'
- #list server '/mycompany.local/1.2.3.4'
- #option nonwildcard 1
- #list interface br-lan
- #list notinterface lo
- #list bogusnxdomain '64.94.110.11'
- option localservice 1 # disable to allow DNS requests from non-loclal subnets
+ option domainneeded '1'
+ option boguspriv '1'
+ option filterwin2k '0'
+ option localise_queries '1'
+ option rebind_protection '1'
+ option rebind_localhost '1'
+ option local '/lan/'
+ option domain 'lan'
+ option expandhosts '1'
+ option nonegcache '0'
+ option authoritative '1'
+ option readethers '1'
+ option leasefile '/tmp/dhcp.leases'
+ option resolvfile '/tmp/resolv.conf.auto'
-config dhcp lan
- option interface lan
- option start 100
- option limit 150
- option leasetime 12h
+config dhcp 'lan'
+ option interface 'lan'
+ option start '100'
+ option limit '150'
+ option leasetime '12h'
-config dhcp wan
- option interface wan
- option ignore 1
+config dhcp 'wan'
+ option interface 'wan'
+ option ignore '1'
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
index 0a9a285..a8d7987 100644
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
@@ -384,6 +384,16 @@ tl-wr741nd)
ucidef_set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0" "0x10"
;;
+bitmain-antminer)
+ ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth1" "link tx rx"
+ ucidef_set_led_netdev "wanl" "WANL" "tp-link:green:wan_link" "eth1" "link"
+ ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x04"
+ ucidef_set_led_switch "lan2" "LAN2" "tp-link:green:lan2" "switch0" "0x08"
+ ucidef_set_led_switch "lan3" "LAN3" "tp-link:green:lan3" "switch0" "0x10"
+ ucidef_set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0" "0x02"
+ ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
+ ;;
+
tl-wr741nd-v4)
ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth1"
ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x04"
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh
b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 645c5d9..5b5be61 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -134,8 +134,8 @@ tplink_board_detect() {
"074100"*)
model="TP-Link TL-WR741N/ND"
;;
- "074300"*)
- model="TP-Link TL-WR743N/ND"
+ "07430002")
+ model="BITMAIN ANTMINER"
;;
"075000"*)
model="TP-Link TL-WA750RE"
diff --git a/target/linux/ar71xx/config-3.18 b/target/linux/ar71xx/config-3.18
index 36b8bb6..f5c67e4 100644
--- a/target/linux/ar71xx/config-3.18
+++ b/target/linux/ar71xx/config-3.18
@@ -55,6 +55,7 @@ CONFIG_ATH79_MACH_DIR_825_C1=y
CONFIG_ATH79_MACH_DRAGINO2=y
CONFIG_ATH79_MACH_EAP300V2=y
CONFIG_ATH79_MACH_EAP7660D=y
+CONFIG_ATH79_MACH_BITMAIN_ANTMINER=y
CONFIG_ATH79_MACH_EL_M150=y
CONFIG_ATH79_MACH_EL_MINI=y
CONFIG_ATH79_MACH_ESR1750=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-bitmain-antminer.c
b/target/linux/ar71xx/files/arch/mips/ath79/mach-bitmain-antminer.c
new file mode 100644
index 0000000..6c0d172
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-bitmain-antminer.c
@@ -0,0 +1,209 @@
+/*
+ * TP-LINK TL-WR741ND v4/TL-MR3220 v2 board support
+ *
+ * Copyright (C) 2011-2012 Gabor Juhos <juhosg at openwrt.org>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+
+#include <linux/gpio.h>
+
+#include <asm/mach-ath79/ath79.h>
+#include <asm/mach-ath79/ar71xx_regs.h>
+
+#include "common.h"
+#include "dev-eth.h"
+#include "dev-gpio-buttons.h"
+#include "dev-leds-gpio.h"
+#include "dev-m25p80.h"
+#include "dev-usb.h"
+#include "dev-wmac.h"
+#include "machtypes.h"
+
+#define TL_WR741NDV4_GPIO_BTN_RESET 11
+#define TL_WR741NDV4_GPIO_BTN_WPS 26
+
+#define TL_WR741NDV4_GPIO_LED_WLAN 0
+#define TL_WR741NDV4_GPIO_LED_QSS 1
+#define TL_WR741NDV4_GPIO_LED_WAN 17
+#define TL_WR741NDV4_GPIO_LED_WANL 22
+#define TL_WR741NDV4_GPIO_LED_LAN1 13
+#define TL_WR741NDV4_GPIO_LED_LAN2 14
+#define TL_WR741NDV4_GPIO_LED_LAN3 15
+#define TL_WR741NDV4_GPIO_LED_LAN4 16
+#define TL_WR741NDV4_GPIO_LED_SYSTEM 23
+
+#define TL_MR3220V2_GPIO_BTN_WPS 11
+#define TL_MR3220V2_GPIO_BTN_WIFI 24
+
+#define TL_MR3220V2_GPIO_LED_3G 26
+#define TL_MR3220V2_GPIO_USB_POWER 8
+
+#define TL_WR741NDV4_KEYS_POLL_INTERVAL 20 /* msecs */
+#define TL_WR741NDV4_KEYS_DEBOUNCE_INTERVAL (3 *
TL_WR741NDV4_KEYS_POLL_INTERVAL)
+
+static const char *tl_wr741ndv4_part_probes[] = {
+ "tp-link",
+ NULL,
+};
+
+static struct flash_platform_data tl_wr741ndv4_flash_data = {
+ .part_probes = tl_wr741ndv4_part_probes,
+};
+
+static struct gpio_led tl_wr741ndv4_leds_gpio[] __initdata = {
+ {
+ .name = "tp-link:green:lan1",
+ .gpio = TL_WR741NDV4_GPIO_LED_LAN1,
+ .active_low = 0,
+ }, {
+ .name = "tp-link:green:lan2",
+ .gpio = TL_WR741NDV4_GPIO_LED_LAN2,
+ .active_low = 0,
+ }, {
+ .name = "tp-link:green:lan3",
+ .gpio = TL_WR741NDV4_GPIO_LED_LAN3,
+ .active_low = 0,
+ }, {
+ .name = "tp-link:green:lan4",
+ .gpio = TL_WR741NDV4_GPIO_LED_LAN4,
+ .active_low = 0,
+ }, {
+ .name = "tp-link:green:qss",
+ .gpio = TL_WR741NDV4_GPIO_LED_QSS,
+ .active_low = 0,
+ }, {
+ .name = "tp-link:green:system",
+ .gpio = TL_WR741NDV4_GPIO_LED_SYSTEM,
+ .active_low = 0,
+ }, {
+ .name = "tp-link:green:wan",
+ .gpio = TL_WR741NDV4_GPIO_LED_WAN,
+ .active_low = 0,
+ }, {
+ .name = "tp-link:green:wan_link",
+ .gpio = TL_WR741NDV4_GPIO_LED_WANL,
+ .active_low = 0,
+ }, {
+ .name = "tp-link:green:wlan",
+ .gpio = TL_WR741NDV4_GPIO_LED_WLAN,
+ .active_low = 0,
+ }, {
+ /* the 3G LED is only present on the MR3220 v2 */
+ .name = "tp-link:green:3g",
+ .gpio = TL_MR3220V2_GPIO_LED_3G,
+ .active_low = 0,
+ },
+};
+
+static struct gpio_keys_button tl_wr741ndv4_gpio_keys[] __initdata = {
+ {
+ .desc = "reset",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = TL_WR741NDV4_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = TL_WR741NDV4_GPIO_BTN_RESET,
+ .active_low = 1,
+ }, {
+ .desc = "WPS",
+ .type = EV_KEY,
+ .code = KEY_WPS_BUTTON,
+ .debounce_interval = TL_WR741NDV4_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = TL_WR741NDV4_GPIO_BTN_WPS,
+ .active_low = 0,
+ }
+};
+
+static struct gpio_keys_button tl_mr3220v2_gpio_keys[] __initdata = {
+ {
+ .desc = "WPS",
+ .type = EV_KEY,
+ .code = KEY_WPS_BUTTON,
+ .debounce_interval = TL_WR741NDV4_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = TL_MR3220V2_GPIO_BTN_WPS,
+ .active_low = 0,
+ }, {
+ .desc = "WIFI button",
+ .type = EV_KEY,
+ .code = KEY_RFKILL,
+ .debounce_interval = TL_WR741NDV4_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = TL_MR3220V2_GPIO_BTN_WIFI,
+ .active_low = 0,
+ }
+};
+
+static void __init tl_ap121_setup(void)
+{
+ u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
+ u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
+
+ if((mac[0] == 0xff) &&
+ (mac[1] == 0xff) &&
+ (mac[2] == 0xff) &&
+ (mac[3] == 0xff) &&
+ (mac[4] == 0xff) &&
+ (mac[5] == 0xff))
+ {
+ printk("MAC FF:FF:FF:FF:FF:FF\n");
+ memcpy(mac, ee+2, 6);
+ mac = ee+2;
+ printk("MAC %02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2],
mac[3], mac[4], mac[5]);
+ }
+ //ath79_setup_ar933x_phy4_switch(true, true);
+ ath79_setup_ar933x_phy4_switch(false, false);
+
+ ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
+ AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
+ AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
+ AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
+ AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN);
+
+ ath79_register_m25p80(&tl_wr741ndv4_flash_data);
+ ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
+ ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1);
+
+ ath79_register_mdio(0, 0x0);
+ ath79_register_eth(1);
+ ath79_register_eth(0);
+
+ ath79_register_wmac(ee, mac);
+}
+
+static void __init tl_wr741ndv4_setup(void)
+{
+ tl_ap121_setup();
+ gpio_request_one(TL_MR3220V2_GPIO_USB_POWER,
+ GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+ "USB power");
+ ath79_register_usb();
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr741ndv4_leds_gpio) - 1,
+ tl_wr741ndv4_leds_gpio);
+ ath79_register_gpio_keys_polled(1, TL_WR741NDV4_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(tl_wr741ndv4_gpio_keys),
+ tl_wr741ndv4_gpio_keys);
+}
+
+MIPS_MACHINE(ATH79_MACH_BITMAIN_ANTMINER, "BITMAIN-ANTMINER",
+ "Bitmain Antminer", tl_wr741ndv4_setup);
+
+static void __init tl_mr3220v2_setup(void)
+{
+ tl_ap121_setup();
+
+ gpio_request_one(TL_MR3220V2_GPIO_USB_POWER,
+ GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+ "USB power");
+ ath79_register_usb();
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr741ndv4_leds_gpio),
+ tl_wr741ndv4_leds_gpio);
+ ath79_register_gpio_keys_polled(1, TL_WR741NDV4_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(tl_mr3220v2_gpio_keys),
+ tl_mr3220v2_gpio_keys);
+}
+
+MIPS_MACHINE(ATH79_MACH_TL_MR3220_V2, "TL-MR3220-v2",
+ "TP-LINK TL-MR3220 v2", tl_mr3220v2_setup);
diff --git a/target/linux/ar71xx/files/drivers/mtd/tplinkpart.c
b/target/linux/ar71xx/files/drivers/mtd/tplinkpart.c
index ab952b6..37dcf4c 100644
--- a/target/linux/ar71xx/files/drivers/mtd/tplinkpart.c
+++ b/target/linux/ar71xx/files/drivers/mtd/tplinkpart.c
@@ -149,7 +149,7 @@ static int tplink_parse_partitions(struct mtd_info *master,
parts[0].name = "u-boot";
parts[0].offset = 0;
parts[0].size = offset;
- parts[0].mask_flags = MTD_WRITEABLE;
+ //parts[0].mask_flags = MTD_WRITEABLE;
parts[1].name = "kernel";
parts[1].offset = offset;
@@ -159,15 +159,24 @@ static int tplink_parse_partitions(struct
mtd_info *master,
parts[2].offset = rootfs_offset;
parts[2].size = art_offset - rootfs_offset;
+ parts[4].name = "art";
+ parts[4].offset = art_offset;
+ parts[4].size = TPLINK_ART_LEN;
+ //part4[3].mask_flags = MTD_WRITEABLE;
+
+ parts[3].name = "firmware";
+ parts[3].offset = offset;
+ parts[3].size = art_offset - offset;
+ #if 0
parts[3].name = "art";
parts[3].offset = art_offset;
parts[3].size = TPLINK_ART_LEN;
- parts[3].mask_flags = MTD_WRITEABLE;
+ //parts[3].mask_flags = MTD_WRITEABLE;
parts[4].name = "firmware";
parts[4].offset = offset;
parts[4].size = art_offset - offset;
-
+ #endif
vfree(header);
*pparts = parts;
diff --git a/target/linux/ar71xx/generic/profiles/bitmain.mk
b/target/linux/ar71xx/generic/profiles/bitmain.mk
new file mode 100644
index 0000000..f432a8b
--- /dev/null
+++ b/target/linux/ar71xx/generic/profiles/bitmain.mk
@@ -0,0 +1,16 @@
+#
+# Copyright (C) 2009 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profile/ANTMINER
+ NAME:=BITMAIN ANTMINER
+ PACKAGES:=
+endef
+
+define Profile/ANTMINER/Description
+ Package set optimized for BITMAIN ANTMINER S1/S3.
+endef
+$(eval $(call Profile,ANTMINER))
diff --git a/target/linux/ar71xx/image/Makefile
b/target/linux/ar71xx/image/Makefile
index e4f6c71..d9b362a 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -1476,6 +1476,7 @@ $(eval $(call
SingleProfile,TPLINK,64kraw,TLWR1043V1,tl-wr1043nd-v1,TL-WR1043ND,
$(eval $(call SingleProfile,TPLINK-LZMA,64kraw,ARCHERC5,archer-c5,ARCHER-C5,ttyS0,115200,0xc5000001,1,16Mlzma))
$(eval $(call SingleProfile,TPLINK-LZMA,64kraw,ARCHERC7V1,archer-c7-v1,ARCHER-C7,ttyS0,115200,0x75000001,1,8Mlzma))
$(eval $(call SingleProfile,TPLINK-LZMA,64kraw,ARCHERC7V2,archer-c7-v2,ARCHER-C7,ttyS0,115200,0xc7000002,1,16Mlzma))
+$(eval $(call SingleProfile,TPLINK-LZMA,64kraw,ANTMINER,bitmain-antminer,TL-WR741ND-v4,ttyATH0,115200,0x07430002,1,8Mlzma))
$(eval $(call SingleProfile,TPLINK-LZMA,64kraw,ELM150,el-m150,EL-M150,ttyATH0,115200,0x01500101,1,8Mlzma))
$(eval $(call SingleProfile,TPLINK-LZMA,64kraw,ELMINI,el-mini,EL-MINI,ttyATH0,115200,0x01530001,1,8Mlzma))
$(eval $(call SingleProfile,TPLINK-LZMA,64kraw,GLINET6408A,gl-inet-6408A-v1,GL-INET,ttyATH0,115200,0x08000001,1,8Mlzma))
diff --git a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
index f8a561c..f8f87c1 100644
--- a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
+++ b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
@@ -44,6 +44,7 @@
+ ATH79_MACH_EW_DORIN_ROUTER, /* embedded wireless Dorin Router Platform */
+ ATH79_MACH_EAP300V2, /* EnGenius EAP300 v2 */
+ ATH79_MACH_EAP7660D, /* Senao EAP7660D */
++ ATH79_MACH_BITMAIN_ANTMINER, /* Bitmain Antminer */
+ ATH79_MACH_EL_M150, /* EasyLink EL-M150 */
+ ATH79_MACH_EL_MINI, /* EasyLink EL-MINI */
+ ATH79_MACH_ESR1750, /* EnGenius ESR1750 */
@@ -624,6 +625,16 @@
+ Say 'Y' here if you want your kernel to support the
+ Dorin Platform from www.80211.de .
+
++config ATH79_MACH_BITMAIN_ANTMINER
++ bool "Bitmain Antminer support"
++ select SOC_AR933X
++ select ATH79_DEV_ETH
++ select ATH79_DEV_GPIO_BUTTONS
++ select ATH79_DEV_LEDS_GPIO
++ select ATH79_DEV_M25P80
++ select ATH79_DEV_USB
++ select ATH79_DEV_WMAC
++
+config ATH79_MACH_EL_M150
+ bool "EasyLink EL-M150 support"
+ select SOC_AR933X
@@ -1437,6 +1448,7 @@
+obj-$(CONFIG_ATH79_MACH_EW_DORIN) += mach-ew-dorin.o
+obj-$(CONFIG_ATH79_MACH_EAP300V2) += mach-eap300v2.o
+obj-$(CONFIG_ATH79_MACH_EAP7660D) += mach-eap7660d.o
++obj-$(CONFIG_ATH79_MACH_BITMAIN_ANTMINER) += mach-bitmain-antminer.o
+obj-$(CONFIG_ATH79_MACH_EL_M150) += mach-el-m150.o
+obj-$(CONFIG_ATH79_MACH_EL_MINI) += mach-el-mini.o
+obj-$(CONFIG_ATH79_MACH_ESR1750) += mach-esr1750.o
diff --git a/tools/firmware-utils/src/mktplinkfw.c
b/tools/firmware-utils/src/mktplinkfw.c
index 4817e58..81f4a0b 100644
--- a/tools/firmware-utils/src/mktplinkfw.c
+++ b/tools/firmware-utils/src/mktplinkfw.c
@@ -58,7 +58,7 @@
#define HWID_TL_WR740N_V1 0x07400001
#define HWID_TL_WR740N_V3 0x07400003
#define HWID_TL_WR743ND_V1 0x07430001
-#define HWID_TL_WR743ND_V2 0x07430002
+#define HWID_BITMAIN_ANTMINER 0x07430002
#define HWID_TL_WR841N_V1_5 0x08410002
#define HWID_TL_WR841ND_V3 0x08410003
#define HWID_TL_WR841ND_V5 0x08410005
@@ -336,11 +336,6 @@ static struct board_info boards[] = {
.hw_rev = 1,
.layout_id = "4M",
}, {
- .id = "TL-WR743NDv2",
- .hw_id = HWID_TL_WR743ND_V2,
- .hw_rev = 1,
- .layout_id = "4Mlzma",
- }, {
.id = "TL-WR841Nv1.5",
.hw_id = HWID_TL_WR841N_V1_5,
.hw_rev = 2,
@@ -411,6 +406,11 @@ static struct board_info boards[] = {
.hw_rev = 1,
.layout_id = "16Mlzma",
}, {
+ .id = "BITMAIN-ANTMINER",
+ .hw_id = HWID_BITMAIN_ANTMINER,
+ .hw_rev = 1,
+ .layout_id = "8Mlzma",
+ }, {
/* terminating entry */
}
};
On Fri, May 1, 2015 at 4:59 AM, Dirk Neukirchen <dirkneukirchen at web.de> wrote:
>
> some comments inline
>
> On 30.04.2015 04:08, James Hilliard wrote:
>> The Antminer S1 and S3 use a controller with a modified version of
>> OpenWRT which has a single ethernet port and a wifi antenna header.
>> This is the patch from their GPL source release which appears to break
>> support for the tl-wr741nd-v4 in order to support their board. What
>> would be the proper way to differentiate this device and add support
>> for it?
>>
>
> A separate ARCH file because replacing 741ND-v4 will break that unit
> This patch contains many different changes so it has to be split up.
>
>> Index: target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr741nd-v4.c
>> ===================================================================
>> --- target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr741nd-v4.c
>> (revision 38031)
>> +++ target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr741nd-v4.c
>> (working copy)
>
> see above - create new file or make changes so it does not break
> supported targets
>
>> Index: target/linux/ar71xx/files/drivers/mtd/tplinkpart.c
>> ===================================================================
>> --- target/linux/ar71xx/files/drivers/mtd/tplinkpart.c (revision 38031)
>> +++ target/linux/ar71xx/files/drivers/mtd/tplinkpart.c (working copy)
>> @@ -149,7 +149,7 @@
>> parts[0].name = "u-boot";
>> parts[0].offset = 0;
>> parts[0].size = offset;
>> - parts[0].mask_flags = MTD_WRITEABLE;
>> + //parts[0].mask_flags = MTD_WRITEABLE;
>
> This seems to remove write protection from u-boot.
> This is dangerous and can result in really bad bricks
>
>
>> Index: target/linux/ar71xx/image/Makefile
>> ===================================================================
>> --- target/linux/ar71xx/image/Makefile (revision 38031)
>> +++ target/linux/ar71xx/image/Makefile (working copy)
>> @@ -921,7 +921,8 @@
>> -$(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR743NV2,tl-wr743nd-v2,TL-WR741ND-v4,ttyATH0,115200,0x07430002,1,4Mlzma))
>> +#$(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR743NV2,tl-wr743nd-v2,TL-WR741ND-v4,ttyATH0,115200,0x07430002,1,4Mlzma))
>> +$(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR743NV2,tl-wr743nd-v2,TL-WR741ND-v4,ttyATH0,115200,0x07430002,1,8Mlzma))
>
> Same as first comment - this breaks/disables the working images of that router
>
>> --- package/network/services/dropbear/files/dropbear.config (revision 38031)
>> +++ package/network/services/dropbear/files/dropbear.config (working copy)
>> @@ -2,4 +2,5 @@
>> option PasswordAuth 'on'
>> option RootPasswordAuth 'on'
>> option Port '22'
>> +# option Interface 'lan'
>> # option BannerFile '/etc/banner'
>
> dropbear change that affects all other platforms - remove
>
>> Index: package/base-files/files/lib/functions/uci-defaults.sh
>> ===================================================================
>> --- package/base-files/files/lib/functions/uci-defaults.sh (revision 38031)
>> +++ package/base-files/files/lib/functions/uci-defaults.sh (working copy)
>
> afaics this is related to LED and probably not needed
>
>
>> Index: package/base-files/files/etc/rc.button/reset
>> ===================================================================
>> --- package/base-files/files/etc/rc.button/reset (revision 38031)
>> +++ package/base-files/files/etc/rc.button/reset (working copy)
>> @@ -14,5 +14,5 @@
>> elif [ "$SEEN" -gt 5 ]
>> then
>> echo "FACTORY RESET" > /dev/console
>> - jffs2reset -y && reboot &
>> + jffs2reset -y && reboot -f &
>
> as before this would affect other boards too
>
>> fi
>> Index: package/base-files/files/etc/shadow
>> ===================================================================
>> --- package/base-files/files/etc/shadow (revision 38031)
>> +++ package/base-files/files/etc/shadow (working copy)
>> @@ -1,4 +1,5 @@
>> -root:x:0:0:99999:7:::
>> +root:$1$2zyJL0u3$UjHfNFlkkj9azThzkLaVA0:16013:0:99999:7:::
>> +admin:*:16013:0:99999:7:::
>
> remove (default root password that is antminer device/software specific)
> Is admin account needed for all other platforms?
> (add it to the software packages that needs it)
>
>> Index: package/base-files/files/etc/profile
>> ===================================================================
>> --- package/base-files/files/etc/profile (revision 38031)
>> +++ package/base-files/files/etc/profile (working copy)
>> @@ -8,6 +8,7 @@
>>
>> [ -x /bin/more ] || alias more=less
>> [ -x /usr/bin/vim ] && alias vi=vim || alias vim=vi
>> +[ -x /bin/ls ] && alias ll=ls -l
>
> while nice this might waste some bytes
>
>>
>> [ -z "$KSH_VERSION" -o \! -s /etc/mkshrc ] || . /etc/mkshrc
>>
>> Index: package/base-files/files/etc/config/system
>> ===================================================================
>> --- package/base-files/files/etc/config/system (revision 38031)
>> +++ package/base-files/files/etc/config/system (working copy)
>> @@ -1,6 +1,8 @@
>> config system
>> - option hostname OpenWrt
>> - option timezone UTC
>> + option hostname antMiner
>> + #option timezone UTC
>> + option zonename 'Asia/Shanghai'
>> + option timezone 'CST-8'
>
> remove - antMiner firmware specific settings
>
>> Index: tools/firmware-utils/src/mktplinkfw.c
>> ===================================================================
>> --- tools/firmware-utils/src/mktplinkfw.c (revision 38031)
>> +++ tools/firmware-utils/src/mktplinkfw.c (working copy)
>> @@ -269,10 +269,16 @@
>
>
> the changeset for this file disables working images
> when it should only add an image for that antminer device
>
>> _______________________________________________
>> openwrt-devel mailing list
>> openwrt-devel at lists.openwrt.org
>> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>>
>
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list