[OpenWrt-Devel] [PATCH v2] zynq: make title consistent for all devices

2019-05-15 Thread Luis Araneda
Modify the title to match the following format, as it's enough
to uniquely identify a device:
 

This matches what's done for other targets and has the
added benefit of creating a sorted-by-manufacturer list
of devices on menuconfig

Signed-off-by: Luis Araneda 
---
Changes since v1:
- Improved commit message
- Removed the "development board" part of all boards, as requested
---
 target/linux/zynq/image/Makefile | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/target/linux/zynq/image/Makefile b/target/linux/zynq/image/Makefile
index d8a882313b..6e45d2bca4 100644
--- a/target/linux/zynq/image/Makefile
+++ b/target/linux/zynq/image/Makefile
@@ -51,28 +51,28 @@ endef
 
 define Device/avnet_zynq-zed
$(call Device/FitImageGzip)
-   DEVICE_TITLE := Avnet ZedBoard board
+   DEVICE_TITLE := Avnet ZedBoard
DEVICE_DTS := zynq-zed
 endef
 TARGET_DEVICES += avnet_zynq-zed
 
 define Device/digilent_zynq-zybo
$(call Device/FitImageGzip)
-   DEVICE_TITLE := ZYBO Development Board
+   DEVICE_TITLE := Digilent Zybo
DEVICE_DTS := zynq-zybo
 endef
 TARGET_DEVICES += digilent_zynq-zybo
 
 define Device/digilent_zynq-zybo-z7
$(call Device/FitImageGzip)
-   DEVICE_TITLE := Digilent Zybo Z7 board
+   DEVICE_TITLE := Digilent Zybo Z7
DEVICE_DTS := zynq-zybo-z7
 endef
 TARGET_DEVICES += digilent_zynq-zybo-z7
 
 define Device/xlnx_zynq-zc702
$(call Device/FitImageGzip)
-   DEVICE_TITLE := ZC702 Development Board
+   DEVICE_TITLE := Xilinx ZC702
DEVICE_DTS := zynq-zc702
DEVICE_PACKAGES:=kmod-can kmod-can-xilinx-can
 endef
-- 
2.21.0


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


[OpenWrt-Devel] ASUS-MAP-AC2200 Low 5G RSSI issue

2019-05-15 Thread Sam Samy
Hi Guys,

  I looked into the boarddata/cal/otp files and all look good for all
the radios and match the stock firmware. Only issue I saw was ASUS
variant name is not present in the board-2.bin for PCIe QCA9888. This,
I worked around by removing the variant name in device tree so that it
will pick the standard one which seem to have the correct board data
for QCA9888 anyway.

Even Marius build that he posted online when he brought this board up
seem to have the same RSSI issue. Its generally 20dB down from stock
firmware which will the reduce the coverage range significantly by
20-25 feet.

I am attaching the debug logs with ATH10K_DBG_BOOT logs which prints
the files loaded and other boot information for your perusal.

At this point I am not sure if the firmware is even reading the
board/cal/otp data that is downloaded. Since I don't have access to
firmware I don't know how to debug this further.


Thanks



On Tue, May 14, 2019 at 6:00 PM Sam Samy  wrote:
>
> > Yes, the implemented method for reading the data is not correct for the
> > wave 2 cards (and maybe also other). You can try the attached hack. At
> > least this worked in 2017 when I've poked around in the stuff with
> > Christian Lamparter.
>
> Latest code already seem to be doing this.
>
> Thanks
>
> On Tue, May 14, 2019 at 1:33 AM Sven Eckelmann  wrote:
> >
> > On Monday, 13 May 2019 22:58:00 CEST Sam Samy wrote:
> > >  I installed master branch openwrt onto Asus MAP-AC2200 AP. It has tri
> > > band. Its based on IPQ4019 DK04 QCA reference platform. 2 radios
> > > (2Ghz/5Ghz) on AHB bus and one 5GHZ on PCIe bus. Its generally working
> > > fine except one problem in 5Ghz. On both the 5Ghz radios the RSSI is
> > > pretty low on any 5Ghz channel I put it in.  In one feet range I see -60dB
> > > RSSI, where as the stock firmware that came with the AP gives an RSSI
> > > of -36dB at one foot distance.The downstream transmit rates are MCS8/9
> > > for most part. The 2Ghz is working fine.
> >
> > It could be the boarddata which contains more than the targetpower and CTLs
> > (and thus not necessarily visible in tpc_stats). As first check, test 
> > whether
> > your board-2.bin has the md5sum 34c1e73e609a27eb9848fdc89cbc2be7 for
> > /lib/firmware/ath10k/QCA4019/hw1.0/board-2.bin. Also check that the correct
> > BDF (with the variant string is loaded). But this should only affect
> > the QCA4019 5GHz PHY because the QCA9886 boarddata is generated here using 
> > the
> > pre-cal data from art (unsure whether this is valid or not for this board 
> > and
> > bootup sequence).
> >
> > You can just check with the ath10k-bdencoder [0] from qca-swiss-army-knife
> > whether the board files from board-2.bin are the ones which also your stock
> > firmware is loading.
> >
> > The next big problem are filters in the rx/tx chains [1]. The 
> > ieee80211-freq-
> > limit in the DTS file should assist you and not allow you to chose the wrong
> > channel/frequency for a specific PHY. But maybe the author accidentally
> > switched the settings in the board and actually wanted the lower 5GHz 
> > channels
> > on the SoC 5GHz PHY and the the upper 5GHz channels on the PCIe card? This
> > would be at least worth a try.
> >
> > > What is the reg. domains 0x20 and 0x58 value points to?
> >
> > It is 20 (0x14) and not 0x20. Same for 58 (0x3a)
> >
> > Btw. the regd numbers from QCA can be checked in regd_common.h [2]. The
> > mapping in regDomainPairs is not necessarily correct because someone has to
> > take them from the newest proprietary driver and use them to update the 
> > ath*k
> > stuff.
> >
> > >   Looks like ./sys/kernel/debug/ieee80211/phy2/ath10k/cal_data is junk
> > > for both the 5Ghz radios even though the
> > > pre-cal-pci-:01:00.0.bin/pre-cal-ahb-a80.wifi.bin is correct.
> >
> > Yes, the implemented method for reading the data is not correct for the
> > wave 2 cards (and maybe also other). You can try the attached hack. At
> > least this worked in 2017 when I've poked around in the stuff with
> > Christian Lamparter.
> >
> > Kind regards,
> > Sven
> >
> > [0] 
> > https://github.com/qca/qca-swiss-army-knife/blob/master/tools/scripts/ath10k/ath10k-bdencoder
> > [1] 
> > https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=41a86debe3c0a01e075e749d0bb1c6d631e35c32
> > [2] 
> > https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/tree/drivers/net/wireless/ath/regd_common.h?id=5fad78689a9229d08ea11af53e48de3c2a845ea3#n29


asus_openwrt.log
Description: Binary data
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/2] mtd: Make fixwrgg command work on DIR-685

2019-05-15 Thread Linus Walleij
The D-Link DIR-685 has the same problem as the
D-Link DAP-2695: when flashing the factory image, the
checksum includes the whole flashed image, even the
rootfs_data part with the end of filesystem mark.
Also the whole flashed image is stored in the flash,
so on the first boot, the whole rootfs image is loaded
into memory with the kernel.

This is fixed using the fixwrgg command to mtd, but
for this to work we need to make fixwrgg work with
the Little-Endian ARM DIR-685.

The code tries to be endian agnostic but this fails
because the WRGG image loader doesn't. On ARM, the
file size is stored in little endian format, and on
big-endian systems it is stored in big endian format,
so we can just drop all the friendly htonl() that
will make the shdr->size big endian: this will
actually break the little endian systems, and on
the big endian systems the native endianness will
still be correct.

The magic number is always stored in little endian
format however, so make sure this is always read
in LE32 format. I chose to create a straight-forward
le32_to_cpu() static inline that IMO is simple and
easy to read.

Cc: Stijn Tintel 
Signed-off-by: Linus Walleij 
---
It'd be great if someone could verify that this works
with DAP-2695 as well. The code is inspired by the
kernel mtdsplit code in
target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_wrgg.c
---
 package/system/mtd/src/wrgg.c | 27 +--
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/package/system/mtd/src/wrgg.c b/package/system/mtd/src/wrgg.c
index e0b5ca172d12..c62f9f550736 100644
--- a/package/system/mtd/src/wrgg.c
+++ b/package/system/mtd/src/wrgg.c
@@ -39,13 +39,10 @@
 #include "wrgg.h"
 #include "md5.h"
 
-#if __BYTE_ORDER == __BIG_ENDIAN
-#define STORE32_LE(X)   X) & 0x00FF) << 24) | (((X) & 
0xFF00) << 8) | (((X) & 0x00FF) >> 8) | (((X) & 0xFF00) >> 24))
-#elif __BYTE_ORDER == __LITTLE_ENDIAN
-#define STORE32_LE(X)   (X)
-#else
-#error unknown endianness!
-#endif
+static inline uint32_t le32_to_cpu(uint8_t *buf)
+{
+   return buf[0] | buf[1] << 8 | buf[2] << 16 | buf[3] << 24;
+}
 
 ssize_t pread(int fd, void *buf, size_t count, off_t offset);
 ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);
@@ -94,7 +91,7 @@ wrgg_fix_md5(struct wrgg03_header *shdr, int fd, size_t 
data_offset, size_t data
}
 
/* update the size in the image */
-   shdr->size = htonl(data_size);
+   shdr->size = data_size;
 
/* update the checksum in the image */
memcpy(shdr->digest, digest, sizeof(digest));
@@ -147,12 +144,14 @@ mtd_fixwrgg(const char *mtd, size_t offset, size_t 
data_size)
}
 
shdr = (struct wrgg03_header *)(first_block + offset);
-   if (shdr->magic1 != htonl(STORE32_LE(WRGG03_MAGIC))) {
-   fprintf(stderr, "magic1 %x\n", shdr->magic1);
-   fprintf(stderr, "htonl(WRGG03_MAGIC) %x\n", WRGG03_MAGIC);
+
+   /* The magic is always stored in little-endian byte order */
+   if (le32_to_cpu((uint8_t *)&shdr->magic1) != WRGG03_MAGIC) {
+   fprintf(stderr, "magic1 = %x\n", shdr->magic1);
+   fprintf(stderr, "WRGG03_MAGIC = %x\n", WRGG03_MAGIC);
fprintf(stderr, "No WRGG header found\n");
exit(1);
-   } else if (!ntohl(shdr->size)) {
+   } else if (!shdr->size) {
fprintf(stderr, "WRGG entity with empty image\n");
exit(1);
}
@@ -160,8 +159,8 @@ mtd_fixwrgg(const char *mtd, size_t offset, size_t 
data_size)
data_offset = offset + sizeof(struct wrgg03_header);
if (!data_size)
data_size = mtdsize - data_offset;
-   if (data_size > ntohl(shdr->size))
-   data_size = ntohl(shdr->size);
+   if (data_size > shdr->size)
+   data_size = shdr->size;
if (wrgg_fix_md5(shdr, fd, data_offset, data_size))
goto out;
 
-- 
2.20.1


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


[OpenWrt-Devel] [PATCH 2/2] gemini: Fix up firmware checksum on DIR-685

2019-05-15 Thread Linus Walleij
Using the same method as the D-Link DAP-2695 A1 we use
the "mtd" tool to augment the firmware checkum in flash
on first boot of a new firmware on the D-Link DIR-685.
We need to augment the Makefile for "mtd" to build in
the special WRGG fixup support for Gemini as well.

This works around the problem of the machine not booting
after factory install unless the sysupgrade is applied
immediately.

Based on commit e3875350f3e4185020b64e0588bba521cd1d6e64
"ar71xx: add support for D-Link DAP-2695 rev. A1"

Cc: Stijn Tintel 
Signed-off-by: Linus Walleij 
---
 package/system/mtd/src/Makefile   |  1 +
 .../etc/uci-defaults/09_fix-checksum  | 20 +++
 2 files changed, 21 insertions(+)
 create mode 100644 
target/linux/gemini/base-files/etc/uci-defaults/09_fix-checksum

diff --git a/package/system/mtd/src/Makefile b/package/system/mtd/src/Makefile
index 08a9fb295dac..e3265fe9f1b9 100644
--- a/package/system/mtd/src/Makefile
+++ b/package/system/mtd/src/Makefile
@@ -8,6 +8,7 @@ obj.wrg = wrg.o md5.o
 obj.wrgg = wrgg.o md5.o
 obj.tpl = tpl_ramips_recoveryflag.o
 obj.ar71xx = trx.o $(obj.seama) $(obj.wrgg)
+obj.gemini = $(obj.wrgg)
 obj.brcm = trx.o
 obj.brcm47xx = $(obj.brcm)
 obj.bcm53xx = $(obj.brcm) $(obj.seama)
diff --git a/target/linux/gemini/base-files/etc/uci-defaults/09_fix-checksum 
b/target/linux/gemini/base-files/etc/uci-defaults/09_fix-checksum
new file mode 100644
index ..5f79d1a65caa
--- /dev/null
+++ b/target/linux/gemini/base-files/etc/uci-defaults/09_fix-checksum
@@ -0,0 +1,20 @@
+#!/bin/sh
+#
+# Copyright (C) 2019 OpenWrt.org
+#
+
+. /lib/functions.sh
+
+board=$(board_name)
+
+fixwrgg() {
+   local kernel_size=$(sed -n 's/mtd[0-9]*: 
\([0-9a-f]*\).*"kernel".*/\1/p' /proc/mtd)
+
+   [ "$kernel_size" ] && mtd -c 0x$kernel_size fixwrgg firmware
+}
+
+case "$board" in
+dlink,dir-685)
+   fixwrgg
+   ;;
+esac
-- 
2.20.1


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


Re: [OpenWrt-Devel] [PATCH 4/4] ipq40xx: add support for secondary cores bringup

2019-05-15 Thread Павел
ср, 15 мая 2019 г., 22:35 Petr Štetiar :

> Павел  [2019-05-15 22:14:41]:
>
> > Not a problem, actually, but I've been suggested to squash them :)
> > https://github.com/openwrt/openwrt/pull/2043#issuecomment-491581897
>
> ok, thanks for the background, but still, squashing doesn't mean changing
> authorship and Christian has probably also warned you beforehand :-)
>
> "(Note: In some of the patches the "Author" in the commits is dissent1! So
>   watch out before sending them off)"
>

