[OpenWrt-Devel] [PATCH] scripts/diffconfig.sh: reduce config output with CONFIG_BUSYBOX_CUSTOM

2015-11-12 Thread Hannu Nyman
Use similar approach as r47461 to reduce output for busybox config.

Since r39435 CONFIG_BUSYBOX_CUSTOM=y has caused the addition of
all ~260 busybox config options to the diffconfig output even if
only one option has been changed.

This patch eliminates the unchanged busybox config options from the output
and leaves only the actually modified options.

Signed-off-by: Hannu Nyman 
---

Reference to:
https://dev.openwrt.org/changeset/39435
https://dev.openwrt.org/changeset/47461

For me this change eliminates 261 unnecessary busybox lines from diffconfig
output, leaving only the 4 actually changed busybox options.

perus@ub1510:/Openwrt/trunk$ wc diff-*
  416   422 14746 base.diffconfig
  155   161  4669 new.diffconfig

 
 scripts/diffconfig.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/diffconfig.sh b/scripts/diffconfig.sh
index d26e9a9..f195d18 100755
--- a/scripts/diffconfig.sh
+++ b/scripts/diffconfig.sh
@@ -4,6 +4,7 @@ grep '^CONFIG_ALL=y' .config >> tmp/.diffconfig.head
 grep '^CONFIG_ALL_KMODS=y' .config >> tmp/.diffconfig.head
 grep '^CONFIG_DEVEL=y' .config >> tmp/.diffconfig.head
 grep '^CONFIG_TOOLCHAINOPTS=y' .config >> tmp/.diffconfig.head
+grep '^CONFIG_BUSYBOX_CUSTOM=y' .config >> tmp/.diffconfig.head
 ./scripts/config/conf --defconfig=tmp/.diffconfig.head -w 
tmp/.diffconfig.stage1 Config.in >/dev/null
 ./scripts/kconfig.pl '>+' tmp/.diffconfig.stage1 .config >> 
tmp/.diffconfig.head
 ./scripts/config/conf --defconfig=tmp/.diffconfig.head -w 
tmp/.diffconfig.stage2 Config.in >/dev/null
-- 
2.5.0
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] toolchain kernel-headers

2015-11-12 Thread Kenneth Johansson

toolchain/kernel-headers/Makefile

contains this

define Host/Configure
env
yes '' | $(KMAKE) oldconfig
$(call Host/Configure/all)
$(call Host/Configure/post/$(ARCH))
endef

Now this is run to configure the kernel so that we later can do make 
with the headers_install target.


But is this really correct ?
what is happening here is that "make oldconfig" is at this point run 
without any .config file present. what is then happening is that the 
kernel makefile fetches the config for the currently running kernel on 
the HOST and uses that as base config. well this is probably wrong ARCH 
and probably a config for the wrong kernel version also. Is there a 
reason a "make defconfig" can't be used ?


I had a kernel that did not allow answering yes on everything and thus 
end in an infinite loop here and notice that this is a bit wrong/strange.


I guess that all that is needed at this stage is that the ARCH is 
correct and we really do not care about the config.

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] toolchain kernel-headers

2015-11-12 Thread Felix Fietkau
On 2015-11-12 10:11, Kenneth Johansson wrote:
> toolchain/kernel-headers/Makefile
> 
> contains this
> 
> define Host/Configure
>  env
>  yes '' | $(KMAKE) oldconfig
>  $(call Host/Configure/all)
>  $(call Host/Configure/post/$(ARCH))
> endef
> 
> Now this is run to configure the kernel so that we later can do make 
> with the headers_install target.
> 
> But is this really correct ?
> what is happening here is that "make oldconfig" is at this point run 
> without any .config file present. what is then happening is that the 
> kernel makefile fetches the config for the currently running kernel on 
> the HOST and uses that as base config. well this is probably wrong ARCH 
> and probably a config for the wrong kernel version also. Is there a 
> reason a "make defconfig" can't be used ?
> 
> I had a kernel that did not allow answering yes on everything and thus 
> end in an infinite loop here and notice that this is a bit wrong/strange.
> 
> I guess that all that is needed at this stage is that the ARCH is 
> correct and we really do not care about the config.
I think defconfig should be usable as well, please test it.
As for ARCH, it definitely uses the right one, just take a look at the
definition of KMAKE.

- Felix
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Progress on Reproducible Builds

2015-11-12 Thread Holger Levsen
Hi,

