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] [PATCH 2/2 v3] linux: add support of Synopsys ARC770-based boards

2015-11-05 Thread Alexey Brodkin
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";
> >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?

-Alexey
___
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-05 Thread Jonas Gorski
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.


Jonas
___
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-04 Thread Jonas Gorski
Hi,

On Tue, Nov 3, 2015 at 12:27 AM, Alexey Brodkin
 wrote:
> This patch introduces support of new boards with ARC cores.
>
>  [1] Synopsys SDP board
>  This is a new-generation development board from Synopsys that
>  consists of base-board and CPU tile-board (which might have a real
>  ASIC or FPGA with CPU image).
>  It sports a lot of DesignWare peripherals like GMAC, USB, SPI, I2C
>  etc and is intended to be used for early development of ARC-based
>  products.
>
>  [2] nSIM
>  This is a virtual board implemented in Synopsys proprietary
>  software simulator (even though available for free for open source
>  community). This board has only serial port as a peripheral and so
>  it is meant to be used for runtime testing which is especially
>  useful during bring-up of new tools and platforms.
>  What's also important ARC cores are very configurable so there're
>  many variations of options like cache sizes, their line lengths,
>  additional hardware blocks like multipliers, dividers etc. And this
>  board could be used to make sure built software still runs on
>  different HW configurations.
>
> Cc: Felix Fietkau 
> Cc: Jo-Philipp Wich 
> Signed-off-by: Alexey Brodkin 
> ---
>
> Changes compared to v2:
>  * Fixed copyright dates
>  * Cleaned-up init scripts
>
> Changes compared to v1:
>  * Switched to SoC-centered design. Now instead of common ARC700
>support we claim support of boards based on ARC770D.
>This allows to use the same one build of kernel binary for both
>boards.
>
>  * Implemented run-time scripts that parse Device Tree compatible
>tag and according to it do configuration of serial port and network.
>
>  * Implemented ability to patch in built Linux kernel external .dtb
>
>  * Linux kernel switched from 4.1 to 4.3
>
>  * Rebased on current master
>
>  include/kernel.mk  |   2 +
>  target/Config.in   |   9 +
>  target/linux/arc770/Makefile   |  26 +++
>  target/linux/arc770/base-files/etc/inittab |   4 +
>  .../arc770/base-files/etc/uci-defaults/02_network  |  23 +++
>  target/linux/arc770/base-files/lib/arc.sh  |  76 +++
>  .../base-files/lib/preinit/01_preinit_arc.sh   |  10 +
>  target/linux/arc770/config-4.3 | 142 +
>  target/linux/arc770/dts/axc001.dtsi| 100 +
>  target/linux/arc770/dts/axs101.dts |  21 ++
>  target/linux/arc770/dts/axs10x_mb.dtsi | 224 
> +
>  target/linux/arc770/dts/nsim_700.dts   |  70 +++
>  target/linux/arc770/dts/skeleton.dtsi  |  37 
>  target/linux/arc770/generic/profiles/00-default.mk |  16 ++
>  target/linux/arc770/generic/profiles/01-minimal.mk |  15 ++
>  target/linux/arc770/generic/profiles/02-axs101.mk  |  17 ++
>  .../linux/arc770/generic/profiles/03-nsim_700.mk   |  16 ++
>  target/linux/arc770/generic/target.mk  |   8 +
>  target/linux/arc770/image/Makefile |  42 
>  ...openwrt-arc-remove-dependency-on-DEVTMPFS.patch |  36 
>  .../0002-openwrt-arc-add-OWRTDTB-section.patch |  91 +
>  21 files changed, 985 insertions(+)
>  create mode 100644 target/linux/arc770/Makefile
>  create mode 100644 target/linux/arc770/base-files/etc/inittab
>  create mode 100644 target/linux/arc770/base-files/etc/uci-defaults/02_network
>  create mode 100644 target/linux/arc770/base-files/lib/arc.sh
>  create mode 100644 
> target/linux/arc770/base-files/lib/preinit/01_preinit_arc.sh
>  create mode 100644 target/linux/arc770/config-4.3
>  create mode 100644 target/linux/arc770/dts/axc001.dtsi
>  create mode 100644 target/linux/arc770/dts/axs101.dts
>  create mode 100644 target/linux/arc770/dts/axs10x_mb.dtsi
>  create mode 100644 target/linux/arc770/dts/nsim_700.dts
>  create mode 100644 target/linux/arc770/dts/skeleton.dtsi
>  create mode 100644 target/linux/arc770/generic/profiles/00-default.mk
>  create mode 100644 target/linux/arc770/generic/profiles/01-minimal.mk
>  create mode 100644 target/linux/arc770/generic/profiles/02-axs101.mk
>  create mode 100644 target/linux/arc770/generic/profiles/03-nsim_700.mk
>  create mode 100644 target/linux/arc770/generic/target.mk
>  create mode 100644 target/linux/arc770/image/Makefile
>  create mode 100644 
> target/linux/arc770/patches-4.3/0001-openwrt-arc-remove-dependency-on-DEVTMPFS.patch
>  create mode 100644 
> target/linux/arc770/patches-4.3/0002-openwrt-arc-add-OWRTDTB-section.patch
>

