[OpenWrt-Devel] [PATCH][uci] Fix uci show sections and options

2008-06-27 Thread Frédéric Moulins
This patch fixes uci when showing only sections or options.

The patch applies to OpenWrt and add a patch in package/uci/patches.

I send it here because I couldn't send it to nbd.

 Please note that currently 'uci show config.section' is broken, so it
 is not fully functionnal with the current trunk. I sent a patch for
 uci to nbd concerning this issue. 
 As it is, it will just ignore parameters but still load modules.

Best regards,

Signed-off-by: Frédéric Moulins [EMAIL PROTECTED]

diff --git a/package/uci/patches/100-fix_show_sections.patch 
b/package/uci/patches/100-fix_show_sections.patch
new file mode 100644
--- /dev/null
+++ b/package/uci/patches/100-fix_show_sections.patch
@@ -0,0 +1,78 @@
+===
+--- uci-0.4.3.orig/cli.c   2008-06-13 13:39:05.0 +0200
 uci-0.4.3/cli.c2008-06-13 17:17:29.0 +0200
+@@ -91,6 +91,15 @@
+   uci_perror(ctx, appname);
+ }
+ 
++static void uci_show_option(struct uci_option *o)
++{
++  printf(%s.%s.%s=%s\n,
++  o-section-package-e.name,
++  o-section-e.name,
++  o-e.name,
++  o-value);
++}
++
+ static void uci_show_section(struct uci_section *p)
+ {
+   struct uci_element *e;
+@@ -100,7 +109,7 @@
+   sname = p-e.name;
+   printf(%s.%s=%s\n, cname, sname, p-type);
+   uci_foreach_element(p-options, e) {
+-  printf(%s.%s.%s=%s\n, cname, sname, e-name, 
uci_to_option(e)-value);
++  uci_show_option(uci_to_option(e));
+   }
+ }
+ 
+@@ -131,11 +140,21 @@
+   }
+ }
+ 
+-static int package_cmd(int cmd, char *package)
++static int package_cmd(int cmd, char *tuple)
+ {
+   struct uci_package *p = NULL;
++  struct uci_element *e = NULL;
++  char *package = NULL;
++  char *section = NULL;
++  char *option = NULL;
++  char **ptr = NULL;
+   int ret;
+ 
++  if (uci_parse_tuple(ctx, tuple, package, section, option, ptr) != 
UCI_OK)
++  return 1;
++  if (section  !section[0])
++  return 1;
++
+   ret = uci_load(ctx, package, p);
+ 
+   if (ret != UCI_OK) {
+@@ -158,7 +177,24 @@
+   uci_export(ctx, stdout, p, true);
+   break;
+   case CMD_SHOW:
+-  uci_show_package(p);
++  if (!section) {
++  uci_show_package(p);
++  return 0;
++  }
++  if (uci_lookup(ctx, e, p, section, option) != UCI_OK)
++  return 1;
++
++  switch(e-type) {
++  case UCI_TYPE_SECTION:
++  uci_show_section(uci_to_section(e));
++  break;
++  case UCI_TYPE_OPTION:
++  uci_show_option(uci_to_option(e));
++  break;
++  default:
++  /* should not happen */
++  return 1;
++  }
+   break;
+   }
+ 
+
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
http://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/1] Initial support for multi-libc. - Proof of Concept -

2008-06-27 Thread Luigi 'Comio' Mantellini
---
 include/host-build.mk|1 +
 package/base-files/Makefile  |2 +-
 package/kexec-tools/Makefile |2 +-
 rules.mk |4 ++--
 toolchain/Config.in  |   13 +
 toolchain/Config.version |   15 +++
 toolchain/Makefile   |4 
 toolchain/binutils/Makefile  |2 +-
 toolchain/gcc/Makefile   |8 ++--
 toolchain/uClibc/Config.in   |4 ++--
 toolchain/uClibc/Makefile|2 +-
 11 files changed, 47 insertions(+), 10 deletions(-)
 create mode 100644 toolchain/Config.version

diff --git a/include/host-build.mk b/include/host-build.mk
index 8a8d6de..7b3356d 100644
--- a/include/host-build.mk
+++ b/include/host-build.mk
@@ -82,6 +82,7 @@ define Download/default
   FILE:=$(PKG_SOURCE)
   URL:=$(PKG_SOURCE_URL)
   PROTO:=$(PKG_SOURCE_PROTO)
+  SUBDIR:=$(PKG_SOURCE_SUBDIR)
   VERSION:=$(PKG_SOURCE_VERSION)
   MD5SUM:=$(PKG_MD5SUM)
 endef
diff --git a/package/base-files/Makefile b/package/base-files/Makefile
index bec33c8..17422c4 100644
--- a/package/base-files/Makefile
+++ b/package/base-files/Makefile
@@ -88,7 +88,7 @@ endef
 define Package/uclibc/Default
   SECTION:=libs
   CATEGORY:=Base system
-  DEPENDS:[EMAIL PROTECTED]
+  DEPENDS:[EMAIL PROTECTED]@USE_UCLIBC
   URL:=http://uclibc.org/
   VERSION:=$(UCLIBC_VERSION)$(UCLIBC_PATCHVER)-$(PKG_RELEASE)
 endef
diff --git a/package/kexec-tools/Makefile b/package/kexec-tools/Makefile
index 951d41a..34def60 100644
--- a/package/kexec-tools/Makefile
+++ b/package/kexec-tools/Makefile
@@ -37,7 +37,7 @@ define Package/kexec-tools/config
 endef
 
 CONFIGURE_ARGS = \
-   --target=$(CONFIG_KEXEC_TOOLS_TARGET_NAME)-linux-uclibc \
+   
--target=$(CONFIG_KEXEC_TOOLS_TARGET_NAME)-linux-$(CONFIG_TARGET_SUFFIX) \
--host=$(GNU_TARGET_NAME)-uclibc \
--build=$(GNU_HOST_NAME) \
--program-prefix= \
diff --git a/rules.mk b/rules.mk
index 7153a04..a86d8f5 100644
--- a/rules.mk
+++ b/rules.mk
@@ -57,9 +57,9 @@ IPKG_STATE_DIR:=$(TARGET_DIR)/usr/lib/ipkg
 
 ifeq ($(CONFIG_NATIVE_TOOLCHAIN),)
   -include $(TOOLCHAIN_DIR)/info.mk
-  REAL_GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux-uclibc$(if 
$(CONFIG_EABI_SUPPORT),gnueabi)
+  REAL_GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux-$(CONFIG_TARGET_SUFFIX)$(if 
$(CONFIG_EABI_SUPPORT),gnueabi)
   GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux
-  TARGET_CROSS:=$(if 
$(TARGET_CROSS),$(TARGET_CROSS),$(OPTIMIZE_FOR_CPU)-linux-uclibc$(if 
$(CONFIG_EABI_SUPPORT),gnueabi)-)
+  TARGET_CROSS:=$(if 
$(TARGET_CROSS),$(TARGET_CROSS),$(OPTIMIZE_FOR_CPU)-linux-$(CONFIG_TARGET_SUFFIX)$(if
 $(CONFIG_EABI_SUPPORT),gnueabi)-)
 endif
 
 
TARGET_PATH:=$(TOOLCHAIN_DIR)/bin:$(STAGING_DIR_HOST)/bin:$(STAGING_DIR)/host/bin:$(PATH)
diff --git a/toolchain/Config.in b/toolchain/Config.in
index 1a465f5..6ecddf4 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -41,6 +41,18 @@ menuconfig EXTRA_TARGET_ARCH
 
 source toolchain/binutils/Config.in
 source toolchain/gcc/Config.in
+
+choice
+   prompt LIBC implementation if TOOLCHAINOPTS
+   default USE_UCLIBC
+   help
+   Select the LIBC implementation between uClibc and... uClibc.
+
+config USE_UCLIBC
+   bool Use uClibC
+endchoice
+
+
 source toolchain/uClibc/Config.in
 
 config GDB
@@ -92,3 +104,4 @@ config TARGET_OPTIMIZATION
 
 source toolchain/gcc/Config.version
 source toolchain/uClibc/Config.version
+source toolchain/Config.version
diff --git a/toolchain/Config.version b/toolchain/Config.version
new file mode 100644
index 000..19d3eab
--- /dev/null
+++ b/toolchain/Config.version
@@ -0,0 +1,15 @@
+config USE_UCLIBC
+bool
+default y if !TOOLCHAINOPTS
+
+config TARGET_SUFFIX
+string
+default uclibcif USE_UCLIBC
+default gnu   if USE_EGLIBC || USE_GLIBC
+default uclibc
+
+config LIBC_IMPLEMENTATION
+   string
+   default UCLIBCif USE_UCLIBC
+   default EGLIBCif USE_EGLIBC
+   default GLIBC if USE_GLIBC
diff --git a/toolchain/Makefile b/toolchain/Makefile
index 4afcc43..8d0f91b 100644
--- a/toolchain/Makefile
+++ b/toolchain/Makefile
@@ -9,11 +9,14 @@
 curdir:=toolchain
 
 # subdirectories to descend into
+ifeq ($(CONFIG_USE_UCLIBC),y)
 $(curdir)/builddirs := kernel-headers $(if $(CONFIG_GDB),gdb) $(if 
$(CONFIG_NATIVE_TOOLCHAIN),,binutils gcc uClibc)
+endif
 $(curdir)/builddirs-compile:=. $(filter-out 
kernel-headers,$($(curdir)/builddirs))
 $(curdir)/builddirs-install:=$($(curdir)/builddirs-compile)
 
 # builddir dependencies
+ifeq ($(CONFIG_USE_UCLIBC),y)
 $(curdir)/uClibc/prepare:=$(curdir)/kernel-headers/prepare
 ifeq ($(CONFIG_NATIVE_TOOLCHAIN),)
   $(curdir)/binutils/prepare:=$(curdir)/uClibc/prepare
@@ -22,6 +25,7 @@ ifeq ($(CONFIG_NATIVE_TOOLCHAIN),)
   $(curdir)/gcc/install:=$(curdir)/uClibc/compile
   $(curdir)/uClibc/install:=$(curdir)/gcc/install
 endif
+endif
 
 ifneq ($(ARCH),)
   

Re: [OpenWrt-Devel] [PATCH][packages] Convert snmpd init to uci

2008-06-27 Thread John Crispin
applied, thanks


Frédéric Moulins wrote:
 This patch allows to configure snmpd communities and access from uci.
 
 The standard '/etc/snmp/snmpd.conf' becomes a symbolic link to
 '/var/run/snmpd.conf' where the configuration is generated at boot time.
 
 The config file included reflects the standard snmpd default
 configuration.
 
 
 Signed-off-by: Frédéric Moulins [EMAIL PROTECTED]
 
 Index: libs/net-snmp/files/snmpd.init
 ===
 --- libs/net-snmp/files/snmpd.init(révision 11569)
 +++ libs/net-snmp/files/snmpd.init(copie de travail)
 @@ -1,5 +1,5 @@
  #!/bin/sh /etc/rc.common
 -# Copyright (C) 2006 OpenWrt.org
 +# Copyright (C) 2008 OpenWrt.org
  START=50
  
  DEFAULT=/etc/default/snmpd
 @@ -7,17 +7,93 @@
  LOG_D=/var/log
  RUN_D=/var/run
  PID_F=$RUN_D/snmpd.pid
 +RUN_C=$RUN_D/snmpd.conf
  
 -
 +snmpd_com2sec_add() {
 + local cfg=$1
 + config_get secname $cfg secname
 + [ -n $secname ] || return 0
 + config_get source $cfg source
 + [ -n $source ] || return 0
 + config_get community $cfg community
 + [ -n $community ] || return 0
 + echo com2sec $secname $source $community  $RUN_C
 +}
 +snmpd_group_add() {
 + local cfg=$1
 + config_get group $cfg group
 + [ -n $group ] || return 0
 + config_get version $cfg version
 + [ -n $version ] || return 0
 + config_get secname $cfg secname
 + [ -n $secname ] || return 0
 + echo group $group $version $secname  $RUN_C
 +}
 +snmpd_view_add() {
 + local cfg=$1
 + config_get viewname $cfg viewname
 + [ -n $viewname ] || return 0
 + config_get type $cfg type
 + [ -n $type ] || return 0
 + config_get oid $cfg oid
 + [ -n $oid ] || return 0
 + # optional mask
 + config_get mask $cfg mask
 + echo view $viewname $type $oid $mask  $RUN_C
 +}
 +snmpd_access_add() {
 + local cfg=$1
 + config_get group $cfg group
 + [ -n $group ] || return 0
 + config_get context $cfg context
 + [ -n $context ] || return 0
 + [ $context == none ]  context=''
 + config_get version $cfg version
 + [ -n $version ] || return 0
 + config_get level $cfg level
 + [ -n $level ] || return 0
 + config_get prefix $cfg prefix
 + [ -n $prefix ] || return 0
 + config_get read $cfg read
 + [ -n $read ] || return 0
 + config_get write $cfg write
 + [ -n $write ] || return 0
 + config_get notify $cfg notify
 + [ -n $notify ] || return 0
 + echo access $group $context $version $level $prefix $read $write 
 $notify  $RUN_C
 +}
 +snmpd_pass_add() {
 + local cfg=$1
 + local pass='pass'
 + 
 + config_get miboid $cfg miboid
 + [ -n $miboid ] || return 0
 + config_get prog $cfg prog
 + [ -n $prog ] || return 0
 + config_get_bool persist $cfg persist 0
 + [ $persist -ne 0 ]  pass='pass_persist'
 + config_get priority $cfg priority
 + priority=${priority:+-p $priority}
 + echo $pass $priority $miboid $prog  $RUN_C
 +}
  start() {
 - [ -f $DEFAULT ]  . $DEFAULT
   [ -d $LIB_D ] || mkdir -p $LIB_D
   [ -d $LOG_D ] || mkdir -p $LOG_D
   [ -d $RUN_D ] || mkdir -p $RUN_D
 - snmpd $OPTIONS
 + [ -f $RUN_C ]  rm -f $RUN_C
 + 
 + config_load snmpd
 + 
 + config_foreach snmpd_com2sec_add com2sec
 + config_foreach snmpd_group_add group
 + config_foreach snmpd_view_add view
 + config_foreach snmpd_access_add access
 + config_foreach snmpd_pass_add pass
 +
 + [ -f $DEFAULT ]  . $DEFAULT
 + $DEBUG /usr/sbin/snmpd $OPTIONS
  }
 -
  stop() {
   [ -f $PID_F ]  kill $(cat $PID_F)
 + [ -f $RUN_C ]  rm -f $RUN_C
  }
 -
 Index: libs/net-snmp/files/snmpd.conf
 ===
 --- libs/net-snmp/files/snmpd.conf(révision 11569)
 +++ libs/net-snmp/files/snmpd.conf(copie de travail)
 @@ -1,14 +1,64 @@
 -com2sec  ro  defaultpublic
 -com2sec  rw  localhost  private
 +config com2sec public
 + option secname ro
 + option source default
 + option community public
  
 -group  public   v1   ro
 -group  public   v2c  ro
 -group  public   usm  ro
 -group  private  v1   rw
 -group  private  v2c  rw
 -group  private  usm  rw
 +config com2sec private
 + option secname rw
 + option source localhost
 + option community private
  
 -view  all  included  .1
 +config group public_v1
 + option group public
 + option version v1
 + option secname ro
  
 -access  public any  noauth  exact  all  none  none
 -access  privateany  noauth  exact  all  all   all
 +config group public_v2c
 + option group public
 + option version v2c
 + option secname ro
 +
 +config group public_usm
 + option group public
 + option version usm
 + option secname ro
 +
 +config group private_v1
 + option group private
 + option version v1
 + option secname rw
 +
 +config group 

[OpenWrt-Devel] WIP-Day late start

2008-06-27 Thread Gregers Petersen
Due to family related transportation of children to holiday destination 
tomorrows WIP-Day will not have it's official opening until UTC 14:00.

Chz

-- 
Gregers Petersen
People-stuff, layer 8 and anthropology
glp on irc

   ___ __
  |   |.-.-.-.|  |  |  |..|  |_
  |   -   ||  _  |  -__| ||  |  |  ||   _||   _|
  |___||   __|_|__|__||||__|  ||
   |__| W I R E L E S S   F R E E D O M
  KAMIKAZE (bleeding edge) ---
   * 10 oz Vodka   Shake well with ice and strain
   * 10 oz Triple sec  mixture into 10 shot glasses.
   * 10 oz lime juice  Salute!
  ---

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


[OpenWrt-Devel] git server down?

2008-06-27 Thread Geoff Levand
Has the git server been moved?

nslookup gives me this:

  Host nbd.name not found: 3(NXDOMAIN)

-Geoff

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


[OpenWrt-Devel] 2.6 kernel and b43 driver

2008-06-27 Thread Stefan Monnier

I'm trying to use my WL-700gE's wifi card with the b43 driver but bumped
into the problem reported at https://dev.openwrt.org/ticket/3510.

This is with revision 11579 of the svn trunk.

Is there something I can do to try and help resolve this problem?


Stefan

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


[OpenWrt-Devel] Booting from USB or some other drive

2008-06-27 Thread Stefan Monnier

I've seen a few posts about how to boot from the WL-700gE's IDE drive or
from a USB drive, but when I tried it on my WL-700gE it failed for the
simple reason that the firmware I built (using the 2.6 kernel) was too
large, so the 128kB left for the jffs2 were insufficient to make
a jffs2 filesystem: OpenWRT gracefully fell back on a ramdisk overlay,
so I could create my disk's partiion, mount it and all, but at the next
reboot, I always cambe back to the default config since nothing had been
saved on flash.

I first tried to squeeze out unimportant things in the hope to get
my firmware small enough to get jffs2 up, but in the end I figured:
why bother.  So I just directly tweaked the /sbin/mount_root script
(took me a while to figure out that it was the place I wanted to
change) by adding the few lines appended below.  This also lets me use
slightly larger firmwares since I don't need any jffs2 at all.

These lines may not be a good default (they'd add about 10s to every
non-USB boot), but maybe we should offer this kind of functionality as
configuration option.  WDYT?
On a related note, such firmwares would be better off without any jffs2
compiled into the kernel.


Stefan


Index: mount_root
===
--- mount_root  (révision 11579)
+++ mount_root  (copie de travail)
@@ -8,9 +10,56 @@
[ $magic != deadc0de ]
 }
 
