[no subject]

2021-01-08 Thread Gagan Sidhu 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 ---
hi,

using the latest stuff from you guys, and i noticed the usb leds aren’t 
included in the dts.

is there an option i’m missing?

currently i have:
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
CONFIG_LEDS_GPIO=y
CONFIG_LED_TRIGGER_PHY=y
CONFIG_USB_LEDS_TRIGGER_USBPORT=y
CONFIG_LEDS_TRIGGER_GPIO=y

enabled. what could i be missing?

nice to see mt76 caught up to the proprietary driver.

Thanks,
Gagan



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


[PATCH 2/3] build/json: factor initramfs json data into profiles.json

2021-01-08 Thread Moritz Warning
The initramfs json data does not contain all fields.
E.g. no default_packages. As such, the python scripts
need to properly merge the json data of the images.

Signed-off-by: Moritz Warning 
---
 scripts/json_add_image_info.py  | 28 --
 scripts/json_overview_image_info.py | 44 ++---
 2 files changed, 46 insertions(+), 26 deletions(-)

diff --git a/scripts/json_add_image_info.py b/scripts/json_add_image_info.py
index d394cf4d1f..7d87ccd621 100755
--- a/scripts/json_add_image_info.py
+++ b/scripts/json_add_image_info.py
@@ -14,24 +14,31 @@ json_path = Path(argv[1])
 bin_dir = Path(getenv("BIN_DIR"))
 image_file = bin_dir / getenv("IMAGE_NAME")

+
 if not image_file.is_file():
-print("Skip JSON creation for non existing image ", image_file)
+print("Skip JSON creation for non existing image: {}".format(image_file))
 exit(0)


+def set(obj, key, value):
+if value != None and len(value) != 0:
+obj[key] = value
+
+
 def get_titles():
 titles = []
 for prefix in ["", "ALT0_", "ALT1_", "ALT2_"]:
 title = {}
 for var in ["vendor", "model", "variant"]:
-if getenv("DEVICE_{}{}".format(prefix, var.upper())):
-title[var] = getenv("DEVICE_{}{}".format(prefix, var.upper()))
+set(title, var, getenv("DEVICE_{}{}".format(prefix, var.upper(

 if title:
 titles.append(title)

 if not titles:
-titles.append({"title": getenv("DEVICE_TITLE")})
+title = getenv("DEVICE_TITLE")
+if title:
+titles.append({"title": title})

 return titles

@@ -47,7 +54,6 @@ image_info = {
 "source_date_epoch": getenv("SOURCE_DATE_EPOCH"),
 "profiles": {
 device_id: {
-"image_prefix": getenv("IMAGE_PREFIX"),
 "images": [
 {
 "type": getenv("IMAGE_TYPE"),
@@ -55,12 +61,16 @@ image_info = {
 "name": getenv("IMAGE_NAME"),
 "sha256": image_hash,
 }
-],
-"device_packages": getenv("DEVICE_PACKAGES").split(),
-"supported_devices": getenv("SUPPORTED_DEVICES").split(),
-"titles": get_titles(),
+]
 }
 },
 }

+profile = image_info["profiles"][device_id]
+
+set(profile, "titles", get_titles())
+set(profile, "device_packages", getenv("DEVICE_PACKAGES", "").split())
+set(profile, "supported_devices", getenv("SUPPORTED_DEVICES", "").split())
+set(profile, "image_prefix", getenv("IMAGE_PREFIX"))
+
 json_path.write_text(json.dumps(image_info, separators=(",", ":")))
diff --git a/scripts/json_overview_image_info.py 
b/scripts/json_overview_image_info.py
index ca6fbbc962..7741154f61 100755
--- a/scripts/json_overview_image_info.py
+++ b/scripts/json_overview_image_info.py
@@ -14,23 +14,33 @@ output_path = Path(argv[1])

 assert getenv("WORK_DIR"), "$WORK_DIR required"

-work_dir = Path(getenv("WORK_DIR"))
-
-output = {}
-
-for json_file in work_dir.glob("*.json"):
-image_info = json.loads(json_file.read_text())
-if not output:
-output.update(image_info)
-else:
-# get first (and only) profile in json file
-device_id = next(iter(image_info["profiles"].keys()))
-if device_id not in output["profiles"]:
-output["profiles"].update(image_info["profiles"])
-else:
-output["profiles"][device_id]["images"].append(
-image_info["profiles"][device_id]["images"][0]
-)
+# merge profiles
+def get_output(work_dir):
+output = None
+
+for json_file in work_dir.glob("*.json"):
+image_info = json.loads(json_file.read_text())
+
+# use first json file as template
+if not output:
+output = image_info
+
+# get first (and probably only) profile in json file
+for device_id, profile in image_info["profiles"].items():
+output["profiles"][device_id] = {
+**profile,
+**output["profiles"].get(device_id, {}),
+}
+output["profiles"][device_id]["images"].extend(profile["images"])
+
+# make image lists unique by name
+for device_id, profile in output["profiles"].items():
+profile["images"] = list({e["name"]: e for e in 
profile["images"]}.values())
+
+return output
+
+
+output = get_output(Path(getenv("WORK_DIR")))

 if output:
 default_packages, output["arch_packages"] = run(
--
2.30.0


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


[PATCH 3/3] build/json: preserve existing profiles.json data

2021-01-08 Thread Moritz Warning
The OpenWrt Image Builder only builds images for one device per call.
This causes the profiles.json files to only contain the data of the
last device that was build.

Signed-off-by: Moritz Warning 
---
 scripts/json_overview_image_info.py | 4 
 1 file changed, 4 insertions(+)

diff --git a/scripts/json_overview_image_info.py 
b/scripts/json_overview_image_info.py
index 7741154f61..47b5899981 100755
--- a/scripts/json_overview_image_info.py
+++ b/scripts/json_overview_image_info.py
@@ -18,6 +18,10 @@ assert getenv("WORK_DIR"), "$WORK_DIR required"
 def get_output(work_dir):
 output = None

+# preserve existing profiles.json file data
+if output_path.is_file():
+output = json.loads(output_path.read_text())
+
 for json_file in work_dir.glob("*.json"):
 image_info = json.loads(json_file.read_text())

--
2.30.0


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


[PATCH 1/3] build/json: generate json file for initramfs images

2021-01-08 Thread Moritz Warning
The initramfs images are missing from the profiles.json files.

Signed-off-by: Moritz Warning 
---
 include/image.mk | 17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/include/image.mk b/include/image.mk
index 8f46c75ffe..fc73658a9a 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -475,7 +475,8 @@ endef
 ifndef IB
 define Device/Build/initramfs
   $(call Device/Export,$(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE),$(1))
-  $$(_TARGET): $$(if 
$$(KERNEL_INITRAMFS),$(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE))
+  $$(_TARGET): $$(if 
$$(KERNEL_INITRAMFS),$(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE)) \
+ $$(if $$(CONFIG_JSON_OVERVIEW_IMAGE_INFO), 
$(BUILD_DIR)/json_info_files/$$(KERNEL_INITRAMFS_IMAGE).json,)

   $(KDIR)/$$(KERNEL_INITRAMFS_NAME):: image_prepare
   $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE): $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE)
@@ -484,6 +485,20 @@ define Device/Build/initramfs
   $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE): $(KDIR)/$$(KERNEL_INITRAMFS_NAME) 
$(CURDIR)/Makefile $$(KERNEL_DEPENDS) image_prepare
@rm -f $$@
$$(call concat_cmd,$$(KERNEL_INITRAMFS))
+
+  $(BUILD_DIR)/json_info_files/$$(KERNEL_INITRAMFS_IMAGE).json: 
$(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE)
+   @mkdir -p $$(shell dirname $$@)
+   DEVICE_ID="$(1)" \
+   BIN_DIR="$(BIN_DIR)" \
+   SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) \
+   IMAGE_NAME="$$(notdir $$^)" \
+   IMAGE_TYPE="kernel" \
+   IMAGE_FILESYSTEM="initramfs" \
+   TARGET="$(BOARD)" \
+   SUBTARGET="$(if $(SUBTARGET),$(SUBTARGET),generic)" \
+   VERSION_NUMBER="$(VERSION_NUMBER)" \
+   VERSION_CODE="$(VERSION_CODE)" \
+   $(TOPDIR)/scripts/json_add_image_info.py $$@
 endef
 endif

--
2.30.0


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


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

2021-01-08 Thread Adrian Schmutzler
Hi,

> -Original Message-
> From: Stijn Segers [mailto:f...@volatilesystems.org]
> Sent: Freitag, 8. Januar 2021 16:33
> To: Sander Vanheule 
> Cc: openwrt-devel@lists.openwrt.org; Adrian Schmutzler
> 
> Subject: Re: [PATCH v5 2/2] realtek: add support for ZyXEL GS1900-8HP v1
> and v2

I've edited the patches a little and merged to master what is consensus at the 
moment.

Feel free to submit new patches for the remaining stuff if you desire.

Best

Adrian 


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


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

2021-01-08 Thread Andrey Jr. Melnikov
Rosen Penev  wrote:
> 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.
 telnetd  .. ^^ and here?


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


[PATCH v2] octeon: rename erlite to ubnt,edgerouter-lite

2021-01-08 Thread Stijn Segers
Rename EdgeRouter Lite board_name value and prefix it with vendor abbreviation
UBNT, as done for other Ubiquiti devices in the tree. Ensure backward sysupgrade
compatibility as well.

Signed-off-by: Stijn Segers 
---
 .../octeon/base-files/lib/preinit/01_sysinfo |  2 +-
 .../octeon/base-files/lib/preinit/79_move_config |  2 +-
 .../octeon/base-files/lib/upgrade/platform.sh| 16 
 target/linux/octeon/image/Makefile   |  1 +
 4 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/target/linux/octeon/base-files/lib/preinit/01_sysinfo 
b/target/linux/octeon/base-files/lib/preinit/01_sysinfo
index d66618b0cf..3512bd7321 100644
--- a/target/linux/octeon/base-files/lib/preinit/01_sysinfo
+++ b/target/linux/octeon/base-files/lib/preinit/01_sysinfo
@@ -6,7 +6,7 @@ do_sysinfo_octeon() {
 
case "$machine" in
"UBNT_E100"*)
-   name="erlite"
+   name="ubnt,edgerouter-lite"
;;
 
"UBNT_E200"*)
diff --git a/target/linux/octeon/base-files/lib/preinit/79_move_config 
b/target/linux/octeon/base-files/lib/preinit/79_move_config
index 5a84e6f18a..07b6585470 100644
--- a/target/linux/octeon/base-files/lib/preinit/79_move_config
+++ b/target/linux/octeon/base-files/lib/preinit/79_move_config
@@ -15,7 +15,7 @@ octeon_move_config() {
. /lib/functions.sh
 
case "$(board_name)" in
-   erlite)
+   ubnt,edgerouter-lite)
move_config "/dev/sda1"
;;
itus,shield-router)
diff --git a/target/linux/octeon/base-files/lib/upgrade/platform.sh 
b/target/linux/octeon/base-files/lib/upgrade/platform.sh
index ad5baef4a1..11e598c10b 100755
--- a/target/linux/octeon/base-files/lib/upgrade/platform.sh
+++ b/target/linux/octeon/base-files/lib/upgrade/platform.sh
@@ -19,11 +19,6 @@ platform_get_rootfs() {
 
 platform_copy_config() {
case "$(board_name)" in
-   erlite)
-   mount -t vfat /dev/sda1 /mnt
-   cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
-   umount /mnt
-   ;;
itus,shield-router)
mount -t vfat /dev/mmcblk1p1 /mnt
cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
@@ -34,6 +29,11 @@ platform_copy_config() {
cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
umount /mnt
;;
+   ubnt,edgerouter-lite)
+   mount -t vfat /dev/sda1 /mnt
+   cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
+   umount /mnt
+   ;;
esac
 }
 