That was about different - I didn't switch from nickname to real name by
mistake when exported patches from my staging tree.

Thanks anyway, I'll add 2 commit messages into patchnotes within the
squashed patch. Is that okay?


> > Shouldn't the dev send the patch directly to me in order to be able to
> post
> > it on his behalf, like openwrt submitting patches guideline describes?
>
> From the kernel docs[1]:
>
> "The contribution is based upon previous work that, to the best of my
>  knowledge, is covered under an appropriate open source license and I have
> the
>  right under that license to submit that work with modifications, whether
>  created in whole or in part by me, under the same open source license
> (unless
>  I am permitted to submit under a different license), as indicated in the
> file;"
>
> so in short, kernel is covered by GPLv2 which allows you to do this if you
> retain the authorship.
>
> 1.
> https://www.kernel.org/doc/html/latest/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin


Okay, thanks for pointing out.


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


Re: [OpenWrt-Devel] [PATCH 4/4] ipq40xx: add support for secondary cores bringup

2019-05-15 Thread Petr Štetiar
Павел  [2019-05-15 22:14:41]:

> Not a problem, actually, but I've been suggested to squash them :)
> https://github.com/openwrt/openwrt/pull/2043#issuecomment-491581897

ok, thanks for the background, but still, squashing doesn't mean changing
authorship and Christian has probably also warned you beforehand :-)

"(Note: In some of the patches the "Author" in the commits is dissent1! So
  watch out before sending them off)"

> Shouldn't the dev send the patch directly to me in order to be able to post
> it on his behalf, like openwrt submitting patches guideline describes?

From the kernel docs[1]:

"The contribution is based upon previous work that, to the best of my
 knowledge, is covered under an appropriate open source license and I have the
 right under that license to submit that work with modifications, whether
 created in whole or in part by me, under the same open source license (unless
 I am permitted to submit under a different license), as indicated in the file;"

so in short, kernel is covered by GPLv2 which allows you to do this if you
retain the authorship.

1. 
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin

-- ynezz

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


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

2019-05-15 Thread Petr Štetiar
Kristian Evensen  [2019-05-15 20:50:45]:

> Head Weblink HDRM200 is a dual-sim router based on MT7620A. The detailed
> specifications are:

Thanks, I've merged it into my staging tree[1], but I had to fix one merge
conflict in target.mk so please check it if I did it properly.

1. 
https://git.openwrt.org/?p=openwrt/staging/ynezz.git;a=commit;h=9fe227e69dea69b4d16859e15d21ca3f66d6b7a3

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


Re: [OpenWrt-Devel] [PATCH 4/4] ipq40xx: add support for secondary cores bringup

2019-05-15 Thread Павел
ср, 15 мая 2019 г., 21:55 Petr Štetiar :

> Павел  [2019-05-15 20:35:38]:
>
> > This patchset consists of 2 patches with different authors that I have
> > squashed into 1. How should I preserve authorship in this case?
>
> Just add them as separate patches, exactly as produced by `git
> format-patch`
> command, don't squash them.
>

Not a problem, actually, but I've been suggested to squash them :)
https://github.com/openwrt/openwrt/pull/2043#issuecomment-491581897


> > I'm not the author of this code to upstream it.
>
> You don't need to be author in order to upstream it. It's quite common to
> post
> patches for review on behalf of other developers, you just need to keep
> proper
> authorship. My recent (rejected) attempt for example[1].
>
> 1. https://patchwork.ozlabs.org/patch/1086628/


Shouldn't the dev send the patch directly to me in order to be able to post
it on his behalf, like openwrt submitting patches guideline describes?


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


[OpenWrt-Devel] [PATCH] ramips: add factory image for WNDR3700v5

2019-05-15 Thread Jan Hoffmann 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 ---
This uses the existing rules for Sercomm factory images and moves them
to the ramips image Makefile, so they can be used in all subtargets.

The new factory image for WNDR3700v5 can be flashed using nmrpflash.

Signed-off-by: Jan Hoffmann 
---
 target/linux/ramips/image/Makefile  | 14 ++
 target/linux/ramips/image/mt7621.mk | 11 ++-
 target/linux/ramips/image/mt76x8.mk | 16 
 3 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/target/linux/ramips/image/Makefile 
b/target/linux/ramips/image/Makefile
index 6eef596caf..145dbf4ec5 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -10,6 +10,7 @@ include $(INCLUDE_DIR)/image.mk
 DEVICE_VARS += DTS IMAGE_SIZE NETGEAR_BOARD_ID NETGEAR_HW_ID
 DEVICE_VARS += BUFFALO_TAG_PLATFORM BUFFALO_TAG_VERSION BUFFALO_TAG_MINOR
 DEVICE_VARS += SEAMA_SIGNATURE SEAMA_MTDBLOCK
+DEVICE_VARS += SERCOMM_HWID SERCOMM_HWVER SERCOMM_SWVER
 
 loadaddr-y := 0x8000
 loadaddr-$(CONFIG_TARGET_ramips_rt288x) := 0x8800
@@ -132,6 +133,19 @@ define Build/zyimage
$(STAGING_DIR_HOST)/bin/zyimage $(1) $@
 endef
 
+define Build/sercom-seal
+   $(STAGING_DIR_HOST)/bin/mksercommfw \
+   -i $@ \
+   -b $(SERCOMM_HWID) \
+   -r $(SERCOMM_HWVER) \
+   -v $(SERCOMM_SWVER) \
+   $(1)
+endef
+
+define Build/sercom-footer
+   $(call Build/sercom-seal,-f)
+endef
+
 ralink_default_fw_size_4M=3866624
 ralink_default_fw_size_8M=8060928
 ralink_default_fw_size_16M=16121856
diff --git a/target/linux/ramips/image/mt7621.mk 
b/target/linux/ramips/image/mt7621.mk
index 9e42404f64..671e7f378a 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -531,7 +531,16 @@ TARGET_DEVICES += mqmaker_witi-512m
 
 define Device/wndr3700v5
   DTS := WNDR3700V5
-  IMAGE_SIZE := $(ralink_default_fw_size_16M)
+  BLOCKSIZE := 64k
+  IMAGE_SIZE := 15232k
+  SERCOMM_HWID := AYB
+  SERCOMM_HWVER := A001
+  SERCOMM_SWVER := 0x1054
+  IMAGES += factory.img
+  IMAGE/default := append-kernel | pad-to (BLOCKSIZE) | append-rootfs | 
pad-rootfs
+  IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | check-size 
(IMAGE_SIZE)
+  IMAGE/factory.img := pad-extra 320k | $$(IMAGE/default) | pad-to 
(BLOCKSIZE) | \
+   sercom-footer | pad-to 128 | zip WNDR3700v5.bin | sercom-seal
   DEVICE_TITLE := Netgear WNDR3700v5
   DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2 kmod-usb3 wpad-basic
 endef
diff --git a/target/linux/ramips/image/mt76x8.mk 
b/target/linux/ramips/image/mt76x8.mk
index ba3354a8a6..0f7d22c942 100644
--- a/target/linux/ramips/image/mt76x8.mk
+++ b/target/linux/ramips/image/mt76x8.mk
@@ -2,22 +2,6 @@
 # MT76x8 Profiles
 #
 
-DEVICE_VARS += SERCOMM_HWID SERCOMM_HWVER SERCOMM_SWVER
-
-define Build/sercom-seal
-   $(STAGING_DIR_HOST)/bin/mksercommfw \
-   -i $@ \
-   -b $(SERCOMM_HWID) \
-   -r $(SERCOMM_HWVER) \
-   -v $(SERCOMM_SWVER) \
-   $(1)
-endef
-
-define Build/sercom-footer
-   $(call Build/sercom-seal,-f)
-endef
-
-
 define Device/tplink
   TPLINK_FLASHLAYOUT :=
   TPLINK_HWID :=
-- 
2.17.1


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


[OpenWrt-Devel] [PATCH v2] system: uci: Use config dir on uci_add and support add_/del_list

2019-05-15 Thread Kristian Evensen
This commit makes three changes to the uci shell library:

* A check for UCI_CONFIG_DIR has been added to the command line when
adding anonymous sections. Without this change, adding anonymous
sections to configs not stored in /etc/config is not possible.

* Support for adding/removing items from lists were missing, so I have
added the functions uci_add_list() and uci_remove_list() to simplify
working with uci lists from scripts.

Signed-off-by; Kristian Evensen 

---
v1->v2:
* Rename uci_del_list() to uci_remove_list() in order to be consistent
with uci_remove() (thanks Petr Štetiar).
---
 package/system/uci/files/lib/config/uci.sh | 20 +++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/package/system/uci/files/lib/config/uci.sh 
b/package/system/uci/files/lib/config/uci.sh
index 78ec277669..1e85ced834 100644
--- a/package/system/uci/files/lib/config/uci.sh
+++ b/package/system/uci/files/lib/config/uci.sh
@@ -85,6 +85,15 @@ uci_set() {
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set 
"$PACKAGE.$CONFIG.$OPTION=$VALUE"
 }
 
+uci_add_list() {
+   local PACKAGE="$1"
+   local CONFIG="$2"
+   local OPTION="$3"
+   local VALUE="$4"
+
+   /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} add_list 
"$PACKAGE.$CONFIG.$OPTION=$VALUE"
+}
+
 uci_get_state() {
uci_get "$1" "$2" "$3" "$4" "/var/state"
 }
@@ -108,7 +117,7 @@ uci_add() {
local CONFIG="$3"
 
if [ -z "$CONFIG" ]; then
-   export ${NO_EXPORT:+-n} CONFIG_SECTION="$(/sbin/uci add 
"$PACKAGE" "$TYPE")"
+   export ${NO_EXPORT:+-n} CONFIG_SECTION="$(/sbin/uci 
${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} add "$PACKAGE" "$TYPE")"
else
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set 
"$PACKAGE.$CONFIG=$TYPE"
export ${NO_EXPORT:+-n} CONFIG_SECTION="$CONFIG"
@@ -132,6 +141,15 @@ uci_remove() {
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} del 
"$PACKAGE.$CONFIG${OPTION:+.$OPTION}"
 }
 
+uci_remove_list() {
+   local PACKAGE="$1"
+   local CONFIG="$2"
+   local OPTION="$3"
+   local VALUE="$4"
+
+   /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} del_list 
"$PACKAGE.$CONFIG.$OPTION=$VALUE"
+}
+
 uci_commit() {
local PACKAGE="$1"
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} commit $PACKAGE
-- 
2.19.1


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


Re: [OpenWrt-Devel] [PATCH 4/4] ipq40xx: add support for secondary cores bringup

2019-05-15 Thread Petr Štetiar
Павел  [2019-05-15 20:35:38]:

> This patchset consists of 2 patches with different authors that I have
> squashed into 1. How should I preserve authorship in this case?

Just add them as separate patches, exactly as produced by `git format-patch`
command, don't squash them.

> I'm not the author of this code to upstream it.

You don't need to be author in order to upstream it. It's quite common to post
patches for review on behalf of other developers, you just need to keep proper
authorship. My recent (rejected) attempt for example[1].

1. https://patchwork.ozlabs.org/patch/1086628/

-- ynezz

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


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

2019-05-15 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). Device is shipped with a SIMCOM
SIM7100E LTE modem.
- 2x SIM slots (standard size)
- 1x USB2.0 port
- 1x 2.4GHz wifi (rt2800)
- 1x 5GHz wifi (mt7612)
- 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 on the HDRM200, 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 
---
v3->v4:
* Update commit. I had forgot to remove instructions to compile a
ramdisk. This now done automatically (thanks Petr Štetiar).
* Fix image size in the Makefile (thanks Petr Štetiar).
* Group the wifi-LED together with other devices. I see that there are
several lone cases with the same LED name, but in order to reduce the
changes made by this patch I have left them as-is (thanks Petr Štetiar).