to also state it on this list: great work and summary!

and btw, if you haven't seen: https://reproducible-builds.org/ you probably 
should have a look!

On Freitag, 23. Oktober 2015, bnewb...@robocracy.org wrote:
> I have some patches to the OpenWRT build system and a small number of core
> packages (host and target), and am writing now to ask how best to start
> submitting them. I could:
> 
> 1. Submit all patches now as-is (following OpenWRT conventions)
> 2. Wait until the work reaches a milestone (eg, most image artifacts are
> reproducible) and submit then
> 3. Upstream patches to other projects first (busybox and squashfs-tools)
> 4. Or something else

I think you should do 1+3 :)
 
> I think a valuable milestone will be the ability for independent parties
> to reproduce all the .ipkg, kernel, rootfs, and image files for a given
> architecture, given the release tag (for the openwrt repo and any package
> feeds) and the "config.diff" file included in releases on
> http://downloads.openwrt.org/. 

agreed.


cheers,
Holger


signature.asc
Description: This is a digitally signed message part.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] openwrt gpsd compilation fail

2015-11-12 Thread Pushpal Sidhu
Hi Luigi,

On Thu, Nov 12, 2015 at 9:27 AM, luigi findanno  wrote:
>
> Hi, I'm trying to compile openwrt for raspberry pi but I found this error:
>
> http://pastebin.com/yQFhza8Y
>
> I don't know how to go on. I found your email in the Makefile and I'll be 
> happy if you can help me.
> Regards
> Luigi Findanno


I just pulled down the latest openwrt and latest packages and built
gpsd, gpsd-clients, and libgps for an arm cortex-a9. I then selected
the Raspberry Pi 2 Model B target and built just fine, so I'm not
totally sure what you're seeing. Can you run a 'strip --version' and
give me that info please? I imagine that your tool needs to be
updated.

- Pushpal
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH CC] procd: rework makefile, split ujail/seccomp

2015-11-12 Thread Etienne Champetier
Hi

2015-10-29 22:04 GMT+01:00 Etienne CHAMPETIER 
:

> ujail doesn't depend on seccomp and some archs dont support seccomp
>
> Backport of r46936
> needed since last procd update (r47268)
>

friendly ping
this is run tested on ar71xx / CC (uclibc)


>
> [...]
>
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] update mtd-utils to 1.5.2

2015-11-12 Thread Sven Roederer
 - update mtd-utils to 1.5.2 (git a494d30ab1ae40cb7665680cadf5af3ca3830a73)
 - remove patches that went upstream
 - fixes build from scratch as of broken patches

just had a crash-course to git send-email 

Signed-off-by: Sven Roederer 
---
 tools/mtd-utils/Makefile   |  6 ++--
 tools/mtd-utils/patches/110-portability.patch  | 21 ---
 tools/mtd-utils/patches/137-no_extern_inline.patch | 41 --
 .../300-libfec_use_standard_unsigned_long.patch| 35 --
 4 files changed, 3 insertions(+), 100 deletions(-)
 delete mode 100644 tools/mtd-utils/patches/137-no_extern_inline.patch
 delete mode 100644 
tools/mtd-utils/patches/300-libfec_use_standard_unsigned_long.patch

diff --git a/tools/mtd-utils/Makefile b/tools/mtd-utils/Makefile
index b863179..d38798b 100644
--- a/tools/mtd-utils/Makefile
+++ b/tools/mtd-utils/Makefile
@@ -7,14 +7,14 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=mtd-utils
-PKG_VERSION:=1.5.1
+PKG_VERSION:=1.5.2
 
-PKG_SOURCE_VERSION:=92686f212c9a4e16891c6a3c57629cbf4f0f8360
+PKG_SOURCE_VERSION:=a494d30ab1ae40cb7665680cadf5af3ca3830a73
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
 PKG_SOURCE_URL:=git://git.infradead.org/mtd-utils.git
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_MIRROR_MD5SUM:=9fe0518213feddacd1842935dddeb6c8
+PKG_MIRROR_MD5SUM:=0785919dc5888e9397a8bb77e7e0e19c
 PKG_CAT:=zcat
 
 HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION)
diff --git a/tools/mtd-utils/patches/110-portability.patch 
b/tools/mtd-utils/patches/110-portability.patch
index 4ad209a..c4cdab9 100644
--- a/tools/mtd-utils/patches/110-portability.patch
+++ b/tools/mtd-utils/patches/110-portability.patch
@@ -150,27 +150,6 @@
  #include 
  #include "version.h"
  
