Re: [OpenWrt-Devel] GCC4.3 patch (wip)

2008-06-16 Thread Hinko Kocevar
Luigi 'Comio' Mantellini wrote:
 Ciao again,
 
 
 On ven, 2008-06-13 at 11:22 +0200, Luigi 'Comio' Mantellini wrote:
 Ciao,
 
 make[4]: Entering directory 
 `/mnt/devel/openwrt/OpenWRT.git/build_dir/toolchain-m68k_gcc4.3.1/uClibc-0.9.29'
 install -d 
 /mnt/devel/openwrt/OpenWRT.git/staging_dir/toolchain-m68k_gcc4.3.1//lib
 install -m 644 lib/lib*-0.9.29.so \
  
 /mnt/devel/openwrt/OpenWRT.git/staging_dir/toolchain-m68k_gcc4.3.1//lib
 cd lib  tar -cf - *.so.* | tar -xf - -C 
 /mnt/devel/openwrt/OpenWRT.git/staging_dir/toolchain-m68k_gcc4.3.1//lib
 tar: error while loading shared libraries: libpthread.so.0: ELF file data 
 encoding not little-endian
 tar: error while loading shared libraries: libpthread.so.0: ELF file data 
 encoding not little-endian

You've seem to remove some some mandatory path in system library search - if 
your had LD_LIBRARY_PATH set you've might need to do:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/your/lib
in contrast to
export LD_LIBRARY_PATH=/path/to/your/lib

 
 My self-answer: This error is caused by the LD_LIBRARY_PATH that I
 defined into rule.mk. At this point I need to resolve an issue: GCC4.3
 requires gmp and mpfr libraries. I added the makefile under the
 toolchain directory in order to create the needed libraries (libgmp.so
 and libmpfr.so). I  placed these libraries into the
 staging_dir/host/lib/ directory... but (cross)gcc doesn't start because
 this directory is not in the ld path... I thought to solve this issue
 using the LD_LIBRARY_PATH=$(TOP)/staging_dir/host/lib/ ... but this
 creates the error in tar application
 
 Now, with LD_LIBRARY_PATH env. variable removed, I'm compiling the
 gcc-final... but I will need it when the (cross)gcc is invoked.
 
 question: Where can I place the host libraries (__NOT TARGET__) in order
 to be visible to cross-compiler (and in general, to crosstools)?

Maybe all you need to do is correctly supply the full path to the 
includes/libraries via C(PP)FLAGS/LDFLAGS in the makefile, or on the command 
line instead of using LD_LIBRARY_PATH. Another approach would be to statically 
build/link the tar app inside the openWRT SDK and use the LD_LIBRARY_PATH after 
all.

HTH,

Hinko

-- 
ČETRTA POT, d.o.o., Kranj
Planina 3
4000 Kranj
Slovenia, Europe
Tel. +386 (0) 4 280 66 03
E-mail: [EMAIL PROTECTED]
Http: www.cetrtapot.si

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


Re: [OpenWrt-Devel] GCC4.3 patch (wip)

2008-06-16 Thread Luigi 'Comio' Mantellini
Hi Hinko,
Hi List,

see my inline comments.

On lun, 2008-06-16 at 10:05 +0200, Hinko Kocevar wrote:

 Luigi 'Comio' Mantellini wrote:
  Ciao again,
  
  
  On ven, 2008-06-13 at 11:22 +0200, Luigi 'Comio' Mantellini wrote:
  Ciao,
  
  make[4]: Entering directory 
  `/mnt/devel/openwrt/OpenWRT.git/build_dir/toolchain-m68k_gcc4.3.1/uClibc-0.9.29'
  install -d 
  /mnt/devel/openwrt/OpenWRT.git/staging_dir/toolchain-m68k_gcc4.3.1//lib
  install -m 644 lib/lib*-0.9.29.so \
 
  /mnt/devel/openwrt/OpenWRT.git/staging_dir/toolchain-m68k_gcc4.3.1//lib
  cd lib  tar -cf - *.so.* | tar -xf - -C 
  /mnt/devel/openwrt/OpenWRT.git/staging_dir/toolchain-m68k_gcc4.3.1//lib
  tar: error while loading shared libraries: libpthread.so.0: ELF file data 
  encoding not little-endian
  tar: error while loading shared libraries: libpthread.so.0: ELF file data 
  encoding not little-endian
 
 You've seem to remove some some mandatory path in system library search - if 
 your had LD_LIBRARY_PATH set you've might need to do:
 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/your/lib
 in contrast to
 export LD_LIBRARY_PATH=/path/to/your/lib
 


I added the following into $(TOP)/rule.mk (and I don't like what I
do...):

export LD_LIBRARY_PATH=$(TOP)/staging_dir/host/lib:$(LD_LIBRARY_PATH)


Anyway I decided to change approach: install directly on the host
environment the GMP and MPFR library need to GCC4.3 compiler... OpenWRT
should make some check to recognize these libraries:


ifneq ($(CONFIG_GCC_VERSION_4_3_X),)
define Require/gmp
echo 'int main(int argc, char **argv) { return 
((__GNU_MP_VERSION*1000+__GNU_MP_VERSION_MINOR)*1000+__GNU_MP_VERSION_PATCHLEVEL)=004001000?0:1;
 }' |
gcc -include gmp.h -x c -o $(TMP_DIR)/gmptest.o -lgmp -
endef

$(eval $(call Require,gmp, \ 
Please install lib gmp = 4.1.0 \ 
))

define Require/mpfr
echo 'int main(int argc, char **argv) { return 
(MPFR_VERSION=MPFR_VERSION_NUM(2,3,0))?0:1; }' | \ 
gcc -include mpfr.h -x c -o $(TMP_DIR)/a.out -lmpfr -
endef

$(eval $(call Require,mpfr, \ 
Please install lib mpfr = 2.3.0 \ 
))

endif