@@ -87,7 +87,7 @@ platform_do_upgrade() {
ubnt,edgerouter-4)
kernel=mmcblk0p1
;;
-   erlite)
+   ubnt,edgerouter-lite)
kernel=sda1
;;
itus,shield-router)
@@ -112,9 +112,9 @@ platform_check_image() {
 
case "$board" in
er | \
-   erlite | \
itus,shield-router | \
-   ubnt,edgerouter-4)
+   ubnt,edgerouter-4 | \
+   ubnt,edgerouter-lite)
local kernel_length=$(tar xf $tar_file $board_dir/kernel -O | 
wc -c 2> /dev/null)
local rootfs_length=$(tar xf $tar_file $board_dir/root -O | wc 
-c 2> /dev/null)
[ "$kernel_length" = 0 -o "$rootfs_length" = 0 ] && {
diff --git a/target/linux/octeon/image/Makefile 
b/target/linux/octeon/image/Makefile
index b91c262447..83a3274587 100644
--- a/target/linux/octeon/image/Makefile
+++ b/target/linux/octeon/image/Makefile
@@ -71,6 +71,7 @@ define Device/ubnt_edgerouter-lite
   DEVICE_MODEL := EdgeRouter Lite
   BOARD_NAME := erlite
   CMDLINE := $(ERLITE_CMDLINE)
+SUPPORTED_DEVICES := erlite ubnt,edgerouter-lite
 endef
 TARGET_DEVICES += ubnt_edgerouter-lite
 
-- 
2.20.1


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


Re: [PATCHv3 2/3] busybox: update to 1.33

2021-01-08 Thread Hannu Nyman

Rosen Penev kirjoitti 8.1.2021 klo 5.30:

...

Refresh config and patches.

Signed-off-by: Rosen Penev 
---
  v3: more complete config refresh.
  v2: refreshed config and slight rewording.



I have applied and tested the v3 patch series in my builds for 
ath79/WNDR3700v2, ipq806x/R7800 and mvebu/WRT3200ACM. Looks ok to me.


(The code is identical to the v2 patches plus the fixes that I communicated 
via the mailing list)


My only suggestion is that it might be good to document in the commit message 
the config refresh commands and the five manual edits that need to be made 
after the scripted config update. I did that with the 1.31.0 version bump, so 
Hauke was now able to quote that as example to Rosen.


The refresh scripts remove three OpenWrt logic additions, do not see one 
hidden option leading to omission of shell arithmetics and do not add quotes 
to sourced Config.in files like currently required.



Config refresh:

Refresh commands, run after busybox is first built once:

  cd package/utils/busybox/config/
  ../convert_menuconfig.pl 
../../../../build_dir/target-mips_24kc_musl/busybox-default/busybox-1.33.0

  cd ..
  ./convert_defaults.pl < 
../../../build_dir/target-mips_24kc_musl/busybox-default/busybox-1.33.0/.config 
> Config-defaults.in



Manual edits needed afterward:

* Config-defaults.in:  OpenWrt config symbol IPV6 logic applied to 
BUSYBOX_DEFAULT_FEATURE_IPV6
* Config-defaults.in:  OpenWrt configTARGET_bcm53xx logic applied to 
BUSYBOX_DEFAULT_TRUNCATE (commit 547f1ec)
* editors/Config.in: Add USE_GLIBC dependency to 
BUSYBOX_CONFIG_FEATURE_VI_REGEX_SEARCH (commit f141090)
* shell/Config.in : change at "Options common to all shells"  the symbol 
SHELL_ASH  -->  BUSYBOX_CONFIG_SHELL_ASH
   (discussion in 
http://lists.openwrt.org/pipermail/openwrt-devel/2021-January/033140.html
 Apparently our script does not see the hidden option while prepending 
config options with "BUSYBOX_CONFIG_" which leads to a missed dependency when 
the options are later evaluated.)
* Edit Config.in files by adding quotes to sourced items in config/Config.in, 
networking/Config.in and util-linux/Config.in (commit 1da014f)



In the long run it might be better to

* un-hide (BUSYBOX_CONFIG_)SHELL_ASH so that the script would fiind the 
dependency for it

* edit the refresh script to add the quotes to the sourced lines, if possible

but those two improvements can be investigated after the version bump.


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


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

2021-01-08 Thread Adrian Schmutzler
> -Original Message-
> From: openwrt-devel [mailto:openwrt-devel-boun...@lists.openwrt.org]
> On Behalf Of Stijn Segers
> Sent: Freitag, 8. Januar 2021 16:33
> To: Sander Vanheule 
> Cc: openwrt-devel@lists.openwrt.org; Adrian Schmutzler
> 
> Subject: Re: [PATCH v5 2/2] realtek: add support for ZyXEL GS1900-8HP v1
> and v2
> 
> Hi,
> 
> Op vrijdag 8 januari 2021 om 16u19 schreef Sander Vanheule
> :
> > Hi Stijn,
> >
> > On Fri, 2021-01-08 at 14:32 +0100, Stijn Segers wrote:
> >>  diff --git a/target/linux/realtek/image/Makefile
> >>  b/target/linux/realtek/image/Makefile
> >>  index 765e516a0a..39b28b6c67 100644
> >>  --- a/target/linux/realtek/image/Makefile
> >>  +++ b/target/linux/realtek/image/Makefile
> >>  @@ -65,11 +65,33 @@ define Device/netgear_gs110tpp-v1
> >>   endef
> >>   TARGET_DEVICES += netgear_gs110tpp-v1
> >>
> >>  -define Device/zyxel_gs1900-10hp
> >>  +define Device/zyxel_gs1900
> >> SOC := rtl8380
> >
> > There are also GS1900 models with a RTL8382M (24 ports), or RTL8393M
> > (48 ports) SoC, so maybe 'Device/zyxel_gs1900' is a bit too broad
> > here.
> > You've used 'rtl8380_zyxel_gs1900' for the DTSI, would something
> > similar be an option here?
> 
> Smart thinking!
> 
> Adrian, what is your take on this? Should I rename the 'base recipe' to
> rtl8380_zyxel_gs1900?

Maybe zyxel_gs1900_rtl8380?

Personally, I would not have created a shared definition for three lines at 
all, specifically if it only covers three devices eventually anyway.

Best

Adrian

> 
> We could also do something like zyxel_gs1900_lower, since it's the lower
> segment of the range?
> 
> I'm all ears :-)
> 
> Stijn
> 
> >
> > Best,
> > Sander
> >
> >
> >
> > ___
> > openwrt-devel mailing list
> > openwrt-devel@lists.openwrt.org
> > https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> 
> 
> 
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


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


Re: [PATCH 1/2] octeon: rename erlite to ubnt,erlite

2021-01-08 Thread Stijn Segers

Hi Roman,

Op vrijdag 8 januari 2021 om 19:31 schreef Roman Kuzmitskii 
:
there is no good way to differentiate between devices in runtime if 
they

  use the same platform.

custom dts would be a better solution in case of edgerouter lite since
  upstream (kernel) already have one for e100 (edgerouter lite).

could we reuse it?



I have no idea if it's possible, but I was thinking about an additional 
DTS that overrides the 'compatible' property. Haven't yet found if this 
is possible at all though, overriding that value.


Stijn



On Jan 8, 2021, at 10:11 PM, Stijn Segers  
wrote:


Hi,

Op vrijdag 8 januari 2021 om 13u29 schreef Adrian Schmutzler 
:

Hi,

-Original Message-
From: openwrt-devel 
[mailto:openwrt-devel-boun...@lists.openwrt.org]

On Behalf Of Stijn Segers
Sent: Freitag, 8. Januar 2021 11:28
To: openwrt-devel@lists.openwrt.org
Subject: [PATCH 1/2] octeon: rename erlite to ubnt,erlite
Prefix EdgeRouter Lite board_name value with vendor abbreviation 
UBNT, as
other Ubiquiti devices do, and use full name "Ubiquiti EdgeRouter 
Lite" as

model value.
If we touch this, please use ubnt,edgerouter-lite to match the 
devices in other targets.


Will do.

I always wanted to do this but never did it because I don't have 
the device to test and breaking sysupgrade was not an option for me 
here.
However, with BOARD_NAME in place I'm not sure whether sysupgrade 
would still break if you also add SUPPORTED_DEVICES properly.


I'll add SUPPORTED_DEVICES to the v2 just to be on the safe side.


Additional comments below.

Signed-off-by: Stijn Segers 
---
 .../octeon/base-files/lib/preinit/01_sysinfo | 10 --
 .../octeon/base-files/lib/preinit/79_move_config |  2 +-
 .../octeon/base-files/lib/upgrade/platform.sh| 16 


 3 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/target/linux/octeon/base-files/lib/preinit/01_sysinfo
b/target/linux/octeon/base-files/lib/preinit/01_sysinfo
index d66618b0cf..497116b2c7 100644
--- a/target/linux/octeon/base-files/lib/preinit/01_sysinfo
+++ b/target/linux/octeon/base-files/lib/preinit/01_sysinfo
@@ -6,7 +6,8 @@ do_sysinfo_octeon() {
case "$machine" in
"UBNT_E100"*)
-   name="erlite"
+   name="ubnt,erlite"
+   model="Ubiquiti EdgeRouter Lite"
;;
"UBNT_E200"*)
@@ -34,7 +35,12 @@ do_sysinfo_octeon() {
[ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
echo "$name" > /tmp/sysinfo/board_name
-   echo "$machine" > /tmp/sysinfo/model
+   if [ -z "$model" ]
+   then
+   echo "$machine" > /tmp/sysinfo/model
+   else
+   echo "$model" > /tmp/sysinfo/model
+   fi
What's the purpose of this change? If it just "adds a friendly 
name" it should probably be separate, as the rest is about changing 
the board_name.


I'll split this out into a separate patch. This is cosmetic indeed, 
so /tmp/sysinfo/model (and LuCI) don't display the architecture as 
'model'. The EdgeRouter 4 e.g. does not suffer from this because it 
uses an external DTS that sets the model value.


I could do the same for the other machine matches, but it looks like 
the UBNT_E[0-9][0-9]0 values are crude indicators of what device 
OpenWrt is running on...


A quick online search gave this:
- UBNT E100: EdgeRouter Lite (ERLite-3), but also EdgeRouter PoE 
(ERPoe-5) e.g.

- UBNT E200: EdgeRouter (ER-8) & EdgeRouter Pro (ERPro-8)
- UBNT E220: UniFi Security Gateway Pro 4 (USG Pro-4), but also 
EdgeRouter


So what's the best way to deduplicate this? A custom DTS per device 
that overrides upstream board_name and model, but inherits the 
remainder of the DTS?


Thanks

Stijn


Best
Adrian

 }
 boot_hook_add preinit_main do_sysinfo_octeon diff --git
a/target/linux/octeon/base-files/lib/preinit/79_move_config
b/target/linux/octeon/base-files/lib/preinit/79_move_config
index 5a84e6f18a..fb917ec39e 100644
--- a/target/linux/octeon/base-files/lib/preinit/79_move_config
+++ b/target/linux/octeon/base-files/lib/preinit/79_move_config
@@ -15,7 +15,7 @@ octeon_move_config() {
. /lib/functions.sh
case "$(board_name)" in
-   erlite)
+   ubnt,erlite)
move_config "/dev/sda1"
;;
itus,shield-router)
diff --git a/target/linux/octeon/base-files/lib/upgrade/platform.sh
b/target/linux/octeon/base-files/lib/upgrade/platform.sh
index ad5baef4a1..5e5f33b719 100755
--- a/target/linux/octeon/base-files/lib/upgrade/platform.sh
+++ b/target/linux/octeon/base-files/lib/upgrade/platform.sh
@@ -19,11 +19,6 @@ platform_get_rootfs() {
 platform_copy_config() {
case "$(board_name)" in
-   erlite)
-   mount -t vfat /dev/sda1 /mnt
-   cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
-   umount /mnt
-   ;;
itus,shield-router)
mount -t vfat /dev/mmcblk1p1 /mnt
cp -af 

