Re: [OpenWrt-Devel] [PATCH 1/1] GL AR150 AR300 Domino patches

2015-11-06 Thread Felix Fietkau
On 2015-11-06 08:01, alz...@gmail.com wrote:
> From: alzhao 
> 
> ---
>  .../ar71xx/base-files/etc/uci-defaults/01_leds |  12 ++
>  .../ar71xx/base-files/etc/uci-defaults/02_network  |   8 ++
>  target/linux/ar71xx/base-files/lib/ar71xx.sh   |   9 ++
>  .../ar71xx/base-files/lib/upgrade/platform.sh  |   3 +
>  target/linux/ar71xx/config-3.18|   3 +
>  .../ar71xx/files/arch/mips/ath79/mach-domino.c | 137 
> +
>  .../ar71xx/files/arch/mips/ath79/mach-gl-ar300.c   | 111 +
>  .../ar71xx/files/arch/mips/ath79/mach-gl_ar150.c   | 122 ++
>  target/linux/ar71xx/generic/profiles/domino.mk |  16 +++
>  target/linux/ar71xx/generic/profiles/gl-ar300.mk   |  16 +++
>  target/linux/ar71xx/generic/profiles/gl_ar150.mk   |  16 +++
>  target/linux/ar71xx/image/Makefile |  25 
>  .../patches-3.18/911-MIPS-ath79-add-gl_ar150.patch |  39 ++
>  .../patches-3.18/912-MIPS-ath79-add-gl_ar300.patch |  39 ++
>  .../913-MIPS-ath79-add-domino-support.patch|  39 ++
>  15 files changed, 595 insertions(+)
>  create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-domino.c
>  create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar300.c
>  create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-gl_ar150.c
>  create mode 100644 target/linux/ar71xx/generic/profiles/domino.mk
>  create mode 100644 target/linux/ar71xx/generic/profiles/gl-ar300.mk
>  create mode 100644 target/linux/ar71xx/generic/profiles/gl_ar150.mk
>  create mode 100644 
> target/linux/ar71xx/patches-3.18/911-MIPS-ath79-add-gl_ar150.patch
>  create mode 100644 
> target/linux/ar71xx/patches-3.18/912-MIPS-ath79-add-gl_ar300.patch
>  create mode 100644 
> target/linux/ar71xx/patches-3.18/913-MIPS-ath79-add-domino-support.patch
This needs to be rebased to OpenWrt trunk, which uses Linux 4.1.

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


Re: [OpenWrt-Devel] uci delete doesn't match documentation

2015-11-06 Thread Yousong Zhou
On 5 November 2015 at 22:44, Karl Palsson  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> I'm trying to work out _a_ way of ensuring that a UCI config file
> has a given section type with a given name.
>
> While trying to test out the various methods, I've been deleting
> files from /etc/config, but I was just trying "uci delete config"
> which is documented as being valid.
>
> delete [.[[.][=]]]
>
> However, providing just a  argument to delete is refused.
>
> karlp@cuth:~/src/uci/lua $ uci show remake
> remake.@plugins[0]=plugins
> karlp@cuth:~/src/uci/lua $ uci delete remake
> uci: Invalid argument
> karlp@cuth:~/src/uci/lua $
>
> This is either a bug in the documentation or the utility.
> (Preferably the utility, it seems like a reasonable feature to
> exist)
>

Just skimmed the relevant code and it looks like the code explicitly
requires at least a section name to be specified.  So it's more likely
a usage documentation problem.

yousong


> Sincerely,
> Karl P
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.11 (GNU/Linux)
>
> iQIcBAEBAgAGBQJWO2s4AAoJEBmotQ/U1cr2iXIP/3kvddWYqa1G2kqnvQigh7uX
> eaVziehuNFh5BugIPDeWsXdpUvnkAcw/FwwCp6BKhEp13icVHJbuUtPHjgxkPqmb
> NLUpAgGiWPOZIeTlhTQnzHJaEB1fyY1CNpksXbMjP8JIWsU2a8mVSJpr5DeIkFhy
> vAK33XoY64+U3+IfaZHBc5O4+OKdaSDHxH3/9zl5HpNnDiJub1KHMJUeJmo5iYb5
> 1gKW0b5t4CefxsFFSL7Lh951PGweIML1LZC0EMeamc77bvUJNxEIHuhn/QLY1U3p
> bpzUbjhxY4t+sCY3ITMRHB/xDvfJatfZ+xVXZanJyqeO6nB2iI8fQYeZXGxIokGV
> KvXG8X1ALetyLnha6Wh2YG+VrvEmZOcwAlEm2WHNwZrxBREamON5zzJbfc6iaOf0
> s43HpntdcrrKzyjK6j3YAhNrvKNrdiRNR0JPyikPpTrWaWilgP0QwBZS/oUhvimB
> XnIEkJoIOE3fUo+KqFVaPdao9c+mfJYm1ObCZ5Q/3USn3sURMKz8d16yAi6ibKaB
> gr1pus82A/cqPw6KTyOe+EZiJNsA98b4Re0nuR8bYQj9s7QQcomphvAvtI7qX09Z
> Dl/eRSYjKURVkl8KqgCliuJVidXzfkInaaKEZQXCHS6yQ1KnukPovbGODNfGAQjP
> M9I4rOAW0kWPIdiyh5Ef
> =eaa1
> -END PGP SIGNATURE-
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 1/1] GL AR150 AR300 Domino patches

2015-11-06 Thread alzhao
I can make the patch for trunk separately. But I observed that for CC1505,
patches are still updated after release. Can we merge the patches to CC1505
as well. As a lot of people prefer a stable release rather than trunk.

On Fri, Nov 6, 2015 at 4:54 PM, Felix Fietkau  wrote:

> On 2015-11-06 08:01, alz...@gmail.com wrote:
> > From: alzhao 
> >
> > ---
> >  .../ar71xx/base-files/etc/uci-defaults/01_leds |  12 ++
> >  .../ar71xx/base-files/etc/uci-defaults/02_network  |   8 ++
> >  target/linux/ar71xx/base-files/lib/ar71xx.sh   |   9 ++
> >  .../ar71xx/base-files/lib/upgrade/platform.sh  |   3 +
> >  target/linux/ar71xx/config-3.18|   3 +
> >  .../ar71xx/files/arch/mips/ath79/mach-domino.c | 137
> +
> >  .../ar71xx/files/arch/mips/ath79/mach-gl-ar300.c   | 111
> +
> >  .../ar71xx/files/arch/mips/ath79/mach-gl_ar150.c   | 122
> ++
> >  target/linux/ar71xx/generic/profiles/domino.mk |  16 +++
> >  target/linux/ar71xx/generic/profiles/gl-ar300.mk   |  16 +++
> >  target/linux/ar71xx/generic/profiles/gl_ar150.mk   |  16 +++
> >  target/linux/ar71xx/image/Makefile |  25 
> >  .../patches-3.18/911-MIPS-ath79-add-gl_ar150.patch |  39 ++
> >  .../patches-3.18/912-MIPS-ath79-add-gl_ar300.patch |  39 ++
> >  .../913-MIPS-ath79-add-domino-support.patch|  39 ++
> >  15 files changed, 595 insertions(+)
> >  create mode 100644
> target/linux/ar71xx/files/arch/mips/ath79/mach-domino.c
> >  create mode 100644
> target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar300.c
> >  create mode 100644
> target/linux/ar71xx/files/arch/mips/ath79/mach-gl_ar150.c
> >  create mode 100644 target/linux/ar71xx/generic/profiles/domino.mk
> >  create mode 100644 target/linux/ar71xx/generic/profiles/gl-ar300.mk
> >  create mode 100644 target/linux/ar71xx/generic/profiles/gl_ar150.mk
> >  create mode 100644
> target/linux/ar71xx/patches-3.18/911-MIPS-ath79-add-gl_ar150.patch
> >  create mode 100644
> target/linux/ar71xx/patches-3.18/912-MIPS-ath79-add-gl_ar300.patch
> >  create mode 100644
> target/linux/ar71xx/patches-3.18/913-MIPS-ath79-add-domino-support.patch
> This needs to be rebased to OpenWrt trunk, which uses Linux 4.1.
>
> - Felix
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 1/1] GL AR150 AR300 Domino patches

2015-11-06 Thread Felix Fietkau
On 2015-11-06 11:18, alzhao wrote:
> I can make the patch for trunk separately. But I observed that for
> CC1505, patches are still updated after release. Can we merge the
> patches to CC1505 as well. As a lot of people prefer a stable release
> rather than trunk.
I don't know if we're going to backport it to CC, but either way it
needs to go into trunk first.

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


Re: [OpenWrt-Devel] [PATCH] include/image.mk: use KERNEL_SUFFIX in Device/Build/initramfs

2015-11-06 Thread Felix Fietkau
On 2015-11-05 18:34, Alexey Brodkin wrote:
> In case if we're interested in generation of non-binary images
> (for example if we want images to be valid .elfs - and that's what we
> want for ARC now) we have to instruct Device/Build/initramfs target to
> use input file with some extension (in case of ARC it will be
> essentially .elf).
> 
> Otherwise default binary vmlinux (without extension) is used and
> resulting images then are binaries instead of elfs.
> 
> Signed-off-by: Alexey Brodkin 
> Cc: Felix Fietkau 
> Cc: John Crispin 
> ---
>  include/image.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/image.mk b/include/image.mk
> index 43980bc..ea7cf34 100644
> --- a/include/image.mk
> +++ b/include/image.mk
> @@ -462,7 +462,7 @@ define Device/Build/initramfs
>$(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE): 
> $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE)
>   cp $$^ $$@
>  
> -  $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE): $(KDIR)/$$(KERNEL_NAME)-initramfs
> +  $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE): 
> $(KDIR)/$$(KERNEL_NAME)-initramfs$$(KERNEL_SUFFIX)
KERNEL_SUFFIX is already used for a different purpose, so this change
will break other targets. I suggest adding a KERNEL_INITRAMFS_NAME
variable, which defaults to $(KERNEL_NAME)-initramfs, and change all
existing references to the initramfs kernel.

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


