[OpenWrt-Devel] OpenVPN with netifd

2012-10-04 Thread Joachim Schlipper
Hi,

as I didn't get reply in the forum (well, except for that spambot who
kindly wrote on the thread), I dare to post my question again here.

I'm quite eager to contribute my work on the OpenVPN netifd integration
into the repository, but don't know which way to go.

I've thought about these possibilities:
1. Integrate stuff into existing package ('openvpn')
2. Create a new package (i.e. openvpn-netifd) and place all stuff there
3. Create a new package (i.e. openvpn-netifd) with just Makefile and
have it download the files (tarball) from a server (i.e. my webserver)

Currently I am using a local package as in 2. but it should be no
problem to convert it to 1. or 3.

Option 1 does not sound very attractive to me because it would force the
use of netifd with openvpn and would also have to be included in the
openvpn-devel package.

Option 2 sounds good, with the advantage that everybody can send patches
for the package and scripts. Disadvantage is that I would have to find
someone who commits all files (quite some) and applies modifications in
svn - or is it possible for me to get svn access to just a single
package directory?

Option 3 sounds good too, with the advantage that it would be easier for
me to modify the files, without having access to OpenWRT svn.
Disadvantage is of course that everybody would have to rely on me and my
webserver which would host the tarball.

Oh, here's the Forum thread:
https://forum.openwrt.org/viewtopic.php?id=39274

Thanks for comments.
Joachim
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] OpenVPN with netifd

2012-10-04 Thread Gert Doering
Hi,

On Thu, Oct 04, 2012 at 11:29:49AM +0200, Joachim Schlipper wrote:
 as I didn't get reply in the forum (well, except for that spambot who
 kindly wrote on the thread), I dare to post my question again here.
 
 I'm quite eager to contribute my work on the OpenVPN netifd integration
 into the repository, but don't know which way to go.

I'm neutral on whether netifd is right or wrong, but want to comment
on something else.

In the forum post, I've seen that you call openvpn with --route-noexec,
and leave routing entries to netifd.  I'm fine with that, but please make
sure this also works for IPv6.

IPv6 support in OpenVPN has come a long way, and it would be a shame
to see a new framework support only the IPv4 side of things.

(openvpn-devel-* are the packages that have full IPv6 support, based
on upstream git of the soon-to-be released 2.3 version)

If you need a remote server that has working IPv6 and will push
IPv6 routes, to see that everything works, let me know and I'll set up 
something.

gert
-- 
USENET is *not* the non-clickable part of WWW!
   //www.muc.de/~gert/
Gert Doering - Munich, Germany g...@greenie.muc.de
fax: +49-89-35655025g...@net.informatik.tu-muenchen.de


pgpE5WH71exPy.pgp
Description: PGP signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] OpenVPN with netifd

2012-10-04 Thread Joachim Schlipper
Hi Gert,

IPv6 works just fine with my setup, at least in my simple setup:

I have a VirtualBox VM with OpenWRT running on my internet server, that
gets a (6to4) IPv6 address from HEnet (sadly my server provider doesn't
yet seem to know anything about IPv6) including a /48 subnet and runs an
OpenVPN server (2.3-alpha3) which distributes (local)IPv4 and
(global)IPv6 addresses to the clients.
Now I have several OpenVPN routers (i.e. my home internet router) that
connect to the OpenVPN server, get a global IPv6 address (with a /56
subnet) from the server and distribute global IPv6 addresses from the
/56 subnet to the LAN-clients via dnsmasq6.

All of this works like a charm, so I'd say there's no problem with
routing IPv6.
But I'd be grateful to have someone with more experience look at it and
test it with more complex scenarios, since I've just started with IPv6
recently. I'm willing to make it perfect, so I'm eager to learn.

Joachim

Am 04.10.2012 12:50, schrieb Gert Doering:
 Hi,
 
 On Thu, Oct 04, 2012 at 11:29:49AM +0200, Joachim Schlipper wrote:
 as I didn't get reply in the forum (well, except for that spambot who
 kindly wrote on the thread), I dare to post my question again here.

 I'm quite eager to contribute my work on the OpenVPN netifd integration
 into the repository, but don't know which way to go.
 
 I'm neutral on whether netifd is right or wrong, but want to comment
 on something else.
 
 In the forum post, I've seen that you call openvpn with --route-noexec,
 and leave routing entries to netifd.  I'm fine with that, but please make
 sure this also works for IPv6.
 
 IPv6 support in OpenVPN has come a long way, and it would be a shame
 to see a new framework support only the IPv4 side of things.
 
 (openvpn-devel-* are the packages that have full IPv6 support, based
 on upstream git of the soon-to-be released 2.3 version)
 
 If you need a remote server that has working IPv6 and will push
 IPv6 routes, to see that everything works, let me know and I'll set up 
 something.
 
 gert
 
 
 
 ___
 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] OpenVPN with netifd