-@@ -117,11 +116,6 @@ extern "C" {
-   fprintf(stderr, "%s: warning!: " fmt "\n", PROGRAM_NAME, 
##__VA_ARGS__); \
- } while(0)
- 
--#if defined(__UCLIBC__)
--/* uClibc versions before 0.9.34 don't have rpmatch() */
--#if __UCLIBC_MAJOR__ == 0 && \
--  (__UCLIBC_MINOR__ < 9 || \
--  (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ < 34))
- #undef rpmatch
- #define rpmatch __rpmatch
- static inline int __rpmatch(const char *resp)
-@@ -129,8 +123,6 @@ static inline int __rpmatch(const char *
- return (resp[0] == 'y' || resp[0] == 'Y') ? 1 :
-   (resp[0] == 'n' || resp[0] == 'N') ? 0 : -1;
- }
--#endif
--#endif
- 
- /**
-  * prompt the user for confirmation
 --- a/include/mtd/ubifs-media.h
 +++ b/include/mtd/ubifs-media.h
 @@ -33,7 +33,15 @@
diff --git a/tools/mtd-utils/patches/137-no_extern_inline.patch 
b/tools/mtd-utils/patches/137-no_extern_inline.patch
deleted file mode 100644
index d871d67..000
--- a/tools/mtd-utils/patches/137-no_extern_inline.patch
+++ /dev/null
@@ -1,41 +0,0 @@
 a/mkfs.ubifs/hashtable/hashtable_itr.c
-+++ b/mkfs.ubifs/hashtable/hashtable_itr.c
-@@ -35,18 +35,6 @@ hashtable_iterator(struct hashtable *h)
- }
- 
- 
/*/
--/* key  - return the key of the (key,value) pair at the current position 
*/
--/* value- return the value of the (key,value) pair at the current 
position */
--
--void *
--hashtable_iterator_key(struct hashtable_itr *i)
--{ return i->e->k; }
--
--void *
--hashtable_iterator_value(struct hashtable_itr *i)
--{ return i->e->v; }
--
--/*/
- /* advance - advance the iterator to the next element
-  *   returns zero if advanced to end of table */
- 
 a/mkfs.ubifs/hashtable/hashtable_itr.h
-+++ b/mkfs.ubifs/hashtable/hashtable_itr.h
-@@ -28,7 +28,7 @@ hashtable_iterator(struct hashtable *h);
- /* hashtable_iterator_key
-  * - return the value of the (key,value) pair at the current position */
- 
--extern inline void *
-+static inline void *
- hashtable_iterator_key(struct hashtable_itr *i)
- {
- return i->e->k;
-@@ -37,7 +37,7 @@ hashtable_iterator_key(struct hashtable_
- 
/*/
- /* value - return the value of the (key,value) pair at the current position */
- 
--extern inline void *
-+static inline void *
- hashtable_iterator_value(struct hashtable_itr *i)
- {
- return i->e->v;
diff --git 
a/tools/mtd-utils/patches/300-libfec_use_standard_unsigned_long.patch 
b/tools/mtd-utils/patches/300-libfec_use_standard_unsigned_long.patch
deleted file mode 100644
index 73a68b5..000
--- a/tools/mtd-utils/patches/300-libfec_use_standard_unsigned_long.patch
+++ /dev/null
@@ -1,35 +0,0 @@
 a/lib/libfec.c
-+++ b/lib/libfec.c
-@@ -61,8 +61,6 @@ struct timeval {
- };
- #define gettimeofday(x, dummy) { (x)->ticks = clock() ; }
- #define DIFF_T(a,b) (1+ 100*(a.ticks - b.ticks) / CLOCKS_PER_SEC )
--typedef unsigned long u_long ;
--typedef unsigned short u_short ;
- #else /* typically, unix systems */
- #include 
- 

[OpenWrt-Devel] ujail not working with musl / DD

2015-11-12 Thread Etienne Champetier
Hi all, John,

I'm a bit out of my game on this bug, ujail is not adding the interpretor
in the jail (/lib/ld-musl-x86_64.so.1) with musl DD
it's working with uclibc CC, on my ubuntu 14.04, but not with musl DD

https://dev.openwrt.org/ticket/20785
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/3] Added patch for GL-AR150 support

2015-11-12 Thread alzhao
This is the patches for GL-AR150 router support. Tested on Trunk and it works.
Also grouped profiles of GL products to gli.mk

---
 .../ar71xx/base-files/etc/uci-defaults/01_leds |   4 +
 .../ar71xx/base-files/etc/uci-defaults/02_network  |   1 +
 target/linux/ar71xx/base-files/lib/ar71xx.sh   |   3 +
 .../ar71xx/base-files/lib/upgrade/platform.sh  |   1 +
 target/linux/ar71xx/config-4.1 |   1 +
 .../ar71xx/files/arch/mips/ath79/mach-gl-ar150.c   | 125 +
 target/linux/ar71xx/generic/profiles/gl-connect.mk |  17 ---
 target/linux/ar71xx/generic/profiles/gli.mk|  27 +
 target/linux/ar71xx/image/Makefile |   8 ++
 .../patches-4.1/911-MIPS-ath79-add-gl_ar150.patch  |  39 +++
 10 files changed, 209 insertions(+), 17 deletions(-)
 create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar150.c
 delete mode 100644 target/linux/ar71xx/generic/profiles/gl-connect.mk
 create mode 100644 target/linux/ar71xx/generic/profiles/gli.mk
 create mode 100644 
target/linux/ar71xx/patches-4.1/911-MIPS-ath79-add-gl_ar150.patch

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 39f472a..25f9d13 100644
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
@@ -211,6 +211,10 @@ dlan-pro-1200-ac)
ucidef_set_led_trigger_gpio "plcr" "dLAN" "devolo:error:dlan" "16" "0"
;;
 
+gl-ar150)
+   ucidef_set_led_wlan "wlan" "WLAN" "gl_ar150:wlan" "phy0tpt"
+   ;;
+
 gl-inet)