RE: ramips: add support for Xiaomi Mi Router 4AC (100M Edition)

2021-01-08 Thread Adrian Schmutzler
> -Original Message-
> From: openwrt-devel [mailto:openwrt-devel-boun...@lists.openwrt.org]
> On Behalf Of Alexander 'lynxis' Couzens
> Sent: Freitag, 8. Januar 2021 17:36
> To: Sorin Pop 
> Cc: openwrt-devel@lists.openwrt.org; Adrian Schmutzler
> 
> Subject: Re: ramips: add support for Xiaomi Mi Router 4AC (100M Edition)
> 
> Hi Sorin,
> 
> do you know if the Xiaomi Mi Router 4A is the same?
> 
> I've a router 4a (100m) around which boots from bc26. Most likely a EU
> variant.

Ah, you found it yourself.

Do you have a smart idea how we resolve this "mess"?

Best

Adrian

> 
> Best,
> lynxis
> 
> > It seems that the difference is not that it's 4AC because even the one
> > in OpenWrt ATM is a 4AC (defined as 4A) but what I found out is that
> > 4AC seem to have 2 different versions/flavors:
> > * 4AC CN -> It's using CPU@380MHz and the bootloader entry point
> > is bc16 and limits the WiFi to 20dBm for 2.4GHz and 20dBm for 5GHz
> > (Currently in OpenWRT)
> > * 4AC EU(or International) -> It's using CPU@375MHz and the
> > bootloader entry point is bc26 and limits the WiFi to 16dBm for
> > 2.4GHz and 18dBm for 5GHz
> 
> 
> --
> Alexander Couzens
> 
> mail: lyn...@fe80.eu
> jabber: lyn...@fe80.eu
> gpg: 390D CF78 8BF9 AA50 4F8F  F1E2 C29E 9DA6 A0DF 8604


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


RE: [PATCH] ramips: fix partition layout of xiaomi mi router 4a 100mbit

2021-01-08 Thread Adrian Schmutzler
Hi,

> -Original Message-
> From: openwrt-devel [mailto:openwrt-devel-boun...@lists.openwrt.org]
> On Behalf Of Alexander Couzens
> Sent: Freitag, 8. Januar 2021 13:43
> To: openwrt-devel@lists.openwrt.org
> Cc: Alexander Couzens 
> Subject: [PATCH] ramips: fix partition layout of xiaomi mi router 4a 100mbit
> 
> The partition layout doesn't match the partition layout read out by OEM
> version. It's unclear to me if different firmware version have different
> partition layouts.

There has been a similar discussion somewhere in the past (don't find it right 
now), and it appears that the names for these devices are either mixed or not 
strictly defined. This should definitely be investigated more closely before 
merging anything.

Best

Adrian

> ---
>  target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4a-100m.dts | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4a-100m.dts
> b/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4a-100m.dts
> index 37797fc368cb..ea7e99d0b3fc 100644
> --- a/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4a-100m.dts
> +++ b/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4a-100m.dts
> @@ -10,13 +10,13 @@
>   {
>   partition@6 {
>   label = "overlay";
> - reg = <0x6 0x10>;
> + reg = <0x6 0x20>;
>   read-only;
>   };
> 
>   partition@16 {
>   label = "firmware";
> - reg = <0x16 0xea>;
> + reg = <0x26 0xda>;
>   compatible = "denx,uimage";
>   };
>  };
> --
> 2.29.2
> 
> 
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


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


RE: [PATCH] bcm4908: initial work on the Broadcom BCM4908 target

2021-01-08 Thread Adrian Schmutzler
Hi,

> -Original Message-
> From: openwrt-devel [mailto:openwrt-devel-boun...@lists.openwrt.org]
> On Behalf Of Rafal Milecki
> Sent: Freitag, 8. Januar 2021 14:53
> To: openwrt-devel@lists.openwrt.org
> Cc: Rafał Miłecki 
> Subject: [PATCH] bcm4908: initial work on the Broadcom BCM4908 target
> 
> From: Rafał Miłecki 
> 
> BCM4906, BCM4908 and BCM49408 are SoCs with 64 bit ARMv8 B53 CPUs.
> Upstream Linux is slowly getting support for that SoCs family so it makes
> sense to add target for it.
> 
> It isn't usable yet (it only produces a bootable kernel) so "source-only"
> is used.
> 

