[PATCH 0/2] determineable package name with ABIVersions

2021-03-07 Thread Paul Spooren
Hi, this set contains two patches which solve the same issues in two
different ways, only one should be merged.

ABIVersions of packages are simply attached to the package name, so
package `foobar` with ABIVersion 32 becomes `foobar32`, literally the
name to install via opkg.

This information is stored on-device in /usr/lib/opkg/status.

For a running device it is currently not possible to determine a list
packages which could be used for later releases, as the ABIVersions
likely changed between releases and the package no longer exists as
`foobar32`, but rather `foobar33`.

A way to determine the so called package *SourceName* is required.

Either the `SourceName` should be stored in the Packages index and
thereby end up on the device or the ABIVersion should be stored, because
*PackageName* - *ABIVersion* = *SourceName*.

Storing SourceName for every package increases storage and is redundant
as not all packages use a ABIVersion, meaning *PackageName* and
*SourceName* are the same.

Offering the *ABIVersion* requires more logic for whatever parses the
file, in this case specifically `ubus call rpc-sys packagelist`.

I'm in favor of adding the ABIVersion again and extend the logic of
rpcd/sys.c.

Paul Spooren (2):
  package: store SourceName in Packages index
  include: store ABIVersion in Packages index

 include/package-ipkg.mk | 1 +
 package/Makefile| 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

-- 
2.30.1


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


[PATCH 2/2] include: store ABIVersion in Packages index

2021-03-07 Thread Paul Spooren
With the existence of ABI versions there is no clean way to determine
the package name without an attached ABI version. The Packages index is
stored on device to know what packages are installed.

The ABIVersion was recently removed in c921650382 "build: drop ABI
version from metadata", while ABI versions still exists. This becomes a
problem if a user tries to export installed packages via `ubus call
rpcd-sys packagelist` which would return package names including the ABI
version. Trying to find these packages in a later release with changes
ABI version is impossible.

This commits adds the `ABIVersion` field again. Knowing both the
combined (SourceName + ABIVersion) and the `ABIVersion` it is possible
to calculate the package `SourceName` without storing it in the
on-device package list.

Signed-off-by: Paul Spooren 
---
 include/package-ipkg.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk
index 082196ccf8..c536999d02 100644
--- a/include/package-ipkg.mk
+++ b/include/package-ipkg.mk
@@ -184,6 +184,7 @@ $$(call addfield,Depends,$$(Package/$(1)/DEPENDS)
 )$$(call addfield,Section,$(SECTION)
 )$$(call addfield,Require-User,$(USERID)
 )$$(call addfield,SourceDateEpoch,$(PKG_SOURCE_DATE_EPOCH)
+)$$(if $$(ABIV_$(1)),ABIVersion: $$(ABIV_$(1))
 )$(if $(PKG_CPE_ID),CPE-ID: $(PKG_CPE_ID)
 )$(if $(filter hold,$(PKG_FLAGS)),Status: unknown hold not-installed
 )$(if $(filter essential,$(PKG_FLAGS)),Essential: yes
-- 
2.30.1


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


[PATCH 1/2] package: store SourceName in Packages index

2021-03-07 Thread Paul Spooren
With the existence of ABI versions there is no clean way to determine
the package name without an attached ABI version. The Packages index is
stored on device to know what packages are installed.

As SourceName is filtered out the real package names are unknown to a
running device. This becomes a problem if a user tries toexport
installed packages via `ubus call rpcd-sys packagelist` which would
return package names including the ABI version. Trying to find these
packages in a later release with changes ABI version is impossible.

This patch stops filtering out the SourceName so it is available on
device.

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

diff --git a/package/Makefile b/package/Makefile
index a89a6068fa..802100838c 100644
--- a/package/Makefile
+++ b/package/Makefile
@@ -87,7 +87,7 @@ $(curdir)/index: FORCE
cd $$d || continue; \
$(SCRIPT_DIR)/apk-make-index.sh . 2>&1; \
$(SCRIPT_DIR)/ipkg-make-index.sh . 2>&1 > Packages.manifest; \
-   grep -vE 
'^(Maintainer|LicenseFiles|Source|SourceName|Require|SourceDateEpoch)' 
Packages.manifest > Packages; \
+   grep -vE 
'^(Maintainer|LicenseFiles|Source:|Require|SourceDateEpoch)' Packages.manifest 
> Packages; \
case "$$(((64 + $$(stat -L -c%s Packages)) % 128))" in 110|111) 
\
$(call ERROR_MESSAGE,WARNING: Applying padding in 
$$d/Packages to workaround usign SHA-512 bug!); \
{ echo ""; echo ""; } >> Packages;; \
-- 
2.30.1


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