(snip)

> diff --git a/target/linux/arc770/base-files/etc/uci-defaults/02_network 
> b/target/linux/arc770/base-files/etc/uci-defaults/02_network
> new file mode 100644
> index 000..7db8451
> --- /dev/null
> +++ b/target/linux/arc770/base-files/etc/uci-defaults/02_network
> @@ -0,0 +1,23 

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

2015-11-04 Thread Alexey Brodkin
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:

> > This patch introduces support of new boards with ARC cores.
> > 
> >  [1] Synopsys SDP board
> >  This is a new-generation development board from Synopsys that
> >  consists of base-board and CPU tile-board (which might have a real
> >  ASIC or FPGA with CPU image).
> >  It sports a lot of DesignWare peripherals like GMAC, USB, SPI, I2C
> >  etc and is intended to be used for early development of ARC-based
> >  products.
> > 
> >  [2] nSIM
> >  This is a virtual board implemented in Synopsys proprietary
> >  software simulator (even though available for free for open source
> >  community). This board has only serial port as a peripheral and so
> >  it is meant to be used for runtime testing which is especially
> >  useful during bring-up of new tools and platforms.
> >  What's also important ARC cores are very configurable so there're
> >  many variations of options like cache sizes, their line lengths,
> >  additional hardware blocks like multipliers, dividers etc. And this
> >  board could be used to make sure built software still runs on
> >  different HW configurations.
> > 
> > Cc: Felix Fietkau 
> > Cc: Jo-Philipp Wich 
> > Signed-off-by: Alexey Brodkin 
> > ---
> > diff --git a/target/linux/arc770/base-files/etc/uci-defaults/02_network 
> > b/target/linux/arc770/base-files/etc/uci
> > -defaults/02_network
> > new file mode 100644
> > index 000..7db8451
> > --- /dev/null
> > +++ b/target/linux/arc770/base-files/etc/uci-defaults/02_network
> > @@ -0,0 +1,23 @@
> > +#!/bin/sh
> > +#
> > +# Copyright (C) 2015 OpenWrt.org
> > +#
> > +
> > +[ -e /etc/config/network ] && exit 0
> > +
> > +touch /etc/config/network
> > +
> > +. /lib/arc.sh
> > +. /lib/functions/uci-defaults.sh
> > +
> > +ucidef_set_interface_loopback
> > +
> > +case "$( arc_board_name )" in
> > +"arc-sdp"*)
> > +   ucidef_set_interface_wan "eth0"
> 
> If you only have one interface at all, it is usually better to make it
> lan/dhcp, else default firewall rules will prevent you from logging in
> through http/ssh. You can either borrow kirkwoods set_lan_dhcp (and
> maybe move that with a better name to base-files), or use
> ucidef_set_interface_raw to configure it appropriately.

Corrrect. I used ucidef_set_interface_wan as a "hack" to get its
settings automatically via DHCP.

So thanks a lot for pointing to better options.
For me ucidef_set_interface_raw looks simpler and cleaner
so I'll go with:
>8--
ucidef_set_interface_raw "lan" "eth0" "dhcp"
>8--
as it is done in realview.

> > +   ;;
> > +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";
>8--
which looks for sure much better!

Will do this for starters here in OpenWRT and will submit a patch upstream
in Linux kernel.