ucidef_set_led_netdev "lan" "LAN" "gl-connect:green:lan" "eth1"
ucidef_set_led_wlan "wlan" "WLAN" "gl-connect:red:wlan" "phy0tpt"
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network 
b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
index 2765adb..2ba1fbd 100644
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -396,6 +396,7 @@ dir-505-a1)
 alfa-ap96 |\
 alfa-nx |\
 ap83 |\
+gl-ar150 |\
 gl-inet |\
 jwap003 |\
 pb42 |\
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 0e92ee7..9848906 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -478,6 +478,9 @@ ar71xx_board_detect() {
name="gl-inet"
gl_inet_board_detect
;;
+   *"GL AR150")
+name="gl-ar150"
+;;
*"EnGenius EPG5000")
name="epg5000"
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh 
b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index b97c076..8ea11b4 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -219,6 +219,7 @@ platform_check_image() {
esr900 | \
ew-dorin | \
ew-dorin-router | \
+   gl-ar150 | \
hiwifi-hc6361 | \
hornet-ub-x2 | \
mzk-w04nu | \
diff --git a/target/linux/ar71xx/config-4.1 b/target/linux/ar71xx/config-4.1
index 08e252d..72b47eb 100644
--- a/target/linux/ar71xx/config-4.1
+++ b/target/linux/ar71xx/config-4.1
@@ -75,6 +75,7 @@ CONFIG_ATH79_MACH_ESR1750=y
 CONFIG_ATH79_MACH_ESR900=y
 CONFIG_ATH79_MACH_EW_DORIN=y
 CONFIG_ATH79_MACH_F9K1115V2=y
+CONFIG_ATH79_MACH_GL_AR150=y
 CONFIG_ATH79_MACH_GL_INET=y
 CONFIG_ATH79_MACH_GS_MINIBOX_V1=y
 CONFIG_ATH79_MACH_GS_OOLITE=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar150.c 
b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar150.c
new file mode 100644
index 000..310182c
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar150.c
@@ -0,0 +1,125 @@
+/*
+ *  GL_ar150 board support
+ *
+ *  Copyright (C) 2011 dongyuqi <729650...@qq.com>
+ *  Copyright (C) 2011-2012 Gabor Juhos 
+ *  Copyright (C) 2013 alzhao 
+ *  Copyright (C) 2014 Michel Stempin 
+ *
+ *  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 
+
+#include 
+
+#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 GL_AR150_GPIO_LED_WLAN0
+#define GL_AR150_GPIO_LED_LAN 13
+#define GL_AR150_GPIO_LED_WAN 15 
+
+#define GL_AR150_GPIO_BIN_USB 6
+#define GL_AR150_GPIO_BTN_MANUAL  7
+#define GL_AR150_GPIO_BTN_AUTO8
+#define GL_AR150_GPIO_BTN_RESET   11
+
+#define GL_AR150_KEYS_POLL_INTERVAL   20   /* msecs */
+#define GL_AR150_KEYS_DEBOUNCE_INTERVAL(3 * 
GL_AR150_KEYS_POLL_INTERVAL)
+
+#define GL_AR150_MAC0_OFFSET   0x
+