[PATCH] ramips: move spi-nor-add-gd25q512 patch to generic

2021-03-07 Thread Ilya Lipnitskiy
A SPI NOR flash should not be target-specific, so move it to generic in
case another platform needs to use it.

Signed-off-by: Ilya Lipnitskiy 
---
 .../pending-5.10/483-mtd-spi-nor-add-gd25q512.patch}  | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename target/linux/{ramips/patches-5.10/420-spi-nor-add-gd25q512.patch => 
generic/pending-5.10/483-mtd-spi-nor-add-gd25q512.patch} (100%)

diff --git a/target/linux/ramips/patches-5.10/420-spi-nor-add-gd25q512.patch 
b/target/linux/generic/pending-5.10/483-mtd-spi-nor-add-gd25q512.patch
similarity index 100%
rename from target/linux/ramips/patches-5.10/420-spi-nor-add-gd25q512.patch
rename to target/linux/generic/pending-5.10/483-mtd-spi-nor-add-gd25q512.patch
-- 
2.30.1


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


Re: [PATCH procd] inittab: detect active console from kernel if no console= specified

2021-03-07 Thread Daniel Golle
Hi Mathew,


On Fri, Mar 05, 2021 at 12:54:15AM +, Mathew McBride wrote:
> The default serial console can be set in the device tree
> using the linux,stdout-path parameter (or equivalent from ACPI).
> 
> This is important for universal booting (EFI/EBBR) on ARM platforms
> where the default console can be different (e.g ttyS0 vs ttyAMA0).

Thank you for your patch, this was on my todo-list as well.


Cheers


Daniel

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


[PATCH] ramips: mt7621: remove redundant lpj re-calibration

2021-03-07 Thread Ilya Lipnitskiy
When the patch was originally introduced [0], it claimed that on mt7621,
CPU core 1 came up with a bad BogoMIPS value because the clock needed
time to stabilize. That is not the case today, at least on my Ubiquity
EdgeRouter X device. As evident from messages below, the LPJ value is
already correct after the original delay loop calibration.

Original calibration:
  [0.033728] Calibrating delay loop... 583.68 BogoMIPS (lpj=1167360)

Redundant re-calibration (this patch removes it):
  [0.788770] 4 CPUs re-calibrate udelay(lpj = 1167360)

So, remove the re-calibration patch to avoid extra busy looping to come
up with the exact same lpj value.

This patch also disables CONFIG_GENERIC_CLOCKEVENTS_BROADCAST as it does
not seem necessary for mt7621 - ER-X boots and functions correctly
without that symbol and no other ramips targets enable it.

This change is only for Linux 5.10, it does not affect Linux 5.4 builds.

Lastly, refresh existing patches to account for the removal of the
re-calibration logic.

[0]: 6acb53c52 ("ralink: fix rcu_sched stalls on mt7621")

Signed-off-by: Ilya Lipnitskiy 
Cc: John Crispin 
---
 target/linux/ramips/mt7621/config-5.10|  1 -
 .../patches-5.10/321-mt7621-timer.patch   | 87 ---
 .../322-mt7621-fix-cpu-clk-add-clkdev.patch   | 10 +--
 .../323-mt7621-memory-detect.patch| 10 +--
 4 files changed, 10 insertions(+), 98 deletions(-)
 delete mode 100644 target/linux/ramips/patches-5.10/321-mt7621-timer.patch

diff --git a/target/linux/ramips/mt7621/config-5.10 
b/target/linux/ramips/mt7621/config-5.10
index 430ea9513c..1f319da5aa 100644
--- a/target/linux/ramips/mt7621/config-5.10
+++ b/target/linux/ramips/mt7621/config-5.10
@@ -61,7 +61,6 @@ CONFIG_FIXED_PHY=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_GENERIC_ATOMIC64=y
 CONFIG_GENERIC_CLOCKEVENTS=y
-CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
 CONFIG_GENERIC_CMOS_UPDATE=y
 CONFIG_GENERIC_CPU_AUTOPROBE=y
 CONFIG_GENERIC_GETTIMEOFDAY=y
diff --git a/target/linux/ramips/patches-5.10/321-mt7621-timer.patch 
b/target/linux/ramips/patches-5.10/321-mt7621-timer.patch
deleted file mode 100644
index 91e14ad63b..00
--- a/target/linux/ramips/patches-5.10/321-mt7621-timer.patch
+++ /dev/null
@@ -1,87 +0,0 @@
 a/arch/mips/ralink/mt7621.c
-+++ b/arch/mips/ralink/mt7621.c
-@@ -9,6 +9,7 @@
- #include 
- #include 
- #include 
-+#include 
- 
- #include 
- #include 
-@@ -16,6 +17,7 @@
- #include 
- #include 
- #include 
-+#include 
- 
- #include 
- 
-@@ -161,6 +163,58 @@ bool plat_cpu_core_present(int core)
-   return true;
- }
- 
-+#define LPS_PREC 8
-+/*
-+*  Re-calibration lpj(loop-per-jiffy).
-+*  (derived from kernel/calibrate.c)
-+*/
-+static int udelay_recal(void)
-+{
-+  unsigned int i, lpj = 0;
-+  unsigned long ticks, loopbit;
-+  int lps_precision = LPS_PREC;
-+
-+  lpj = (1<<12);
-+
-+  while ((lpj <<= 1) != 0) {
-+  /* wait for "start of" clock tick */
-+  ticks = jiffies;
-+  while (ticks == jiffies)
-+  /* nothing */;
-+
-+  /* Go .. */
-+  ticks = jiffies;
-+  __delay(lpj);
-+  ticks = jiffies - ticks;
-+  if (ticks)
-+  break;
-+  }
-+
-+  /*
-+   * Do a binary approximation to get lpj set to
-+   * equal one clock (up to lps_precision bits)
-+   */
-+  lpj >>= 1;
-+  loopbit = lpj;
-+  while (lps_precision-- && (loopbit >>= 1)) {
-+  lpj |= loopbit;
-+  ticks = jiffies;
-+  while (ticks == jiffies)
-+  /* nothing */;
-+  ticks = jiffies;
-+  __delay(lpj);
-+  if (jiffies != ticks)   /* longer than 1 tick */
-+  lpj &= ~loopbit;
-+  }
-+  printk(KERN_INFO "%d CPUs re-calibrate udelay(lpj = %d)\n", NR_CPUS, 
lpj);
-+
-+  for(i=0; i< NR_CPUS; i++)
-+  cpu_data[i].udelay_val = lpj;
-+
-+  return 0;
-+}
-+device_initcall(udelay_recal);
-+
- void prom_soc_init(struct ralink_soc_info *soc_info)
- {
-   void __iomem *sysc = (void __iomem *) KSEG1ADDR(MT7621_SYSC_BASE);
 a/arch/mips/ralink/Kconfig
-+++ b/arch/mips/ralink/Kconfig
-@@ -63,6 +63,7 @@ choice
-   select HAVE_PCI if PCI_MT7621
-   select SOC_BUS
-   select WEAK_REORDERING_BEYOND_LLSC
-+  select GENERIC_CLOCKEVENTS_BROADCAST
- endchoice
- 
- choice
diff --git 
a/target/linux/ramips/patches-5.10/322-mt7621-fix-cpu-clk-add-clkdev.patch 
b/target/linux/ramips/patches-5.10/322-mt7621-fix-cpu-clk-add-clkdev.patch
index 723c628790..be5fee54b2 100644
--- a/target/linux/ramips/patches-5.10/322-mt7621-fix-cpu-clk-add-clkdev.patch
+++ b/target/linux/ramips/patches-5.10/322-mt7621-fix-cpu-clk-add-clkdev.patch
@@ -36,10 +36,10 @@
  #define MT7621_DDR2_SIZE_MAX  256
 --- a/arch/mips/ralink/mt7621.c
 +++ b/arch/mips/ralink/mt7621.c
-@@ -10,6 +10,10 @@
+@@ -9,6 

[sdwalker/sdwalker.github.io] e78484: This week's update

2021-03-07 Thread Stephen Walker 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 ---
  Branch: refs/heads/master
  Home:   https://github.com/sdwalker/sdwalker.github.io
  Commit: e78484cfb3e6c7c9ed447a70222a63f02392533f
  
https://github.com/sdwalker/sdwalker.github.io/commit/e78484cfb3e6c7c9ed447a70222a63f02392533f
  Author: Stephen Walker 
  Date:   2021-03-07 (Sun, 07 Mar 2021)

  Changed paths:
M uscan/index-18.06.html
M uscan/index-19.07.html
M uscan/index.html

  Log Message:
  ---
  This week's update



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


Re: [PATCH v1 1/2] libubox: fix test_base64.t for bash

2021-03-07 Thread Henrique de Moraes Holschuh

On 07/03/2021 07:27, Petr Štetiar wrote:

You've two options to test your changes from the CI perspective.


[...]

Can we have these very nice instructions added to a CONTRIBUTING.md file 
(or something to that effect) for libubox?


--
Henrique de Moraes Holschuh
Analista de Projetos
Centro de Estudos e Pesquisas em Tecnologias de Redes e Operações 
(Ceptro.br)

+55 11 5509-3537 R.:4023
INOC 22548*625
www.nic.br

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


Re: [PATCH v1 2/2] libubox: tests: add more blobmsg/json test cases

2021-03-07 Thread Petr Štetiar
Peter Seiderer  [2021-03-06 11:54:50]:

Hi,

nice, just a small nitpicks, these seems fine:

> +  int8_max: 127
> +  int8_min: -128

...

but the outputs bellow looks suspicious:

> +  [*] blobmsg from json:

...

> +  int8_max: 1
> +  int8_min: 1

...

> +  [*] blobmsg from json/cast_u64:

...

> +  int8_max: 1
> +  int8_min: 1

...

> +  [*] blobmsg from json/cast_s64:

...

> +  int8_max: 1
> +  int8_min: 1

Cheers,

Petr

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


Re: [PATCH v1 1/2] libubox: fix test_base64.t for bash

2021-03-07 Thread Petr Štetiar
Peter Seiderer  [2021-03-06 11:54:49]:

Hi,

thanks a lot for your nice contribution!

> My shell/bash seems to emit a more detailed failure message than
> expected. Fix this by complete avoiding the failure message using
> command substitution instead of direct command execution.

This needs more work as it fails now on my development machine and it would
fail on CI as well[1].

You've two options to test your changes from the CI perspective.

1. Directly on GitLab

 - fork the https://gitlab.com/openwrt/project/libubox project under your 
account
 - push the changes to that forked repo of yours
 - CI kicks in automatically and it will use GitLab resources to CI test the
   changes

2. Locally with Docker container

 (these are basically the steps done on GitLab CI)

 $ git clone git://git.openwrt.org/project/libubox.git; cd libubox
 $ wget -q https://gitlab.com/ynezz/openwrt-ci/raw/master/Makefile -O 
Makefile.ci
 $ make ci-prepare -f Makefile.ci
 $ docker run --rm --tty --interactive \
--volume $(pwd):/home/build/openwrt \
--env CI_ENABLE_UNIT_TESTING=1 \
registry.gitlab.com/ynezz/openwrt-ci/native-testing:latest \
make ci-native-checks -f Makefile.ci

 That `ci-native-checks` target is pipeline[2] of following checks:

  ci-native-cppcheck - build with cppcheck static analyzer
  ci-native-scan-build - build with clang's static analyzer
  ci-native-build - build with gcc 8 9 10 and clang 10

   - gcc 8/9/10 runs only compile(release,debug)/cram/shunit2 tests
   - clang 10 runs sanitizer and fuzzer tests in addition to
 compile(release,debug)/cram/shunit2 tests

1. https://gitlab.com/ynezz/openwrt-libubox/-/jobs/1078074565#L1583
2. https://gitlab.com/ynezz/openwrt-ci/#available-make-targets

Cheers,

Petr

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