Re: [OpenWrt-Devel] [PATCH 2/2 v3] linux: add support of Synopsys ARC770-based boards

2015-11-06 Thread Jonas Gorski
Hi Alexey,

On Thu, Nov 5, 2015 at 8:39 PM, Alexey Brodkin
 wrote:
> Hi Jonas,
>
> On Thu, 2015-11-05 at 20:04 +0100, Jonas Gorski wrote:
>> Hi Alexey,
>>
>> On Thu, Nov 5, 2015 at 7:14 PM, Alexey Brodkin
>>  wrote:
>> > Hi Jonas,
>> >
>> > On Wed, 2015-11-04 at 20:22 +0300, Alexey Brodkin wrote:
>> > > Hi Jonas,
>> > >
>> > > On Wed, 2015-11-04 at 13:06 +0100, Jonas Gorski wrote:
>> > > > Hi,
>> > > >
>> > > > On Tue, Nov 3, 2015 at 12:27 AM, Alexey Brodkin
>> > > >  wrote:
>> > > > > +   ;;
>> > > > > +esac
>> > > > > +
>> > > > > +uci commit network
>> > > > > +
>> > > > > +exit 0
>> > > > > diff --git a/target/linux/arc770/base-files/lib/arc.sh 
>> > > > > b/target/linux/arc770/base-files/lib/arc.sh
>> > > > > new file mode 100644
>> > > > > index 000..b15e94b
>> > > > > --- /dev/null
>> > > > > +++ b/target/linux/arc770/base-files/lib/arc.sh
>> > > > > @@ -0,0 +1,76 @@
>> > > > > +#!/bin/sh
>> > > > > +#
>> > > > > +# Copyright (C) 2015 OpenWrt.org
>> > > > > +#
>> > > > > +
>> > > > > +# defaults
>> > > > > +ARC_BOARD_NAME="generic"
>> > > > > +ARC_BOARD_MODEL="Generic arc board"
>> > > > > +
>> > > > > +arc_board_detect() {
>> > > > > +   local board
>> > > > > +   local model
>> > > > > +
>> > > > > +   [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
>> > > > > +
>> > > > > +   model="$( cat /proc/device-tree/compatible )"
>> > > > > +
>> > > > > +   # We cannot just use "model" as it is because in case of SDP 
>> > > > > board
>> > > >
>> > > > ePAPR says your dts root nodes must have a "model" property that
>> > > > uniquely identifies the board. I see that is currently missing even in
>> > > > upstream, so please fix your dts files. Then you won't need to grep in
>> > > > the compatible. On a side node, ePAPR also says that the recommended
>> > > > format is the same as compatible but .. *looks at arm* .. apparently
>> > > > nobody does that.
>> > >
>> > > Indeed "model" is a required property.
>> > > So thanks for that suggestion.
>> > >
>> > > Then we'll have:
>> > > >8--
>> > > compatible = "snps,arc-sdp";
>> > > model = "snps,axs101";
>>
>> Grepping through the different arch's dts directories, some arches use
>> compatible like model values (e.g. powerpc), some use free text values
>> (e.g. arm). Might be something discuss worthy for devicetree ML how
>> this spec "violation" should be handled. Especially since the example
>> in Documentation/devicetree/usage-model.txt doesn't have one.
>>
>> > > >8--
>> > > which looks for sure much better!
>> > >
>> > > Will do this for starters here in OpenWRT and will submit a patch 
>> > > upstream
>> > > in Linux kernel.
>> >
>> > I started to think about it and now I understand why we use complicated
>> > "compatible" value.
>> >
>> > This allows us to use multiple platform-specific parts at once.
>> > We use "snps,arc-sdp" here:
>> > http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arc/kernel/devtree.c#n35
>> > and "snps,axs101" here:
>> > http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arc/plat-axs10x/axs10x.c#n464
>> >
>> > In the first case it's not really necessary to use "compatible" node but
>> > it's usage is quite convenient, see we only need to execute this oneliner:
>> > >8--
>> > of_flat_dt_is_compatible(dt_root, "snps,arc-sdp")
>> > >8--
>> >
>> > But if we use "model" node instead we'll need to do:
>> > 1) of_get_property
>> > 2) strcmp
>> >
>> > This is a bit longer, still possible solution.
>> >
>> > So even though your proposal is very useful and I'm going to discuss it
>> > with Vineet Gupta (ARC Linux maintainer) but if you don't mind I'd go
>> > without that change for this submission. Then if your proposal is 
>> > implemented
>> > I'll need to rework OpenWRT scripts anyways because newer upstream kernel
>> > will require that.
>> >
>> > Are you OK with that?
>>
>> My suggestion was only for the model detection script part, not to
>> modify anything in the kernel (apart from adding a model property to
>> the dts files). The kernel should just keep using the compatible
>> property as it properly handles multiple compatible names etc, and it
>> doesn't need to be unique.
>
> So should I just add "model" property in .dts files in OpenWRT and correct
> init scripts? This all without patching kernel itself essentially.

Yes, that is my suggestion. Just add a new model property without
touching any of the other ones.


Jonas

P.S: It's "OpenWrt", not "OpenWRT" ;p
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Enable BPF JIT by default?

2015-11-06 Thread Helmut Schaa
On Thu, Nov 5, 2015 at 5:56 PM, John Crispin  wrote:
> On 05/11/2015 17:54, Helmut Schaa wrote:
>> Since lots of architectures now support BPF JIT would it make sense to
>> enable it by default for all openwrt builds?
>> Any opinions on that?
>
> can you grab some stats so we can compare kernel size on a few targets ?

Just quickly tried mips and x86_64:

On mips:

openwrt-ar71xx-generic-uImage-gzip.bin +4.605 bytes
openwrt-ar71xx-generic-uImage-lzma.bin +2.836 bytes

On x86_64:

openwrt-x86_64-vmlinuz +3.168 Bytes

So kernel size increase is in the ~5K range.
Not sure if this would justify an extra config option or enabling it
by default makes sense.

Performance-wise this change would only matter for BPF usage but on some archs
even BPF JIT for seccomp filters gets accelerated ...

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


Re: [OpenWrt-Devel] Enable BPF JIT by default?

2015-11-06 Thread Felix Fietkau
On 2015-11-06 13:44, Helmut Schaa wrote:
> On Thu, Nov 5, 2015 at 5:56 PM, John Crispin  wrote:
>> On 05/11/2015 17:54, Helmut Schaa wrote:
>>> Since lots of architectures now support BPF JIT would it make sense to
>>> enable it by default for all openwrt builds?
>>> Any opinions on that?
>>
>> can you grab some stats so we can compare kernel size on a few targets ?
> 
> Just quickly tried mips and x86_64:
> 
> On mips:
> 
> openwrt-ar71xx-generic-uImage-gzip.bin +4.605 bytes
> openwrt-ar71xx-generic-uImage-lzma.bin +2.836 bytes
> 
> On x86_64:
> 
> openwrt-x86_64-vmlinuz +3.168 Bytes
> 
> So kernel size increase is in the ~5K range.
> Not sure if this would justify an extra config option or enabling it
> by default makes sense.
> 
> Performance-wise this change would only matter for BPF usage but on some archs
> even BPF JIT for seccomp filters gets accelerated ...
The size increase is small enough, so I think we can simply enable it by
default. Feel free to send a patch.

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


[OpenWrt-Devel] Netifd: are the protocol-based prefixes still needed for interface names?

2015-11-06 Thread Hannu Nyman
Netifd (or the protocol defintions) add a prefix like "br-", "6in4-", 
"pppoe-" etc. to names of interfaces with selected protocols and bridge 
interfaces. Example: 6in4-tunnel interface "sixxs" gets created in the system 
as "6in4-sixxs".

https://dev.openwrt.org/browser/trunk/package/network/ipv6/6in4/files/6in4.sh#L28

That long name is shown e.g. by 'ifconfig' and used by dnsmasq and firewall etc.

To my knowledge, there are at least these prefixes:
br-, 6in4-, 6to4-, 6rd-, ds-, map-, pppoe-, pppoa-

Is that prefix really needed today, or is that just a leftover from 
pre-netifd times?


The question arose in connection with Luci and limiting firewall zone & 
interface name lengths.

Reference to:
https://dev.openwrt.org/ticket/20380
https://github.com/openwrt/luci/issues/507

There is apparently a 15 character limit to the "real" interface name, 
enforced both in the firewall and dnsmasq. The real interface name