v2->v3:
* Build initramfs automatically, which means that ramdisk is now enabled
the mt7620-target. Due to this change, an initramfs-image is built for all
deivces, but this seems to be ok when looking at other targets (mt7621)
(thanks Petr Štetiar).
* Use generic board/model detection, updated the match in 01_leds and
02_network (thanks Petr Štetiar).
* Changed the device/target device in the Makefile to match the
compatible-string in the DTS (thanks Petr Štetiar).
* Use the user-space gpio-switch alternative instead of gpio-export in
the DTS (thanks Petr Štetiar).
* Update name of flash node in DTS to the more generic "flash0" (thanks
Petr Štetiar)..
* Fix typo in commit message (mt7621->mt7612) (thanks Tom Psyborg).
* Added the QMI and option drivers, as well as uqmi, so that the modem
is available for use out of the box.

v1->v2:
* Add SPDX line to DTS (thanks Rafał Miłecki).
---
 .../ramips/base-files/etc/board.d/01_leds |   1 +
 .../ramips/base-files/etc/board.d/02_network  |   1 +
 .../base-files/etc/board.d/03_gpio_switches   |   8 +
 target/linux/ramips/dts/HDRM200.dts   | 188 ++
 target/linux/ramips/image/mt7620.mk   |   9 +
 target/linux/ramips/mt7620/target.mk  |   2 +-
 6 files changed, 208 insertions(+), 1 deletion(-)
 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 fa20ab0714..9d42720c60 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -119,6 +119,7 @@ dir-615-h1)
;;
 dir-620-d1|\
 dlink,dwr-116-a1|\
+head-weblink,hdrm200|\
 mzk-ex300np)
set_wifi_led "$boardname:green:wifi"
;;
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 c2646876a2..b0037a0ce2 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -314,6 +314,7 @@ ramips_setup_interfaces()
"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0"
;;
hc5661|\
+   head-weblink,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/etc/board.d/03_gpio_switches 
b/target/linux/ramips/base-files/etc/board.d/03_gpio_switches
index 80e3c4c41f..fc376a4d1f 100755
--- a/target/linux/ramips/base-fil

Re: [OpenWrt-Devel] [PATCH 3/4] ipq40xx: fix high resolution timer

2019-05-15 Thread Petr Štetiar
Павел  [2019-05-15 20:30:09]:

> > Shouldn't this go through upstream as well?
> >
> 
> It should, but I'm not the author.

This is not a problem if you keep proper authorship (From and
Signed-off-by).

-- ynezz

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


Re: [OpenWrt-Devel] [PATCH 4/4] ipq40xx: add support for secondary cores bringup

2019-05-15 Thread Павел
ср, 15 мая 2019 г., 19:02 Petr Štetiar :

> Pavel Kubelun  [2019-05-14 16:42:20]:
>
> > --- /dev/null
> > +++
> b/target/linux/ipq40xx/patches-4.14/091-ipq40xx-add-support-for-secondary-cores-bringup.patch
> > @@ -0,0 +1,174 @@
> > +From 6126701397fa6c884fd78453d995e49df91a566a Mon Sep 17 00:00:00 2001
> > +From: Pavel Kubelun 
> > +Date: Mon, 13 May 2019 11:25:05 +0300
> > +Subject: [PATCH] ipq40xx: Add support for secondary cores bringup
> > +
> > +Cherry-pick QSDK patches to enable proper ipq40xx
> > +secondary cores bringup.
> > +
> > +
> https://source.codeaurora.org/quic/qsdk/oss/kernel/linux-msm/commit/?h=eggplant&id=f810b63c356bd72d9b89fb9c0b7e27c250c3540f
>
> Please preserve the authorship of the work and try to upstream this changes
> first, then backport it to OpenWrt.
>

This patchset consists of 2 patches with different authors that I have
squashed into 1. How should I preserve authorship in this case?
I'm not the author of this code to upstream it.


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


Re: [OpenWrt-Devel] [PATCH 3/4] ipq40xx: fix high resolution timer

2019-05-15 Thread Павел
ср, 15 мая 2019 г., 18:59 Petr Štetiar :

> Pavel Kubelun  [2019-05-14 16:42:19]:
>
> > diff --git
> a/target/linux/ipq40xx/patches-4.14/090-ipq40xx-fix-high-resolution-timer.patch
> b/target/linux/ipq40xx/patches-4.14/090-ipq40xx-fix-high-resolution-timer.patch
> > new file mode 100644
> > index 00..0fc50ec533
> > --- /dev/null
> > +++
> b/target/linux/ipq40xx/patches-4.14/090-ipq40xx-fix-high-resolution-timer.patch
> > @@ -0,0 +1,30 @@
> > +From 09f145f417a5d64d6b8d4476699dfb0eccc6c784 Mon Sep 17 00:00:00 2001
> > +From: Pavel Kubelun 
> > +Date: Tue, 7 May 2019 10:14:05 +0300
> > +Subject: [PATCH] ipq40xx: fix high resolution timer
> > +
> > +Cherry-picked from CAF QSDK repo.
>
> You should preserve the authorship of the changes if you do so. It looks
> now,
> like you're author of this work.
>

Sure, will fix this.


> > +The kernel is failing in switching the timer for high resolution
> > +mode and clock source operates in 10ms resolution. The always-on
> > +property needs to be given for timer device tree node to make
> > +clock source working in 1ns resolution.
>
> Shouldn't this go through upstream as well?
>

It should, but I'm not the author.


> > + soc {
> > diff --git
> a/target/linux/ipq40xx/patches-4.14/701-dts-ipq4019-add-mdio-node.patch
> b/target/linux/ipq40xx/patches-4.14/701-dts-ipq4019-add-mdio-node.patch
> > index 0e1bb87368..b7e241058c 100644
> > ---
> a/target/linux/ipq40xx/patches-4.14/701-dts-ipq4019-add-mdio-node.patch
> > +++
> b/target/linux/ipq40xx/patches-4.14/701-dts-ipq4019-add-mdio-node.patch
> > @@ -15,7 +15,7 @@ so the info might change.
> >
> >  --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi
> >  +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi
> > -@@ -566,6 +566,34 @@
> > +@@ -567,6 +567,34 @@
> >   status = "disabled";
> >   };
>
> Probably some leftover?
>

It's a refresh of existing patches, because they are applied to the same
file.


> > diff --git
> a/target/linux/ipq40xx/patches-4.14/702-dts-ipq4019-add-PHY-switch-nodes.patch
> b/target/linux/ipq40xx/patches-4.14/702-dts-ipq4019-add-PHY-switch-nodes.patch
> > index 03da6c863a..cc56a60ea3 100644
> > ---
> a/target/linux/ipq40xx/patches-4.14/702-dts-ipq4019-add-PHY-switch-nodes.patch
> > +++
> b/target/linux/ipq40xx/patches-4.14/702-dts-ipq4019-add-PHY-switch-nodes.patch
> > @@ -14,7 +14,7 @@ Signed-off-by: Christian Lamparter  >
> >
> >  --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi
> >  +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi
> > -@@ -594,6 +594,29 @@
> > +@@ -595,6 +595,29 @@
> >   };
> >   };
>
> Ditto.
>
> > diff --git
> a/target/linux/ipq40xx/patches-4.14/711-dts-ipq4019-add-ethernet-essedma-node.patch
> b/target/linux/ipq40xx/patches-4.14/711-dts-ipq4019-add-ethernet-essedma-node.patch
> > index 7302d237bc..80b16a8211 100644
> > ---
> a/target/linux/ipq40xx/patches-4.14/711-dts-ipq4019-add-ethernet-essedma-node.patch
> > +++
> b/target/linux/ipq40xx/patches-4.14/711-dts-ipq4019-add-ethernet-essedma-node.patch
> > @@ -25,7 +25,7 @@ Signed-off-by: Christian Lamparter  >
> >   };
> >
> >   cpus {
> > -@@ -617,6 +619,64 @@
> > +@@ -618,6 +620,64 @@
> >   status = "disabled";
> >   };
>
> Ditto.
>
> > diff --git
> a/target/linux/ipq40xx/patches-4.19/086-ipq40xx-fix-high-resolution-timer.patch
> b/target/linux/ipq40xx/patches-4.19/086-ipq40xx-fix-high-resolution-timer.patch
> > new file mode 100644
> > index 00..9d277fa8e0
> > --- /dev/null
> > +++
> b/target/linux/ipq40xx/patches-4.19/086-ipq40xx-fix-high-resolution-timer.patch
> > @@ -0,0 +1,30 @@
> > +From 09f145f417a5d64d6b8d4476699dfb0eccc6c784 Mon Sep 17 00:00:00 2001
> > +From: Pavel Kubelun 
> > +Date: Tue, 7 May 2019 10:14:05 +0300
> > +Subject: [PATCH] ipq40xx: fix high resolution timer
> > +
> > +Cherry-picked from CAF QSDK repo.
> > +Original commit message:
> > +The kernel is failing in switching the timer for high resolution
> > +mode and clock source operates in 10ms resolution. The always-on
> > +property needs to be given for timer device tree node to make
> > +clock source working in 1ns resolution.
>
> Same as above.
>
> > diff --git
> a/target/linux/ipq40xx/patches-4.19/701-dts-ipq4019-add-mdio-node.patch
> b/target/linux/ipq40xx/patches-4.19/701-dts-ipq4019-add-mdio-node.patch
> > index e5936a0c93..0298644d22 100644
> > ---
> a/target/linux/ipq40xx/patches-4.19/701-dts-ipq4019-add-mdio-node.patch
> > +++
> b/target/linux/ipq40xx/patches-4.19/701-dts-ipq4019-add-mdio-node.patch
> > @@ -15,7 +15,7 @@ so the info might change.
> >
> >  --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi
> >  +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi
> > -@@ -570,6 +570,34 @@
> > +@@ -571,6 +571,34 @@
> >   status = "disabled";
> >   };
>
> Ditto.
>
> > diff --git
> a/target/linux/ipq40xx/patches-4.19/702-dts-ipq4019-add-PHY-switch-nodes.patch
> b/target/linux/ipq40xx/patches-4.19/702-dts-ipq4019-add-PHY-switch-nodes.patch
> > index

Re: [OpenWrt-Devel] [PATCH 1/4] ipq40xx: directly define voltage per opp

2019-05-15 Thread Павел
ср, 15 мая 2019 г., 19:11 Petr Štetiar :

> Pavel Kubelun  [2019-05-14 16:42:17]:
>
> > diff --git
> a/target/linux/ipq40xx/patches-4.14/073-qcom-ipq4019-fix-cpu0-s-qcom-saw2-reg-value.patch
> b/target/linux/ipq40xx/patches-4.14/073-qcom-ipq4019-fix-cpu0-s-qcom-saw2-reg-value.patch
> > index d72e3d3c36..ac128ab9e1 100644
> > ---
> a/target/linux/ipq40xx/patches-4.14/073-qcom-ipq4019-fix-cpu0-s-qcom-saw2-reg-value.patch
> > +++
> b/target/linux/ipq40xx/patches-4.14/073-qcom-ipq4019-fix-cpu0-s-qcom-saw2-reg-value.patch
> > @@ -22,7 +22,7 @@ Signed-off-by: John Crispin 
> >
> >  --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi
> >  +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi
> > -@@ -262,7 +262,7 @@
> > +@@ -266,7 +266,7 @@
> >
> >   saw0: regulator@b089000 {
> >   compatible = "qcom,saw2";
>
> Some leftover?
>

It's a refresh of existing patches, because they are applied to the same
file.


> > diff --git
> a/target/linux/ipq40xx/patches-4.14/077-qcom-ipq4019-add-USB-devicetree-nodes.patch
> b/target/linux/ipq40xx/patches-4.14/077-qcom-ipq4019-add-USB-devicetree-nodes.patch
> > index 44c07f8f45..be413188a7 100644
> > ---
> a/target/linux/ipq40xx/patches-4.14/077-qcom-ipq4019-add-USB-devicetree-nodes.patch
> > +++
> b/target/linux/ipq40xx/patches-4.14/077-qcom-ipq4019-add-USB-devicetree-nodes.patch
> > @@ -41,7 +41,7 @@ Signed-off-by: John Crispin 
> >   };
> >  --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi
> >  +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi
> > -@@ -410,5 +410,79 @@
> > +@@ -414,5 +414,79 @@
> > "legacy";
> >   status = "disabled";
> >   };
>
> Ditto.
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 2/4] ipq40xx: fix sleep clock

2019-05-15 Thread Павел
ср, 15 мая 2019 г., 18:55 Petr Štetiar :

> Pavel Kubelun  [2019-05-14 16:42:18]:
>
> Hi,
>
> > It seems like sleep_clk was copied from ipq806x.
> > Fix ipq40xx sleep_clk to the value QSDK defines.
> >
> > Hope someone with datasheet could clarify the correct
> > value.
>
> what problem does this exactly fixes? Is there any particular reason why
> this
> shouldn't be sent upstream and then backported to OpenWrt?
>

There are no reasons why it shouldn't be sent upstream along with other
patches. I hope to find someone with datasheet beforehand to verify the
correct sleep clock rate.