[OpenWrt-Devel] [PATCH 2/3] added patch for GL-AR300 support

2015-11-12 Thread alzhao
This is the patches for GL-AR300 router support. Tested on Trunk and it works.

---
 .../ar71xx/base-files/etc/uci-defaults/01_leds |   4 +
 .../ar71xx/base-files/etc/uci-defaults/02_network  |   6 ++
 target/linux/ar71xx/base-files/lib/ar71xx.sh   |   3 +
 .../ar71xx/base-files/lib/upgrade/platform.sh  |   1 +
 target/linux/ar71xx/config-4.1 |   1 +
 .../ar71xx/files/arch/mips/ath79/mach-gl-ar300.c   | 106 +
 target/linux/ar71xx/generic/profiles/gli.mk|  11 +++
 target/linux/ar71xx/image/Makefile |   9 ++
 .../patches-4.1/912-MIPS-ath79-add-gl_ar300.patch  |  39 
 9 files changed, 180 insertions(+)
 create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar300.c
 create mode 100644 
target/linux/ar71xx/patches-4.1/912-MIPS-ath79-add-gl_ar300.patch

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 25f9d13..5da1ef4 100644
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
@@ -215,6 +215,10 @@ gl-ar150)
ucidef_set_led_wlan "wlan" "WLAN" "gl_ar150:wlan" "phy0tpt"
;;
 
+gl-ar300)
+   ucidef_set_led_wlan "wlan" "WLAN" "gl_ar300:wlan" "phy0tpt"
+   ;;
+
 gl-inet)
ucidef_set_led_netdev "lan" "LAN" "gl-connect:green:lan" "eth1"
ucidef_set_led_wlan "wlan" "WLAN" "gl-connect:red:wlan" "phy0tpt"
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network 
b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
index 2ba1fbd..628d710 100644
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -408,6 +408,12 @@ wpe72)
ucidef_set_interfaces_lan_wan "eth1" "eth0"
;;
 
+gl-ar300)
+   ucidef_set_interfaces_lan_wan "eth1" "eth0"
+   ucidef_add_switch "switch0" "1" "1"
+   ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
+   ;;
+
 wpj344)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1"
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 9848906..a64d005 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -481,6 +481,9 @@ ar71xx_board_detect() {
*"GL AR150")
 name="gl-ar150"
 ;;
+   *"GL AR300")
+   name="gl-ar300"
+   ;;
*"EnGenius EPG5000")
name="epg5000"
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh 
b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 8ea11b4..f06919f 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -220,6 +220,7 @@ platform_check_image() {
ew-dorin | \
ew-dorin-router | \
gl-ar150 | \
+   gl-ar300 | \
hiwifi-hc6361 | \
hornet-ub-x2 | \
mzk-w04nu | \
diff --git a/target/linux/ar71xx/config-4.1 b/target/linux/ar71xx/config-4.1
index 72b47eb..019d6d6 100644
--- a/target/linux/ar71xx/config-4.1
+++ b/target/linux/ar71xx/config-4.1
@@ -76,6 +76,7 @@ CONFIG_ATH79_MACH_ESR900=y
 CONFIG_ATH79_MACH_EW_DORIN=y
 CONFIG_ATH79_MACH_F9K1115V2=y
 CONFIG_ATH79_MACH_GL_AR150=y
+CONFIG_ATH79_MACH_GL_AR300=y
 CONFIG_ATH79_MACH_GL_INET=y
 CONFIG_ATH79_MACH_GS_MINIBOX_V1=y
 CONFIG_ATH79_MACH_GS_OOLITE=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar300.c 
b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar300.c
new file mode 100644
index 000..565267e
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar300.c
@@ -0,0 +1,106 @@
+/*
+ *  Domino board support
+ *
+ *  Copyright (C) 2011 dongyuqi <729650...@qq.com>
+ *  Copyright (C) 2011-2012 Gabor Juhos 
+ *  Copyright (C) 2013 alzhao 
+ *  Copyright (C) 2014 Michel Stempin 
+ *
+ *  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 
+#include 
+#include 
+#include 
+#include 
+
+#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 GL_AR300_GPIO_LED_WLAN 13
+#define GL_AR300_GPIO_LED_WAN  14
+#define GL_AR300_GPIO_BTN_RESET16
+
+
+#define GL_AR300_KEYS_POLL_INTERVAL20  /* msecs */
+#define GL_AR300_KEYS_DEBOUNCE_INTERVAL(3 * 
GL_AR300_KEYS_POLL_INTERVAL)
+
+#define GL_AR300_MAC0_OFFSET   0x
+#defineGL_AR300_MAC1_OFFSET0x
+#define GL_AR300_CALDATA_OFFSET0x1000
+#define GL_AR300_WMAC_MAC_OFFSET   0x
+
+static struct gpio_led gl_ar300_

