Re: [OpenWrt-Devel] cant boot ralink rt3052 (openwrt Attitude Adjustment 2/6/2011 co)

2011-06-03 Thread Layne Edwards
  

I don't think you want to use this patch. OpenWrt uses custom drivers and a 
differnet configuration than Fonera's firmware (yes it's built on OpenWrt, but 
it's been customized and is no longer compatible with trunk). 

It's probably just a matter of using the correct configuration (or creating 
one) for your generic router. Instead of using the generic kernel and squashfs 
rootfs, try using one of the combined images... which will have the mtd 
partitions setup for the respective router. If you have 8MB flash, try the 
fonera 2.0n image, if you have 4MB flash, try the dir-300 image. If you get it 
working, you may want to adjust the configuration slightly to match your 
generic router (gpios, etc). See 
linux/target/ramips/filese/arch/mips/ralink/rt305x/. 

Regards,
Layne 

On Fri, 3 Jun 2011 10:30:57 +0530, harish badrinath wrote: 

 What board/router are you using?
 Its a unbranded chinese Ralink SOC RT3052 
 
 What image did you flash?
 I checked out trunk, built it on a
local machine and then flahsed openwrt-ramips-rt305x-uImage.bin and 
openwrt-ramips-rt305x-root.squashfs. The patches in question can be found at 
(a)http://gitorious.org/wive-rtnl-ralink-rt305x-routers-firmware/wive-rtnl-ralink-rt305x-routers-firmware/blobs/51578b4f4efe8fba3eefec0a8e8aae4e6be7a404/linux-2.6.21.x/drivers/mtd/maps/ralink-flash.c
 [1] 
(b)http://svn.fonosfera.org/fon-ng/trunk/openwrt/target/linux/fonera2n/patches-2.6.21/301-mtd.patch
 [2] I am quiet new to openwrt (and the embedded world in general) any help 
would be appreciated. Regrds, Harish Badrinath 
___ openwrt-devel mailing list 
openwrt-devel@lists.openwrt.org [3] 
https://lists.openwrt.org/mailman/listinfo/openwrt-devel [4]
 

Links:
--
[1] 
http://gitorious.org/wive-rtnl-ralink-rt305x-routers-firmware/wive-rtnl-ralink-rt305x-routers-firmware/blobs/51578b4f4efe8fba3eefec0a8e8aae4e6be7a404/linux-2.6.21.x/drivers/mtd/maps/ralink-flash.c
[2]
http://svn.fonosfera.org/fon-ng/trunk/openwrt/target/linux/fonera2n/patches-2.6.21/301-mtd.patch
[3] mailto:openwrt-devel@lists.openwrt.org
[4] https://lists.openwrt.org/mailman/listinfo/openwrt-devel
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Ralink rt3052 Reset button and 2nd MAC

2011-06-03 Thread Layne Edwards
  