some nitpicks below, as usual.

[...]

> --- /dev/null
> +++ b/target/linux/bcm4908/generic/target.mk
> @@ -0,0 +1 @@
> +BOARDNAME:=Generic
> diff --git a/target/linux/bcm4908/image/Makefile
> b/target/linux/bcm4908/image/Makefile
> new file mode 100644
> index 00..672cdf40e6
> --- /dev/null
> +++ b/target/linux/bcm4908/image/Makefile
> @@ -0,0 +1,39 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +
> +include $(TOPDIR)/rules.mk
> +include $(INCLUDE_DIR)/image.mk
> +
> +define Build/bcm4908lzma
> + $(STAGING_DIR_HOST)/bin/lzma e -lc1 -lp2 -pb2 -d22 $@ $@.new
> + mv $@.new $@
> +endef
> +
> +define Device/Default
> +  KERNEL := kernel-bin | bcm4908lzma
> +  KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
> +  KERNEL_INITRAMFS_SUFFIX := .bin
> +  KERNEL_INITRAMFS := kernel-bin | bcm4908lzma
> +  FILESYSTEMS := squashfs
> +  KERNEL_NAME := Image
> +  IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1).$$(2)
> +  BLOCKSIZE := 128k
> +  PAGESIZE := 2048
> +endef
> +
> +define Device/asus-gt-ac5300

It would be nice if we could use the vendor_model scheme with underscore here, 
like for most of the other targets (i.e. asus_gt-ac5300 in this case).

> +  DEVICE_VENDOR := Asus
> +  DEVICE_MODEL := GT-AC5300
> +  DEVICE_DTS := broadcom/bcm4908/bcm4908-asus-gt-ac5300

This could be auto-assembled based on SOC variable and DEVICE_NAME/$1 
eventually.

> +  IMAGES := bin
> +endef
> +TARGET_DEVICES += asus-gt-ac5300
> +

[...]

> +--- /dev/null
>  b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi
> +@@ -0,0 +1,187 @@
> ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
> ++
> ++#include 
> ++#include 
> ++
> ++/dts-v1/;

dts-v1 needs to be placed before any definitions to be valid. I assume the 
includes only contain macros (so don't count in that context), but one might 
still consider to move the dts-v1 in front of them, directly after the license. 
(Same argument applies indirectly to the includes in the DTS file above.

Best

Adrian 


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


[PATCH] wireless: add comments to functions

2021-01-08 Thread Alexander Couzens
Signed-off-by: Alexander Couzens 
---
 wireless.c | 42 ++
 1 file changed, 42 insertions(+)

diff --git a/wireless.c b/wireless.c
index 818f7c994da8..4422656065b0 100644
--- a/wireless.c
+++ b/wireless.c
@@ -11,6 +11,21 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  */
+
+/* The wireless configuration is projected on the following objects
+ *
+ * 1. wireless device
+ * 2. wireless interface
+ * 3. wireless vlan
+ * 4. wireless station
+ *
+ * A wireless device is a phy or simplified a wireless card.
+ * A wireless interface is a SSID on a phy.
+ * A wireless vlan can be assigned to a wireless interface. A wireless 
interface can
+ *   have multiple vlans.
+ * A wireless station is a client connected to an wireless interface.
+ */
+
 #include 
 #include "netifd.h"
 #include "wireless.h"
@@ -508,6 +523,7 @@ wireless_device_mark_down(struct wireless_device *wdev)
wdev_handle_config_change(wdev);
 }
 
+/* timeout callback to protect the tear down */
 static void
 wireless_device_setup_timeout(struct uloop_timeout *timeout)
 {
@@ -553,6 +569,7 @@ __wireless_device_set_down(struct wireless_device *wdev)
wireless_device_run_handler(wdev, false);
 }
 
+/* ubus callback network.wireless.notify, command = up */
 static void
 wireless_device_mark_up(struct wireless_device *wdev)
 {
@@ -665,6 +682,7 @@ wdev_create(struct wireless_device *wdev)
wdev->config = blob_memdup(wdev->config);
 }
 
+/* vlist update call for wireless device list */
 static void
 wdev_update(struct vlist_tree *tree, struct vlist_node *node_new,
struct vlist_node *node_old)
@@ -684,6 +702,7 @@ wdev_update(struct vlist_tree *tree, struct vlist_node 
*node_new,
}
 }
 
+/* wireless netifd script handler */
 static void
 wireless_add_handler(const char *script, const char *name, json_object *obj)
 {
@@ -751,6 +770,7 @@ void wireless_init(void)
netifd_init_script_handlers(drv_fd, wireless_add_handler);
 }
 
+/* parse blob config into the wireless interface object */
 static void
 wireless_interface_init_config(struct wireless_interface *vif)
 {
@@ -772,6 +792,7 @@ wireless_interface_init_config(struct wireless_interface 
*vif)
vif->ap_mode = !strcmp(blobmsg_get_string(cur), "ap");
 }
 
+/* vlist update call for wireless interface list */
 static void
 vif_update(struct vlist_tree *tree, struct vlist_node *node_new,
   struct vlist_node *node_old)
@@ -817,6 +838,7 @@ vif_update(struct vlist_tree *tree, struct vlist_node 
*node_new,
wdev_set_config_state(wdev, IFC_RELOAD);
 }
 
+/* parse blob config into the vlan object */
 static void
 wireless_vlan_init_config(struct wireless_vlan *vlan)
 {
@@ -834,6 +856,7 @@ wireless_vlan_init_config(struct wireless_vlan *vlan)
vlan->isolate = blobmsg_get_bool(cur);
 }
 
+/* vlist update call for vlan list */
 static void
 vlan_update(struct vlist_tree *tree, struct vlist_node *node_new,
struct vlist_node *node_old)
@@ -878,6 +901,7 @@ vlan_update(struct vlist_tree *tree, struct vlist_node 
*node_new,
wdev_set_config_state(wdev, IFC_RELOAD);
 }
 
+/* vlist update call for station list */
 static void
 station_update(struct vlist_tree *tree, struct vlist_node *node_new,
   struct vlist_node *node_old)
@@ -944,6 +968,8 @@ done:
wireless_close_script_proc_fd(wdev);
 }
 
+/* watchdog and garbage collector for wireless processes.
+ * It cleans up terminated processes. If a process is a requirement for the 
wireless device, it retries the setup */
 static void
 wireless_device_check_script_tasks(struct uloop_timeout *timeout)
 {
@@ -968,6 +994,7 @@ wireless_device_check_script_tasks(struct uloop_timeout 
*timeout)
uloop_timeout_set(>script_check, 1000);
 }
 
+/* creates a wireless device object. Called by config */
 void
 wireless_device_create(struct wireless_driver *drv, const char *name, struct 
blob_attr *data)
 {
@@ -1019,6 +1046,7 @@ wireless_device_create(struct wireless_driver *drv, const 
char *name, struct blo
vlist_add(_devices, >node, wdev->name);
 }
 
+/* creates a wireless station object. Called by config */
 void
 wireless_station_create(struct wireless_device *wdev, char *vif, struct 
blob_attr *data, const char *section)
 {
@@ -1048,6 +1076,7 @@ wireless_station_create(struct wireless_device *wdev, 
char *vif, struct blob_att
vlist_add(>stations, >node, sta->name);
 }
 
+/* ubus callback network.wireless.status, runs for every interface, encode the 
station */
 static void
 wireless_station_status(struct wireless_station *sta, struct blob_buf *b)
 {
@@ -1060,6 +1089,7 @@ wireless_station_status(struct wireless_station *sta, 
struct blob_buf *b)
blobmsg_close_table(b, i);
 }
 
+/* create a vlan object. Called by config */
 void
 wireless_vlan_create(struct wireless_device *wdev, char *vif, struct blob_attr 
*data, 

Re: ramips: add support for Xiaomi Mi Router 4AC (100M Edition)

2021-01-08 Thread Alexander 'lynxis' Couzens
Hi Sorin,

do you know if the Xiaomi Mi Router 4A is the same?

I've a router 4a (100m) around which boots from
bc26. Most likely a EU variant.

Best,
lynxis

> It seems that the difference is not that it's 4AC because even the
> one
> in OpenWrt ATM is a 4AC (defined as 4A) but what I found out is that
> 4AC seem to have 2 different versions/flavors:
> * 4AC CN -> It's using CPU@380MHz and the bootloader entry point
> is bc16 and limits the WiFi to 20dBm for 2.4GHz and 20dBm for 5GHz
> (Currently in OpenWRT)
> * 4AC EU(or International) -> It's using CPU@375MHz and the
> bootloader entry point is bc26 and limits the WiFi to 16dBm for
> 2.4GHz and 18dBm for 5GHz


-- 
Alexander Couzens

mail: lyn...@fe80.eu
jabber: lyn...@fe80.eu
gpg: 390D CF78 8BF9 AA50 4F8F  F1E2 C29E 9DA6 A0DF 8604


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


RE: [PATCH 2/2] octeon: add EdgeRouter Lite specific network config

2021-01-08 Thread Stijn Segers

Hi Adrian,

Op vrijdag 8 januari 2021 om 13u30 schreef Adrian Schmutzler 
:

Hi,


 -Original Message-
 From: openwrt-devel [mailto:openwrt-devel-boun...@lists.openwrt.org]
 On Behalf Of Stijn Segers
 Sent: Freitag, 8. Januar 2021 11:28
 To: openwrt-devel@lists.openwrt.org
 Subject: [PATCH 2/2] octeon: add EdgeRouter Lite specific network 
config


 The Ubiquiti EdgeRouter Lite has three network interfaces. Add a 
specific

 match in /etc/board.d/01_network so they all get set up.
 Default to eth0 for WAN and an eth1 + eth2 bridge for LAN.


Why this particular assignment?



The EdgeRouter 4 (same Octeon target) uses a similar set-up; the PC 
Engines APU has a similar setup as well: 3 Ethernet ports, eth0 being 
set as WAN - see [2].


I can invert it and set eth2 as WAN port, if you'd like. The fallback 
setup for Octeon at this point is just as weird, to set eth0 as LAN 
(which is logical) and eth1 as WAN, and leave other ports unconfigured.


There's no perfect solution, but I think leaving a port unused makes 
even less sense than this.


Stijn

[1] 
https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=target/linux/octeon/base-files/etc/board.d/01_network;h=749d99be1d11802fbc442a11b1d3312b806ea9fb;hb=HEAD
[2] 
https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=target/linux/x86/base-files/etc/board.d/02_network;h=c6e381b946d03887cb941e90db2ccbb2f918fca4;hb=HEAD




Best

Adrian



 Signed-off-by: Stijn Segers 
 ---
  target/linux/octeon/base-files/etc/board.d/01_network | 3 +++
  1 file changed, 3 insertions(+)

 diff --git a/target/linux/octeon/base-files/etc/board.d/01_network
 b/target/linux/octeon/base-files/etc/board.d/01_network
 index 749d99be1d..4ad5f95598 100755
 --- a/target/linux/octeon/base-files/etc/board.d/01_network
 +++ b/target/linux/octeon/base-files/etc/board.d/01_network
 @@ -14,6 +14,9 @@ itus,shield-router)
  ubnt,edgerouter-4)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "lan0"
;;
 +ubnt,erlite)
 +  ucidef_set_interfaces_lan_wan "eth1 eth2" "eth0"
 +  ;;
  *)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