Besides upstreaming a patch takes time while the next openwrt release
should be out soon I suppose.

This patch also contains a fix (node name) that allows the GCC driver to
correctly initialize the clock and its children (USB sleep clock in fact)


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


Re: [OpenWrt-Devel] [PATCH][opkg-lede] build: Allow overriding opkg state dir prefix

2019-05-15 Thread Petr Štetiar
Patrick McDermott  [2019-04-17 13:54:05]:

You've probably forget to add commit description, which would explain us why
you need this changes or what problem it fixes as requested in 

 https://openwrt.org/submitting-patches

> Signed-off-by: Patrick McDermott 
> ---
>  CMakeLists.txt | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index 26230b3..f57fe10 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -7,6 +7,7 @@ INCLUDE(TestBigEndian)
>  SET(HOST_CPU "" CACHE STRING "Override Host CPU")
>  SET(BUILD_CPU "" CACHE STRING "Override Host CPU")
>  SET(LOCK_FILE "/var/lock/opkg.lock" CACHE STRING "Override lock file path")
> +SET(STATE_DIR_PREFIX "/usr/lib" CACHE STRING "Override opkg state directory 
> prefix")
>  SET(PATH_SPEC "/usr/sbin:/usr/bin:/sbin:/bin" CACHE STRING "Override default 
> PATH value")
>  SET(VERSION "" CACHE STRING "Override version")
>  
> @@ -39,7 +40,7 @@ ADD_DEFINITIONS(-Os -Wall --std=gnu99 -g3 
> -Wmissing-declarations
>   -DDATADIR="/usr/share"
>   -DOPKGETCDIR="/etc"
>   -DOPKGLOCKFILE="${LOCK_FILE}"
> - -DOPKGLIBDIR="/usr/lib"
> + -DOPKGLIBDIR="${STATE_DIR_PREFIX}"
>   -DHOST_CPU_STR="${HOST_CPU}"
>   -DBUILD_CPU=${BUILD_CPU}
>   -DPATH_SPEC="${PATH_SPEC}"

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


Re: [OpenWrt-Devel] [PATCH][opkg-lede] libopkg: Detect gzipped pkg lists by magic number

2019-05-15 Thread Petr Štetiar
Patrick McDermott  [2019-04-17 13:56:11]:

You've probably forget to add commit description, which would explain us why
you need this changes or what problem it fixes as requested in 

 https://openwrt.org/submitting-patches

> Signed-off-by: Patrick McDermott 
> ---
>  libbb/gzip.h   |  2 ++
>  libopkg/pkg_hash.c | 27 ---
>  2 files changed, 22 insertions(+), 7 deletions(-)
> 
> diff --git a/libbb/gzip.h b/libbb/gzip.h
> index 3a61a1d..28e3a50 100644
> --- a/libbb/gzip.h
> +++ b/libbb/gzip.h
> @@ -22,6 +22,8 @@
>  #include 
>  #include 
>  
> +#define GZIP_MAGIC "\037\213" /* gzip magic number, 1F 8B */
> +
>  struct gzip_handle {
>   FILE *file;
>   struct gzip_handle *gzip;
> diff --git a/libopkg/pkg_hash.c b/libopkg/pkg_hash.c
> index 611f3b9..b536db7 100644
> --- a/libopkg/pkg_hash.c
> +++ b/libopkg/pkg_hash.c
> @@ -99,21 +99,34 @@ pkg_hash_add_from_file(const char *file_name,
>  {
>   pkg_t *pkg;
>   FILE *fp;
> + char magic[2];
> + int is_gzip = 0;
>   char *buf;
>   const size_t len = 4096;
>   int ret = 0;
>   struct gzip_handle zh;
>  
> - if (src && src->gzip) {
> - fp = gzip_fdopen(&zh, file_name);
> - } else {
> - fp = fopen(file_name, "r");
> - }
> -
> + fp = fopen(file_name, "r");
>   if (fp == NULL) {
>   opkg_perror(ERROR, "Failed to open %s", file_name);
>   return -1;
>   }
> + if (fread(magic, 1, 2, fp) != 2) {
> + opkg_perror(ERROR, "Failed to read %s", file_name);
> + fclose(fp);
> + return -1;
> + }
> + (void)fseek(fp, 0L, SEEK_SET);
> +
> + if (src && src->gzip && memcmp(magic, GZIP_MAGIC, 2) == 0) {
> + fclose(fp);
> + fp = gzip_fdopen(&zh, file_name);
> + if (fp == NULL) {
> + opkg_perror(ERROR, "Failed to open %s", file_name);
> + return -1;
> + }
> + is_gzip = 1;
> + }
>  
>   buf = xmalloc(len);
>  
> @@ -165,7 +178,7 @@ pkg_hash_add_from_file(const char *file_name,
>   free(buf);
>   fclose(fp);
>  
> - if (src && src->gzip)
> + if (is_gzip)
>   gzip_close(&zh);
>  
>   return ret;

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


Re: [OpenWrt-Devel] [PATCH 1/4] ipq40xx: directly define voltage per opp

2019-05-15 Thread Petr Štetiar
Pavel Kubelun  [2019-05-14 16:42:17]:

> diff --git 
> a/target/linux/ipq40xx/patches-4.14/073-qcom-ipq4019-fix-cpu0-s-qcom-saw2-reg-value.patch
>  
> b/target/linux/ipq40xx/patches-4.14/073-qcom-ipq4019-fix-cpu0-s-qcom-saw2-reg-value.patch
> index d72e3d3c36..ac128ab9e1 100644
> --- 
> a/target/linux/ipq40xx/patches-4.14/073-qcom-ipq4019-fix-cpu0-s-qcom-saw2-reg-value.patch
> +++ 
> b/target/linux/ipq40xx/patches-4.14/073-qcom-ipq4019-fix-cpu0-s-qcom-saw2-reg-value.patch
> @@ -22,7 +22,7 @@ Signed-off-by: John Crispin 
>  
>  --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi
>  +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi
> -@@ -262,7 +262,7 @@
> +@@ -266,7 +266,7 @@
>   
>   saw0: regulator@b089000 {
>   compatible = "qcom,saw2";

Some leftover?

> diff --git 
> a/target/linux/ipq40xx/patches-4.14/077-qcom-ipq4019-add-USB-devicetree-nodes.patch
>  
> b/target/linux/ipq40xx/patches-4.14/077-qcom-ipq4019-add-USB-devicetree-nodes.patch
> index 44c07f8f45..be413188a7 100644
> --- 
> a/target/linux/ipq40xx/patches-4.14/077-qcom-ipq4019-add-USB-devicetree-nodes.patch
> +++ 
> b/target/linux/ipq40xx/patches-4.14/077-qcom-ipq4019-add-USB-devicetree-nodes.patch
> @@ -41,7 +41,7 @@ Signed-off-by: John Crispin 
>   };
>  --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi
>  +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi
> -@@ -410,5 +410,79 @@
> +@@ -414,5 +414,79 @@
> "legacy";
>   status = "disabled";
>   };

Ditto.

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


Re: [OpenWrt-Devel] [PATCH 4/4] ipq40xx: add support for secondary cores bringup

2019-05-15 Thread Petr Štetiar
Pavel Kubelun  [2019-05-14 16:42:20]:

> --- /dev/null
> +++ 
> b/target/linux/ipq40xx/patches-4.14/091-ipq40xx-add-support-for-secondary-cores-bringup.patch
> @@ -0,0 +1,174 @@
> +From 6126701397fa6c884fd78453d995e49df91a566a Mon Sep 17 00:00:00 2001
> +From: Pavel Kubelun 
> +Date: Mon, 13 May 2019 11:25:05 +0300
> +Subject: [PATCH] ipq40xx: Add support for secondary cores bringup
> +
> +Cherry-pick QSDK patches to enable proper ipq40xx
> +secondary cores bringup.
> +
> +https://source.codeaurora.org/quic/qsdk/oss/kernel/linux-msm/commit/?h=eggplant&id=f810b63c356bd72d9b89fb9c0b7e27c250c3540f

Please preserve the authorship of the work and try to upstream this changes
first, then backport it to OpenWrt.

-- ynezz

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


Re: [OpenWrt-Devel] [PATCH 3/4] ipq40xx: fix high resolution timer

2019-05-15 Thread Petr Štetiar
Pavel Kubelun  [2019-05-14 16:42:19]:

> diff --git 
> a/target/linux/ipq40xx/patches-4.14/090-ipq40xx-fix-high-resolution-timer.patch
>  
> b/target/linux/ipq40xx/patches-4.14/090-ipq40xx-fix-high-resolution-timer.patch
> new file mode 100644
> index 00..0fc50ec533
> --- /dev/null
> +++ 
> b/target/linux/ipq40xx/patches-4.14/090-ipq40xx-fix-high-resolution-timer.patch
> @@ -0,0 +1,30 @@
> +From 09f145f417a5d64d6b8d4476699dfb0eccc6c784 Mon Sep 17 00:00:00 2001
> +From: Pavel Kubelun 
> +Date: Tue, 7 May 2019 10:14:05 +0300
> +Subject: [PATCH] ipq40xx: fix high resolution timer
> +
> +Cherry-picked from CAF QSDK repo.

You should preserve the authorship of the changes if you do so. It looks now,
like you're author of this work.

> +The kernel is failing in switching the timer for high resolution
> +mode and clock source operates in 10ms resolution. The always-on
> +property needs to be given for timer device tree node to make
> +clock source working in 1ns resolution.

Shouldn't this go through upstream as well?

> + soc {
> diff --git 
> a/target/linux/ipq40xx/patches-4.14/701-dts-ipq4019-add-mdio-node.patch 
> b/target/linux/ipq40xx/patches-4.14/701-dts-ipq4019-add-mdio-node.patch
> index 0e1bb87368..b7e241058c 100644
> --- a/target/linux/ipq40xx/patches-4.14/701-dts-ipq4019-add-mdio-node.patch
> +++ b/target/linux/ipq40xx/patches-4.14/701-dts-ipq4019-add-mdio-node.patch
> @@ -15,7 +15,7 @@ so the info might change.
>  
>  --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi
>  +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi
> -@@ -566,6 +566,34 @@
> +@@ -567,6 +567,34 @@
>   status = "disabled";
>   };

Probably some leftover?

> diff --git 
> a/target/linux/ipq40xx/patches-4.14/702-dts-ipq4019-add-PHY-switch-nodes.patch
>  
> b/target/linux/ipq40xx/patches-4.14/702-dts-ipq4019-add-PHY-switch-nodes.patch
> index 03da6c863a..cc56a60ea3 100644
> --- 
> a/target/linux/ipq40xx/patches-4.14/702-dts-ipq4019-add-PHY-switch-nodes.patch
> +++ 
> b/target/linux/ipq40xx/patches-4.14/702-dts-ipq4019-add-PHY-switch-nodes.patch
> @@ -14,7 +14,7 @@ Signed-off-by: Christian Lamparter 
>  
>  --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi
>  +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi
> -@@ -594,6 +594,29 @@
> +@@ -595,6 +595,29 @@
>   };
>   };

Ditto.

> diff --git 
> a/target/linux/ipq40xx/patches-4.14/711-dts-ipq4019-add-ethernet-essedma-node.patch
>  
> b/target/linux/ipq40xx/patches-4.14/711-dts-ipq4019-add-ethernet-essedma-node.patch
> index 7302d237bc..80b16a8211 100644
> --- 
> a/target/linux/ipq40xx/patches-4.14/711-dts-ipq4019-add-ethernet-essedma-node.patch
> +++ 
> b/target/linux/ipq40xx/patches-4.14/711-dts-ipq4019-add-ethernet-essedma-node.patch
> @@ -25,7 +25,7 @@ Signed-off-by: Christian Lamparter 
>   };
>   
>   cpus {
> -@@ -617,6 +619,64 @@
> +@@ -618,6 +620,64 @@
>   status = "disabled";
>   };

Ditto.

> diff --git 
> a/target/linux/ipq40xx/patches-4.19/086-ipq40xx-fix-high-resolution-timer.patch
>  
> b/target/linux/ipq40xx/patches-4.19/086-ipq40xx-fix-high-resolution-timer.patch
> new file mode 100644
> index 00..9d277fa8e0
> --- /dev/null
> +++ 
> b/target/linux/ipq40xx/patches-4.19/086-ipq40xx-fix-high-resolution-timer.patch
> @@ -0,0 +1,30 @@
> +From 09f145f417a5d64d6b8d4476699dfb0eccc6c784 Mon Sep 17 00:00:00 2001
> +From: Pavel Kubelun 
> +Date: Tue, 7 May 2019 10:14:05 +0300
> +Subject: [PATCH] ipq40xx: fix high resolution timer
> +
> +Cherry-picked from CAF QSDK repo.
> +Original commit message:
> +The kernel is failing in switching the timer for high resolution
> +mode and clock source operates in 10ms resolution. The always-on
> +property needs to be given for timer device tree node to make
> +clock source working in 1ns resolution.

Same as above.

> diff --git 
> a/target/linux/ipq40xx/patches-4.19/701-dts-ipq4019-add-mdio-node.patch 
> b/target/linux/ipq40xx/patches-4.19/701-dts-ipq4019-add-mdio-node.patch
> index e5936a0c93..0298644d22 100644
> --- a/target/linux/ipq40xx/patches-4.19/701-dts-ipq4019-add-mdio-node.patch
> +++ b/target/linux/ipq40xx/patches-4.19/701-dts-ipq4019-add-mdio-node.patch
> @@ -15,7 +15,7 @@ so the info might change.
>  
>  --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi
>  +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi
> -@@ -570,6 +570,34 @@
> +@@ -571,6 +571,34 @@
>   status = "disabled";
>   };

Ditto.

> diff --git 
> a/target/linux/ipq40xx/patches-4.19/702-dts-ipq4019-add-PHY-switch-nodes.patch
>  
> b/target/linux/ipq40xx/patches-4.19/702-dts-ipq4019-add-PHY-switch-nodes.patch
> index 7c5d1ec2bb..df95699294 100644
> --- 
> a/target/linux/ipq40xx/patches-4.19/702-dts-ipq4019-add-PHY-switch-nodes.patch
> +++ 
> b/target/linux/ipq40xx/patches-4.19/702-dts-ipq4019-add-PHY-switch-nodes.patch
> @@ -14,7 +14,7 @@ Signed-off-by: Christian Lamparter 
>  
>  --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi
>  +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi

Re: [OpenWrt-Devel] [PATCH 2/4] ipq40xx: fix sleep clock

2019-05-15 Thread Petr Štetiar
Pavel Kubelun  [2019-05-14 16:42:18]:

Hi,

> It seems like sleep_clk was copied from ipq806x.
> Fix ipq40xx sleep_clk to the value QSDK defines.
> 
> Hope someone with datasheet could clarify the correct
> value.

what problem does this exactly fixes? Is there any particular reason why this
shouldn't be sent upstream and then backported to OpenWrt?

-- ynezz

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


Re: [OpenWrt-Devel] RFC: add metadata to buildroot

2019-05-15 Thread Alberto Bursi


On 14/05/19 16:49, Petr Štetiar wrote:

[adding Thomas and Alberto to the Cc loop]

Paul Spooren  [2019-05-04 17:48:03]:

Hi,


from my point of view the current OpenWrt device documentation lacks
some unity, meaning the table of hardware is partly incomplete or
inconsistent. Also documentations are often rewritten with different
precision and "tongue".

To unify things I created a *PoC*[0], mostly based on the official
LineageOS Wiki[1], as they have a similar situation regarding devices.

The idea is to define templates describing common information and fill
them with device metadata.

The *PoC* above is based on the following metadata here[2]. Most parts
of the metadata are scraped from the current ToH[3], however some small
pieces are added and later rendered in something useful:

     tftp_image: ArcherC5v1_tp_recovery.bin
     tftp_ip: 192.168.0.66

Result in a small text to explain how to use the TFTP recovery.

     switch_ports:
       0: ETH1
       1: WAN
       2: LAN1
       3: LAN2
       4: LAN3
       5: LAN4
       6: ETH0

Creates a table with the switch port messing.

Same could be done with the flash layout, LEDs, etc.

All these information are (hopefully) available to the developer adding
a new device, therefore easy to supply such a `yaml` metadata file as
well. Often these information are (re-formulated) in commit messages
anyway[4]. Meaning, somewhere in the buildroot could be a store of
`yaml` files, which could even be reused for building itself.

A second repository like openwrt-device.git[5] could be added to render
the wiki pages and organize the templates.

I'd be happy to hear your opinions.

I really like, it's nice and I applaud your effort. Thanks!


Best,
Paul

PS: I'm afraid I don't know the mail address of tmomas...

[0]: 
https://aparcar.github.io/openwrt-devices/devices/tp-link_archer_c5_ac1200_v1/
[1]: http://wiki.lineageos.org/devices/
[2]: 
https://github.com/aparcar/openwrt-devices/blob/master/_data/devices/tp-link_archer_c5_ac1200_v1.yml
[3]: https://openwrt.org/toh/hwdata/tp-link/tp-link_archer_c5_ac1200_v1
[4]: 
https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=43e8c37cb4da64a12a3cb88a84b19db7f2fc640c
[5]: https://github.com/aparcar/openwrt-devices

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



I'm always in favor of more automation, although the TOH is mostly 
tmomas's thing.


The point here is that before we can enforce this on commits there needs 
to be:


-a consensus between core devs

-enough devices with a YAML file generated and a working "TOH" site.

-Alberto


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


[OpenWrt-Devel] [PATCH v2] zlib: Use relative paths in pkg-config metadata file

2019-05-15 Thread Jeffery To
The buildroot pkg-config (in staging_dir/host/bin) overrides the prefix
and exec_prefix variables in *.pc files, to supply the correct
(buildroot) paths for callers. If other variables are not defined
relative to prefix and exec_prefix, then the returned values will be
incorrect.

The default zlib.pc file generated by cmake contains absolute paths.
This patches the file to use relative paths (relative to ${prefix} and
${exec_prefix}).

Signed-off-by: Jeffery To 
---
v2: expanded commit message

 package/libs/zlib/Makefile |  2 +-
 .../patches/004-relative-pkg-config-paths.patch| 14 ++
 2 files changed, 15 insertions(+), 1 deletion(-)
 create mode 100644 
package/libs/zlib/patches/004-relative-pkg-config-paths.patch

diff --git a/package/libs/zlib/Makefile b/package/libs/zlib/Makefile
index 4a2a0e53b0..c7a8415c79 100644
--- a/package/libs/zlib/Makefile
+++ b/package/libs/zlib/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=zlib
 PKG_VERSION:=1.2.11
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=@SF/libpng http://www.zlib.net
diff --git a/package/libs/zlib/patches/004-relative-pkg-config-paths.patch 
b/package/libs/zlib/patches/004-relative-pkg-config-paths.patch
new file mode 100644
index 00..c86d19b412
--- /dev/null
+++ b/package/libs/zlib/patches/004-relative-pkg-config-paths.patch
@@ -0,0 +1,14 @@
+--- a/zlib.pc.cmakein
 b/zlib.pc.cmakein
+@@ -1,8 +1,8 @@
+ prefix=@CMAKE_INSTALL_PREFIX@
+ exec_prefix=@CMAKE_INSTALL_PREFIX@
+-libdir=@INSTALL_LIB_DIR@
+-sharedlibdir=@INSTALL_LIB_DIR@
+-includedir=@INSTALL_INC_DIR@
++libdir=${exec_prefix}/lib
++sharedlibdir=${exec_prefix}/lib
++includedir=${prefix}/include
+ 
+ Name: zlib
+ Description: zlib compression library
-- 
2.20.1


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


Re: [OpenWrt-Devel] [PATCH] zlib: Use relative paths in pkg-config metadata file

2019-05-15 Thread Jeffery To
On Wed, May 15, 2019 at 9:33 PM Petr Štetiar  wrote:

> Jeffery To  [2019-05-15 21:00:28]:
>
> > The buildroot pkg-config (in staging_dir/host/bin) overrides the prefix
> and
> > exec_prefix variables in *.pc files, to supply the correct (buildroot)
> > paths for callers. If other variables are not defined relative to prefix
> > and exec_prefix, then the returned values will be incorrect.
>
> Ok, makes sense, so can you add this explanation to the commit message
> please?
>

Sure, will do.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v2] build: fix STAGING_DIR cleaning when filenames contain spaces

2019-05-15 Thread Jeffery To
When looping through a package's STAGING_FILES_LIST (a list of
file/directory paths delimited by newlines), if the path contains
spaces, then the path will be split by the while loops, and the
file/directory will not be deleted/removed.