[OpenWrt-Devel] [PATCH 3/3] Added patch for GL Domino Pi support

2015-11-12 Thread alzhao
This is the patches for GL Domino Core and Pi boards support. Tested on Trunk 
and it works.

---
 .../ar71xx/base-files/etc/uci-defaults/01_leds |   4 +
 .../ar71xx/base-files/etc/uci-defaults/02_network  |   1 +
 target/linux/ar71xx/base-files/lib/ar71xx.sh   |   3 +
 .../ar71xx/base-files/lib/upgrade/platform.sh  |   1 +
 target/linux/ar71xx/config-4.1 |   1 +
 .../ar71xx/files/arch/mips/ath79/mach-gl-domino.c  | 136 +
 target/linux/ar71xx/generic/profiles/gli.mk|  11 ++
 target/linux/ar71xx/image/Makefile |   8 ++
 .../913-MIPS-ath79-add-domino-support.patch|  39 ++
 9 files changed, 204 insertions(+)
 create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-gl-domino.c
 create mode 100644 
target/linux/ar71xx/patches-4.1/913-MIPS-ath79-add-domino-support.patch

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 5da1ef4..e7bab29 100644
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
@@ -219,6 +219,10 @@ gl-ar300)
ucidef_set_led_wlan "wlan" "WLAN" "gl_ar300:wlan" "phy0tpt"
;;
 
+gl-domino)
+   ucidef_set_led_wlan "wlan" "WLAN" "domino:blue:wlan" "phy0tpt"
+   ;;
+
 gl-inet)
ucidef_set_led_netdev "lan" "LAN" "gl-connect:green:lan" "eth1"
ucidef_set_led_wlan "wlan" "WLAN" "gl-connect:red:wlan" "phy0tpt"
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network 
b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
index 628d710..c3cfdb7 100644
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -397,6 +397,7 @@ alfa-ap96 |\
 alfa-nx |\
 ap83 |\
 gl-ar150 |\