2012-10-04 Thread Joachim Schlipper
Hi Jow,

Am 04.10.2012 13:11, schrieb Jo-Philipp Wich:
 Hi Joachim,
 
 integrating the netifd support into the main OpenVPN package is just
 fine, it does not prevent the traditional way of using OpenVPN from
 working therefore I see no reason to not integrate it there.

what to do then with the openvpn-devel package, should it include a copy
of all scripts which are also in the openvpn package? That would mean
that patches would have to be applied to both packages, no?

 
 One main reason why your work isn't integrated yet is due to the fact
 that trunk is currently feature-frozen for the 12.09 release preparations.

No problem, I wasn't expecting it to be already integrated because I was
still testing and improving it. The version I've posted in the forum was
just to have a look at my work in progress, not meant as final version
to commit.

Joachim

 
 ~ Jow
 ___
 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] OpenVPN with netifd

2012-10-04 Thread Jo-Philipp Wich
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi.

 what to do then with the openvpn-devel package, should it include a
 copy of all scripts which are also in the openvpn package? That
 would mean that patches would have to be applied to both packages,
 no?

If I am not mistaken then openvpn-devel is supposed to use the very
same files as openvpn. Afair its files/ folder is symlinked to the
openvpn package.

~ Jow
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iEYEARECAAYFAlBte3EACgkQdputYINPTPPb0wCfV6uFNPNugat9rLcDKcnJ3fLB
UaIAoICGco1bduaC9UHSwURuHNdbfol0
=nE5k
-END PGP SIGNATURE-
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] OpenVPN with netifd

2012-10-04 Thread Joachim Schlipper
Hi jow,

Am 04.10.2012 14:05, schrieb Jo-Philipp Wich:
 Hi.

 If I am not mistaken then openvpn-devel is supposed to use the very
 same files as openvpn. Afair its files/ folder is symlinked to the
 openvpn package.

Good to read, that indeed eliminates my concerns about maintaining
different packages.

Joachim

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


[OpenWrt-Devel] user and group for portmap

2012-10-04 Thread Peter Wagner
Instead of running portmap together with dnsmasq in the nobody group, portmap 
should get it's
own group/user called rpc. This patch adds the group/user.

Signed-off-by: Peter Wagner tripo...@gmx.atdiff --git a/net/portmap/Makefile b/net/portmap/Makefile
index 70499aa..3e8ae80 100644
--- a/net/portmap/Makefile
+++ b/net/portmap/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=portmap
 PKG_VERSION:=6.0
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
 PKG_SOURCE_URL:=http://neil.brown.name/portmap/
@@ -34,7 +34,7 @@ endef
 
 MAKE_FLAGS += \
 	CFLAGS=$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -DHOSTS_ACCESS -DFACILITY=LOG_DAEMON -DIGNORE_SIGCHLD \
-	RPCUSER=nobody \
+	RPCUSER=rpc \
 	LDLIBS=$(TARGET_LDFLAGS) -lwrap $(LIBRPC) \
 	all
 
diff --git a/net/portmap/files/portmap.init b/net/portmap/files/portmap.init
index e73701c..c57541e 100644
--- a/net/portmap/files/portmap.init
+++ b/net/portmap/files/portmap.init
@@ -5,6 +5,9 @@ START=19
 STOP=19
 
 start() {
+	user_exists rpc 65533 || user_add rpc 65533 65533 rpc /var/empty
+	group_exists rpc 65533 || group_add rpc 65533
+	
 	service_start /usr/sbin/portmap
 }
 
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] OpenVPN with netifd

2012-10-04 Thread Gert Doering
Hi,

On Thu, Oct 04, 2012 at 01:44:00PM +0200, Joachim Schlipper wrote:
 IPv6 works just fine with my setup, at least in my simple setup:

Cool :-)

[..]
 All of this works like a charm, so I'd say there's no problem with
 routing IPv6.
 But I'd be grateful to have someone with more experience look at it and
 test it with more complex scenarios, since I've just started with IPv6
 recently. I'm willing to make it perfect, so I'm eager to learn.

There is not much more to it - ifconfig-ipv6 needs to work, and
pushing route-ipv6.  If it's working for you right now, I think you
have tested everything there is, as far as operating system framework
is needed.

(If you have specific questions about IPv6 in OpenVPN, feel free to mail 
me directly, of course)

gert
-- 
USENET is *not* the non-clickable part of WWW!
   //www.muc.de/~gert/