This sets the internal field separator to the newline only so that the
entire path is considered when deleting/removing.

Signed-off-by: Jeffery To 
---
v2: use ksh93 syntax

 scripts/clean-package.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/clean-package.sh b/scripts/clean-package.sh
index e580566a52..6dd9bf7306 100755
--- a/scripts/clean-package.sh
+++ b/scripts/clean-package.sh
@@ -1,4 +1,5 @@
 #!/usr/bin/env bash
+IFS=$'\n'
 [ -n "$1" -a -n "$2" ] || {
echo "Usage: $0  "
exit 1
-- 
2.20.1


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


Re: [OpenWrt-Devel] [PATCH] build: fix STAGING_DIR cleaning when filenames contain spaces

2019-05-15 Thread Jeffery To
On Wed, May 15, 2019 at 9:24 PM Petr Štetiar  wrote:

> Jeffery To  [2019-05-15 19:03:16]:
>
> > If you prefer, I can change this to use ksh93 syntax[5]:
> >
> > IFS=$'\n'
>
> indeed, I like this a lot more, and
>
>  IFS="$(printf '\n\t')"
>
> from that TLDP page you've linked looks good as well, seems even more
> readable
> to me. Anyway, I'll leave the decision up to you, both are fine with me.
>

 Sure, I'll change it to IFS=$'\n'.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] mt7621: add kexec smp shutdown patch.

2019-05-15 Thread Petr Štetiar
Daniel Danzberger  [2019-02-17 13:31:04]:

Hi,

> This patch shuts down all secondary cpus before executing machine_kexec.
> This avoids paging errors and random hangups when doing kexec.

this looks like a material for upstream submission, so please take it through
upstream and then backport it to OpenWrt. Thanks!

-- ynezz

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


Re: [OpenWrt-Devel] [PATCH] system: uci: Use config dir on uci_add and support add_/del_list

2019-05-15 Thread Petr Štetiar
Kristian Evensen  [2019-05-03 18:05:32]:

Hi,

> +uci_del_list() {

as `uci_remove` is calling `uci del` under the hood, this should be probably
renamed to `uci_remove_list` in order to stay consistent ?

> + /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} del_list 
> "$PACKAGE.$CONFIG.$OPTION=$VALUE"
> +}

-- ynezz

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


Re: [OpenWrt-Devel] [PATCH] zlib: Use relative paths in pkg-config metadata file

2019-05-15 Thread Petr Štetiar
Jeffery To  [2019-05-15 21:00:28]:

> The buildroot pkg-config (in staging_dir/host/bin) overrides the prefix and
> exec_prefix variables in *.pc files, to supply the correct (buildroot)
> paths for callers. If other variables are not defined relative to prefix
> and exec_prefix, then the returned values will be incorrect.

Ok, makes sense, so can you add this explanation to the commit message please?


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


Re: [OpenWrt-Devel] [PATCH] build: fix STAGING_DIR cleaning when filenames contain spaces

2019-05-15 Thread Petr Štetiar
Jeffery To  [2019-05-15 19:03:16]:

> I finally remembered, I copied this syntax from
> package/network/services/openvpn/files/openvpn.init[3]:
> 
> LIST_SEP="
> "

it just looks weird as well.

> If you prefer, I can change this to use ksh93 syntax[5]:
> 
> IFS=$'\n'

indeed, I like this a lot more, and 

 IFS="$(printf '\n\t')"

from that TLDP page you've linked looks good as well, seems even more readable
to me. Anyway, I'll leave the decision up to you, both are fine with me.

-- ynezz

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


Re: [OpenWrt-Devel] [PATCH] zlib: Use relative paths in pkg-config metadata file

2019-05-15 Thread Jeffery To
On Fri, May 3, 2019 at 5:32 PM Petr Štetiar  wrote:

> Jeffery To  [2019-05-03 00:47:06]:
>
> > The default zlib.pc file generated by cmake contains absolute paths.
> > This patches the file to use relative paths (relative to ${prefix} and
> > ${exec_prefix}).
>
> I can see that from the diff already, but I miss the information, why do
> you
> need this change. Could this perhaps be upstreamed first as well?
>
> -- ynezz
>

The buildroot pkg-config (in staging_dir/host/bin) overrides the prefix and
exec_prefix variables in *.pc files, to supply the correct (buildroot)
paths for callers. If other variables are not defined relative to prefix
and exec_prefix, then the returned values will be incorrect.

A similar change was merged for xz[1] in the packages repo.

I'm not sure upstream will want this change, since what is there currently
isn't "wrong"; it only affects our cross-compilation.


1. https://github.com/openwrt/packages/pull/8880
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v2] build: include BUILD_VARIANT in PKG_BUILD_DIR

2019-05-15 Thread Jeffery To
This changes the default PKG_BUILD_DIR to take BUILD_VARIANT into
account (if set), so that packages do not need to manually override
PKG_BUILD_DIR just to handle variants.

This also updates most base packages with variants to use the updated
default PKG_BUILD_DIR.

Signed-off-by: Jeffery To 
---
v2: updated PKG_BUILD_DIR in include/kernel.mk, removed undefines

 include/kernel.mk | 2 +-
 include/package.mk| 2 +-
 package/libs/ustream-ssl/Makefile | 2 --
 package/network/services/hostapd/Makefile | 2 --
 package/network/services/odhcpd/Makefile  | 2 --
 package/network/services/openvpn/Makefile | 1 -
 package/network/services/ppp/Makefile | 2 --
 package/network/utils/iproute2/Makefile   | 2 --
 package/network/utils/iw/Makefile | 1 -
 package/network/utils/tcpdump/Makefile| 1 -
 package/system/ucert/Makefile | 2 --
 package/utils/px5g/Makefile   | 1 -
 12 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/include/kernel.mk b/include/kernel.mk