> 
> > +   # it will be wet with "snps,axs101snps,arc-sdp" which is
> > +   # concatenation of "snps,axs101" and "snps,arc-sdp".
> > +   if cat /proc/device-tree/compatible | grep -q "snps,arc-sdp"; then
> > +   board="arc-sdp";
> > +   fi
> > +
> > +   if cat /proc/device-tree/compatible | grep -q "snps,axs101"; then
> > +   model="axs101";
> > +   fi
> > +
> > +   if cat /proc/device-tree/compatible | grep -q "snps,nsim"; then
> > +   board="nsim";
> > +   fi
> > +
> > +   if [ "$board" != "" ]; then
> > +   ARC_BOARD_NAME="$board"
> > +   fi
> > 

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

2015-11-03 Thread Felix Fietkau
On 2015-11-03 17:49, Alexey Brodkin wrote:
>> > diff --git a/target/linux/arc770/image/Makefile 
>> > b/target/linux/arc770/image/Makefile
>> > --- /dev/null
>> > +++ b/target/linux/arc770/image/Makefile
>> > @@ -0,0 +1,42 @@
>> > +#
>> > +# Copyright (C) 2015 OpenWrt.org
>> > +#
>> > +# This is free software, licensed under the GNU General Public License v2.
>> > +# See /LICENSE for more information.
>> > +#
>> > +include $(TOPDIR)/rules.mk
>> > +include $(INCLUDE_DIR)/image.mk
>> > +
>> > +Image/Build/Initramfs=$(call Image/Build/Profile/$(PROFILE),initramfs)
>> > +
>> > +# $(1), lowercase board name like "axs101"
>> > +# $(2), DTS filename without .dts extension
>> > +# $(3), optional filename suffix, e.g. "-initramfs"
>> > +define PatchKernelDtb
>> > +  cp $(KDIR)/vmlinux$(3).elf $(KDIR)/vmlinux-$(1)$(3).elf
>> > +  $(LINUX_DIR)/scripts/dtc/dtc -O dtb -o $(KDIR)/$(2).dtb ../dts/$(2).dts
>> > +  $(STAGING_DIR_HOST)/bin/patch-dtb $(KDIR)/vmlinux-$(1)$(3).elf 
>> > $(KDIR)/$(2).dtb
>> > +endef
>> > +
>> > +# $(1), lowercase board name
>> > +# $(2), DTS filename without .dts extension
>> > +# $(3), optional filename suffix, e.g. "-initramfs"
>> > +MkImageDtb=$(call PatchKernelDtb,$(1),$(2),$(3))
>> > +
>> > +# $(1), squashfs/initramfs
>> > +# $(2), lowercase board name
>> > +# $(3), DTS filename without .dts extension
>> > +BuildFirmware/OF/initramfs=$(call MkImageDtb,$(2),$(3),-initramfs)
>> > +
>> > +BuildFirmware/axs101/initramfs=$(call 
>> > BuildFirmware/OF/initramfs,$(1),axs101,axs101)
>> > +BuildFirmware/nsim_700/initramfs=$(call 
>> > BuildFirmware/OF/initramfs,$(1),nsim_700,nsim_700)
>> > +
>> > +Image/Build/Profile/axs101=$(call BuildFirmware/axs101/$(1),$(1))
>> > +Image/Build/Profile/nsim_700=$(call BuildFirmware/nsim_700/$(1),$(1))
>> > +
>> > +define Image/Build/Profile/Default
>> > +  $(call Image/Build/Profile/axs101,$(1))
>> > +  $(call Image/Build/Profile/nsim_700,$(1))
>> > +endef
>> > +
>> > +$(eval $(call BuildImage))
>> Please use the new image building code instead. You can find examples in
>> the bcm53xx image Makefile.
> 
> Could you please elaborate a little bit why this is necessary?
> IMHO my current implementation is quite clean and understandable.
> What is also important it allows for more flexibility.
Eventually I would like to have all targets use the new image build
code, so we can get rid of the old stuff. Adding more code that uses the
old infrastructure will make this harder than it already is.

The new code is faster because it allows parallel build, and it has
better integration for handling profiles. It is also cleaner for targets
with different image types, because it makes it easier to chain and
recombine small image build recipes.

> For example I may deal with vmlinux.elf instead of objcopied vmlinux
> (which doesn't include elf header any longer) etc.
You can use easily use vmlinux.elf with that code as well.

> Moreover bcm53xx has no profiles so it's hard for me to figure out how to 
> deal with
> profiles properly with this new build code.
Many ar71xx devices have been ported over already, and they use
profiles. Limiting a device to one or more profiles is easy:
Setting PROFILES = foo bar in the device template will ensure that the
device image is only built for profiles 'foo' and 'bar'.

- 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-03 Thread Alexey Brodkin
Hi Felix,

On Tue, 2015-11-03 at 08:43 +0100, Felix Fietkau wrote:
> On 2015-11-03 00:27, Alexey Brodkin wrote:
> > This patch introduces support of new boards with ARC cores.

[snip]

> > diff --git a/include/kernel.mk b/include/kernel.mk
> > index 6a613fe..878a366 100644
> > --- a/include/kernel.mk
> > +++ b/include/kernel.mk
> > @@ -64,6 +64,8 @@ ifneq (,$(findstring uml,$(BOARD)))
> >LINUX_KARCH=um
> >  else ifneq (,$(findstring $(ARCH) , aarch64 aarch64_be ))
> >LINUX_KARCH := arm64
> > +else ifneq (,$(findstring $(ARCH) , arceb ))
> > +  LINUX_KARCH := arc
> >  else ifneq (,$(findstring $(ARCH) , armeb ))
> >LINUX_KARCH := arm
> >  else ifneq (,$(findstring $(ARCH) , mipsel mips64 mips64el ))
> > diff --git a/target/Config.in b/target/Config.in
> > index baae8d6..571b06e 100644
> > --- a/target/Config.in
> > +++ b/target/Config.in
> > @@ -100,6 +100,13 @@ config aarch64_be
> > select BIG_ENDIAN
> > bool
> >  
> > +config arc
> > +   bool
> > +
> > +config arceb
> > +   select BIG_ENDIAN
> > +   bool
> > +
> >  config arm
> > bool
> >  
> > @@ -179,6 +186,8 @@ config ARCH
> > string
> > default "aarch64"   if aarch64
> > default "aarch64_be" if aarch64_be
> > +   default "arc"   if arc
> > +   default "arceb" if arceb
> > default "arm"   if arm
> > default "armeb" if armeb
> > default "i386"  if i386
> Minor nitpick: The above parts should be folded into the previous patch.

Ok, will move it in toolchain patch.

> > diff --git a/target/linux/arc770/config-4.3 b/target/linux/arc770/config-4.3
> > new file mode 100644
> > index 000..aba6908
> > --- /dev/null
> > +++ b/target/linux/arc770/config-4.3
> > @@ -0,0 +1,142 @@
> > +#
> > +# ARC Architecture Configuration
> > +#
> > +CONFIG_ARC=y
> > +
> [...]
> Please run make kernel_oldconfig to refresh the target kernel config.
> This file is not meant to be hand-written. If you want to make changes
> to it, you can use make kernel_menuconfig.

Ok will do that too.

> > diff --git a/target/linux/arc770/image/Makefile 
> > b/target/linux/arc770/image/Makefile
> > --- /dev/null
> > +++ b/target/linux/arc770/image/Makefile
> > @@ -0,0 +1,42 @@
> > +#
> > +# Copyright (C) 2015 OpenWrt.org
> > +#
> > +# This is free software, licensed under the GNU General Public License v2.
> > +# See /LICENSE for more information.
> > +#
> > +include $(TOPDIR)/rules.mk
> > +include $(INCLUDE_DIR)/image.mk
> > +
> > +Image/Build/Initramfs=$(call Image/Build/Profile/$(PROFILE),initramfs)
> > +
> > +# $(1), lowercase board name like "axs101"
> > +# $(2), DTS filename without .dts extension
> > +# $(3), optional filename suffix, e.g. "-initramfs"
> > +define PatchKernelDtb
> > +   cp $(KDIR)/vmlinux$(3).elf $(KDIR)/vmlinux-$(1)$(3).elf
> > +   $(LINUX_DIR)/scripts/dtc/dtc -O dtb -o $(KDIR)/$(2).dtb ../dts/$(2).dts
> > +   $(STAGING_DIR_HOST)/bin/patch-dtb $(KDIR)/vmlinux-$(1)$(3).elf 
> > $(KDIR)/$(2).dtb
> > +endef
> > +
> > +# $(1), lowercase board name
> > +# $(2), DTS filename without .dts extension
> > +# $(3), optional filename suffix, e.g. "-initramfs"
> > +MkImageDtb=$(call PatchKernelDtb,$(1),$(2),$(3))
> > +
> > +# $(1), squashfs/initramfs
> > +# $(2), lowercase board name
> > +# $(3), DTS filename without .dts extension
> > +BuildFirmware/OF/initramfs=$(call MkImageDtb,$(2),$(3),-initramfs)
> > +
> > +BuildFirmware/axs101/initramfs=$(call 
> > BuildFirmware/OF/initramfs,$(1),axs101,axs101)
> > +BuildFirmware/nsim_700/initramfs=$(call 
> > BuildFirmware/OF/initramfs,$(1),nsim_700,nsim_700)
> > +
> > +Image/Build/Profile/axs101=$(call BuildFirmware/axs101/$(1),$(1))
> > +Image/Build/Profile/nsim_700=$(call BuildFirmware/nsim_700/$(1),$(1))
> > +
> > +define Image/Build/Profile/Default
> > +   $(call Image/Build/Profile/axs101,$(1))
> > +   $(call Image/Build/Profile/nsim_700,$(1))
> > +endef
> > +
> > +$(eval $(call BuildImage))
> Please use the new image building code instead. You can find examples in
> the bcm53xx image Makefile.

Could you please elaborate a little bit why this is necessary?
IMHO my current implementation is quite clean and understandable.
What is also important it allows for more flexibility.

For example I may deal with vmlinux.elf instead of objcopied vmlinux
(which doesn't include elf header any longer) etc.

Moreover bcm53xx has no profiles so it's hard for me to figure out how to deal 
with
profiles properly with this new build code.

-Alexey
___
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-02 Thread Felix Fietkau
On 2015-11-03 00:27, Alexey Brodkin wrote:
> This patch introduces support of new boards with ARC cores.
> 
>  [1] Synopsys SDP board
>  This is a new-generation development board from Synopsys that
>  consists of base-board and CPU tile-board (which might have a real
>  ASIC or FPGA with CPU image).
>  It sports a lot of DesignWare peripherals like GMAC, USB, SPI, I2C
>  etc and is intended to be used for early development of ARC-based
>  products.
> 
>  [2] nSIM
>  This is a virtual board implemented in Synopsys proprietary
>  software simulator (even though available for free for open source
>  community). This board has only serial port as a peripheral and so
>  it is meant to be used for runtime testing which is especially
>  useful during bring-up of new tools and platforms.
>  What's also important ARC cores are very configurable so there're
>  many variations of options like cache sizes, their line lengths,
>  additional hardware blocks like multipliers, dividers etc. And this
>  board could be used to make sure built software still runs on
>  different HW configurations.
> 
> Cc: Felix Fietkau 
> Cc: Jo-Philipp Wich 
> Signed-off-by: Alexey Brodkin 
> ---
> 
> Changes compared to v2:
>  * Fixed copyright dates
>  * Cleaned-up init scripts
> 
> Changes compared to v1:
>  * Switched to SoC-centered design. Now instead of common ARC700
>support we claim support of boards based on ARC770D.
>This allows to use the same one build of kernel binary for both
>boards.
> 
>  * Implemented run-time scripts that parse Device Tree compatible
>tag and according to it do configuration of serial port and network.
> 
>  * Implemented ability to patch in built Linux kernel external .dtb
> 
>  * Linux kernel switched from 4.1 to 4.3
> 
>  * Rebased on current master
> 
>  include/kernel.mk  |   2 +
>  target/Config.in   |   9 +
>  target/linux/arc770/Makefile   |  26 +++
>  target/linux/arc770/base-files/etc/inittab |   4 +
>  .../arc770/base-files/etc/uci-defaults/02_network  |  23 +++
>  target/linux/arc770/base-files/lib/arc.sh  |  76 +++
>  .../base-files/lib/preinit/01_preinit_arc.sh   |  10 +
>  target/linux/arc770/config-4.3 | 142 +
>  target/linux/arc770/dts/axc001.dtsi| 100 +
>  target/linux/arc770/dts/axs101.dts |  21 ++
>  target/linux/arc770/dts/axs10x_mb.dtsi | 224 
> +
>  target/linux/arc770/dts/nsim_700.dts   |  70 +++
>  target/linux/arc770/dts/skeleton.dtsi  |  37 
>  target/linux/arc770/generic/profiles/00-default.mk |  16 ++
>  target/linux/arc770/generic/profiles/01-minimal.mk |  15 ++
>  target/linux/arc770/generic/profiles/02-axs101.mk  |  17 ++
>  .../linux/arc770/generic/profiles/03-nsim_700.mk   |  16 ++
>  target/linux/arc770/generic/target.mk  |   8 +
>  target/linux/arc770/image/Makefile |  42 
>  ...openwrt-arc-remove-dependency-on-DEVTMPFS.patch |  36 
>  .../0002-openwrt-arc-add-OWRTDTB-section.patch |  91 +
>  21 files changed, 985 insertions(+)
>  create mode 100644 target/linux/arc770/Makefile
>  create mode 100644 target/linux/arc770/base-files/etc/inittab
>  create mode 100644 target/linux/arc770/base-files/etc/uci-defaults/02_network
>  create mode 100644 target/linux/arc770/base-files/lib/arc.sh
>  create mode 100644 
> target/linux/arc770/base-files/lib/preinit/01_preinit_arc.sh
>  create mode 100644 target/linux/arc770/config-4.3
>  create mode 100644 target/linux/arc770/dts/axc001.dtsi
>  create mode 100644 target/linux/arc770/dts/axs101.dts
>  create mode 100644 target/linux/arc770/dts/axs10x_mb.dtsi
>  create mode 100644 target/linux/arc770/dts/nsim_700.dts
>  create mode 100644 target/linux/arc770/dts/skeleton.dtsi
>  create mode 100644 target/linux/arc770/generic/profiles/00-default.mk
>  create mode 100644 target/linux/arc770/generic/profiles/01-minimal.mk
>  create mode 100644 target/linux/arc770/generic/profiles/02-axs101.mk
>  create mode 100644 target/linux/arc770/generic/profiles/03-nsim_700.mk
>  create mode 100644 target/linux/arc770/generic/target.mk
>  create mode 100644 target/linux/arc770/image/Makefile
>  create mode 100644 
> target/linux/arc770/patches-4.3/0001-openwrt-arc-remove-dependency-on-DEVTMPFS.patch
>  create mode 100644 
> target/linux/arc770/patches-4.3/0002-openwrt-arc-add-OWRTDTB-section.patch
> 
> diff --git a/include/kernel.mk b/include/kernel.mk
> index 6a613fe..878a366 100644
> --- a/include/kernel.mk
> +++ b/include/kernel.mk
> @@ -64,6 +64,8 @@ ifneq (,$(findstring uml,$(BOARD)))
>LINUX_KARCH=um
>  else ifneq (,$(findstring $(ARCH) , aarch64 aarch64_be ))
>LINUX_KARCH := arm64
> +else ifneq (,$(findstring 

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

2015-11-02 Thread Alexey Brodkin
This patch introduces support of new boards with ARC cores.

 [1] Synopsys SDP board
 This is a new-generation development board from Synopsys that
 consists of base-board and CPU tile-board (which might have a real
 ASIC or FPGA with CPU image).
 It sports a lot of DesignWare peripherals like GMAC, USB, SPI, I2C
 etc and is intended to be used for early development of ARC-based
 products.

 [2] nSIM
 This is a virtual board implemented in Synopsys proprietary
 software simulator (even though available for free for open source
 community). This board has only serial port as a peripheral and so
 it is meant to be used for runtime testing which is especially
 useful during bring-up of new tools and platforms.
 What's also important ARC cores are very configurable so there're
 many variations of options like cache sizes, their line lengths,
 additional hardware blocks like multipliers, dividers etc. And this
 board could be used to make sure built software still runs on
 different HW configurations.

Cc: Felix Fietkau 
Cc: Jo-Philipp Wich 
Signed-off-by: Alexey Brodkin 
---

Changes compared to v2:
 * Fixed copyright dates
 * Cleaned-up init scripts

Changes compared to v1:
 * Switched to SoC-centered design. Now instead of common ARC700
   support we claim support of boards based on ARC770D.
   This allows to use the same one build of kernel binary for both
   boards.

 * Implemented run-time scripts that parse Device Tree compatible
   tag and according to it do configuration of serial port and network.

 * Implemented ability to patch in built Linux kernel external .dtb

 * Linux kernel switched from 4.1 to 4.3

 * Rebased on current master

 include/kernel.mk  |   2 +
 target/Config.in   |   9 +
 target/linux/arc770/Makefile   |  26 +++
 target/linux/arc770/base-files/etc/inittab |   4 +
 .../arc770/base-files/etc/uci-defaults/02_network  |  23 +++
 target/linux/arc770/base-files/lib/arc.sh  |  76 +++
 .../base-files/lib/preinit/01_preinit_arc.sh   |  10 +
 target/linux/arc770/config-4.3 | 142 +
 target/linux/arc770/dts/axc001.dtsi| 100 +
 target/linux/arc770/dts/axs101.dts |  21 ++
 target/linux/arc770/dts/axs10x_mb.dtsi | 224 +
 target/linux/arc770/dts/nsim_700.dts   |  70 +++
 target/linux/arc770/dts/skeleton.dtsi  |  37 
 target/linux/arc770/generic/profiles/00-default.mk |  16 ++
 target/linux/arc770/generic/profiles/01-minimal.mk |  15 ++
 target/linux/arc770/generic/profiles/02-axs101.mk  |  17 ++
 .../linux/arc770/generic/profiles/03-nsim_700.mk   |  16 ++
 target/linux/arc770/generic/target.mk  |   8 +
 target/linux/arc770/image/Makefile |  42 
 ...openwrt-arc-remove-dependency-on-DEVTMPFS.patch |  36 
 .../0002-openwrt-arc-add-OWRTDTB-section.patch |  91 +
 21 files changed, 985 insertions(+)
 create mode 100644 target/linux/arc770/Makefile
 create mode 100644 target/linux/arc770/base-files/etc/inittab
 create mode 100644 target/linux/arc770/base-files/etc/uci-defaults/02_network
 create mode 100644 target/linux/arc770/base-files/lib/arc.sh
 create mode 100644 target/linux/arc770/base-files/lib/preinit/01_preinit_arc.sh
 create mode 100644 target/linux/arc770/config-4.3
 create mode 100644 target/linux/arc770/dts/axc001.dtsi
 create mode 100644 target/linux/arc770/dts/axs101.dts
 create mode 100644 target/linux/arc770/dts/axs10x_mb.dtsi
 create mode 100644 target/linux/arc770/dts/nsim_700.dts
 create mode 100644 target/linux/arc770/dts/skeleton.dtsi
 create mode 100644 target/linux/arc770/generic/profiles/00-default.mk
 create mode 100644 target/linux/arc770/generic/profiles/01-minimal.mk
 create mode 100644 target/linux/arc770/generic/profiles/02-axs101.mk
 create mode 100644 target/linux/arc770/generic/profiles/03-nsim_700.mk
 create mode 100644 target/linux/arc770/generic/target.mk
 create mode 100644 target/linux/arc770/image/Makefile
 create mode 100644 
target/linux/arc770/patches-4.3/0001-openwrt-arc-remove-dependency-on-DEVTMPFS.patch
 create mode 100644 
target/linux/arc770/patches-4.3/0002-openwrt-arc-add-OWRTDTB-section.patch

diff --git a/include/kernel.mk b/include/kernel.mk
index 6a613fe..878a366 100644
--- a/include/kernel.mk
+++ b/include/kernel.mk
@@ -64,6 +64,8 @@ ifneq (,$(findstring uml,$(BOARD)))
   LINUX_KARCH=um
 else ifneq (,$(findstring $(ARCH) , aarch64 aarch64_be ))
   LINUX_KARCH := arm64
+else ifneq (,$(findstring $(ARCH) , arceb ))
+  LINUX_KARCH := arc
 else ifneq (,$(findstring $(ARCH) , armeb ))
   LINUX_KARCH := arm
 else ifneq (,$(findstring $(ARCH) , mipsel mips64 mips64el ))
diff --git a/target/Config.in b/target/Config.in
index baae8d6..571b06e