+###  Try to mount some drive.  
+mount_drive () {
+for m in jbd ext3; do
+echo mount_drive $m /tmp/stef
+insmod $m /tmp/stef 21
+done
+
+rootdev=$1
+
+COUNTER=0
+while [ ! -b $rootdev ]  [ $COUNTER -lt 10 ]; do
+echo mount sleep for $rootdev /tmp/stef
+sleep 1
+let COUNTER=COUNTER+1
+done
+
+mount $rootdev /mnt  [ -x /mnt/sbin/init ]  {
+echo mounted $rootdev /tmp/stef
+. /bin/firstboot
+pivot /mnt /rom
+exit
+}
+}
+
+mount_ide () {
+echo mount_ide /tmp/stef
+for m in ide-core aec62xx ide-generic ide-disk; do
+insmod $m /tmp/stef 21
+done
+mount_drive /dev/hde1
+}
+
+mount_usb () {
+echo mount_usb /tmp/stef
+for m in usbcore ohci-hcd ehci-hcd scsi_mod sd_mod usb-storage; do
+echo mount_usb $m /tmp/stef
+insmod $m /tmp/stef 21
+done
+mount_drive /dev/sda1
+}
+
+mount_usb
+mount_ide
+
+###  If no drve, mount the JFFS2 partition or a ramdisk.  
 grep rootfs_data /proc/mtd /dev/null 2/dev/null  {
+echo mount_root-11 /tmp/stef
. /bin/firstboot
mtd unlock rootfs_data
+echo mount_root-12 /tmp/stef
jffs2_ready  {
echo switching to jffs2
mount $(find_mtd_part rootfs_data) /jffs -t jffs2  \

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