Gert Doering - Munich, Germany g...@greenie.muc.de
fax: +49-89-35655025g...@net.informatik.tu-muenchen.de


pgpCoLgNDnuzN.pgp
Description: PGP signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] OpenVPN with netifd

2012-10-04 Thread Mirko Vogt
On 10/04/2012 02:25 PM, Joachim Schlipper wrote:
 Am 04.10.2012 14:05, schrieb Jo-Philipp Wich:
 If I am not mistaken then openvpn-devel is supposed to use the very
 same files as openvpn. Afair its files/ folder is symlinked to the
 openvpn package.
 
 Good to read, that indeed eliminates my concerns about maintaining
 different packages.
 
 Joachim

As far as I see the only advantage of the openvpn package over the
openvpn-devel one is, that it has 'stable' and not 'devel' in its name.
Since the openvpn version used in the openvpn-devel package is close(TM)
to a release, I won't put too much effort into getting the old package
working with netifd as well.

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


Re: [OpenWrt-Devel] OpenVPN with netifd

2012-10-04 Thread Joachim Schlipper
Am 04.10.2012 16:40, schrieb Mirko Vogt:
 On 10/04/2012 02:25 PM, Joachim Schlipper wrote:
 Am 04.10.2012 14:05, schrieb Jo-Philipp Wich:
 If I am not mistaken then openvpn-devel is supposed to use the very
 same files as openvpn. Afair its files/ folder is symlinked to the
 openvpn package.
 Good to read, that indeed eliminates my concerns about maintaining
 different packages.

 Joachim
 As far as I see the only advantage of the openvpn package over the
 openvpn-devel one is, that it has 'stable' and not 'devel' in its name.
 Since the openvpn version used in the openvpn-devel package is close(TM)
 to a release, I won't put too much effort into getting the old package
 working with netifd as well.

   mirko

The openvpn-devel package won't disappear once the 2.3 version of
OpenVPN is released, or does it? As far as I see, the openvpn-devel
package exists to always use the latest 'bleeding-edge' svn version of
openvpn instead of the latest release as does the 'stable' openvpn
package. So it will continue to exist until the OpenVPN team ceases
development - or nobody is interested anymore in testing the latest svn
version.

Joachim

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


Re: [OpenWrt-Devel] OpenVPN with netifd

2012-10-04 Thread Mirko Vogt
On 10/04/2012 05:48 PM, Joachim Schlipper wrote:
 The openvpn-devel package won't disappear once the 2.3 version of
 OpenVPN is released, or does it?

