openwrt/openwrt.git
4 years agobcm47xx: disable image for Linksys WRT160n v3
Adrian Schmutzler [Wed, 8 Jul 2020 12:32:31 +0000 (14:32 +0200)]
bcm47xx: disable image for Linksys WRT160n v3

The device can only hold 3.6 MB, but newer images (since 18.06)
are bigger, so flashing a new version fails.

This disables default build for this device based on the bug report
referenced below.

Fixes: FS#1963
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agoramips: consolidate Netgear devices for mt7628
Adrian Schmutzler [Fri, 10 Jul 2020 10:00:08 +0000 (12:00 +0200)]
ramips: consolidate Netgear devices for mt7628

This creates a common DTSI and shared image definition for the
relatively similar Netgear devices for mt7628 platform.

As a side effect, this raises SPI flash frequency for the R6120,
as it's expected to work there as well if it works for R6080 and
R6020.

Based on the data from the other devices, it also seems probable
the 5g MAC address for R6120 could be extracted from the caldata,
and the mtd-mac-address there could be dropped.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agowireguard: bump to 1.0.20200712
Jason A. Donenfeld [Mon, 13 Jul 2020 03:37:11 +0000 (21:37 -0600)]
wireguard: bump to 1.0.20200712

This release brings parity with the commits Linus released a few hours
ago into 5.8-rc5.

* receive: account for napi_gro_receive never returning GRO_DROP

The napi_gro_receive function no longer returns GRO_DROP ever, making
handling GRO_DROP dead code. This commit removes that dead code.
Further, it's not even clear that device drivers have any business in
taking action after passing off received packets; that's arguably out of
their hands.

* device: implement header_ops->parse_protocol for AF_PACKET

WireGuard uses skb->protocol to determine packet type, and bails out if
it's not set or set to something it's not expecting. For AF_PACKET
injection, we need to support its call chain of:

    packet_sendmsg -> packet_snd -> packet_parse_headers ->
      dev_parse_header_protocol -> parse_protocol

Without a valid parse_protocol, this returns zero, and wireguard then
rejects the skb. So, this wires up the ip_tunnel handler for layer 3
packets for that case.

* queueing: make use of ip_tunnel_parse_protocol

Now that wg_examine_packet_protocol has been added for general
consumption as ip_tunnel_parse_protocol, it's possible to remove
wg_examine_packet_protocol and simply use the new
ip_tunnel_parse_protocol function directly.

* compat: backport ip_tunnel_parse_protocol and ip_tunnel_header_ops

These are required for moving wg_examine_packet_protocol out of
wireguard and into upstream.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
4 years agoscripts/env: Fix 56f813674a scripts/env: use command -v instead of which
Kevin Darbyshire-Bryant [Sun, 12 Jul 2020 12:25:39 +0000 (13:25 +0100)]
scripts/env: Fix 56f813674a scripts/env: use command -v instead of which

We don't need to see how git will be executed and it produces non silent
output on 'scripts/env diff' commands when there are no differences
unlike before.

Re-introduce original silent behaviour.

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
4 years agoath79: fix dsa binding for TP-Link TL-WR941ND v2
Chuanhong Guo [Sun, 12 Jul 2020 08:14:45 +0000 (16:14 +0800)]
ath79: fix dsa binding for TP-Link TL-WR941ND v2

upstream changed dt-bindings for marvell 88e6060 to use mdio-device
and dropped support for legacy bindings.
fix it in our local dts.

Fixes: FS#2524
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
4 years agoath79: qihoo,c301: use phy-supply for usb vbus
Chuanhong Guo [Sun, 12 Jul 2020 07:39:18 +0000 (15:39 +0800)]
ath79: qihoo,c301: use phy-supply for usb vbus

Linux phy subsystem provides support for a phy regulator defined via
phy-supply property. Use it to turn on usb power only when usb is
probed.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
4 years agomvebu: add support for MACCHIATObin Single Shot
Tomasz Maciej Nowak [Fri, 10 Jul 2020 17:35:22 +0000 (19:35 +0200)]
mvebu: add support for MACCHIATObin Single Shot

Add support for Marvell MACCHIATObin Single Shot, cortex-a72 based
Marvell ARMADA 8040 Community board. Single Shot was broken as the
device tree is different on the Double Shot Board.

Specifications:
- Quad core Cortex-A72 (up to 2GHz)
- DDR4 DIMM slot with optional ECC and single/dual chip select support
- Dual 10GbE (1/2.5/10GbE) SFP+
  2.5GbE (1/2.5GbE) via SFP
  1GbE via copper
- SPI Flash
- 3 X SATA 3.0 connectors
- MicroSD connector
- eMMC
- PCI x4 3.0 slot
- USB 2.0 Headers (Internal)
- USB 3.0 connector
- Console port (UART) over microUSB connector
- 20-pin Connector for CPU JTAG debugger
- 2 X UART Headers
- 12V input via DC Jack
- ATX type power connector
- Form Factor: Mini-ITX (170 mm x 170 mm)

More details at http://macchiatobin.net

Installation:

Write the Image to your Micro SD Card and insert it in the
MACCHIATObin Single Shot SD Card Slot.

In the U-Boot Environment:
   1. reset U-Boot environment:
      env default -a
      saveenv

   2. prepare U-Boot with boot script:
      setenv bootcmd "load mmc 1:1 0x4d00000 boot.scr; source 0x4d00000"
      saveenv

   or manually (hanging lines indicate wrapped one-line command):
      setenv fdt_name armada-8040-mcbin-singleshot.dtb
      setenv image_name Image
      setenv bootcmd 'mmc dev 1; ext4load mmc 1:1 $kernel_addr
         $image_name;ext4load mmc 1:1 $fdt_addr $fdt_name;setenv
         bootargs $console root=/dev/mmcblk1p2 rw rootwait; booti
         $kernel_addr - $fdt_addr'
      saveenv

   On newer Bootloaders (18.12) the Variables have been changed, use:
      setenv fdt_name armada-8040-mcbin-singleshot.dtb
      setenv image_name Image
      setenv bootcmd 'mmc dev 1; ext4load mmc 1:1 $kernel_addr_r
         $image_name;ext4load mmc 1:1 $fdt_addr_r $fdt_name;setenv
         bootargs $console root=/dev/mmcblk1p2 rw rootwait; booti
         $kernel_addr_r - $fdt_addr_r'

Reported-by: Alexandra Alth <alexandra@alth.de>
Signed-off-by: Tomasz Maciej Nowak <tomek_n@o2.pl>
Tested-by: Alexandra Alth <alexandra@alth.de>
[add specs and installation as provided by Alexandra Alth]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agoscripts/mkits.sh: fix use of printf
Adrian Schmutzler [Sat, 11 Jul 2020 16:46:53 +0000 (18:46 +0200)]
scripts/mkits.sh: fix use of printf

Due to a line break, printf was accidentally called with three
arguments instead of two, causing a different output than before.

Fix it by splitting the printf command into two lines.

Fixes: 907053193a1c ("scripts/mkits.sh: replace echo -e with printf")
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agoramips: consolidate recipes with uimage_padhdr
Adrian Schmutzler [Fri, 10 Jul 2020 12:16:23 +0000 (14:16 +0200)]
ramips: consolidate recipes with uimage_padhdr

There are already two very similar recipes using uimage_padhdr
in ramips target, and a third one is about to be added.

Make the recipe more generic, so redefinitions are not necessary
anymore.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Tested-by: Bjørn Mork <bjorn@mork.no> [Zyxel WAP6805]
4 years agomvebu: fix support for Marvell 8040 MACCHIATOBin
Adrian Schmutzler [Fri, 10 Jul 2020 08:28:13 +0000 (10:28 +0200)]
mvebu: fix support for Marvell 8040 MACCHIATOBin

Between kernels 4.20 and 5.0, a new variant of this board has been
introduced ("Single Shot"), and the existing one has been renamed
with the appendix "Double Shot". [1]
This also adjusted the first compatible in the list:

marvell,armada8040-mcbin -> marvell,armada8040-mcbin-doubleshot

This patch updates the OpenWrt implementation of this device by
adjusting the relevant references to that compatible (i.e., our
board name).

To still provide support for 4.19 with our setup, this adds a
small patch to change the compatible there as well.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=b1f0bbe2700051886b954192b6c1751233fe0f52

Cc: Tomasz Maciej Nowak <tomek_n@o2.pl>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Tomasz Maciej Nowak <tomek_n@o2.pl>
4 years agobcm63xx: R5010UNv2: fix flash partitions for 16MB flash
Daniel González Cabanelas [Mon, 22 Jun 2020 19:44:44 +0000 (21:44 +0200)]
bcm63xx: R5010UNv2: fix flash partitions for 16MB flash

The router Nucom R5010UN v2 has the partitions defined for a 8MB flash,
but the flash chip is 16MB size. We are wasting half of the flash.

Fix it and use generic names for partitions.

Fixes: 474cde61234c ("brcm63xx: probe SPI flash through DT")
Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com>
4 years agobuild: improve ccache support
Roman Yeryomin [Fri, 12 Jun 2020 18:43:46 +0000 (21:43 +0300)]
build: improve ccache support

Set CCACHE_DIR to $(TOPDIR)/.ccache and CCACHE_BASEDIR to $(TOPDIR).
This allows to do clean and dirclean. Cache hit rate for test build
after dirclean is ~65%.
If CCACHE is enabled stats are printed out at the end of building process.
CCACHE_DIR config variable allows to override default, which could be useful
when sharing cache with many builds.
cacheclean make target allows to clean the cache.

Changes from v1:
- remove ccache directory using CCACHE_DIR variable
- remove ccache leftovers from sdk and toolchain make files
- introduce CONFIG_CCACHE_DIR variable
- introduce cacheclean make target

Signed-off-by: Roman Yeryomin <roman@advem.lv>
4 years agoramips: mt7621: refactor set affinity script
DENG Qingfang [Thu, 4 Jun 2020 04:00:44 +0000 (12:00 +0800)]
ramips: mt7621: refactor set affinity script

The current one only looks for mt76x2e and mt7603e, and
does not work for 2 or more same Wi-Fi chips.
Refactor the script to cover those cases.

Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
4 years agoltq-vmmc: update permission handling
Sebastian Kemper [Tue, 9 Jun 2020 17:18:55 +0000 (19:18 +0200)]
ltq-vmmc: update permission handling

The firmware is currently just copied. It can end up with o= on the
device (this is the case for voice_ar9_firmware.bin for instance).
Instead of copying it the Makefile is changed to use the macro
"$(INSTALL_DATA)" in order for the file to be world-readable.

While at it refactor the device node creation in the init script with
loop.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
[removed 2nd part with custom group handling for device nodes]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years agolayerscape: define IMAGE_SIZE and LS_SYSUPGRADE_IMAGE_SIZE
Yangbo Lu [Mon, 29 Jun 2020 08:18:57 +0000 (16:18 +0800)]
layerscape: define IMAGE_SIZE and LS_SYSUPGRADE_IMAGE_SIZE

Define 64m IMAGE_SIZE for flash firmware.bin since the flash size
is 64MB. Define 48m LS_SYSUPGRADE_IMAGE_SIZE for flash sysupgrade.bin
which contains maximum 16MB kernel and 32MB rootfs according to
memory map.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
4 years agolayerscape: support sysupgrade for SD card ext4 rootfs
Yangbo Lu [Thu, 28 May 2020 08:02:28 +0000 (16:02 +0800)]
layerscape: support sysupgrade for SD card ext4 rootfs

Support sysupgrade for SD card ext4 rootfs.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
4 years agolayerscape: support sysupgrade for squashfs rootfs
Yangbo Lu [Thu, 28 May 2020 04:48:29 +0000 (12:48 +0800)]
layerscape: support sysupgrade for squashfs rootfs

Support sysupgrade for all Layerscape boards with squashfs
rootfs.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
4 years agolayerscape: fix board name for SD card boot
Yangbo Lu [Thu, 28 May 2020 05:50:42 +0000 (13:50 +0800)]
layerscape: fix board name for SD card boot

Many Layerscape boards support both flash boot and SD card boot.
And different firmware and sysupgrade.bin are built for the two
boot methods. To identify them, a fix could be done on board name
by adding a postfix "-sdboot" for SD card boot.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
4 years agolayerscape: add compatible for board ls1043ardb
Yangbo Lu [Thu, 28 May 2020 04:06:20 +0000 (12:06 +0800)]
layerscape: add compatible for board ls1043ardb

Backport a dts patch which added compatible for ls1043ardb.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
4 years agolayerscape: convert to squashfs rootfs for QSPI NOR boot
Yangbo Lu [Wed, 27 May 2020 03:10:19 +0000 (11:10 +0800)]
layerscape: convert to squashfs rootfs for QSPI NOR boot

There had been an issue in Layerscape QSPI driver for very long
time, which made squashfs,jffs2 rootfs not work on QSPI NOR.
And the ubifs had been used as a workaround.
Now the issue has been fixed. So convert to use squashfs,jffs2
rootfs on QSPI NOR for Layerscape boards (LS1012ARDB/LS1046ARDB/
LS1088ARDB), and update u-boot bootargs for booting.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
4 years agobusybox: store applet usage messages uncompressed
Rui Salvaterra [Tue, 7 Jul 2020 13:16:47 +0000 (14:16 +0100)]
busybox: store applet usage messages uncompressed

The rootfs squashfs is already highly (XZ) compressed. Storing the applet
messages in compressed form will increase the entropy and reduce the overall
image compression ratio.

Size diffs (compressed vs uncompressed):

busybox (the executable): 364596 vs 384804 bytes.

OpenWrt target images (the kernel image is unchanged, obviously):

 omnia-medkit-openwrt-mvebu-cortexa9-cznic_turris-omnia-initramfs.tar.gz:

  9163597 vs 9162531 bytes (1066 bytes difference).

openwrt-mvebu-cortexa9-cznic_turris-omnia-initramfs-kernel.bin:

  9161688 vs 9160600 bytes (1088 bytes difference).

openwrt-mvebu-cortexa9-cznic_turris-omnia-sysupgrade.img.gz:

 9729550 vs 9729230 bytes (320 bytes difference).

All in all, we save just a little bit over 1 kiB. As an added bonus, we
also don't have to decompress the messages twice, (first from squashfs,
then from the bzip2 message storage).

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
[added additional size comparision diff detaisl]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years agobase-files/functions.sh: use command -v instead of which
Rosen Penev [Fri, 17 Jan 2020 22:38:19 +0000 (14:38 -0800)]
base-files/functions.sh: use command -v instead of which

which must be executed. command -v is a shell builtin.

https://github.com/koalaman/shellcheck/wiki/SC2230

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years agoscripts/mkits.sh: fix remaining shellcheck warning
Petr Štetiar [Sat, 11 Jul 2020 11:31:35 +0000 (13:31 +0200)]
scripts/mkits.sh: fix remaining shellcheck warning

Fixes following shellcheck warning:

 In scripts/mkits.sh line 19:
   "-k kernel [-D name -d dtb] -o its_file" "$(basename $0)"
                                                                       ^-- SC2086: Double quote to prevent globbing and word splitting.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years agoscripts/mkits.sh: switch from bash to sh
Rosen Penev [Mon, 6 Jan 2020 02:31:20 +0000 (18:31 -0800)]
scripts/mkits.sh: switch from bash to sh

This no longer needs bash.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years agoscripts/mkits.sh: fix improper string and array concatenation
Rosen Penev [Mon, 6 Jan 2020 02:31:19 +0000 (18:31 -0800)]
scripts/mkits.sh: fix improper string and array concatenation

