{"action":"created","issue":{"url":"https://api.github.com/repos/wongsyrone/openwrt-1/issues/9","labels_url":"https://api.github.com/repos/wongsyrone/openwrt-1/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/wongsyrone/openwrt-1/issues/9/comments","events_url":"https://api.github.com/repos/wongsyrone/openwrt-1/issues/9/events","html_url":"https://github.com/wongsyrone/openwrt-1/issues/9","id":54546988,"number":9,"title":"review patch","user":{"login":"wongsyrone","id":5462232,"avatar_url":"https://avatars.githubusercontent.com/u/5462232?v=3","gravatar_id":"","url":"https://api.github.com/users/wongsyrone","html_url":"https://github.com/wongsyrone","followers_url":"https://api.github.com/users/wongsyrone/followers","following_url":"https://api.github.com/users/wongsyrone/following{/other_user}","gists_url":"https://api.github.com/users/wongsyrone/gists{/gist_id}","starred_url":"https://api.github.com/users/wongsyrone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wongsyrone/subscriptions","organizations_url":"https://api.github.com/users/wongsyrone/orgs","repos_url":"https://api.github.com/users/wongsyrone/repos","events_url":"https://api.github.com/users/wongsyrone/events{/privacy}","received_events_url":"https://api.github.com/users/wongsyrone/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-16T07:21:42Z","updated_at":"2015-01-16T11:59:25Z","closed_at":"2015-01-16T11:59:25Z","body":"```patch\r\nFrom 0048e6392c11c7cf1b40ce3c157b80f097c355d2 Mon Sep 17 00:00:00 2001\r\nFrom: zhouruixi <zhouruixi@gmail.com>\r\nDate: Tue, 13 Jan 2015 11:23:39 +0800\r\nSubject: [PATCH] test-419\r\n\r\nSigned-off-by: zhouruixi <zhouruixi@gmail.com>\r\n---\r\n package/boot/uboot-envtools/files/ar71xx           |  7 +++-\r\n target/linux/ar71xx/base-files/etc/diag.sh         | 12 +++---\r\n .../lib/preinit/81_load_ath10k_board_bin           |  6 ++-\r\n .../ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c | 49 ++++++++++++++++++++--\r\n target/linux/ar71xx/image/Makefile                 | 13 ++++--\r\n .../419-mtd-seama-add-c301-part-name-check.patch   | 14 +++++++\r\n 6 files changed, 85 insertions(+), 16 deletions(-)\r\n create mode 100644 target/linux/ar71xx/patches-3.14/419-mtd-seama-add-c301-part-name-check.patch\r\n\r\ndiff --git a/package/boot/uboot-envtools/files/ar71xx b/package/boot/uboot-envtools/files/ar71xx\r\nindex 30c86fd..48d1329 100644\r\n--- a/package/boot/uboot-envtools/files/ar71xx\r\n+++ b/package/boot/uboot-envtools/files/ar71xx\r\n@@ -45,8 +45,11 @@ wzr-hp-ag300h)\r\n \tubootenv_add_uci_config \"/dev/mtd3\" \"0x0\" \"0x10000\" \"0x10000\"\r\n \t;;\r\n qihoo-c301)\r\n-\tubootenv_add_uci_config \"/dev/mtd9\" \"0x0\" \"0x10000\" \"0x10000\"\r\n-\t;;\r\n+       if cat /proc/mtd | grep action_image_config; then\r\n+               local mtd=$(cat /proc/mtd | grep action_image_config | sed 's/mtd\\([0-9]*\\):.*/\\1/g')\r\n+               ubootenv_add_uci_config \"/dev/mtd${mtd}\" \"0x0\" \"0x10000\" \"0x10000\"\r\n+       fi\r\n+       ;;\r\n esac\r\n \r\n config_load ubootenv\r\ndiff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh\r\nindex 06b96a3..0e5d17b 100755\r\n--- a/target/linux/ar71xx/base-files/etc/diag.sh\r\n+++ b/target/linux/ar71xx/base-files/etc/diag.sh\r\n@@ -314,11 +314,13 @@ set_state() {\r\n \tdone)\r\n \t\tstatus_led_on\r\n \t\tcase $(ar71xx_board_name) in\r\n-\t\tqihoo-c301)\r\n-\t\t\tlocal n=$(fw_printenv activeregion | cut -d = -f 2)\r\n-\t\t\tfw_setenv \"image${n}trynum\" 0\r\n-\t\t\t;;\r\n-\t\tesac\r\n+                qihoo-c301)\r\n+                       if cat /proc/mtd | grep action_image_config; then\r\n+                               local n=$(fw_printenv activeregion | cut -d = -f 2)\r\n+                               fw_setenv \"image${n}trynum\" 0\r\n+                       fi\r\n+                       ;;\r\n+               esac\r\n \t\t;;\r\n \tesac\r\n }\r\ndiff --git a/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin b/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin\r\nindex 7190820..c6258dd 100644\r\n--- a/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin\r\n+++ b/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin\r\n@@ -36,18 +36,20 @@ do_load_ath10k_board_bin() {\r\n \t\t;;\r\n \t\tqihoo-c301)\r\n \t\t\tlocal mac\r\n+                        local mtd\r\n \r\n+                        mtd=$(cat /proc/mtd | grep radiocfg | sed 's/mtd\\([0-9]*\\):.*/\\1/g')\r\n \t\t\tmac=$(mtd_get_mac_ascii devdata wlan5mac)\r\n \r\n \t\t\tif [ -z \"$mac\" ]; then\r\n \t\t\t\tmac=$(macaddr_add $(cat /sys/class/net/eth0/address) -2)\r\n \t\t\tfi\r\n \r\n-\t\t\tdd if=/dev/mtdblock10 \\\r\n+\t\t\tdd if=/dev/mtdblock${mtd} \\\r\n \t\t\t\tbs=1 skip=20480 count=6 \\\r\n \t\t\t\tof=/tmp/ath10k-board.bin\r\n \t\t\tmacaddr_2bin $mac >> /tmp/ath10k-board.bin\r\n-\t\t\tdd if=/dev/mtdblock10 \\\r\n+\t\t\tdd if=/dev/mtdblock${mtd} \\\r\n \t\t\t\tbs=1 skip=20492 count=2104 >> /tmp/ath10k-board.bin\r\n \r\n \t\t;;\r\ndiff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c\r\nindex 08a602f..2896033 100644\r\n--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c\r\n+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c\r\n@@ -14,6 +14,8 @@\r\n #include <linux/gpio.h>\r\n #include <linux/platform_device.h>\r\n #include <linux/ath9k_platform.h>\r\n+#include <linux/crc32.h>\r\n+#include <linux/mtd/mtd.h>\r\n \r\n #include <asm/mach-ath79/ar71xx_regs.h>\r\n \r\n@@ -81,6 +83,10 @@ static struct gpio_keys_button qihoo_c301_gpio_keys[] __initdata = {\r\n \r\n struct flash_platform_data flash __initdata = {NULL, NULL, 0};\r\n \r\n+static int qihoo_c301_board = 0;\r\n+\r\n+static u8 wlan24mac[ETH_ALEN];\r\n+\r\n static void qihoo_c301_get_mac(const char *name, char *mac)\r\n {\r\n \tu8 *nvram = (u8 *) KSEG1ADDR(QIHOO_C301_NVRAM_ADDR);\r\n@@ -94,8 +100,6 @@ static void qihoo_c301_get_mac(const char *name, char *mac)\r\n \r\n static void __init qihoo_c301_setup(void)\r\n {\r\n-\tu8 *art = (u8 *) KSEG1ADDR(0x1fff0000);\r\n-\tu8 tmpmac[ETH_ALEN];\r\n \r\n \tath79_register_m25p80_multi(&flash);\r\n \r\n@@ -125,8 +129,7 @@ static void __init qihoo_c301_setup(void)\r\n \tath79_wmac_set_ext_lna_gpio(0, QIHOO_C301_GPIO_EXTERNAL_LNA0);\r\n \tath79_wmac_set_ext_lna_gpio(1, QIHOO_C301_GPIO_EXTERNAL_LNA1);\r\n \r\n-\tqihoo_c301_get_mac(\"wlan24mac=\", tmpmac);\r\n-\tath79_register_wmac(art + QIHOO_C301_WMAC_CALDATA_OFFSET, tmpmac);\r\n+\tqihoo_c301_get_mac(\"wlan24mac=\", wlan24mac);\r\n \r\n \tath79_register_pci();\r\n \r\n@@ -160,7 +163,45 @@ static void __init qihoo_c301_setup(void)\r\n \t\t\t GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,\r\n \t\t\t \"USB power\");\r\n \tath79_register_usb();\r\n+\r\n+       qihoo_c301_board = 1;\r\n }\r\n \r\n MIPS_MACHINE(ATH79_MACH_QIHOO_C301, \"QIHOO-C301\", \"Qihoo 360 C301\",\r\n \t     qihoo_c301_setup);\r\n+\r\n+\r\n+static int qihoo_init_wmac(void)\r\n+{\r\n+       struct mtd_info * mtd;\r\n+       size_t nb = 0;\r\n+       u8 *art;\r\n+       int ret;\r\n+\r\n+       if (!qihoo_c301_board)\r\n+               return 0;\r\n+\r\n+       mtd = get_mtd_device_nm(\"radiocfg\");\r\n+       if (IS_ERR(mtd))\r\n+               return PTR_ERR(mtd);\r\n+\r\n+       if (mtd->size != 0x10000)\r\n+               return -1;\r\n+\r\n+       art = kzalloc(0x1000, GFP_KERNEL);\r\n+       if (!art)\r\n+               return -1;\r\n+\r\n+       ret = mtd_read(mtd, QIHOO_C301_WMAC_CALDATA_OFFSET, 0x1000, &nb, art);\r\n+       if (nb != 0x1000)\r\n+       {\r\n+               kfree(art);\r\n+               return ret;\r\n+       }\r\n+\r\n+       ath79_register_wmac(art, wlan24mac);\r\n+\r\n+       return 0;\r\n+}\r\n+\r\n+late_initcall(qihoo_init_wmac);\r\n\\ No newline at end of file\r\ndiff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile\r\nindex ef52f46..e92827e 100644\r\n--- a/target/linux/ar71xx/image/Makefile\r\n+++ b/target/linux/ar71xx/image/Makefile\r\n@@ -403,13 +403,15 @@ wnr2200_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7808k(firmwar\r\n wnr2000v3_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,3712k(firmware),64k(art)ro\r\n wnr2000v4_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,3776k(firmware),64k(art)ro\r\n r6100_mtdlayout=mtdparts=ar934x-nfc:128k(u-boot)ro,256k(caldata),256k(caldata-backup),512k(config),512k(pot),2048k(kernel),122240k(ubi),25600k@0x1a0000(firmware),2048k(language),3072k(traffic_meter)\r\n-wndr4300_mtdlayout=mtdparts=ar934x-nfc:256k(u-boot)ro,256k(u-boot-env)ro,256k(caldata),512k(pot),2048k(language),512k(config),3072k(traffic_meter),2048k(kernel),23552k(ubi),25600k@0x6c0000(firmware),256k(caldata_backup),-(reserved)\r\n+wndr4300_mtdlayout=mtdparts=ar934x-nfc:256k(u-boot)ro,256k(u-boot-env)ro,256k(caldata),512k(pot),2048k(language),512k(config),3072k(traffic_meter),2048k(kernel),121856k(ubi),123904k@0x6c0000(firmware),256k(caldata_backup),-(reserved)\r\n zcn1523h_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6208k(rootfs),1472k(kernel),64k(configure)ro,64k(mfg)ro,64k(art)ro,7680k@0x50000(firmware)\r\n mynet_n600_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,64k(devdata)ro,64k(devconf)ro,15872k(firmware),64k(radiocfg)ro\r\n mynet_rext_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,7808k(firmware),64k(nvram)ro,64k(ART)ro,6848k@0x130000(filesystem)\r\n zyx_nbg6716_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(env)ro,64k(RFdata)ro,-(nbu);ar934x-nfc:2048k(zyxel_rfsd),2048k(romd),1024k(header),2048k(kernel),-(ubi)\r\n-qihoo_c301_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),64k(devdata),64k(devconf),15744k(firmware),64k(warm_start),64k(action_image_config),64k(radiocfg)ro;spi0.1:15360k(upgrade2),1024k(privatedata)\r\n \r\n+qihoo_c301_mtdlayout=mtdparts=spi0.0:256k(u-boot),64k(u-boot-env),64k(devdata),64k(devconf),15744k(firmware),64k(warm_start),64k(action_image_config),64k(radiocfg);spi0.1:15360k(upgrade2),1024k(privatedata)\r\n+qihoo_c301_flash2_mtdlayout=mtdparts=spi0.0:256k(u-boot),64k(u-boot-env),64k(devdata),64k(devconf),15744k(firmware_backup),64k(warm_start),64k(action_image_config),64k(radiocfg);spi0.1:15360k(firmware),1024k(privatedata)\r\n+qihoo_c301_32m_mtdlayout=mtdparts=flash:256k(u-boot),64k(u-boot-env),64k(devdata),64k(devconf),32256k(firmware),64k(radiocfg)\r\n \r\n define Image/BuildKernel\r\n \tcp $(KDIR)/vmlinux.elf $(VMLINUX).elf\r\n@@ -1343,7 +1345,9 @@ $(eval $(call SingleProfile,Planex,64kraw,MZKW300NH,mzk-w300nh,MZK-W300NH,ttyS0,\r\n $(eval $(call SingleProfile,Seama,64k,MYNETN600,mynet-n600,MYNET-N600,ttyS0,115200,$$(mynet_n600_mtdlayout),wrgnd16_wd_db600,1310720,16187392))\r\n $(eval $(call SingleProfile,Seama,64k,MYNETN750,mynet-n750,MYNET-N750,ttyS0,115200,$$(mynet_n600_mtdlayout),wrgnd13_wd_av,1310720,16187392))\r\n \r\n-$(eval $(call SingleProfile,Seama,64k,QIHOO360,qihoo-c301,QIHOO-C301,ttyS0,115200,$$(qihoo_c301_mtdlayout),wrgac26_qihoo360_360rg,1310720,16121856))\r\n+$(eval $(call SingleProfile,Seama,64k,QIHOO36016M,qihoo-c301,QIHOO-C301,ttyS0,115200,$$(qihoo_c301_mtdlayout),wrgac26_qihoo360_360rg,1310720,16121856))\r\n+$(eval $(call SingleProfile,Seama,64k,QIHOO360FLASH2,qihoo-c301-flash2,QIHOO-C301,ttyS0,115200,$$(qihoo_c301_flash2_mtdlayout),wrgac26_qihoo360_360rg,1310720,15728640))\r\n+$(eval $(call SingleProfile,Seama,64k,QIHOO36032M,qihoo-c301-32m,QIHOO-C301,ttyS0,115200,$$(qihoo_c301_32m_mtdlayout),wrgac26_qihoo360_360rg,1310720,33030144))\r\n \r\n $(eval $(call SingleProfile,Senao,squashfs-only,EAP300V2,eap300v2,EAP300V2,ttyS0,115200,$$(eap300v2_mtdlayout)))\r\n \r\n@@ -1468,6 +1472,9 @@ $(eval $(call MultiProfile,EWDORIN, EWDORINAP EWDORINRT EWDORIN16M))\r\n $(eval $(call MultiProfile,OPENMESH,OM2P OM5P MR600 MR900))\r\n $(eval $(call MultiProfile,GLINET,GLINET6408A GLINET6416A))\r\n $(eval $(call MultiProfile,TEW652BRP,TEW652BRP_FW TEW652BRP_RECOVERY))\r\n+\r\n+$(eval $(call MultiProfile,QIHOO360,QIHOO36016M QIHOO360FLASH2 QIHOO36032M))\r\n+\r\n $(eval $(call MultiProfile,TLMR11U,TLMR11UV1 TLMR11UV2))\r\n $(eval $(call MultiProfile,TLMR3040,TLMR3040V1 TLMR3040V2))\r\n $(eval $(call MultiProfile,TLMR3220,TLMR3220V1 TLMR3220V2))\r\ndiff --git a/target/linux/ar71xx/patches-3.14/419-mtd-seama-add-c301-part-name-check.patch b/target/linux/ar71xx/patches-3.14/419-mtd-seama-add-c301-part-name-check.patch\r\nnew file mode 100644\r\nindex 0000000..8e51cff\r\n--- /dev/null\r\n+++ b/target/linux/ar71xx/patches-3.14/419-mtd-seama-add-c301-part-name-check.patch\r\n@@ -0,0 +1,14 @@\r\n+--- a/drivers/mtd/mtdsplit/mtdsplit_seama.c\r\n++++ b/drivers/mtd/mtdsplit/mtdsplit_seama.c\r\n+@@ -38,6 +38,11 @@\r\n+\tstruct mtd_partition *parts;\r\n+\tint err;\r\n+\r\n++\tif (!strcmp(master->name, \"firmware_backup\")\r\n++\t\t) {\r\n++\t\treturn -EINVAL;\r\n++\t}\r\n++\r\n+\thdr_len = sizeof(hdr);\r\n+\terr = mtd_read(master, 0, hdr_len, &retlen, (void *) &hdr);\r\n+\tif (err)\r\n-- \r\n1.9.1\r\n```"},"comment":{"url":"https://api.github.com/repos/wongsyrone/openwrt-1/issues/comments/70244249","html_url":"https://github.com/wongsyrone/openwrt-1/issues/9#issuecomment-70244249","issue_url":"https://api.github.com/repos/wongsyrone/openwrt-1/issues/9","id":70244249,"user":{"login":"wongsyrone","id":5462232,"avatar_url":"https://avatars.githubusercontent.com/u/5462232?v=3","gravatar_id":"","url":"https://api.github.com/users/wongsyrone","html_url":"https://github.com/wongsyrone","followers_url":"https://api.github.com/users/wongsyrone/followers","following_url":"https://api.github.com/users/wongsyrone/following{/other_user}","gists_url":"https://api.github.com/users/wongsyrone/gists{/gist_id}","starred_url":"https://api.github.com/users/wongsyrone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wongsyrone/subscriptions","organizations_url":"https://api.github.com/users/wongsyrone/orgs","repos_url":"https://api.github.com/users/wongsyrone/repos","events_url":"https://api.github.com/users/wongsyrone/events{/privacy}","received_events_url":"https://api.github.com/users/wongsyrone/received_events","type":"User","site_admin":false},"created_at":"2015-01-16T11:59:25Z","updated_at":"2015-01-16T11:59:25Z","body":"done"}}