I don't see any reason to continue this once 2.3 is out.
There are currently features in OpenVPN-trunk which are essential to
some users. Once 2.3 is out however, continuing this just for having a
stable as well as a bleeding-edge version doesn't make any sense to me
(and it wouldn't have to do anything with OpenVPN in particular anymore).
I was already about to drop the old package when I was reworking the
-devel package, however this time OpenVPN-trunk was in an alpha state
and we didn't want to have the only OpenVPN-package being an alpha
version in our next release.
However it's not going to be dropped now nor very soon and if there's
any particular reason I also don't mind keeping it the way it is right
now, once 2.3 is released.

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


[OpenWrt-Devel] [PATCH] [cns3xxx] add sysupgrade support

2012-10-04 Thread Tim Harvey

Add sysupgrade support for cns3xxx

Signed-off-by: Tim Harvey thar...@gateworks.com

 target/linux/cns3xxx/base-files/lib/cns3xxx.sh  |   22 ++
 target/linux/cns3xxx/base-files/lib/upgrade/platform.sh |  122 
 target/linux/cns3xxx/image/Makefile |   19 +-
 3 files changed, 159 insertions(+), 4 deletions(-)

Index: trunk/target/linux/cns3xxx/base-files/lib/cns3xxx.sh
===
--- trunk/target/linux/cns3xxx/base-files/lib/cns3xxx.sh(revision 0)
+++ trunk/target/linux/cns3xxx/base-files/lib/cns3xxx.sh(working copy)
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# Copyright (C) 2012 OpenWrt.org
+#
+
+cns3xxx_board_name() {
+local machine
+local name
+
+machine=$(awk 'BEGIN{FS=[ \t]+:[ \t]} /Hardware/ {print $2}' 
/proc/cpuinfo)
+
+case $machine in
+   Gateworks Corporation Laguna*)
+   name=laguna
+   ;;
+   *)
+   name=generic;
+   ;;
+   esac
+   
+   echo $name
+}
Index: trunk/target/linux/cns3xxx/base-files/lib/upgrade/platform.sh
===
--- trunk/target/linux/cns3xxx/base-files/lib/upgrade/platform.sh   
(revision 0)
+++ trunk/target/linux/cns3xxx/base-files/lib/upgrade/platform.sh   
(working copy)
@@ -0,0 +1,122 @@
+. /lib/cns3xxx.sh
+
+RAMFS_COPY_DATA=/lib/cns3xxx.sh
+
+CI_BLKSZ=65536
+
+platform_find_partitions() {
+   local first dev size erasesize name
+   while read dev size erasesize name; do
+   name=${name#''}; name=${name%''}
+   case $name in
+   vmlinux.bin.l7|kernel|linux|rootfs)
+   if [ -z $first ]; then
+   first=$name
+   else
+   echo $erasesize:$first:$name
+   break
+   fi
+   ;;
+   esac
+   done  /proc/mtd
+}
+
+platform_find_kernelpart() {
+   local part
+   for part in ${1%:*} ${1#*:}; do
+   case $part in
+   vmlinux.bin.l7|kernel|linux)
+   echo $part
+   break
+   ;;
+   esac
+   done
+}
+
+platform_do_upgrade_combined() {
+   local partitions=$(platform_find_partitions)
+   local kernelpart=$(platform_find_kernelpart ${partitions#*:})
+   local erase_size=$((0x${partitions%%:*})); partitions=${partitions#*:}
+   local kern_length=0x$(dd if=$1 bs=2 skip=1 count=4 2/dev/null)
+   local kern_blocks=$(($kern_length / $CI_BLKSZ))
+   local root_blocks=$((0x$(dd if=$1 bs=2 skip=5 count=4 2/dev/null) / 
$CI_BLKSZ))
+
+   v platform_do_upgrade_combined
+   v partitions=$partitions
+   v kernelpart=$kernelpart
+   v erase_size=$erase_size 
+   v kern_blocks=$kern_blocks
+   v root_blocks=$root_blocks
+
+   if [ -n $partitions ]  [ -n $kernelpart ]  \
+  [ ${kern_blocks:-0} -gt 0 ]  \
+  [ ${root_blocks:-0} -gt 0 ]  \
+  [ ${erase_size:-0} -gt 0 ];
+   then
+   local append=
+   [ -f $CONF_TAR -a $SAVE_CONFIG -eq 1 ]  append=-j 
$CONF_TAR
+
+   dd if=$1 bs=$CI_BLKSZ skip=1 count=$kern_blocks 2/dev/null | 
mtd write - kernel
+   dd if=$1 bs=$CI_BLKSZ skip=$((1+$kern_blocks)) 
count=$root_blocks 2/dev/null | \
+mtd -r $append write - rootfs
+   else
+   echo invalid image
+   fi
+}
+
+platform_check_image() {
+   local board=$(cns3xxx_board_name)
+   local magic=$(get_magic_word $1)
+   local magic_long=$(get_magic_long $1)
+
+   [ $ARGC -gt 1 ]  return 1
+
+   case $board in
+   laguna)
+   [ $magic != 4349 ]  {
+   echo Invalid image. Use *-sysupgrade.bin files on this 
board
+   return 1
+   }
+
+   local md5_img=$(dd if=$1 bs=2 skip=9 count=16 2/dev/null)
+   local md5_chk=$(dd if=$1 bs=$CI_BLKSZ skip=1 2/dev/null | 
md5sum -); md5_chk=${md5_chk%% *}
+
+   if [ -n $md5_img -a -n $md5_chk ]  [ $md5_img = 
$md5_chk ]; then
+   return 0
+   else
+   echo Invalid image. Contents do not match checksum 
(image:$md5_img calculated:$md5_chk)
+   return 1
+   fi
+   return 0
+   ;;
+   esac
+
+   echo Sysupgrade is not yet supported on $board.
+   return 1
+}
+
+platform_do_upgrade() {
+   local board=$(cns3xxx_board_name)
+
+   v board=$board
+   case $board in
+   laguna)
+   platform_do_upgrade_combined $ARGV
+   

[OpenWrt-Devel] [PATCH] [ixp4xx] mtd: allow partial block unlock

2012-10-04 Thread Tim Harvey

Allow unlocking MTD partitions that exist within a partial eraseblock

This allows sysupgrade for devices such as the Gateworks Avila/Cambria
product families based on the ixp4xx using the redboot bootloader with
combined FIS directory and RedBoot config partitions

Signed-off-by: Tim Harvey thar...@gateworks.com

 target/linux/generic/patches-3.3/478-mtd-partial_eraseblock_unlock.patch |   
30 ++
 1 file changed, 30 insertions(+)

Index: 
trunk/target/linux/generic/patches-3.3/478-mtd-partial_eraseblock_unlock.patch
===
--- 
trunk/target/linux/generic/patches-3.3/478-mtd-partial_eraseblock_unlock.patch  
(revision 0)
+++ 
trunk/target/linux/generic/patches-3.3/478-mtd-partial_eraseblock_unlock.patch  
(working copy)
@@ -0,0 +1,30 @@
+--- a/drivers/mtd/mtdpart.c
 b/drivers/mtd/mtdpart.c
+@@ -356,7 +356,26 @@ static int part_unlock(struct mtd_info *
+   struct mtd_part *part = PART(mtd);
+   if ((len + ofs)  mtd-size)
+   return -EINVAL;
+-  return mtd_unlock(part-master, ofs + part-offset, len);
++
++  if (mtd-flags  MTD_ERASE_PARTIAL
++   (mtd_mod_by_eb(ofs + part-offset, part-master) == 0) )
++  {
++  struct mtd_part *part = PART(mtd);
++  /* Round up to next erasesize */
++  uint64_t newlen = (uint64_t) (mtd_div_by_eb(len, part-master) 
+ 1)
++  * part-master-erasesize;
++  printk(%s: unlocking partial block\n, mtd-name);
++  return mtd_unlock(part-master, ofs + part-offset, newlen);
++  } else if (mtd-flags  MTD_ERASE_PARTIAL) {
++  /* presumably this was unlocked by previous partition that it 
shares
++ sector(s) with
++  */
++  printk(KERN_INFO %s: assuming partial block already 
unlocked\n,
++  mtd-name);
++  return 0;
++  } else {
++  return mtd_unlock(part-master, ofs + part-offset, len);
++  }
+ }
+ 
+ static int part_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len)
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] [ixp4xx] add sysupgrade support