Unfortunately, this code cannot be performed by prereq-build.mk because
we don't know if we need gcc4.3 or not.


  
  My self-answer: This error is caused by the LD_LIBRARY_PATH that I
  defined into rule.mk. At this point I need to resolve an issue: GCC4.3
  requires gmp and mpfr libraries. I added the makefile under the
  toolchain directory in order to create the needed libraries (libgmp.so
  and libmpfr.so). I  placed these libraries into the
  staging_dir/host/lib/ directory... but (cross)gcc doesn't start because
  this directory is not in the ld path... I thought to solve this issue
  using the LD_LIBRARY_PATH=$(TOP)/staging_dir/host/lib/ ... but this
  creates the error in tar application
  
  Now, with LD_LIBRARY_PATH env. variable removed, I'm compiling the
  gcc-final... but I will need it when the (cross)gcc is invoked.
  
  question: Where can I place the host libraries (__NOT TARGET__) in order
  to be visible to cross-compiler (and in general, to crosstools)?
 
 Maybe all you need to do is correctly supply the full path to the 
 includes/libraries via C(PP)FLAGS/LDFLAGS in the makefile, or on the command 
 line instead of using LD_LIBRARY_PATH. Another approach would be to 
 statically build/link the tar app inside the openWRT SDK and use the 
 LD_LIBRARY_PATH after all.
 
 HTH,
 
 Hinko
 


I would patch OpenWRT as little as possible, of course. The solution
should be to link statically libgmp and libmpfr to gcc cross-compiler...
but How can I say this to the gcc configure?

Furthermore I chosen to avoid to compile the mpfr and gmp into the
OpenWRT environment... Now I have an error during the gcc-final
regarding ctype_basechar... 

Thanks and Best regards,

luigi


Industrie Dial Face S.p.A.
Luigi Mantellini
RD - Software
Industrie Dial Face S.p.A.
Via Canzo, 4 
20068 Peschiera Borromeo (MI), Italy
Tel.:   +39 02 5167 2813
Fax:+39 02 5167 2459
E-mail: [EMAIL PROTECTED]
GPG fingerprint: 3DD1 7B71 FBDF 6376
1B4A
 B003 175F E979 907E
1650
attachment: idf_logo.gif___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
http://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] GCC4.3 patch (wip)