Found with shellcheck.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years agoscripts/mkits.sh: add missing quotes
Rosen Penev [Mon, 6 Jan 2020 02:31:18 +0000 (18:31 -0800)]
scripts/mkits.sh: add missing quotes

Found with shellcheck.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years agoscripts/mkits.sh: replace echo -e with printf
Rosen Penev [Mon, 6 Jan 2020 02:31:17 +0000 (18:31 -0800)]
scripts/mkits.sh: replace echo -e with printf

echo flags are not POSIX. printf does the same with added \n.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years agoscripts/gen_image_generic.sh: fix more shellcheck warnings
Petr Štetiar [Sat, 11 Jul 2020 11:24:17 +0000 (13:24 +0200)]
scripts/gen_image_generic.sh: fix more shellcheck warnings

Fixes following shellcheck warnings:

 In scripts/gen_image_generic.sh line 20:
 cyl=$(( (KERNELSIZE + ROOTFSSIZE) * 1024 * 1024 / (head * sect * 512)))
 ^-^ SC2034: cyl appears unused. Verify use (or export if used externally).
 --
 In scripts/gen_image_generic.sh line 34:
     [ -n "$PADDING" ] && dd if=/dev/zero of="$OUTPUT" bs=512 seek="$(($ROOTFSOFFSET + $ROOTFSSIZE))" conv=notrunc count="$sect"
                                                                       ^-----------^ SC2004: $/${} is unnecessary on arithmetic variables.
 --
 In scripts/gen_image_generic.sh line 35:
     mkfs.fat -n kernel -C "$OUTPUT.kernel" -S 512 "$(($KERNELSIZE / 1024))"
                                                       ^---------^ SC2004: $/${} is unnecessary on arithmetic variables.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years agoscripts/gen_image_generic.sh: use /bin/sh
Rosen Penev [Mon, 6 Jan 2020 02:22:55 +0000 (18:22 -0800)]
scripts/gen_image_generic.sh: use /bin/sh

This has nothing bash specific.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years agoscripts/gen_image_generic.sh: replace -o with if/&&
Rosen Penev [Mon, 6 Jan 2020 02:22:54 +0000 (18:22 -0800)]
scripts/gen_image_generic.sh: replace -o with if/&&

-o is not well defined.

Found with shellcheck.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years agoscripts/env: fix remaining shellcheck warning
Petr Štetiar [Sat, 11 Jul 2020 11:20:34 +0000 (13:20 +0200)]
scripts/env: fix remaining shellcheck warning

Fixes following shellcheck warning:

 In scripts/env line 25:
  exit ${1:-1}
             ^-----^ SC2086: Double quote to prevent globbing and word splitting.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years agoscripts/env: use read -r instead of read
Rosen Penev [Mon, 6 Jan 2020 02:32:38 +0000 (18:32 -0800)]
scripts/env: use read -r instead of read

read mangles backslashes.

Found with shellcheck.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years agoscripts/env: exit in case of failure to cd
Rosen Penev [Mon, 6 Jan 2020 02:32:37 +0000 (18:32 -0800)]
scripts/env: exit in case of failure to cd

Found with shellcheck.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years agoscripts/env: replace \! with !
Rosen Penev [Mon, 6 Jan 2020 02:32:36 +0000 (18:32 -0800)]
scripts/env: replace \! with !

The latter is more standard. The former throws an error under
shellcheck.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years agoscripts/env: use command -v instead of which
Rosen Penev [Mon, 6 Jan 2020 02:32:35 +0000 (18:32 -0800)]
scripts/env: use command -v instead of which

Simpler and built in to the shell.

Found with shellcheck.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years agobuild: reduce number of files passed to ipk-remove
Eneas U de Queiroz [Thu, 20 Feb 2020 21:29:04 +0000 (18:29 -0300)]
build: reduce number of files passed to ipk-remove

Instead of using xargs to pass a huge number of files to
script/ipkg-remove, which will usually pick only one, use a more
restrictive wildcard so that, currently, at the most 325 files are
examined, instead of up to over 2,300.  The 325-file package is python,
which is picking up python3* ipks.  It is about to be removed.
Runner-up is ddns-scripts with 7 files.

This makes a second run of make package/luci/compile go from
real 16.40s; user 17.42s; sys 2.73s
to
real 10.71s; user 9.51s; sys 1.27s

There is a caveat though: if one were to remove the ABI_VERSION of a
package that ends in a digit [0-9], then the old package ipk will not be
removed from the bin directory by make package/abc2/clean.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
4 years agobuild: call ipkg-remove using xargs if #args>=512
Eneas U de Queiroz [Thu, 20 Feb 2020 21:29:03 +0000 (18:29 -0300)]
build: call ipkg-remove using xargs if #args>=512

The wildcard call to clean up luci package (luci*) can pick up over
2,300 files when the full tree is built. Running make package/luci/clean
or a second run of make package/luci/compile would fail with an
'Argument list too long' error.

To avoid that, a maybe_use_xargs function was created that runs the
command straight as usual if the number of arguments is < 512, or saves
the list in a temporary file and feeds it to xargs otherwise.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
4 years agobuild: package-ipkg: avoid calling wildcard twice
Eneas U de Queiroz [Thu, 20 Feb 2020 21:29:02 +0000 (18:29 -0300)]
build: package-ipkg: avoid calling wildcard twice

Instead of calling $(wildcard) to check if the removal list is empty,
then calling it again to actually remove the files, define a function so
that the arguments are expanded only once when it gets called.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
4 years agotoolchain/wrapper.sh: fix remaining shellcheck warnings
Petr Štetiar [Sat, 11 Jul 2020 11:06:36 +0000 (13:06 +0200)]
toolchain/wrapper.sh: fix remaining shellcheck warnings

Fixes following warnings:

 In target/toolchain/files/wrapper.sh line 18:
 REALNAME=$(readlink -f $0)
                        ^-- SC2086: Double quote to prevent globbing and word splitting.
 --
 In target/toolchain/files/wrapper.sh line 20:
 REALNAME_BASE=$(basename $REALNAME)
                          ^-------^ SC2086: Double quote to prevent globbing and word splitting.
 --
 In target/toolchain/files/wrapper.sh line 21:
 REALNAME_DIR=$(dirname $REALNAME)
                        ^-------^ SC2086: Double quote to prevent globbing and word splitting.
 --
 In target/toolchain/files/wrapper.sh line 74:
  exec $TARGET_TOOLCHAIN_TRIPLET-$BINARY.bin $GCC_SYSROOT_FLAGS $TARGET_FUNDAMENTAL_CFLAGS $TARGET_ROOTFS_CFLAGS "$@"
                     ^-----------------------^ SC2086: Double quote to prevent globbing and word splitting.
 --
 In target/toolchain/files/wrapper.sh line 77:
  exec $TARGET_TOOLCHAIN_TRIPLET-$BINARY.bin $LD_SYSROOT_FLAGS $TARGET_FUNDAMENTAL_LDFLAGS "$@"
                      ^-----------------------^ SC2086: Double quote to prevent globbing and word splitting.
 --
 In target/toolchain/files/wrapper.sh line 80:
  exec $TARGET_TOOLCHAIN_TRIPLET-$BINARY.bin $TARGET_FUNDAMENTAL_ASFLAGS "$@"
                      ^-----------------------^ SC2086: Double quote to prevent globbing and word splitting.
 --
 In target/toolchain/files/wrapper.sh line 83:
  exec $TARGET_TOOLCHAIN_TRIPLET-$BINARY.bin "$@"
                      ^-----------------------^ SC2086: Double quote to prevent globbing and word splitting.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years agotoolchain/wrapper.sh: Replace read with read -r
Rosen Penev [Mon, 30 Dec 2019 03:41:17 +0000 (19:41 -0800)]
toolchain/wrapper.sh: Replace read with read -r

Without -r, backslashes would get mangled.

Found with shellcheck.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years agotoolchain/gdb: Don't use gdb-arc
Rosen Penev [Fri, 22 Nov 2019 23:09:01 +0000 (15:09 -0800)]
toolchain/gdb: Don't use gdb-arc

GDB got support for ARC with version 8.2. No need for this fork.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years agokernel: kmod-zram: break the strict dependency from lz4
Rui Salvaterra [Thu, 25 Jun 2020 14:20:23 +0000 (15:20 +0100)]
kernel: kmod-zram: break the strict dependency from lz4

Zram is only strictly dependent on lzo, not lz4. Break this dependency and
make the lz4 module visible in the configuration, in order for the user to
have the choice of enabling/disabling it, if (s)he sees fit.

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
4 years agozram-swap: correctly express the required dependencies
Rui Salvaterra [Wed, 8 Jul 2020 16:20:28 +0000 (17:20 +0100)]
zram-swap: correctly express the required dependencies

The block-mount swapon implementation doesn't support discard, so make zram-swap
depend only on the default BusyBox implementation or, when unavailable, on the
one present in the swap-utils package.

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
4 years agozram-swap: enable swap discard
Rui Salvaterra [Tue, 23 Jun 2020 11:29:54 +0000 (12:29 +0100)]
zram-swap: enable swap discard

Zram block devices have supported trim/discard for over six years, let's
enable it. This allows the zram device to actually free up allocated memory
when it's marked as unused in the filesystem metadata, as explained in more
detail in the original commit message [1].