;;
 --
 2.20.1


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

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




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


RE: [PATCH 1/2] octeon: rename erlite to ubnt,erlite

2021-01-08 Thread Stijn Segers

Hi,

Op vrijdag 8 januari 2021 om 13u29 schreef Adrian Schmutzler 
:

Hi,


 -Original Message-
 From: openwrt-devel [mailto:openwrt-devel-boun...@lists.openwrt.org]
 On Behalf Of Stijn Segers
 Sent: Freitag, 8. Januar 2021 11:28
 To: openwrt-devel@lists.openwrt.org
 Subject: [PATCH 1/2] octeon: rename erlite to ubnt,erlite

 Prefix EdgeRouter Lite board_name value with vendor abbreviation 
UBNT, as
 other Ubiquiti devices do, and use full name "Ubiquiti EdgeRouter 
Lite" as

 model value.


If we touch this, please use ubnt,edgerouter-lite to match the 
devices in other targets.


Will do.



I always wanted to do this but never did it because I don't have the 
device to test and breaking sysupgrade was not an option for me here.


However, with BOARD_NAME in place I'm not sure whether sysupgrade 
would still break if you also add SUPPORTED_DEVICES properly.


I'll add SUPPORTED_DEVICES to the v2 just to be on the safe side.



Additional comments below.



 Signed-off-by: Stijn Segers 
 ---
  .../octeon/base-files/lib/preinit/01_sysinfo | 10 --
  .../octeon/base-files/lib/preinit/79_move_config |  2 +-
  .../octeon/base-files/lib/upgrade/platform.sh| 16 


  3 files changed, 17 insertions(+), 11 deletions(-)

 diff --git a/target/linux/octeon/base-files/lib/preinit/01_sysinfo
 b/target/linux/octeon/base-files/lib/preinit/01_sysinfo
 index d66618b0cf..497116b2c7 100644
 --- a/target/linux/octeon/base-files/lib/preinit/01_sysinfo
 +++ b/target/linux/octeon/base-files/lib/preinit/01_sysinfo
 @@ -6,7 +6,8 @@ do_sysinfo_octeon() {

case "$machine" in
"UBNT_E100"*)
 -  name="erlite"
 +  name="ubnt,erlite"
 +  model="Ubiquiti EdgeRouter Lite"
;;

"UBNT_E200"*)
 @@ -34,7 +35,12 @@ do_sysinfo_octeon() {
[ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"

echo "$name" > /tmp/sysinfo/board_name
 -  echo "$machine" > /tmp/sysinfo/model
 +  if [ -z "$model" ]
 +  then
 +  echo "$machine" > /tmp/sysinfo/model
 +  else
 +  echo "$model" > /tmp/sysinfo/model
 +  fi


What's the purpose of this change? If it just "adds a friendly name" 
it should probably be separate, as the rest is about changing the 
board_name.




I'll split this out into a separate patch. This is cosmetic indeed, so 
/tmp/sysinfo/model (and LuCI) don't display the architecture as 
'model'. The EdgeRouter 4 e.g. does not suffer from this because it 
uses an external DTS that sets the model value.


I could do the same for the other machine matches, but it looks like 
the UBNT_E[0-9][0-9]0 values are crude indicators of what device 
OpenWrt is running on...


A quick online search gave this:
- UBNT E100: EdgeRouter Lite (ERLite-3), but also EdgeRouter PoE 
(ERPoe-5) e.g.

- UBNT E200: EdgeRouter (ER-8) & EdgeRouter Pro (ERPro-8)
- UBNT E220: UniFi Security Gateway Pro 4 (USG Pro-4), but also 
EdgeRouter


So what's the best way to deduplicate this? A custom DTS per device 
that overrides upstream board_name and model, but inherits the 
remainder of the DTS?


Thanks

Stijn


Best

Adrian


  }

  boot_hook_add preinit_main do_sysinfo_octeon diff --git
 a/target/linux/octeon/base-files/lib/preinit/79_move_config
 b/target/linux/octeon/base-files/lib/preinit/79_move_config
 index 5a84e6f18a..fb917ec39e 100644
 --- a/target/linux/octeon/base-files/lib/preinit/79_move_config
 +++ b/target/linux/octeon/base-files/lib/preinit/79_move_config
 @@ -15,7 +15,7 @@ octeon_move_config() {
. /lib/functions.sh

case "$(board_name)" in
 -  erlite)
 +  ubnt,erlite)
move_config "/dev/sda1"
;;
itus,shield-router)
 diff --git a/target/linux/octeon/base-files/lib/upgrade/platform.sh
 b/target/linux/octeon/base-files/lib/upgrade/platform.sh
 index ad5baef4a1..5e5f33b719 100755
 --- a/target/linux/octeon/base-files/lib/upgrade/platform.sh
 +++ b/target/linux/octeon/base-files/lib/upgrade/platform.sh
 @@ -19,11 +19,6 @@ platform_get_rootfs() {

  platform_copy_config() {
case "$(board_name)" in
 -  erlite)
 -  mount -t vfat /dev/sda1 /mnt
 -  cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
 -  umount /mnt
 -  ;;
itus,shield-router)
mount -t vfat /dev/mmcblk1p1 /mnt
cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
 @@ -34,6 +29,11 @@ platform_copy_config() {
cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
umount /mnt
;;
 +  ubnt,erlite)
 +  mount -t vfat /dev/sda1 /mnt
 +  cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
 +  umount /mnt
 +  ;;
esac
  }

 @@ -87,7 +87,7 @@ platform_do_upgrade() {
ubnt,edgerouter-4)
kernel=mmcblk0p1
;;
 -  erlite)
 +  ubnt,erlite)

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

2021-01-08 Thread Stijn Segers

Hi,

Op vrijdag 8 januari 2021 om 16u19 schreef Sander Vanheule 
:

Hi Stijn,

On Fri, 2021-01-08 at 14:32 +0100, Stijn Segers wrote:

 diff --git a/target/linux/realtek/image/Makefile
 b/target/linux/realtek/image/Makefile
 index 765e516a0a..39b28b6c67 100644
 --- a/target/linux/realtek/image/Makefile
 +++ b/target/linux/realtek/image/Makefile
 @@ -65,11 +65,33 @@ define Device/netgear_gs110tpp-v1
  endef
  TARGET_DEVICES += netgear_gs110tpp-v1

 -define Device/zyxel_gs1900-10hp
 +define Device/zyxel_gs1900
SOC := rtl8380


There are also GS1900 models with a RTL8382M (24 ports), or RTL8393M
(48 ports) SoC, so maybe 'Device/zyxel_gs1900' is a bit too broad 
here.

You've used 'rtl8380_zyxel_gs1900' for the DTSI, would something
similar be an option here?


Smart thinking!

Adrian, what is your take on this? Should I rename the 'base recipe' to 
rtl8380_zyxel_gs1900?


We could also do something like zyxel_gs1900_lower, since it's the 
lower segment of the range?


I'm all ears :-)

Stijn



Best,
Sander



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




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


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

2021-01-08 Thread Sander Vanheule
Hi Stijn,

On Fri, 2021-01-08 at 14:32 +0100, Stijn Segers wrote:
> diff --git a/target/linux/realtek/image/Makefile
> b/target/linux/realtek/image/Makefile
> index 765e516a0a..39b28b6c67 100644
> --- a/target/linux/realtek/image/Makefile
> +++ b/target/linux/realtek/image/Makefile
> @@ -65,11 +65,33 @@ define Device/netgear_gs110tpp-v1
>  endef
>  TARGET_DEVICES += netgear_gs110tpp-v1
>  
> -define Device/zyxel_gs1900-10hp
> +define Device/zyxel_gs1900
>    SOC := rtl8380