index 3195090a0a..24ece77e0f 100644
--- a/include/kernel.mk
+++ b/include/kernel.mk
@@ -77,7 +77,7 @@ else
   TARGET_MODULES_DIR:=$(LINUX_TARGET_DIR)/$(MODULES_SUBDIR)
 
   ifneq ($(TARGET_BUILD),1)
-PKG_BUILD_DIR ?= $(KERNEL_BUILD_DIR)/$(PKG_NAME)$(if 
$(PKG_VERSION),-$(PKG_VERSION))
+PKG_BUILD_DIR ?= $(KERNEL_BUILD_DIR)/$(if 
$(BUILD_VARIANT),$(PKG_NAME)-$(BUILD_VARIANT)/)$(PKG_NAME)$(if 
$(PKG_VERSION),-$(PKG_VERSION))
   endif
 endif
 
diff --git a/include/package.mk b/include/package.mk
index 569ad647d6..015117bd3a 100644
--- a/include/package.mk
+++ b/include/package.mk
@@ -11,7 +11,7 @@ all: $(if $(DUMP),dumpinfo,$(if $(CHECK),check,compile))
 
 include $(INCLUDE_DIR)/download.mk
 
-PKG_BUILD_DIR ?= $(BUILD_DIR)/$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION))
+PKG_BUILD_DIR ?= $(BUILD_DIR)/$(if 
$(BUILD_VARIANT),$(PKG_NAME)-$(BUILD_VARIANT)/)$(PKG_NAME)$(if 
$(PKG_VERSION),-$(PKG_VERSION))
 PKG_INSTALL_DIR ?= $(PKG_BUILD_DIR)/ipkg-install
 PKG_BUILD_PARALLEL ?=
 PKG_USE_MIPS16 ?= 1
diff --git a/package/libs/ustream-ssl/Makefile 
b/package/libs/ustream-ssl/Makefile
index a15f3d8ab8..3b23d30b31 100644
--- a/package/libs/ustream-ssl/Makefile
+++ b/package/libs/ustream-ssl/Makefile
@@ -10,8 +10,6 @@ PKG_SOURCE_VERSION:=23a3f2830341acd1db149175baf7315a33bd0edb
 
PKG_MIRROR_HASH:=289bef5dac684015b6a40cfd72cf1c8c297bb77cf2efd54e562b628ba3afd83d
 CMAKE_INSTALL:=1
 
-PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_SOURCE_SUBDIR)
-
 PKG_LICENSE:=ISC
 PKG_LICENSE_FILES:=
 
diff --git a/package/network/services/hostapd/Makefile 
b/package/network/services/hostapd/Makefile
index 235f178bc9..05789dbe6b 100644
--- a/package/network/services/hostapd/Makefile
+++ b/package/network/services/hostapd/Makefile
@@ -67,8 +67,6 @@ ifeq ($(LOCAL_VARIANT),mesh)
   CONFIG_VARIANT:=full
 endif
 
-PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
-
 include $(INCLUDE_DIR)/package.mk
 
 STAMP_CONFIGURED:=$(STAMP_CONFIGURED)_$(CONFIG_WPA_MSG_MIN_PRIORITY)
diff --git a/package/network/services/odhcpd/Makefile 
b/package/network/services/odhcpd/Makefile
index a588af0ea6..83cfdd235b 100644
--- a/package/network/services/odhcpd/Makefile
+++ b/package/network/services/odhcpd/Makefile
@@ -19,8 +19,6 @@ 
PKG_MIRROR_HASH:=27a0802a01bc6334c6c602b71d8521a2472b82d2bf67be63ae380f56234b0fb
 PKG_MAINTAINER:=Hans Dedecker 
 PKG_LICENSE:=GPL-2.0
 
-PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
-
 PKG_INSTALL:=1
 PKG_CONFIG_DEPENDS:=CONFIG_PACKAGE_odhcpd_$(BUILD_VARIANT)_ext_cer_id
 
diff --git a/package/network/services/openvpn/Makefile 
b/package/network/services/openvpn/Makefile
index f01b74d8aa..538be5d51d 100644
--- a/package/network/services/openvpn/Makefile
+++ b/package/network/services/openvpn/Makefile
@@ -18,7 +18,6 @@ PKG_SOURCE_URL:=\
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_HASH:=a42f53570f669eaf10af68e98d65b531015ff9e12be7a62d9269ea684652f648
 
-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
 PKG_MAINTAINER:=Felix Fietkau 
 
 PKG_INSTALL:=1
diff --git a/package/network/services/ppp/Makefile 
b/package/network/services/ppp/Makefile
index a588540a5d..1235d18471 100644
--- a/package/network/services/ppp/Makefile
+++ b/package/network/services/ppp/Makefile
@@ -23,8 +23,6 @@ PKG_CPE_ID:=cpe:/a:samba:ppp
 PKG_RELEASE_VERSION:=2.4.7
 PKG_VERSION:=$(PKG_RELEASE_VERSION).git-$(PKG_SOURCE_DATE)
 
-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
-
 PKG_BUILD_DEPENDS:=libpcap
 
 PKG_BUILD_PARALLEL:=1
diff --git a/package/network/utils/iproute2/Makefile 
b/package/network/utils/iproute2/Makefile
index 8617a8ef2f..2d69f1c1f3 100644
--- a/package/network/utils/iproute2/Makefile
+++ b/package/network/utils/iproute2/Makefile
@@ -19,8 +19,6 @@ PKG_BUILD_DEPENDS:=iptables
 PKG_LICENSE:=GPL-2.0
 PKG_CPE_ID:=cpe:/a:iproute2_project:ipr

[OpenWrt-Devel] [PATCH iwinfo 1/2] Enable extra compiler checks

2019-05-15 Thread Petr Štetiar
Let's enforce additional automatic checks enforced by the compiler in
order to catch possible errors during compilation.

Signed-off-by: Petr Štetiar 
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 715c03e34671..7f9c755d53ba 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 IWINFO_BACKENDS= $(BACKENDS)
-IWINFO_CFLAGS  = $(CFLAGS) -std=gnu99 -fstrict-aliasing -Iinclude
+IWINFO_CFLAGS  = $(CFLAGS) -std=gnu99 -fstrict-aliasing -Iinclude -Wall 
-Wextra -Werror -Wno-unused
 IWINFO_LDFLAGS = -luci -lubox -lubus
 
 IWINFO_LIB = libiwinfo.so
-- 
1.9.1


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


[OpenWrt-Devel] [PATCH iwinfo 2/2] Iron out all extra compiler warnings

2019-05-15 Thread Petr Štetiar
iwinfo_lib.c:352:16: error: comparison between signed and unsigned integer 
expressions [-Werror=sign-compare]
iwinfo_lib.c:363:16: error: comparison between signed and unsigned integer 
expressions [-Werror=sign-compare]
iwinfo_lib.c:374:16: error: comparison between signed and unsigned integer 
expressions [-Werror=sign-compare]
iwinfo_lua.c:193:23: error: comparison between signed and unsigned integer 
expressions [-Werror=sign-compare]
iwinfo_lua.c:204:23: error: comparison between signed and unsigned integer 
expressions [-Werror=sign-compare]
iwinfo_lua.c:215:23: error: comparison between signed and unsigned integer 
expressions [-Werror=sign-compare]
iwinfo_lua.c:226:23: error: comparison between signed and unsigned integer 
expressions [-Werror=sign-compare]
iwinfo_lua.c:541:17: error: comparison between signed and unsigned integer 
expressions [-Werror=sign-compare]
iwinfo_cli.c:769:16: error: comparison between signed and unsigned integer 
expressions [-Werror=sign-compare]
iwinfo_cli.c:824:17: error: comparison between signed and unsigned integer 
expressions [-Werror=sign-compare]

Signed-off-by: Petr Štetiar 
---
 iwinfo_cli.c | 7 ---
 iwinfo_lib.c | 6 +++---
 iwinfo_lua.c | 5 +++--
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/iwinfo_cli.c b/iwinfo_cli.c
index dba75296..8f80aa41cd20 100644
--- a/iwinfo_cli.c
+++ b/iwinfo_cli.c
@@ -758,7 +758,8 @@ static void print_countrylist(const struct iwinfo_ops *iw, 
const char *ifname)
 
 static void print_htmodelist(const struct iwinfo_ops *iw, const char *ifname)
 {
-   int i, htmodes = 0;
+   unsigned int i;
+   int htmodes = 0;
 
if (iw->htmodelist(ifname, &htmodes))
{
@@ -821,9 +822,9 @@ int main(int argc, char **argv)
{
glob("/sys/class/net/*", 0, NULL, &globbuf);
 
-   for (i = 0; i < globbuf.gl_pathc; i++)
+   for (unsigned int y = 0; y < globbuf.gl_pathc; y++)
{
-   p = strrchr(globbuf.gl_pathv[i], '/');
+   p = strrchr(globbuf.gl_pathv[y], '/');
 
if (!p)
continue;
diff --git a/iwinfo_lib.c b/iwinfo_lib.c
index fa9bb9f14f4c..e2c3db1b32c8 100644
--- a/iwinfo_lib.c
+++ b/iwinfo_lib.c
@@ -347,7 +347,7 @@ const char * iwinfo_type(const char *ifname)
 
 const struct iwinfo_ops * iwinfo_backend(const char *ifname)
 {
-   int i;
+   unsigned int i;
 
for (i = 0; i < ARRAY_SIZE(backends); i++)
if (backends[i]->probe(ifname))
@@ -358,7 +358,7 @@ const struct iwinfo_ops * iwinfo_backend(const char *ifname)
 
 const struct iwinfo_ops * iwinfo_backend_by_name(const char *name)
 {
-   int i;
+   unsigned int i;
 
for (i = 0; i < ARRAY_SIZE(backends); i++)
if (!strcmp(backends[i]->name, name))
@@ -369,7 +369,7 @@ const struct iwinfo_ops * iwinfo_backend_by_name(const char 
*name)
 
 void iwinfo_finish(void)
 {
-   int i;
+   unsigned int i;
 
for (i = 0; i < ARRAY_SIZE(backends); i++)
backends[i]->close();
diff --git a/iwinfo_lua.c b/iwinfo_lua.c
index bb43438d8dd5..391ec02c5e8a 100644
--- a/iwinfo_lua.c
+++ b/iwinfo_lua.c
@@ -173,7 +173,7 @@ static char * iwinfo_crypto_desc(struct iwinfo_crypto_entry 
*c)
 /* Build Lua table from crypto data */
 static void iwinfo_L_cryptotable(lua_State *L, struct iwinfo_crypto_entry *c)
 {
-   int i, j;
+   unsigned int i, j;
 
lua_newtable(L);
 
@@ -532,7 +532,8 @@ static int iwinfo_L_hwmodelist(lua_State *L, int 
(*func)(const char *, int *))
 static int iwinfo_L_htmodelist(lua_State *L, int (*func)(const char *, int *))
 {
const char *ifname = luaL_checkstring(L, 1);
-   int i, htmodes = 0;
+   int htmodes = 0;
+   unsigned int i;
 
if (!(*func)(ifname, &htmodes))
{
-- 
1.9.1


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


Re: [OpenWrt-Devel] [PATCH] build: include BUILD_VARIANT in PKG_BUILD_DIR

2019-05-15 Thread Jeffery To
On Sun, May 12, 2019 at 3:15 AM Hauke Mehrtens  wrote:

> On 5/2/19 7:52 PM, Jeffery To wrote:
> > This changes the default PKG_BUILD_DIR to take BUILD_VARIANT into
> > account (if set), so that packages do not need to manually override
> > PKG_BUILD_DIR just to handle variants.
> >
> > This also updates most base packages with variants to use the updated
> > default PKG_BUILD_DIR.
> >
> > Signed-off-by: Jeffery To 
> > ---
> >  include/package.mk| 2 +-
> >  package/libs/ustream-ssl/Makefile | 2 --
> >  package/network/services/hostapd/Makefile | 2 --
> >  package/network/services/odhcpd/Makefile  | 2 --
> >  package/network/services/openvpn/Makefile | 1 -
> >  package/network/services/ppp/Makefile | 3 ++-
> >  package/network/utils/iproute2/Makefile   | 4 ++--
> >  package/network/utils/iw/Makefile | 1 -
> >  package/network/utils/tcpdump/Makefile| 1 -
> >  package/system/ucert/Makefile | 2 --
> >  package/utils/px5g/Makefile   | 1 -
> >  11 files changed, 5 insertions(+), 16 deletions(-)
> >
> > diff --git a/include/package.mk b/include/package.mk
> > index 569ad647d6..015117bd3a 100644
> > --- a/include/package.mk
> > +++ b/include/package.mk
> > @@ -11,7 +11,7 @@ all: $(if $(DUMP),dumpinfo,$(if
> $(CHECK),check,compile))
> >
> >  include $(INCLUDE_DIR)/download.mk
> >
> > -PKG_BUILD_DIR ?= $(BUILD_DIR)/$(PKG_NAME)$(if
> $(PKG_VERSION),-$(PKG_VERSION))
> > +PKG_BUILD_DIR ?= $(BUILD_DIR)/$(if
> $(BUILD_VARIANT),$(PKG_NAME)-$(BUILD_VARIANT)/)$(PKG_NAME)$(if
> $(PKG_VERSION),-$(PKG_VERSION))
> >  PKG_INSTALL_DIR ?= $(PKG_BUILD_DIR)/ipkg-install
> >  PKG_BUILD_PARALLEL ?=
> >  PKG_USE_MIPS16 ?= 1
>
> Please also update the variable in include/kernel.mk then you should not
> need the workarounds for the packages which include include/kernel.mk
> and more.
>
> Hauke
>

I've updated include/kernel.mk and will submit a revised patch shortly, but
now iproute2 and ppp are built inside KERNEL_BUILD_DIR instead of
BUILD_DIR, not sure if this is an issue.

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


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

2019-05-15 Thread Kristian Evensen
On Wed, May 15, 2019 at 12:42 PM Petr Štetiar  wrote:
> Yes, you're correct, I've missed this userspace GPIOs.

Thanks for confirming. I will submit a v4 during the afternoon.

BR,
Kristian

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


Re: [OpenWrt-Devel] [PATCH] build: fix STAGING_DIR cleaning when filenames contain spaces

2019-05-15 Thread Jeffery To
On Wed, May 15, 2019 at 7:03 PM Jeffery To  wrote:

> On Fri, May 3, 2019 at 5:40 PM Petr Štetiar  wrote:
>
>> Jeffery To  [2019-05-03 01:33:27]:
>>
>> > When looping through a package's STAGING_FILES_LIST (a list of
>> > file/directory paths delimited by newlines), if the path contains
>> > spaces, then the path will be split by the while loops, and the
>> > file/directory will not be deleted/removed.
>> >
>> > This sets the internal field separator to the newline only so that the
>> > entire path is considered when deleting/removing.
>> >
>> > Signed-off-by: Jeffery To 
>> > ---
>> >  scripts/clean-package.sh | 2 ++
>> >  1 file changed, 2 insertions(+)
>> >
>> > diff --git a/scripts/clean-package.sh b/scripts/clean-package.sh
>> > index e580566a52..3a824929c6 100755
>> > --- a/scripts/clean-package.sh
>> > +++ b/scripts/clean-package.sh
>> > @@ -1,4 +1,6 @@
>> >  #!/usr/bin/env bash
>> > +IFS="
>> > +"
>> >  [ -n "$1" -a -n "$2" ] || {
>> >   echo "Usage: $0  "
>> >   exit 1
>>
>> just for the record, copy&pasting my comment from your PR[1]:
>>
>> I'm just wondering, if this proposed fix with this strange looking IFS is
>> the
>> right direction. Usually if I've problem with whitespaces in filenames,
>> it's
>> because I've forget to use xargs. If I'm not mistaken, this [ -n "$entry"
>> ] ||
>> break construct could be replaced with xargs -r, there's even
>> XARGS:=xargs -r
>> in rules.mk. Just my two cents.
>>
>> 1. https://github.com/openwrt/openwrt/pull/1806#issuecomment-475454138
>>
>> -- ynezz
>>
>
> For the record, here is my reply from the PR[1]:
>
> IFS[2] is a standard internal variable that controls how the shell splits
> tokens. Setting it here determines how the while loops further down the
> script will split the input (lines of file paths generated by find).
> Normally, IFS contains space, newline, and tab, which causes the while
> loops to incorrectly split paths with spaces. This problem is avoided by
> setting IFS to the newline only.
>
> The line you cite ([ -n "$entry" ] || break) causes the while loops (which
> delete the input file paths) to exit on the first empty line of input. It
> would make no sense to replace it with xargs.
>
> * * *
>
> I finally remembered, I copied this syntax from
> package/network/services/openvpn/files/openvpn.init[3]:
>
> LIST_SEP="
> "
>
> then further down it's used in append_param()[4] as IFS="$LIST_SEP" (I
> won't quote the whole for loop here).
>
> If you prefer, I can change this to use ksh93 syntax[5]:
>
> IFS=$'\n'
>
> If you want to rewrite the script to use xargs, please be my guest, but
> setting IFS solves the issue here of spaces in file paths (technically,
> lines of text read from a file list).
>
>
> 1. https://github.com/openwrt/openwrt/pull/1806#issuecomment-475506440
> 2. https://www.tldp.org/LDP/abs/html/internalvariables.html#IFSREF
> 3.
> https://github.com/openwrt/openwrt/blob/172b02c05f2dc199f511f1577aeddfabb7790dc0/package/network/services/openvpn/files/openvpn.init#L13-L14
> 4.
> https://github.com/openwrt/openwrt/blob/172b02c05f2dc199f511f1577aeddfabb7790dc0/package/network/services/openvpn/files/openvpn.init#L43
> 5. https://unix.stackexchange.com/a/184867
>
>
Just want to add, it may not be obvious why there would be spaces in file
paths (it wasn't obvious to me at first).

Apparently, some Go packages that users have been trying to build
(Docker[1], Delve[2]) include files with spaces in their names (mostly as
test cases for handling files with spaces in their name, I think). The Go
compilation issue was eventually fixed, but I noticed that the files were
not cleaned up properly from STAGING_DIR.


1. https://github.com/openwrt/packages/pull/7127#issuecomment-439688448
2. https://github.com/openwrt/packages/issues/7639
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] build: fix STAGING_DIR cleaning when filenames contain spaces

2019-05-15 Thread Jeffery To
On Fri, May 3, 2019 at 5:40 PM Petr Štetiar  wrote:

> Jeffery To  [2019-05-03 01:33:27]:
>
> > When looping through a package's STAGING_FILES_LIST (a list of
> > file/directory paths delimited by newlines), if the path contains
> > spaces, then the path will be split by the while loops, and the
> > file/directory will not be deleted/removed.
> >
> > This sets the internal field separator to the newline only so that the
> > entire path is considered when deleting/removing.
> >
> > Signed-off-by: Jeffery To 
> > ---
> >  scripts/clean-package.sh | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/scripts/clean-package.sh b/scripts/clean-package.sh
> > index e580566a52..3a824929c6 100755
> > --- a/scripts/clean-package.sh
> > +++ b/scripts/clean-package.sh
> > @@ -1,4 +1,6 @@
> >  #!/usr/bin/env bash
> > +IFS="
> > +"
> >  [ -n "$1" -a -n "$2" ] || {
> >   echo "Usage: $0  "
> >   exit 1
>
> just for the record, copy&pasting my comment from your PR[1]:
>
> I'm just wondering, if this proposed fix with this strange looking IFS is
> the
> right direction. Usually if I've problem with whitespaces in filenames,
> it's
> because I've forget to use xargs. If I'm not mistaken, this [ -n "$entry"
> ] ||
> break construct could be replaced with xargs -r, there's even XARGS:=xargs
> -r
> in rules.mk. Just my two cents.
>
> 1. https://github.com/openwrt/openwrt/pull/1806#issuecomment-475454138
>
> -- ynezz
>

For the record, here is my reply from the PR[1]:

IFS[2] is a standard internal variable that controls how the shell splits
tokens. Setting it here determines how the while loops further down the
script will split the input (lines of file paths generated by find).
Normally, IFS contains space, newline, and tab, which causes the while
loops to incorrectly split paths with spaces. This problem is avoided by
setting IFS to the newline only.

The line you cite ([ -n "$entry" ] || break) causes the while loops (which
delete the input file paths) to exit on the first empty line of input. It
would make no sense to replace it with xargs.

* * *

I finally remembered, I copied this syntax from
package/network/services/openvpn/files/openvpn.init[3]:

LIST_SEP="
"

then further down it's used in append_param()[4] as IFS="$LIST_SEP" (I
won't quote the whole for loop here).

If you prefer, I can change this to use ksh93 syntax[5]:

IFS=$'\n'

If you want to rewrite the script to use xargs, please be my guest, but
setting IFS solves the issue here of spaces in file paths (technically,
lines of text read from a file list).


1. https://github.com/openwrt/openwrt/pull/1806#issuecomment-475506440
2. https://www.tldp.org/LDP/abs/html/internalvariables.html#IFSREF
3.
https://github.com/openwrt/openwrt/blob/172b02c05f2dc199f511f1577aeddfabb7790dc0/package/network/services/openvpn/files/openvpn.init#L13-L14
4.
https://github.com/openwrt/openwrt/blob/172b02c05f2dc199f511f1577aeddfabb7790dc0/package/network/services/openvpn/files/openvpn.init#L43
5. https://unix.stackexchange.com/a/184867
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


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

2019-05-15 Thread Petr Štetiar
Kristian Evensen  [2019-05-15 12:34:48]:

> > so if I'm counting it right, you should probably remove i2c.
> 
> If I have understood the datasheet correctly, then i2c is required for
> two of the GPIOs exported in 03_gpio_switches (io1/GPIO#1 and
> io2/GPIO#2).

Yes, you're correct, I've missed this userspace GPIOs.

-- ynezz

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


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

2019-05-15 Thread Kristian Evensen
Hi Petr,

Thanks for your feedback.

On Wed, May 15, 2019 at 12:17 PM Petr Štetiar  wrote:
> > In order to install OpenWRT, you first need to compile an initramfs
> > (ramdisk)-image for the device.
>
> This is no longer valid, right?

Correct, will remove it for v4.

>
> > --- 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"
> >   ;;
> > +head-weblink,hdrm200)
> > + set_wifi_led "$boardname:green:wifi"
> > + ;;
>
> this could be grouped with other devices.

Thanks for spotting this.

> so if I'm counting it right, you should probably remove i2c.

If I have understood the datasheet correctly, then i2c is required for
two of the GPIOs exported in 03_gpio_switches (io1/GPIO#1 and
io2/GPIO#2).

BR,
Kristian

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


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

2019-05-15 Thread Petr Štetiar
Kristian Evensen  [2019-05-10 18:26:22]:

I've one more comment for you to address

> + firmware: partition@5 {
> + compatible = "denx,uimage";
> + label = "firmware";
> + reg = <0x5 0xfb>;
> + };

...

> +define Device/head-weblink_hdrm200
> +  DTS := HDRM200
> +  IMAGE_SIZE := $(ralink_default_fw_size_16M)

ralink_default_fw_size_16M = 16121856 = 0xf6 which doesn't correspond with
your 0xfb.

-- ynezz

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


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

2019-05-15 Thread Petr Štetiar
Kristian Evensen  [2019-05-10 18:26:22]:

> In order to install OpenWRT, you first need to compile an initramfs
> (ramdisk)-image for the device. 

This is no longer valid, right?

> --- 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"
>   ;;
> +head-weblink,hdrm200)
> + set_wifi_led "$boardname:green:wifi"
> + ;;

this could be grouped with other devices.

> + gpios = <&gpio0 19 GPIO_ACTIVE_LOW>;

pa group

> + gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>;

spi refclk group

> + gpios = <&gpio3 0 GPIO_ACTIVE_LOW>;

wled group

> + gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;

uartf group

> + gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;

uartf group

> +&pinctrl {
> + state_default: pinctrl0 {
> + default {
> + ralink,group = "i2c", "uartf", "pa", "spi refclk",
> +"wled";

so if I'm counting it right, you should probably remove i2c.

-- ynezz

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


Re: [OpenWrt-Devel] [PATCH] zynq: add manufactured to device title

2019-05-15 Thread Petr Štetiar
Luis Araneda  [2019-05-06 08:59:27]:

> > why are you removing the development part? I think, that it's useful
> > information so it shouldn't be removed if you don't have a good reason for
> > this. Putting appart the fact, that it's marked as trainer board on the
> > vendor's site[1].
> 
> Having said that, I really care about the manufacturer being added to
> the title, and for consistency reasons, I propose one of these
> options:
> 1: Remove the development part (modify 2 boards, this patch)
> 2: Remove the development board part (modify 4 boards, new patch)
> 3: Add the development/trainer/evaluation part (modify 2 boards, new patch)
> 
> I'm now more inclined to go for option 2 and drop everything that's
> not part of the manufacturer and model, as the "board" part is not
> adding meaningful information from a developer point of view, IMHO.
> 
> I'll wait for your reply before sending a V2.

Ok, lets do option 2.

-- ynezz

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


Re: [OpenWrt-Devel] [PATCH] fstools: block: make extroot mount preparation more robust

2019-05-15 Thread Petr Štetiar
Val Kulkov  [2019-05-14 17:03:11]:

> The patch was proposed last month by Kenneth Miller [1]. It enables
> extroot on x86_64-based devices. I confirm that the patch does what it
> claims. The issue with extroot on x86_64 devices is described in
> FS#2231 [2].

Then you should reply to that email[1] with your `Tested-by` tag[3], so the
potential reviewer knows, that it has been actually tested and that there's
some interest to get this fixed and merged.

> Any possibility to see this patch in the trunk any time soon?

You know, day has just 42 hours :-)

> [1] http://lists.infradead.org/pipermail/openwrt-devel/2019-April/016654.html
> [2] https://bugs.openwrt.org/index.php?do=details&task_id=2231
[3] 
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#using-reported-by-tested-by-reviewed-by-suggested-by-and-fixes

-- ynezz

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


Re: [OpenWrt-Devel] RFC: add metadata to buildroot

2019-05-15 Thread Petr Štetiar
Paul Spooren  [2019-05-14 17:32:20]:

> Glad you like it, my main goal would be to motivate device porters to
> deliver a uniform yaml file when requesting to add a new device. Do you see
> this as a possibility once a reasonable yaml template is created?

Well, I see no problem to merge it once it's in acceptable state and nobody
has explicitly NACKed it. We could simply start with opt-in (bonus points if
you include such YAML file along with the support for a new device) and once
the dust settles we could start talking about it as somehow more or less
mandatory requirement.

If by a template you mean some kind of schema, then yes. I think, that some
kind of schema is needed in order to have some tools which would help with
writing of properly formatted YAML files, validation during review etc.

It would be nice if we could possibly avoid reinventing the wheel and could
somehow (re)use ongoing DT dt-schema[1] effort:

"Devicetree bindings are written using json-schema vocabulary. Schema files are
 written in a JSON compatible subset of YAML. YAML is used instead of JSON as
 it considered more human readable and has some advantages such as allowing
 comments (Prefixed with '#')."[2]

1. https://github.com/devicetree-org/dt-schema
2. 
https://github.com/torvalds/linux/blob/master/Documentation/devicetree/writing-schema.md

-- ynezz

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


Re: [OpenWrt-Devel] [PATCH 3/3] ath79: Extend GL.iNet AR750S support to NAND file system

2019-05-15 Thread Petr Štetiar
Jeff Kletsky  [2019-05-14 15:39:56]:

> diff --git a/target/linux/ath79/base-files/etc/board.d/01_leds 
> b/target/linux/ath79/base-files/etc/board.d/01_leds
> index 9c353baabe..c974c12d14 100755
> --- a/target/linux/ath79/base-files/etc/board.d/01_leds
> +++ b/target/linux/ath79/base-files/etc/board.d/01_leds
> @@ -78,6 +78,10 @@ glinet,gl-ar300m-nor)
>  glinet,gl-ar300m-lite)
>   ucidef_set_led_netdev "lan" "LAN" "gl-ar300m-lite:green:lan" "eth0"
>   ;;
> +glinet,gl-ar750s-*)
> + ucidef_set_led_netdev "wlan2g" "WLAN 2G" "gl-ar750s:green:wlan2g"
> + ucidef_set_led_netdev "wlan5g" "WLAN 5G" "gl-ar750s:green:wlan5g"

why do you need this? It's already being set in the DTS by the LED triggers,
isn't it? Having it defined in DTS is preferred.

> +# During image creation the "board name" is of the format mfgr_board-name
> +# However, on a running device it is of the format mfgr,board-name

That's already clear from the code, so drop this comment.

> +comma_to_underscore() {
> + echo "${1%%,*}_${1#*,}"
> +}
> +
>  platform_check_image() {
> - return 0
> + local board=$(board_name)
> +
> + case "$board" in
> + glinet,gl-ar750s-nand)
> + nand_do_platform_check "$(comma_to_underscore "$board")" 
> "$IMAGE"
> + ;;
> + *)
> + return 0
> + ;;
> + esac
>  }

I think, that it would be better to add support for DT compatible based
board_name format directly into nand_do_platform_check, so it could be reused
by other platforms as well.

> diff --git a/target/linux/ath79/dts/qca9563_glinet_gl-ar750s.dts 
> b/target/linux/ath79/dts/qca9563_glinet_gl-ar750s.dtsi
> similarity index 64%
> rename from target/linux/ath79/dts/qca9563_glinet_gl-ar750s.dts
> rename to target/linux/ath79/dts/qca9563_glinet_gl-ar750s.dtsi
> index 378de5de90..e38879182e 100644
> --- a/target/linux/ath79/dts/qca9563_glinet_gl-ar750s.dts
> +++ b/target/linux/ath79/dts/qca9563_glinet_gl-ar750s.dtsi
> @@ -15,10 +15,10 @@
>   };
>  
>   aliases {
> - led-boot = &power;
> - led-failsafe = &power;
> - led-running = &power;
> - led-upgrade = &power;
> + led-boot = &led_power;
> + led-failsafe = &led_wlan2g;
> + led-running = &led_power;
> + led-upgrade = &led_wlan5g;
>   };

Please don't do this, those LEDs have defined functions and using wlan5g LED
to signal an upgrade might be confusing. It has been discussed a lot of times
already.

> + i2c@0 {
> + compatible = "i2c-gpio";
> +
> + sda-gpios = <&gpio  5 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
> + scl-gpios = <&gpio 21 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
> + i2c-gpio,delay-us = <2>;/* ~100 kHz */

What was wrong with the default value? Have you actually checked the resulting
clock frequency somehow?

> + #address-cells = <1>;
> + #size-cells = <0>;

The #address-cells and #size-cells properties may be used in any device node
that has children in the devicetree hierarchy and describes how child device
nodes should be addressed. The #address-cells property defines the number of
 cells used to encode the address field in a child node’s reg property.
The #size-cells property defines the number of  cells used to encode the
size field in a child node’s reg property.

So you can drop this.

> diff --git a/target/linux/ath79/image/nand.mk 
> b/target/linux/ath79/image/nand.mk
> index e69de29bb2..7db5f51c98 100644
> --- a/target/linux/ath79/image/nand.mk
> +++ b/target/linux/ath79/image/nand.mk
> @@ -0,0 +1,15 @@
> +define Device/glinet_gl-ar750s-nand
> +  ATH_SOC := qca9563
> +  DEVICE_TITLE := GL.iNet GL-AR750S
> +  DEVICE_PACKAGES := kmod-usb2 kmod-ath10k-ct ath10k-firmware-qca9887-ct 
> kmod-i2c-gpio
> +  KERNEL_SIZE := 2048k
> +  BLOCKSIZE := 128k
> +  PAGESIZE := 2048
> +  VID_HDR_OFFSET := 2048
> +  IMAGES += factory.img
> +  IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
> +  IMAGE/factory.img := append-kernel | pad-to (KERNEL_SIZE) | append-ubi
> +  SUPPORTED_DEVICES += gl-ar750s

I'm really not sure about this. Do we've enough checks in place, that we won't
allow sysupgrade from NOR?

-- ynezz

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


Re: [OpenWrt-Devel] [PATCH 1/3] mtd: spinand: Add support for GigaDevice GD5F1GQ4UFxxG (Pending)

2019-05-15 Thread Petr Štetiar
Jeff Kletsky  [2019-05-14 15:39:54]:

> Subject: [PATCH 1/3] mtd: spinand: Add support for GigaDevice GD5F1GQ4UFxxG 
> (Pending)

It should be `kernel: mtd: spinand: ...` and while at it, you can probably
drop that `(Pending)` part as well.

> Submitted upstream as https://patchwork.ozlabs.org/patch/1098024/

...

> --- /dev/null
> +++ 
> b/target/linux/generic/pending-4.19/452-mtd-spinand-add-support-for-gigadevice-gd5f1gq4ufxxg.patch
> @@ -0,0 +1,255 @@
> +Index: linux-4.19.37/drivers/mtd/nand/spi/gigadevice.c
> +===
> +--- linux-4.19.37.orig/drivers/mtd/nand/spi/gigadevice.c
>  linux-4.19.37/drivers/mtd/nand/spi/gigadevice.c

I would prefer if you could include complete patch as provided by `git
format-patch` command in order to have some context in that file.

-- ynezz

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


Re: [OpenWrt-Devel] [PATCH 2/3] ath79: Prepare nand subtarget for SPI-NAND boards under Linux 4.19

2019-05-15 Thread Petr Štetiar
Jeff Kletsky  [2019-05-14 15:39:55]:

[ adding Marty (author of ar300m-nand support) to the Cc loop ]

>   * Removed non-functional GL.iNet AR300M NAND target

you've probably missed some parts:

 package/boot/uboot-envtools/files/ath79:glinet,gl-ar300m-nand|\
 target/linux/ath79/base-files/etc/board.d/01_leds:glinet,gl-ar300m-nand|\
 target/linux/ath79/base-files/etc/board.d/02_network:   glinet,gl-ar300m-nand|\
 target/linux/ath79/dts/qca9531_glinet_gl-ar300m-nand.dts:   compatible = 
"glinet,gl-ar300m-nand", "qca,qca9531";

could you please make this ar300m-nand removal separate commit (probably first
in the series) and add Marty to the Cc?

 Cc: Marty E. Plummer 
 Signed-off-by: Jeff Kletsky 

It would be nice to make him aware about this possible device removal as he
might be interested in fixing of support for this device or in the other case,
he can possibly give you his Acked-by/Reviewed-by tag.

> ---
>  target/linux/ath79/image/nand.mk   | 13 ---
>  target/linux/ath79/nand/config-default | 32 +++---
>  target/linux/ath79/nand/target.mk  | 10 +---
>  3 files changed, 26 insertions(+), 29 deletions(-)
> 
> diff --git a/target/linux/ath79/image/nand.mk 
> b/target/linux/ath79/image/nand.mk
> index eee419194b..e69de29bb2 100644
> --- a/target/linux/ath79/image/nand.mk
> +++ b/target/linux/ath79/image/nand.mk
> @@ -1,13 +0,0 @@
> -define Device/glinet_gl-ar300m-nand
> -  ATH_SOC := qca9531
> -  DEVICE_TITLE := GL-AR300M (NAND)
> -  DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-storage 
> kmod-usb-ledtrig-usbport
> -  KERNEL_SIZE := 2048k
> -  BLOCKSIZE := 128k
> -  PAGESIZE := 2048
> -  VID_HDR_OFFSET := 512
> -  IMAGES += factory.ubi
> -  IMAGE/sysupgrade.bin := sysupgrade-tar
> -  IMAGE/factory.ubi := append-kernel | pad-to (KERNEL_SIZE) | append-ubi
> -endef
> -TARGET_DEVICES += glinet_gl-ar300m-nand
> diff --git a/target/linux/ath79/nand/config-default 
> b/target/linux/ath79/nand/config-default
> index 738c29c9b1..05a5a8dbd0 100644
> --- a/target/linux/ath79/nand/config-default
> +++ b/target/linux/ath79/nand/config-default
> @@ -1,14 +1,20 @@
> -CONFIG_BCH=y
> -CONFIG_MTD_NAND=y
> -CONFIG_MTD_NAND_BCH=y
> -CONFIG_MTD_NAND_ECC=y
> -CONFIG_MTD_NAND_ECC_BCH=y
> -CONFIG_MTD_SPINAND_MT29F=y
> -CONFIG_MTD_SPINAND_ONDIEECC=y
> +CONFIG_BLK_MQ_PCI=y
> +CONFIG_LEDS_RESET=y
> +CONFIG_MTD_NAND_CORE=y
> +CONFIG_MTD_SPI_NAND=y
>  CONFIG_MTD_UBI=y
> -CONFIG_MTD_UBI_BEB_LIMIT=20
> -# CONFIG_MTD_UBI_BLOCK is not set
> -# CONFIG_MTD_UBI_FASTMAP is not set
> -# CONFIG_MTD_UBI_GLUEBI is not set
> -CONFIG_MTD_UBI_WL_THRESHOLD=4096
> -# CONFIG_UBIFS_FS is not set
> +CONFIG_MTD_UBI_BLOCK=y
> +CONFIG_OF_ADDRESS_PCI=y
> +CONFIG_OF_PCI=y
> +CONFIG_OF_PCI_IRQ=y
> +CONFIG_PCI=y
> +# CONFIG_PCI_AR71XX is not set
> +CONFIG_PCI_AR724X=y
> +CONFIG_PCI_DISABLE_COMMON_QUIRKS=y
> +CONFIG_PCI_DOMAINS=y
> +# CONFIG_PHY_AR7100_USB is not set
> +CONFIG_PHY_AR7200_USB=y
> +CONFIG_UBIFS_FS=y
> +CONFIG_UBIFS_FS_ADVANCED_COMPR=y
> +CONFIG_UBIFS_FS_LZO=y
> +CONFIG_UBIFS_FS_ZLIB=y
> diff --git a/target/linux/ath79/nand/target.mk 
> b/target/linux/ath79/nand/target.mk
> index 91afe675c5..6ab9748ca4 100644
> --- a/target/linux/ath79/nand/target.mk
> +++ b/target/linux/ath79/nand/target.mk
> @@ -1,9 +1,13 @@
>  BOARDNAME := Generic devices with NAND flash
> -FEATURES += squashfs nand rtc
> +
> +# SPI NAND support requires at least Linux 4.19

You can drop this comment, having this in the commit message is enough.

> +KERNEL_PATCHVER:=4.19
> +
> +FEATURES += squashfs nand
>  
>  DEFAULT_PACKAGES += wpad-basic
>  
>  define Target/Description
> - Build firmware for Atheros AR71xx/AR913x based boards with
> - NAND flash, e.g. Netgear WNDR4300.
> + Firmware for boards based on MIPS 24kc Atheros/Qualcomm SoCs
> + in the ar72xx and subsequent generations with support for NAND flash
>  endef
> -- 
> 2.20.1

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