On Fri, 3 Jun 2011 13:50:17 +0800, HP Teoh wrote: 

 On Fri, Jun 3, 2011 at 12:42 PM, Layne Edwards wrote:
 
 On Fri, 3 Jun 2011 12:01:55 +0800, HP Teoh wrote: 
 
 Hi Lanyne,
 
 Thanks for the wifi led configuration. Any idea about the reset button not 
 working and method to insert 2nd mac for vlan?
 
 Thanks and Regards.
 -Vincent
 
 Vincent, 
 
 For your MAC issue:
 The current ethernet and switch drivers for the ramips target still need 
 some work. The VLAN is hardcoded and the MAC address is not pulled from 
 flash or eeprom, but hard-coded to 00:11:22:33:44:55. See the 
 ramips_eth_data struct in 
 linux/ramips/files/arch/mips/ralink/rt305x/devices.c. The ethernet driver 
 (linux/ramips/files/driver/net/ramips.c needs to be updated to pull in the 
 ethernet MAC instead of using the default hard-coded value.
 
 Hi Layne,
 
 I added some code to read and pull the MACs out of mtdblock3 (factory) and 
 write both addresses to 
 
 static inline void

ramips_hw_set_macaddr(unsigned char *mac)
 {
 ramips_fe_wr((mac[0]

Vincent, 

If you're talking about WAN and LAN having different MACs... just remember that 
the WAN and LAN are on a VLAN and share the same interface (eth0), so they will 
have the same MAC (same as eth0). I think you can set the MACs for WAN and LAN 
independently in the configuration though. Something like: 

config 'interface' 'wan'
 option 'ifname' 'eth0.2'
 option 'proto' 'dhcp'
 option 'macaddr' '1234567890' 

See http://wiki.openwrt.org/doc/uci/network. 

Hope this helps. 

Layne 

Links:
--
[1] mailto:ledwa...@astrumtech.net
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Ralink rt3052 Reset button and 2nd MAC

2011-06-03 Thread HP Teoh
On Fri, Jun 3, 2011 at 2:15 PM, Layne Edwards ledwa...@astrumtech.netwrote:

  On Fri, 3 Jun 2011 13:50:17 +0800, HP Teoh wrote:


 On Fri, Jun 3, 2011 at 12:42 PM, Layne Edwards ledwa...@astrumtech.netwrote:

  On Fri, 3 Jun 2011 12:01:55 +0800, HP Teoh wrote:

 Hi Lanyne,

 Thanks for the wifi led configuration.  Any idea about the reset button
 not working and method to insert 2nd mac for vlan?

 Thanks and Regards.
 -Vincent

  Vincent,

 For your MAC issue:
 The current ethernet and switch drivers for the ramips target still need
 some work.  The VLAN is hardcoded and the MAC address is not pulled from
 flash or eeprom, but hard-coded to 00:11:22:33:44:55.  See the
 ramips_eth_data struct in
 linux/ramips/files/arch/mips/ralink/rt305x/devices.c.  The ethernet driver
 (linux/ramips/files/driver/net/ramips.c needs to be updated to pull in the
 ethernet MAC instead of using the default hard-coded value.

 Hi Layne,

 I added some code to read and pull the MACs out of mtdblock3 (factory) and
 write both addresses to

 static inline void
 ramips_hw_set_macaddr(unsigned char *mac)
 {
 ramips_fe_wr((mac[0]  8) | mac[1], RAMIPS_GDMA1_MAC_ADRH);
 ramips_fe_wr((mac[2]  24) | (mac[3]  16) | (mac[4]  8) | mac[5],
  RAMIPS_GDMA1_MAC_ADRL);
 }

 static inline void
 ramips_hw_set_mac2addr(unsigned char *mac)
 {
 ramips_fe_wr((mac[0]  8) | mac[1], RAMIPS_GDMA2_MAC_ADRH);
 ramips_fe_wr((mac[2]  24) | (mac[3]  16) | (mac[4]  8) | mac[5],
  RAMIPS_GDMA2_MAC_ADRL);
 }

 However, the system only sees and takes the first one.

 Vincent,

 If you're talking about WAN and LAN having different MACs... just remember
 that the WAN and LAN are on a VLAN and share the same interface (eth0), so
 they will have the same MAC (same as eth0).  I think you can set the MACs
 for WAN and LAN independently in the configuration though.  Something like:

 config 'interface' 'wan'
 option 'ifname' 'eth0.2'
 option 'proto' 'dhcp'
 option 'macaddr' '1234567890'

 See http://wiki.openwrt.org/doc/uci/network.


Hi Layne,

Yes.  This is the method I'm currently using for the second MAC.  I thought
the mac address can be somehow programmed to a vlan driver.

As for the Reset button GPIO settings, I don't see GPIO PIN 10 for Reset
button been assigned.  Have I missed anything?

GPIOs 0-23, RT305X-GPIO0:
 gpio-1   (reserved) in  lo
 gpio-2   (reserved) in  lo
 gpio-3   (reserved) in  lo
 gpio-4   (reserved) in  lo
 gpio-7   (wiwi-300n:green:wifi) out hi
 gpio-15  (reserved) in  lo
 gpio-16  (reserved) in  lo
 gpio-17  (reserved) in  lo
 gpio-18  (reserved) in  lo
 gpio-22  (reserved) in  lo
 gpio-23  (reserved) in  lo

GPIOs 24-39, RT305X-GPIO1:
 gpio-24  (reserved) in  lo
 gpio-25  (reserved) in  lo
 gpio-26  (reserved) in  lo
 gpio-27  (reserved) in  lo
 gpio-28  (reserved) in  lo
 gpio-29  (reserved) in  lo
 gpio-30  (reserved) in  lo
 gpio-31  (reserved) in  lo
 gpio-32  (reserved) in  lo
 gpio-33  (reserved) in  lo
 gpio-34  (reserved) in  lo
 gpio-35  (reserved) in  lo
 gpio-36  (reserved) in  lo
 gpio-37  (reserved) in  lo
 gpio-38  (reserved) in  lo
 gpio-39  (reserved) in  lo

GPIOs 40-51, RT305X-GPIO2:
 gpio-40  (reserved) in  lo
 gpio-41  (reserved) in  lo
 gpio-42  (reserved) in  lo
 gpio-43  (reserved) in  lo
 gpio-44  (reserved) in  lo
 gpio-45  (reserved) in  lo
 gpio-46  (reserved) in  lo
 gpio-47  (reserved) in  lo
 gpio-48  (reserved) in  lo
 gpio-49  (reserved) in  lo
 gpio-50  (reserved) in  lo
 gpio-51  (reserved) in  lo


Thanks and Regards.
Vincent



 Hope this helps.

 Layne

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


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


Re: [OpenWrt-Devel] [proposal] More flexible configuration of DHCP-assigned IP addresses in non-C class networks

2011-06-03 Thread Jo-Philipp Wich
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,

just set start to 257 and it will lease addresses beginning with x.y.1.1 .

192.168.0.0/16 + 257 = 192.168.1.1

~ Jow
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk3ojtUACgkQdputYINPTPOVXQCgmFfwNyELaKfoDb7LcpkDxQkg
4AMAoJcuaEU/rBTlvr1uv0gjXGEkBC08
=C1dX
-END PGP SIGNATURE-
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 2/2] runtime shared library binding support

2011-06-03 Thread Mika Laitio
Fix the eglibc/glibc builds where the network init failed due to
unresolved libraries by adding support for the fot the runtime library
bindings by running ldconfig at bootup.
Directories used by default for the creating ld.config.cache are
/lib and /usr/lib but other applications can extend it in their install
time by adding own conf file under /etc/ld.so.conf.d directory.
By default the cache is created to file /tmp/ld.so.cache that is
symlinked from /etc/ld.so.cache. But script will also detect if user
has instead changed the symlink target to somewhere or wants
/etc/ld.so.cache to be normal file instead of being a symlink.

Signed-off-by: Mika Laitio lam...@pilppa.org
---
 package/base-files/Makefile|4 ++
 .../base-files/glibc-files/etc/init.d/linkbindings |   32 
 package/base-files/glibc-files/etc/ld.so.conf  |1 +
 .../etc/ld.so.conf.d/base_library_path.conf|2 +
 4 files changed, 39 insertions(+), 0 deletions(-)
 create mode 100644 package/base-files/glibc-files/etc/init.d/linkbindings
 create mode 100644 package/base-files/glibc-files/etc/ld.so.conf
 create mode 100644 
package/base-files/glibc-files/etc/ld.so.conf.d/base_library_path.conf

diff --git a/package/base-files/Makefile b/package/base-files/Makefile
index 5e6e652..9880f3f 100644
--- a/package/base-files/Makefile
+++ b/package/base-files/Makefile
@@ -494,6 +494,10 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
fi; \
done; \
done
+   $(INSTALL_DIR) $(1)/sbin
+   if [ -e $(TOOLCHAIN_DIR)/sbin/ldconfig ]; then \
+   $(CP) $(TOOLCHAIN_DIR)/sbin/ldconfig $(1)/sbin/; \
+   fi
   endef
 
   define Package/eglibc/install
diff --git a/package/base-files/glibc-files/etc/init.d/linkbindings 
b/package/base-files/glibc-files/etc/init.d/linkbindings
new file mode 100644
index 000..08f5b7e
--- /dev/null
+++ b/package/base-files/glibc-files/etc/init.d/linkbindings
@@ -0,0 +1,32 @@
+#!/bin/sh /etc/rc.common
+#
+# Copyright (C) 2011 OpenWrt.org
+#
+
+START=04
+
+start() {
+if [ -e /sbin/ldconfig ]  [ -e /etc/ld.so.conf ]; then
+   if [ -h /etc/ld.so.cache ]; then
+   # cache exist and is symlink
+   # parse file where the symlink points
+   symtarget=$(ls -l /etc/ld.so.cache | sed 's/.*-\ //g')
+   #update cache from file where the symlink from 
/etc/ld.so.cache points
+   /sbin/ldconfig -C $symtarget
+   echo runtime shared library bindings updated to 
/etc/ld.so.cache symlink $symtarget
+   else
+   if [ ! -e /etc/ld.so.cache ]; then
+   # cache does not yet exist, create it as a 
symlink to /tmp/ld.so.cache
+   echo creating symlink from /etc/ld.so.cache to 
/tmp/ld.so.cache
+   ln -s /tmp/ld.so.cache /etc/ld.so.cache
+   /sbin/ldconfig -C /tmp/ld.so.cache
+   echo runtime shared library bindings updated 
to /etc/ld.so.cache symlink /tmp/ld.so.cache
+   else
+   # cache does not exist as a symlink or is not 
pointing to /tmp
+   # let ldconfig update cache from default 
position (/etc/ld.so.cache)
+   /sbin/ldconfig
+   echo runtime shared library bindings updated 
to /etc/ld.so.cache
+   fi
+fi
+fi
+}
diff --git a/package/base-files/glibc-files/etc/ld.so.conf 
b/package/base-files/glibc-files/etc/ld.so.conf
new file mode 100644
index 000..83327c0
--- /dev/null
+++ b/package/base-files/glibc-files/etc/ld.so.conf
@@ -0,0 +1 @@
+include /etc/ld.so.conf.d/*.conf
diff --git 
a/package/base-files/glibc-files/etc/ld.so.conf.d/base_library_path.conf 
b/package/base-files/glibc-files/etc/ld.so.conf.d/base_library_path.conf
new file mode 100644
index 000..61b171c
--- /dev/null
+++ b/package/base-files/glibc-files/etc/ld.so.conf.d/base_library_path.conf
@@ -0,0 +1,2 @@
+/lib
+/usr/lib
-- 
1.7.1

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


[OpenWrt-Devel] [PATCH 0/2] glibc and eglibc build and usage fixes

2011-06-03 Thread Mika Laitio
Two patches for glibc/eglibc builds on openwrt trunk.
First one is build fix to udevtrigger by adding missing
functions in hotplug2 is build against the glibc or eglibc. 
Fix is originally from sav in bug
https://dev.openwrt.org/ticket/9012

Second patch adds support for the ldconfig in case image
is build against the eglibc or glibc. (It does not change
anything in default uclibc case)

Without these patches I was not able to get network
connection to wzr-hp-g300nh when I build openwrt trunk against the 
eglibc 2.12 version. Serial console revealed that
network was not up because commands like swconfig
where failing because they could not find shared libraries
from /usr/lib directory. (On that attempt things started working
once I set LD_LIBRARY_PATH)

Mika Laitio (2):
  Fix the hotplug2 build with glibc/eglibc
  runtime shared library binding support

 package/base-files/Makefile|4 ++
 .../base-files/glibc-files/etc/init.d/linkbindings |   32 ++
 package/base-files/glibc-files/etc/ld.so.conf  |1 +
 .../etc/ld.so.conf.d/base_library_path.conf|2 +
 package/hotplug2/src/udevtrigger.c |   45 
 5 files changed, 84 insertions(+), 0 deletions(-)
 create mode 100644 package/base-files/glibc-files/etc/init.d/linkbindings
 create mode 100644 package/base-files/glibc-files/etc/ld.so.conf
 create mode 100644 
package/base-files/glibc-files/etc/ld.so.conf.d/base_library_path.conf

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


[OpenWrt-Devel] [PATCH 1/2] Fix the hotplug2 build with glibc/eglibc

2011-06-03 Thread Mika Laitio
Add strlcat and strlcpy functions if build env
is glibc or eglibc because they do not have
those functions.
Patch originates from: https://dev.openwrt.org/ticket/9012

Tested-by: Mika Laitio lam...@pilppa.org
---
 package/hotplug2/src/udevtrigger.c |   45 
 1 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/package/hotplug2/src/udevtrigger.c 
b/package/hotplug2/src/udevtrigger.c
index 297e64c..1f9ea69 100644
--- a/package/hotplug2/src/udevtrigger.c
+++ b/package/hotplug2/src/udevtrigger.c
@@ -36,6 +36,51 @@
 static int verbose;
 static int dry_run;
 
+#ifdef __GLIBC__
+size_t strlcpy(char *dst, const char *src, size_t size)
+{
+   size_t bytes = 0;
+   char *q = dst;
+   const char *p = src;
+   char ch;
+
+   while ((ch = *p++)) {
+   if (bytes+1  size)
+   *q++ = ch;
+   bytes++;
+   }
+
+   /* If size == 0 there is no space for a final null... */
+   if (size)
+   *q = '\0';
+   return bytes;
+}
+
+size_t strlcat(char *dst, const char *src, size_t size)
+{
+   size_t bytes = 0;
+   char *q = dst;
+   const char *p = src;
+   char ch;
+
+   while (bytes  size  *q) {
+   q++;
+   bytes++;
+   }
+   if (bytes == size)
+   return (bytes + strlen(src));
+
+   while ((ch = *p++)) {
+   if (bytes+1  size)
+   *q++ = ch;
+   bytes++;
+   }
+
+   *q = '\0';
+   return bytes;
+}
+#endif /* __GLIBC__ */
+
 void log_message(int priority, const char *format, ...)
 {
va_list args;
-- 
1.7.1

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


[OpenWrt-Devel] 2.6.39.1 update

2011-06-03 Thread Peter Wagner
this patch updates all target that use 2.6.39 to 2.39.1.

regards
Peter
diff --git a/include/kernel-version.mk b/include/kernel-version.mk
index 9b60d43..4ce6771 100644
--- a/include/kernel-version.mk
+++ b/include/kernel-version.mk
@@ -26,8 +26,8 @@ endif
 ifeq ($(LINUX_VERSION),2.6.38.6)
   LINUX_KERNEL_MD5SUM:=e896a3bb3185b8a8af8e2f010f63c02e
 endif
-ifeq ($(LINUX_VERSION),2.6.39)
-  LINUX_KERNEL_MD5SUM:=1aab7a741abe08d42e8eccf20de61e05
+ifeq ($(LINUX_VERSION),2.6.39.1)
+  LINUX_KERNEL_MD5SUM:=983834b0138e102a3fb0098367c17150
 endif
 
 # disable the md5sum check for unknown kernel versions
diff --git a/target/linux/au1000/Makefile b/target/linux/au1000/Makefile
index f90116f..bc62872 100644
--- a/target/linux/au1000/Makefile
+++ b/target/linux/au1000/Makefile
@@ -13,7 +13,7 @@ FEATURES:=jffs2 usb pci
 SUBTARGETS=au1500 au1550
 MAINTAINER:=Florian Fainelli flor...@openwrt.org
 
-LINUX_VERSION:=2.6.39
+LINUX_VERSION:=2.6.39.1
 
 include $(INCLUDE_DIR)/target.mk
 DEFAULT_PACKAGES += wpad-mini yamonenv
diff --git a/target/linux/cns3xxx/Makefile b/target/linux/cns3xxx/Makefile
index 86ca83a..f52de27 100644
--- a/target/linux/cns3xxx/Makefile
+++ b/target/linux/cns3xxx/Makefile
@@ -13,7 +13,7 @@ FEATURES:=squashfs fpu gpio
 CFLAGS:=-Os -pipe -march=armv6k -mtune=mpcore -mfloat-abi=softfp -mfpu=vfp -fno-caller-saves
 MAINTAINER:=Imre Kaloz ka...@openwrt.org
 
-LINUX_VERSION:=2.6.39
+LINUX_VERSION:=2.6.39.1
 
 include $(INCLUDE_DIR)/target.mk
 
diff --git a/target/linux/lantiq/Makefile b/target/linux/lantiq/Makefile
index 412b7b1..29da8a3 100644
--- a/target/linux/lantiq/Makefile
+++ b/target/linux/lantiq/Makefile
@@ -12,8 +12,7 @@ BOARDNAME:=Lantiq GPON/XWAY
 FEATURES:=squashfs jffs2
 SUBTARGETS:=falcon xway ase
 
-LINUX_VERSION:=2.6.39
-#LINUX_VERSION:=2.6.32.33
+LINUX_VERSION:=2.6.39.1
 
 CFLAGS=-Os -pipe -mips32r2 -mtune=mips32r2 -fno-caller-saves
 
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel