[PATCHv3 2/3] busybox: update to 1.33

2021-01-07 Thread Rosen Penev
Remove stime backport.

Remove static libgcc patch as upstream fixed it with
BUSYBOX_DEFAULT_STATIC_LIBGCC which defauls to off.

Remove date -k patch as it no longer applies. It's also pointless as
busybox' hwclock utility can do the same thing.

Remove ntpd patch as that seems to have been applied upstream.

Add smalll patch fixing compilation with SELinux. Upstream commit
2496616b0a8d1c80cd1416b73a4847b59b9f969a renamed the variable without
renaming it in the SELinux path.

Refresh config and patches.

Signed-off-by: Rosen Penev 
---
 v3: more complete config refresh.
 v2: refreshed config and slight rewording.
 package/utils/busybox/Config-defaults.in  |  48 ++-
 package/utils/busybox/Makefile|   6 +-
 package/utils/busybox/config/Config.in|  38 --
 .../utils/busybox/config/archival/Config.in   |   2 +-
 .../busybox/config/console-tools/Config.in|  13 --
 .../utils/busybox/config/coreutils/Config.in  |  10 +-
 .../utils/busybox/config/e2fsprogs/Config.in  |   1 -
 .../utils/busybox/config/findutils/Config.in  |   8 ++
 .../busybox/config/klibc-utils/Config.in  |   1 -
 package/utils/busybox/config/libbb/Config.in  |   2 -
 .../utils/busybox/config/miscutils/Config.in  |  36 +
 .../utils/busybox/config/modutils/Config.in   |   6 -
 .../utils/busybox/config/networking/Config.in |  68 ++
 .../busybox/config/networking/udhcp/Config.in |   2 -
 package/utils/busybox/config/procps/Config.in |   3 -
 package/utils/busybox/config/shell/Config.in  | 124 ++
 .../utils/busybox/config/sysklogd/Config.in   |  10 +-
 .../utils/busybox/config/util-linux/Config.in |  62 ++---
 .../config/util-linux/volume_id/Config.in |   6 +
 .../001-remove-stime-function-calls.patch |  84 
 .../patches/010-fix-wrong-variable.patch  |  11 ++
 .../patches/110-no_static_libgcc.patch|  11 --
 .../busybox/patches/120-lto-jobserver.patch   |   6 +-
 .../patches/200-udhcpc_reduce_msgs.patch  |   4 +-
 .../patches/201-udhcpc_changed_ifindex.patch  |   2 +-
 .../203-udhcpc_renew_no_deconfig.patch|   2 +-
 .../patches/230-add_nslookup_lede.patch   |   6 +-
 .../busybox/patches/250-date-k-flag.patch |  92 -
 .../500-move-traceroute-applets-to-bin.patch  |   2 +-
 ...520-loginutils-handle-crypt-failures.patch |   6 +-
 .../patches/600-allow-ntpd-non-root.patch |  12 --
 31 files changed, 255 insertions(+), 429 deletions(-)
 delete mode 100644 
package/utils/busybox/patches/001-remove-stime-function-calls.patch
 create mode 100644 package/utils/busybox/patches/010-fix-wrong-variable.patch
 delete mode 100644 package/utils/busybox/patches/110-no_static_libgcc.patch
 delete mode 100644 package/utils/busybox/patches/250-date-k-flag.patch
 delete mode 100644 package/utils/busybox/patches/600-allow-ntpd-non-root.patch

diff --git a/package/utils/busybox/Config-defaults.in 
b/package/utils/busybox/Config-defaults.in
index 8d237ad181..04148df267 100644
--- a/package/utils/busybox/Config-defaults.in
+++ b/package/utils/busybox/Config-defaults.in
@@ -85,9 +85,6 @@ config BUSYBOX_DEFAULT_FEATURE_SYSLOG_INFO
 config BUSYBOX_DEFAULT_FEATURE_SYSLOG
bool
default y
-config BUSYBOX_DEFAULT_PLATFORM_LINUX
-   bool
-   default y
 config BUSYBOX_DEFAULT_STATIC
bool
default n
@@ -130,6 +127,9 @@ config BUSYBOX_DEFAULT_USE_PORTABLE_CODE
 config BUSYBOX_DEFAULT_STACK_OPTIMIZATION_386
bool
default n
+config BUSYBOX_DEFAULT_STATIC_LIBGCC
+   bool
+   default n
 config BUSYBOX_DEFAULT_INSTALL_APPLET_SYMLINKS
bool
default y
@@ -169,6 +169,9 @@ config BUSYBOX_DEFAULT_UNIT_TEST
 config BUSYBOX_DEFAULT_WERROR
bool
default n
+config BUSYBOX_DEFAULT_WARN_SIMPLE_MSG
+   bool
+   default n
 config BUSYBOX_DEFAULT_NO_DEBUG_LIB
bool
default y
@@ -872,6 +875,9 @@ config BUSYBOX_DEFAULT_USLEEP
 config BUSYBOX_DEFAULT_UUDECODE
bool
default n
+config BUSYBOX_DEFAULT_BASE32
+   bool
+   default n
 config BUSYBOX_DEFAULT_BASE64
bool
default n
@@ -1160,6 +1166,9 @@ config BUSYBOX_DEFAULT_FEATURE_FIND_QUIT
 config BUSYBOX_DEFAULT_FEATURE_FIND_DELETE
bool
default n
+config BUSYBOX_DEFAULT_FEATURE_FIND_EMPTY
+   bool
+   default n
 config BUSYBOX_DEFAULT_FEATURE_FIND_PATH
bool
default y
@@ -1565,9 +1574,6 @@ config BUSYBOX_DEFAULT_FEATURE_GETOPT_LONG
 config BUSYBOX_DEFAULT_HEXDUMP
bool
default y
-config BUSYBOX_DEFAULT_FEATURE_HEXDUMP_REVERSE
-   bool
-   default n
 config BUSYBOX_DEFAULT_HD
bool
default n
@@ -1778,6 +1784,9 @@ config BUSYBOX_DEFAULT_TASKSET
 config BUSYBOX_DEFAULT_FEATURE_TASKSET_FANCY
bool
default n
+config BUSYBOX_DEFAULT_FEATURE_TASKSET_CPULIST
+   bool
+   default n
 config BUSYBOX_DEFAULT_UEVENT
bool
default n
@@ -1814,6 +1823,9 @@ config 

[PATCHv3 3/3] busybox: remove useless busybox patches

2021-01-07 Thread Rosen Penev
The first two are useless as /bin/sh can execute those scripts just
fine. Shellcheck reports no problems.

Telnet patch is useless as telnet is no longer used in OpenWrt.

Signed-off-by: Rosen Penev 
---
 package/utils/busybox/patches/100-trylink_bash.patch   |  8 
 .../busybox/patches/101-gen_build_files_bash.patch |  8 
 package/utils/busybox/patches/240-telnetd_intr.patch   | 10 --
 3 files changed, 26 deletions(-)
 delete mode 100644 package/utils/busybox/patches/100-trylink_bash.patch
 delete mode 100644 package/utils/busybox/patches/101-gen_build_files_bash.patch
 delete mode 100644 package/utils/busybox/patches/240-telnetd_intr.patch

diff --git a/package/utils/busybox/patches/100-trylink_bash.patch 
b/package/utils/busybox/patches/100-trylink_bash.patch
deleted file mode 100644
index f9571fcbc8..00
--- a/package/utils/busybox/patches/100-trylink_bash.patch
+++ /dev/null
@@ -1,8 +0,0 @@
 a/scripts/trylink
-+++ b/scripts/trylink
-@@ -1,4 +1,4 @@
--#!/bin/sh
-+#!/usr/bin/env bash
- 
- debug=false
- 
diff --git a/package/utils/busybox/patches/101-gen_build_files_bash.patch 
b/package/utils/busybox/patches/101-gen_build_files_bash.patch
deleted file mode 100644
index d258fb8bc4..00
--- a/package/utils/busybox/patches/101-gen_build_files_bash.patch
+++ /dev/null
@@ -1,8 +0,0 @@
 a/scripts/gen_build_files.sh
-+++ b/scripts/gen_build_files.sh
-@@ -1,4 +1,4 @@
--#!/bin/sh
-+#!/usr/bin/env bash
- 
- # Note: was using sed OPTS CMD -- FILES
- # but users complain that many sed implementations
diff --git a/package/utils/busybox/patches/240-telnetd_intr.patch 
b/package/utils/busybox/patches/240-telnetd_intr.patch
deleted file mode 100644
index 773ba44db5..00
--- a/package/utils/busybox/patches/240-telnetd_intr.patch
+++ /dev/null
@@ -1,10 +0,0 @@
 a/networking/telnetd.c
-+++ b/networking/telnetd.c
-@@ -509,6 +509,7 @@ make_new_session(
- 
-   /* Restore default signal handling ASAP */
-   bb_signals((1 << SIGCHLD) + (1 << SIGPIPE), SIG_DFL);
-+  signal(SIGINT, SIG_DFL);
- 
-   pid = getpid();
- 
-- 
2.29.2


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


[PATCHv3 1/3] base-files: use hwclock --systz

2021-01-07 Thread Rosen Penev
The date -k patch is non standard and will be removed in the next
commit.

Tested behavior to be identical with a simple C program:

 #define _GNU_SOURCE
 #include 
 #include 
 #include 
 #include 

int main()
{
struct timezone tt;
struct timezone tz;

int a = syscall(SYS_gettimeofday, NULL, );
int b = gettimeofday(NULL, );
printf("%d - %d, %d\n", a, tt.tz_minuteswest, tt.tz_dsttime);
printf("%d - %d, %d\n", b, tz.tz_minuteswest, tz.tz_dsttime);
}

Signed-off-by: Rosen Penev 
---
 v2: moved patch to the front for easier git bisect
 package/base-files/files/etc/init.d/system | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/base-files/files/etc/init.d/system 
b/package/base-files/files/etc/init.d/system
index 0e33c522b4..585f7e 100755
--- a/package/base-files/files/etc/init.d/system
+++ b/package/base-files/files/etc/init.d/system
@@ -27,7 +27,7 @@ system_config() {
ln -sf "/usr/share/zoneinfo/$zonename" /tmp/localtime && rm -f 
/tmp/TZ
 
# apply timezone to kernel
-   busybox date -k
+   hwclock --systz
 }
 
 reload_service() {
-- 
2.29.2


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


[PATCH] wireguard-tools: allow generating private_key

2021-01-07 Thread Leonardo Mörlein
When the uci configuration is created automatically during a very early
stage, where no entropy daemon is set up, generating the key directly is
not an option. Therefore we allow to set the private_key to "generate"
and generate the private key directly before the interface is taken up.

Signed-off-by: Leonardo Mörlein 
---
 package/network/utils/wireguard-tools/files/wireguard.sh | 5 +
 1 file changed, 5 insertions(+)

diff --git a/package/network/utils/wireguard-tools/files/wireguard.sh 
b/package/network/utils/wireguard-tools/files/wireguard.sh
index 63261aea71..d874c4b5e6 100644
--- a/package/network/utils/wireguard-tools/files/wireguard.sh
+++ b/package/network/utils/wireguard-tools/files/wireguard.sh
@@ -121,6 +121,11 @@ proto_wireguard_setup() {
ip link set mtu "${mtu}" dev "${config}"
fi
 
+   if [ "$private_key" == "generate" ]; then
+   private_key=`"${WG}" genkey`
+   uci -q set network."$config".private_key="$private_key" && uci 
-q commit network
+   fi
+
proto_init_update "${config}" 1
 
umask 077
-- 
2.30.0


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


[PATCH] iw: enable HE PHY information for iw-tiny

2021-01-07 Thread David Bauer
Currently PHY information obtained from "iw phy" lacks information about
a PHYs HE capabilities when using the by default installed iw-tiny.

As there are already 802.11ax supported devices, enabled printing this
information for the by-default installed iw variant.

Signed-off-by: David Bauer 
---
 package/network/utils/iw/Makefile |  2 +-
 .../utils/iw/patches/200-reduce_size.patch| 38 ++-
 2 files changed, 12 insertions(+), 28 deletions(-)

diff --git a/package/network/utils/iw/Makefile 
b/package/network/utils/iw/Makefile
index 90e6782911..6eb10c837f 100644
--- a/package/network/utils/iw/Makefile
+++ b/package/network/utils/iw/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=iw
 PKG_VERSION:=5.8
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=@KERNEL/software/network/iw
diff --git a/package/network/utils/iw/patches/200-reduce_size.patch 
b/package/network/utils/iw/patches/200-reduce_size.patch
index 24eb96537b..1e8286300b 100644
--- a/package/network/utils/iw/patches/200-reduce_size.patch
+++ b/package/network/utils/iw/patches/200-reduce_size.patch
@@ -38,23 +38,7 @@
  
 --- a/info.c
 +++ b/info.c
-@@ -167,6 +167,7 @@ static int print_phy_handler(struct nl_m
-   tb_band[NL80211_BAND_ATTR_VHT_MCS_SET])
-   
print_vht_info(nla_get_u32(tb_band[NL80211_BAND_ATTR_VHT_CAPA]),
-  
nla_data(tb_band[NL80211_BAND_ATTR_VHT_MCS_SET]));
-+#ifdef IW_FULL
-   if (tb_band[NL80211_BAND_ATTR_IFTYPE_DATA]) {
-   struct nlattr *nl_iftype;
-   int rem_band;
-@@ -174,6 +175,7 @@ static int print_phy_handler(struct nl_m
-   nla_for_each_nested(nl_iftype, 
tb_band[NL80211_BAND_ATTR_IFTYPE_DATA], rem_band)
-   print_he_info(nl_iftype);
-   }
-+#endif
-   if (tb_band[NL80211_BAND_ATTR_FREQS]) {
-   if (!band_had_freq) {
-   printf("\t\tFrequencies:\n");
-@@ -216,6 +218,7 @@ next:
+@@ -216,6 +216,7 @@ next:
}
}
  
@@ -62,7 +46,7 @@
if (tb_band[NL80211_BAND_ATTR_RATES]) {
printf("\t\tBitrates (non-HT):\n");
nla_for_each_nested(nl_rate, 
tb_band[NL80211_BAND_ATTR_RATES], rem_rate) {
-@@ -232,6 +235,7 @@ next:
+@@ -232,6 +233,7 @@ next:
printf("\n");
}
}
@@ -70,7 +54,7 @@
}
}
  
-@@ -297,6 +301,7 @@ next:
+@@ -297,6 +299,7 @@ next:
printf("\tCoverage class: %d (up to %dm)\n", coverage, 450 * 
coverage);
}
  
@@ -78,7 +62,7 @@
if (tb_msg[NL80211_ATTR_CIPHER_SUITES]) {
int num = nla_len(tb_msg[NL80211_ATTR_CIPHER_SUITES]) / 
sizeof(__u32);
int i;
-@@ -308,6 +313,7 @@ next:
+@@ -308,6 +311,7 @@ next:
cipher_name(ciphers[i]));
}
}
@@ -86,7 +70,7 @@
  
if (tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX] &&
tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX])
-@@ -327,11 +333,13 @@ next:
+@@ -327,11 +331,13 @@ next:
printf("\t\t * %s\n", iftype_name(nla_type(nl_mode)));
}
  
@@ -100,7 +84,7 @@
  
if (tb_msg[NL80211_ATTR_INTERFACE_COMBINATIONS]) {
struct nlattr *nl_combi;
-@@ -428,6 +436,7 @@ broken_combination:
+@@ -428,6 +434,7 @@ broken_combination:
printf("\tinterface combinations are not supported\n");
}
  
@@ -108,7 +92,7 @@
if (tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS]) {
printf("\tSupported commands:\n");
nla_for_each_nested(nl_cmd, 
tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS], rem_cmd)
-@@ -525,6 +534,7 @@ broken_combination:
+@@ -525,6 +532,7 @@ broken_combination:
printf("\t\t * wake up on TCP connection\n");
}
}
@@ -116,7 +100,7 @@
  
if (tb_msg[NL80211_ATTR_ROAM_SUPPORT])
printf("\tDevice supports roaming.\n");
-@@ -563,6 +573,7 @@ broken_combination:
+@@ -563,6 +571,7 @@ broken_combination:
}
}
  
@@ -124,7 +108,7 @@
if (tb_msg[NL80211_ATTR_FEATURE_FLAGS]) {
unsigned int features = 
nla_get_u32(tb_msg[NL80211_ATTR_FEATURE_FLAGS]);
  
-@@ -627,6 +638,7 @@ broken_combination:
+@@ -627,6 +636,7 @@ broken_combination:
if (features & NL80211_FEATURE_ND_RANDOM_MAC_ADDR)
printf("\tDevice supports randomizing MAC-addr in 
net-detect scans.\n");
}
@@ -132,7 +116,7 @@
  
if (tb_msg[NL80211_ATTR_TDLS_SUPPORT])
printf("\tDevice 

RE: [PATCH 4/5] realtek: introduce shared DTSI for GS1900-HP series

2021-01-07 Thread Adrian Schmutzler
Hi,

> -Original Message-
> From: Stijn Segers [mailto:f...@volatilesystems.org]
> Sent: Donnerstag, 7. Januar 2021 22:23
> To: Adrian Schmutzler 
> Cc: openwrt-devel@lists.openwrt.org
> Subject: RE: [PATCH 4/5] realtek: introduce shared DTSI for GS1900-HP series
> 
> Hi Adrian,
> 
> Op donderdag 7 januari 2021 om 19:54 schreef Adrian Schmutzler
> :
> > Hi,
> >
> >>  -Original Message-
> >>  From: openwrt-devel [mailto:openwrt-devel-
> boun...@lists.openwrt.org]
> >>  On Behalf Of Stijn Segers
> >>  Sent: Mittwoch, 6. Januar 2021 22:45
> >>  To: openwrt-devel@lists.openwrt.org
> >>  Subject: [PATCH 4/5] realtek: introduce shared DTSI for GS1900-HP
> >> series
> >>
> >>  The ZyXEL GS1900-8HP v1, v2 and GS1900-10HP are all built on a
> >> similar  Realtek RTL8380M platform. Create a common DTSI in
> >> preparation for  GS1900-8HP support, and switch to the macros defined
> >> in rtl838x.dtsi.
> >
> > I've merged 1 to 3 with minor adjustments/fixes, but for this one the
> > removed and added sections don't match at all.
> 
> I think your shuffling around the memory blocks (rightfully so) and the fact
> my patches already had some dts-v1 lines removed might have been a factor
> in that?
> 
> Have sent in a v4 for the remaining two patches :-)

you still don't use the DTSI in the DTS, and only copy a part of it ...

This is still broken.

Best

Adrian

> 
> Thank you
> 
> Stijn
> 
> >
> > Please fix/rebase (and also changed the DTSI include in the DTS).
> >
> > Best
> >
> > Adrian
> >
> >>
> >>  Signed-off-by: Stijn Segers 
> >>  ---
> >>   .../realtek/dts/rtl8380_zyxel_gs1900-10hp.dts | 190
> >> +-
> >>   .../realtek/dts/rtl8380_zyxel_gs1900.dtsi | 147 ++
> >>   2 files changed, 151 insertions(+), 186 deletions(-)  create mode
> >> 100644
> >>  target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi
> >>
> >>  diff --git a/target/linux/realtek/dts/rtl8380_zyxel_gs1900-10hp.dts
> >>  b/target/linux/realtek/dts/rtl8380_zyxel_gs1900-10hp.dts
> >>  index 0fb78926d9..5c53385020 100644
> >>  --- a/target/linux/realtek/dts/rtl8380_zyxel_gs1900-10hp.dts
> >>  +++ b/target/linux/realtek/dts/rtl8380_zyxel_gs1900-10hp.dts
> >>  @@ -1,5 +1,4 @@
> >>   // SPDX-License-Identifier: GPL-2.0-or-later -/dts-v1/;
> >>
> >>   #include "rtl838x.dtsi"
> >>
> >>  @@ -10,11 +9,6 @@
> >>compatible = "zyxel,gs1900-10hp", "realtek,rtl838x-soc";
> >>model = "ZyXEL GS1900-10HP Switch";
> >>
> >>  - memory@0 {
> >>  - device_type = "memory";
> >>  - reg = <0x0 0x800>;
> >>  - };
> >>  -
> >>aliases {
> >>led-boot = _sys;
> >>led-failsafe = _sys;
> >>  @@ -96,192 +90,16 @@
> >>
> >>   };
> >>
> >>  - {
> >>  - status = "okay";
> >>  - flash@0 {
> >>  - compatible = "jedec,spi-nor";
> >>  - reg = <0>;
> >>  - spi-max-frequency = <1000>;
> >>  -
> >>  - partitions {
> >>  - compatible = "fixed-partitions";
> >>  - #address-cells = <1>;
> >>  - #size-cells = <1>;
> >>  -
> >>  - partition@0 {
> >>  - label = "u-boot";
> >>  - reg = <0x0 0x4>;
> >>  - read-only;
> >>  - };
> >>  - partition@4 {
> >>  - label = "u-boot-env";
> >>  - reg = <0x4 0x1>;
> >>  - read-only;
> >>  - };
> >>  - partition@5 {
> >>  - label = "u-boot-env2";
> >>  - reg = <0x5 0x1>;
> >>  - read-only;
> >>  - };
> >>  - partition@6 {
> >>  - label = "jffs";
> >>  - reg = <0x6 0x10>;
> >>  - };
> >>  - partition@16 {
> >>  - label = "jffs2";
> >>  - reg = <0x16 0x10>;
> >>  - };
> >>  - partition@b26 {
> >>  - label = "firmware";
> >>  - reg = <0x26 0x6d>;
> >>  - compatible = "denx,uimage";
> >>  - };
> >>  - partition@93 {
> >>  - label = "runtime2";
> >>  - reg = <0x93 0x6d>;
> >>  - };
> >>  - };
> >>  - };
> >>  -};
> >>  -
> >>{
> >>mdio: mdio-bus {
> >>  - compatible = "realtek,rtl838x-mdio";
> >>  - regmap = <>;
> >>  - #address-cells = <1>;
> >>  - #size-cells = <0>;
> >>  -
> >>  - /* Internal phy */
> >>  - phy8: ethernet-phy@8 {
> >>  - reg = <8>;
> >>  - compatible = "ethernet-phy-ieee802.3-c22";
> >>  - };
> >>  - phy9: ethernet-phy@9 {
> >>  - 

[PATCH 1/2] realtek: introduce shared DTSI for GS1900-HP series

2021-01-07 Thread Stijn Segers
The ZyXEL GS1900-8HP v1, v2 and GS1900-10HP are all built on a similar
Realtek RTL8380M platform. Create a common DTSI in preparation for
GS1900-8HP support, and switch to the macros defined in rtl838x.dtsi.

Signed-off-by: Stijn Segers 
---
 .../realtek/dts/rtl8380_zyxel_gs1900-10hp.dts | 189 +-
 .../realtek/dts/rtl8380_zyxel_gs1900.dtsi | 147 ++
 2 files changed, 151 insertions(+), 185 deletions(-)
 create mode 100644 target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi

diff --git a/target/linux/realtek/dts/rtl8380_zyxel_gs1900-10hp.dts 
b/target/linux/realtek/dts/rtl8380_zyxel_gs1900-10hp.dts
index b114cb6b5a..5c53385020 100644
--- a/target/linux/realtek/dts/rtl8380_zyxel_gs1900-10hp.dts
+++ b/target/linux/realtek/dts/rtl8380_zyxel_gs1900-10hp.dts
@@ -20,11 +20,6 @@
bootargs = "console=ttyS0,115200";
};
 
-   memory@0 {
-   device_type = "memory";
-   reg = <0x0 0x800>;
-   };
-
gpio1: rtl8231-gpio {
status = "okay";
 
@@ -95,192 +90,16 @@
 
 };
 
- {
-   status = "okay";
-   flash@0 {
-   compatible = "jedec,spi-nor";
-   reg = <0>;
-   spi-max-frequency = <1000>;
-
-   partitions {
-   compatible = "fixed-partitions";
-   #address-cells = <1>;
-   #size-cells = <1>;
-
-   partition@0 {
-   label = "u-boot";
-   reg = <0x0 0x4>;
-   read-only;
-   };
-   partition@4 {
-   label = "u-boot-env";
-   reg = <0x4 0x1>;
-   read-only;
-   };
-   partition@5 {
-   label = "u-boot-env2";
-   reg = <0x5 0x1>;
-   read-only;
-   };
-   partition@6 {
-   label = "jffs";
-   reg = <0x6 0x10>;
-   };
-   partition@16 {
-   label = "jffs2";
-   reg = <0x16 0x10>;
-   };
-   partition@b26 {
-   label = "firmware";
-   reg = <0x26 0x6d>;
-   compatible = "denx,uimage";
-   };
-   partition@93 {
-   label = "runtime2";
-   reg = <0x93 0x6d>;
-   };
-   };
-   };
-};
-
  {
mdio: mdio-bus {
-   compatible = "realtek,rtl838x-mdio";
-   regmap = <>;
-   #address-cells = <1>;
-   #size-cells = <0>;
-
-   /* Internal phy */
-   phy8: ethernet-phy@8 {
-   reg = <8>;
-   compatible = "ethernet-phy-ieee802.3-c22";
-   };
-   phy9: ethernet-phy@9 {
-   reg = <9>;
-   compatible = "ethernet-phy-ieee802.3-c22";
-   };
-   phy10: ethernet-phy@10 {
-   reg = <10>;
-   compatible = "ethernet-phy-ieee802.3-c22";
-   };
-   phy11: ethernet-phy@11 {
-   reg = <11>;
-   compatible = "ethernet-phy-ieee802.3-c22";
-   };
-   phy12: ethernet-phy@12 {
-   reg = <12>;
-   compatible = "ethernet-phy-ieee802.3-c22";
-   };
-   phy13: ethernet-phy@13 {
-   reg = <13>;
-   compatible = "ethernet-phy-ieee802.3-c22";
-   };
-   phy14: ethernet-phy@14 {
-   reg = <14>;
-   compatible = "ethernet-phy-ieee802.3-c22";
-   };
-   phy15: ethernet-phy@15 {
-   reg = <15>;
-   compatible = "ethernet-phy-ieee802.3-c22";
-   };
-   phy24: ethernet-phy@24 {
-   compatible = "ethernet-phy-ieee802.3-c22";
-   reg = <24>;
-   };
-   phy26: ethernet-phy@26 {
-   compatible = "ethernet-phy-ieee802.3-c22";
-   reg = <26>;
-   };
+   INTERNAL_PHY(24)
+   INTERNAL_PHY(26)
};
 };
 
  {
ports {
-   #address-cells = <1>;
-   #size-cells = <0>;
-
-   port@0 {
-   reg = <8>;
-  

RE: [PATCH 4/5] realtek: introduce shared DTSI for GS1900-HP series

2021-01-07 Thread Stijn Segers

Hi Adrian,

Op donderdag 7 januari 2021 om 19:54 schreef Adrian Schmutzler 
:

Hi,


 -Original Message-
 From: openwrt-devel [mailto:openwrt-devel-boun...@lists.openwrt.org]
 On Behalf Of Stijn Segers
 Sent: Mittwoch, 6. Januar 2021 22:45
 To: openwrt-devel@lists.openwrt.org
 Subject: [PATCH 4/5] realtek: introduce shared DTSI for GS1900-HP 
series


 The ZyXEL GS1900-8HP v1, v2 and GS1900-10HP are all built on a 
similar

 Realtek RTL8380M platform. Create a common DTSI in preparation for
 GS1900-8HP support, and switch to the macros defined in 
rtl838x.dtsi.


I've merged 1 to 3 with minor adjustments/fixes, but for this one the 
removed and added sections don't match at all.


I think your shuffling around the memory blocks (rightfully so) and the 
fact my patches already had some dts-v1 lines removed might have been a 
factor in that?


Have sent in a v4 for the remaining two patches :-)

Thank you

Stijn



Please fix/rebase (and also changed the DTSI include in the DTS).

Best

Adrian



 Signed-off-by: Stijn Segers 
 ---
  .../realtek/dts/rtl8380_zyxel_gs1900-10hp.dts | 190 
+-

  .../realtek/dts/rtl8380_zyxel_gs1900.dtsi | 147 ++
  2 files changed, 151 insertions(+), 186 deletions(-)  create mode 
100644

 target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi

 diff --git a/target/linux/realtek/dts/rtl8380_zyxel_gs1900-10hp.dts
 b/target/linux/realtek/dts/rtl8380_zyxel_gs1900-10hp.dts
 index 0fb78926d9..5c53385020 100644
 --- a/target/linux/realtek/dts/rtl8380_zyxel_gs1900-10hp.dts
 +++ b/target/linux/realtek/dts/rtl8380_zyxel_gs1900-10hp.dts
 @@ -1,5 +1,4 @@
  // SPDX-License-Identifier: GPL-2.0-or-later -/dts-v1/;

  #include "rtl838x.dtsi"

 @@ -10,11 +9,6 @@
compatible = "zyxel,gs1900-10hp", "realtek,rtl838x-soc";
model = "ZyXEL GS1900-10HP Switch";

 -  memory@0 {
 -  device_type = "memory";
 -  reg = <0x0 0x800>;
 -  };
 -
aliases {
led-boot = _sys;
led-failsafe = _sys;
 @@ -96,192 +90,16 @@

  };

 - {
 -  status = "okay";
 -  flash@0 {
 -  compatible = "jedec,spi-nor";
 -  reg = <0>;
 -  spi-max-frequency = <1000>;
 -
 -  partitions {
 -  compatible = "fixed-partitions";
 -  #address-cells = <1>;
 -  #size-cells = <1>;
 -
 -  partition@0 {
 -  label = "u-boot";
 -  reg = <0x0 0x4>;
 -  read-only;
 -  };
 -  partition@4 {
 -  label = "u-boot-env";
 -  reg = <0x4 0x1>;
 -  read-only;
 -  };
 -  partition@5 {
 -  label = "u-boot-env2";
 -  reg = <0x5 0x1>;
 -  read-only;
 -  };
 -  partition@6 {
 -  label = "jffs";
 -  reg = <0x6 0x10>;
 -  };
 -  partition@16 {
 -  label = "jffs2";
 -  reg = <0x16 0x10>;
 -  };
 -  partition@b26 {
 -  label = "firmware";
 -  reg = <0x26 0x6d>;
 -  compatible = "denx,uimage";
 -  };
 -  partition@93 {
 -  label = "runtime2";
 -  reg = <0x93 0x6d>;
 -  };
 -  };
 -  };
 -};
 -
   {
mdio: mdio-bus {
 -  compatible = "realtek,rtl838x-mdio";
 -  regmap = <>;
 -  #address-cells = <1>;
 -  #size-cells = <0>;
 -
 -  /* Internal phy */
 -  phy8: ethernet-phy@8 {
 -  reg = <8>;
 -  compatible = "ethernet-phy-ieee802.3-c22";
 -  };
 -  phy9: ethernet-phy@9 {
 -  reg = <9>;
 -  compatible = "ethernet-phy-ieee802.3-c22";
 -  };
 -  phy10: ethernet-phy@10 {
 -  reg = <10>;
 -  compatible = "ethernet-phy-ieee802.3-c22";
 -  };
 -  phy11: ethernet-phy@11 {
 -  reg = <11>;
 -  compatible = "ethernet-phy-ieee802.3-c22";
 -  };
 -  phy12: ethernet-phy@12 {
 -  reg = <12>;
 -  compatible = "ethernet-phy-ieee802.3-c22";
 -  };
 -  phy13: ethernet-phy@13 {
 -  

[PATCH 2/2] realtek: add support for ZyXEL GS1900-8HP v1 and v2

2021-01-07 Thread Stijn Segers
The ZyXEL GS1900-8HP is an 8 port gigabit switch with PoE+ support.
There are two versions on the market (v1 & v2) which share similar
specs (same flash size and flash layout, same RAM size, same PoE+ power
envelope) but have a different case and board layout that they each
share with other GS1900 siblings.

The v1 seems to share its PCB and case with non-PoE GS1900-8; as such,
adding support for the GS1900-8 would probably be trivial. The v2 seems
to share its casing and platform with its already supported bigger
brother, the GS1900-10HP - its board looks the same, except for two
holes where the GS1900-10 has its SFP ports.

Like their 10 port sibling, both devices have a dual firmware layout.
Both GS1900-8HP boards have the same 70W PoE+ power budget. In order to
manipulate the PoE+, one needs the rtl83xx-poe package [1].

After careful consideration it was decided to go with separate images
for each version.

Specifications (v1)
---
* SoC:   Realtek RTL8380M 500 MHz MIPS 4KEc
* Flash: Macronix MX25L12835F 16 MiB
* RAM:   Nanya NT5TU128M8HE-AC 128 MiB DDR2 SDRAM
* Ethernet:  8x 10/100/1000 Mbit
* PoE+:  Broadcom BCM59111KMLG (IEEE 802.3at-2009 compliant, 2x)
* UART:  1 serial header with populated standard pin connector on the
 left side of the PCB, towards the bottom. Pins are labeled:
 + VCC (3.3V)
 + TX
 + RX
 + GND

Specifications (v2)
---
* SoC:   Realtek RTL8380M 500 MHz MIPS 4KEc
* Flash: Macronix MX25L12835F 16 MiB
* RAM:   Samsung K4B1G0846G 128 MiB DDR3 SDRAM
* Ethernet:  8x 10/100/1000 Mbit
* PoE+:  Broadcom BCM59121B0KMLG (IEEE 802.3at-2009 compliant)
* UART:  1 angled serial header with populated standard pin connector
 accessible from outside through the ventilation slits on the
 side. Pins from top to bottom are clearly marked on the PCB:
 + VCC (3.3V)
 + TX
 + RX
 + GND

Serial connection parameters for both devices: 115200 8N1.

Installation

Instructions are identical to those for the GS1900-10HP and apply both
to the GS1900-8HP v1 and v2 as well.

* Configure your client with a static 192.168.1.x IP (e.g. 192.168.1.10).
* Set up a TFTP server on your client and make it serve the initramfs
  image.
* Connect serial, power up the switch, interrupt U-boot by hitting the
  space bar, and enable the network:
  # rtk network on
* Since the GS1900-10HP is a dual-partition device, you want to keep the
  OEM firmware on the backup partition for the time being. OpenWrt can
  only boot off the first partition anyway (hardcoded in the DTS). To
  make sure we are manipulating the first partition, issue the following
  commands:
  # setsys bootpartition 0
  # savesys
* Download the image onto the device and boot from it:
  # tftpboot 0x84f0 
192.168.1.10:openwrt-realtek-generic-zyxel_gs1900-8hp-v{1,2}-initramfs-kernel.bin
  # bootm
* Once OpenWrt has booted, scp the sysupgrade image to /tmp and flash it:
  # sysupgrade 
/tmp//tmp/openwrt-realtek-generic-zyxel_gs1900-8hp-v{1,2}-squashfs-sysupgrade.bin

Signed-off-by: Stijn Segers 
---
 .../realtek/base-files/etc/board.d/02_network |  6 +
 .../dts/rtl8380_zyxel_gs1900-8hp-v1.dts   |  8 +++
 .../dts/rtl8380_zyxel_gs1900-8hp-v2.dts   |  8 +++
 target/linux/realtek/image/Makefile   | 24 ++-
 4 files changed, 45 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/realtek/dts/rtl8380_zyxel_gs1900-8hp-v1.dts
 create mode 100644 target/linux/realtek/dts/rtl8380_zyxel_gs1900-8hp-v2.dts

diff --git a/target/linux/realtek/base-files/etc/board.d/02_network 
b/target/linux/realtek/base-files/etc/board.d/02_network
index 84fefa536d..cc8beb1c95 100755
--- a/target/linux/realtek/base-files/etc/board.d/02_network
+++ b/target/linux/realtek/base-files/etc/board.d/02_network
@@ -52,6 +52,12 @@ case $board in
 netgear,gs110tpp-v1)
ucidef_set_poe 130 "$lan_list"
;;
+zyxel,gs1900-8hp-v1)
+   ucidef_set_poe 70 "$lan_list"
+   ;;
+zyxel,gs1900-8hp-v2)
+   ucidef_set_poe 70 "$lan_list"
+   ;;
 zyxel,gs1900-10hp)
ucidef_set_poe 77 "$lan_list"
;;
diff --git a/target/linux/realtek/dts/rtl8380_zyxel_gs1900-8hp-v1.dts 
b/target/linux/realtek/dts/rtl8380_zyxel_gs1900-8hp-v1.dts
new file mode 100644
index 00..0d9b7c97c0
--- /dev/null
+++ b/target/linux/realtek/dts/rtl8380_zyxel_gs1900-8hp-v1.dts
@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "rtl8380_zyxel_gs1900.dtsi"
+
+/ {
+   compatible = "zyxel,gs1900-8hp-v1", "realtek,rtl838x-soc";
+   model = "ZyXEL GS1900-8HP v1 Switch";
+};
diff --git a/target/linux/realtek/dts/rtl8380_zyxel_gs1900-8hp-v2.dts 
b/target/linux/realtek/dts/rtl8380_zyxel_gs1900-8hp-v2.dts
new file mode 100644
index 00..cdc4aed6d1
--- /dev/null
+++ 

[PATCH v2 3/3] uboot-envtools: use `commitcount` for release

2021-01-07 Thread Paul Spooren
Use `commitcount` function rather than manually setting a PKG_RELEASE.

Signed-off-by: Paul Spooren 
---
 package/boot/uboot-envtools/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/boot/uboot-envtools/Makefile 
b/package/boot/uboot-envtools/Makefile
index 8bc2c00ba5..fef3008f3b 100644
--- a/package/boot/uboot-envtools/Makefile
+++ b/package/boot/uboot-envtools/Makefile
@@ -10,7 +10,6 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=uboot-envtools
 PKG_DISTNAME:=u-boot
 PKG_VERSION:=2020.04
-PKG_RELEASE:=17
 
 PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:= \
@@ -38,6 +37,7 @@ define Package/uboot-envtools
   SUBMENU:=Boot Loaders
   TITLE:=read/modify U-Boot bootloader environment
   URL:=http://www.denx.de/wiki/U-Boot
+  VERSION:=$(PKG_VERSION)-$(strip $(call commitcount))
 endef
 
 define Package/uboot-envtools/description
-- 
2.29.2


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


[PATCH v2 2/3] base-files: replace PKG_RELEASE with commitcount

2021-01-07 Thread Paul Spooren
The newly added `commitcount` function does automatic versioning based
on the number of Git commits of a package. Replace *tedious to bump* and
*merge conflict causing* `PKG_RELEASE` and replace it with `commitcount`.

Signed-off-by: Paul Spooren 
---
 package/base-files/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/package/base-files/Makefile b/package/base-files/Makefile
index 8d40eb0e49..52cf8a2b7b 100644
--- a/package/base-files/Makefile
+++ b/package/base-files/Makefile
@@ -12,7 +12,6 @@ include $(INCLUDE_DIR)/version.mk
 include $(INCLUDE_DIR)/feeds.mk
 
 PKG_NAME:=base-files
-PKG_RELEASE:=245
 PKG_FLAGS:=nonshared
 
 PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
@@ -40,7 +39,7 @@ define Package/base-files
   DEPENDS:=+netifd +libc +jsonfilter +SIGNED_PACKAGES:usign 
+SIGNED_PACKAGES:openwrt-keyring +NAND_SUPPORT:ubi-utils +fstools +fwtool
   TITLE:=Base filesystem for OpenWrt
   URL:=http://openwrt.org/
-  VERSION:=$(PKG_RELEASE)-$(REVISION)
+  VERSION:=$(call commitcount)-$(REVISION)
 endef
 
 define Package/base-files/conffiles
-- 
2.29.2


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


[PATCH v2 1/3] rules: add commitcount function

2021-01-07 Thread Paul Spooren
`commitcount` returns the number of commits affecting the current
folder. The newly added function can be used for packages that do not
follow a traditional versioning schema, most prominent `base-files`
which requires tedious `PKG_RELEASE` bumps.

Below a naming example:

base-files_1399-r15385+75-c5d033a34d_x86_64.ipk

In cases where no Git system is used, the timestamp of SOURCE_DATE_EPOCH
is used instead, allowing reproducible builds.

base-files_210107.30634-r1538581-c5d033a34d_x86_64.ipk

Signed-off-by: Paul Spooren 
---
v2:
- reproducible versions via SOURCE_DATE_EPOCH
- wrap function in ifndef DUMP

 rules.mk | 24 
 1 file changed, 24 insertions(+)

diff --git a/rules.mk b/rules.mk
index f79340b124..eeaadfecea 100644
--- a/rules.mk
+++ b/rules.mk
@@ -408,6 +408,30 @@ endef
 # file extension
 ext=$(word $(words $(subst ., ,$(1))),$(subst ., ,$(1)))
 
+
+ifndef DUMP
+define commitcount
+   $(shell \
+   if git log -1 >/dev/null 2>/dev/null; then \
+   set -- $$(git rev-list --count HEAD .); \
+   if [ -n "$$1" ]; then
+   echo "$$1"; \
+   else \
+   echo "unknown"; \
+   fi; \
+   else \
+   secs="$$(($(SOURCE_DATE_EPOCH) % 86400))"; \
+   date="$$(date --utc --date="@$(SOURCE_DATE_EPOCH)" 
"+%y%m%d")"; \
+   printf '%s.%05d' "$$date" "$$secs"; \
+   fi \
+   )
+endef
+else
+define commitcount
+   1
+endef
+endif
+
 all:
 FORCE: ;
 .PHONY: FORCE
-- 
2.29.2


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


RE: [PATCH 4/5] realtek: introduce shared DTSI for GS1900-HP series

2021-01-07 Thread Adrian Schmutzler
Hi,

> -Original Message-
> From: openwrt-devel [mailto:openwrt-devel-boun...@lists.openwrt.org]
> On Behalf Of Stijn Segers
> Sent: Mittwoch, 6. Januar 2021 22:45
> To: openwrt-devel@lists.openwrt.org
> Subject: [PATCH 4/5] realtek: introduce shared DTSI for GS1900-HP series
> 
> The ZyXEL GS1900-8HP v1, v2 and GS1900-10HP are all built on a similar
> Realtek RTL8380M platform. Create a common DTSI in preparation for
> GS1900-8HP support, and switch to the macros defined in rtl838x.dtsi.

I've merged 1 to 3 with minor adjustments/fixes, but for this one the removed 
and added sections don't match at all.

Please fix/rebase (and also changed the DTSI include in the DTS).

Best

Adrian

> 
> Signed-off-by: Stijn Segers 
> ---
>  .../realtek/dts/rtl8380_zyxel_gs1900-10hp.dts | 190 +-
>  .../realtek/dts/rtl8380_zyxel_gs1900.dtsi | 147 ++
>  2 files changed, 151 insertions(+), 186 deletions(-)  create mode 100644
> target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi
> 
> diff --git a/target/linux/realtek/dts/rtl8380_zyxel_gs1900-10hp.dts
> b/target/linux/realtek/dts/rtl8380_zyxel_gs1900-10hp.dts
> index 0fb78926d9..5c53385020 100644
> --- a/target/linux/realtek/dts/rtl8380_zyxel_gs1900-10hp.dts
> +++ b/target/linux/realtek/dts/rtl8380_zyxel_gs1900-10hp.dts
> @@ -1,5 +1,4 @@
>  // SPDX-License-Identifier: GPL-2.0-or-later -/dts-v1/;
> 
>  #include "rtl838x.dtsi"
> 
> @@ -10,11 +9,6 @@
>   compatible = "zyxel,gs1900-10hp", "realtek,rtl838x-soc";
>   model = "ZyXEL GS1900-10HP Switch";
> 
> - memory@0 {
> - device_type = "memory";
> - reg = <0x0 0x800>;
> - };
> -
>   aliases {
>   led-boot = _sys;
>   led-failsafe = _sys;
> @@ -96,192 +90,16 @@
> 
>  };
> 
> - {
> - status = "okay";
> - flash@0 {
> - compatible = "jedec,spi-nor";
> - reg = <0>;
> - spi-max-frequency = <1000>;
> -
> - partitions {
> - compatible = "fixed-partitions";
> - #address-cells = <1>;
> - #size-cells = <1>;
> -
> - partition@0 {
> - label = "u-boot";
> - reg = <0x0 0x4>;
> - read-only;
> - };
> - partition@4 {
> - label = "u-boot-env";
> - reg = <0x4 0x1>;
> - read-only;
> - };
> - partition@5 {
> - label = "u-boot-env2";
> - reg = <0x5 0x1>;
> - read-only;
> - };
> - partition@6 {
> - label = "jffs";
> - reg = <0x6 0x10>;
> - };
> - partition@16 {
> - label = "jffs2";
> - reg = <0x16 0x10>;
> - };
> - partition@b26 {
> - label = "firmware";
> - reg = <0x26 0x6d>;
> - compatible = "denx,uimage";
> - };
> - partition@93 {
> - label = "runtime2";
> - reg = <0x93 0x6d>;
> - };
> - };
> - };
> -};
> -
>   {
>   mdio: mdio-bus {
> - compatible = "realtek,rtl838x-mdio";
> - regmap = <>;
> - #address-cells = <1>;
> - #size-cells = <0>;
> -
> - /* Internal phy */
> - phy8: ethernet-phy@8 {
> - reg = <8>;
> - compatible = "ethernet-phy-ieee802.3-c22";
> - };
> - phy9: ethernet-phy@9 {
> - reg = <9>;
> - compatible = "ethernet-phy-ieee802.3-c22";
> - };
> - phy10: ethernet-phy@10 {
> - reg = <10>;
> - compatible = "ethernet-phy-ieee802.3-c22";
> - };
> - phy11: ethernet-phy@11 {
> - reg = <11>;
> - compatible = "ethernet-phy-ieee802.3-c22";
> - };
> - phy12: ethernet-phy@12 {
> - reg = <12>;
> - compatible = "ethernet-phy-ieee802.3-c22";
> - };
> - phy13: ethernet-phy@13 {
> - reg = <13>;
> - compatible = "ethernet-phy-ieee802.3-c22";
> - };
> - phy14: ethernet-phy@14 {
> - reg = <14>;
> - compatible = "ethernet-phy-ieee802.3-c22";
> - };
> - 

Upgrading Mikrotik RB922 (19.07 ar71xx -> 20.x ath79)

2021-01-07 Thread Koen Vandeputte

Hi all,

I'm playing around with Mikrotik stuff to test flashing from 19.07 
ar71xx towards master using sysupgrade.


Trying this natively using sysupgrade shows Invalid firmware image:


dd 
'if=/tmp/openwrt-ath79-mikrotik-mikrotik_routerboard-922uags-5hpacd-squashfs-sysupgrade.bin' 
'skip=0' 'bs=4' 'count=1'

+ identify_magic 73797375
+ local 'magic=73797375'
+ echo 'unknown 73797375'
+ local 'file_type=unknown 73797375'
+ '[' 0 '=' 0 -a 'unknown 73797375' '!=' ubi -a 'unknown 73797375' '!=' 
ubifs ]

+ echo 'Invalid sysupgrade file.'
Invalid sysupgrade file.

Looks like it trips over "file_type"

Anyone any idea how to fix this properly?

Thanks,

Koen


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


Re: [PATCH 1/3] rules: add commitcount function

2021-01-07 Thread Jo-Philipp Wich
Hi,

I think this change will introduce massive overhead during the DUMP phase of
the buildroot when scanning package metadata.

You should wrap the logic into an `ifneq ($(DUMP),1)` or similar and simply
return a static placeholder value if DUMP==1

~ Jo



signature.asc
Description: OpenPGP digital signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH 2/3] base-files: replace PKG_RELEASE with commitcount

2021-01-07 Thread Paul Spooren
The newly added `commitcount` function does automatic versioning based
on the number of Git commits of a package. Replace *tedious to bump* and
*merge conflict causing* `PKG_RELEASE` and replace it with `commitcount`.

Signed-off-by: Paul Spooren 
---
 package/base-files/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/package/base-files/Makefile b/package/base-files/Makefile
index 8d40eb0e49..52cf8a2b7b 100644
--- a/package/base-files/Makefile
+++ b/package/base-files/Makefile
@@ -12,7 +12,6 @@ include $(INCLUDE_DIR)/version.mk
 include $(INCLUDE_DIR)/feeds.mk
 
 PKG_NAME:=base-files
-PKG_RELEASE:=245
 PKG_FLAGS:=nonshared
 
 PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
@@ -40,7 +39,7 @@ define Package/base-files
   DEPENDS:=+netifd +libc +jsonfilter +SIGNED_PACKAGES:usign 
+SIGNED_PACKAGES:openwrt-keyring +NAND_SUPPORT:ubi-utils +fstools +fwtool
   TITLE:=Base filesystem for OpenWrt
   URL:=http://openwrt.org/
-  VERSION:=$(PKG_RELEASE)-$(REVISION)
+  VERSION:=$(call commitcount)-$(REVISION)
 endef
 
 define Package/base-files/conffiles
-- 
2.29.2


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


[PATCH 3/3] uboot-envtools: use `commitcount` for release

2021-01-07 Thread Paul Spooren
Use `commitcount` function rather than manually setting a PKG_RELEASE.

Signed-off-by: Paul Spooren 
---
 package/boot/uboot-envtools/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/boot/uboot-envtools/Makefile 
b/package/boot/uboot-envtools/Makefile
index 8bc2c00ba5..fef3008f3b 100644
--- a/package/boot/uboot-envtools/Makefile
+++ b/package/boot/uboot-envtools/Makefile
@@ -10,7 +10,6 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=uboot-envtools
 PKG_DISTNAME:=u-boot
 PKG_VERSION:=2020.04
-PKG_RELEASE:=17
 
 PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:= \
@@ -38,6 +37,7 @@ define Package/uboot-envtools
   SUBMENU:=Boot Loaders
   TITLE:=read/modify U-Boot bootloader environment
   URL:=http://www.denx.de/wiki/U-Boot
+  VERSION:=$(PKG_VERSION)-$(strip $(call commitcount))
 endef
 
 define Package/uboot-envtools/description
-- 
2.29.2


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


[PATCH 1/3] rules: add commitcount function

2021-01-07 Thread Paul Spooren
`commitcount` returns the number of commits affecting the current
folder. The newly added function can be used for packages that do not
follow a traditional versioning schema, most prominent `base-files`
which requires tedious `PKG_RELEASE` bumps.

Below a naming example:

base-files_1399-r15385+75-c5d033a34d_x86_64.ipk

In cases where no Git system is used, a folder timestamp is used in
combination with the hardcoded $(REVISION) variable (set in releases).

base-files_210107.30634-r1538581-c5d033a34d_x86_64.ipk

Signed-off-by: Paul Spooren 
---
 rules.mk | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/rules.mk b/rules.mk
index f79340b124..8ccecb89d5 100644
--- a/rules.mk
+++ b/rules.mk
@@ -408,6 +408,28 @@ endef
 # file extension
 ext=$(word $(words $(subst ., ,$(1))),$(subst ., ,$(1)))
 
+define commitcount
+   $(shell \
+   if git log -1 >/dev/null 2>/dev/null; then \
+   set -- $$(git rev-list --count HEAD .); \
+   if [ -n "$$1" ]; then
+   echo "$$1"; \
+   else \
+   echo "unknown"; \
+   fi; \
+   else \
+   ts=$$(find . -type f -printf '%T@\n' 2>/dev/null | sort 
-rn | head -n1 | cut -d. -f1); \
+   if [ -n "$$ts" ]; then \
+   secs="$$(($$ts % 86400))"; \
+   date="$$(date --utc --date="@$$ts" "+%y%m%d")"; 
\
+   printf '%s.%05d' "$$date" "$$secs"; \
+   else \
+   echo "unknown"; \
+   fi; \
+   fi \
+   )
+endef
+
 all:
 FORCE: ;
 .PHONY: FORCE
-- 
2.29.2


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