[1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/drivers/block/zram/zram_drv.c?h=linux-4.14.y&id=f4659d8e620d08bd1a84a8aec5d2f5294a242764

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
4 years agobusybox: use CLOCK_MONOTONIC instead of gettimeofday
Rui Salvaterra [Wed, 8 Jul 2020 08:18:14 +0000 (09:18 +0100)]
busybox: use CLOCK_MONOTONIC instead of gettimeofday

The clock_gettime(CLOCK_MONOTONIC) syscall exists for so long that the first
kernel version to support it is not even specified in the man page [1]. Let's
enable it on BusyBox by default. Otherwise, gettimeofday will be used instead,
which will give wrong results if the date/time is reset (time moving backwards).

[1] https://linux.die.net/man/2/clock_gettime

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
4 years agolzo: switch to building with CMake
Rosen Penev [Fri, 10 Jul 2020 23:13:10 +0000 (16:13 -0700)]
lzo: switch to building with CMake

CMake is less error prone that autotools and also compiles faster.

Fixed license information.

Added pkgconfig file to InstallDev so that packages that use it can
find lzo.

Before:

time make package/lzo/compile -j 12
________________________________________________________
Executed in   20.87 secs   fish           external
   usr time   26.95 secs    0.00 micros   26.95 secs
   sys time    5.49 secs  305.00 micros    5.49 secs

After:

time make package/lzo/compile -j 12
________________________________________________________
Executed in   13.22 secs   fish           external
   usr time   19.59 secs  328.00 micros   19.59 secs
   sys time    4.03 secs   10.00 micros    4.03 secs

Time output is with fish shell. make clean was ran before both attempts.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years agolibubox: update to version 2020-07-11
Petr Štetiar [Mon, 20 Jan 2020 15:22:07 +0000 (16:22 +0100)]
libubox: update to version 2020-07-11

 f4e9bf73ac5c examples/lua: attempt to highlight some traps
 53b9a2123fc6 lua/uloop: fd_add: use absolute indices for arguments
 c0941d3289fc lua/uloop: make get_sock_fd capable of absolute addresses
 161c25960ba2 lua/uloop: fd_add() better args checking

Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years agoramips: kernel: fix awake-rt305x-dwc2 patch
Alexey Dobrovolsky [Wed, 6 May 2020 20:48:15 +0000 (23:48 +0300)]
ramips: kernel: fix awake-rt305x-dwc2 patch

At this point in v5.4 kernel we cannot use dwc2_readl() and
dwc2_writel() since they rely on the value hsotg->needs_byte_swap
which cannot be obtained before the controller wakes up.
We should use readl() and writel() to wake up the controller before
calling dwc2_check_core_endianness().

Fixes: 6be0da90a165 ("ramips: refresh patches")
Signed-off-by: Alexey Dobrovolsky <dobrovolskiy.alexey@gmail.com>
[fixed Fixes: tag]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years agolinux-firmware: package EIP197 mini firmware
Tomasz Maciej Nowak [Thu, 9 Jul 2020 19:16:15 +0000 (21:16 +0200)]
linux-firmware: package EIP197 mini firmware

Quoting part of original message from eefb5f741015 commit in
linux-firmware repository:

This adds the "minifw" version of the EIP197 firmware, which the inside-
secure driver will use as a fallback if the original full-featured
firmware cannot be found. This allows for using the inside-secure driver
and hardware without access to "official" firmware only available under
NDA.

Signed-off-by: Tomasz Maciej Nowak <tomek_n@o2.pl>
4 years agofirmware-utils: mkfwimage: fix memcpy and strncpy usage
Petr Štetiar [Fri, 26 Jul 2019 12:45:32 +0000 (14:45 +0200)]
firmware-utils: mkfwimage: fix memcpy and strncpy usage

Firmware is binary blob, so there are barely any NULL terminated strings
expected, so we should probably convert all chars into u8 types, and
after that it's clear, that using strcpy doesn't make sense anymore.

This is rather theoretical stuff, but `uint8_t name[PART_NAME_LENGTH]`
means, that you can supply PART_NAME_LENGTH sized name, not
PART_NAME_LENGTH-1 name when NULL terminated.

Ref: https://github.com/openwrt/openwrt/pull/2274
Fixes: 04cb651376f9 ("firmware-utils: mkfwimage: fix more errors reported by gcc-6/7/9")
Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years agotoolchain/gcc: Add GCC 10.1.0 patches
Syrone Wong [Tue, 7 Jul 2020 22:46:22 +0000 (06:46 +0800)]
toolchain/gcc: Add GCC 10.1.0 patches

Compared to GCC 9:

870-ppc_no_crtsavres.patch changes moved to another file following upstream
881-no_tm_section.patch keep the tm section disabled

patches refreshed to apply cleanly

See https://gcc.gnu.org/gcc-10/porting_to.html for more info

Compiled and run tested on x86_64

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
4 years agotoolchain/gcc: Add GCC 10.1.0 config
Syrone Wong [Tue, 7 Jul 2020 22:41:21 +0000 (06:41 +0800)]
toolchain/gcc: Add GCC 10.1.0 config

Add needed config changes and tarball hash for new GCC version.

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
[added missing commit description]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years agotoolchain/gcc: Copy patches from 9.3.0 to 10.1.0
Syrone Wong [Tue, 7 Jul 2020 22:40:24 +0000 (06:40 +0800)]
toolchain/gcc: Copy patches from 9.3.0 to 10.1.0

No content changes in this commit

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
4 years agokirkwood: add support for Check Point L-50
Pawel Dembicki [Sun, 26 Jan 2020 16:22:28 +0000 (17:22 +0100)]
kirkwood: add support for Check Point L-50

This patch adds support for the Check Point L-50 from 600/1100 series
routers.

Specification:
-CPU: Marvell Kirkwood 88F6281 1200MHz
-RAM: 512MB
-Flash: NAND 512MB
-WiFi: mPCIe card based on Atheros AR9287 b/g/n
-WAN: 1 Gigabit Port (Marvell 88E1116R PHY)
-LAN: 9 Gigabit Ports (2x Marvell 88E6171(5+4))
-USB: 2x USB2.0
-Express card slot
-SD card slot
-Serial console: RJ-45 115200 8n1
-Unsupported DSL

Known issues:
-DSL not supported
-Expresscard not tested

Installation:

Step one -> backup:
make backup u-boot and env for revert stock posibility
make backup dsl_mac_addr, dmz_mac_addr, eth1addr, ethaddr and all lanX_mac_addr

Step two -> Use kwboot tool to upload openwrt u-boot to RAM:

run kwboot: "kwboot -B 115200 /dev/ttyUSB0 -b u-boot.kwb -p -t"
end start u-boot

Step three -> Restore macs (e.g. below):
setenv eth1addr 00:1C:XX:XX:XX:6C
setenv ethaddr 00:1C:XX:XX:XX:6B
setenv lan1_mac_addr 00:1C:XX:XX:XX:6C
setenv lan2_mac_addr 00:1C:XX:XX:XX:6D
setenv lan3_mac_addr 00:1C:XX:XX:XX:6E
setenv lan4_mac_addr 00:1C:XX:XX:XX:6F
setenv lan5_mac_addr 00:1C:XX:XX:XX:70
setenv lan6_mac_addr 00:1C:XX:XX:XX:71
setenv lan7_mac_addr 00:1C:XX:XX:XX:72
setenv lan8_mac_addr 00:1C:XX:XX:XX:73
setenv dmz_mac_addr 00:1C:XX:XX:XX:74
setenv dsl_mac_addr 00:1C:XX:XX:XX:75

Step four -> flash u-boot:
mw 0x0800000 0xffff 0x100000
nand erase 0x0 100000
tftp 0x0800000 openwrt-kirkwood-l50-u-boot.kwb
nand write 0x0800000 0x0 0x100000
saveenv

Step five -> run initramfs image:

tftpboot 0x02000000 openwrt.bin; bootm 0x02000000;

Step six -> install sysupgrade OpenWrt image:

copy to /tmp/ sysupgrade image
run sysupgrade

Back to stock:
Restore original u-boot end env.
Install factory image via stock u-boot.

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
4 years agouboot-kirkwood: add uboot for CheckPoint L-50
Pawel Dembicki [Fri, 24 Jan 2020 06:13:24 +0000 (07:13 +0100)]
uboot-kirkwood: add uboot for CheckPoint L-50

This patch add u-boot for CheckPoint L-50 routers.

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
4 years agokernel: add package for Seiko S-35390A I2C RTC
Pawel Dembicki [Fri, 24 Jan 2020 06:25:54 +0000 (07:25 +0100)]
kernel: add package for Seiko S-35390A I2C RTC

This patch adds kernel package for Seiko Instruments S-35390A.

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
4 years agouboot-envtools: ath79: update ubootenv partion index for gl-ar300m
Huangbin Zhan [Wed, 8 Jul 2020 21:01:54 +0000 (05:01 +0800)]
uboot-envtools: ath79: update ubootenv partion index for gl-ar300m

The block index of u-boot-env changed from mtd1 to mtd3 after upgrading kernel to 5.4.
This patch search the mtd block by label name, work as expect when perform a clean flash.

Signed-off-by: Huangbin Zhan <zhanhb88@gmail.com>
4 years agokernel: bump 5.4 to 5.4.51
John Audia [Thu, 9 Jul 2020 21:22:35 +0000 (17:22 -0400)]
kernel: bump 5.4 to 5.4.51
update via update_kernel.sh -v -u 5.4

Removed upstreamed patches:
 350-MIPS-Add-missing-EHB-in-mtc0-mfc0-sequence-for-DSPen.patch

Script refreshed patches:
 902-debloat_proc.patch
 904-debloat_dma_buf.patch

Attempted merge conflict in following patches:
 0024-MIPS-lantiq-revert-DSA-switch-driver-PMU-clock-chang.patch

Build system: x86_64
Build tested: ipq806x (Netgear R7800)

Signed-off-by: John Audia <graysky@archlinux.us>
[fixed sha256sum of the tarball]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years agoipq806x: enable Linksys EA8500 eth1 interface
Pawel Dembicki [Tue, 30 Jun 2020 09:29:46 +0000 (11:29 +0200)]
ipq806x: enable Linksys EA8500 eth1 interface

At this moment Linksys EA8500 uses only eth0.

This patch change switch registers, which allow to use eth1 as lan
and eth0 as wan. The method work with similar Linksys EA7500V1
and it work with EA8500.

Suggested-by: Sungbo Eo <mans0n@gorani.run>
Tested-by: Brian Onn <brian.a.onn@gmail.com>
Tested-by: Adrian Panella <ianchi74@outlook.com>
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
4 years agobase-files: remove useless cat
Adrian Schmutzler [Sun, 10 May 2020 14:47:54 +0000 (16:47 +0200)]
base-files: remove useless cat

Check file contents directly instead of using cat.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agowireguard-tools: replace backticks by $(...)
Adrian Schmutzler [Sun, 10 May 2020 14:47:51 +0000 (16:47 +0200)]
wireguard-tools: replace backticks by $(...)

This replaces deprecated backticks by more versatile $(...) syntax.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agobase-files: replace backticks by $(...)
Adrian Schmutzler [Sun, 10 May 2020 14:47:46 +0000 (16:47 +0200)]
base-files: replace backticks by $(...)

This replaces deprecated backticks by more versatile $(...) syntax.

This does not touch lib/upgrade/nand.sh, as there replacement is
not trivial.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agoprocd: fix yet another build issue, this time with capabilities
Daniel Golle [Sat, 11 Jul 2020 10:27:33 +0000 (11:27 +0100)]
procd: fix yet another build issue, this time with capabilities

 3034eaf jail: use linux/capability.h instead of sys/capability.h

Fixes: b6e440a0f5 ("procd: update to git HEAD")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
4 years agoprocd: fix another seccomp-related build issue
Daniel Golle [Sat, 11 Jul 2020 09:52:28 +0000 (10:52 +0100)]
procd: fix another seccomp-related build issue

 3473671 ujail: add dependency on syscall-names-h

Fixes: b6e440a0f5 ("procd: update to git HEAD")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
4 years agoath79: disable TP-Link TL-WR941ND v2
Adrian Schmutzler [Sat, 11 Jul 2020 09:43:22 +0000 (11:43 +0200)]
ath79: disable TP-Link TL-WR941ND v2

The support for this device's Marvell MV88E6060 switch has been
reported to be broken with kernels 4.19/5.4 (see bug report).

Since this a 4/32 device and it has been confirmed to be working
with stable 19.07 release (kernel 4.14), and since fixing it does
not seem trivial, let's just disable it in master.

Fixes: FS#2524
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agoprocd: jail: fix build on platforms without seccomp support
Daniel Golle [Fri, 10 Jul 2020 23:08:04 +0000 (00:08 +0100)]
procd: jail: fix build on platforms without seccomp support

Fixes: b6e440a0f5 ("procd: update to git HEAD")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
4 years agoprocd: update to git HEAD
Daniel Golle [Fri, 10 Jul 2020 17:52:28 +0000 (18:52 +0100)]
procd: update to git HEAD

 ea7a790 jail: add support for running OCI bundle
 bb4a446 uxc: add container management CLI tool

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
4 years agomac80211: rt2x00: define RF5592 in init_eeprom routine
Daniel Golle [Tue, 7 Jul 2020 20:51:58 +0000 (21:51 +0100)]
mac80211: rt2x00: define RF5592 in init_eeprom routine

Make sure RF5592 is set for RT5592 chip which apparently sometimes
doesn't have RF defined (but always comes with RF5592).
This patch was originally submitted on linux-wireless by
Tom Psyborg <pozega.tomislav@gmail.com> but got rejected.
Turns out the patch is actually needed.

Reported-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
4 years agoramips: add support for Netgear R6020
Tim Thorpe [Thu, 9 Jul 2020 03:07:35 +0000 (22:07 -0500)]
ramips: add support for Netgear R6020

This adds support for the Netgear R6020, aka Netgear AC750.

The R6020 appears to be the same hardware as the Netgear R6080,
aka Netgear AC1000, but it has a slightly different flash layout,
and no USB ports.

Specification:

SoC: MediaTek MT7628 (580 MHz)
Flash: 8 MiB
RAM: 64 MiB
Wireless: 2.4Ghz (builtin) and 5Ghz (MT7612E)
LAN speed: 10/100
LAN ports: 4
WAN speed: 10/100
WAN ports: 1
UART (57600 8N1) on PCB

MAC addresses based on vendor firmware:
LAN      *:88   0x4
WAN      *:89
WLAN2    *:88   0x4
WLAN5    *:8a   0x8004

The factory partition might have been corrupted beforehand. However,
the comparison of vendor firmware and OpenWrt still allowed to retrieve
a meaningful assignment that also matches the other similar devices.

Installation:

Flashing OpenWRT from stock firmware requires nmrpflash. Use an ethernet
cable to connect to LAN port 1 of the R6020, and power the R6020 off.
From the connected workstation, run
`nmrpflash -i eth0 -f openwrt-ramips-mt76x8-netgear_r6020-squashfs-factory.img`,
replacing eth0 with the appropriate interface (can be identified by
running `nmrpflash -L`). Then power on the R6020. After flashing has finished,
power cycle the R6020, and it will boot into OpenWRT. Once OpenWRT has been
installed, subsequent flashes can use the web interface and sysupgrade files.

Signed-off-by: Tim Thorpe <timfthorpe@gmail.com>
[slightly extend commit message, fix whitespaces in DTS, align From:
with Signed-off-by]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agolantiq: set correct gphy pins for Zyxel P-2812
Willem van den Akker [Thu, 9 Jul 2020 12:51:19 +0000 (14:51 +0200)]
lantiq: set correct gphy pins for Zyxel P-2812

This fixes the gphy LED pins for Zyxel P-2812 devices. The have
been accidentally altered during a tidy-up operation (see Fixes:
below).

No ports were available, dmesg reported:

[ 0.658577] pinctrl-xway 1e100b10.pinmux: pin io5 already requested by
            1e100bb0.stp; cannot claim for 1e108000.eth
[ 0.667566] pinctrl-xway 1e100b10.pinmux: pin-5 (1e108000.eth) status -22
[ 0.685238] lantiq,xrx200-net 1e108000.eth: Error applying setting,
            reverse things back
[ 0.693270] lantiq,xrx200-net: probe of 1e108000.eth failed with error -22

Fixes: FS#3188
Fixes: 660200e53d62 ("lantiq: dts: assign the GPHY LED pins to the
Ethernet controller node")

Suggested-by: Mathias Kresin <dev@kresin.me>
Signed-off-by: Willem van den Akker <wvdakker@wilsoft.nl>
[commit message facelift]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agomediatek: fix bashism in gen_banana_pi_img.sh
David Woodhouse [Thu, 9 Jul 2020 08:56:18 +0000 (09:56 +0100)]
mediatek: fix bashism in gen_banana_pi_img.sh

There was a bashism in the script. This fixes the script so that it
doesn't actually require bash, and can be run with any POSIX shell as
its shebang suggests.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agokernel: iscsi-initator: fix kernel config symbols
Lucian Cristian [Wed, 8 Jul 2020 19:49:57 +0000 (22:49 +0300)]
kernel: iscsi-initator: fix kernel config symbols

Enable SCSI low-level drivers on targets that don't have it already in
order to fix following build failures on few platforms:

  .config:4739:warning: symbol value 'm' invalid for SCSI_LOWLEVEL
 * Restart config...
 * SCSI low-level drivers
 SCSI low-level drivers (SCSI_LOWLEVEL) [Y/n] (NEW) aborted!

Fixes: b88f8202c4ce ("kernel: add iscsi-initator support")
Signed-off-by: Lucian Cristian <lucian.cristian@gmail.com>
[commit subject and description facelift]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years agomediatek: re-add u3phy2 phy-switch patch
Sungbo Eo [Fri, 29 May 2020 13:06:35 +0000 (22:06 +0900)]
mediatek: re-add u3phy2 phy-switch patch

This patch is required for pcie@2,0 in mt7623 to work. The patch was originally
added in kernel 4.14, but it has not been ported to 4.19 and later.

Fixes: FS#3217
Tested-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years agomediatek: do not create device nodes in uci-defaults script
Sungbo Eo [Fri, 29 May 2020 11:51:01 +0000 (20:51 +0900)]
mediatek: do not create device nodes in uci-defaults script

Since commit 298814e6be76 ("base-files: config_generate: split macaddr with
multiple ifaces") uci MAC address setup will create a device node for each
member iface. But this script might override the device nodes and interfere
with the MAC address setup.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years agotreewide: kernel: drop redundant USB_EHCI_HCD=n config symbol
Petr Štetiar [Thu, 9 Jul 2020 07:04:54 +0000 (09:04 +0200)]
treewide: kernel: drop redundant USB_EHCI_HCD=n config symbol

Commit e53ec043bae1 ("kirkwood: move usb support to modules") has moved
this config symbol into generic configs, so it could be removed from
other configs.

Suggested-by: Aleksander Jan Bajkowski <A.Bajkowski@stud.elka.pw.edu.pl>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years agoath79: add support for D-Link DAP-1330/DAP-1365 A1
Sebastian Schaper [Wed, 3 Jun 2020 19:15:09 +0000 (21:15 +0200)]
ath79: add support for D-Link DAP-1330/DAP-1365 A1

Port device support for DAP-1330 from the ar71xx target to ath79.

Additionally, images are generated for the European through-socket
case variant DAP-1365. Both devices run the same vendor firmware, the
only difference being the DAP_SIGNATURE field in the factory header.
The vendor's Web UI will display a model string stored in the flash.

Specifications:

 * QCA9533, 8 MiB Flash, 64 MiB RAM
 * One Ethernet Port (10/100)
 * Wall-plug style case (DAP-1365 with additional socket)
 * LED bargraph RSSI indicator

Installation:

 * Web UI: http://192.168.0.50 (or different address obtained via DHCP)
   There is no password set by default
 * Recovery Web UI: Keep reset button pressed during power-on
   until LED starts flashing red, upgrade via http://192.168.0.50
 * Some modern browsers may have problems flashing via the Web UI,
   if this occurs consider booting to recovery mode and flashing via:
   curl -F \
     files=@openwrt-ath79-generic-dlink_dap-1330-a1-squashfs-factory.bin \
     http://192.168.0.50/cgi/index

The device will use the same MAC address for both wired and wireless
interfaces, however it is stored at two different locations in the flash.

Signed-off-by: Sebastian Schaper <openwrt@sebastianschaper.net>
4 years agoath79: add support for Arduino Yun
Sungbo Eo [Sun, 12 Jan 2020 12:36:23 +0000 (21:36 +0900)]
ath79: add support for Arduino Yun

Arduino Yun is a microcontroller development board, based on Atmel
ATmega32u4 and Atheros AR9331.

Specifications:
- MCU: ATmega32U4
- SoC: AR9331
- RAM: DDR2 64MB
- Flash: SPI NOR 16MB
- WiFi:
  - 2.4GHz: SoC internal
- Ethernet: 1x 10/100Mbps
- USB: 1x 2.0
- MicroSD: 1x SDHC

Notes:
- Stock firmware is based on OpenWrt AA.
- The SoC UART can be accessed only through the MCU.
  YunSerialTerminal is recommended for access to serial console.
- Stock firmware uses non-standard 250000 baudrate by default.
- The MCU can be reprogrammed from the SoC with avrdude linuxgpio.

Installation:
1.  Update U-Boot environment variables to adapt to new partition scheme.
    > setenv bootcmd "run addboard; run addtty; run addparts; run addrootfs; bootm 0x9f050000 || bootm 0x9fea0000"
    > setenv mtdparts "spi0.0:256k(u-boot)ro,64k(u-boot-env),15936k(firmware),64k(nvram),64k(art)ro"
    > saveenv
2.  Boot into stock firmware normally and perform sysupgrade with
    sysupgrade image.
    # sysupgrade -n -F /tmp/sysupgrade.bin

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years agobase-files: add functions to set or clear bit in MAC address
Sungbo Eo [Sat, 25 Jan 2020 14:06:07 +0000 (23:06 +0900)]
base-files: add functions to set or clear bit in MAC address

Some devices (e.g. Arduino Yun) need bitwise operations during MAC address
setup. This commit adds generalized versions of macaddr_setbit_la(), which
are helpful when manipulating a single bit in a MAC address.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years agomediatek: Implement sysupgrade support for Banana Pi R2
David Woodhouse [Mon, 15 Jun 2020 16:48:19 +0000 (17:48 +0100)]
mediatek: Implement sysupgrade support for Banana Pi R2

Based on work by Alexey Loukianov <lx2@lexa2.ru> and others.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agomediatek: store MAC address in boot partition on Banana Pi R2
David Woodhouse [Sun, 14 Jun 2020 13:20:36 +0000 (14:20 +0100)]
mediatek: store MAC address in boot partition on Banana Pi R2

Like many boards, the Banana Pi R2 doesn't have permanant storage of
its MAC address, and we store the first random one that the kernel
generates in order to use it later and at least be consistent.

Store it in the FAT boot partition, just as the U7623 board (and others)
do.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agomediatek: add SD card image creation for Banana Pi R2
David Woodhouse [Fri, 12 Jun 2020 10:06:38 +0000 (11:06 +0100)]
mediatek: add SD card image creation for Banana Pi R2

Based on work by Alexey Loukianov <lx2@lexa2.ru> and others.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agomediatek: use U-Boot FAT environment support for Banana Pi R2
David Woodhouse [Fri, 19 Jun 2020 22:11:48 +0000 (23:11 +0100)]
mediatek: use U-Boot FAT environment support for Banana Pi R2

Instead of building in a default environment which loads our environment
from the FAT partition....  just ask U-Boot to do it.

Submitted upstream at
https://patchwork.ozlabs.org/project/uboot/list/?series=184688

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agomediatek: fix U-Boot pinctrl setup for mt7623 eMMC
David Woodhouse [Fri, 19 Jun 2020 11:43:10 +0000 (12:43 +0100)]
mediatek: fix U-Boot pinctrl setup for mt7623 eMMC

The U-Boot pinctrl driver for mt7623 was incomplete and didn't handle the
settings required for eMMC to work.

Submitted upstream at
https://patchwork.ozlabs.org/project/uboot/list/?series=184529

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agomediatek: add mt7623 u-boot build for Banana Pi R2
David Woodhouse [Thu, 11 Jun 2020 18:32:12 +0000 (19:32 +0100)]
mediatek: add mt7623 u-boot build for Banana Pi R2

For building full SD/eMMC images for Banana Pi R2 we'll want a u-boot
image built for that platform.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agomediatek: new mt7623n preloader package for Banana Pi
David Woodhouse [Thu, 11 Jun 2020 18:33:42 +0000 (19:33 +0100)]
mediatek: new mt7623n preloader package for Banana Pi

Download the boot preloader code from the Banana Pi github repo and make
it available for bootable SD card image creation.

Supports only Banana Pi R2 for now.

Based on work by Alexey Loukianov <lx2@lexa2.ru> and others.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agomediatek: enable SATA for mt7623
David Woodhouse [Wed, 10 Jun 2020 15:23:04 +0000 (16:23 +0100)]
mediatek: enable SATA for mt7623

The MT7623 SoC has the same SATA block as the MT7622, so enable it in
MT7623 builds too and add it to the DEVICE_PACKAGES for those boards.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agomediatek/mt7623: unify features and packages, add ext4 and usb
David Woodhouse [Mon, 15 Jun 2020 08:47:09 +0000 (09:47 +0100)]
mediatek/mt7623: unify features and packages, add ext4 and usb

The supported MT7623 boards are mostly identical (what with being a
System-on-Chip and all), so unify the DEVICE_PACKAGES for them, and add
ext4 and usb support for them.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agofirmware-utils/ptgen: allow explicit placement of partitions
David Woodhouse [Sat, 13 Jun 2020 22:39:15 +0000 (23:39 +0100)]
firmware-utils/ptgen: allow explicit placement of partitions

For Banana Pi R2 we need to place the U-Boot partition at precisely 0x50000.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agomediatek: mt7623: refresh 5.4 kernel config
David Woodhouse [Wed, 17 Jun 2020 21:04:46 +0000 (22:04 +0100)]
mediatek: mt7623: refresh 5.4 kernel config

Some options were not explicitly specified, causing the kernel build to
drop to interactive mode. Set the missing options.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agofstools: update to the latest version
David Woodhouse [Wed, 17 Jun 2020 21:31:59 +0000 (22:31 +0100)]
fstools: update to the latest version

d34ea8e Use autoclear for overlay loopback device

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoath79: add support for D-Link DCH-G020 Rev. A1
Sebastian Schaper [Wed, 13 May 2020 15:37:31 +0000 (17:37 +0200)]
ath79: add support for D-Link DCH-G020 Rev. A1

The DCH-G020 is a Smart Home Gateway for Z-Wave devices.

Specifications:

 * QCA9531, 16 MiB Flash, 64 MiB RAM
 * On-Board USB SD3503A Z-Wave dongle
 * GL850 USB 2.0 Hub (one rear port, internal Z-Wave)
 * Two Ethernet Ports (10/100)

Installation:

 * Web UI: http://192.168.0.60 (or different address obtained via DHCP)
   Login with 'admin' and the 6-digit PIN Code from the bottom label
 * Recovery Web UI: Keep reset button pressed during power-on
   until LED starts flashing red, upgrade via http://192.168.0.60
 * Some modern browsers may have problems flashing via the Web UI,
   if this occurs consider booting to recovery mode and flashing via:
   curl -F \
     files=@openwrt-ath79-generic-dlink_dch-g020-a1-squashfs-factory.bin \
     http://192.168.0.60/cgi/index

Known issues:

 * Real-Time-Clock is not working as there is currently no matching driver
   It is still included in the dts as compatible = "pericom,pt7c43390";
 * openzwave was tested on v19.07 (running MinOZW as a proof-of-concept),
   but the package grew too big as lots of device pictures were included,
   thus any use of Z-Wave is up to the user (e.g. extroot and domoticz)

The device will use the same MAC address for both wired and wireless
interfaces, however it is stored at two different locations in the flash.

Signed-off-by: Sebastian Schaper <openwrt@sebastianschaper.net>
4 years agotarget.mk: change i386 CPU type to pentium-mmx
Rosen Penev [Sun, 12 Jan 2020 04:44:34 +0000 (20:44 -0800)]
target.mk: change i386 CPU type to pentium-mmx

f4f8f4a180366ee90fd8e153213db2cb746ca361 broke ffmpeg compilation with x86

The reason is that ffmpeg's x86 assembly requires at least MMX, which the
pentium CPU_TYPE was preventing.

Fixes ffmpeg compilation on x86_legacy and x86_geode.

Ref: https://github.com/openwrt/openwrt/pull/3061
Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years agoipq806x: compile in schedutil governor
John Audia [Wed, 8 Jul 2020 18:43:04 +0000 (14:43 -0400)]
ipq806x: compile in schedutil governor

Gives users a third option to augment ondemand and performance. Kernel
docs[1] explain differences and this PR empowers users w/ the choice to
select between the older ondemand and newer and more simplistic schedutil
should they wish to use one that is not the performance governor.

1. Documentation/admin-guide/pm/cpufreq.rst

Signed-off-by: John Audia <graysky@archlinux.us>
[fixed From: to match SoB:]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years agoramips: mt7621: use lzma-loader for ra21s & rg21s
Furkan Alaca [Fri, 3 Jul 2020 05:51:03 +0000 (01:51 -0400)]
ramips: mt7621: use lzma-loader for ra21s & rg21s

The rg21s fails to boot if the kernel is larger than about
2,376 KiB. The ra21s is virtually identical hardware.
Enabling lzma-loader resolves the issue on both the rg21s
and ra21s (see FS#3057 on the issue tracker).

Fixes: FS#3057
Signed-off-by: Furkan Alaca <furkan.alaca@queensu.ca>
4 years agoramips: add support for ZyXEL Keenetic Lite Rev.B
Sergei Burakov [Thu, 28 May 2020 18:24:55 +0000 (21:24 +0300)]
ramips: add support for ZyXEL Keenetic Lite Rev.B

Device specification:

SoC: RT5350
CPU Frequency: 360 MHz
Flash Chip: Macronix MX25L6406E (8192 KiB)
RAM: Winbond W9825G6JH-6 (32768 KiB)
5x 10/100 Mbps Ethernet (4x LAN, 1x WAN)
1x external antenna
UART (J1) header on PCB (57800 8n1)
Wireless: SoC-intergated: 2.4GHz 802.11bgn
USB: None
8x LED, 2x button

Flash instruction:

Configure PC with static IP 192.168.99.8/24 and start TFTP server.
Rename "openwrt-ramips-rt305x-zyxel_keenetic-lite-b-squashfs-sysupgrade.bin"
to "rt305x_firmware.bin" and place it in TFTP server directory.
Connect PC with one of LAN ports, press the reset button, power up
the router and keep button pressed until power LED start blinking.
Router will download file from TFTP server, write it to flash and reboot.

Signed-off-by: Sergei Burakov <senior.anonymous@ya.ru>
4 years agoramips: move adslr_g7 in image/mt7621.mk to keep sorting
Adrian Schmutzler [Wed, 8 Jul 2020 19:18:12 +0000 (21:18 +0200)]
ramips: move adslr_g7 in image/mt7621.mk to keep sorting

Move this device to the top to maintain alphabetic sorting in the
file.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agoramips: add missing kmod-mt7615-firmware for TP-Link RE500 v1
Adrian Schmutzler [Wed, 8 Jul 2020 19:12:27 +0000 (21:12 +0200)]
ramips: add missing kmod-mt7615-firmware for TP-Link RE500 v1

Adding this has been overlooked when rebasing the commit prior to
merge.

Fixes: ba0f4f0cfddc ("ramips: add support for TP-Link RE500 v1")
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agokernel: iscsi-initator: fix missing dependency
Petr Štetiar [Wed, 8 Jul 2020 19:11:40 +0000 (21:11 +0200)]
kernel: iscsi-initator: fix missing dependency

Fixes following issue:

 Package kmod-iscsi-initiator is missing dependencies for the following libraries:
 crypto_hash.ko

Fixes: b88f8202c4ce ("kernel: add iscsi-initator support")
Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years agoipq40xx: fix patches on dts Makefile
Adrian Schmutzler [Wed, 8 Jul 2020 15:48:15 +0000 (17:48 +0200)]
ipq40xx: fix patches on dts Makefile

The patches for arch/arm/boot/dts/Makefile have not been updated
in a syntactically correct way (just body was changed). Fix it.

Fixes: 4a77a060ab62 ("ipq40xx: add support for Buffalo WTR-M2133HP")
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agoramips: add support for ZyXEL WAP6805 (Altibox WiFi+)
Bjørn Mork [Wed, 18 Apr 2018 19:57:52 +0000 (21:57 +0200)]
ramips: add support for ZyXEL WAP6805 (Altibox WiFi+)

Hardware
--------
SoC:   MediaTek MT7621ST
WiFi:  MediaTek MT7603
       Quantenna QT3840BC
Flash: 128M NAND
RAM:   64M
LED:   Dual colour red and green
BTN:   Reset
       WPS
Eth:   4 x 10/100/1000 connected to MT7621 internal switch
       MT7621 RGMII port connected to Quantenna module
GPIO:  Power/reset of Quantenna module

Quantenna module
----------------

The Quantenna QT3840BC (or QV840) is a separate SoC running
another Linux installation.  It is mounted on a wide mini-PCIe
form factor module, but is connected to the RGMII port of
the MT7621.  It loads both a second uboot stage and an os
image from the MT7621 using tftp.  The module is configured
using Quantenna specific RPC calls over IP, using 802.1q
over the RGMII link to support multiple SSIDs.

There is no support for using this module as a WiFi device
in OpenWrt. A package with basic firmware and management
tools is being prepared.

Serial ports
------------

Two serial ports with headers:

RRJ1 - 115200 8N1 - Connected to the Quantenna console
J1   -  57600 8N1 - Connected to the MT7621 console

Both share pinout with many other Zyxel/Mitrastar devices:

1 - NC (VDD)
2 - TX
3 - RX
4 - NC (no pin)
5 - GND

Dual system partitions
----------------------

The vendor firmware and boot loader use a dual partition
scheme storing a counter in the header of each partition. The
partition with the highest number will be selected for boot.

OpenWrt does not support this scheme and will always use the
first OS partition.  It will reset both counters to zero the
first time sysupgrade is run, making sure the first partition
is selected by the boot loader.

Installation from vendor firmware
---------------------------------

1. Run a DHCP server. The WAP6805 is configured as a client device
   and does not have a default static IP address. Make a note of
   which address it is assigned

2. tftp the OpenWrt initramfs-kernel.bin image to this address.
   Wait for the WAP6805 to reboot.

3. ssh to the OpenWrt initramfs system on 192.168.1.1. Make a
   backup of all mtd partitions now.  The last used OEM image is
   still present in either "Kernel" or "Kernel2" at this point,
   and can be restored later if you save a copy.

4. sysupgrade to the OpenWrt sysupgrade.bin image.

Installation from U-Boot
------------------------

This requires serial console access

1. Copy the OpenWrt initramfs-kernel.bin image as "ras.bin" to
   your tftp server directory.  Configure the server address as
   192.168.0.33/24

2. Hit ESC when the message "Hit ESC key to stop autoboot"
   appears

3. Type "ATGU" + Enter, and then "2" immediately after pressing enter.

4. Answer Y to the question "Erase Linux in Flash then burn new
   one. Are you sure?", and answer the address/filename questions.
   Defaults:
        Input device IP (192.168.0.2)
        Input server IP (192.168.0.33)
        Input Linux Kernel filename ("ras.bin")

5. Wait until after you see the message "Done!" and power cycle
   the device.  It will hang after flashing.

6. Continue with step 3 and 4 from the vendor firmware procedure.

Notes on the WAP6805 U-Boot
---------------------------
The bootloader has been modified with both ZyXELs zyloader and the
device specific dual partition scheme.  These changes appear to have
broken a few things.  The zyloader shell claims to support a number
of ZyXEL AT commands, but not all of them work.  The image selection
scheme is unreliable and inconsistent.  A limited U-Boot menu is
available - and used by the above U-Boot install procedure.  But
direct booting into an uploaded image does not work, neither with
ram nor with flash.  Flashing works, but requires a hard reset after
it is finished.

Reverting to OEM firmware
-------------------------

The OEM firmware can be restored by using mtd write from OpenWrt,
flashing it to the "Kernel" partition. E.g.

  ssh root@192.168.1.1 "mtd -r -e Kernel write - Kernel" < oem.bin

OEM firmwares for the WAP6805 are not avaible for public download,
so a backup of the original installation is required.  See above.

Alternatively, firmware for the WAP6806 (Armor X1) may be used. This
is exactly the same hardware.  But the branding features do obviously
differ.

LED controller
--------------

Hardware implementation is unknown.  The dual-color LED is controlled
by 3 GPIOs:

  4: red
  7: blinking green
 13: green

Enabling both red and green makes the LED appear yellow.

The boot loader enables hardware blinking, causing the green LED to blink
slowly on power-on, until the OpenWrt boot mode starts a faster software
blink.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
[fix alphabetic sorting for image build statement]
Signed-off-by: Petr Štetiar <ynezz@true.cz>