Thanks to hnyman and routednbooted for the patch...
I have a working build-root and sucessfully build latest trunk firmware for my boxes wzr hpg300nh,tplink 3420 and 701nd..i have huawei hg532b lying in my cabinet and wonder if openwrt support this device..then i found this link https://forum.openwrt.org/viewtopic.php?id=37964..he forgot to upload or share his firmware,,and i want to build trunk firmware for this device..
he post this patch but how can i add this patch to my build-root
Index: target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig
===================================================================
--- target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig (revision 32650)
+++ target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig (working copy)
@@ -154,6 +154,11 @@
select RALINK_DEV_GPIO_BUTTONS
select RALINK_DEV_GPIO_LEDS
+config RT305X_MACH_HG532
+ bool "Huawei Echolife HG532 B1.01"
+ select RALINK_DEV_GPIO_BUTTONS
+ select RALINK_DEV_GPIO_LEDS
+
endmenu
endif
Index: target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile
===================================================================
--- target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile (revision 32650)
+++ target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile (working copy)
@@ -42,3 +42,4 @@
obj-$(CONFIG_RT305X_MACH_WL351) += mach-wl351.o
obj-$(CONFIG_RT305X_MACH_WR6202) += mach-wr6202.o
obj-$(CONFIG_RT305X_MACH_XDX_RN502J) += mach-xdx-rn502j.o
+obj-$(CONFIG_RT305X_MACH_HG532) += mach-hg532.o
Index: target/linux/ramips/files/arch/mips/ralink/rt305x/mach-hg532.c
===================================================================
--- target/linux/ramips/files/arch/mips/ralink/rt305x/mach-hg532.c (revision 0)
+++ target/linux/ramips/files/arch/mips/ralink/rt305x/mach-hg532.c (revision 0)
@@ -0,0 +1,107 @@
+/*
+ * Hauwei EcholifeHG532 board support
+ * 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/init.h>
+#include <linux/platform_device.h>
+
+#include <asm/mach-ralink/machine.h>
+#include <asm/mach-ralink/dev-gpio-buttons.h>
+#include <asm/mach-ralink/dev-gpio-leds.h>
+#include <asm/mach-ralink/rt305x.h>
+#include <asm/mach-ralink/rt305x_regs.h>
+
+#include "devices.h"
+
+#define HG532_GPIO_LED_POWER_GREEN 8
+#define HG532_GPIO_LED_POWER_RED 11
+#define HG532_GPIO_LED_INTERNET_GREEN 14
+#define HG532_GPIO_LED_INTERNET_RED 13
+#define HG532_GPIO_LED_USB 9
+
+#define HG532_GPIO_BUTTON_WPS 0
+#define HG532_GPIO_BUTTON_WLAN 10
+#define HG532_GPIO_BUTTON_RESET 4
+
+#define HG532_KEYS_POLL_INTERVAL 20
+#define HG532_KEYS_DEBOUNCE_INTERVAL (3 * HG532_KEYS_POLL_INTERVAL)
+
+static struct gpio_led hg532_leds_gpio[] __initdata = {
+ {
+ .name = "hg532:power:green",
+ .gpio = HG532_GPIO_LED_POWER_GREEN,
+ .active_low = 1,
+ }, {
+ .name = "hg532:power:red",
+ .gpio = HG532_GPIO_LED_POWER_RED,
+ .active_low = 1,
+ }, {
+ .name = "hg532:internet:green",
+ .gpio = HG532_GPIO_LED_INTERNET_GREEN,
+ .active_low = 1,
+ }, {
+ .name = "hg532:internet:red",
+ .gpio = HG532_GPIO_LED_INTERNET_RED,
+ .active_low = 1,
+ }, {
+ .name = "hg532:usb",
+ .gpio = HG532_GPIO_LED_USB,
+ .active_low = 1,
+ }
+};
+
+static struct gpio_keys_button hg532_gpio_buttons[] __initdata = {
+ {
+ .desc = "wps",
+ .type = EV_KEY,
+ .code = BTN_1,
+ .debounce_interval = HG532_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = HG532_GPIO_BUTTON_WPS,
+ .active_low = 1,
+ }, {
+ .desc = "wlan",
+ .type = EV_KEY,
+ .code = KEY_WLAN,
+ .debounce_interval = HG532_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = HG532_GPIO_BUTTON_WLAN,
+ .active_low = 1,
+ }, {
+ .desc = "reset",
+ .type = EV_KEY,
+ .code = BTN_2,
+ .debounce_interval = HG532_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = HG532_GPIO_RESET,
+ .active_low = 1,
+ }
+
+};
+#define HG532_GPIO_MODE \
+ ((RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT) | \
+ RT305X_GPIO_MODE_I2C | RT305X_GPIO_MODE_SPI)
+//RT305X_GPIO_MODE_GPIO | RT305X_GPIO_MODE_I2C | RT305X_GPIO_MODE_SPI | RT305X_GPIO_MODE_UART1 | RT305X_GPIO_MODE_MDIO
+
+static void __init hg532_init(void)
+{
+ rt305x_gpio_init(HG532_GPIO_MODE);
+
+ rt305x_register_flash(0);
+
+ ramips_register_gpio_leds(-1, ARRAY_SIZE(hg532_leds_gpio),
+ hg532_leds_gpio);
+
+ ramips_register_gpio_buttons(-1, HG532_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(hg532_gpio_buttons),
+ hg532_gpio_buttons);
+
+ rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL;
+ rt305x_register_ethernet();
+ rt305x_register_wifi();
+ rt305x_register_wdt();
+ rt305x_register_usb();
+}
+
+MIPS_MACHINE(RAMIPS_MACH_HG532, "HG532", "Hauwei Echolife HG532",
+ hg532_init);
Index: target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h
===================================================================
--- target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h (revision 32650)
+++ target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h (working copy)
@@ -57,6 +57,7 @@
RAMIPS_MACH_WR6202, /* Accton WR6202 */
RAMIPS_MACH_XDXRN502J, /* unknown XDX-RN502J */
RAMIPS_MACH_UR_336UN, /* UPVEL ROUTER */
+ RAMIPS_MACH_HG532, /* Huawei Echolife HG532 */
/* RT3662 based machines */
RAMIPS_MACH_RT_N56U, /* Asus RT-N56U */
Index: target/linux/ramips/image/Makefile
===================================================================
--- target/linux/ramips/image/Makefile (revision 32650)
+++ target/linux/ramips/image/Makefile (working copy)
@@ -442,6 +442,10 @@
$(call Image/Build/Template/$(fs_squash)/$(1),GENERIC_4M,xdxrn502j,XDXRN502J,ttyS1,57600,phys)
endef
+define Image/Build/Profile/HG532
+ $(call Image/Build/Template/$(fs_squash)/$(1),GENERIC_4M,hg532,HG532,ttyS1,57600,phys)
+endef
+
ifeq ($(CONFIG_RALINK_RT305X),y)
define Image/Build/Profile/Default
$(call Image/Build/Profile/ALL0256N,$(1))
@@ -474,6 +478,7 @@
$(call Image/Build/Profile/WR5123GN,$(1))
$(call Image/Build/Profile/WR6202,$(1))
$(call Image/Build/Profile/XDXRN502J,$(1))
+ $(call Image/Build/Profile/HG532,$(1))
endef
endif
Index: target/linux/ramips/rt305x/config-3.3
===================================================================
--- target/linux/ramips/rt305x/config-3.3 (revision 32650)
+++ target/linux/ramips/rt305x/config-3.3 (working copy)
@@ -21,6 +21,7 @@
CONFIG_CPU_SUPPORTS_HIGHMEM=y
CONFIG_CSRC_R4K=y
CONFIG_CSRC_R4K_LIB=y
+CONFIG_DEBUG_GPIO=y
CONFIG_DECOMPRESS_LZMA=y
CONFIG_DMA_NONCOHERENT=y
# CONFIG_DWC_OTG is not set
@@ -60,7 +61,8 @@
CONFIG_INITRAMFS_SOURCE=""
CONFIG_IRQ_CPU=y
CONFIG_IRQ_FORCED_THREADING=y
-CONFIG_M25PXX_USE_FAST_READ=y
+# CONFIG_ISDN is not set
+CONFIG_LEDS_GPIO=y
CONFIG_MDIO_BOARDINFO=y
# CONFIG_MII is not set
CONFIG_MIPS=y
@@ -70,13 +72,21 @@
CONFIG_MIPS_RALINK=y
# CONFIG_MTD_CFI_INTELEXT is not set
CONFIG_MTD_CMDLINE_PARTS=y
-CONFIG_MTD_M25P80=y
CONFIG_MTD_PHYSMAP=y
CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_NEED_PER_CPU_KM=y
CONFIG_NET_RAMIPS=y
# CONFIG_NET_RAMIPS_DEBUG is not set
# CONFIG_NET_RAMIPS_DEBUG_FS is not set
+# CONFIG_NET_VENDOR_BROADCOM is not set
+# CONFIG_NET_VENDOR_CHELSIO is not set
+# CONFIG_NET_VENDOR_INTEL is not set
+# CONFIG_NET_VENDOR_MARVELL is not set
+# CONFIG_NET_VENDOR_MICREL is not set
+# CONFIG_NET_VENDOR_NATSEMI is not set
+# CONFIG_NET_VENDOR_SEEQ is not set
+# CONFIG_NET_VENDOR_SMSC is not set
+# CONFIG_NET_VENDOR_STMICRO is not set
CONFIG_PAGEFLAGS_EXTENDED=y
CONFIG_PERF_USE_VMALLOC=y
CONFIG_PHYLIB=y
@@ -86,7 +96,7 @@
# CONFIG_RALINK_RT288X is not set
CONFIG_RALINK_RT305X=y
# CONFIG_RALINK_RT3883 is not set
-CONFIG_RAMIPS_WDT=y
+CONFIG_REALTEK_PHY=y
CONFIG_RT305X_MACH_ALL0256N=y
CONFIG_RT305X_MACH_ARGUS_ATP52B=y
CONFIG_RT305X_MACH_BC2=y
@@ -95,6 +105,7 @@
CONFIG_RT305X_MACH_F5D8235_V2=y
CONFIG_RT305X_MACH_FONERA20N=y
CONFIG_RT305X_MACH_FREESTATION5=y
+CONFIG_RT305X_MACH_HG532=y
CONFIG_RT305X_MACH_HW550_3G=y
CONFIG_RT305X_MACH_MOFI3500_3GN=y
CONFIG_RT305X_MACH_NBG_419N=y
@@ -124,9 +135,8 @@
# CONFIG_SLAB is not set
CONFIG_SLUB=y
CONFIG_SOC_RT305X=y
-CONFIG_SPI=y
-CONFIG_SPI_MASTER=y
-CONFIG_SPI_RAMIPS=y
+# CONFIG_STAGING is not set
+CONFIG_SWCONFIG=y
CONFIG_SYS_HAS_CPU_MIPS32_R1=y
CONFIG_SYS_HAS_CPU_MIPS32_R2=y
CONFIG_SYS_HAS_EARLY_PRINTK=y
@@ -137,5 +147,7 @@
# CONFIG_USB_ARCH_HAS_OHCI is not set
# CONFIG_USB_ARCH_HAS_XHCI is not set
CONFIG_USB_SUPPORT=y
+# CONFIG_WATCHDOG is not set
+# CONFIG_WLAN is not set
CONFIG_XZ_DEC=y
CONFIG_ZONE_DMA_FLAG=0
Index: target/linux/ramips/base-files/lib/ramips.sh
===================================================================
--- target/linux/ramips/base-files/lib/ramips.sh (revision 32650)
+++ target/linux/ramips/base-files/lib/ramips.sh (working copy)
@@ -164,6 +164,9 @@
*"XDX RN502J")
name="xdxrn502j"
;;
+ *"HG532")
+ name="hg532"
+ ;;
*)
name="generic"
;;
Index: target/linux/ramips/base-files/lib/upgrade/platform.sh
===================================================================
--- target/linux/ramips/base-files/lib/upgrade/platform.sh (revision 32650)
+++ target/linux/ramips/base-files/lib/upgrade/platform.sh (working copy)
@@ -43,7 +43,8 @@
wli-tx4-ag300n | \
whr-g300n |\
ur-336un |\
- wr512-3gn)
+ wr512-3gn|\
+ hg532)
[ "$magic" != "2705" ] && {
echo "Invalid image type."
return 1
Index: target/linux/ramips/base-files/lib/preinit/06_set_iface_mac
===================================================================
--- target/linux/ramips/base-files/lib/preinit/06_set_iface_mac (revision 32650)
+++ target/linux/ramips/base-files/lib/preinit/06_set_iface_mac (working copy)
@@ -14,7 +14,8 @@
nw718 |\
psr-680w |\
rt-n56u |\
- sl-r7205)
+ sl-r7205|\
+ hg532)
mac=$(ramips_get_mac_binary factory 4)
mac=$(maccalc or "$mac" "02:00:00:00:00:00")
ifconfig eth0 hw ether $mac 2>/dev/null
Index: target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
===================================================================
--- target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom (revision 32650)
+++ target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom (working copy)
@@ -84,6 +84,9 @@
wl341v3)
rt2x00_eeprom_extract "board-nvram" 64880 272
;;
+ hg532)
+ rt2x00_eeprom_extract "firmware" 0 272
+ ;;
*)
rt2x00_eeprom_die "board $board is not supported yet"
Index: target/linux/ramips/base-files/etc/uci-defaults/network
===================================================================
--- target/linux/ramips/base-files/etc/uci-defaults/network (revision 32650)
+++ target/linux/ramips/base-files/etc/uci-defaults/network (working copy)
@@ -27,7 +27,8 @@
psr-680w | \
sl-r7205 | \
w502u | \
- wr6202)
+ wr6202 |\
+ hg532)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
;;
@@ -97,7 +98,8 @@
psr-680w | \
rt-n15 | \
sl-r7205 | \
- wl-351)
+ wl-351 |\
+ hg532)
lan_mac=$(ramips_get_mac_binary factory 4)
wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
;;(Last edited by jefbuan on 3 Nov 2012, 13:11)