+gl-domino |\
 gl-inet |\
 jwap003 |\
 pb42 |\
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index a64d005..1c517cf 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -462,6 +462,9 @@ ar71xx_board_detect() {
*"Dragino v2")
name="dragino2"
;;
+   *"Domino Pi")
+   name="gl-domino"
+   ;;
*"EAP300 v2")
name="eap300v2"
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh 
b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index f06919f..e329299 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -221,6 +221,7 @@ platform_check_image() {
ew-dorin-router | \
gl-ar150 | \
gl-ar300 | \
+   gl-domino | \
hiwifi-hc6361 | \
hornet-ub-x2 | \
mzk-w04nu | \
diff --git a/target/linux/ar71xx/config-4.1 b/target/linux/ar71xx/config-4.1
index 019d6d6..29e0f96 100644
--- a/target/linux/ar71xx/config-4.1
+++ b/target/linux/ar71xx/config-4.1
@@ -65,6 +65,7 @@ CONFIG_ATH79_MACH_DIR_825_B1=y
 CONFIG_ATH79_MACH_DIR_825_C1=y
 CONFIG_ATH79_MACH_DLAN_PRO_1200_AC=y
 CONFIG_ATH79_MACH_DLAN_PRO_500_WP=y
+CONFIG_ATH79_MACH_GL_DOMINO=y
 CONFIG_ATH79_MACH_DRAGINO2=y
 CONFIG_ATH79_MACH_EAP300V2=y
 CONFIG_ATH79_MACH_EAP7660D=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-domino.c 
b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-domino.c
new file mode 100644
index 000..a8a42ad
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-domino.c
@@ -0,0 +1,136 @@
+/*
+ *  Domino board support
+ *
+ *  Copyright (C) 2011 dongyuqi <729650...@qq.com>
+ *  Copyright (C) 2011-2012 Gabor Juhos 
+ *  Copyright (C) 2013 alzhao 
+ *  Copyright (C) 2014 Michel Stempin 
+ *
+ *  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 
+
+#include 
+
+#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 DOMINO_GPIO_LED_WLAN   0
+#define DOMINO_GPIO_LED_WAN17
+#define DOMINO_GPIO_LED_USB1
+#define DOMINO_GPIO_LED_LAN1   13
+#define DOMINO_GPIO_LED_LAN2   14
+#define DOMINO_GPIO_LED_LAN3   15
+#define DOMINO_GPIO_LED_LAN4   16
+#define DOMINO_GPIO_LED_SYS27
+#define DOMINO_GPIO_LED_WPS26
+#define DOMINO_GPIO_USB_POWER  6
+
+#define DOMINO_GPIO_BTN_RESET  11
+#define DOMINO_GPIO_BTN_WPS20
+
+#define DOMINO_KEYS_POLL_INTERVAL  20  /* msecs */
+#define DOMINO_KEYS_DEBOUNCE_INTERVAL  (3 * DOMINO_KEYS_POLL_INTERVAL)
+
+#define DOMINO_MAC0_OFFSET 0x
+#define   

[OpenWrt-Devel] [RFC] A patch for mt7621 nand controler. Revision 2.

2015-11-12 Thread Kirill Berezin
Hello,

It turned out that mtk_nand driver uses some sophisticated accounting and a
general nand code must be patched.

This patch adds required read and erase calls to a general nand code. I
used a  code  for re6500 released by Linksys as a reference.

All required operations (erase, write and read) are usable. However I found
that jffs2 filesystem can be created only on top of a ubi volume. I tried
to create jffs2 directly on mtd device but pages with clean markers are
became uncorrectable.

This patch also includes changes that I sent earlier.

Best regards,
Kirill.

Signed-off-by: Kirill Berezin (fyi...@gmail.com)
diff -urNb a/drivers/mtd/nand/mtk_nand.c b/drivers/mtd/nand/mtk_nand.c
--- a/drivers/mtd/nand/mtk_nand.c	2015-11-06 16:44:31.0 +0400
+++ b/drivers/mtd/nand/mtk_nand.c	2015-11-12 10:06:20.080430855 +0400
@@ -110,6 +110,10 @@
 int manu_id;
 int dev_id;
 
+/* this constant was taken from linux/nand/nand.h v 3.14
+ * in later versions it seems it was removed in order to save a bit of space
+ */
+#define NAND_MAX_OOBSIZE 774
 static u8 local_oob_buf[NAND_MAX_OOBSIZE];
 
 static u8 nand_badblock_offset = 0;
@@ -348,7 +352,7 @@
 		if (0xF == u4ErrNum) {
 			mtd->ecc_stats.failed++;
 			bRet = false;
-			//printk(KERN_ERR"UnCorrectable at PageAddr=%d\n", u4PageAddr);
+			printk(KERN_ERR"mtk_nand: UnCorrectable at PageAddr=%d\n", u4PageAddr);
 		} else {
 			for (i = 0; i < ((u4ErrNum + 1) >> 1); ++i) {
 au4ErrBitLoc[i] = DRV_Reg32(ECC_DECEL0_REG32 + i);
@@ -1422,7 +1426,7 @@
 {
 	struct nand_chip *chip = (struct nand_chip *)mtd->priv;
 
-	chip->erase_cmd(mtd, page);
+	chip->erase(mtd, page);
 
 	return chip->waitfunc(mtd, chip);
 }
@@ -2094,8 +2098,8 @@
 	nand_chip->write_page = mtk_nand_write_page;
 	nand_chip->ecc.write_oob = mtk_nand_write_oob;
 	nand_chip->block_markbad = mtk_nand_block_markbad;   // need to add nand_get_device()/nand_release_device().
-	//	nand_chip->erase = mtk_nand_erase;	
-	//nand_chip->read_page = mtk_nand_read_page;
+	nand_chip->erase_mtk = mtk_nand_erase;	
+	nand_chip->read_page = mtk_nand_read_page;
 	nand_chip->ecc.read_oob = mtk_nand_read_oob;
 	nand_chip->block_bad = mtk_nand_block_bad;
 
@@ -2175,6 +2179,21 @@
 	nand_chip->pagemask = (nand_chip->chipsize >> nand_chip->page_shift) - 1;
 	nand_chip->phys_erase_shift = ffs(mtd->erasesize) - 1;
 	nand_chip->chip_shift = ffs(nand_chip->chipsize) - 1;//0x1C;//ffs(nand_chip->chipsize) - 1;
+
+	/* allocate buffers or call select_chip here or a bit earlier*/
+	{
+		struct nand_buffers *nbuf = kzalloc(sizeof(*nbuf) + mtd->writesize + mtd->oobsize * 3, GFP_KERNEL);
+		if (!nbuf) {
+			return -ENOMEM;
+		}
+		nbuf->ecccalc = (uint8_t *)(nbuf + 1);
+		nbuf->ecccode = nbuf->ecccalc + mtd->oobsize;
+		nbuf->databuf = nbuf->ecccode + mtd->oobsize;
+
+		nand_chip->buffers = nbuf;
+		nand_chip->options |= NAND_OWN_BUFFERS;
+	}
+
 	nand_chip->oob_poi = nand_chip->buffers->databuf + mtd->writesize;
 	nand_chip->badblockpos = 0;
 
@@ -2251,6 +2270,9 @@
 	MSG(INIT, "[NFI] mtk_nand_probe fail, err = %d!\n", err);
 	nand_release(mtd);
 	platform_set_drvdata(pdev, NULL);
+	if ( NULL != nand_chip->buffers) {
+		kfree(nand_chip->buffers);
+	}
 	kfree(host);
 	nand_disable_clock();
 	return err;
@@ -2261,8 +2283,12 @@
 {
 	struct mtk_nand_host *host = platform_get_drvdata(pdev);
 	struct mtd_info *mtd = &host->mtd;
+	struct nand_chip *nand_chip = &host->nand_chip;
 
 	nand_release(mtd);
+	if ( NULL != nand_chip->buffers) {
+		kfree(nand_chip->buffers);
+	}
 	kfree(host);
 	nand_disable_clock();
 
diff -urNb a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
--- a/drivers/mtd/nand/nand_base.c	2015-11-06 16:44:31.0 +0400
+++ b/drivers/mtd/nand/nand_base.c	2015-11-09 10:24:52.931720862 +0400
@@ -1575,6 +1575,9 @@
 		 __func__, buf);
 
 read_retry:
+#ifdef CONFIG_MTK_MTD_NAND
+			ret = chip->read_page(mtd, chip, bufpoi, page);
+#else
 			chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
 
 			/*
@@ -1593,6 +1596,7 @@
 			else
 ret = chip->ecc.read_page(mtd, chip, bufpoi,
 			  oob_required, page);
+#endif /* CONFIG_MTK_MTD_NAND */
 			if (ret < 0) {
 if (use_bufpoi)
 	/* Invalidate page cache */
@@ -2770,8 +2774,11 @@
 		if (page <= chip->pagebuf && chip->pagebuf <
 		(page + pages_per_block))
 			chip->pagebuf = -1;
-
+#ifdef CONFIG_MTK_MTD_NAND
+		status = chip->erase_mtk(mtd, page & chip->pagemask);
+#else
 		status = chip->erase(mtd, page & chip->pagemask);
+#endif /* CONFIG_MTK_MTD_NAND */
 
 		/*
 		 * See if operation failed and additional status checks are
diff -urNb a/drivers/mtd/nand/nand_device_list.h b/drivers/mtd/nand/nand_device_list.h
--- a/drivers/mtd/nand/nand_device_list.h	2015-11-06 16:44:31.0 +0400
+++ b/drivers/mtd/nand/nand_device_list.h	2015-11-06 11:13:26.0 +0400
@@ -43,6 +43,8 @@
 	{0xADBC, 0x905554, 5, 16, 512, 128, 2048, 64, 0x10801011, "H9DA4GH4JJAMC", 0},
 {0x01F1, 0x801D01, 4, 8, 128, 128, 2048, 64, 0x30C77fff, "S34ML01G100TF", 0},
 {0x92F1