includes the possible prefix "br-", "6in4-" etc. Example of an error:
  interface name `br-lan_protected' must be shorter than IFNAMSIZ (15)

Afaik, the limit is coming from Linux itself:
http://lxr.free-electrons.com/source/include/uapi/linux/if.h#L26
   #define IFNAMSIZ 16

The 15-characrater hard limit combined to a possibly 6-character long prefix 
(like "pppoe-") restricts in practice the interface name allowed to the user 
to only 9 characters if that name should work with any protocol. Verifying 
the allowed length (e.g. in Luci GUI) gets unnecessarily difficult, if the 
protocol causes this kind of huge impact. The easy approach would be to 
restrict the name to the "guaranteed to work with any protocol" length, = 9 
characters.


I question if that prefix is really needed and used for something?
Or could we drop that practice and just leave the interface names to those 
that the user has configured?

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


[OpenWrt-Devel] STAGING_DIR vs. --sysroot

2015-11-06 Thread Rüdiger , Christoph
Hi folks,

I'm wondering a bit why the OpenWrt toolchains rely on a set STAGING_DIR 
environment variable. I haven't found any documentation on this except "You 
have to set it". Examining the source tree of gcc didn't show me any 
STAGING_DIR occurrence. It seems to be used only in the specs file. And from 
examining these, I get the feeling that the STAGING_DIR environment variable is 
used to work around or against the sysroot setting.

As the OpenWrt SDK is the first gcc I've worked with that rely on a command 
line variable, my question is: Why did OpenWrt introduced this (uncommon?) 
extension instead of an additional command line argument?

The STAGING_DIR env variable makes it difficult to work with in build systems 
like cmake where you have to give a toolchain file with the compiler flags and 
paths and have to set the environment variable for each build.

Regards,
Christoph

-- 
ThyssenKrupp Elevator Innovation GmbH
PDC Neuhausen
TKEI Elevator Control
Bernhaeuser Straße 45
73765 Neuhausen, Germany

Phone +49 7158 12-2615
christoph.ruedi...@thyssenkrupp.com

Company domicile: Essen  Commercial register: Essen HRB 20 839
Postal address: ThyssenKrupp Allee 1, 45143 Essen, Germany 
Executive Board: Gerhard Thumm, Katrin Huenger, Philippe Choleau


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


Re: [OpenWrt-Devel] STAGING_DIR vs. --sysroot

2015-11-06 Thread Felix Fietkau
On 2015-11-06 15:24, Rüdiger, Christoph wrote:
> Hi folks,
> 
> I'm wondering a bit why the OpenWrt toolchains rely on a set
> STAGING_DIR environment variable. I haven't found any documentation on
> this except "You have to set it". Examining the source tree of gcc
> didn't show me any STAGING_DIR occurrence. It seems to be used only in
> the specs file. And from examining these, I get the feeling that the
> STAGING_DIR environment variable is used to work around or against the
> sysroot setting.
> 
> As the OpenWrt SDK is the first gcc I've worked with that rely on a
> command line variable, my question is: Why did OpenWrt introduced this
> (uncommon?) extension instead of an additional command line argument?
Our use of the extra variable comes from the fact that we separate the
toolchain path from the path where packages install their headers and
library files. I think most other build systems don't do that.

I think if we were to override the sysroot and set it to
$STAGING_DIR/usr, gcc would probably not find the include files from
$TOOLCHAIN_DIR anymore.

For testing, I just removed the specs file override and tried to build a
normal binary with sysroot pointing to $STAGING_DIR, and it did not even
find the header files from there.

> The STAGING_DIR env variable makes it difficult to work with in
> build systems like cmake where you have to give a toolchain file with the
> compiler flags and paths and have to set the environment variable for
> each build.
I think most people don't bother with that and just use the normal
OpenWrt build system commands instead of running make in the package
build directories directly.

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


[OpenWrt-Devel] [PATCH v3 1/2] include/image.mk: Introduce generic option to wrap kernel into JFFS2

2015-11-06 Thread Benjamin Berg
Some devices require the kernel to be in a JFFS2 file system. Make the
support for this more generic so that it can be used by other devices.

Signed-off-by: Benjamin Berg 
---
 include/image.mk   | 15 +++
 target/linux/ar71xx/image/Makefile | 19 +++
 2 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/include/image.mk b/include/image.mk
index 43980bc..753bd48 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -347,6 +347,21 @@ define Build/gzip
@mv $@.new $@
 endef
 
+define Build/jffs2
+   rm -rf $(KDIR_TMP)/$(DEVICE_NAME)/jffs2 && \
+   mkdir -p $(KDIR_TMP)/$(DEVICE_NAME)/jffs2/$$(dirname $(1)) && \
+   cp $@ $(KDIR_TMP)/$(DEVICE_NAME)/jffs2/$(1) && \
+   $(STAGING_DIR_HOST)/bin/mkfs.jffs2 --pad \
+   $(if $(CONFIG_BIG_ENDIAN),--big-endian,--little-endian) 
\
+   --squash-uids -v -e $(patsubst %k,%KiB,$(BLOCKSIZE)) \
+   -o $@.new \
+   -d $(KDIR_TMP)/$(DEVICE_NAME)/jffs2 \
+   2>&1 1>/dev/null | awk '/^.+/' && \
+   $(STAGING_DIR_HOST)/bin/padjffs2 $@.new -J $(patsubst 
%k,,$(BLOCKSIZE))
+   -rm -rf $(KDIR_TMP)/$(DEVICE_NAME)/jffs2/
+   @mv $@.new $@
+endef
+
 define Build/kernel-bin
rm -f $@
cp $^ $@
diff --git a/target/linux/ar71xx/image/Makefile 
b/target/linux/ar71xx/image/Makefile
index 7bf2f27..15cf2c6 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -140,20 +140,6 @@ endef
 
 DEVICE_VARS += UBNT_BOARD UBNT_CHIP UBNT_TYPE
 
-define Build/mkubntkernelimage
-   rm -rf $(KDIR_TMP)/ubnt-$(KERNEL_IMAGE)/image && \
-   mkdir -p $(KDIR_TMP)/ubnt-$(KERNEL_IMAGE)/image && \
-   cp $@ $(KDIR_TMP)/ubnt-$(KERNEL_IMAGE)/image/kernel0 && \
-   $(STAGING_DIR_HOST)/bin/mkfs.jffs2 \
-   --pad --big-endian --squash-uids -v -e 64KiB \
-   -o $@.new \
-   -d $(KDIR_TMP)/ubnt-$(KERNEL_IMAGE)/image \
-   2>&1 && \
-   $(STAGING_DIR_HOST)/bin/padjffs2 $@.new -J 64
-   -rm -rf $(KDIR_TMP)/ubnt-$(KERNEL_IMAGE)/image
-   @mv $@.new $@
-endef
-
 define Device/Default
   BOARDNAME :=
   DEVICE_PROFILE = $$(BOARDNAME)
@@ -1135,15 +1121,16 @@ endef
 TARGET_DEVICES += ubnt-rs ubnt-rspro ubnt-ls-sr71
 
 define Device/ubnt-uap-pro
+  KERNEL_SIZE := 1536k
   IMAGE_SIZE := 15744k
   MTDPARTS := 
spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1536k(kernel),14208k(rootfs),256k(cfg)ro,64k(EEPROM)ro,15744k@0x5(firmware)
   UBNT_TYPE := BZ
   UBNT_CHIP := ar934x
   BOARDNAME := UAP-PRO
   DEVICE_PROFILE := UBNT UAPPRO
-  KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma | mkubntkernelimage
+  KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma | jffs2 kernel0
   IMAGES := sysupgrade.bin factory.bin
-  IMAGE/sysupgrade.bin = append-kernel 1536k | append-rootfs | pad-rootfs | 
check-size (IMAGE_SIZE)
+  IMAGE/sysupgrade.bin = append-kernel (KERNEL_SIZE) | append-rootfs | 
pad-rootfs | check-size (IMAGE_SIZE)
   IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage2
 endef
 
-- 
2.6.2
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v3 2/2] ar71xx: Add support for ZyXEL NBG6616.

2015-11-06 Thread Benjamin Berg
Signed-off-by: Benjamin Berg 
---
 target/linux/ar71xx/base-files/etc/diag.sh |   5 +-
 .../etc/hotplug.d/firmware/11-ath10k-caldata   |   2 +
 .../ar71xx/base-files/etc/uci-defaults/01_leds |  17 ++-
 .../ar71xx/base-files/etc/uci-defaults/02_network  |   1 +
 target/linux/ar71xx/base-files/lib/ar71xx.sh   |   3 +
 .../ar71xx/base-files/lib/upgrade/platform.sh  |   1 +
 .../ar71xx/files/arch/mips/ath79/mach-nbg6716.c| 141 ++---
 target/linux/ar71xx/generic/profiles/zyxel.mk  |  12 ++
 target/linux/ar71xx/image/Makefile |  33 +
 .../700-MIPS-ath79-openwrt-machines.patch  |   5 +-
 10 files changed, 194 insertions(+), 26 deletions(-)

diff --git a/target/linux/ar71xx/base-files/etc/diag.sh 
b/target/linux/ar71xx/base-files/etc/diag.sh
index 1375f38..2f489d8 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -173,8 +173,11 @@ get_status_led() {
nbg460n_550n_550nh)
status_led="nbg460n:green:power"
;;
+   nbg6616)
+   status_led="nbg6616:green:power"
+   ;;
nbg6716)
-   status_led="zyxel:white:power"
+   status_led="nbg6716:white:power"
;;
om2p | \
om2pv2 | \
diff --git 
a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata 
b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index f53c853..74c3417 100644
--- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -84,8 +84,10 @@ case "$FIRMWARE" in
ath10kcal_extract "art" 20480 2116
ath10kcal_patch_mac $(macaddr_add $(cat 
/sys/class/net/eth1/address) -2)
;;
+   nbg6616 | \
nbg6716)
ath10kcal_extract "RFdata" 20480 2116
+   ath10kcal_patch_mac $(macaddr_add $(cat 
/sys/class/net/eth1/address) -2)
;;
rb-911g-5hpacd)
ath10kcal_from_file "/sys/firmware/routerboot/ext_wlan_data" 
20480 2116
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds 
b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
index abed456..b269181 100644
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
@@ -306,12 +306,19 @@ nbg460n_550n_550nh)
ucidef_set_led_wlan "wlan" "WLAN" "nbg460n:green:wlan" "phy0tpt"
;;
 
+nbg6616)
+   ucidef_set_led_wlan "wlan" "WLAN" "nbg6616:green:wifi2g" "phy1tpt"
+   ucidef_set_led_wlan "wlan5" "WLAN5" "nbg6616:green:wifi5g" "phy0tpt"
+   ucidef_set_led_usbdev "usb1" "USB1" "nbg6616:green:usb1" "1-1"
+   ucidef_set_led_usbdev "usb2" "USB2" "nbg6616:green:usb2" "2-1"
+   ;;
+
 nbg6716)
-   ucidef_set_led_netdev "wan" "WAN" "zyxel:white:internet" "eth1"
-   ucidef_set_led_wlan "wlan" "WLAN" "zyxel:white:wifi2g" "phy1tpt"
-   ucidef_set_led_wlan "wlan5" "WLAN5" "zyxel:white:wifi5g" "phy0tpt"
-   ucidef_set_led_usbdev "usb1" "USB1" "zyxel:white:usb1" "2-1"
-   ucidef_set_led_usbdev "usb2" "USB2" "zyxel:white:usb2" "1-1"
+   ucidef_set_led_netdev "wan" "WAN" "nbg6716:white:internet" "eth1"
+   ucidef_set_led_wlan "wlan" "WLAN" "nbg6716:white:wifi2g" "phy1tpt"
+   ucidef_set_led_wlan "wlan5" "WLAN5" "nbg6716:white:wifi5g" "phy0tpt"
+   ucidef_set_led_usbdev "usb1" "USB1" "nbg6716:white:usb1" "1-1"
+   ucidef_set_led_usbdev "usb2" "USB2" "nbg6716:white:usb2" "2-1"
;;
 
 om2p | \
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network 
b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
index f6ac891..5e93835 100644
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -134,6 +134,7 @@ nbg460n_550n_550nh)
ucidef_add_switch_vlan "switch0" "0" "0 1 2 3 5"
;;
 
+nbg6616 |\
 nbg6716)
ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
ucidef_add_switch "switch0" "1" "1"
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 5f02e4e..2fdc538 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -565,6 +565,9 @@ ar71xx_board_detect() {
*"NBG460N/550N/550NH")
name="nbg460n_550n_550nh"
;;
+   *"Zyxel NBG6616")
+   name="nbg6616"
+   ;;
*"Zyxel NBG6716")
name="nbg6716"
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh 
b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index a464fee..ae498b9 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/p

[OpenWrt-Devel] [PATCH v3 0/2] Patches to add support fo rNBG6616

2015-11-06 Thread Benjamin Berg
Hi,

so here another iteration of the patches. The biggest change is to use
paddjffs2 for the kernel image as suggested by Felix and to move other
boards to use the same mechanism to build the kernel.

Other than that, just a tiny bugfix to include usb trigger support.

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


Re: [OpenWrt-Devel] [PATCH v3 1/2] include/image.mk: Introduce generic option to wrap kernel into JFFS2

2015-11-06 Thread Felix Fietkau
On 2015-11-06 17:25, Benjamin Berg wrote:
> Some devices require the kernel to be in a JFFS2 file system. Make the
> support for this more generic so that it can be used by other devices.
> 
> Signed-off-by: Benjamin Berg 
> ---
>  include/image.mk   | 15 +++
>  target/linux/ar71xx/image/Makefile | 19 +++
>  2 files changed, 18 insertions(+), 16 deletions(-)
> 
> diff --git a/include/image.mk b/include/image.mk
> index 43980bc..753bd48 100644
> --- a/include/image.mk
> +++ b/include/image.mk
> @@ -1135,15 +1121,16 @@ endef
>  TARGET_DEVICES += ubnt-rs ubnt-rspro ubnt-ls-sr71
>  
>  define Device/ubnt-uap-pro
> +  KERNEL_SIZE := 1536k
>IMAGE_SIZE := 15744k
>MTDPARTS := 
> spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1536k(kernel),14208k(rootfs),256k(cfg)ro,64k(EEPROM)ro,15744k@0x5(firmware)
>UBNT_TYPE := BZ
>UBNT_CHIP := ar934x
>BOARDNAME := UAP-PRO
>DEVICE_PROFILE := UBNT UAPPRO
> -  KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma | 
> mkubntkernelimage
> +  KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma | jffs2 kernel0
>IMAGES := sysupgrade.bin factory.bin
> -  IMAGE/sysupgrade.bin = append-kernel 1536k | append-rootfs | pad-rootfs | 
> check-size (IMAGE_SIZE)
> +  IMAGE/sysupgrade.bin = append-kernel (KERNEL_SIZE) | append-rootfs | 
> pad-rootfs | check-size (IMAGE_SIZE)
>IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage2
>  endef
Why did you add the KERNEL_SIZE variable here if you only use it in one
place?

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


Re: [OpenWrt-Devel] [PATCH v3 1/2] include/image.mk: Introduce generic option to wrap kernel into JFFS2

2015-11-06 Thread Benjamin Berg
On Fr, 2015-11-06 at 17:46 +0100, Felix Fietkau wrote:
> On 2015-11-06 17:25, Benjamin Berg wrote:
> > Some devices require the kernel to be in a JFFS2 file system. Make the
> > support for this more generic so that it can be used by other devices.
> > 
> > Signed-off-by: Benjamin Berg 
> > ---
> >  include/image.mk   | 15 +++
> >  target/linux/ar71xx/image/Makefile | 19 +++
> >  2 files changed, 18 insertions(+), 16 deletions(-)
> > 
> > diff --git a/include/image.mk b/include/image.mk
> > index 43980bc..753bd48 100644
> > --- a/include/image.mk
> > +++ b/include/image.mk
> > @@ -1135,15 +1121,16 @@ endef
> >  TARGET_DEVICES += ubnt-rs ubnt-rspro ubnt-ls-sr71
> >  
> >  define Device/ubnt-uap-pro
> > +  KERNEL_SIZE := 1536k
> >    IMAGE_SIZE := 15744k
> >    MTDPARTS := 
> > spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1536k(kernel),14208k(rootfs),256k(cfg)ro,64k(EEPROM)ro,15744k@0x5(firmware)
> >    UBNT_TYPE := BZ
> >    UBNT_CHIP := ar934x
> >    BOARDNAME := UAP-PRO
> >    DEVICE_PROFILE := UBNT UAPPRO
> > -  KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma | 
> > mkubntkernelimage
> > +  KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma | jffs2 kernel0
> >    IMAGES := sysupgrade.bin factory.bin
> > -  IMAGE/sysupgrade.bin = append-kernel 1536k | append-rootfs | pad-rootfs 
> > | check-size (IMAGE_SIZE)
> > +  IMAGE/sysupgrade.bin = append-kernel (KERNEL_SIZE) | append-rootfs | 
> > pad-rootfs | check-size (IMAGE_SIZE)
> >    IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage2
> >  endef
> Why did you add the KERNEL_SIZE variable here if you only use it in one
> place?

As I understand it the "Device/Build/kernel" define will check that the
kernel fits into KERNEL_SIZE if the variable is set. So while this is a
relatively unrelated change it should help to catch issues.

Benjamin

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


[OpenWrt-Devel] [PATCH] ramips: minor fixes for mt7621 profiles

2015-11-06 Thread Daniel Golle
 * remove references to non-existing kmod-usb3-mt7621
 * ZTB WG2626 doesn't have an RTC (thanks to Piotr Dymacz!)

Signed-off-by: Daniel Golle 
---
 target/linux/ramips/mt7621/profiles/misc.mk | 2 +-
 target/linux/ramips/mt7621/profiles/zbt.mk  | 4 +---
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/target/linux/ramips/mt7621/profiles/misc.mk 
b/target/linux/ramips/mt7621/profiles/misc.mk
index 9db0cd5..ee25b95 100644
--- a/target/linux/ramips/mt7621/profiles/misc.mk
+++ b/target/linux/ramips/mt7621/profiles/misc.mk
@@ -11,7 +11,7 @@ define Profile/PBR-M1
PACKAGES:=\
kmod-usb-core kmod-usb3 kmod-usb-hid kmod-sdhci-mt7620 \
kmod-ledtrig-usbdev kmod-ata-core kmod-ata-ahci \
-   kmod-usb3-mt7621 kmod-rtc-pcf8563
+   kmod-rtc-pcf8563
 endef
 
 define Profile/PBR-M1/Description
diff --git a/target/linux/ramips/mt7621/profiles/zbt.mk 
b/target/linux/ramips/mt7621/profiles/zbt.mk
index 0134bb5..07131d1 100644
--- a/target/linux/ramips/mt7621/profiles/zbt.mk
+++ b/target/linux/ramips/mt7621/profiles/zbt.mk
@@ -7,11 +7,9 @@
 
 define Profile/ZBT-WG2626
NAME:=ZBT-WG2626 Device
-   FEATURES+=rtc
PACKAGES:=\
kmod-usb-core kmod-usb3 kmod-sdhci-mt7620 \
-   kmod-ledtrig-usbdev kmod-ata-core kmod-ata-ahci \
-   kmod-usb3-mt7621
+   kmod-ledtrig-usbdev kmod-ata-core kmod-ata-ahci
 endef
 
 define Profile/ZBT-WG2626/Description
-- 
2.6.2
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 0/2] imx6: Ventana: add nand squashfs+ubifs support

2015-11-06 Thread Tim Harvey
This series adds NAND ubi squqashfs+ubifs support for the Gateworks Ventana
boards.

Tim Harvey (2):
  imx6: kernel: add UBI_BLOCK support
  imx6: convert ventana images to squashfs+ubifs overlay

 target/linux/imx6/config-4.1|   2 +-
 target/linux/imx6/image/Makefile| 217 
 target/linux/imx6/image/bootscript-ventana  | 150 +++
 target/linux/imx6/image/ubinize-ventana.cfg |  37 +
 4 files changed, 284 insertions(+), 122 deletions(-)
 create mode 100644 target/linux/imx6/image/bootscript-ventana
 create mode 100644 target/linux/imx6/image/ubinize-ventana.cfg

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


[OpenWrt-Devel] [PATCH 1/2] imx6: kernel: add UBI_BLOCK support

2015-11-06 Thread Tim Harvey
UBI_BLOCK support is needed for mounting squashfs over UBI

Signed-off-by: Tim Harvey 
---
 target/linux/imx6/config-4.1 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/imx6/config-4.1 b/target/linux/imx6/config-4.1
index 18a26d6..52544a7 100644
--- a/target/linux/imx6/config-4.1
+++ b/target/linux/imx6/config-4.1
@@ -241,7 +241,7 @@ CONFIG_MTD_NAND_GPMI_NAND=y
 # CONFIG_MTD_PHYSMAP_OF is not set
 CONFIG_MTD_UBI=y
 CONFIG_MTD_UBI_BEB_LIMIT=20
-# CONFIG_MTD_UBI_BLOCK is not set
+CONFIG_MTD_UBI_BLOCK=y
 # CONFIG_MTD_UBI_FASTMAP is not set
 # CONFIG_MTD_UBI_GLUEBI is not set
 CONFIG_MTD_UBI_WL_THRESHOLD=4096
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 2/2] imx6: convert ventana images to squashfs+ubifs overlay

2015-11-06 Thread Tim Harvey
Replace the ventana ubi images from a single rootfs volume containing the
rootfs as well as kernel+dtbs in the boot/ subdir to a multi-volume ubi
containing kernel+dtbs+bootscript in 'root' ubifs volume, rootfs in 'rootfs'
squasfs volume, and rootfs_data an empty ubifs volume.

At the same time move ventana image creation over to using the new
TARGET_DEVICE syntax as a cleanup.

Additionally removed FIT image creation as it is recommended that this be
done manually to produce signed FIT images if needed.

Note that a bootscript is needed for Ventana to change its default mtdparts
to rename the 2nd partition from 'rootfs' to 'ubi'. This is because there
are patches in OpenWrt kernels that try to auto-attach and auto-mount and these
get in the way if the mtd partition is named 'rootfs'.

Signed-off-by: Tim Harvey 
---
 target/linux/imx6/image/Makefile| 217 
 target/linux/imx6/image/bootscript-ventana  | 150 +++
 target/linux/imx6/image/ubinize-ventana.cfg |  37 +
 3 files changed, 283 insertions(+), 121 deletions(-)
 create mode 100644 target/linux/imx6/image/bootscript-ventana
 create mode 100644 target/linux/imx6/image/ubinize-ventana.cfg

diff --git a/target/linux/imx6/image/Makefile b/target/linux/imx6/image/Makefile
index 3381473..a552ac6 100644
--- a/target/linux/imx6/image/Makefile
+++ b/target/linux/imx6/image/Makefile
@@ -7,135 +7,110 @@
 include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/image.mk
 
-define sanitize_profile_name
-$(shell echo $(PROFILE) | tr '[:upper:]' '[:lower:]' | sed 's/_/-/g')
-endef
-
-define Image/BuildKernel/Template
-
- ifneq ($(1),)
-   $(CP) $(DTS_DIR)/$(1).dtb $(BIN_DIR)/$(IMG_PREFIX)-$(1).dtb
-
-   $(call 
Image/BuildKernel/MkFIT,$(1),$(KDIR)/zImage,$(BIN_DIR)/$(IMG_PREFIX)-$(1).dtb,none,0x10008000,0x10008000)
-   $(CP) $(KDIR)/fit-$(1).itb $(BIN_DIR)/$(IMG_PREFIX)-$(1)-fit-uImage.itb
-
-  ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
-   $(call 
Image/BuildKernel/MkFIT,$(1),$(KDIR)/zImage-initramfs,$(BIN_DIR)/$(IMG_PREFIX)-$(1).dtb,none,0x10008000,0x10008000,-initramfs)
-   $(CP) $(KDIR)/fit-$(1)-initramfs.itb 
$(BIN_DIR)/$(IMG_PREFIX)-$(1)-fit-uImage-initramfs.itb
-  endif
- endif
-
-   $(CP) $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-zImage
-   $(call Image/BuildKernel/MkuImage, \
-   none, 0x10008000, 0x10008000, \
-   $(BIN_DIR)/$(IMG_PREFIX)-zImage, \
-   $(BIN_DIR)/$(IMG_PREFIX)-uImage \
-   )
-
- ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
-   $(CP) $(KDIR)/zImage-initramfs $(BIN_DIR)/$(IMG_PREFIX)-zImage-initramfs
-   $(call Image/BuildKernel/MkuImage, \
-   none, 0x10008000, 0x10008000, \
-   $(BIN_DIR)/$(IMG_PREFIX)-zImage-initramfs, \
-   $(BIN_DIR)/$(IMG_PREFIX)-uImage-initramfs \
-   )
- endif
-endef
-
-define Image/InstallKernel/Template
-
- ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_KERNEL)$(CONFIG_TARGET_imx6_VENTANA),)
-   $(INSTALL_DIR) $(TARGET_DIR)/boot
-   ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_UIMAGE)$(CONFIG_TARGET_imx6_VENTANA),)
-   $(CP) $(BIN_DIR)/$(IMG_PREFIX)-uImage $(TARGET_DIR)/boot/
-   ln -sf $(IMG_PREFIX)-uImage $(TARGET_DIR)/boot/uImage
-   endif
-   ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_ZIMAGE),)
-   $(CP) $(BIN_DIR)/$(IMG_PREFIX)-zImage $(TARGET_DIR)/boot/
-   ln -sf $(IMG_PREFIX)-zImage $(TARGET_DIR)/boot/zImage
-   endif
-   ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_FIT),)
-   $(foreach dts,$(shell echo $(1)), \
-   $(CP) $(BIN_DIR)/$(IMG_PREFIX)-$(dts)-fit-uImage.itb 
$(TARGET_DIR)/boot/
+#
+# Images
+#
+
+# build a ubi for a specific flash geometry/layout which can contain
+# volumes with the following data from ubinize-$(DEVICE_NAME).cfg:
+#   - 'boot.ubifs' volume: kernel+dtbs+bootscript
+#   - 'root.squashfs' volume: rootfs
+# $(1): name (used for suffix)
+# $(2): PAGESIZE (-m param to mkfs.ubifs/ubinize)
+# $(3): ERASESIZE (logical eraseblock size: -e param to mkfs.ubifs)
+# $(4): BLOCKSIZE (-p param to ubinize)
+# $(5): MAXSIZE (maximum file-system size in LEB's -c param to mkfs.ubifs)
+#
+define Build/ubi-boot-overlay
+   # ubi-boot-overlay $(DEVICE_NAME) $(word 1, $(1))
+
+   # boot filesystem
+   rm -rf $(TARGET_ROOTFS_DIR)/boot-$(DEVICE_NAME)_$(word 1, $(1))
+   mkdir -p $(TARGET_ROOTFS_DIR)/boot-$(DEVICE_NAME)_$(word 1, $(1))
+   $(CP) $< $(TARGET_ROOTFS_DIR)/boot-$(DEVICE_NAME)_$(word 1, 
$(1))/$(IMG_PREFIX)-uImage
+   ln -sf $(IMG_PREFIX)-uImage \
+   $(TARGET_ROOTFS_DIR)/boot-$(DEVICE_NAME)_$(word 1, $(1))/uImage
+   $(foreach dts,$(shell echo $(DEVICE_DTS)), \
+   $(CP) $(LINUX_DIR)/arch/$(ARCH)/boot/dts/$(dts).dtb \
+   $(BIN_DIR)/$(IMG_PREFIX)-$(dts).dtb; \
+   $(CP) $(LINUX_DIR)/arch/$(ARCH)/boot/dts/$(dts).dtb \
+   $(TARGE

[OpenWrt-Devel] [PATCH] CC: ramips: Backport support for ZBT WG2626

2015-11-06 Thread L. D. Pinney
Backport of r47351

Signed-off-by: L. D. Pinney 
---
 target/linux/ramips/base-files/etc/board.d/01_leds |   5 +++
 target/linux/ramips/base-files/etc/board.d/02_network  |   3 +-
 target/linux/ramips/base-files/etc/diag.sh |   3 ++
 target/linux/ramips/base-files/lib/ramips.sh   |   3 ++
 target/linux/ramips/base-files/lib/upgrade/platform.sh |   5 +--
 target/linux/ramips/dts/ZBT-WG2626.dts | 127 
+
 target/linux/ramips/image/Makefile |   7 +++-
 target/linux/ramips/mt7621/profiles/zbt.mk |  19 +++
 8 files changed, 168 insertions(+), 4 deletions(-)

diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds 
b/target/linux/ramips/base-files/etc/board.d/01_leds
index 545bd70..5946f98 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -258,6 +258,11 @@ case $board in
set_usb_led "lenovo:blue:usb"
set_wifi_led "lenovo:blue:wifi"
;;
+   zbt-wg2626)
+   ucidef_set_led_default "power" "power" "zbt-wg2626:green:power" 
"1"
+   set_wifi_led "zbt-wg2626:green:air"
+   set_usb_led "zbt-wg2626:green:usb"
+   ;;
zte-q7)
set_wifi_led "zte:blue:status"
;;
diff --git a/target/linux/ramips/base-files/etc/board.d/02_network 
b/target/linux/ramips/base-files/etc/board.d/02_network
index 19ef3f7..d7d016b 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -145,7 +145,8 @@ ramips_setup_interfaces()
wsr-1166 | \
wt1520 | \
xiaomi-miwifi-mini |\
-   y1)
+   y1|\
+   zbt-wg2626)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1"
ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
diff --git a/target/linux/ramips/base-files/etc/diag.sh 
b/target/linux/ramips/base-files/etc/diag.sh
index d32d692..0747d70 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -247,6 +247,9 @@ get_status_led() {
y1s)
status_led="lenovo:blue:power"
;;
+   zbt-wg2626)
+   status_led="zbt-wg2626:green:power"
+   ;;
zte-q7)
status_led="zte:red:status"
;;
diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
b/target/linux/ramips/base-files/lib/ramips.sh
index 70f22a7..e4276d9 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -403,6 +403,9 @@ ramips_board_detect() {
*"Zbtlink ZBT-WA05")
name="zbt-wa05"
;;
+   *"ZBT-WG2626")
+   name="zbt-wg2626"
+   ;;
*"ZBT WR8305RT")
name="wr8305rt"
;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh 
b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 11fee85..2f64d8c 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -126,8 +126,9 @@ platform_check_image() {
xiaomi-miwifi-mini |\
y1 |\
y1s |\
-   zte-q7 |\
-   zbt-wa05)
+   zbt-wa05 |\
+   zbt-wg2626 |\
+   zte-q7)
[ "$magic" != "27051956" ] && {
echo "Invalid image type."
return 1
diff --git a/target/linux/ramips/dts/ZBT-WG2626.dts 
b/target/linux/ramips/dts/ZBT-WG2626.dts
new file mode 100644
index 000..6170454
--- /dev/null
+++ b/target/linux/ramips/dts/ZBT-WG2626.dts
@@ -0,0 +1,127 @@
+/dts-v1/;
+
+/include/ "mt7621.dtsi"
+
+/ {
+   compatible = "mediatek,mt7621-eval-board", "mediatek,mt7621-soc";
+   model = "ZBT-WG2626";
+
+   memory@0 {
+   device_type = "memory";
+   reg = <0x0 0x1c00>, <0x2000 0x400>;
+   };
+
+   chosen {
+   bootargs = "console=ttyS0,57600";
+   };
+
+   sdhci@1013 {
+   status = "okay";
+   };
+
+   palmbus@1E00 {
+   spi@b00 {
+   status = "okay";
+
+   m25p80@0 {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   compatible = "w25q128";
+   reg = <0 0>;
+   linux,modalias = "m25p80";
+   spi-max-frequency = <1000>;
+
+   partition@0 {
+   label = "u-boot";
+   reg = <0x0 0x3>;
+  

[OpenWrt-Devel] [PATCH 0/7] kirkwood: revamp Linksys EA3500 & EA4500 support

2015-11-06 Thread Claudio Leite
This patch set reworks support for the Linksys EA3500 and EA4500,
integrating significant amounts of code from the WRT1900AC port.

Previously these two routers were supported by flashing from the
bootloader and setting new boot commands. They can now be flashed
from the Linksys factory firmware and upgraded from within OpenWrt.
This also adds support for the Linksys dual-image firmware layout
and recovery mechanism.

These patches also transition from a single read-write UBIFS to
squashfs on UBI + UBIFS overlay.

Claudio Leite (7):
  kirkwood: enable squashfs-on-ubiblock support
  kirkwood: match factory partitions on EA[34]500
  kirkwood: find active Linksys root partition
  kirkwood: generate factory images for Linksys EA[34]500
  kirkwood: support Linksys boot counter on EA[34]500
  kirkwood: support sysupgrade on Linksys EA[34]500
  kirkwood: add diag LED on Linksys EA3500

 package/boot/uboot-envtools/files/kirkwood |  2 +-
 package/system/mtd/src/Makefile|  1 +
 target/linux/kirkwood/Makefile |  2 +-
 target/linux/kirkwood/base-files/etc/diag.sh   |  3 +
 .../base-files/etc/init.d/linksys_recovery | 20 ++
 .../kirkwood/base-files/lib/upgrade/linksys.sh | 79 ++
 .../kirkwood/base-files/lib/upgrade/platform.sh| 32 +
 target/linux/kirkwood/config-3.18  |  3 +-
 target/linux/kirkwood/config-4.3   |  3 +-
 target/linux/kirkwood/image/Makefile   | 45 ++--
 .../patches-3.18/100-find_active_root.patch| 61 +
 .../linux/kirkwood/patches-3.18/160-ea4500.patch   | 36 +++---
 .../linux/kirkwood/patches-3.18/170-ea3500.patch   | 39 ---
 .../patches-4.3/100-find_active_root.patch | 61 +
 target/linux/kirkwood/patches-4.3/140-ea4500.patch | 36 +++---
 target/linux/kirkwood/patches-4.3/150-ea3500.patch | 39 ---
 16 files changed, 416 insertions(+), 46 deletions(-)
 create mode 100755 target/linux/kirkwood/base-files/etc/init.d/linksys_recovery
 create mode 100644 target/linux/kirkwood/base-files/lib/upgrade/linksys.sh
 create mode 100644 target/linux/kirkwood/base-files/lib/upgrade/platform.sh
 create mode 100644 
target/linux/kirkwood/patches-3.18/100-find_active_root.patch
 create mode 100644 target/linux/kirkwood/patches-4.3/100-find_active_root.patch

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


[OpenWrt-Devel] [PATCH 1/7] kirkwood: enable squashfs-on-ubiblock support

2015-11-06 Thread Claudio Leite
Signed-off-by: Claudio Leite 
---
 target/linux/kirkwood/Makefile| 2 +-
 target/linux/kirkwood/config-3.18 | 2 +-
 target/linux/kirkwood/config-4.3  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/target/linux/kirkwood/Makefile b/target/linux/kirkwood/Makefile
index 2fe1c84..2db7e39 100644
--- a/target/linux/kirkwood/Makefile
+++ b/target/linux/kirkwood/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 ARCH:=arm
 BOARD:=kirkwood
 BOARDNAME:=Marvell Kirkwood
-FEATURES:=targz usb jffs2_nand nand ubifs
+FEATURES:=targz usb jffs2_nand nand ubifs squashfs
 CPU_TYPE:=xscale
 MAINTAINER:=Luka Perkov 
 
diff --git a/target/linux/kirkwood/config-3.18 
b/target/linux/kirkwood/config-3.18
index f488e9b..b936ba9 100644
--- a/target/linux/kirkwood/config-3.18
+++ b/target/linux/kirkwood/config-3.18
@@ -203,7 +203,7 @@ CONFIG_MTD_NAND_ECC=y
 CONFIG_MTD_NAND_ORION=y
 CONFIG_MTD_UBI=y
 CONFIG_MTD_UBI_BEB_LIMIT=20
-# CONFIG_MTD_UBI_BLOCK is not set
+CONFIG_MTD_UBI_BLOCK=y
 # CONFIG_MTD_UBI_FASTMAP is not set
 # CONFIG_MTD_UBI_GLUEBI is not set
 CONFIG_MTD_UBI_WL_THRESHOLD=4096
diff --git a/target/linux/kirkwood/config-4.3 b/target/linux/kirkwood/config-4.3
index f9ff602..86eace5 100644
--- a/target/linux/kirkwood/config-4.3
+++ b/target/linux/kirkwood/config-4.3
@@ -211,7 +211,7 @@ CONFIG_MTD_NAND_ECC=y
 CONFIG_MTD_NAND_ORION=y
 CONFIG_MTD_UBI=y
 CONFIG_MTD_UBI_BEB_LIMIT=20
-# CONFIG_MTD_UBI_BLOCK is not set
+CONFIG_MTD_UBI_BLOCK=y
 # CONFIG_MTD_UBI_FASTMAP is not set
 # CONFIG_MTD_UBI_GLUEBI is not set
 CONFIG_MTD_UBI_WL_THRESHOLD=4096
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 2/7] kirkwood: match factory partitions on EA[34]500

2015-11-06 Thread Claudio Leite
Linksys uses a dual firmware layout, where the bootloader
will switch to the other stored image when one fails to
boot three consecutive times.

In order to make this firmware compatible with the factory
images and the stock bootloader we must match this layout.

Signed-off-by: Claudio Leite 
---
 package/boot/uboot-envtools/files/kirkwood |  2 +-
 .../linux/kirkwood/patches-3.18/160-ea4500.patch   | 36 +++-
 .../linux/kirkwood/patches-3.18/170-ea3500.patch   | 39 --
 target/linux/kirkwood/patches-4.3/140-ea4500.patch | 36 +++-
 target/linux/kirkwood/patches-4.3/150-ea3500.patch | 39 --
 5 files changed, 115 insertions(+), 37 deletions(-)

diff --git a/package/boot/uboot-envtools/files/kirkwood 
b/package/boot/uboot-envtools/files/kirkwood
index 98f85da..1066371 100644
--- a/package/boot/uboot-envtools/files/kirkwood
+++ b/package/boot/uboot-envtools/files/kirkwood
@@ -15,7 +15,7 @@ board=$(kirkwood_board_name)
 
 case "$board" in
 "ea3500")
-   ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x4000" "0x2"
+   ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x4000" "0x4000"
;;
 "ea4500" | \
 "guruplug-server-plus" | \
diff --git a/target/linux/kirkwood/patches-3.18/160-ea4500.patch 
b/target/linux/kirkwood/patches-3.18/160-ea4500.patch
index 386b5ea..9027070 100644
--- a/target/linux/kirkwood/patches-3.18/160-ea4500.patch
+++ b/target/linux/kirkwood/patches-3.18/160-ea4500.patch
@@ -10,7 +10,7 @@
kirkwood-ib62x0.dtb \
 --- /dev/null
 +++ b/arch/arm/boot/dts/kirkwood-ea4500.dts
-@@ -0,0 +1,167 @@
+@@ -0,0 +1,187 @@
 +/*
 + * kirkwood-ea4500.dts - Device Tree file for Linksys EA4500
 + *
@@ -140,22 +140,42 @@
 +
 +  partition@0 {
 +  label = "u-boot";
-+  reg = <0x000 0x8>;
++  reg = <0x0 0x8>;
 +  };
 +
 +  partition@8 {
-+  label = "u-boot environment";
++  label = "u_env";
 +  reg = <0x8 0x2>;
 +  };
 +
++  partition@a {
++  label = "s_env";
++  reg = <0xa 0x2>;
++  };
++
 +  partition@20 {
-+  label = "kernel";
-+  reg = <0x20 0x20>;
++  label = "kernel1";
++  reg = <0x20 0x1a0>;
++  };
++
++  partition@4a {
++  label = "rootfs1";
++  reg = <0x4a 0x176>;
++  };
++
++  partition@1c0 {
++  label = "kernel2";
++  reg = <0x1c0 0x1a0>;
++  };
++
++  partition@1ea {
++  label = "rootfs2";
++  reg = <0x1ea 0x176>;
 +  };
 +
-+  partition@40 {
-+  label = "root";
-+  reg = <0x40 0x1c0>;
++  partition@360 {
++  label = "syscfg";
++  reg = <0x360 0x4a0>;
 +  };
 +};
 +
diff --git a/target/linux/kirkwood/patches-3.18/170-ea3500.patch 
b/target/linux/kirkwood/patches-3.18/170-ea3500.patch
index 84645de..db69659 100644
--- a/target/linux/kirkwood/patches-3.18/170-ea3500.patch
+++ b/target/linux/kirkwood/patches-3.18/170-ea3500.patch
@@ -10,7 +10,7 @@
kirkwood-guruplug-server-plus.dtb \
 --- /dev/null
 +++ b/arch/arm/boot/dts/kirkwood-ea3500.dts
-@@ -0,0 +1,160 @@
+@@ -0,0 +1,179 @@
 +/*
 + * kirkwood-ea3500.dts - Device Tree file for Linksys EA3500
 + *
@@ -132,23 +132,42 @@
 +
 +  partition@0 {
 +  label = "u-boot";
-+  reg = <0x000 0x8>;
-+  read-only;
++  reg = <0x0 0x8>;
 +  };
 +
 +  partition@8 {
-+  label = "u-boot environment";
-+  reg = <0x8 0x2>;
++  label = "u_env";
++  reg = <0x8 0x4000>;
++  };
++
++  partition@84000 {
++  label = "s_env";
++  reg = <0x84000 0x4000>;
 +  };
 +
 +  partition@20 {
-+  label = "kernel";
-+  reg = <0x20 0x20>;
++  label = "kernel1";
++  reg = <0x20 0x140>;
++  };
++
++  partition@49 {
++  label = "rootfs1";
++  reg = <0x49 0x117>;
++  };
++
++  partition@160 {
++  label = "kernel2";
++  reg = <0x160 0x140>;
++  };
++
++  partition@189 {
++  label = "rootfs2";
++  reg = <0x189 0x117>;
 +  };
 +
-+  partition@40 {
-+  label = "root";
-+  reg = <0x40 0x120>;
++  partition@2a0 {
++  label = "syscfg";
++  reg = <0x2a0  0x160>;
 +  };
 +};
 +
diff --git a/target/linux/kirkwood/patches-4.3/140-ea4500.patch 
b/target/linux/kirkwood/patches-4.3/140-ea4500.patch
index 4409394..7fd56a7 100644
--- a/target/linux/kirkwood/patches-4.3/140-ea4500.patch
+++ b/target/linux/kirkwood/patches-4.3

[OpenWrt-Devel] [PATCH 3/7] kirkwood: find active Linksys root partition

2015-11-06 Thread Claudio Leite
This is imported verbatim from the mvebu WRT1900AC port.

It picks up the current boot partition from the kernel command line,
then renames that partition "ubi" so that it auto-mounts.

Signed-off-by: Claudio Leite 
---
 target/linux/kirkwood/config-3.18  |  1 +
 target/linux/kirkwood/config-4.3   |  1 +
 .../patches-3.18/100-find_active_root.patch| 61 ++
 .../patches-4.3/100-find_active_root.patch | 61 ++
 4 files changed, 124 insertions(+)
 create mode 100644 
target/linux/kirkwood/patches-3.18/100-find_active_root.patch
 create mode 100644 target/linux/kirkwood/patches-4.3/100-find_active_root.patch

diff --git a/target/linux/kirkwood/config-3.18 
b/target/linux/kirkwood/config-3.18
index b936ba9..17b2819 100644
--- a/target/linux/kirkwood/config-3.18
+++ b/target/linux/kirkwood/config-3.18
@@ -189,6 +189,7 @@ CONFIG_LZO_DECOMPRESS=y
 CONFIG_MACH_KIRKWOOD=y
 CONFIG_MACH_MVEBU_ANY=y
 # CONFIG_MACH_NETXBIG is not set
+CONFIG_MANGLE_BOOTARGS=y
 CONFIG_MDIO_BOARDINFO=y
 CONFIG_MIGHT_HAVE_PCI=y
 CONFIG_MMC=y
diff --git a/target/linux/kirkwood/config-4.3 b/target/linux/kirkwood/config-4.3
index 86eace5..1e68af5 100644
--- a/target/linux/kirkwood/config-4.3
+++ b/target/linux/kirkwood/config-4.3
@@ -197,6 +197,7 @@ CONFIG_MAC80211_STA_HASH_MAX_SIZE=0
 CONFIG_MACH_KIRKWOOD=y
 CONFIG_MACH_MVEBU_ANY=y
 # CONFIG_MACH_NETXBIG is not set
+CONFIG_MANGLE_BOOTARGS=y
 CONFIG_MDIO_BOARDINFO=y
 CONFIG_MIGHT_HAVE_PCI=y
 CONFIG_MMC=y
diff --git a/target/linux/kirkwood/patches-3.18/100-find_active_root.patch 
b/target/linux/kirkwood/patches-3.18/100-find_active_root.patch
new file mode 100644
index 000..e32b608
--- /dev/null
+++ b/target/linux/kirkwood/patches-3.18/100-find_active_root.patch
@@ -0,0 +1,61 @@
+The WRT1900AC among other Linksys routers uses a dual-firmware layout.
+Dynamically rename the active partition to "ubi".
+
+Signed-off-by: Imre Kaloz 
+
+--- a/drivers/mtd/ofpart.c
 b/drivers/mtd/ofpart.c
+@@ -25,12 +25,15 @@ static bool node_has_compatible(struct d
+   return of_get_property(pp, "compatible", NULL);
+ }
+ 
++static int mangled_rootblock;
++
+ static int parse_ofpart_partitions(struct mtd_info *master,
+  struct mtd_partition **pparts,
+  struct mtd_part_parser_data *data)
+ {
+   struct device_node *node;
+   const char *partname;
++  const char *owrtpart = "ubi";
+   struct device_node *pp;
+   int nr_parts, i;
+ 
+@@ -78,9 +81,15 @@ static int parse_ofpart_partitions(struc
+   (*pparts)[i].offset = of_read_number(reg, a_cells);
+   (*pparts)[i].size = of_read_number(reg + a_cells, s_cells);
+ 
+-  partname = of_get_property(pp, "label", &len);
+-  if (!partname)
+-  partname = of_get_property(pp, "name", &len);
++  if (mangled_rootblock && (i == mangled_rootblock)) {
++  partname = owrtpart;
++  } else {
++  partname = of_get_property(pp, "label", &len);
++
++  if (!partname)
++  partname = of_get_property(pp, "name", &len);
++  }
++
+   (*pparts)[i].name = partname;
+ 
+   if (of_get_property(pp, "read-only", &len))
+@@ -178,6 +187,18 @@ static int __init ofpart_parser_init(voi
+   return 0;
+ }
+ 
++static int __init active_root(char *str)
++{
++  get_option(&str, &mangled_rootblock);
++
++  if (!mangled_rootblock)
++  return 1;
++
++  return 1;
++}
++
++__setup("mangled_rootblock=", active_root);
++
+ static void __exit ofpart_parser_exit(void)
+ {
+   deregister_mtd_parser(&ofpart_parser);
diff --git a/target/linux/kirkwood/patches-4.3/100-find_active_root.patch 
b/target/linux/kirkwood/patches-4.3/100-find_active_root.patch
new file mode 100644
index 000..e32b608
--- /dev/null
+++ b/target/linux/kirkwood/patches-4.3/100-find_active_root.patch
@@ -0,0 +1,61 @@
+The WRT1900AC among other Linksys routers uses a dual-firmware layout.
+Dynamically rename the active partition to "ubi".
+
+Signed-off-by: Imre Kaloz 
+
+--- a/drivers/mtd/ofpart.c
 b/drivers/mtd/ofpart.c
+@@ -25,12 +25,15 @@ static bool node_has_compatible(struct d
+   return of_get_property(pp, "compatible", NULL);
+ }
+ 
++static int mangled_rootblock;
++
+ static int parse_ofpart_partitions(struct mtd_info *master,
+  struct mtd_partition **pparts,
+  struct mtd_part_parser_data *data)
+ {
+   struct device_node *node;
+   const char *partname;
++  const char *owrtpart = "ubi";
+   struct device_node *pp;
+   int nr_parts, i;
+ 
+@@ -78,9 +81,15 @@ static int parse_ofpart_partitions(struc
+   (*pparts)[i].offset = of_read_number(reg, a_cells);
+   (*pparts)[i].size = of_read_number(re

[OpenWrt-Devel] [PATCH 4/7] kirkwood: generate factory images for Linksys EA[34]500

2015-11-06 Thread Claudio Leite
This is done with the new image generation system. It also
generates a sysupgrade.tar image.

These images only support squashfs-on-UBI in their present form.

Signed-off-by: Claudio Leite 
---
 target/linux/kirkwood/image/Makefile | 45 +++-
 1 file changed, 39 insertions(+), 6 deletions(-)

diff --git a/target/linux/kirkwood/image/Makefile 
b/target/linux/kirkwood/image/Makefile
index 0aa75ff..6f15724 100644
--- a/target/linux/kirkwood/image/Makefile
+++ b/target/linux/kirkwood/image/Makefile
@@ -10,6 +10,45 @@ NAND_BLOCKSIZE := 2048-128k
 include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/image.mk
 
+DEVICE_VARS += DEVICE_DTS KERNEL_SIZE PAGESIZE BLOCKSIZE SUBPAGESIZE
+KERNEL_LOADADDR:=0x8000
+TARGET_DEVICES = ea3500 ea4500
+
+define Device/Default
+  KERNEL := kernel-bin | append-dtb | uImage none
+  KERNEL_NAME := zImage
+endef
+
+define Device/ea3500
+  DEVICE_DTS := kirkwood-ea3500
+  PAGESIZE := 512
+  SUBPAGESIZE := 256
+  BLOCKSIZE := 16KiB
+  KERNEL_SIZE := 2624k
+  FILESYSTEMS := squashfs
+  PROFILES := EA3500
+  IMAGES := factory.bin sysupgrade.tar
+  IMAGE/factory.bin := append-kernel (KERNEL_SIZE) | append-ubi
+  IMAGE/sysupgrade.tar := sysupgrade-nand
+endef
+
+define Device/ea4500
+  DEVICE_DTS := kirkwood-ea4500
+  PAGESIZE := 2048
+  SUBPAGESIZE := 512
+  BLOCKSIZE := 128KiB
+  KERNEL_SIZE := 2688k
+  FILESYSTEMS := squashfs
+  PROFILES := EA4500
+  IMAGES := factory.bin sysupgrade.tar
+  IMAGE/factory.bin := append-kernel (KERNEL_SIZE) | append-ubi
+  IMAGE/sysupgrade.tar := sysupgrade-nand
+endef
+
+define Build/append-dtb
+   cat $(DTS_DIR)/$(DEVICE_DTS).dtb >> $@
+endef
+
 define Image/BuildKernel/Template
 
$(CP) $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-zImage
@@ -109,12 +148,6 @@ Image/InstallKernel/Template/Generic=$(call 
Image/InstallKernel/Template)
 Image/BuildKernel/Template/DOCKSTAR=$(call Image/BuildKernel/Template,dockstar)
 Image/InstallKernel/Template/DOCKSTAR=$(call 
Image/InstallKernel/Template,dockstar)
 
-Image/BuildKernel/Template/EA3500=$(call Image/BuildKernel/Template,ea3500)
-Image/InstallKernel/Template/EA3500=$(call Image/InstallKernel/Template,ea3500)
-
-Image/BuildKernel/Template/EA4500=$(call Image/BuildKernel/Template,ea4500)
-Image/InstallKernel/Template/EA4500=$(call Image/InstallKernel/Template,ea4500)
-
 Image/BuildKernel/Template/GOFLEXHOME=$(call 
Image/BuildKernel/Template,goflexhome)
 Image/InstallKernel/Template/GOFLEXHOME=$(call 
Image/InstallKernel/Template,goflexhome)
 
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 5/7] kirkwood: support Linksys boot counter on EA[34]500

2015-11-06 Thread Claudio Leite
This is done with existing code from the WRT1900AC port.
It makes sure the "auto_recovery" bootloader option is set,
and resets the s_env boot counter after a successful boot.

This gives users without a serial console connection some
measure of safety.

Signed-off-by: Claudio Leite 
---
 package/system/mtd/src/Makefile  |  1 +
 .../kirkwood/base-files/etc/init.d/linksys_recovery  | 20 
 2 files changed, 21 insertions(+)
 create mode 100755 target/linux/kirkwood/base-files/etc/init.d/linksys_recovery

diff --git a/package/system/mtd/src/Makefile b/package/system/mtd/src/Makefile
index 40a165e..1e02ce9 100644
--- a/package/system/mtd/src/Makefile
+++ b/package/system/mtd/src/Makefile
@@ -11,6 +11,7 @@ obj.bcm53xx = $(obj.brcm)
 obj.brcm63xx = imagetag.o
 obj.ramips = $(obj.seama)
 obj.mvebu = linksys_bootcount.o
+obj.kirkwood = linksys_bootcount.o
 
 ifdef FIS_SUPPORT
   obj += fis.o
diff --git a/target/linux/kirkwood/base-files/etc/init.d/linksys_recovery 
b/target/linux/kirkwood/base-files/etc/init.d/linksys_recovery
new file mode 100755
index 000..b291c3d
--- /dev/null
+++ b/target/linux/kirkwood/base-files/etc/init.d/linksys_recovery
@@ -0,0 +1,20 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2015 OpenWrt.org
+
+START=97
+boot() {
+. /lib/functions.sh
+. /lib/kirkwood.sh
+
+case $(kirkwood_board_name) in
+   ea3500|ea4500)
+   # make sure auto_recovery in uboot is always on
+   AUTO_RECOVERY_ENA="`fw_printenv -n auto_recovery`"
+   if [ "$AUTO_RECOVERY_ENA" != "yes" ] ; then
+   fw_setenv auto_recovery yes
+   fi
+   # reset the boot counter
+   mtd resetbc s_env
+   ;;
+esac
+}
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 6/7] kirkwood: support sysupgrade on Linksys EA[34]500

2015-11-06 Thread Claudio Leite
This automatically writes to the alternate firmware partition
(on Linksys's dual firmware layout) using code borrowed from
the WRT1900AC port.

Signed-off-by: Claudio Leite 
---
 .../kirkwood/base-files/lib/upgrade/linksys.sh | 79 ++
 .../kirkwood/base-files/lib/upgrade/platform.sh| 32 +
 2 files changed, 111 insertions(+)
 create mode 100644 target/linux/kirkwood/base-files/lib/upgrade/linksys.sh
 create mode 100644 target/linux/kirkwood/base-files/lib/upgrade/platform.sh

diff --git a/target/linux/kirkwood/base-files/lib/upgrade/linksys.sh 
b/target/linux/kirkwood/base-files/lib/upgrade/linksys.sh
new file mode 100644
index 000..13a8f1c
--- /dev/null
+++ b/target/linux/kirkwood/base-files/lib/upgrade/linksys.sh
@@ -0,0 +1,79 @@
+#
+# Copyright (C) 2014 OpenWrt.org
+#
+
+linksys_get_target_firmware() {
+   cur_boot_part=`/usr/sbin/fw_printenv -n boot_part`
+   target_firmware=""
+   if [ "$cur_boot_part" = "1" ]
+   then
+   # current primary boot - update alt boot
+   target_firmware="kernel2"
+   fw_setenv boot_part 2
+   fw_setenv bootcmd "run altnandboot"
+   elif [ "$cur_boot_part" = "2" ]
+   then
+   # current alt boot - update primary boot
+   target_firmware="kernel1"
+   fw_setenv boot_part 1
+   fw_setenv bootcmd "run nandboot"
+   fi
+
+   echo "$target_firmware"
+}
+
+linksys_get_root_magic() {
+   (get_image "$@" | dd skip=786432 bs=4 count=1 | hexdump -v -n 4 -e '1/1 
"%02x"') 2>/dev/null
+}
+
+platform_do_upgrade_linksys() {
+   local magic_long="$(get_magic_long "$1")"
+
+   mkdir -p /var/lock
+   local part_label="$(linksys_get_target_firmware)"
+   touch /var/lock/fw_printenv.lock
+
+   if [ ! -n "$part_label" ]
+   then
+   echo "cannot find target partition"
+   exit 1
+   fi
+
+   local target_mtd=$(find_mtd_part $part_label)
+
+   [ "$magic_long" = "73797375" ] && {
+   CI_KERNPART="$part_label"
+   if [ "$part_label" = "kernel1" ]
+   then
+   CI_UBIPART="rootfs1"
+   else
+   CI_UBIPART="rootfs2"
+   fi
+
+   nand_upgrade_tar "$1"
+   }
+   [ "$magic_long" = "27051956" ] && {
+   # check firmwares' rootfs types
+   local target_mtd=$(find_mtd_part $part_label)
+   local oldroot="$(linksys_get_root_magic $target_mtd)"
+   local newroot="$(linksys_get_root_magic "$1")"
+
+   if [ "$newroot" = "55424923" -a "$oldroot" = "55424923" ]
+   # we're upgrading from a firmware with UBI to one with UBI
+   then
+   # erase everything to be safe
+   mtd erase $part_label
+   get_image "$1" | mtd -n write - $part_label
+   else
+   get_image "$1" | mtd write - $part_label
+   fi
+   }
+}
+
+linksys_preupgrade() {
+   export RAMFS_COPY_BIN="${RAMFS_COPY_BIN} /usr/sbin/fw_printenv 
/usr/sbin/fw_setenv"
+   export RAMFS_COPY_BIN="${RAMFS_COPY_BIN} /bin/mkdir /bin/touch"
+   export RAMFS_COPY_DATA="${RAMFS_COPY_DATA} /etc/fw_env.config 
/var/lock/fw_printenv.lock"
+}
+
+append sysupgrade_pre_upgrade linksys_preupgrade
diff --git a/target/linux/kirkwood/base-files/lib/upgrade/platform.sh 
b/target/linux/kirkwood/base-files/lib/upgrade/platform.sh
new file mode 100644
index 000..fa7603d
--- /dev/null
+++ b/target/linux/kirkwood/base-files/lib/upgrade/platform.sh
@@ -0,0 +1,32 @@
+. /lib/kirkwood.sh
+
+platform_check_image() {
+   [ "$#" -gt 1 ] && return 1
+   local board="$(kirkwood_board_name)"
+   local magic="$(get_magic_long "$1")"
+
+   case "$board" in
+   "ea3500"|\
+   "ea4500")
+   [ "$magic" != "27051956" -a "$magic" != "73797375" ] && {
+   echo "Invalid image type."
+   return 1
+   }
+   return 0
+   ;;
+   esac
+
+   echo "Sysupgrade is not yet supported on $board."
+   return 1
+}
+
+platform_do_upgrade() {
+   local board="$(kirkwood_board_name)"
+
+   case "$board" in
+   "ea3500"|\
+   "ea4500")
+   platform_do_upgrade_linksys "$ARGV"
+   ;;
+   esac
+}
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 7/7] kirkwood: add diag LED on Linksys EA3500

2015-11-06 Thread Claudio Leite
Signed-off-by: Claudio Leite 
---
 target/linux/kirkwood/base-files/etc/diag.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/target/linux/kirkwood/base-files/etc/diag.sh 
b/target/linux/kirkwood/base-files/etc/diag.sh
index 716e6c9..89d4655 100755
--- a/target/linux/kirkwood/base-files/etc/diag.sh
+++ b/target/linux/kirkwood/base-files/etc/diag.sh
@@ -12,6 +12,9 @@ get_status_led() {
pogo_e02)
status_led="status:orange:fault"
;;
+   ea3500)
+   status_led="ea3500:green:power"
+   ;;
ea4500)
status_led="ea4500:white:health"
;;
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel