Re: [OpenWrt-Devel] [PATCH] openssl: build kmods only if engines are selected

2019-04-25 Thread Rosen Penev
On Thu, Apr 25, 2019 at 12:23 PM Eneas U de Queiroz via openwrt-devel
 wrote:
>
> The sender domain has a DMARC Reject/Quarantine policy which disallows
> sending mailing list messages using the original "From" header.
>
> To mitigate this problem, the original message has been wrapped
> automatically by the mailing list software.
>
>
> -- Forwarded message --
> From: Eneas U de Queiroz 
> To: openwrt-devel@lists.openwrt.org
> Cc: Eneas U de Queiroz 
> Bcc:
> Date: Thu, 25 Apr 2019 16:23:27 -0300
> Subject: [PATCH] openssl: build kmods only if engines are selected
> Add a conditional to the individual package's for the kmods in DEPENDS.
> This avoids the need to compile the kernel modules when the crypto
> engine packages are not selected.  The final binares are not affected by
> this.
>
> Signed-off-by: Eneas U de Queiroz 
Tested-by: Rosen Penev 

Tested a few different configurations. No issues found.
> ---
> This trick takes, for example, $(curdir)/kernel/cryptodev-linux/compile
> from the $(curdir)/kernel/cryptodev-linux/compile+= line in
> tmp/.packagedeps, and changes it to:
> $(if 
> $(CONFIG_PACKAGE_libopenssl-devcrypto),$(curdir)/kernel/cryptodev-linux/compile)
> so it will only build kmod-cryptodev (from the cryptodev-linux package)
> if the devcrypto engine is actually selected.
> The conditionals in tmp/.config-package.in are optimized out, so it does
> not change that file, and it will not result in recursive dependencies.
>
> diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile
> index 6f0b0aac5b..b16bf9854f 100644
> --- a/package/libs/openssl/Makefile
> +++ b/package/libs/openssl/Makefile
> @@ -139,8 +139,8 @@ define Package/libopenssl-afalg
>$(call Package/openssl/Default)
>SUBMENU:=SSL
>TITLE:=AFALG hardware acceleration engine
> -  DEPENDS:=libopenssl @OPENSSL_ENGINE @KERNEL_AIO @!LINUX_3_18 
> +kmod-crypto-user \
> -  +libopenssl-conf @!OPENSSL_ENGINE_BUILTIN
> +  DEPENDS:=libopenssl @OPENSSL_ENGINE @KERNEL_AIO @!LINUX_3_18 \
> +  +PACKAGE_libopenssl-afalg:kmod-crypto-user +libopenssl-conf 
> @!OPENSSL_ENGINE_BUILTIN
>  endef
>
>  define Package/libopenssl-afalg/description
> @@ -156,7 +156,7 @@ define Package/libopenssl-devcrypto
>$(call Package/openssl/Default)
>SUBMENU:=SSL
>TITLE:=/dev/crypto hardware acceleration engine
> -  DEPENDS:=libopenssl @OPENSSL_ENGINE +kmod-cryptodev +libopenssl-conf \
> +  DEPENDS:=libopenssl @OPENSSL_ENGINE 
> +PACKAGE_libopenssl-devcrypto:kmod-cryptodev +libopenssl-conf \
>@!OPENSSL_ENGINE_BUILTIN
>  endef
>
> @@ -173,7 +173,7 @@ define Package/libopenssl-padlock
>$(call Package/openssl/Default)
>SUBMENU:=SSL
>TITLE:=VIA Padlock hardware acceleration engine
> -  DEPENDS:=libopenssl @OPENSSL_ENGINE @TARGET_x86 +kmod-crypto-hw-padlock \
> +  DEPENDS:=libopenssl @OPENSSL_ENGINE @TARGET_x86 
> +PACKAGE_libopenssl-padlock:kmod-crypto-hw-padlock \
>+libopenssl-conf @!OPENSSL_ENGINE_BUILTIN
>  endef
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

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


Re: [OpenWrt-Devel] [PATCH v2 1/2] scripts/qemustart: no network by default and enable with -n

2019-04-25 Thread Hans Dedecker
On Thu, Apr 25, 2019 at 6:19 PM Yousong Zhou  wrote:
>
> This should make it easier to setup and possibly provide a "work out of
> the box" experience for most test usage.  With typical wan
> networking setup being only two characters argument away.
>
> Cc: Petr Štetiar 
> Signed-off-by: Yousong Zhou 
Acked-by: Hans Dedecker 
> ---
> v2 <- v1
>
>  - Rebase on current master branch
>  - Fix logic invert in check_setup() of v1
>  - Reword commit message
>
>  scripts/qemustart | 12 +++-
>  1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/qemustart b/scripts/qemustart
> index 076d4bbcfe..8daeac69a8 100755
> --- a/scripts/qemustart
> +++ b/scripts/qemustart
> @@ -74,7 +74,7 @@ check_setup_() {
>  }
>
>  check_setup() {
> -   [ -z "$o_nonetwork" ] || return 0
> +   [ -n "$o_network" ] || return 0
> check_setup_ || {
> __errmsg "please check the script content to see the 
> environment requirement"
> return 1
> @@ -90,6 +90,7 @@ Usage: $SELF [-h|--help]
>   [--kernel ]
>   [--rootfs ]
>   [--machine ]
> + [-n|--network]
>
>   will default to "generic" and must be specified if
>   are present
> @@ -120,13 +121,14 @@ rand_mac() {
>  }
>
>  parse_args() {
> +   o_network=
> o_qemu_extra=()
> while [ "$#" -gt 0 ]; do
> case "$1" in
> -   --no-network|-n) o_nonetwork=1; shift ;;
> --kernel) o_kernel="$2"; shift 2 ;;
> --rootfs) o_rootfs="$2"; shift 2 ;;
> --machine|-machine|-M) o_mach="$2"; shift 2 ;;
> +   --network|-n) o_network=1; shift ;;
> --help|-h)
> usage
> exit 0
> @@ -187,7 +189,7 @@ start_qemu_armvirt() {
> )
> }
>
> -   [ -n "$o_nonetwork" ] || {
> +   [ -z "$o_network" ] || {
> o_qemu_extra+=( \
> "-netdev" "bridge,id=lan,br=$BR_LAN,helper=$HELPER" \
> "-device" 
> "virtio-net-pci,id=devlan,netdev=lan,mac=$MAC_LAN" \
> @@ -229,7 +231,7 @@ start_qemu_malta() {
> # NOTE: order of wan, lan -device arguments matters as it will affect 
> which
> # one will be actually used as the wan, lan network interface inside 
> the
> # guest machine
> -   [ -n "$o_nonetwork" ] || {
> +   [ -z "$o_network" ] || {
> o_qemu_extra+=( \
> "-netdev" "bridge,id=wan,br=$BR_WAN,helper=$HELPER" 
> "-device" \
> 
> "virtio-net-pci,id=devwan,netdev=wan,mac=$MAC_WAN" \
> @@ -276,7 +278,7 @@ start_qemu_x86() {
> )
> }
>
> -   [ -n "$o_nonetwork" ] || {
> +   [ -z "$o_network" ] || {
> o_qemu_extra+=( \
> "-netdev" "bridge,id=lan,br=$BR_LAN,helper=$HELPER" \
> "-device" 
> "virtio-net-pci,id=devlan,netdev=lan,mac=$MAC_LAN" \

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


[OpenWrt-Devel] [PATCH] openssl: build kmods only if engines are selected

2019-04-25 Thread Eneas U de Queiroz via openwrt-devel
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.--- Begin Message ---
Add a conditional to the individual package's for the kmods in DEPENDS.
This avoids the need to compile the kernel modules when the crypto
engine packages are not selected.  The final binares are not affected by
this.

Signed-off-by: Eneas U de Queiroz 
---
This trick takes, for example, $(curdir)/kernel/cryptodev-linux/compile
from the $(curdir)/kernel/cryptodev-linux/compile+= line in 
tmp/.packagedeps, and changes it to:
$(if 
$(CONFIG_PACKAGE_libopenssl-devcrypto),$(curdir)/kernel/cryptodev-linux/compile)
so it will only build kmod-cryptodev (from the cryptodev-linux package)
if the devcrypto engine is actually selected.
The conditionals in tmp/.config-package.in are optimized out, so it does
not change that file, and it will not result in recursive dependencies.

diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile
index 6f0b0aac5b..b16bf9854f 100644
--- a/package/libs/openssl/Makefile
+++ b/package/libs/openssl/Makefile
@@ -139,8 +139,8 @@ define Package/libopenssl-afalg
   $(call Package/openssl/Default)
   SUBMENU:=SSL
   TITLE:=AFALG hardware acceleration engine
-  DEPENDS:=libopenssl @OPENSSL_ENGINE @KERNEL_AIO @!LINUX_3_18 
+kmod-crypto-user \
-  +libopenssl-conf @!OPENSSL_ENGINE_BUILTIN
+  DEPENDS:=libopenssl @OPENSSL_ENGINE @KERNEL_AIO @!LINUX_3_18 \
+  +PACKAGE_libopenssl-afalg:kmod-crypto-user +libopenssl-conf 
@!OPENSSL_ENGINE_BUILTIN
 endef
 
 define Package/libopenssl-afalg/description
@@ -156,7 +156,7 @@ define Package/libopenssl-devcrypto
   $(call Package/openssl/Default)
   SUBMENU:=SSL
   TITLE:=/dev/crypto hardware acceleration engine
-  DEPENDS:=libopenssl @OPENSSL_ENGINE +kmod-cryptodev +libopenssl-conf \
+  DEPENDS:=libopenssl @OPENSSL_ENGINE 
+PACKAGE_libopenssl-devcrypto:kmod-cryptodev +libopenssl-conf \
   @!OPENSSL_ENGINE_BUILTIN
 endef
 
@@ -173,7 +173,7 @@ define Package/libopenssl-padlock
   $(call Package/openssl/Default)
   SUBMENU:=SSL
   TITLE:=VIA Padlock hardware acceleration engine
-  DEPENDS:=libopenssl @OPENSSL_ENGINE @TARGET_x86 +kmod-crypto-hw-padlock \
+  DEPENDS:=libopenssl @OPENSSL_ENGINE @TARGET_x86 
+PACKAGE_libopenssl-padlock:kmod-crypto-hw-padlock \
   +libopenssl-conf @!OPENSSL_ENGINE_BUILTIN
 endef
 

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


[OpenWrt-Devel] [PATCH v2 1/2] scripts/qemustart: no network by default and enable with -n

2019-04-25 Thread Yousong Zhou
This should make it easier to setup and possibly provide a "work out of
the box" experience for most test usage.  With typical wan
networking setup being only two characters argument away.

Cc: Petr Štetiar 
Signed-off-by: Yousong Zhou 
---
v2 <- v1

 - Rebase on current master branch
 - Fix logic invert in check_setup() of v1
 - Reword commit message

 scripts/qemustart | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/scripts/qemustart b/scripts/qemustart
index 076d4bbcfe..8daeac69a8 100755
--- a/scripts/qemustart
+++ b/scripts/qemustart
@@ -74,7 +74,7 @@ check_setup_() {
 }
 
 check_setup() {
-   [ -z "$o_nonetwork" ] || return 0
+   [ -n "$o_network" ] || return 0
check_setup_ || {
__errmsg "please check the script content to see the 
environment requirement"
return 1
@@ -90,6 +90,7 @@ Usage: $SELF [-h|--help]
  [--kernel ]
  [--rootfs ]
  [--machine ]
+ [-n|--network]
 
  will default to "generic" and must be specified if
  are present
@@ -120,13 +121,14 @@ rand_mac() {
 }
 
 parse_args() {
+   o_network=
o_qemu_extra=()
while [ "$#" -gt 0 ]; do
case "$1" in
-   --no-network|-n) o_nonetwork=1; shift ;;
--kernel) o_kernel="$2"; shift 2 ;;
--rootfs) o_rootfs="$2"; shift 2 ;;
--machine|-machine|-M) o_mach="$2"; shift 2 ;;
+   --network|-n) o_network=1; shift ;;
--help|-h)
usage
exit 0
@@ -187,7 +189,7 @@ start_qemu_armvirt() {
)
}
 
-   [ -n "$o_nonetwork" ] || {
+   [ -z "$o_network" ] || {
o_qemu_extra+=( \
"-netdev" "bridge,id=lan,br=$BR_LAN,helper=$HELPER" \
"-device" 
"virtio-net-pci,id=devlan,netdev=lan,mac=$MAC_LAN" \
@@ -229,7 +231,7 @@ start_qemu_malta() {
# NOTE: order of wan, lan -device arguments matters as it will affect 
which
# one will be actually used as the wan, lan network interface inside the
# guest machine
-   [ -n "$o_nonetwork" ] || {
+   [ -z "$o_network" ] || {
o_qemu_extra+=( \
"-netdev" "bridge,id=wan,br=$BR_WAN,helper=$HELPER" 
"-device" \
"virtio-net-pci,id=devwan,netdev=wan,mac=$MAC_WAN" \
@@ -276,7 +278,7 @@ start_qemu_x86() {
)
}
 
-   [ -n "$o_nonetwork" ] || {
+   [ -z "$o_network" ] || {
o_qemu_extra+=( \
"-netdev" "bridge,id=lan,br=$BR_LAN,helper=$HELPER" \
"-device" 
"virtio-net-pci,id=devlan,netdev=lan,mac=$MAC_LAN" \

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


[OpenWrt-Devel] [PATCH v2 2/2] scripts/qemustart: fix network device emulation

2019-04-25 Thread Yousong Zhou
We only enabled pcnet driver for malta machine, and x86/legacy target
was supposed to only support e1000 model

Cc: Petr Štetiar 
Signed-off-by: Yousong Zhou 
---
 scripts/qemustart | 28 +---
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/scripts/qemustart b/scripts/qemustart
index 8daeac69a8..2d1f476dde 100755
--- a/scripts/qemustart
+++ b/scripts/qemustart
@@ -232,11 +232,9 @@ start_qemu_malta() {
# one will be actually used as the wan, lan network interface inside the
# guest machine
[ -z "$o_network" ] || {
-   o_qemu_extra+=( \
-   "-netdev" "bridge,id=wan,br=$BR_WAN,helper=$HELPER" 
"-device" \
-   "virtio-net-pci,id=devwan,netdev=wan,mac=$MAC_WAN" \
-   "-netdev" "bridge,id=lan,br=$BR_LAN,helper=$HELPER" \
-   "-device" 
"virtio-net-pci,id=devlan,netdev=lan,mac=$MAC_LAN" \
+   o_qemu_extra+=(
+   -netdev bridge,id=wan,br="$BR_WAN,helper=$HELPER" 
-device pcnet,netdev=wan,mac="$MAC_WAN"
+   -netdev bridge,id=lan,br="$BR_LAN,helper=$HELPER" 
-device pcnet,netdev=lan,mac="$MAC_LAN"
)
}
 
@@ -279,12 +277,20 @@ start_qemu_x86() {
}
 
[ -z "$o_network" ] || {
-   o_qemu_extra+=( \
-   "-netdev" "bridge,id=lan,br=$BR_LAN,helper=$HELPER" \
-   "-device" 
"virtio-net-pci,id=devlan,netdev=lan,mac=$MAC_LAN" \
-   "-netdev" "bridge,id=wan,br=$BR_WAN,helper=$HELPER" 
"-device" \
-   "virtio-net-pci,id=devwan,netdev=wan,mac=$MAC_WAN" \
-   )
+   case "${o_subtarget%-*}" in
+   legacy)
+   o_qemu_extra+=(
+   -netdev 
"bridge,id=lan,br=$BR_LAN,helper=$HELPER" -device 
"e1000,id=devlan,netdev=lan,mac=$MAC_LAN"
+   -netdev 
"bridge,id=wan,br=$BR_WAN,helper=$HELPER" -device 
"e1000,id=devwan,netdev=wan,mac=$MAC_WAN"
+   )
+   ;;
+   generic|64)
+   o_qemu_extra+=(
+   -netdev 
"bridge,id=lan,br=$BR_LAN,helper=$HELPER" -device 
"virtio-net-pci,id=devlan,netdev=lan,mac=$MAC_LAN"
+   -netdev 
"bridge,id=wan,br=$BR_WAN,helper=$HELPER" -device 
"virtio-net-pci,id=devwan,netdev=wan,mac=$MAC_WAN"
+   )
+   ;;
+   esac
}
 
case "${o_subtarget%-*}" in

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


[OpenWrt-Devel] Fix TX power handling

2019-04-25 Thread Vincent Wiemann
Hi,

I've stumbled across problems with the transmission output power of OpenWrt
routers quite often.
E.g. https://bugs.openwrt.org/index.php?do=details_id=1289=4
which I still have to look into in greater detail.
OpenWrt's handling of TX power, antenna and PA gains needs to be revised
thoroughly.

There is a iw patch in OpenWrt that is being used for setting the antenna gain.
There was one try of nbd to upstream this change in 2013:
https://www.spinics.net/lists/linux-wireless/msg111944.html

I'd like to make some things clear here and hope that there will be a new
attempt to getting this upstreamed.
First EIRP is by definition ERP + antenna gain - cable loss.
And ERP is radio chip output + PA chip gain - (board's signal path loss which 
is likely
irrelevant due to golden device calibration).

If there is a regulatory limit of the antenna gain that (whyever) means that no 
antennas
with a higher gain are allowed - this does not really make sense.
It certainly does not mean that you can exceed the EIRP
by the antenna gain as this would reduce the definition of EIRP to absurdity.
If the regulatory domain values aren't plausible (because why in the world 
should
there be a limit to the antenna gain when there is a EIRP limit already?),
we should not work around that, because otherwise nobody will see the mistake -
It is a problem of the regdb then, which likely needs to introduce a new 
regulatory
definition for maximum ERP and maximum antenna gain for affected regions, which
would still don't really make sense, but maybe laws are just weird in this 
regions.

Second e.g. most TP-Link routers don't use the ART's antenna gain field.
Instead they use the TX gain field (which should have been used for defining an
external PA chip's gain instead). I assume that they did it to circumvent 
problems
with the regdb...

Finally some device's (Ubiquiti XM/XW) external PA chip gain is defined in stock
firmware depending on the subvendor device ID of the radio chip.
These definitions are being defined in:
https://git.openwrt.org/?p=project/iwinfo.git;a=blob;f=hardware.txt
I've filed a patch which adds all PA gains of Ubiquiti XM/XW devices to iwinfo 
which
I've extracted from the stock firmware, but it seems to be ignored until now:
https://www.mail-archive.com/openwrt-devel@lists.openwrt.org/msg46175.html

AFAIK OpenWrt does not make use of these values, yet leading to a much higher
EIRP than allowed if these values are not manually adjusted.

Thus to my best knowledge what has to be done is:
1. add options for external PA gain in iw and nl80211 code
2. display antenna gain and PA gain in iw
3. check if ath9k code sets PA gain and antenna gain correctly and
   if not, fix it
4. for devices whose PA gain does not seem to be defined in ART like
   Ubiquiti XM/XWs, add a hotplug script to OpenWrt that sets
   the correct PA gains from iwinfo using iw.
5. for devices whose antenna gain neither seems to be defined in ART's
   antenna gain nor it's TX gain field, add a hotplug script to OpenWrt
   that sets the correct antenna gains manually on a model basis using iw.
6. take measurements to check if the ERP meets expectations
7. upstream all these changes and make regdb developers aware

I'd like to do this by myself, but I don't have time for it.
Still I can help with the measurements etc.
If someone feels capable of doing this, this would be a great improvement
and help OpenWrt to keep a stand against vendor locking.

Regards,

Vincent Wiemann

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


Re: [OpenWrt-Devel] [PATCH 1/2] scripts/qemustart: no-network by default and enable with -n

2019-04-25 Thread Yousong Zhou
On Thu, 25 Apr 2019 at 23:05, Hans Dedecker  wrote:
>
> Hi Yousong,
>
> On Thu, Apr 25, 2019 at 4:29 PM Yousong Zhou  wrote:
> >
> > Before this change, we have no way to have network on as both bash and
> > zsh have zero exit status for "[ -n ]" and "[ -z ]"
> >
> > By running qemu without network by default we make common usage of and
> > first encounter with qemustart script more comfortable.  With networking
> > only two characters argument away.
> >
> > Cc: Petr Štetiar 
> > Signed-off-by: Yousong Zhou 
> > ---
> >  scripts/qemustart | 12 +++-
> >  1 file changed, 7 insertions(+), 5 deletions(-)

...

> >
> I pushed a patch
> (https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=9424b6f998917e2926c0b7afb8d7a968590da335)
> yesterday which fixes the [ -n ] and [ -z ] issues
>
> Hans

I missed that one ;)  But I would still like to propose that we make
"no network" the default.  I assume that would be easier to set up and
works for most cases.  What do you think?

yousong

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


Re: [OpenWrt-Devel] [PATCH 1/2] scripts/qemustart: no-network by default and enable with -n

2019-04-25 Thread Yousong Zhou
On Thursday, 25 April 2019, Hans Dedecker  wrote:

> Hi Yousong,
>
> On Thu, Apr 25, 2019 at 4:29 PM Yousong Zhou 
> wrote:
> >
> > Before this change, we have no way to have network on as both bash and
> > zsh have zero exit status for "[ -n ]" and "[ -z ]"
> >
> > By running qemu without network by default we make common usage of and
> > first encounter with qemustart script more comfortable.  With networking
> > only two characters argument away.
> >
> > Cc: Petr Štetiar 
> > Signed-off-by: Yousong Zhou 
> > ---
> >  scripts/qemustart | 12 +++-
> >  1 file changed, 7 insertions(+), 5 deletions(-)
> >
> > diff --git a/scripts/qemustart b/scripts/qemustart
> > index 951f225272..f0ffc64734 100755
> > --- a/scripts/qemustart
> > +++ b/scripts/qemustart
> > @@ -74,7 +74,7 @@ check_setup_() {
> >  }
> >
> >  check_setup() {
> > -   [ -z $o_nonetwork ] || return 0
> > +   [ -z "$o_network" ] || return 0
> > check_setup_ || {
> > __errmsg "please check the script content to see the
> environment requirement"
> > return 1
> > @@ -90,6 +90,7 @@ Usage: $SELF [-h|--help]
> >   [--kernel ]
> >   [--rootfs ]
> >   [--machine ]
> > + [-n|--network]
> >
> >   will default to "generic" and must be specified if
> >   are present
> > @@ -120,13 +121,14 @@ rand_mac() {
> >  }
> >
> >  parse_args() {
> > +   o_network=
> > o_qemu_extra=()
> > while [ "$#" -gt 0 ]; do
> > case "$1" in
> > -   --no-network|-n) o_nonetwork=1; shift ;;
> > --kernel) o_kernel="$2"; shift 2 ;;
> > --rootfs) o_rootfs="$2"; shift 2 ;;
> > --machine|-machine|-M) o_mach="$2"; shift 2 ;;
> > +   --network|-n) o_network=1; shift ;;
> > --help|-h)
> > usage
> > exit 0
> > @@ -187,7 +189,7 @@ start_qemu_armvirt() {
> > )
> > }
> >
> > -   [ -n $o_nonetwork ] || {
> > +   [ -z "$o_network" ] || {
> > o_qemu_extra+=( \
> > "-netdev" "bridge,id=lan,br=$BR_LAN,helper=$HELPER"
> \
> > "-device" 
> > "virtio-net-pci,id=devlan,netdev=lan,mac=$MAC_LAN"
> \
> > @@ -229,7 +231,7 @@ start_qemu_malta() {
> > # NOTE: order of wan, lan -device arguments matters as it will
> affect which
> > # one will be actually used as the wan, lan network interface
> inside the
> > # guest machine
> > -   [ -n $o_nonetwork ] || {
> > +   [ -z "$o_network" ] || {
> > o_qemu_extra+=( \
> > "-netdev" "bridge,id=wan,br=$BR_WAN,helper=$HELPER"
> "-device" \
> > 
> > "virtio-net-pci,id=devwan,netdev=wan,mac=$MAC_WAN"
> \
> > @@ -276,7 +278,7 @@ start_qemu_x86() {
> > )
> > }
> >
> > -   [ -n $o_nonetwork ] || {
> > +   [ -z "$o_network" ] || {
> > o_qemu_extra+=( \
> > "-netdev" "bridge,id=lan,br=$BR_LAN,helper=$HELPER"
> \
> > "-device" 
> > "virtio-net-pci,id=devlan,netdev=lan,mac=$MAC_LAN"
> \
> >
> I pushed a patch
> (https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=
> 9424b6f998917e2926c0b7afb8d7a968590da335)
> yesterday which fixes the [ -n ] and [ -z ] issues
>
> Hans
> > ___
> > openwrt-devel mailing list
> > openwrt-devel@lists.openwrt.org
> > https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>


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


Re: [OpenWrt-Devel] [PATCH 1/2] scripts/qemustart: no-network by default and enable with -n

2019-04-25 Thread Hans Dedecker
Hi Yousong,

On Thu, Apr 25, 2019 at 4:29 PM Yousong Zhou  wrote:
>
> Before this change, we have no way to have network on as both bash and
> zsh have zero exit status for "[ -n ]" and "[ -z ]"
>
> By running qemu without network by default we make common usage of and
> first encounter with qemustart script more comfortable.  With networking
> only two characters argument away.
>
> Cc: Petr Štetiar 
> Signed-off-by: Yousong Zhou 
> ---
>  scripts/qemustart | 12 +++-
>  1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/qemustart b/scripts/qemustart
> index 951f225272..f0ffc64734 100755
> --- a/scripts/qemustart
> +++ b/scripts/qemustart
> @@ -74,7 +74,7 @@ check_setup_() {
>  }
>
>  check_setup() {
> -   [ -z $o_nonetwork ] || return 0
> +   [ -z "$o_network" ] || return 0
> check_setup_ || {
> __errmsg "please check the script content to see the 
> environment requirement"
> return 1
> @@ -90,6 +90,7 @@ Usage: $SELF [-h|--help]
>   [--kernel ]
>   [--rootfs ]
>   [--machine ]
> + [-n|--network]
>
>   will default to "generic" and must be specified if
>   are present
> @@ -120,13 +121,14 @@ rand_mac() {
>  }
>
>  parse_args() {
> +   o_network=
> o_qemu_extra=()
> while [ "$#" -gt 0 ]; do
> case "$1" in
> -   --no-network|-n) o_nonetwork=1; shift ;;
> --kernel) o_kernel="$2"; shift 2 ;;
> --rootfs) o_rootfs="$2"; shift 2 ;;
> --machine|-machine|-M) o_mach="$2"; shift 2 ;;
> +   --network|-n) o_network=1; shift ;;
> --help|-h)
> usage
> exit 0
> @@ -187,7 +189,7 @@ start_qemu_armvirt() {
> )
> }
>
> -   [ -n $o_nonetwork ] || {
> +   [ -z "$o_network" ] || {
> o_qemu_extra+=( \
> "-netdev" "bridge,id=lan,br=$BR_LAN,helper=$HELPER" \
> "-device" 
> "virtio-net-pci,id=devlan,netdev=lan,mac=$MAC_LAN" \
> @@ -229,7 +231,7 @@ start_qemu_malta() {
> # NOTE: order of wan, lan -device arguments matters as it will affect 
> which
> # one will be actually used as the wan, lan network interface inside 
> the
> # guest machine
> -   [ -n $o_nonetwork ] || {
> +   [ -z "$o_network" ] || {
> o_qemu_extra+=( \
> "-netdev" "bridge,id=wan,br=$BR_WAN,helper=$HELPER" 
> "-device" \
> 
> "virtio-net-pci,id=devwan,netdev=wan,mac=$MAC_WAN" \
> @@ -276,7 +278,7 @@ start_qemu_x86() {
> )
> }
>
> -   [ -n $o_nonetwork ] || {
> +   [ -z "$o_network" ] || {
> o_qemu_extra+=( \
> "-netdev" "bridge,id=lan,br=$BR_LAN,helper=$HELPER" \
> "-device" 
> "virtio-net-pci,id=devlan,netdev=lan,mac=$MAC_LAN" \
>
I pushed a patch
(https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=9424b6f998917e2926c0b7afb8d7a968590da335)
yesterday which fixes the [ -n ] and [ -z ] issues

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

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


[OpenWrt-Devel] [PATCH 2/2] scripts/qemustart: fix network device emulation

2019-04-25 Thread Yousong Zhou
We only enabled pcnet driver for malta machine, and x86/legacy target
was supposed to only support e1000 model

Cc: Petr Štetiar 
Signed-off-by: Yousong Zhou 
---
 scripts/qemustart | 28 +---
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/scripts/qemustart b/scripts/qemustart
index f0ffc64734..64a6ebf17b 100755
--- a/scripts/qemustart
+++ b/scripts/qemustart
@@ -232,11 +232,9 @@ start_qemu_malta() {
# one will be actually used as the wan, lan network interface inside the
# guest machine
[ -z "$o_network" ] || {
-   o_qemu_extra+=( \
-   "-netdev" "bridge,id=wan,br=$BR_WAN,helper=$HELPER" 
"-device" \
-   "virtio-net-pci,id=devwan,netdev=wan,mac=$MAC_WAN" \
-   "-netdev" "bridge,id=lan,br=$BR_LAN,helper=$HELPER" \
-   "-device" 
"virtio-net-pci,id=devlan,netdev=lan,mac=$MAC_LAN" \
+   o_qemu_extra+=(
+   -netdev bridge,id=wan,br="$BR_WAN,helper=$HELPER" 
-device pcnet,netdev=wan,mac="$MAC_WAN"
+   -netdev bridge,id=lan,br="$BR_LAN,helper=$HELPER" 
-device pcnet,netdev=lan,mac="$MAC_LAN"
)
}
 
@@ -279,12 +277,20 @@ start_qemu_x86() {
}
 
[ -z "$o_network" ] || {
-   o_qemu_extra+=( \
-   "-netdev" "bridge,id=lan,br=$BR_LAN,helper=$HELPER" \
-   "-device" 
"virtio-net-pci,id=devlan,netdev=lan,mac=$MAC_LAN" \
-   "-netdev" "bridge,id=wan,br=$BR_WAN,helper=$HELPER" 
"-device" \
-   "virtio-net-pci,id=devwan,netdev=wan,mac=$MAC_WAN" \
-   )
+   case "${o_subtarget%-*}" in
+   legacy)
+   o_qemu_extra+=(
+   -netdev 
"bridge,id=lan,br=$BR_LAN,helper=$HELPER" -device 
"e1000,id=devlan,netdev=lan,mac=$MAC_LAN"
+   -netdev 
"bridge,id=wan,br=$BR_WAN,helper=$HELPER" -device 
"e1000,id=devwan,netdev=wan,mac=$MAC_WAN"
+   )
+   ;;
+   generic|64)
+   o_qemu_extra+=(
+   -netdev 
"bridge,id=lan,br=$BR_LAN,helper=$HELPER" -device 
"virtio-net-pci,id=devlan,netdev=lan,mac=$MAC_LAN"
+   -netdev 
"bridge,id=wan,br=$BR_WAN,helper=$HELPER" -device 
"virtio-net-pci,id=devwan,netdev=wan,mac=$MAC_WAN"
+   )
+   ;;
+   esac
}
 
case "${o_subtarget%-*}" in

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


[OpenWrt-Devel] [PATCH 1/2] scripts/qemustart: no-network by default and enable with -n

2019-04-25 Thread Yousong Zhou
Before this change, we have no way to have network on as both bash and
zsh have zero exit status for "[ -n ]" and "[ -z ]"

By running qemu without network by default we make common usage of and
first encounter with qemustart script more comfortable.  With networking
only two characters argument away.

Cc: Petr Štetiar 
Signed-off-by: Yousong Zhou 
---
 scripts/qemustart | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/scripts/qemustart b/scripts/qemustart
index 951f225272..f0ffc64734 100755
--- a/scripts/qemustart
+++ b/scripts/qemustart
@@ -74,7 +74,7 @@ check_setup_() {
 }
 
 check_setup() {
-   [ -z $o_nonetwork ] || return 0
+   [ -z "$o_network" ] || return 0
check_setup_ || {
__errmsg "please check the script content to see the 
environment requirement"
return 1
@@ -90,6 +90,7 @@ Usage: $SELF [-h|--help]
  [--kernel ]
  [--rootfs ]
  [--machine ]
+ [-n|--network]
 
  will default to "generic" and must be specified if
  are present
@@ -120,13 +121,14 @@ rand_mac() {
 }
 
 parse_args() {
+   o_network=
o_qemu_extra=()
while [ "$#" -gt 0 ]; do
case "$1" in
-   --no-network|-n) o_nonetwork=1; shift ;;
--kernel) o_kernel="$2"; shift 2 ;;
--rootfs) o_rootfs="$2"; shift 2 ;;
--machine|-machine|-M) o_mach="$2"; shift 2 ;;
+   --network|-n) o_network=1; shift ;;
--help|-h)
usage
exit 0
@@ -187,7 +189,7 @@ start_qemu_armvirt() {
)
}
 
-   [ -n $o_nonetwork ] || {
+   [ -z "$o_network" ] || {
o_qemu_extra+=( \
"-netdev" "bridge,id=lan,br=$BR_LAN,helper=$HELPER" \
"-device" 
"virtio-net-pci,id=devlan,netdev=lan,mac=$MAC_LAN" \
@@ -229,7 +231,7 @@ start_qemu_malta() {
# NOTE: order of wan, lan -device arguments matters as it will affect 
which
# one will be actually used as the wan, lan network interface inside the
# guest machine
-   [ -n $o_nonetwork ] || {
+   [ -z "$o_network" ] || {
o_qemu_extra+=( \
"-netdev" "bridge,id=wan,br=$BR_WAN,helper=$HELPER" 
"-device" \
"virtio-net-pci,id=devwan,netdev=wan,mac=$MAC_WAN" \
@@ -276,7 +278,7 @@ start_qemu_x86() {
)
}
 
-   [ -n $o_nonetwork ] || {
+   [ -z "$o_network" ] || {
o_qemu_extra+=( \
"-netdev" "bridge,id=lan,br=$BR_LAN,helper=$HELPER" \
"-device" 
"virtio-net-pci,id=devlan,netdev=lan,mac=$MAC_LAN" \

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


[OpenWrt-Devel] [PATCH] uboot-tegra: bump to 2019.04

2019-04-25 Thread Tomasz Maciej Nowak
This version has important change for tegra boards which is reserving
32MB memory for Linux kernel instead of current 16MB.

Signed-off-by: Tomasz Maciej Nowak 
---
 package/boot/uboot-tegra/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/boot/uboot-tegra/Makefile 
b/package/boot/uboot-tegra/Makefile
index 191d108771..a42d9cfc27 100644
--- a/package/boot/uboot-tegra/Makefile
+++ b/package/boot/uboot-tegra/Makefile
@@ -6,10 +6,10 @@
 #
 include $(TOPDIR)/rules.mk
 
-PKG_VERSION := 2019.01
+PKG_VERSION := 2019.04
 PKG_RELEASE := 1
 
-PKG_HASH := 50bd7e5a466ab828914d080d5f6a432345b500e8fba1ad3b7b61e95e60d51c22
+PKG_HASH := 76b7772d156b3ddd7644c8a1736081e55b78828537ff714065d21dbade229bef
 
 PKG_MAINTAINER := Tomasz Maciej Nowak 
 
-- 
2.21.0


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


Re: [OpenWrt-Devel] [PATCH v2 2/2] mvebu: fix board_name condition in 79_move_config

2019-04-25 Thread Tomasz Maciej Nowak
W dniu 24.04.2019 o 21:14, Klaus Kudielka pisze:
> The correct board_name for the Turris Omnia is armada-385-turris-omnia.
> 
> Fixes: 4e8345ff68 ("mvebu: base-files: autodetect upgrade device")
> 
> Signed-off-by: Klaus Kudielka 

Acked-by: Tomasz Maciej Nowak 

Thanks.

> ---
>  target/linux/mvebu/base-files/lib/preinit/79_move_config | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target/linux/mvebu/base-files/lib/preinit/79_move_config 
> b/target/linux/mvebu/base-files/lib/preinit/79_move_config
> index 64c0cc0eea..f7e23cc324 100644
> --- a/target/linux/mvebu/base-files/lib/preinit/79_move_config
> +++ b/target/linux/mvebu/base-files/lib/preinit/79_move_config
> @@ -9,7 +9,7 @@ move_config() {
>  
>   if export_bootdevice && export_partdevice partdev 1; then
>   case $(board_name) in
> - turris-omnia)
> + armada-385-turris-omnia)
>   insmod nls_cp437
>   insmod nls_iso8859-1
>   insmod fat
> 

-- 
TMN

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


Re: [OpenWrt-Devel] [PATCH v2 1/2] base-files: improve lib/upgrade/common.sh

2019-04-25 Thread Tomasz Maciej Nowak
W dniu 24.04.2019 o 21:14, Klaus Kudielka pisze:
> Recently, upgrade device autodetection has been added to the mvebu target.
> This exposes some shortcomings of the generic export_bootdevice function,
> e.g. on the Turris Omnia: export_bootdevice silently reports the root
> partition to be the boot device. This makes the sysupgrade process
> fail at several places.
> 
> Fix this by clearly distinguishing between /proc/cmdline arguments which
> specify the boot disk, and those which specify the root partition. Only
> in the latter case, strip off the partition, and do it consistently.
> Include /dev/mmcblk* and /dev/sd* as potential arguments to "root=".
> 
> Remove workarounds for the old, inconsistent behaviour from the following
> targets: apm821xx, brcm2708, omap, sunxi.
> 
> Fixes: 4e8345ff68 ("mvebu: base-files: autodetect upgrade device")
> 
> Signed-off-by: Klaus Kudielka 

Acked-by: Tomasz Maciej Nowak 

Thanks.

> ---
>  .../base-files/files/lib/upgrade/common.sh| 27 +--
>  .../apm821xx/base-files/lib/upgrade/wdbook.sh | 11 +++-
>  .../base-files/lib/upgrade/platform.sh| 11 +++-
>  .../base-files/lib/preinit/79_move_config |  2 +-
>  .../omap/base-files/lib/upgrade/platform.sh   |  7 +++--
>  .../base-files/lib/preinit/79_move_config |  2 +-
>  .../sunxi/base-files/lib/upgrade/platform.sh  |  7 +++--
>  7 files changed, 33 insertions(+), 34 deletions(-)
> 
> diff --git a/package/base-files/files/lib/upgrade/common.sh 
> b/package/base-files/files/lib/upgrade/common.sh
> index b3a29fb32e..d906023dab 100644
> --- a/package/base-files/files/lib/upgrade/common.sh
> +++ b/package/base-files/files/lib/upgrade/common.sh
> @@ -101,24 +101,30 @@ get_magic_long() {
>  }
>  
>  export_bootdevice() {
> - local cmdline uuid disk uevent line
> + local cmdline bootdisk rootpart uuid disk uevent line
>   local MAJOR MINOR DEVNAME DEVTYPE
>  
>   if read cmdline < /proc/cmdline; then
>   case "$cmdline" in
>   *block2mtd=*)
> - disk="${cmdline##*block2mtd=}"
> - disk="${disk%%,*}"
> + bootdisk="${cmdline##*block2mtd=}"
> + bootdisk="${bootdisk%%,*}"
>   ;;
>   *root=*)
> - disk="${cmdline##*root=}"
> - disk="${disk%% *}"
> + rootpart="${cmdline##*root=}"
> + rootpart="${rootpart%% *}"
>   ;;
>   esac
>  
> - case "$disk" in
> + case "$bootdisk" in
> + /dev/*)
> + uevent="/sys/class/block/${bootdisk##*/}/uevent"
> + ;;
> + esac
> +
> + case "$rootpart" in
>   
> PARTUUID=[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]-02)
> - uuid="${disk#PARTUUID=}"
> + uuid="${rootpart#PARTUUID=}"
>   uuid="${uuid%-02}"
>   for disk in $(find /dev -type b); do
>   set -- $(dd if=$disk bs=1 skip=440 
> count=4 2>/dev/null | hexdump -v -e '4/1 "%02x "')
> @@ -128,7 +134,12 @@ export_bootdevice() {
>   fi
>   done
>   ;;
> - /dev/*)
> + /dev/mmcblk[0-9]p2)
> + disk="${rootpart%p2}"
> + uevent="/sys/class/block/${disk##*/}/uevent"
> + ;;
> + /dev/sd[a-z]2)
> + disk="${rootpart%2}"
>   uevent="/sys/class/block/${disk##*/}/uevent"
>   ;;
>   esac
> diff --git a/target/linux/apm821xx/base-files/lib/upgrade/wdbook.sh 
> b/target/linux/apm821xx/base-files/lib/upgrade/wdbook.sh
> index 2287e0619d..c191271149 100644
> --- a/target/linux/apm821xx/base-files/lib/upgrade/wdbook.sh
> +++ b/target/linux/apm821xx/base-files/lib/upgrade/wdbook.sh
> @@ -7,7 +7,7 @@ mbl_do_platform_check() {
>  
>   [ "$#" -gt 1 ] && return 1
>  
> - export_bootdevice && export_partdevice diskdev -2 || {
> + export_bootdevice && export_partdevice diskdev 0 || {
>   echo "Unable to determine upgrade device"
>   return 1
>   }
> @@ -36,7 +36,7 @@ mbl_do_platform_check() {
>  mbl_do_upgrade() {
>   local diskdev partdev diff
>  
> - export_bootdevice && export_partdevice diskdev -2 || {
> + export_bootdevice && export_partdevice diskdev 0 || {
>   echo "Unable to determine upgrade device"
>   return 1
>   }
> @@ -70,10 +70,6 @@ mbl_do_upgrade() {
>  
>   #iterate over each partition from the image and write 

[OpenWrt-Devel] [PATCH] ramips: Add support for Head Weblink HDRM200

2019-04-25 Thread Kristian Evensen
Head Weblink HDRM200 is a dual-sim router based on MT7620A. The detailed
specifications are:

- MT7620A (580MHz)
- 64MB RAM
- 16MB of flash (SPI NOR)
- 6x 10/100Mbps Ethernet (MT7620A built-in switch)
- 1x microSD slot
- 1x miniPCIe slot (only USB2.0 bus)
- 2x SIM slots (standard size)
- 1x USB2.0 port
- 1x 2.4GHz wifi (rt2800)
- 1x 5GHz wifi (mt7621)
- 1x reset button
- 1x WPS button
- 3x GPIO-controllable LEDs
- 1x 10 pin terminal block (RS232, RS485, 4 x GPIO)

Tested:
- Ethernet switch
- Wifi
- USB slot
- SD card slot
- miniPCIe-slot
- sysupgrade
- reset button

Installation instructions:

Installing OpenWRT for the first time requires a bit of work, as the
board does not ship with OpenWRT. In addition, the bootloader
automatically reboots when installing an image over tftp.

In order to install OpenWRT, you first need to compile an initramfs
(ramdisk)-image for the device. Once the image is ready, you need to do
the following:

* Copy the initramfs-image to your tftp-root (default filename is
test.bin) and configure networking accordingly (default server IP is
10.10.10.3, client 10.10.10.123). Start your tftp server.
* Open the board and connect to UART. The pins are exposed and clearly
marked.
* Boot the board and press 1.
* Either use the default filename and client/server IP-addresses, or
specify your own.

The image should now be loaded to memory and board boot. If the router
reboots while the image is loading, you need to try again. Once the
board has booted, copy the sysupgrade-image to the router and run
sysupgrade in order to install OpenWRT to the flash.

Notes:

- You control which SIM slot to use by writing 0/1 to
/sys/class/gpio/sim_switch/value. In order for the change to take
effect, you can either use AT-commands (AT+CFUN) or power-cycle the
modem (write 0/1 to /sys/class/gpio/power_mpcie/value).
- RS485 is available on /dev/ttyS0.
- RS232 is available on /dev/ttyS1.
- The name of the ioX-gpios map to the labels on the casing.

Signed-off-by: Kristian Evensen 
---
 .../ramips/base-files/etc/board.d/01_leds |   3 +
 .../ramips/base-files/etc/board.d/02_network  |   1 +
 target/linux/ramips/base-files/lib/ramips.sh  |   3 +
 target/linux/ramips/dts/HDRM200.dts   | 226 ++
 target/linux/ramips/image/mt7620.mk   |   8 +
 5 files changed, 241 insertions(+)
 create mode 100644 target/linux/ramips/dts/HDRM200.dts

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 1fc86c44c3..c9da17ddc9 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -184,6 +184,9 @@ hc5861)
ucidef_set_led_netdev "wifi5g" "wifi5g" "$boardname:blue:wlan5g" "wlan0"
ucidef_set_led_netdev "wifi2g" "wifi2g" "$boardname:blue:wlan2g" "wlan1"
;;
+hdrm200)
+   set_wifi_led "$boardname:green:wifi"
+   ;;
 hg255d)
set_wifi_led "$boardname:green:wlan"
ucidef_set_led_netdev "internet" "internet" "$boardname:green:internet" 
"eth0.2"
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 28fd00926c..69c281aeeb 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -315,6 +315,7 @@ ramips_setup_interfaces()
"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0"
;;
hc5661|\
+   hdrm200|\
y1s)
ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "5:lan" "0:wan" "6@eth0"
diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
b/target/linux/ramips/base-files/lib/ramips.sh
index 6742c5370b..ea12a021b3 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -229,6 +229,9 @@ ramips_board_detect() {
*"HC5962")
name="hc5962"
;;
+   *"HDRM200")
+   name="hdrm200"
+   ;;
*"HG255D")
name="hg255d"
;;
diff --git a/target/linux/ramips/dts/HDRM200.dts 
b/target/linux/ramips/dts/HDRM200.dts
new file mode 100644
index 00..b076f30978
--- /dev/null
+++ b/target/linux/ramips/dts/HDRM200.dts
@@ -0,0 +1,226 @@
+/dts-v1/;
+
+#include "mt7620a.dtsi"
+
+#include 
+#include 
+
+/ {
+   compatible = "head-weblink,hdrm200", "ralink,mt7620a-soc";
+   model = "Head Weblink HDRM200";
+
+   aliases {
+   led-boot = _system;
+   led-failsafe = _system;
+   led-running = _system;
+   led-upgrade = _system;
+   };
+
+   chosen {
+   bootargs = "console=ttyS1,57600";
+   };
+
+   gpio-export {
+   compatible = "gpio-export";
+   #size-cells = <0>;
+
+   sim_switch {
+   gpio-export,name 

[OpenWrt-Devel] [PATCH] sdk: fix building external modules when CONFIG_STACK_VALIDATION=y

2019-04-25 Thread Yousong Zhou
The option is at the moment enabled for x86/64.  The selection chain
should be

config RETPOLINE
  select STACK_VALIDATION if HAVE_STACK_VALIDATION
config x86
  select HAVE_STACK_VALIDATIONif X86_64

cryptdev-linux:

make[4]: Entering directory 
'/store/buildbot/slave/x86_64/build/sdk/build_dir/target-x86_64_musl/linux-x86_64/cryptodev-linux-cryptodev-linux-1.10'
make -C 
/store/buildbot/slave/x86_64/build/sdk/build_dir/target-x86_64_musl/linux-x86_64/linux-4.14.113
 
M=/store/buildbot/slave/x86_64/build/sdk/build_dir/target-x86_64_musl/linux-x86_64/cryptodev-linux-cryptodev-linux-1.10
 ARCH=x86 CROSS_COMPILE=x86_64-openwrt-linux-musl- modules
make[5]: Entering directory 
'/store/buildbot/slave/x86_64/build/sdk/build_dir/target-x86_64_musl/linux-x86_64/linux-4.14.113'
make[6]: *** No rule to make target 
'/store/buildbot/slave/x86_64/build/sdk/build_dir/target-x86_64_musl/linux-x86_64/cryptodev-linux-cryptodev-linux-1.10/ioctl.o',
 needed by 
'/store/buildbot/slave/x86_64/build/sdk/build_dir/target-x86_64_musl/linux-x86_64/cryptodev-linux-cryptodev-linux-1.10/cryptodev.o'.
  Stop.
Makefile:1533: recipe for target 
'_module_/store/buildbot/slave/x86_64/build/sdk/build_dir/target-x86_64_musl/linux-x86_64/cryptodev-linux-cryptodev-linux-1.10'
 failed

Open vSwitch intree kmods

make[7]: Entering directory 
'/store/buildbot/slave/x86_64/build/sdk/build_dir/target-x86_64_musl/linux-x86_64/openvswitch-2.11.0/datapath/linux'
make -C 
/store/buildbot/slave/x86_64/build/sdk/build_dir/target-x86_64_musl/linux-x86_64/linux-4.14.111
 ARCH=x86 
M=/store/buildbot/slave/x86_64/build/sdk/build_dir/target-x86_64_musl/linux-x86_64/openvswitch-2.11.0/datapath/linux
 modules
make[8]: Entering directory 
'/store/buildbot/slave/x86_64/build/sdk/build_dir/target-x86_64_musl/linux-x86_64/linux-4.14.111'
make[9]: *** No rule to make target 'tools/objtool/objtool', needed by 
'/store/buildbot/slave/x86_64/build/sdk/build_dir/target-x86_64_musl/linux-x86_64/openvswitch-2.11.0/datapath/linux/actions.o'.
  Stop.
Makefile:1533: recipe for target 
'_module_/store/buildbot/slave/x86_64/build/sdk/build_dir/target-x86_64_musl/linux-x86_64/openvswitch-2.11.0/datapath/linux'
 failed
make[8]: *** 
[_module_/store/buildbot/slave/x86_64/build/sdk/build_dir/target-x86_64_musl/linux-x86_64/openvswitch-2.11.0/datapath/linux]
 Error 2
make[8]: Leaving directory 
'/store/buildbot/slave/x86_64/build/sdk/build_dir/target-x86_64_musl/linux-x86_64/linux-4.14.111'

Reference: builddeb: include objtool binary in headers package, 
https://patchwork.kernel.org/patch/9014071/
Signed-off-by: Yousong Zhou 
---
 target/sdk/Makefile | 8 
 1 file changed, 8 insertions(+)

diff --git a/target/sdk/Makefile b/target/sdk/Makefile
index 95ac3be197..3b860db93a 100644
--- a/target/sdk/Makefile
+++ b/target/sdk/Makefile
@@ -94,6 +94,14 @@ $(BIN_DIR)/$(SDK_NAME).tar.xz: clean
$(TAR) -cf - -C $(TOPDIR) $(KDIR_BASE)/tools/usb/usbip/ | \
$(TAR) -xf - -C $(SDK_BUILD_DIR)
 
+   # Copy objtool executables.  They are required for building external
+   # modules if "Compile-time stack metadata validation" is enabled.
+   if grep -q '^CONFIG_STACK_VALIDATION=y' $(LINUX_DIR)/.config; then \
+   $(TAR) -cf - -C $(TOPDIR) \
+   `cd $(TOPDIR); find $(KDIR_BASE)/tools/objtool 
-type f -executable` | \
+   $(TAR) -xf - -C $(SDK_BUILD_DIR); \
+   fi
+
(cd $(SDK_BUILD_DIR); find $(STAGING_SUBDIR_HOST)/bin 
$(STAGING_SUBDIR_HOST)/usr/bin \
$(STAGING_SUBDIR_TOOLCHAIN)/bin 
$(STAGING_SUBDIR_TOOLCHAIN)/*/bin $(STAGING_SUBDIR_TOOLCHAIN)/libexec \
-type f | $(XARGS) $(SCRIPT_DIR)/bundle-libraries.sh 
$(SDK_BUILD_DIR)/$(STAGING_SUBDIR_HOST))

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