2012-10-04 Thread Tim Harvey

Add sysupgrade support for ixp4xx platform

Signed-off-by: Tim Harvey thar...@gateworks.com

 target/linux/ixp4xx/base-files/lib/ixp4xx.sh   |   25 ++
 target/linux/ixp4xx/base-files/lib/upgrade/platform.sh |  156 +
 target/linux/ixp4xx/image/Makefile |   11 +
 3 files changed, 192 insertions(+)

Index: trunk/target/linux/ixp4xx/base-files/lib/ixp4xx.sh
===
--- trunk/target/linux/ixp4xx/base-files/lib/ixp4xx.sh  (revision 0)
+++ trunk/target/linux/ixp4xx/base-files/lib/ixp4xx.sh  (working copy)
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+# Copyright (C) 2012 OpenWrt.org
+#
+
+ixp4xx_board_name() {
+local machine
+local name
+
+machine=$(awk 'BEGIN{FS=[ \t]+:[ \t]} /Hardware/ {print $2}' 
/proc/cpuinfo)
+
+case $machine in
+   Gateworks Cambria*)
+   name=cambria
+   ;;
+   Gateworks Avila*)
+   name=avila
+   ;;
+   *)
+   name=generic;
+   ;;
+   esac
+   
+   echo $name
+}
Index: trunk/target/linux/ixp4xx/base-files/lib/upgrade/platform.sh
===
--- trunk/target/linux/ixp4xx/base-files/lib/upgrade/platform.sh
(revision 0)
+++ trunk/target/linux/ixp4xx/base-files/lib/upgrade/platform.sh
(working copy)
@@ -0,0 +1,156 @@
+. /lib/ixp4xx.sh
+
+RAMFS_COPY_DATA=/lib/ixp4xx.sh
+
+# testing
+RAMFS_COPY_BIN=/usr/bin/less /usr/bin/hexdump
+
+CI_BLKSZ=65536
+CI_LDADR=0x0080
+
+platform_find_partitions() {
+   local first dev size erasesize name
+   while read dev size erasesize name; do
+   name=${name#''}; name=${name%''}
+   case $name in
+   vmlinux.bin.l7|kernel|linux|rootfs)
+   if [ -z $first ]; then
+   first=$name
+   else
+   echo $erasesize:$first:$name
+   break
+   fi
+   ;;
+   esac
+   done  /proc/mtd
+}
+
+platform_find_kernelpart() {
+   local part
+   for part in ${1%:*} ${1#*:}; do
+   case $part in
+   vmlinux.bin.l7|kernel|linux)
+   echo $part
+   break
+   ;;
+   esac
+   done
+}
+
+platform_find_part_size() {
+   local first dev size erasesize name
+   while read dev size erasesize name; do
+   name=${name#''}; name=${name%''}
+   [ $name = $1 ]  {
+   echo $size
+   break
+   }
+   done  /proc/mtd
+}
+
+platform_do_upgrade_combined() {
+   local partitions=$(platform_find_partitions)
+   local kernelpart=$(platform_find_kernelpart ${partitions#*:})
+   local erase_size=$((0x${partitions%%:*})); partitions=${partitions#*:}
+   local kern_part_size=0x$(platform_find_part_size $kernelpart)
+   local kern_part_blocks=$(($kern_part_size / $CI_BLKSZ))
+   local kern_length=0x$(dd if=$1 bs=2 skip=1 count=4 2/dev/null)
+   local kern_blocks=$(($kern_length / $CI_BLKSZ))
+   local root_blocks=$((0x$(dd if=$1 bs=2 skip=5 count=4 2/dev/null) / 
$CI_BLKSZ))
+
+   v platform_do_upgrade_combined
+   v partitions=$partitions
+   v kernelpart=$kernelpart
+   v kernel_part_size=$kern_part_size
+   v kernel_part_blocks=$kern_part_blocks
+   v kern_length=$kern_length
+   v erase_size=$erase_size 
+   v kern_blocks=$kern_blocks
+   v root_blocks=$root_blocks
+   v kern_pad_blocks=$(($kern_part_blocks-$kern_blocks))
+
+   if [ -n $partitions ]  [ -n $kernelpart ]  \
+  [ ${kern_blocks:-0} -gt 0 ]  \
+  [ ${root_blocks:-0} -gt 0 ]  \
+  [ ${erase_size:-0} -gt 0 ];
+   then
+   local append=
+   [ -f $CONF_TAR -a $SAVE_CONFIG -eq 1 ]  append=-j 
$CONF_TAR
+
+   # write the kernel
+   dd if=$1 bs=$CI_BLKSZ skip=1 count=$kern_blocks 2/dev/null | 
\
+   mtd -F$kernelpart:$kern_part_size:$CI_LDADR write - 
$kernelpart
+   # write the rootfs
+   dd if=$1 bs=$CI_BLKSZ skip=$((1+$kern_blocks)) 
count=$root_blocks 2/dev/null | \
+   mtd $append write - rootfs
+   else
+   echo invalid image
+   fi
+}
+
+platform_check_image() {
+   local board=$(ixp4xx_board_name)
+   local magic=$(get_magic_word $1)
+   local partitions=$(platform_find_partitions)
+   local kernelpart=$(platform_find_kernelpart ${partitions#*:})
+   local kern_part_size=0x$(platform_find_part_size $kernelpart)
+   local 

[OpenWrt-Devel] [PATCH 1/4] ixp4xx: add 8250 delayed_uart I/O

2012-10-04 Thread Tim Harvey

Add a new UART I/O type for slow busses such as the ixp4xx

Signed-off-by: Tim Harvey thar...@gateworks.com

 target/linux/ixp4xx/patches-3.3/160-delayed_uart.patch |  121 +
 1 file changed, 121 insertions(+)

Index: trunk/target/linux/ixp4xx/patches-3.3/160-delayed_uart.patch
===
--- trunk/target/linux/ixp4xx/patches-3.3/160-delayed_uart.patch
(revision 0)
+++ trunk/target/linux/ixp4xx/patches-3.3/160-delayed_uart.patch
(working copy)
@@ -0,0 +1,121 @@
+--- a/drivers/tty/serial/8250/8250.c
 b/drivers/tty/serial/8250/8250.c
+@@ -400,6 +400,20 @@ static void mem_serial_out(struct uart_p
+   writeb(value, p-membase + offset);
+ }
+ 
++static unsigned int memdelay_serial_in(struct uart_port *p, int offset)
++{
++  struct uart_8250_port *up = (struct uart_8250_port *)p;
++  udelay(up-port.rw_delay);
++  return mem_serial_in(p, offset);
++}
++
++static void memdelay_serial_out(struct uart_port *p, int offset, int value)
++{
++  struct uart_8250_port *up = (struct uart_8250_port *)p;
++  udelay(up-port.rw_delay);
++  mem_serial_out(p, offset, value);
++}
++
+ static void mem32_serial_out(struct uart_port *p, int offset, int value)
+ {
+   offset = map_8250_out_reg(p, offset)  p-regshift;
+@@ -459,6 +473,11 @@ static void set_io_from_upio(struct uart
+   p-serial_out = mem32_serial_out;
+   break;
+ 
++  case UPIO_MEM_DELAY:
++  p-serial_in = memdelay_serial_in;
++  p-serial_out = memdelay_serial_out;
++  break;
++
+   case UPIO_AU:
+   p-serial_in = au_serial_in;
+   p-serial_out = au_serial_out;
+@@ -481,6 +500,7 @@ serial_out_sync(struct uart_8250_port *u
+   switch (p-iotype) {
+   case UPIO_MEM:
+   case UPIO_MEM32:
++  case UPIO_MEM_DELAY:
+   case UPIO_AU:
+   p-serial_out(p, offset, value);
+   p-serial_in(p, UART_LCR);  /* safe, no side-effects */
+@@ -2498,6 +2518,7 @@ static int serial8250_request_std_resour
+   case UPIO_TSI:
+   case UPIO_MEM32:
+   case UPIO_MEM:
++  case UPIO_MEM_DELAY:
+   if (!up-port.mapbase)
+   break;
+ 
+@@ -2534,6 +2555,7 @@ static void serial8250_release_std_resou
+   case UPIO_TSI:
+   case UPIO_MEM32:
+   case UPIO_MEM:
++  case UPIO_MEM_DELAY:
+   if (!up-port.mapbase)
+   break;
+ 
+@@ -3050,6 +3072,7 @@ static int __devinit serial8250_probe(st
+   port.set_termios= p-set_termios;
+   port.pm = p-pm;
+   port.dev= dev-dev;
++  port.rw_delay   = p-rw_delay;
+   port.irqflags   |= irqflag;
+   ret = serial8250_register_port(port);
+   if (ret  0) {
+@@ -3199,6 +3222,7 @@ int serial8250_register_port(struct uart
+   uart-port.iotype   = port-iotype;
+   uart-port.flags= port-flags | UPF_BOOT_AUTOCONF;
+   uart-port.mapbase  = port-mapbase;
++  uart-port.rw_delay = port-rw_delay;
+   uart-port.private_data = port-private_data;
+   if (port-dev)
+   uart-port.dev = port-dev;
+--- a/drivers/tty/serial/serial_core.c
 b/drivers/tty/serial/serial_core.c
+@@ -2021,6 +2021,7 @@ uart_report_port(struct uart_driver *drv
+   snprintf(address, sizeof(address),
+I/O 0x%lx offset 0x%x, port-iobase, port-hub6);
+   break;
++  case UPIO_MEM_DELAY:
+   case UPIO_MEM:
+   case UPIO_MEM32:
+   case UPIO_AU:
+@@ -2436,6 +2437,7 @@ int uart_match_port(struct uart_port *po
+   case UPIO_HUB6:
+   return (port1-iobase == port2-iobase) 
+  (port1-hub6   == port2-hub6);
++  case UPIO_MEM_DELAY:
+   case UPIO_MEM:
+   case UPIO_MEM32:
+   case UPIO_AU:
+--- a/include/linux/serial_8250.h
 b/include/linux/serial_8250.h
+@@ -27,6 +27,7 @@ struct plat_serial8250_port {
+   void*private_data;
+   unsigned char   regshift;   /* register shift */
+   unsigned char   iotype; /* UPIO_* */
++  unsigned intrw_delay;   /* udelay for slower busses IXP4XX 
Expansion Bus */
+   unsigned char   hub6;
+   upf_t   flags;  /* UPF_* flags */
+   unsigned inttype;   /* If UPF_FIXED_TYPE */
+--- a/include/linux/serial_core.h
 b/include/linux/serial_core.h
+@@ -324,6 +324,7 @@ struct uart_port {
+ #define UPIO_AU   (4) /* Au1x00 type 
IO */
+ #define UPIO_TSI  (5) /* Tsi108/109 type IO */
+ #define UPIO_RM9000   (6) /* RM9000 type IO */
++#define UPIO_MEM_DELAY(7)
+ 
+   

[OpenWrt-Devel] [PATCH] ixp4xx: spread-spectrum clock adjust

2012-10-04 Thread Tim Harvey

Spread-spectrum clock adjust support

The ixp4xx can be driven from a 2% down spread-spectrum clock.  Doing so
however will cause your UART timing and system clock timing to be 2% slow.
This patch adds a kernel built-time configuration to adjust those clocks
so that running on boards with a spread-spectrum clock do not show clock drift
or UART issues.

Signed-off-by: Tim Harvey thar...@gateworks.com

 target/linux/ixp4xx/config-3.3   |1 
 target/linux/ixp4xx/patches-3.3/700-spread-spectrum-adjust.patch |   45 
++
 2 files changed, 46 insertions(+)

Index: trunk/target/linux/ixp4xx/patches-3.3/700-spread-spectrum-adjust.patch
===
--- trunk/target/linux/ixp4xx/patches-3.3/700-spread-spectrum-adjust.patch  
(revision 0)
+++ trunk/target/linux/ixp4xx/patches-3.3/700-spread-spectrum-adjust.patch  
(working copy)
@@ -0,0 +1,45 @@
+--- a/arch/arm/mach-ixp4xx/Kconfig
 b/arch/arm/mach-ixp4xx/Kconfig
+@@ -296,6 +296,12 @@ config MACH_MI424WR
+ 
+ comment IXP4xx Options
+ 
++config IXP4XX_SPREAD_SPECTRUM_CLK
++  bool Adjust clocks for 2% Down Spread Spectrum source
++  help
++Say 'Y' here if you want your kernel to adjust clocks for a
++2% down spread-spectrum oscillator used as the CPU clock.
++
+ config IXP4XX_INDIRECT_PCI
+   bool Use indirect PCI memory access
+   depends on PCI
+--- a/arch/arm/mach-ixp4xx/include/mach/platform.h
 b/arch/arm/mach-ixp4xx/include/mach/platform.h
+@@ -73,7 +73,12 @@ extern unsigned long ixp4xx_exp_bus_size
+  * Clock Speed Definitions.
+  */
+ #define IXP4XX_PERIPHERAL_BUS_CLOCK   (66) /* 66Mhzi APB BUS   */
++#ifdef CONFIG_IXP4XX_SPREAD_SPECTRUM_CLK
++// Adjusted for 2% down spread-spectrum osciallator
++#define IXP4XX_UART_XTAL  14598144
++#else
+ #define IXP4XX_UART_XTAL  14745600
++#endif
+ 
+ /*
+  * This structure provide a means for the board setup code
+--- a/arch/arm/mach-ixp4xx/include/mach/timex.h
 b/arch/arm/mach-ixp4xx/include/mach/timex.h
+@@ -10,7 +10,12 @@
+  * 66.66... MHz. We do a convulted calculation of CLOCK_TICK_RATE b/c the
+  * timer register ignores the bottom 2 bits of the LATCH value.
+  */
++#ifdef CONFIG_IXP4XX_SPREAD_SPECTRUM_CLK
++// Adjusted for 2% down spread-spectrum osciallator
++#define IXP4XX_TIMER_FREQ 65999340
++#else
+ #define IXP4XX_TIMER_FREQ 6000
++#endif
+ #define CLOCK_TICK_RATE \
+   (((IXP4XX_TIMER_FREQ / HZ  ~IXP4XX_OST_RELOAD_MASK) + 1) * HZ)
+ 
Index: trunk/target/linux/ixp4xx/config-3.3
===
--- trunk/target/linux/ixp4xx/config-3.3(revision 33620)
+++ trunk/target/linux/ixp4xx/config-3.3(working copy)
@@ -109,6 +109,7 @@
 # CONFIG_IXP4XX_INDIRECT_PCI is not set
 CONFIG_IXP4XX_NPE=y
 CONFIG_IXP4XX_QMGR=y
+# CONFIG_IXP4XX_SPREAD_SPECTRUM_CLK is not set
 CONFIG_IXP4XX_WATCHDOG=y
 CONFIG_KTIME_SCALAR=y
 CONFIG_LEDS_FSG=y
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] [packages] cmus: fix build when sys/soundcard.h is missing on host.

2012-10-04 Thread Catalin Patulea
---
I think upstream was trying to separate the check for include file in system
include dir vs check for include file in any dependent library's include
paths. Ideally their configure script could be instructed to use something
other than / as its idea of the root for system include dirs, but that would
require passing an extra arg to configure, and seemed messy. This (using the
check in any -I dirs) seems like a reasonable compromise, as it piggybacks
on paths that are already being passed in.

 .../patches/020-check_header_sys_soundcard.patch   |   20 
 1 files changed, 20 insertions(+), 0 deletions(-)
 create mode 100644 sound/cmus/patches/020-check_header_sys_soundcard.patch

diff --git a/sound/cmus/patches/020-check_header_sys_soundcard.patch 
b/sound/cmus/patches/020-check_header_sys_soundcard.patch
new file mode 100644
index 000..c17d6ea
--- /dev/null
+++ b/sound/cmus/patches/020-check_header_sys_soundcard.patch
@@ -0,0 +1,20 @@
+--- a/configure
 b/configure
+@@ -244,16 +244,10 @@ check_oss()
+   ;;
+   esac
+ 
+-  OSS_CFLAGS=
+-  OSS_LIBS=
+-  msg_checking for header sys/soundcard.h
+-  if test -f /usr/include/sys/soundcard.h
++  if check_header sys/soundcard.h
+   then
+-  msg_result yes
+   makefile_vars OSS_CFLAGS OSS_LIBS
+   return 0
+-  else
+-  msg_result no
+   fi
+   return 1
+ }
-- 
1.7.7.3

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