There are also GS1900 models with a RTL8382M (24 ports), or RTL8393M
(48 ports) SoC, so maybe 'Device/zyxel_gs1900' is a bit too broad here.
You've used 'rtl8380_zyxel_gs1900' for the DTSI, would something
similar be an option here?

Best,
Sander



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


[PATCH] bcm4908: initial work on the Broadcom BCM4908 target

2021-01-08 Thread Rafał Miłecki
From: Rafał Miłecki 

BCM4906, BCM4908 and BCM49408 are SoCs with 64 bit ARMv8 B53 CPUs.
Upstream Linux is slowly getting support for that SoCs family so it
makes sense to add target for it.

It isn't usable yet (it only produces a bootable kernel) so "source-only"
is used.

Signed-off-by: Rafał Miłecki 
---
 target/linux/bcm4908/Makefile |  23 ++
 target/linux/bcm4908/config-5.4   | 179 ++
 target/linux/bcm4908/generic/target.mk|   1 +
 target/linux/bcm4908/image/Makefile   |  39 +++
 ...om-add-BCM4908-and-Asus-GT-AC5300-ea.patch | 307 ++
 ...add-config-for-Broadcom-BCM4908-SoCs.patch |  44 +++
 ...al-bcm63xx-lower-driver-dependencies.patch |  31 ++
 7 files changed, 624 insertions(+)
 create mode 100644 target/linux/bcm4908/Makefile
 create mode 100644 target/linux/bcm4908/config-5.4
 create mode 100644 target/linux/bcm4908/generic/target.mk
 create mode 100644 target/linux/bcm4908/image/Makefile
 create mode 100644 
target/linux/bcm4908/patches-5.4/030-v5.11-0001-arm64-dts-broadcom-add-BCM4908-and-Asus-GT-AC5300-ea.patch
 create mode 100644 
target/linux/bcm4908/patches-5.4/030-v5.11-0002-v5.11-arm64-add-config-for-Broadcom-BCM4908-SoCs.patch
 create mode 100644 
target/linux/bcm4908/patches-5.4/080-v5.11-tty-serial-bcm63xx-lower-driver-dependencies.patch

diff --git a/target/linux/bcm4908/Makefile b/target/linux/bcm4908/Makefile
new file mode 100644
index 00..d5f82a188e
--- /dev/null
+++ b/target/linux/bcm4908/Makefile
@@ -0,0 +1,23 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+include $(TOPDIR)/rules.mk
+
+ARCH:=aarch64
+BOARD:=bcm4908
+BOARDNAME:=Broadcom BCM4908 (ARMv8A CPUs Brahma-B53)
+FEATURES:=squashfs nand usb pci pcie gpio source-only
+CPU_TYPE:=cortex-a53
+SUBTARGETS:=generic
+
+KERNEL_PATCHVER:=5.4
+KERNEL_TESTING_PATCHVER:=5.4
+
+define Target/Description
+   Build firmware images for Broadcom BCM4908 SoC family routers.
+endef
+
+include $(INCLUDE_DIR)/target.mk
+
+KERNELNAME:=Image dtbs
+
+$(eval $(call BuildTarget))
diff --git a/target/linux/bcm4908/config-5.4 b/target/linux/bcm4908/config-5.4
new file mode 100644
index 00..b75fd93f76
--- /dev/null
+++ b/target/linux/bcm4908/config-5.4
@@ -0,0 +1,179 @@
+CONFIG_64BIT=y
+CONFIG_ARCH_BCM4908=y
+CONFIG_ARCH_CLOCKSOURCE_DATA=y
+CONFIG_ARCH_DMA_ADDR_T_64BIT=y
+CONFIG_ARCH_KEEP_MEMBLOCK=y
+CONFIG_ARCH_MMAP_RND_BITS=18
+CONFIG_ARCH_MMAP_RND_BITS_MAX=24
+CONFIG_ARCH_MMAP_RND_BITS_MIN=18
+CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11
+CONFIG_ARCH_PROC_KCORE_TEXT=y
+CONFIG_ARCH_SELECT_MEMORY_MODEL=y
+CONFIG_ARCH_SPARSEMEM_DEFAULT=y
+CONFIG_ARCH_SPARSEMEM_ENABLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_ARM64=y
+CONFIG_ARM64_4K_PAGES=y
+CONFIG_ARM64_CONT_SHIFT=4
+CONFIG_ARM64_ERRATUM_1165522=y
+CONFIG_ARM64_ERRATUM_1286807=y
+CONFIG_ARM64_PAGE_SHIFT=12
+CONFIG_ARM64_PA_BITS=48
+CONFIG_ARM64_PA_BITS_48=y
+CONFIG_ARM64_PTR_AUTH=y
+CONFIG_ARM64_SSBD=y
+CONFIG_ARM64_SVE=y
+CONFIG_ARM64_TAGGED_ADDR_ABI=y
+CONFIG_ARM64_VA_BITS=39
+CONFIG_ARM64_VA_BITS_39=y
+CONFIG_ARM64_WORKAROUND_REPEAT_TLBI=y
+CONFIG_ARM_AMBA=y
+CONFIG_ARM_ARCH_TIMER=y
+CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y
+CONFIG_ARM_GIC=y
+CONFIG_ARM_GIC_V3=y
+CONFIG_ARM_GIC_V3_ITS=y
+CONFIG_ARM_PSCI_FW=y
+CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y
+CONFIG_BCM7XXX_PHY=y
+CONFIG_BCM_NET_PHYLIB=y
+CONFIG_CAVIUM_TX2_ERRATUM_219=y
+CONFIG_CLKDEV_LOOKUP=y
+CONFIG_CLONE_BACKWARDS=y
+CONFIG_CMDLINE="earlycon=bcm63xx_uart,0xff800640"
+CONFIG_CMDLINE_FORCE=y
+CONFIG_COMMON_CLK=y
+CONFIG_CPU_RMAP=y
+CONFIG_CRYPTO_AEAD=y
+CONFIG_CRYPTO_AEAD2=y
+CONFIG_CRYPTO_HASH2=y
+CONFIG_CRYPTO_MANAGER=y
+CONFIG_CRYPTO_MANAGER2=y
+CONFIG_CRYPTO_NULL2=y
+CONFIG_CRYPTO_RNG2=y
+CONFIG_DCACHE_WORD_ACCESS=y
+CONFIG_DMA_DIRECT_REMAP=y
+CONFIG_DMA_REMAP=y
+CONFIG_DRM_RCAR_WRITEBACK=y
+CONFIG_DTC=y
+CONFIG_EDAC_SUPPORT=y
+CONFIG_FIXED_PHY=y
+CONFIG_FIX_EARLYCON_MEM=y
+CONFIG_FRAME_POINTER=y
+CONFIG_FUJITSU_ERRATUM_010001=y
+CONFIG_FW_LOADER_PAGED_BUF=y
+CONFIG_GENERIC_ALLOCATOR=y
+CONFIG_GENERIC_ARCH_TOPOLOGY=y
+CONFIG_GENERIC_BUG=y
+CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
+CONFIG_GENERIC_CPU_AUTOPROBE=y
+CONFIG_GENERIC_CPU_VULNERABILITIES=y
+CONFIG_GENERIC_CSUM=y
+CONFIG_GENERIC_EARLY_IOREMAP=y
+CONFIG_GENERIC_GETTIMEOFDAY=y
+CONFIG_GENERIC_IDLE_POLL_SETUP=y
+CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y
+CONFIG_GENERIC_IRQ_MULTI_HANDLER=y
+CONFIG_GENERIC_IRQ_SHOW=y
+CONFIG_GENERIC_IRQ_SHOW_LEVEL=y
+CONFIG_GENERIC_MSI_IRQ=y
+CONFIG_GENERIC_MSI_IRQ_DOMAIN=y
+CONFIG_GENERIC_PCI_IOMAP=y
+CONFIG_GENERIC_SCHED_CLOCK=y
+CONFIG_GENERIC_SMP_IDLE_THREAD=y
+CONFIG_GENERIC_STRNCPY_FROM_USER=y
+CONFIG_GENERIC_STRNLEN_USER=y
+CONFIG_GENERIC_TIME_VSYSCALL=y
+CONFIG_GPIOLIB=y
+CONFIG_GPIO_GENERIC=y
+CONFIG_GPIO_GENERIC_PLATFORM=y
+CONFIG_HANDLE_DOMAIN_IRQ=y
+CONFIG_HARDEN_BRANCH_PREDICTOR=y
+CONFIG_HARDIRQS_SW_RESEND=y
+CONFIG_HAS_DMA=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HOLES_IN_ZONE=y
+CONFIG_HZ=250
+CONFIG_HZ_250=y

Re: [PATCH] ramips: fix partition layout of xiaomi mi router 4a 100mbit

2021-01-08 Thread Rafał Miłecki

On 08.01.2021 13:42, Alexander Couzens wrote:

The partition layout doesn't match the partition layout read out by OEM
version. It's unclear to me if different firmware version have different
partition layouts.


Missing Signed-off-by




---
  target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4a-100m.dts | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4a-100m.dts 
b/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4a-100m.dts
index 37797fc368cb..ea7e99d0b3fc 100644
--- a/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4a-100m.dts
+++ b/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4a-100m.dts
@@ -10,13 +10,13 @@
   {
partition@6 {
label = "overlay";
-   reg = <0x6 0x10>;
+   reg = <0x6 0x20>;
read-only;
};
  
  	partition@16 {


You need to update address in the node name.



label = "firmware";
-   reg = <0x16 0xea>;
+   reg = <0x26 0xda>;
compatible = "denx,uimage";
};
  };



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


Re: [PATCH] wireguard-tools: allow generating private_key

2021-01-08 Thread Leonardo Mörlein
Hi Jo,

I see your point. I will solve this downstream, so this can be closed.

Kind regards,
Leo

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


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

2021-01-08 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 v5 0/2] Add GS1900-8HP v1/v2 support and GS1900 DTSI

2021-01-08 Thread Stijn Segers
Hi Adrian, 

This should be the final round. Run-tested on a GS1900-10HP. It's still
alive :-).

Thank you!

Stijn

Stijn Segers (2):
  realtek: introduce shared DTSI for GS1900 series
  realtek: add support for ZyXEL GS1900-8HP v1 and v2

 .../realtek/base-files/etc/board.d/02_network |   6 +
 .../realtek/dts/rtl8380_zyxel_gs1900-10hp.dts | 233 +-
 .../dts/rtl8380_zyxel_gs1900-8hp-v1.dts   |   8 +
 .../dts/rtl8380_zyxel_gs1900-8hp-v2.dts   |   8 +
 .../realtek/dts/rtl8380_zyxel_gs1900.dtsi | 146 +++
 target/linux/realtek/image/Makefile   |  24 +-
 6 files changed, 196 insertions(+), 229 deletions(-)
 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
 create mode 100644 target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi

-- 
2.20.1


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


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

2021-01-08 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 | 233 +-
 .../realtek/dts/rtl8380_zyxel_gs1900.dtsi | 146 +++
 2 files changed, 151 insertions(+), 228 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..58c387d053 100644
--- a/target/linux/realtek/dts/rtl8380_zyxel_gs1900-10hp.dts
+++ b/target/linux/realtek/dts/rtl8380_zyxel_gs1900-10hp.dts
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
 
-#include "rtl838x.dtsi"
+#include "rtl8380_zyxel_gs1900.dtsi"
 
 #include 
 #include 
@@ -9,52 +9,6 @@
compatible = "zyxel,gs1900-10hp", "realtek,rtl838x-soc";
model = "ZyXEL GS1900-10HP Switch";
 
-   aliases {
-   led-boot = _sys;
-   led-failsafe = _sys;
-   led-running = _sys;
-   led-upgrade = _sys;
-   };
-
-   chosen {
-   bootargs = "console=ttyS0,115200";
-   };
-
-   memory@0 {
-   device_type = "memory";
-   reg = <0x0 0x800>;
-   };
-
-   gpio1: rtl8231-gpio {
-   status = "okay";
-
-   poe_enable {
-   gpio-hog;
-   gpios = <13 0>;
-   output-high;
-   };
-   };
-
-   keys {
-   compatible = "gpio-keys-polled";
-   poll-interval = <20>;
-
-   reset {
-   label = "reset";
-   gpios = < 3 GPIO_ACTIVE_LOW>;
-   linux,code = ;
-   };
-   };
-
-   leds {
-   compatible = "gpio-leds";
-
-   led_sys: sys {
-   label = "gs1900:green:sys";
-   gpios = < 47 GPIO_ACTIVE_HIGH>;
-   };
-   };
-
/* i2c of the left SFP cage: port 9 */
i2c0: i2c-gpio-0 {
compatible = "i2c-gpio";
@@ -92,195 +46,18 @@
mod-def0-gpio = < 32 GPIO_ACTIVE_LOW>;
tx-disable-gpio = < 29 GPIO_ACTIVE_HIGH>;
};
-
-};
-
- {
-   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";
-   };
-   

Re: [PATCH] wireguard-tools: allow generating private_key

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