2008-06-16 Thread Hinko Kocevar
Luigi 'Comio' Mantellini wrote:
 Hi Hinko,
 Hi List,
 
 see my inline comments.
 
 On lun, 2008-06-16 at 10:05 +0200, Hinko Kocevar wrote:
 
 Luigi 'Comio' Mantellini wrote:
 Ciao again,


 On ven, 2008-06-13 at 11:22 +0200, Luigi 'Comio' Mantellini wrote:
 Ciao,
 make[4]: Entering directory 
 `/mnt/devel/openwrt/OpenWRT.git/build_dir/toolchain-m68k_gcc4.3.1/uClibc-0.9.29'
 install -d 
 /mnt/devel/openwrt/OpenWRT.git/staging_dir/toolchain-m68k_gcc4.3.1//lib
 install -m 644 lib/lib*-0.9.29.so \

 /mnt/devel/openwrt/OpenWRT.git/staging_dir/toolchain-m68k_gcc4.3.1//lib
 cd lib  tar -cf - *.so.* | tar -xf - -C 
 /mnt/devel/openwrt/OpenWRT.git/staging_dir/toolchain-m68k_gcc4.3.1//lib
 tar: error while loading shared libraries: libpthread.so.0: ELF file data 
 encoding not little-endian
 tar: error while loading shared libraries: libpthread.so.0: ELF file data 
 encoding not little-endian
 You've seem to remove some some mandatory path in system library search - if 
 your had LD_LIBRARY_PATH set you've might need to do:
 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/your/lib
 in contrast to
 export LD_LIBRARY_PATH=/path/to/your/lib

 
 
 I added the following into $(TOP)/rule.mk (and I don't like what I
 do...):
 
 export LD_LIBRARY_PATH=$(TOP)/staging_dir/host/lib:$(LD_LIBRARY_PATH)
 
 
 Anyway I decided to change approach: install directly on the host
 environment the GMP and MPFR library need to GCC4.3 compiler... OpenWRT
 should make some check to recognize these libraries:
 
 
 ifneq ($(CONFIG_GCC_VERSION_4_3_X),)
 define Require/gmp
 echo 'int main(int argc, char **argv) { return 
 ((__GNU_MP_VERSION*1000+__GNU_MP_VERSION_MINOR)*1000+__GNU_MP_VERSION_PATCHLEVEL)=004001000?0:1;
  }' |
 gcc -include gmp.h -x c -o $(TMP_DIR)/gmptest.o -lgmp 
 -
 endef
 
 $(eval $(call Require,gmp, \ 
 Please install lib gmp = 4.1.0 \ 
 ))
 
 define Require/mpfr
 echo 'int main(int argc, char **argv) { return 
 (MPFR_VERSION=MPFR_VERSION_NUM(2,3,0))?0:1; }' | \ 
 gcc -include mpfr.h -x c -o $(TMP_DIR)/a.out -lmpfr -
 endef
 
 $(eval $(call Require,mpfr, \ 
 Please install lib mpfr = 2.3.0 \ 
 ))
 
 endif
 
 
 Unfortunately, this code cannot be performed by prereq-build.mk because
 we don't know if we need gcc4.3 or not.
 
 
 My self-answer: This error is caused by the LD_LIBRARY_PATH that I
 defined into rule.mk. At this point I need to resolve an issue: GCC4.3
 requires gmp and mpfr libraries. I added the makefile under the
 toolchain directory in order to create the needed libraries (libgmp.so
 and libmpfr.so). I  placed these libraries into the
 staging_dir/host/lib/ directory... but (cross)gcc doesn't start because
 this directory is not in the ld path... I thought to solve this issue
 using the LD_LIBRARY_PATH=$(TOP)/staging_dir/host/lib/ ... but this
 creates the error in tar application

 Now, with LD_LIBRARY_PATH env. variable removed, I'm compiling the
 gcc-final... but I will need it when the (cross)gcc is invoked.

 question: Where can I place the host libraries (__NOT TARGET__) in order
 to be visible to cross-compiler (and in general, to crosstools)?
 Maybe all you need to do is correctly supply the full path to the 
 includes/libraries via C(PP)FLAGS/LDFLAGS in the makefile, or on the command 
 line instead of using LD_LIBRARY_PATH. Another approach would be to 
 statically build/link the tar app inside the openWRT SDK and use the 
 LD_LIBRARY_PATH after all.

 HTH,

 Hinko

 
 
 I would patch OpenWRT as little as possible, of course. The solution
 should be to link statically libgmp and libmpfr to gcc cross-compiler...
 but How can I say this to the gcc configure?
 
 Furthermore I chosen to avoid to compile the mpfr and gmp into the
 OpenWRT environment... Now I have an error during the gcc-final
 regarding ctype_basechar... 
 


I guess you could look at the uclibc buildroot at http://buildroot.uclibc.org/ 
and the way they handle the mpfr/gmp for gcc toolchain.


-- 
ČETRTA POT, d.o.o., Kranj
Planina 3
4000 Kranj
Slovenia, Europe
Tel. +386 (0) 4 280 66 03
E-mail: [EMAIL PROTECTED]
Http: www.cetrtapot.si

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


[OpenWrt-Devel] [patch] (1/3) r6040.c: added debugs, more global procedures

2008-06-16 Thread Joerg Albert
Hi,

this is the first of three patches to fix the ethernet driver of RDC R32xx 
applied to svn r10754.

It adds debugs and make some procedures (r6040_*) global symbols in order to 
help with debugging kernel oops. Version is increased from 0.16 to 0.18 to 
avoid conflicts with the driver variant metioned in the X-WRT forum (call 
0.17.3) Tested on a Sitecom WL-153.

Signed-Off-By: Joerg Albert [EMAIL PROTECTED]

Index: r6040.c
===
--- r6040.c (revision 11401)
+++ r6040.c (working copy)
@@ -50,9 +50,46 @@
 #include asm/processor.h
 
 #define DRV_NAME   r6040
-#define DRV_VERSION0.16
-#define DRV_RELDATE10Nov2007
+#define DRV_VERSION0.18
+#define DRV_RELDATE13Jun2008
 
+/* define bits of a debug mask */
+#define DBG_PHY   (1 0) /*! show PHY read/write */
+#define DBG_FREE_BUFS (1 1) /*! show calls to r6040_free_*bufs */
+#define DBG_RING  (1 2) /*! debug init./freeing of descr rings */
+#define DBG_RX_BUF(1 3) /*! show alloc. of new rx buf (in IRQ 
context !) */
+#define DBG_TX_BUF(1 4) /*! show arrival of new tx buf */
+#define DBG_RX_IRQ(1 5) /*! show RX IRQ handling */
+#define DBG_TX_IRQ(1 6) /*! debug TX done IRQ */
+#define DBG_RX_DESCR  (1 7) /*! debug rx descr to be processed */
+#define DBG_RX_DATA   (1 8) /*! show some user data of incoming packet 
*/
+#define DBG_EXIT  (1 9) /*! show exit code calls */
+#define DBG_INIT  (110) /*! show init. code calls */
+#define DBG_TX_RING_DUMP  (111) /*! dump the tx ring after creation */
+#define DBG_RX_RING_DUMP  (112) /*! dump the rx ring after creation */
+#define DBG_TX_DESCR  (113) /*! dump the setting of a descr for tx */
+#define DBG_TX_DATA   (114) /*! dump some tx data */
+#define DBG_IRQ   (115) /*! print inside the irq handler */
+#define DBG_POLL  (116) /*! dump info on poll procedure */
+#define DBG_MAC_ADDR  (117) /*! debug mac address setting */
+#define DBG_OPEN  (118) /*! debug open proc. */
+
+static int debug = 0;
+module_param(debug, int, 0);
+MODULE_PARM_DESC(debug, debug mask (-1 for all));
+
+/* define wcd hich debugs are left in the code during compilation */
+#define DEBUG (-1) /* all debugs */
+
+#define dbg(l, f, ...) \
+  do { \
+if ((DEBUG  l)  (debug  l)) { \
+  printk(KERN_INFO DRV_NAME  %s:  f, __FUNCTION__, ## __VA_ARGS__); \
+} \
+  } while (0)
+
+#define err(f, ...) printk(KERN_WARNING DRV_NAME  %s:  f, __FUNCTION__, ## 
__VA_ARGS__)
+
 /* PHY CHIP Address */
 #define PHY1_ADDR  1   /* For MAC1 */
 #define PHY2_ADDR  2   /* For MAC2 */
@@ -182,11 +219,43 @@
 
 static int phy_table[] = { PHY1_ADDR, PHY2_ADDR };
 
+/* jal2: comment out to get more symbols for debugging */
+//#define STATIC static
+#define STATIC
+
+#if DEBUG
+/*! hexdump an memory area into a string. delim is taken as the delimiter 
between two bytes.
+It is omitted if delim == '\0' */
+STATIC char *hex2str(void *addr, char *buf, int nr_bytes, int delim)
+{
+   unsigned char *dst = addr;
+   char *outb = buf;
+
+#define BIN2HEXDIGIT(x) ((x)  10 ? '0'+(x) : 'A'-10+(x))
+
+   while (nr_bytes  0) {
+   *outb++ = BIN2HEXDIGIT(*dst4);
+   *outb++ = BIN2HEXDIGIT(*dst0xf);
+   if (delim)
+   *outb++ = delim;
+   nr_bytes--;
+   dst++;
+   }
+
+   if (delim)
+   dst--;
+   *dst = '\0';
+   return buf;
+}
+
+#endif /* #if DEBUG */
+
 /* Read a word data from PHY Chip */
-static int phy_read(void __iomem *ioaddr, int phy_addr, int reg)
+STATIC int phy_read(void __iomem *ioaddr, int phy_addr, int reg)
 {
int limit = 2048;
u16 cmd;
+   int rc;
 
iowrite16(MDIO_READ + reg + (phy_addr  8), ioaddr + MMDIO);
/* Wait for the read bit to be cleared */
@@ -196,15 +265,24 @@
break;
}
 
-   return ioread16(ioaddr + MMRD);
+   if (limit = 0)
+   err(phy addr x%x reg x%x timed out\n,
+   phy_addr, reg);
+
+   rc=ioread16(ioaddr + MMRD);
+
+   dbg(DBG_PHY, phy addr x%x reg x%x val x%x\n, phy_addr, reg, rc);
+   return rc;
 }
 
 /* Write a word data from PHY Chip */
-static void phy_write(void __iomem *ioaddr, int phy_addr, int reg, u16 val)
+STATIC void phy_write(void __iomem *ioaddr, int phy_addr, int reg, u16 val)
 {
int limit = 2048;
u16 cmd;
 
+   dbg(DBG_PHY, phy addr x%x reg x%x val x%x\n, phy_addr, reg, val);
+
iowrite16(val, ioaddr + MMWD);
/* Write the command to the MDIO bus */
iowrite16(MDIO_WRITE + reg + (phy_addr  8), ioaddr + MMDIO);
@@ -214,9 +292,12 @@
if (cmd  MDIO_WRITE)
break;
}
+   if (limit = 0)
+   err(phy addr x%x reg x%x val x%x timed out\n,
+   

[OpenWrt-Devel] [patch] (3/3) r6040.c: fix long delay in outgoing pings

2008-06-16 Thread Joerg Albert
This patch mainly fixes the huge delay when we ping from the RDC device to 
another host (160-230 ms).
r6040_rx() was rewritten.
Further changes:
- fix a bug in hex2str(), which overwrote the source with a zero
- removed rx_free_desc counter; allocate skb inside r6040_rx() on the fly
- r6040_rx: don't take the error from the MLSR register (may be too late) but 
from the
  descriptor (we may have to allow these errors (via MCR0) there
- r6040_alloc_rxbufs() may fail due to lack of skb, added a return value
- changed some debugs
- more defines
- version: 0.18 - 0.19

Signed-Off by Joerg Albert [EMAIL PROTECTED]



--- r6040.c.301 2008-06-12 17:15:45.0 +0200
+++ r6040.c 2008-06-16 12:25:26.0 +0200
@@ -50,35 +50,34 @@
 #include asm/processor.h
 
 #define DRV_NAME   r6040
-#define DRV_VERSION0.18
-#define DRV_RELDATE13Jun2008
+#define DRV_VERSION0.19
+#define DRV_RELDATE16Jun2008
 
 /* define bits of a debug mask */
-#define DBG_PHY   (1 0) /*! show PHY read/write */
-#define DBG_FREE_BUFS (1 1) /*! show calls to r6040_free_*bufs */
-#define DBG_RING  (1 2) /*! debug init./freeing of descr rings */
-#define DBG_RX_BUF(1 3) /*! show alloc. of new rx buf (in IRQ 
context !) */
-#define DBG_TX_BUF(1 4) /*! show arrival of new tx buf */
-#define DBG_RX_IRQ(1 5) /*! show RX IRQ handling */
-#define DBG_TX_IRQ(1 6) /*! debug TX done IRQ */
-#define DBG_RX_DESCR  (1 7) /*! debug rx descr to be processed */
-#define DBG_RX_DATA   (1 8) /*! show some user data of incoming packet 
*/
-#define DBG_EXIT  (1 9) /*! show exit code calls */
-#define DBG_INIT  (110) /*! show init. code calls */
-#define DBG_TX_RING_DUMP  (111) /*! dump the tx ring after creation */
-#define DBG_RX_RING_DUMP  (112) /*! dump the rx ring after creation */
-#define DBG_TX_DESCR  (113) /*! dump the setting of a descr for tx */
-#define DBG_TX_DATA   (114) /*! dump some tx data */
-#define DBG_IRQ   (115) /*! print inside the irq handler */
-#define DBG_POLL  (116) /*! dump info on poll procedure */
-#define DBG_MAC_ADDR  (117) /*! debug mac address setting */
-#define DBG_OPEN  (118) /*! debug open proc. */
+#define DBG_PHY   0x0001 /*! show PHY read/write */
+#define DBG_FREE_BUFS 0x0002 /*! show calls to r6040_free_*bufs */
+#define DBG_RING  0x0004 /*! debug init./freeing of descr rings */
+#define DBG_RX_BUF0x0008 /*! show alloc. of new rx buf (in IRQ 
context !) */
+#define DBG_TX_BUF0x0010 /*! show arrival of new tx buf */
+#define DBG_TX_DONE   0x0020 /*! debug TX done */
+#define DBG_RX_DESCR  0x0040 /*! debug rx descr to be processed */
+#define DBG_RX_DATA   0x0080 /*! show some user data of incoming 
packet */
+#define DBG_EXIT  0x0100 /*! show exit code calls */
+#define DBG_INIT  0x0200 /*! show init. code calls */
+#define DBG_TX_RING_DUMP  0x0400 /*! dump the tx ring after creation */
+#define DBG_RX_RING_DUMP  0x0800 /*! dump the rx ring after creation */
+#define DBG_TX_DESCR  0x1000 /*! dump the setting of a descr for tx */
+#define DBG_TX_DATA   0x2000 /*! dump some tx data */
+#define DBG_IRQ   0x4000 /*! print inside the irq handler */
+#define DBG_POLL  0x8000 /*! dump info on poll procedure */
+#define DBG_MAC_ADDR  0x0001 /*! debug mac address setting */
+#define DBG_OPEN  0x0002 /*! debug open proc. */
 
 static int debug = 0;
 module_param(debug, int, 0);
 MODULE_PARM_DESC(debug, debug mask (-1 for all));
 
-/* define wcd hich debugs are left in the code during compilation */
+/* define which debugs are left in the code during compilation */
 #define DEBUG (-1) /* all debugs */
 
 #define dbg(l, f, ...) \
@@ -207,6 +206,21 @@ struct r6040_descriptor {
u32 rev2;   /* 1C-1F */
 } __attribute__((aligned(32)));
 
+/*! defines for the status field in the r6040_descriptor */
+#define DESC_STATUS_OWNER_MAC   (115) /*! if set the MAC is the owner 
of this descriptor */
+#define DESC_STATUS_RX_OK   (114) /*! rx was successful */
+#define DESC_STATUS_RX_ERR  (111) /*! rx PHY error */
+#define DESC_STATUS_RX_ERR_DRIBBLE  (110) /*! rx dribble packet */
+#define DESC_STATUS_RX_ERR_BUFLEN   (1 9) /*! rx length exceeded buffer 
size */
+#define DESC_STATUS_RX_ERR_LONG (1 8) /*! rx length  maximum packet 
length */
+#define DESC_STATUS_RX_ERR_RUNT (1 7) /*! rx: packet length  64 byte */
+#define DESC_STATUS_RX_ERR_CRC  (1 6) /*! rx: crc error */
+#define DESC_STATUS_RX_BROADCAST(1 5) /*! rx: broadcast (no error) */
+#define DESC_STATUS_RX_MULTICAST(1 4) /*! rx: multicast (no error) */
+#define DESC_STATUS_RX_MCH_HIT  (1 3) /*! rx: multicast hit in hash 
table (no error) */
+#define DESC_STATUS_RX_MIDH_HIT (1 2) /*! rx: 

[OpenWrt-Devel] [PATCH] /sbin/usb-storage now works on NSLU2

2008-06-16 Thread Ross Smith
The original /sbin/usb-storage script didn't work on my NSLU2.

The below patch should be backwards compatible with the original script.

I've tested it thoroughly, and it even works with hotplug, although I
currently have to edit /etc/fstab prior to the hotplug, if the volume is
a different file system then the previous volume that was mounted.

Signed-off-by: Ross Smith openwrtspam at netebb.com

---

Index: usb-storage
===
--- usb-storage (revision 11495)
+++ usb-storage (working copy)
@@ -8,19 +8,34 @@
logger waiting on usb drive $i ...
i=$(($i+1))
cd /sys${DEVPATH}
-   for blk in `find host* -type d 2/dev/null`; do
+   for blk in `find host* -maxdepth 0 -type d 2/dev/null`; do
cd /sys/${DEVPATH}/${blk}
-   BLK=$(find block* -type l 2/dev/null)
+   BLK=$(find . -name 'block*' \( -type l -o -type d \) 
2/dev/null)
[ -n ${BLK} ]  {
cd /sys${DEVPATH}/${blk}/${BLK}
ls /dev/  /tmp/d
sleep 2
for node in `find sd* -type d 2/dev/null| grep -v 
/`; do
-   echo mounting /dev/${node} on /mnt/usbdrive
-   mkdir -p /mnt/usbdrive
-   mount /dev/${node} /mnt/usbdrive
-   exit 0
+   cd /sys${DEVPATH}/${blk}/${BLK}/${node}
+   PARTS=`find ${node}* -type d 2/dev/null | grep 
-v /`
+   if [ -z ${PARTS} ]
+   then
+   echo mounting /dev/${node} on 
/mnt/usbdrive
+   mkdir -p /mnt/usbdrive
+   mount /dev/${node} /mnt/usbdrive
+   exit 0
+   fi
+   for part in ${PARTS}
+   do
+   DEV=/dev/${part}
+   MNT=/mnt/${part}
+   logger mounting ${DEV} on ${MNT}
+   test -d ${MNT} || mkdir -p ${MNT}
+   mount | grep ${MNT}  umount ${DEV}
+   mount ${DEV} ${MNT}
+   done
done
+   exit 0
}
done
sleep 1

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


[OpenWrt-Devel] [PATCH 1/2] Add support for pcspkr module

2008-06-16 Thread Acinonyx
Signed-off-by: Vasilis Tsiligiannis [EMAIL PROTECTED]
---
 trunk/package/kernel/modules/other.mk |   17 +
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/trunk/package/kernel/modules/other.mk 
b/trunk/package/kernel/modules/other.mk
index a096552..5f0316f 100644
--- a/trunk/package/kernel/modules/other.mk
+++ b/trunk/package/kernel/modules/other.mk
@@ -71,6 +71,23 @@ endef
 
 $(eval $(call KernelPackage,lp))
 
+define KernelPackage/pcspkr
+  SUBMENU:=$(OTHER_MENU)
+  TITLE:=PC speaker support
+  DEPENDS:[EMAIL PROTECTED]
+  KCONFIG:=CONFIG_INPUT_PCSPKR
+  FILES:= \
+   $(LINUX_DIR)/drivers/input/misc/pcspkr.$(LINUX_KMOD_SUFFIX)
+  AUTOLOAD:=$(call AutoLoad,50, \
+   pcspkr \
+  )
+endef
+
+define KernelPackage/pcspkr/description
+ This enables sounds (tones) through the pc speaker
+endef
+
+$(eval $(call KernelPackage,pcspkr))
 
 define KernelPackage/pcmcia-core
   SUBMENU:=$(OTHER_MENU)
-- 
1.5.4.3

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


[OpenWrt-Devel] [PATCH] Fix aes_i586 module dependency to aes_generic for x86 target

2008-06-16 Thread Acinonyx
Signed-off-by: Vasilis Tsiligiannis [EMAIL PROTECTED]
---
 trunk/package/kernel/modules/crypto.mk |   13 +++--
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/trunk/package/kernel/modules/crypto.mk 
b/trunk/package/kernel/modules/crypto.mk
index 68ccb60..e33ee6e 100644
--- a/trunk/package/kernel/modules/crypto.mk
+++ b/trunk/package/kernel/modules/crypto.mk
@@ -69,17 +69,18 @@ define KernelPackage/crypto-aes
   SUBMENU:=$(CRYPTO_MENU)
   TITLE:=AES cipher CryptoAPI module
   DEPENDS:=+kmod-crypto-core
-  KCONFIG:= \
-   CONFIG_CRYPTO_AES \
-   CONFIG_CRYPTO_AES_586
+  KCONFIG:= CONFIG_CRYPTO_AES
   FILES:=$(LINUX_DIR)/crypto/aes$(CRYPTO_GENERIC).$(LINUX_KMOD_SUFFIX)
   AUTOLOAD:=$(call AutoLoad,09,aes$(CRYPTO_GENERIC))
 endef
 
 define KernelPackage/crypto-aes/x86-2.6
-  KCONFIG:=CONFIG_CRYPTO_AES_586
-  FILES:=$(LINUX_DIR)/arch/x86/crypto/aes-i586.$(LINUX_KMOD_SUFFIX)
-  AUTOLOAD:=$(call AutoLoad,09,aes-i586)
+  KCONFIG+=CONFIG_CRYPTO_AES_586
+  FILES+=$(LINUX_DIR)/arch/x86/crypto/aes-i586.$(LINUX_KMOD_SUFFIX)
+  AUTOLOAD:=$(call AutoLoad,09, \
+   aes$(CRYPTO_GENERIC) \
+   aes-i586 \
+  )
 endef
 
 $(eval $(call KernelPackage,crypto-aes))
-- 
1.5.4.3


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


[OpenWrt-Devel] [PATCH 2/2] Enable misc input devices support to linux kernel

2008-06-16 Thread Acinonyx
Signed-off-by: Vasilis Tsiligiannis [EMAIL PROTECTED]
---
 trunk/target/linux/generic-2.6/config-2.6.22  |2 +-
 trunk/target/linux/generic-2.6/config-2.6.23  |2 +-
 trunk/target/linux/generic-2.6/config-2.6.24  |2 +-
 trunk/target/linux/generic-2.6/config-2.6.25  |2 +-
 trunk/target/linux/generic-2.6/config-2.6.26  |2 +-
 trunk/target/linux/generic-2.6/config-default |2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/trunk/target/linux/generic-2.6/config-2.6.22 
b/trunk/target/linux/generic-2.6/config-2.6.22
index a09e0af..fb66806 100644
--- a/trunk/target/linux/generic-2.6/config-2.6.22
+++ b/trunk/target/linux/generic-2.6/config-2.6.22
@@ -474,7 +474,7 @@ CONFIG_INPUT_EVDEV=m
 # CONFIG_INPUT_JOYSTICK is not set
 # CONFIG_INPUT_KEYBOARD is not set
 # CONFIG_INPUT_KEYSPAN_REMOTE is not set
-# CONFIG_INPUT_MISC is not set
+CONFIG_INPUT_MISC=y 
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_INPUT_MOUSEDEV is not set
 # CONFIG_INPUT_PCSPKR is not set
diff --git a/trunk/target/linux/generic-2.6/config-2.6.23 
b/trunk/target/linux/generic-2.6/config-2.6.23
index b2860f9..d8d78f8 100644
--- a/trunk/target/linux/generic-2.6/config-2.6.23
+++ b/trunk/target/linux/generic-2.6/config-2.6.23
@@ -485,7 +485,7 @@ CONFIG_INPUT_EVDEV=m
 # CONFIG_INPUT_JOYSTICK is not set
 # CONFIG_INPUT_KEYBOARD is not set
 # CONFIG_INPUT_KEYSPAN_REMOTE is not set
-# CONFIG_INPUT_MISC is not set
+CONFIG_INPUT_MISC=y
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_INPUT_MOUSEDEV is not set
 # CONFIG_INPUT_PCSPKR is not set
diff --git a/trunk/target/linux/generic-2.6/config-2.6.24 
b/trunk/target/linux/generic-2.6/config-2.6.24
index 579df9f..ff1440c 100644
--- a/trunk/target/linux/generic-2.6/config-2.6.24
+++ b/trunk/target/linux/generic-2.6/config-2.6.24
@@ -500,7 +500,7 @@ CONFIG_INPUT_EVDEV=m
 # CONFIG_INPUT_JOYSTICK is not set
 # CONFIG_INPUT_KEYBOARD is not set
 # CONFIG_INPUT_KEYSPAN_REMOTE is not set
-# CONFIG_INPUT_MISC is not set
+CONFIG_INPUT_MISC=y
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_INPUT_MOUSEDEV is not set
 # CONFIG_INPUT_PCSPKR is not set
diff --git a/trunk/target/linux/generic-2.6/config-2.6.25 
b/trunk/target/linux/generic-2.6/config-2.6.25
index 6773e20..2210b3e 100644
--- a/trunk/target/linux/generic-2.6/config-2.6.25
+++ b/trunk/target/linux/generic-2.6/config-2.6.25
@@ -511,7 +511,7 @@ CONFIG_INPUT_EVDEV=m
 # CONFIG_INPUT_JOYSTICK is not set
 # CONFIG_INPUT_KEYBOARD is not set
 # CONFIG_INPUT_KEYSPAN_REMOTE is not set
-# CONFIG_INPUT_MISC is not set
+CONFIG_INPUT_MISC=y
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_INPUT_MOUSEDEV is not set
 # CONFIG_INPUT_PCSPKR is not set
diff --git a/trunk/target/linux/generic-2.6/config-2.6.26 
b/trunk/target/linux/generic-2.6/config-2.6.26
index 5f3bc76..0c91057 100644
--- a/trunk/target/linux/generic-2.6/config-2.6.26
+++ b/trunk/target/linux/generic-2.6/config-2.6.26
@@ -511,7 +511,7 @@ CONFIG_INPUT_EVDEV=m
 # CONFIG_INPUT_JOYSTICK is not set
 # CONFIG_INPUT_KEYBOARD is not set
 # CONFIG_INPUT_KEYSPAN_REMOTE is not set
-# CONFIG_INPUT_MISC is not set
+CONFIG_INPUT_MISC=y
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_INPUT_MOUSEDEV is not set
 # CONFIG_INPUT_PCSPKR is not set
diff --git a/trunk/target/linux/generic-2.6/config-default 
b/trunk/target/linux/generic-2.6/config-default
index cbef536..395bf9b 100644
--- a/trunk/target/linux/generic-2.6/config-default
+++ b/trunk/target/linux/generic-2.6/config-default
@@ -444,7 +444,7 @@ CONFIG_INPUT_EVDEV=m
 # CONFIG_INPUT_JOYSTICK is not set
 # CONFIG_INPUT_KEYBOARD is not set
 # CONFIG_INPUT_KEYSPAN_REMOTE is not set
-# CONFIG_INPUT_MISC is not set
+CONFIG_INPUT_MISC=y
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_INPUT_MOUSEDEV is not set
 # CONFIG_INPUT_PCSPKR is not set
-- 
1.5.4.3

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


[OpenWrt-Devel] [PATCH] Exit post-install script successfully when PCI IDs update fails

2008-06-16 Thread Acinonyx
Signed-off-by: Vasilis Tsiligiannis [EMAIL PROTECTED]
---
 packages/utils/pciutils/Makefile |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/packages/utils/pciutils/Makefile b/packages/utils/pciutils/Makefile
index d20f2f5..8b5c344 100644
--- a/packages/utils/pciutils/Makefile
+++ b/packages/utils/pciutils/Makefile
@@ -34,6 +34,7 @@ endef
 define Package/pciutils/postinst
 #!/bin/sh
 $${IPKG_INSTROOT}/usr/sbin/update-pciids.sh
+exit 0
 endef
 
 MAKE_FLAGS += \
-- 
1.5.4.3

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


Re: [OpenWrt-Devel] Empty directories problem - package/uci Patch

2008-06-16 Thread Yuji Mano
Yuji Mano wrote:
 Yuji Mano wrote:
 Yuji Mano wrote:
 Hi.
 
 I checkout from the git repository but noticed it doesn't pull down empty 
 directories (trunk/package/base-files/files/etc/uci-defaults).
 This wasn't a problem for me until I set CONFIG_UCI_PRECONFIG.
 The build expects the '/etc/uci-defaults' to exist in the root fs and 
 otherwise causes errors:
 
 make[3]: Entering directory `/home/ymano/openwrt/trunk'
 ( \
 echo uci set 'network.lan.dns='; \
 echo uci set 'network.lan.proto=dhcp'; \
 echo uci set 'network.lan.gateway='; \
 echo uci set 'network.lan.netmask=255.255.255.0'; \
 echo uci set 'network.lan.ipaddr=192.168.1.1'; \
  \
 )  
 /home/ymano/openwrt/trunk/build_dir/powerpc/root-ps3/etc/uci-defaults/base-files
 --: line 7: 
 /home/ymano/openwrt/trunk/build_dir/powerpc/root-ps3/etc/uci-defaults/base-files:
  No such file or directory
 make[3]: *** 
 [/home/ymano/openwrt/trunk/build_dir/powerpc/root-ps3/etc/uci-defaults/base-files]
  Error 1
 make[3]: Leaving directory `/home/ymano/openwrt/trunk'
 make[2]: [package/rootfs-prepare] Error 2 (ignored)
 
 The build otherwise continues on without really letting me know that 
 something has gone horribly wrong, leaving me confused during runtime why 
 my proto is set to 'static' even though I swore I set it to 'dhcp'... 
 should the build stop on such an error?
 
 Can we either add dummy files to empty directories in the repository so git 
 will properly pull them down?
 Or can we make sure the build creates necessary directories?
 
 Bumping my previous post.
 Am I the only one using git and having this problem?
 
 Can we at least fix package uci to create the necessary directory at build 
 time?
 
 The more I think about it the more I think it makes no sense to have the 
 empty directory (trunk/package/base-files/files/etc/uci-defaults).
 Package uci should create the directory during package install unless there 
 is some other package that depends on it,
 in which case that package should create the directory as well during install.
 
 The patch below fixes the package uci build.
 Also 'trunk/package/base-files/files/etc/uci-defaults/' should be removed 
 from the repository.
 
 Regards,
 Yuji
 
 ---
  package/uci/Makefile |1 +
  1 file changed, 1 insertion(+)
 
 --- a/package/uci/Makefile
 +++ b/package/uci/Makefile
 @@ -78,6 +78,7 @@ define Package/libuci-lua/install
  endef
 
  define Package/uci/install
 +   $(INSTALL_DIR) $(1)/etc/uci-defaults
 $(INSTALL_DIR) $(1)/sbin
 $(INSTALL_BIN) $(PKG_BUILD_DIR)/uci $(1)/sbin/
 $(CP) ./files/uci/* $(1)/

Still no comments regarding this patch...
Can somebody comment or commit the patch?

- Yuji


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


Re: [OpenWrt-Devel] [PATCH][trunk/package/busybox/patches] - udhcpc request rootpath option

2008-06-16 Thread Yuji Mano
Yuji Mano wrote:
 This adds a patch for busybox for udhcpc to request the rootpath option from
 dhcp server.
 
 Signed-off-by: Yuji Mano [EMAIL PROTECTED]
 
 ---
  package/busybox/patches/244-udhcpc_request_rootpath.patch |   19 
 ++
  1 file changed, 19 insertions(+)
 
 --- /dev/null
 +++ b/package/busybox/patches/244-udhcpc_request_rootpath.patch
 @@ -0,0 +1,19 @@
 +This patches udhcpc to request the rootpath option from dhcp server.
 +
 +Signed-off-by: Yuji Mano [EMAIL PROTECTED]
 +
 +---
 + networking/udhcp/options.c |2 +-
 + 1 file changed, 1 insertion(+), 1 deletion(-)
 +
 +--- a/networking/udhcp/options.c
  b/networking/udhcp/options.c
 +@@ -25,7 +25,7 @@ const struct dhcp_option dhcp_options[]
 + {bootsize,OPTION_U16, 0x0d},
 + {domain,  OPTION_STRING | OPTION_LIST | OPTION_REQ, 0x0f},
 + {swapsvr, OPTION_IP,  0x10},
 +-{rootpath,OPTION_STRING,  0x11},
 ++{rootpath,OPTION_STRING | OPTION_REQ, 0x11},
 + {ipttl,   OPTION_U8,  0x17},
 + {mtu, OPTION_U16, 0x1a},
 + {broadcast,   OPTION_IP | OPTION_REQ, 0x1c},

It's been awhile since I posted this patch.
Are there any comments or objections to it?
Will someone commit this patch?

- Yuji



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


[OpenWrt-Devel] nousepeerdns ppp uci option

2008-06-16 Thread Brian J. Murrell
Here's a patch to force not using the ppp peer's DNS servers.

Signed-off-by:  Brian J. Murrell [EMAIL PROTECTED];

Index: package/ppp/files/ppp.sh
===
--- package/ppp/files/ppp.sh(revision 11518)
+++ package/ppp/files/ppp.sh(working copy)
@@ -35,7 +35,10 @@
config_get pppd_options $cfg pppd_options
config_get_bool defaultroute $cfg defaultroute 1
[ $defaultroute -eq 1 ]  defaultroute=defaultroute 
replacedefaultroute || defaultroute=
+   config_get_bool nousepeerdns $cfg nousepeerdns 1
+[ $nousepeerdns -eq 1 ]  usepeerdns= || usepeerdns=usepeerdns
 
+
interval=${keepalive##*[, ]}
[ $interval != $keepalive ] || interval=5
 



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


[OpenWrt-Devel] nousepeerdns option for DHCP interfaces

2008-06-16 Thread Brian J. Murrell
Here's a patch to enable not using the DHCP server assigned DNS servers
via a UCI option.

Signed-off-by:  Brian J. Murrell [EMAIL PROTECTED]

Index: package/base-files/files/usr/share/udhcpc/default.script
===
--- package/base-files/files/usr/share/udhcpc/default.script(revision 11518)
+++ package/base-files/files/usr/share/udhcpc/default.script(working copy)
@@ -14,6 +14,18 @@
config_get proto $ifc proto
[ $proto = dhcp ] || continue
[ ifup = $1 ]  {
+config_get_bool nousepeerdns $ifc nousepeerdns 0
+[ $nousepeerdns -eq 0 ]  {
+[ -n $dns ]  {
+echo -n  ${RESOLV_CONF}.tmp
+${domain:+echo search $domain}  
${RESOLV_CONF}.tmp
+for i in $dns ; do
+echo adding dns $i
+echo nameserver $i  
${RESOLV_CONF}.tmp
+done
+mv ${RESOLV_CONF}.tmp $RESOLV_CONF
+}
+}
uci_set_state network $ifc ipaddr $ip
uci_set_state network $ifc netmask 
${subnet:-255.255.255.0}
uci_set_state network $ifc dnsdomain $domain
@@ -46,16 +58,6 @@
$(route -n | awk '/^0.0.0.0\W{9}('$valid')\W/ {next} 
/^0.0.0.0/ {print route del -net $1 gw $2;}')
}

-   [ -n $dns ]  {
-   echo -n  ${RESOLV_CONF}.tmp
-   ${domain:+echo search $domain}  ${RESOLV_CONF}.tmp
-   for i in $dns ; do
-   echo adding dns $i
-   echo nameserver $i  ${RESOLV_CONF}.tmp
-   done
-   mv ${RESOLV_CONF}.tmp $RESOLV_CONF
-   }
-   
hotplug_event ifup

# user rules



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


[OpenWrt-Devel] new hotplug.d/iface script for adding /etc/hosts entries.

2008-06-16 Thread Brian J. Murrell
Here's a new hotplug script I created in hotplug.d/iface/01-hosts that
I'd like to propose for addition to the standard hotplug scripts.

The result of that script after a reboot of my router is:

root at gw:~# cat /etc/hosts
127.0.0.1 localhost.
10.75.22.254lan
33.1.73.242 wan1
167.9.10.202wan0

The idea is to populate a local host entry for each interface and it's
address so that configuration files which want a hostname can get one
before any DDNS is updated with new addresses, etc.

Signed-off-by:  Brian J. Murrell [EMAIL PROTECTED]

--- /dev/null   2008-04-20 11:31:37.0 -0400
+++ package/base-files/files/etc/hotplug.d/iface/01-hosts   2008-06-06 
13:00:18.0 -0400
@@ -0,0 +1,36 @@
+config_load network
+config_get ifname $INTERFACE ifname
+
+config_load /var/state/network
+
+# standard hosts file already has a loopback/localhost entry
+[ $INTERFACE = loopback ]  exit 0
+
+# need to wait for others to be done
+n=0
+while [ -f /tmp/edit_hosts -a $n -lt 5 ]; do
+   sleep 1
+   let n=n+1
+done
+
+[ -f /tmp/edit_hosts ]  {
+   logger Unable to update /etc/hosts due to lock file /tmp/edit_hosts 
being present for more than 5 seconds
+   exit 0
+}
+
+# tell others we are working
+echo $$  /tmp/edit_hosts
+
+[ ifup = $ACTION ]  {
+   config_get addr $INTERFACE ipaddr
+
+   [ -n $addr ]  \
+   sed -i -e /^.* $INTERFACE$/d -e \$a$addr $INTERFACE 
/etc/hosts
+}
+
+[ ifdown = $ACTION ]  {
+   sed -i -e /^.* $INTERFACE$/d /etc/hosts
+}
+
+rm -f /tmp/edit_hosts
+



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