I'm afraid this approach is not really acceptable. Automatically calling `uci
commit` outside of the early-boot / uci-defaults context is not safe.

There could be arbitrary user defined, intentionally uncommitted changes
stashed when the ifup sequence is running which you would inadvertently commit
along with the key option change.

So, a NACK from me.

~ 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] ramips: fix partition layout of xiaomi mi router 4a 100mbit

2021-01-08 Thread Alexander Couzens
The partition layout doesn't match the partition layout read out by OEM
version. It's unclear to me if different firmware version have different
partition layouts.
---
 target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4a-100m.dts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4a-100m.dts 
b/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4a-100m.dts
index 37797fc368cb..ea7e99d0b3fc 100644
--- a/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4a-100m.dts
+++ b/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4a-100m.dts
@@ -10,13 +10,13 @@
  {
partition@6 {
label = "overlay";
-   reg = <0x6 0x10>;
+   reg = <0x6 0x20>;
read-only;
};
 
partition@16 {
label = "firmware";
-   reg = <0x16 0xea>;
+   reg = <0x26 0xda>;
compatible = "denx,uimage";
};
 };
-- 
2.29.2


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


RE: [PATCH 2/2] octeon: add EdgeRouter Lite specific network config

2021-01-08 Thread Adrian Schmutzler
Hi,

> -Original Message-
> From: openwrt-devel [mailto:openwrt-devel-boun...@lists.openwrt.org]
> On Behalf Of Stijn Segers
> Sent: Freitag, 8. Januar 2021 11:28
> To: openwrt-devel@lists.openwrt.org
> Subject: [PATCH 2/2] octeon: add EdgeRouter Lite specific network config
> 
> The Ubiquiti EdgeRouter Lite has three network interfaces. Add a specific
> match in /etc/board.d/01_network so they all get set up.
> Default to eth0 for WAN and an eth1 + eth2 bridge for LAN.

Why this particular assignment?

Best

Adrian

> 
> Signed-off-by: Stijn Segers 
> ---
>  target/linux/octeon/base-files/etc/board.d/01_network | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/target/linux/octeon/base-files/etc/board.d/01_network
> b/target/linux/octeon/base-files/etc/board.d/01_network
> index 749d99be1d..4ad5f95598 100755
> --- a/target/linux/octeon/base-files/etc/board.d/01_network
> +++ b/target/linux/octeon/base-files/etc/board.d/01_network
> @@ -14,6 +14,9 @@ itus,shield-router)
>  ubnt,edgerouter-4)
>   ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "lan0"
>   ;;
> +ubnt,erlite)
> + ucidef_set_interfaces_lan_wan "eth1 eth2" "eth0"
> + ;;
>  *)
>   ucidef_set_interfaces_lan_wan "eth0" "eth1"
>   ;;
> --
> 2.20.1
> 
> 
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


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


RE: [PATCH 1/2] octeon: rename erlite to ubnt,erlite

2021-01-08 Thread Adrian Schmutzler
Hi,

> -Original Message-
> From: openwrt-devel [mailto:openwrt-devel-boun...@lists.openwrt.org]
> On Behalf Of Stijn Segers
> Sent: Freitag, 8. Januar 2021 11:28
> To: openwrt-devel@lists.openwrt.org
> Subject: [PATCH 1/2] octeon: rename erlite to ubnt,erlite
> 
> Prefix EdgeRouter Lite board_name value with vendor abbreviation UBNT, as
> other Ubiquiti devices do, and use full name "Ubiquiti EdgeRouter Lite" as
> model value.

If we touch this, please use ubnt,edgerouter-lite to match the devices in other 
targets.

I always wanted to do this but never did it because I don't have the device to 
test and breaking sysupgrade was not an option for me here.

However, with BOARD_NAME in place I'm not sure whether sysupgrade would still 
break if you also add SUPPORTED_DEVICES properly.

Additional comments below.

> 
> Signed-off-by: Stijn Segers 
> ---
>  .../octeon/base-files/lib/preinit/01_sysinfo | 10 --
>  .../octeon/base-files/lib/preinit/79_move_config |  2 +-
>  .../octeon/base-files/lib/upgrade/platform.sh| 16 
>  3 files changed, 17 insertions(+), 11 deletions(-)
> 
> diff --git a/target/linux/octeon/base-files/lib/preinit/01_sysinfo
> b/target/linux/octeon/base-files/lib/preinit/01_sysinfo
> index d66618b0cf..497116b2c7 100644
> --- a/target/linux/octeon/base-files/lib/preinit/01_sysinfo
> +++ b/target/linux/octeon/base-files/lib/preinit/01_sysinfo
> @@ -6,7 +6,8 @@ do_sysinfo_octeon() {
> 
>   case "$machine" in
>   "UBNT_E100"*)
> - name="erlite"
> + name="ubnt,erlite"
> + model="Ubiquiti EdgeRouter Lite"
>   ;;
> 
>   "UBNT_E200"*)
> @@ -34,7 +35,12 @@ do_sysinfo_octeon() {
>   [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
> 
>   echo "$name" > /tmp/sysinfo/board_name
> - echo "$machine" > /tmp/sysinfo/model
> + if [ -z "$model" ]
> + then
> + echo "$machine" > /tmp/sysinfo/model
> + else
> + echo "$model" > /tmp/sysinfo/model
> + fi

What's the purpose of this change? If it just "adds a friendly name" it should 
probably be separate, as the rest is about changing the board_name.

Best

Adrian

>  }
> 
>  boot_hook_add preinit_main do_sysinfo_octeon diff --git
> a/target/linux/octeon/base-files/lib/preinit/79_move_config
> b/target/linux/octeon/base-files/lib/preinit/79_move_config
> index 5a84e6f18a..fb917ec39e 100644
> --- a/target/linux/octeon/base-files/lib/preinit/79_move_config
> +++ b/target/linux/octeon/base-files/lib/preinit/79_move_config
> @@ -15,7 +15,7 @@ octeon_move_config() {
>   . /lib/functions.sh
> 
>   case "$(board_name)" in
> - erlite)
> + ubnt,erlite)
>   move_config "/dev/sda1"
>   ;;
>   itus,shield-router)
> diff --git a/target/linux/octeon/base-files/lib/upgrade/platform.sh
> b/target/linux/octeon/base-files/lib/upgrade/platform.sh
> index ad5baef4a1..5e5f33b719 100755
> --- a/target/linux/octeon/base-files/lib/upgrade/platform.sh
> +++ b/target/linux/octeon/base-files/lib/upgrade/platform.sh
> @@ -19,11 +19,6 @@ platform_get_rootfs() {
> 
>  platform_copy_config() {
>   case "$(board_name)" in
> - erlite)
> - mount -t vfat /dev/sda1 /mnt
> - cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
> - umount /mnt
> - ;;
>   itus,shield-router)
>   mount -t vfat /dev/mmcblk1p1 /mnt
>   cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
> @@ -34,6 +29,11 @@ platform_copy_config() {
>   cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
>   umount /mnt
>   ;;
> + ubnt,erlite)
> + mount -t vfat /dev/sda1 /mnt
> + cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
> + umount /mnt
> + ;;
>   esac
>  }
> 
> @@ -87,7 +87,7 @@ platform_do_upgrade() {
>   ubnt,edgerouter-4)
>   kernel=mmcblk0p1
>   ;;
> - erlite)
> + ubnt,erlite)
>   kernel=sda1
>   ;;
>   itus,shield-router)
> @@ -112,9 +112,9 @@ platform_check_image() {
> 
>   case "$board" in
>   er | \
> - erlite | \
>   itus,shield-router | \
> - ubnt,edgerouter-4)
> + ubnt,edgerouter-4 | \
> + ubnt,erlite)
>   local kernel_length=$(tar xf $tar_file $board_dir/kernel -O |
> wc -c 2> /dev/null)
>   local rootfs_length=$(tar xf $tar_file $board_dir/root -O | wc
> -c 2> /dev/null)
>   [ "$kernel_length" = 0 -o "$rootfs_length" = 0 ] && {
> --
> 2.20.1
> 
> 
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


openpgp-digital-signature.asc
Description: PGP signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org

RE: [PATCH] wireguard-tools: allow generating private_key

2021-01-08 Thread Adrian Schmutzler
Hi,

> -Original Message-
> From: openwrt-devel [mailto:openwrt-devel-boun...@lists.openwrt.org]
> On Behalf Of Leonardo Mörlein
> Sent: Freitag, 8. Januar 2021 02:25
> To: openwrt-devel@lists.openwrt.org
> Cc: Leonardo Mörlein 
> Subject: [PATCH] wireguard-tools: allow generating private_key
> 
> 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.

Please bump PKG_RELEASE.

Best

Adrian

> 
> 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


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


[PATCH 1/2] octeon: rename erlite to ubnt,erlite

2021-01-08 Thread Stijn Segers
Prefix EdgeRouter Lite board_name value with vendor abbreviation UBNT, as other 
Ubiquiti
devices do, and use full name "Ubiquiti EdgeRouter Lite" as model value.

Signed-off-by: Stijn Segers 
---
 .../octeon/base-files/lib/preinit/01_sysinfo | 10 --
 .../octeon/base-files/lib/preinit/79_move_config |  2 +-
 .../octeon/base-files/lib/upgrade/platform.sh| 16 
 3 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/target/linux/octeon/base-files/lib/preinit/01_sysinfo 
b/target/linux/octeon/base-files/lib/preinit/01_sysinfo
index d66618b0cf..497116b2c7 100644
--- a/target/linux/octeon/base-files/lib/preinit/01_sysinfo
+++ b/target/linux/octeon/base-files/lib/preinit/01_sysinfo
@@ -6,7 +6,8 @@ do_sysinfo_octeon() {
 
case "$machine" in
"UBNT_E100"*)
-   name="erlite"
+   name="ubnt,erlite"
+   model="Ubiquiti EdgeRouter Lite"
;;
 
"UBNT_E200"*)
@@ -34,7 +35,12 @@ do_sysinfo_octeon() {
[ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
 
echo "$name" > /tmp/sysinfo/board_name
-   echo "$machine" > /tmp/sysinfo/model
+   if [ -z "$model" ]
+   then
+   echo "$machine" > /tmp/sysinfo/model
+   else
+   echo "$model" > /tmp/sysinfo/model
+   fi
 }
 
 boot_hook_add preinit_main do_sysinfo_octeon
diff --git a/target/linux/octeon/base-files/lib/preinit/79_move_config 
b/target/linux/octeon/base-files/lib/preinit/79_move_config
index 5a84e6f18a..fb917ec39e 100644
--- a/target/linux/octeon/base-files/lib/preinit/79_move_config
+++ b/target/linux/octeon/base-files/lib/preinit/79_move_config
@@ -15,7 +15,7 @@ octeon_move_config() {
. /lib/functions.sh
 
case "$(board_name)" in
-   erlite)
+   ubnt,erlite)
move_config "/dev/sda1"
;;
itus,shield-router)
diff --git a/target/linux/octeon/base-files/lib/upgrade/platform.sh 
b/target/linux/octeon/base-files/lib/upgrade/platform.sh
index ad5baef4a1..5e5f33b719 100755
--- a/target/linux/octeon/base-files/lib/upgrade/platform.sh
+++ b/target/linux/octeon/base-files/lib/upgrade/platform.sh
@@ -19,11 +19,6 @@ platform_get_rootfs() {
 
 platform_copy_config() {
case "$(board_name)" in
-   erlite)
-   mount -t vfat /dev/sda1 /mnt
-   cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
-   umount /mnt
-   ;;
itus,shield-router)
mount -t vfat /dev/mmcblk1p1 /mnt
cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
@@ -34,6 +29,11 @@ platform_copy_config() {
cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
umount /mnt
;;
+   ubnt,erlite)
+   mount -t vfat /dev/sda1 /mnt
+   cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
+   umount /mnt
+   ;;
esac
 }
 
@@ -87,7 +87,7 @@ platform_do_upgrade() {
ubnt,edgerouter-4)
kernel=mmcblk0p1
;;
-   erlite)
+   ubnt,erlite)
kernel=sda1
;;
itus,shield-router)
@@ -112,9 +112,9 @@ platform_check_image() {
 
case "$board" in
er | \
-   erlite | \
itus,shield-router | \
-   ubnt,edgerouter-4)
+   ubnt,edgerouter-4 | \
+   ubnt,erlite)
local kernel_length=$(tar xf $tar_file $board_dir/kernel -O | 
wc -c 2> /dev/null)
local rootfs_length=$(tar xf $tar_file $board_dir/root -O | wc 
-c 2> /dev/null)
[ "$kernel_length" = 0 -o "$rootfs_length" = 0 ] && {
-- 
2.20.1


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


[RFC] Octeon: EdgeRouter Lite fixes

2021-01-08 Thread Stijn Segers
These patches align the EdgeRouter Lite device with modern OpenWrt
practices:
- Use vendor prefix for board_name: ubnt,erlite instead of erlite.
- Set the model to "Ubiquiti EdgeRouter Lite".
- Add an EdgeRouter Lite match in /etc/board.d/01_network so all
  network interfaces get configured: eth0 as WAN, eth1 and eth2 as a LAN
  bridge. This is similar to what is done for the PC Engines APU line
  and for the Ubiquiti EdgeRouter 4 (also octeon).

I've made this an RFC because of the hackish way I set the model,
but I think this is the cleanest way to do it (short of overwriting the
machine variable altogether). Also, lots of Ubiquiti devices seem to use
shortened codenames in board_name, but recent addition EdgeRouter 4 e.g.
does not, so I'm not sure what's best practice here. It doesn't look
like the codenames are needed for anything?

This will of course break sysupgrade, but since the default network
layout changes, I'm not sure if we want to keep compatibility?

Thanks

Stijn



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


[PATCH 2/2] octeon: add EdgeRouter Lite specific network config

2021-01-08 Thread Stijn Segers
The Ubiquiti EdgeRouter Lite has three network interfaces. Add a
specific match in /etc/board.d/01_network so they all get set up.
Default to eth0 for WAN and an eth1 + eth2 bridge for LAN.

Signed-off-by: Stijn Segers 
---
 target/linux/octeon/base-files/etc/board.d/01_network | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/target/linux/octeon/base-files/etc/board.d/01_network 
b/target/linux/octeon/base-files/etc/board.d/01_network
index 749d99be1d..4ad5f95598 100755
--- a/target/linux/octeon/base-files/etc/board.d/01_network
+++ b/target/linux/octeon/base-files/etc/board.d/01_network
@@ -14,6 +14,9 @@ itus,shield-router)
 ubnt,edgerouter-4)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "lan0"
;;
+ubnt,erlite)
+   ucidef_set_interfaces_lan_wan "eth1 eth2" "eth0"
+   ;;
 *)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
;;
-- 
2.20.1


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