Switch to OpenWrt 18.06 branch

This commit is contained in:
Matthias Schiffer 2018-07-10 22:57:40 +02:00
parent fcd5f183ee
commit 210d97c53e
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C
135 changed files with 976 additions and 13552 deletions

2
.gitignore vendored
View File

@ -1,5 +1,5 @@
*~
/lede
/openwrt
/output
/site
/tmp

View File

@ -1,7 +1,7 @@
The code of Project Gluon may be distributed under the following terms, unless
noted otherwise in individual files or subtrees.
Copyright (c) 2013-2017, Project Gluon
Copyright (c) 2013-2018, Project Gluon
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -25,10 +25,11 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
LEDE and OpenWrt are licensed under the terms of the GNU General Public License
Version 2, which can be found at lede/LICENSE after the lede repository has been
OpenWrt is licensed under the terms of the GNU General Public License Version 2,
which can be found at openwrt/LICENSE after the OpenWrt repository has been
obtained. This applies to the following repositories:
* lede
* openwrt
* packages/openwrt
* packages/routing
* packages/luci

View File

@ -67,13 +67,13 @@ define GluonTarget
gluon_target := $(1)$$(if $(2),-$(2))
GLUON_TARGETS += $$(gluon_target)
GLUON_TARGET_$$(gluon_target)_BOARD := $(1)
GLUON_TARGET_$$(gluon_target)_SUBTARGET := $(if $(3),$(3),$(2))
GLUON_TARGET_$$(gluon_target)_SUBTARGET := $(2)
endef
include targets/targets.mk
LEDEMAKE = $(MAKE) -C lede
OPENWRTMAKE = $(MAKE) -C openwrt
BOARD := $(GLUON_TARGET_$(GLUON_TARGET)_BOARD)
SUBTARGET := $(GLUON_TARGET_$(GLUON_TARGET)_SUBTARGET)
@ -86,15 +86,15 @@ GLUON_CONFIG_VARS := \
BOARD='$(BOARD)' \
SUBTARGET='$(SUBTARGET)'
LEDE_TARGET := $(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))
OPENWRT_TARGET := $(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))
export LEDE_TARGET
export OPENWRT_TARGET
CheckTarget := [ '$(LEDE_TARGET)' ] \
CheckTarget := [ '$(OPENWRT_TARGET)' ] \
|| (echo 'Please set GLUON_TARGET to a valid target. Gluon supports the following targets:'; $(foreach target,$(GLUON_TARGETS),echo ' * $(target)';) false)
CheckExternal := test -d lede || (echo 'You don'"'"'t seem to have obtained the external repositories needed by Gluon; please call `make update` first!'; false)
CheckExternal := test -d openwrt || (echo 'You don'"'"'t seem to have obtained the external repositories needed by Gluon; please call `make update` first!'; false)
define CheckSite
@GLUON_SITEDIR='$(GLUON_SITEDIR)' GLUON_SITE_CONFIG='$(1).conf' $(LUA) scripts/site_config.lua \
@ -126,21 +126,21 @@ config: FORCE
@$(GLUON_CONFIG_VARS) \
scripts/target_config.sh '$(GLUON_TARGET)' '$(GLUON_PACKAGES)' \
> lede/.config
+@$(LEDEMAKE) defconfig
> openwrt/.config
+@$(OPENWRTMAKE) defconfig
@$(GLUON_CONFIG_VARS) \
scripts/target_config_check.sh '$(GLUON_TARGET)' '$(GLUON_PACKAGES)'
LUA := lede/staging_dir/hostpkg/bin/lua
LUA := openwrt/staging_dir/hostpkg/bin/lua
$(LUA):
@$(CheckExternal)
+@[ -e lede/.config ] || $(LEDEMAKE) defconfig
+@$(LEDEMAKE) tools/install
+@$(LEDEMAKE) package/lua/host/install
+@[ -e openwrt/.config ] || $(OPENWRTMAKE) defconfig
+@$(OPENWRTMAKE) tools/install
+@$(OPENWRTMAKE) package/lua/host/compile
prepare-target: config $(LUA) ;
@ -148,15 +148,15 @@ all: prepare-target
$(foreach conf,site $(patsubst $(GLUON_SITEDIR)/%.conf,%,$(wildcard $(GLUON_SITEDIR)/domains/*.conf)),$(call CheckSite,$(conf)))
@scripts/clean_output.sh
+@$(LEDEMAKE)
+@$(OPENWRTMAKE)
@GLUON_SITEDIR='$(GLUON_SITEDIR)' scripts/copy_output.sh '$(GLUON_TARGET)'
clean download: config
+@$(LEDEMAKE) $@
+@$(OPENWRTMAKE) $@
dirclean: FORCE
+@[ -e lede/.config ] || $(LEDEMAKE) defconfig
+@$(LEDEMAKE) dirclean
+@[ -e openwrt/.config ] || $(OPENWRTMAKE) defconfig
+@$(OPENWRTMAKE) dirclean
@rm -rf $(GLUON_TMPDIR) $(GLUON_OUTPUTDIR)
manifest: $(LUA) FORCE

View File

@ -14,7 +14,7 @@ is a requirement.
Adding profiles
---------------
The vast majority of devices with ath9k WLAN is based on the ar71xx target of LEDE.
The vast majority of devices with ath9k WLAN is based on the ar71xx target of OpenWrt.
If the hardware you want to add support for is ar71xx, adding a new profile
is sufficient.
@ -35,9 +35,9 @@ While porting Gluon to a new device, it might happen that the profile name is un
known. Best practise is to generate an image first by using an arbitrary value
and then executing the lua command on the device and use its output from then on.
The second parameter defines the name of the image files generated by LEDE. Usually,
it is also the LEDE profile name; for devices that still use the old image build
code, a third parameter with the LEDE profile name can be passed. The profile names
The second parameter defines the name of the image files generated by OpenWrt. Usually,
it is also the OpenWrt profile name; for devices that still use the old image build
code, a third parameter with the OpenWrt profile name can be passed. The profile names
can be found in the image Makefiles in ``lede/target/linux/<target>/image/Makefile``.
Examples::
@ -49,7 +49,7 @@ Suffixes and extensions
'''''''''''''''''''''''
By default, image files are expected to have the extension ``.bin``. In addition,
the images generated by LEDE have a suffix before the extension that defaults to
the images generated by OpenWrt have a suffix before the extension that defaults to
``-squashfs-factory`` and ``-squashfs-sysupgrade``.
This can be changed using the ``factory`` and ``sysupgrade`` commands, either at
@ -66,14 +66,14 @@ are given, this signals that no factory (or sysupgrade) image exists.
Aliases
'''''''
Sometimes multiple models use the same LEDE images. In this case, the ``alias``
Sometimes multiple models use the same OpenWrt images. In this case, the ``alias``
command can be used to create symlinks and additional entries in the autoupdater
manifest for the alternative models.
Standalone images
'''''''''''''''''
On targets without *per-device rootfs* support in LEDE, the commands described above
On targets without *per-device rootfs* support in OpenWrt, the commands described above
can't be used. Instead, ``factory_image`` and ``sysupgrade_image`` are used::
factory_image PROFILE IMAGE .EXT
@ -81,14 +81,14 @@ can't be used. Instead, ``factory_image`` and ``sysupgrade_image`` are used::
Again, the profile name must match the value printed by the aforementioned Lua
command. The image name must match the part between the target name and the extension
as generated by LEDE and is to be omitted when no such part exists.
as generated by OpenWrt and is to be omitted when no such part exists.
Packages
''''''''
The ``packages`` command takes an arbitrary number of arguments. Each argument
defines an additional package to include in the images in addition to the default
package sets defined by LEDE. When a package name is prefixed by a minus sign, the
package sets defined by OpenWrt. When a package name is prefixed by a minus sign, the
packages are excluded instead.
The ``packages`` command may be used at the top of a target definition to modify
@ -99,7 +99,7 @@ target supports *per-default rootfs*).
Configuration
'''''''''''''
The ``config`` command allows to add arbitary target-specific LEDE configuration
The ``config`` command allows to add arbitary target-specific OpenWrt configuration
to be emitted to ``.config``.
Notes
@ -109,7 +109,7 @@ On devices with multiple WLAN adapters, care must also be taken that the primary
configured correctly. ``/lib/gluon/core/sysconfig/primary_mac`` should contain the MAC address which
can be found on a label on most hardware; if it does not, ``/lib/gluon/upgrade/010-primary-mac``
in ``gluon-core`` might need a fix. (There have also been cases in which the address was incorrect
even on devices with only one WLAN adapter, in these cases a LEDE bug was the cause).
even on devices with only one WLAN adapter, in these cases a OpenWrt bug was the cause).
Adding support for new hardware targets
@ -137,8 +137,8 @@ Build system support
A definition for the new target must be created under ``targets``, and it must be added
to ``targets/targets.mk``. The ``GluonTarget`` macro takes one to three arguments:
the target name, the Gluon subtarget name (if the target has subtargets), and the
LEDE subtarget name (if it differs from the Gluon subtarget). The third argument
OpenWrt subtarget name (if it differs from the Gluon subtarget). The third argument
can be used to define multiple Gluon targets with different configuration for the
same LEDE target, like it is done for the ``ar71xx-tiny`` target.
same OpenWrt target, like it is done for the ``ar71xx-tiny`` target.
After this, is should be sufficient to call ``make GLUON_TARGET=<target>`` to build the images for the new target.

View File

@ -58,7 +58,7 @@ script in the ``contrib`` directory:
The same command can be run again to update the template.
In addition, the Makefile must be adjusted. Instead of LEDE's default *package.mk*,
In addition, the Makefile must be adjusted. Instead of OpenWrt's default *package.mk*,
the Gluon version (``../gluon.mk`` for core packages) must be used. The i18n files must be installed
and PKG_CONFIG_DEPENDS must be added::

View File

@ -19,7 +19,7 @@ GLUON_FEATURES := \
web-wizard
## GLUON_SITE_PACKAGES
# Specify additional Gluon/LEDE packages to include here;
# Specify additional Gluon/OpenWrt packages to include here;
# A minus sign may be prepended to remove a packages from the
# selection that would be enabled by default or due to the
# chosen feature flags

View File

@ -94,7 +94,7 @@ You should generally reserve 5GB of disk space and additionally about 10GB for e
The built images can be found in the directory `output/images`. Of these, the `factory`
images are to be used when flashing from the original firmware a device came with,
and `sysupgrade` is to upgrade from other versions of Gluon or any other OpenWrt/LEDE-based
and `sysupgrade` is to upgrade from other versions of Gluon or any other OpenWrt-based
system.
**Note:** The images for some models are identical; to save disk space, symlinks are generated instead
@ -122,12 +122,12 @@ will clean the entire tree, so the toolchain will be rebuilt as well, which will
opkg repositories
-----------------
Gluon is mostly compatible with LEDE, so the normal LEDE package repositories
Gluon is mostly compatible with OpenWrt, so the normal OpenWrt package repositories
can be used for Gluon as well.
This is not true for kernel modules; the Gluon kernel is incompatible with the
kernel of the default LEDE images. Therefore, Gluon will not only generate images,
but also an opkg repository containing all core packages provided by LEDE,
kernel of the default OpenWrt images. Therefore, Gluon will not only generate images,
but also an opkg repository containing all core packages provided by OpenWrt,
including modules for the kernel of the generated images.
Signing keys
@ -136,11 +136,11 @@ Signing keys
Gluon does not support HTTPS for downloading packages; fortunately, opkg deploys
public-key cryptography to ensure package integrity.
The Gluon images will contain public keys from two sources: the official LEDE keyring
The Gluon images will contain public keys from two sources: the official OpenWrt keyring
(to allow installing userspace packages) and a Gluon-specific key (which is used
to sign the generated package repository).
LEDE will handle the generation and handling of the keys itself.
OpenWrt will handle the generation and handling of the keys itself.
When making firmware releases based on Gluon, it might make sense to store
the keypair, so updating the module repository later is possible.

View File

@ -67,8 +67,8 @@ opkg \: optional
There are two optional fields in the ``opkg`` section:
- ``lede`` overrides the default LEDE repository URL. The default URL would
correspond to ``http://downloads.lede-project.org/snapshots/packages/%A``
- ``openwrt`` overrides the default OpenWrt repository URL. The default URL would
correspond to ``http://downloads.openwrt.org/snapshots/packages/%A``
and usually doesn't need to be changed when nodes are expected to have IPv6
internet connectivity.
- ``extra`` specifies a table of additional repositories (with arbitrary keys)
@ -76,7 +76,7 @@ opkg \: optional
::
opkg = {
lede = 'http://opkg.services.ffac/lede/snapshots/packages/%A',
openwrt = 'http://opkg.services.ffac/openwrt/snapshots/packages/%A',
extra = {
gluon = 'http://opkg.services.ffac/modules/gluon-%GS-%GR/%S',
},
@ -84,8 +84,8 @@ opkg \: optional
There are various patterns which can be used in the URLs:
- ``%n`` is replaced by the LEDE version codename
- ``%v`` is replaced by the LEDE version number (e.g. "17.01")
- ``%d`` is replaced by the OpenWrt distribution name ("openwrt")
- ``%v`` is replaced by the OpenWrt version number (e.g. "17.01")
- ``%S`` is replaced by the target board (e.g. "ar71xx/generic")
- ``%A`` is replaced by the target architecture (e.g. "mips_24kc")
- ``%GS`` is replaced by the Gluon site code (as specified in ``site.conf``)

24
modules
View File

@ -1,20 +1,20 @@
GLUON_FEEDS='openwrt gluon routing luci'
GLUON_FEEDS='packages routing luci gluon'
LEDE_REPO=https://git.openwrt.org/openwrt/openwrt.git
LEDE_BRANCH=lede-17.01
LEDE_COMMIT=b6a1f43075f96b0028e33ed1af1fe31068791d24
OPENWRT_REPO=https://git.openwrt.org/openwrt/openwrt.git
OPENWRT_BRANCH=openwrt-18.06
OPENWRT_COMMIT=b84a07b3803bd39d0a1eb1b040718a023b8f7971
PACKAGES_OPENWRT_REPO=https://github.com/openwrt/packages.git
PACKAGES_OPENWRT_BRANCH=lede-17.01
PACKAGES_OPENWRT_COMMIT=338690b2f79e2c7090be4e9adbb19b452c9e3c36
PACKAGES_GLUON_REPO=https://github.com/freifunk-gluon/packages.git
PACKAGES_GLUON_COMMIT=be2c35785994e443d895225c7240474a46f64f5e
PACKAGES_PACKAGES_REPO=https://github.com/openwrt/packages.git
PACKAGES_PACKAGES_BRANCH=openwrt-18.06
PACKAGES_PACKAGES_COMMIT=05b9aceb00725b69220defaaad11f24b63731ac3
PACKAGES_ROUTING_REPO=https://github.com/openwrt-routing/packages.git
PACKAGES_ROUTING_BRANCH=openwrt-18.06
PACKAGES_ROUTING_COMMIT=1b9d1c419f0ecefda51922a7845ab2183d6acd76
PACKAGES_LUCI_REPO=https://github.com/openwrt/luci.git
PACKAGES_LUCI_BRANCH=lede-17.01
PACKAGES_LUCI_COMMIT=1f014bd2180b364bec4c3f6457f72a0621884f9a
PACKAGES_LUCI_BRANCH=openwrt-18.06
PACKAGES_LUCI_COMMIT=4ba85e3d82b684262c570e38a72d2dc3bb712a13
PACKAGES_GLUON_REPO=https://github.com/freifunk-gluon/packages.git
PACKAGES_GLUON_COMMIT=be2c35785994e443d895225c7240474a46f64f5e

View File

@ -1,10 +0,0 @@
# LEDE doesn't have a nice way to set the list of feeds in
# /etc/opkg/distfeeds.conf, so we use this overlay file (which is included by
# the opkg package Makefile though LEDE's IncludeOverlay mechanism).
# The following definitions make /etc/opkg/distfeeds.conf match the one included
# in official LEDE builds (by default, FEEDS_DISABLED contains the original list
# of feeds (which are unused by Gluon), and FEEDS_ENABLED our own feed list).
FEEDS_ENABLED := $(FEEDS_DISABLED)
FEEDS_DISABLED :=

View File

@ -23,7 +23,7 @@ end
need_string_match(in_domain({'domain_seed'}), '^' .. ('%x'):rep(64) .. '$')
need_string({'opkg', 'lede'}, false)
need_string({'opkg', 'openwrt'}, false)
need_table({'opkg', 'extra'}, function(extra_repo)
need_alphanumeric_key(extra_repo)
need_string(extra_repo)

View File

@ -14,8 +14,8 @@ local util = require 'gluon.util'
local subst = {}
local f = io.popen('. /etc/openwrt_release; echo "$DISTRIB_CODENAME"; echo "$DISTRIB_RELEASE"; echo "$DISTRIB_TARGET"; echo "$DISTRIB_ARCH"')
subst['%%n'] = f:read()
local f = io.popen('. /etc/os-release; echo "$ID"; echo "$VERSION_ID"; echo "$LEDE_BOARD"; echo "$LEDE_ARCH"')
subst['%%d'] = f:read()
subst['%%v'] = f:read():gsub('-SNAPSHOT', '')
subst['%%S'] = f:read()
subst['%%A'] = f:read()
@ -25,7 +25,7 @@ subst['%%GS'] = site.site_code()
subst['%%GV'] = util.trim(fs.readfile('/lib/gluon/gluon-version'))
subst['%%GR'] = util.trim(fs.readfile('/lib/gluon/release'))
local prefix = subst['%%n'] .. '_'
local prefix = subst['%%d'] .. '_'
local function replace_patterns(url)
@ -37,7 +37,7 @@ local function replace_patterns(url)
end
local lede = site.opkg.lede()
local openwrt = site.opkg.openwrt()
local extra = site.opkg.extra({})
@ -52,8 +52,8 @@ for _, line in ipairs(distfeeds) do
local name = line:match('^src/gz%s' .. prefix .. '(%S+)%s')
if name == 'core' then
f:write('# ' .. line .. '\n')
elseif name and lede then
f:write(string.format('src/gz %s %s/%s\n', prefix .. name, replace_patterns(lede), name))
elseif name and openwrt then
f:write(string.format('src/gz %s %s/%s\n', prefix .. name, replace_patterns(openwrt), name))
else
f:write(line .. '\n')
end

View File

@ -1,111 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sat, 14 Jan 2017 18:13:14 +0100
Subject: build: move STAGING_DIR_HOSTPKG and BUILD_DIR_HOST back to a common directory for all targets
$(STAGING_DIR)/host is kept in addition to $(STAGING_DIR_HOSTPKG) in most
places; it is still used as destination for host files in Build/InstallDev.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/Makefile b/Makefile
index b220dfd3c56a11f3e27d70e3d6e58cc6448abd2f..c1a7285c83df310e987eaef8376500d2b614eafb 100644
--- a/Makefile
+++ b/Makefile
@@ -55,7 +55,7 @@ clean: FORCE
rm -rf $(BUILD_DIR) $(STAGING_DIR) $(BIN_DIR) $(OUTPUT_DIR)/packages/$(ARCH_PACKAGES) $(BUILD_LOG_DIR) $(TOPDIR)/staging_dir/packages
dirclean: clean
- rm -rf $(STAGING_DIR_HOST) $(TOOLCHAIN_DIR) $(BUILD_DIR_HOST) $(BUILD_DIR_TOOLCHAIN)
+ rm -rf $(STAGING_DIR_HOST) $(STAGING_DIR_HOSTPKG) $(TOOLCHAIN_DIR) $(BUILD_DIR_BASE)/host $(BUILD_DIR_BASE)/hostpkg $(BUILD_DIR_TOOLCHAIN)
rm -rf $(TMP_DIR)
ifndef DUMP_TARGET_DB
diff --git a/include/autotools.mk b/include/autotools.mk
index c6aa47e0bef311697b4def7a7183d1ac59dcf599..7bd400ab36d052b39fcb76a66873c8673eb189a0 100644
--- a/include/autotools.mk
+++ b/include/autotools.mk
@@ -75,7 +75,7 @@ define autoreconf_target
$(strip $(call autoreconf, \
$(PKG_BUILD_DIR), $(PKG_REMOVE_FILES), \
$(PKG_AUTOMAKE_PATHS), $(PKG_LIBTOOL_PATHS), \
- $(STAGING_DIR)/host/share/aclocal $(STAGING_DIR)/usr/share/aclocal $(PKG_MACRO_PATHS)))
+ $(STAGING_DIR)/host/share/aclocal $(STAGING_DIR_HOSTPKG)/share/aclocal $(STAGING_DIR)/usr/share/aclocal $(PKG_MACRO_PATHS)))
endef
define patch_libtool_target
diff --git a/include/cmake.mk b/include/cmake.mk
index 5a403cbf41e2bbd6bdb843492639a01aff8cf75b..900dae1d4afc6007f8ac04179dd7f0922a07d4fa 100644
--- a/include/cmake.mk
+++ b/include/cmake.mk
@@ -34,7 +34,7 @@ CMAKE_NM:=$(call cmake_tool,$(TARGET_NM))
CMAKE_RANLIB:=$(call cmake_tool,$(TARGET_RANLIB))
CMAKE_FIND_ROOT_PATH:=$(STAGING_DIR)/usr;$(TOOLCHAIN_DIR)$(if $(CONFIG_EXTERNAL_TOOLCHAIN),;$(CONFIG_TOOLCHAIN_ROOT))
-CMAKE_HOST_FIND_ROOT_PATH:=$(STAGING_DIR)/host;$(STAGING_DIR_HOST)
+CMAKE_HOST_FIND_ROOT_PATH:=$(STAGING_DIR)/host;$(STAGING_DIR_HOSTPKG);$(STAGING_DIR_HOST)
CMAKE_SHARED_LDFLAGS:=-Wl,-Bsymbolic-functions
define Build/Configure/Default
diff --git a/include/host-build.mk b/include/host-build.mk
index 5fcec7ebf48361100d29c5925beaae4f36d5ac7b..485f09a6b71b881692b5ee575927397259bbac24 100644
--- a/include/host-build.mk
+++ b/include/host-build.mk
@@ -126,7 +126,7 @@ ifneq ($(if $(HOST_QUILT),,$(CONFIG_AUTOREBUILD)),)
endif
define Host/Exports/Default
- $(1) : export ACLOCAL_INCLUDE=$$(foreach p,$$(wildcard $$(STAGING_DIR_HOST)/share/aclocal $$(STAGING_DIR_HOST)/share/aclocal-* $(if $(IS_PACKAGE_BUILD),$$(STAGING_DIR)/host/share/aclocal $$(STAGING_DIR)/host/share/aclocal-*)),-I $$(p))
+ $(1) : export ACLOCAL_INCLUDE=$$(foreach p,$$(wildcard $$(STAGING_DIR_HOST)/share/aclocal $$(STAGING_DIR_HOST)/share/aclocal-* $(if $(IS_PACKAGE_BUILD),$$(STAGING_DIR)/host/share/aclocal $$(STAGING_DIR_HOSTPKG)/share/aclocal $$(STAGING_DIR)/host/share/aclocal-*)),-I $$(p))
$(1) : export STAGING_PREFIX=$$(HOST_BUILD_PREFIX)
$(1) : export PKG_CONFIG_PATH=$$(STAGING_DIR_HOST)/lib/pkgconfig:$$(HOST_BUILD_PREFIX)/lib/pkgconfig
$(1) : export PKG_CONFIG_LIBDIR=$$(HOST_BUILD_PREFIX)/lib/pkgconfig
diff --git a/include/package.mk b/include/package.mk
index e9989ab13ec81a8751ee7245639ee0b82b9a87b2..7f77c4e99b1e9b79503963c497c4c87d7af9d71a 100644
--- a/include/package.mk
+++ b/include/package.mk
@@ -130,7 +130,7 @@ ifdef USE_SOURCE_DIR
endif
define Build/Exports/Default
- $(1) : export ACLOCAL_INCLUDE=$$(foreach p,$$(wildcard $$(STAGING_DIR)/usr/share/aclocal $$(STAGING_DIR)/usr/share/aclocal-* $$(STAGING_DIR)/host/share/aclocal $$(STAGING_DIR)/host/share/aclocal-*),-I $$(p))
+ $(1) : export ACLOCAL_INCLUDE=$$(foreach p,$$(wildcard $$(STAGING_DIR)/usr/share/aclocal $$(STAGING_DIR)/usr/share/aclocal-* $$(STAGING_DIR_HOSTPKG)/share/aclocal $$(STAGING_DIR_HOSTPKG)/share/aclocal-* $$(STAGING_DIR)/host/share/aclocal $$(STAGING_DIR)/host/share/aclocal-*),-I $$(p))
$(1) : export STAGING_PREFIX=$$(STAGING_DIR)/usr
$(1) : export PATH=$$(TARGET_PATH_PKG)
$(1) : export CONFIG_SITE:=$$(CONFIG_SITE)
diff --git a/rules.mk b/rules.mk
index 5710a84fe7ad24e45acb2ef62ee29eab37e8de06..b678e9bea5bc146a3c515d93003415cd21882068 100644
--- a/rules.mk
+++ b/rules.mk
@@ -147,9 +147,9 @@ STAGING_DIR_ROOT:=$(STAGING_DIR)/root-$(BOARD)
BUILD_LOG_DIR:=$(TOPDIR)/logs
PKG_INFO_DIR := $(STAGING_DIR)/pkginfo
-BUILD_DIR_HOST:=$(if $(IS_PACKAGE_BUILD),$(BUILD_DIR)/host,$(BUILD_DIR_BASE)/host)
+BUILD_DIR_HOST:=$(if $(IS_PACKAGE_BUILD),$(BUILD_DIR_BASE)/hostpkg,$(BUILD_DIR_BASE)/host)
STAGING_DIR_HOST:=$(TOPDIR)/staging_dir/host
-STAGING_DIR_HOSTPKG:=$(STAGING_DIR)/host
+STAGING_DIR_HOSTPKG:=$(TOPDIR)/staging_dir/hostpkg
TARGET_PATH:=$(subst $(space),:,$(filter-out .,$(filter-out ./,$(subst :,$(space),$(PATH)))))
TARGET_INIT_PATH:=$(call qstrip,$(CONFIG_TARGET_INIT_PATH))
@@ -208,7 +208,7 @@ ifndef DUMP
endif
endif
endif
-TARGET_PATH_PKG:=$(STAGING_DIR)/host/bin:$(TARGET_PATH)
+TARGET_PATH_PKG:=$(STAGING_DIR)/host/bin:$(STAGING_DIR_HOSTPKG)/bin:$(TARGET_PATH)
ifeq ($(CONFIG_SOFT_FLOAT),y)
SOFT_FLOAT_CONFIG_OPTION:=--with-float=soft
@@ -234,9 +234,9 @@ export PKG_CONFIG
HOSTCC:=gcc
HOSTCXX:=g++
-HOST_CPPFLAGS:=-I$(STAGING_DIR_HOST)/include -I$(STAGING_DIR_HOST)/usr/include $(if $(IS_PACKAGE_BUILD),-I$(STAGING_DIR)/host/include)
+HOST_CPPFLAGS:=-I$(STAGING_DIR_HOST)/include -I$(STAGING_DIR_HOST)/usr/include $(if $(IS_PACKAGE_BUILD),-I$(STAGING_DIR_HOSTPKG)/include -I$(STAGING_DIR)/host/include)
HOST_CFLAGS:=-O2 $(HOST_CPPFLAGS)
-HOST_LDFLAGS:=-L$(STAGING_DIR_HOST)/lib -L$(STAGING_DIR_HOST)/usr/lib $(if $(IS_PACKAGE_BUILD),-L$(STAGING_DIR)/host/lib)
+HOST_LDFLAGS:=-L$(STAGING_DIR_HOST)/lib -L$(STAGING_DIR_HOST)/usr/lib $(if $(IS_PACKAGE_BUILD),-L$(STAGING_DIR_HOSTPKG)/lib -L$(STAGING_DIR)/host/lib)
ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
TARGET_AR:=$(TARGET_CROSS)gcc-ar

View File

@ -1,19 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Thu, 19 Jan 2017 00:03:32 +0100
Subject: rules.mk: export STAGING_DIR_HOSTPKG
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/rules.mk b/rules.mk
index b678e9bea5bc146a3c515d93003415cd21882068..16cab67d5d1b8b130a0ffddc81789e798cda338e 100644
--- a/rules.mk
+++ b/rules.mk
@@ -225,7 +225,7 @@ else
endif
export PATH:=$(TARGET_PATH)
-export STAGING_DIR STAGING_DIR_HOST
+export STAGING_DIR STAGING_DIR_HOST STAGING_DIR_HOSTPKG
export SH_FUNC:=. $(INCLUDE_DIR)/shell.sh;
PKG_CONFIG:=$(STAGING_DIR_HOST)/bin/pkg-config

View File

@ -1,32 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Thu, 19 Jan 2017 00:04:09 +0100
Subject: gettext-full: fix to use $STAGING_DIR_HOSTPKG instead of $STAGING_DIR/host
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/package/libs/gettext-full/patches/000-relocatable.patch b/package/libs/gettext-full/patches/000-relocatable.patch
index c14be728367b57c08024d848cf8ff847cfe865be..a95c268f5bc94ed8ec3784ae2044aa77e0322491 100644
--- a/package/libs/gettext-full/patches/000-relocatable.patch
+++ b/package/libs/gettext-full/patches/000-relocatable.patch
@@ -5,8 +5,8 @@
# Set variables
# - gettext_datadir directory where the data files are stored.
-prefix="@prefix@"
-+if [ -n "$STAGING_DIR" ]; then
-+ prefix="$STAGING_DIR/host"
++if [ -n "$STAGING_DIR_HOSTPKG" ]; then
++ prefix="$STAGING_DIR_HOSTPKG"
+else
+ prefix="@prefix@"
+fi
@@ -20,8 +20,8 @@
# Set variables
# - gettext_datadir directory where the data files are stored.
-prefix="@prefix@"
-+if [ -n "$STAGING_DIR" ]; then
-+ prefix="$STAGING_DIR/host"
++if [ -n "$STAGING_DIR_HOSTPKG" ]; then
++ prefix="$STAGING_DIR_HOSTPKG"
+else
+ prefix="@prefix@"
+fi

View File

@ -1,28 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Fri, 10 Mar 2017 01:58:42 +0100
Subject: netifd: update to git HEAD version
91810ec system-linux: add VXLAN support
f107656 netifd: Add option to configure locktime for each device
cdc0e80 interface: add prefix assignment priority support
6397f5e device: add veth support
6228d0f wireless: fix _wireless_add_process
7cc2f10 treewide: fix white space errors
diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile
index fb035864017df739a0d0b0c0451fe8488a40c77c..d6d91ba014c67f126176eba8acae5fd2c8b007ba 100644
--- a/package/network/config/netifd/Makefile
+++ b/package/network/config/netifd/Makefile
@@ -5,9 +5,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(LEDE_GIT)/project/netifd.git
-PKG_SOURCE_DATE:=2017-01-25
-PKG_SOURCE_VERSION:=650758b16e5185505a3fbc1307949340af70b611
-PKG_MIRROR_HASH:=d09c740bc1bf6269678bd75c9af52ecd4be3d1d59402a543ceb9d4459cecfa2b
+PKG_SOURCE_DATE:=2017-03-07
+PKG_SOURCE_VERSION:=91810ecc13239f3b18c8299de265b4f3531c0017
+PKG_MIRROR_HASH:=51d0a8866c6b004185f1fb83f37e7aed33fc94b72bd85954c773549a57c3c761
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_LICENSE:=GPL-2.0

View File

@ -1,83 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Wed, 12 Apr 2017 02:31:12 +0200
Subject: netifd: ubus: add interface method to trigger renew event
diff --git a/package/network/config/netifd/patches/0001-ubus-add-interface-method-to-trigger-renew-event.patch b/package/network/config/netifd/patches/0001-ubus-add-interface-method-to-trigger-renew-event.patch
new file mode 100644
index 0000000000000000000000000000000000000000..1f59498d421b7e1d3e76a1a38f604181d11c4649
--- /dev/null
+++ b/package/network/config/netifd/patches/0001-ubus-add-interface-method-to-trigger-renew-event.patch
@@ -0,0 +1,73 @@
+From 8b39c2fce4c1da3f3dcd4c6fd305c124714839e8 Mon Sep 17 00:00:00 2001
+Message-Id: <8b39c2fce4c1da3f3dcd4c6fd305c124714839e8.1491956920.git.mschiffer@universe-factory.net>
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Wed, 12 Apr 2017 02:25:33 +0200
+Subject: [PATCH] ubus: add interface method to trigger renew event
+
+proto-shell handlers may implement all kinds of renew handlers, there
+should be a way to explicitly trigger such a renew.
+
+Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
+---
+ interface.c | 8 ++++++++
+ interface.h | 1 +
+ ubus.c | 14 ++++++++++++++
+ 3 files changed, 23 insertions(+)
+
+--- a/interface.c
++++ b/interface.c
+@@ -1076,6 +1076,14 @@ interface_set_down(struct interface *ifa
+ return 0;
+ }
+
++int interface_renew(struct interface *iface)
++{
++ if (iface->state == IFS_TEARDOWN || iface->state == IFS_DOWN)
++ return -1;
++
++ return interface_proto_event(iface->proto, PROTO_CMD_RENEW, false);
++}
++
+ void
+ interface_start_pending(void)
+ {
+--- a/interface.h
++++ b/interface.h
+@@ -184,6 +184,7 @@ void interface_set_available(struct inte
+ int interface_set_up(struct interface *iface);
+ int interface_set_down(struct interface *iface);
+ void __interface_set_down(struct interface *iface, bool force);
++int interface_renew(struct interface *iface);
+
+ void interface_set_main_dev(struct interface *iface, struct device *dev);
+ void interface_set_l3_dev(struct interface *iface, struct device *dev);
+--- a/ubus.c
++++ b/ubus.c
+@@ -376,6 +376,19 @@ netifd_handle_down(struct ubus_context *
+ return 0;
+ }
+
++static int
++netifd_handle_renew(struct ubus_context *ctx, struct ubus_object *obj,
++ struct ubus_request_data *req, const char *method,
++ struct blob_attr *msg)
++{
++ struct interface *iface;
++
++ iface = container_of(obj, struct interface, ubus);
++ interface_renew(iface);
++
++ return 0;
++}
++
+ static void
+ netifd_add_interface_errors(struct blob_buf *b, struct interface *iface)
+ {
+@@ -912,6 +925,7 @@ netifd_handle_set_data(struct ubus_conte
+ static struct ubus_method iface_object_methods[] = {
+ { .name = "up", .handler = netifd_handle_up },
+ { .name = "down", .handler = netifd_handle_down },
++ { .name = "renew", .handler = netifd_handle_renew },
+ { .name = "status", .handler = netifd_handle_status },
+ { .name = "prepare", .handler = netifd_handle_iface_prepare },
+ { .name = "dump", .handler = netifd_handle_dump },

View File

@ -1,21 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Thu, 13 Jul 2017 17:15:21 +0200
Subject: procd: switch to latest master
diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile
index b905cb25aa02c4c3f82cbc288ef15648dfd66444..5b92d79332f2ea400041586b92b570d8b633218a 100644
--- a/package/system/procd/Makefile
+++ b/package/system/procd/Makefile
@@ -12,9 +12,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(LEDE_GIT)/project/procd.git
-PKG_SOURCE_DATE:=2018-01-22
-PKG_SOURCE_VERSION:=9a4036fb1b7412ab2ea4f360d2cc7e6a5e0fa6b5
-PKG_MIRROR_HASH:=669f062e9c5228ef9d09cc9904d8ce4651f0b8506a6c2fff27b21e83b26f0abb
+PKG_SOURCE_DATE:=2018-01-23
+PKG_SOURCE_VERSION:=653629f19e591a0827ab39de07b4526bb119a57a
+PKG_MIRROR_HASH:=2e0c3ae45521eea456a8411c8d9ef19ed9a5ed6c0ab38b9496555625fb4ba6a2
CMAKE_INSTALL:=1
PKG_LICENSE:=GPL-2.0

View File

@ -1,28 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Wed, 3 May 2017 08:27:40 +0200
Subject: procd: clean up trailing whitespace in nand.sh
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/package/system/procd/files/nand.sh b/package/system/procd/files/nand.sh
index ebaaf2aa16009cc1431dbb79ba9f689c8b636069..8a164ee08537014936a8608f5a60fe0e27dcabd6 100644
--- a/package/system/procd/files/nand.sh
+++ b/package/system/procd/files/nand.sh
@@ -194,7 +194,7 @@ nand_upgrade_prepare_ubi() {
nand_do_upgrade_success() {
local conf_tar="/tmp/sysupgrade.tgz"
-
+
sync
[ -f "$conf_tar" ] && nand_restore_config "$conf_tar"
echo "sysupgrade successful"
@@ -231,7 +231,7 @@ nand_upgrade_ubifs() {
local rootfs_length=`(cat $1 | wc -c) 2> /dev/null`
nand_upgrade_prepare_ubi "$rootfs_length" "ubifs" "0" "0"
-
+
local ubidev="$( nand_find_ubi "$CI_UBIPART" )"
local root_ubivol="$(nand_find_volume $ubidev rootfs)"
ubiupdatevol /dev/$root_ubivol -s $rootfs_length $1

View File

@ -1,32 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Wed, 3 May 2017 08:28:05 +0200
Subject: procd: prepare NAND sysupgrade for making upgraded dynamically linked
Use install_bin to copy upgraded with all dependencies. The old name
/tmp/upgraded is temporarily retained as a symlink to avoid breaking
things.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/package/system/procd/files/nand.sh b/package/system/procd/files/nand.sh
index 8a164ee08537014936a8608f5a60fe0e27dcabd6..6bd2005344c081df20e5a330a69e49e37225c39f 100644
--- a/package/system/procd/files/nand.sh
+++ b/package/system/procd/files/nand.sh
@@ -333,7 +333,7 @@ nand_upgrade_stage1() {
[ "$SAVE_CONFIG" != 1 -a -f "$CONF_TAR" ] &&
rm $CONF_TAR
- ubus call system nandupgrade "{\"path\": \"$path\" }"
+ ubus call system nandupgrade "{\"prefix\": \"$RAM_ROOT\", \"path\": \"$path\" }"
exit 0
}
}
@@ -370,6 +370,7 @@ nand_do_platform_check() {
# $(1): file to be used for upgrade
nand_do_upgrade() {
echo -n $1 > /tmp/sysupgrade-nand-path
- cp /sbin/upgraded /tmp/
+ install_bin /sbin/upgraded
+ ln -s "$RAM_ROOT"/sbin/upgraded /tmp/upgraded
nand_upgrade_stage1
}

View File

@ -1,934 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Fri, 21 Apr 2017 20:37:58 +0200
Subject: procd: remove procd-nand package
We always want to support staged upgrades now, so it's better to include
upgraded into the main package. /lib/upgrade/nand.sh is moved to
base-files.
The procd-nand-firstboot package is removed for now, it may return later
as a separate package.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/package/base-files/Makefile b/package/base-files/Makefile
index 4fbc9a265b535d850fe812085677b3f6aabf4e1f..c971de4deee7cd331ddcad6b87eb9fefd7af6a64 100644
--- a/package/base-files/Makefile
+++ b/package/base-files/Makefile
@@ -19,7 +19,9 @@ PKG_BUILD_DEPENDS:=usign/host
PKG_LICENSE:=GPL-2.0
# Extend depends from version.mk
-PKG_CONFIG_DEPENDS += CONFIG_SIGNED_PACKAGES CONFIG_TARGET_INIT_PATH CONFIG_TARGET_PREINIT_DISABLE_FAILSAFE
+PKG_CONFIG_DEPENDS += \
+ CONFIG_SIGNED_PACKAGES CONFIG_TARGET_INIT_PATH CONFIG_TARGET_PREINIT_DISABLE_FAILSAFE \
+ CONFIG_NAND_SUPPORT
include $(INCLUDE_DIR)/package.mk
@@ -31,7 +33,7 @@ endif
define Package/base-files
SECTION:=base
CATEGORY:=Base system
- DEPENDS:=+netifd +libc +procd +jsonfilter +SIGNED_PACKAGES:usign +SIGNED_PACKAGES:lede-keyring +fstools +fwtool
+ DEPENDS:=+netifd +libc +procd +jsonfilter +SIGNED_PACKAGES:usign +SIGNED_PACKAGES:lede-keyring +NAND_SUPPORT:ubi-utils +fstools +fwtool
TITLE:=Base filesystem for Lede
URL:=http://openwrt.org/
VERSION:=$(PKG_RELEASE)-$(REVISION)
@@ -107,9 +109,16 @@ ifdef CONFIG_SIGNED_PACKAGES
endef
endif
+ifeq ($(CONFIG_NAND_SUPPORT),)
+ define Package/base-files/nand-support
+ rm -f $(1)/lib/upgrade/nand.sh
+ endef
+endif
+
define Package/base-files/install
$(CP) ./files/* $(1)/
$(Package/base-files/install-key)
+ $(Package/base-files/nand-support)
if [ -d $(GENERIC_PLATFORM_DIR)/base-files/. ]; then \
$(CP) $(GENERIC_PLATFORM_DIR)/base-files/* $(1)/; \
fi
diff --git a/package/base-files/files/lib/upgrade/nand.sh b/package/base-files/files/lib/upgrade/nand.sh
new file mode 100644
index 0000000000000000000000000000000000000000..6bd2005344c081df20e5a330a69e49e37225c39f
--- /dev/null
+++ b/package/base-files/files/lib/upgrade/nand.sh
@@ -0,0 +1,376 @@
+#!/bin/sh
+# Copyright (C) 2014 OpenWrt.org
+#
+
+. /lib/functions.sh
+
+# 'kernel' partition on NAND contains the kernel
+CI_KERNPART="kernel"
+
+# 'ubi' partition on NAND contains UBI
+CI_UBIPART="ubi"
+
+ubi_mknod() {
+ local dir="$1"
+ local dev="/dev/$(basename $dir)"
+
+ [ -e "$dev" ] && return 0
+
+ local devid="$(cat $dir/dev)"
+ local major="${devid%%:*}"
+ local minor="${devid##*:}"
+ mknod "$dev" c $major $minor
+}
+
+nand_find_volume() {
+ local ubidevdir ubivoldir
+ ubidevdir="/sys/devices/virtual/ubi/$1"
+ [ ! -d "$ubidevdir" ] && return 1
+ for ubivoldir in $ubidevdir/${1}_*; do
+ [ ! -d "$ubivoldir" ] && continue
+ if [ "$( cat $ubivoldir/name )" = "$2" ]; then
+ basename $ubivoldir
+ ubi_mknod "$ubivoldir"
+ return 0
+ fi
+ done
+}
+
+nand_find_ubi() {
+ local ubidevdir ubidev mtdnum
+ mtdnum="$( find_mtd_index $1 )"
+ [ ! "$mtdnum" ] && return 1
+ for ubidevdir in /sys/devices/virtual/ubi/ubi*; do
+ [ ! -d "$ubidevdir" ] && continue
+ cmtdnum="$( cat $ubidevdir/mtd_num )"
+ [ ! "$mtdnum" ] && continue
+ if [ "$mtdnum" = "$cmtdnum" ]; then
+ ubidev=$( basename $ubidevdir )
+ ubi_mknod "$ubidevdir"
+ echo $ubidev
+ return 0
+ fi
+ done
+}
+
+nand_get_magic_long() {
+ dd if="$1" skip=$2 bs=4 count=1 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
+}
+
+get_magic_long_tar() {
+ ( tar xf $1 $2 -O | dd bs=4 count=1 | hexdump -v -n 4 -e '1/1 "%02x"') 2> /dev/null
+}
+
+identify_magic() {
+ local magic=$1
+ case "$magic" in
+ "55424923")
+ echo "ubi"
+ ;;
+ "31181006")
+ echo "ubifs"
+ ;;
+ "68737173")
+ echo "squashfs"
+ ;;
+ "d00dfeed")
+ echo "fit"
+ ;;
+ "4349"*)
+ echo "combined"
+ ;;
+ *)
+ echo "unknown $magic"
+ ;;
+ esac
+}
+
+
+identify() {
+ identify_magic $(nand_get_magic_long "$1" "${2:-0}")
+}
+
+identify_tar() {
+ identify_magic $(get_magic_long_tar "$1" "$2")
+}
+
+nand_restore_config() {
+ sync
+ local ubidev=$( nand_find_ubi $CI_UBIPART )
+ local ubivol="$( nand_find_volume $ubidev rootfs_data )"
+ [ ! "$ubivol" ] &&
+ ubivol="$( nand_find_volume $ubidev rootfs )"
+ mkdir /tmp/new_root
+ if ! mount -t ubifs /dev/$ubivol /tmp/new_root; then
+ echo "mounting ubifs $ubivol failed"
+ rmdir /tmp/new_root
+ return 1
+ fi
+ mv "$1" "/tmp/new_root/sysupgrade.tgz"
+ umount /tmp/new_root
+ sync
+ rmdir /tmp/new_root
+}
+
+nand_upgrade_prepare_ubi() {
+ local rootfs_length="$1"
+ local rootfs_type="$2"
+ local has_kernel="${3:-0}"
+ local has_env="${4:-0}"
+
+ local mtdnum="$( find_mtd_index "$CI_UBIPART" )"
+ if [ ! "$mtdnum" ]; then
+ echo "cannot find ubi mtd partition $CI_UBIPART"
+ return 1
+ fi
+
+ local ubidev="$( nand_find_ubi "$CI_UBIPART" )"
+ if [ ! "$ubidev" ]; then
+ ubiattach -m "$mtdnum"
+ sync
+ ubidev="$( nand_find_ubi "$CI_UBIPART" )"
+ fi
+
+ if [ ! "$ubidev" ]; then
+ ubiformat /dev/mtd$mtdnum -y
+ ubiattach -m "$mtdnum"
+ sync
+ ubidev="$( nand_find_ubi "$CI_UBIPART" )"
+ [ "$has_env" -gt 0 ] && {
+ ubimkvol /dev/$ubidev -n 0 -N ubootenv -s 1MiB
+ ubimkvol /dev/$ubidev -n 1 -N ubootenv2 -s 1MiB
+ }
+ fi
+
+ local kern_ubivol="$( nand_find_volume $ubidev kernel )"
+ local root_ubivol="$( nand_find_volume $ubidev rootfs )"
+ local data_ubivol="$( nand_find_volume $ubidev rootfs_data )"
+
+ # remove ubiblock device of rootfs
+ local root_ubiblk="ubiblock${root_ubivol:3}"
+ if [ "$root_ubivol" -a -e "/dev/$root_ubiblk" ]; then
+ echo "removing $root_ubiblk"
+ if ! ubiblock -r /dev/$root_ubivol; then
+ echo "cannot remove $root_ubiblk"
+ return 1;
+ fi
+ fi
+
+ # kill volumes
+ [ "$kern_ubivol" ] && ubirmvol /dev/$ubidev -N kernel || true
+ [ "$root_ubivol" ] && ubirmvol /dev/$ubidev -N rootfs || true
+ [ "$data_ubivol" ] && ubirmvol /dev/$ubidev -N rootfs_data || true
+
+ # update kernel
+ if [ "$has_kernel" = "1" ]; then
+ if ! ubimkvol /dev/$ubidev -N kernel -s $kernel_length; then
+ echo "cannot create kernel volume"
+ return 1;
+ fi
+ fi
+
+ # update rootfs
+ local root_size_param
+ if [ "$rootfs_type" = "ubifs" ]; then
+ root_size_param="-m"
+ else
+ root_size_param="-s $rootfs_length"
+ fi
+ if ! ubimkvol /dev/$ubidev -N rootfs $root_size_param; then
+ echo "cannot create rootfs volume"
+ return 1;
+ fi
+
+ # create rootfs_data for non-ubifs rootfs
+ if [ "$rootfs_type" != "ubifs" ]; then
+ if ! ubimkvol /dev/$ubidev -N rootfs_data -m; then
+ echo "cannot initialize rootfs_data volume"
+ return 1
+ fi
+ fi
+ sync
+ return 0
+}
+
+nand_do_upgrade_success() {
+ local conf_tar="/tmp/sysupgrade.tgz"
+
+ sync
+ [ -f "$conf_tar" ] && nand_restore_config "$conf_tar"
+ echo "sysupgrade successful"
+ umount -a
+ reboot -f
+}
+
+# Flash the UBI image to MTD partition
+nand_upgrade_ubinized() {
+ local ubi_file="$1"
+ local mtdnum="$(find_mtd_index "$CI_UBIPART")"
+
+ [ ! "$mtdnum" ] && {
+ CI_UBIPART="rootfs"
+ mtdnum="$(find_mtd_index "$CI_UBIPART")"
+ }
+
+ if [ ! "$mtdnum" ]; then
+ echo "cannot find mtd device $CI_UBIPART"
+ umount -a
+ reboot -f
+ fi
+
+ local mtddev="/dev/mtd${mtdnum}"
+ ubidetach -p "${mtddev}" || true
+ sync
+ ubiformat "${mtddev}" -y -f "${ubi_file}"
+ ubiattach -p "${mtddev}"
+ nand_do_upgrade_success
+}
+
+# Write the UBIFS image to UBI volume
+nand_upgrade_ubifs() {
+ local rootfs_length=`(cat $1 | wc -c) 2> /dev/null`
+
+ nand_upgrade_prepare_ubi "$rootfs_length" "ubifs" "0" "0"
+
+ local ubidev="$( nand_find_ubi "$CI_UBIPART" )"
+ local root_ubivol="$(nand_find_volume $ubidev rootfs)"
+ ubiupdatevol /dev/$root_ubivol -s $rootfs_length $1
+
+ nand_do_upgrade_success
+}
+
+nand_board_name() {
+ if type 'platform_nand_board_name' >/dev/null 2>/dev/null; then
+ platform_nand_board_name
+ return
+ fi
+
+ cat /tmp/sysinfo/board_name
+}
+
+nand_upgrade_tar() {
+ local tar_file="$1"
+ local board_name="$(nand_board_name)"
+ local kernel_mtd="$(find_mtd_index $CI_KERNPART)"
+
+ local kernel_length=`(tar xf $tar_file sysupgrade-$board_name/kernel -O | wc -c) 2> /dev/null`
+ local rootfs_length=`(tar xf $tar_file sysupgrade-$board_name/root -O | wc -c) 2> /dev/null`
+
+ local rootfs_type="$(identify_tar "$tar_file" sysupgrade-$board_name/root)"
+
+ local has_kernel=1
+ local has_env=0
+
+ [ "$kernel_length" != 0 -a -n "$kernel_mtd" ] && {
+ tar xf $tar_file sysupgrade-$board_name/kernel -O | mtd write - $CI_KERNPART
+ }
+ [ "$kernel_length" = 0 -o ! -z "$kernel_mtd" ] && has_kernel=0
+
+ nand_upgrade_prepare_ubi "$rootfs_length" "$rootfs_type" "$has_kernel" "$has_env"
+
+ local ubidev="$( nand_find_ubi "$CI_UBIPART" )"
+ [ "$has_kernel" = "1" ] && {
+ local kern_ubivol="$(nand_find_volume $ubidev kernel)"
+ tar xf $tar_file sysupgrade-$board_name/kernel -O | \
+ ubiupdatevol /dev/$kern_ubivol -s $kernel_length -
+ }
+
+ local root_ubivol="$(nand_find_volume $ubidev rootfs)"
+ tar xf $tar_file sysupgrade-$board_name/root -O | \
+ ubiupdatevol /dev/$root_ubivol -s $rootfs_length -
+
+ nand_do_upgrade_success
+}
+
+# Recognize type of passed file and start the upgrade process
+nand_do_upgrade_stage2() {
+ local file_type=$(identify $1)
+
+ if type 'platform_nand_pre_upgrade' >/dev/null 2>/dev/null; then
+ platform_nand_pre_upgrade "$1"
+ fi
+
+ [ ! "$(find_mtd_index "$CI_UBIPART")" ] && CI_UBIPART="rootfs"
+
+ case "$file_type" in
+ "ubi") nand_upgrade_ubinized $1;;
+ "ubifs") nand_upgrade_ubifs $1;;
+ *) nand_upgrade_tar $1;;
+ esac
+}
+
+nand_upgrade_stage2() {
+ [ $1 = "nand" ] && {
+ [ -f "$2" ] && {
+ touch /tmp/sysupgrade
+
+ killall -9 telnetd
+ killall -9 dropbear
+ killall -9 ash
+
+ kill_remaining TERM
+ sleep 3
+ kill_remaining KILL
+
+ sleep 1
+
+ if [ -n "$(rootfs_type)" ]; then
+ v "Switching to ramdisk..."
+ run_ramfs ". /lib/functions.sh; include /lib/upgrade; nand_do_upgrade_stage2 $2"
+ else
+ nand_do_upgrade_stage2 $2
+ fi
+ return 0
+ }
+ echo "Nand upgrade failed"
+ exit 1
+ }
+}
+
+nand_upgrade_stage1() {
+ [ -f /tmp/sysupgrade-nand-path ] && {
+ path="$(cat /tmp/sysupgrade-nand-path)"
+ [ "$SAVE_CONFIG" != 1 -a -f "$CONF_TAR" ] &&
+ rm $CONF_TAR
+
+ ubus call system nandupgrade "{\"prefix\": \"$RAM_ROOT\", \"path\": \"$path\" }"
+ exit 0
+ }
+}
+
+# Check if passed file is a valid one for NAND sysupgrade. Currently it accepts
+# 3 types of files:
+# 1) UBI - should contain an ubinized image, header is checked for the proper
+# MAGIC
+# 2) UBIFS - should contain UBIFS partition that will replace "rootfs" volume,
+# header is checked for the proper MAGIC
+# 3) TAR - archive has to include "sysupgrade-BOARD" directory with a non-empty
+# "CONTROL" file (at this point its content isn't verified)
+#
+# You usually want to call this function in platform_check_image.
+#
+# $(1): board name, used in case of passing TAR file
+# $(2): file to be checked
+nand_do_platform_check() {
+ local board_name="$1"
+ local tar_file="$2"
+ local control_length=`(tar xf $tar_file sysupgrade-$board_name/CONTROL -O | wc -c) 2> /dev/null`
+ local file_type="$(identify $2)"
+
+ [ "$control_length" = 0 -a "$file_type" != "ubi" -a "$file_type" != "ubifs" ] && {
+ echo "Invalid sysupgrade file."
+ return 1
+ }
+
+ return 0
+}
+
+# Start NAND upgrade process
+#
+# $(1): file to be used for upgrade
+nand_do_upgrade() {
+ echo -n $1 > /tmp/sysupgrade-nand-path
+ install_bin /sbin/upgraded
+ ln -s "$RAM_ROOT"/sbin/upgraded /tmp/upgraded
+ nand_upgrade_stage1
+}
diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile
index 5b92d79332f2ea400041586b92b570d8b633218a..879f03f54b23603a360499078d7d53503875f55a 100644
--- a/package/system/procd/Makefile
+++ b/package/system/procd/Makefile
@@ -22,11 +22,9 @@ PKG_LICENSE_FILES:=
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
-PKG_FLAGS:=nonshared
-
PKG_CONFIG_DEPENDS:= \
CONFIG_TARGET_INIT_PATH CONFIG_KERNEL_SECCOMP \
- CONFIG_NAND_SUPPORT CONFIG_PROCD_SHOW_BOOT CONFIG_PROCD_ZRAM_TMPFS \
+ CONFIG_PROCD_SHOW_BOOT CONFIG_PROCD_ZRAM_TMPFS \
CONFIG_KERNEL_NAMESPACES CONFIG_PACKAGE_procd-ujail CONFIG_PACKAGE_procd-seccomp
include $(INCLUDE_DIR)/package.mk
@@ -42,7 +40,7 @@ TARGET_LDFLAGS += $(if $(CONFIG_USE_GLIBC),-lrt)
define Package/procd
SECTION:=base
CATEGORY:=Base system
- DEPENDS:=+ubusd +ubus +libjson-script +ubox +USE_GLIBC:librt +libubox +libubus +NAND_SUPPORT:procd-nand
+ DEPENDS:=+ubusd +ubus +libjson-script +ubox +USE_GLIBC:librt +libubox +libubus
TITLE:=OpenWrt system process manager
endef
@@ -60,20 +58,6 @@ define Package/procd-seccomp
TITLE:=OpenWrt process seccomp helper + utrace
endef
-define Package/procd-nand
- SECTION:=utils
- CATEGORY:=Utilities
- DEPENDS:=@NAND_SUPPORT +ubi-utils
- TITLE:=OpenWrt sysupgrade nand helper
-endef
-
-define Package/procd-nand-firstboot
- SECTION:=utils
- CATEGORY:=Utilities
- DEPENDS:=procd-nand
- TITLE:=OpenWrt firstboot nand helper
-endef
-
define Package/procd/config
menu "Configuration"
depends on PACKAGE_procd
@@ -91,10 +75,6 @@ endmenu
endef
-ifeq ($(CONFIG_NAND_SUPPORT),y)
- CMAKE_OPTIONS += -DBUILD_UPGRADED=1
-endif
-
ifeq ($(CONFIG_PROCD_SHOW_BOOT),y)
CMAKE_OPTIONS += -DSHOW_BOOT_ON_CONSOLE=1
endif
@@ -113,7 +93,7 @@ CMAKE_OPTIONS += -DSECCOMP_SUPPORT=$(SECCOMP) -DUTRACE_SUPPORT=$(SECCOMP)
define Package/procd/install
$(INSTALL_DIR) $(1)/sbin $(1)/etc $(1)/lib/functions
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{init,procd,askfirst,udevtrigger} $(1)/sbin/
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{init,procd,askfirst,udevtrigger,upgraded} $(1)/sbin/
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libsetlbf.so $(1)/lib
$(INSTALL_BIN) ./files/reload_config $(1)/sbin/
$(INSTALL_DATA) ./files/hotplug*.json $(1)/etc/
@@ -133,21 +113,6 @@ define Package/procd-seccomp/install
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libpreload-trace.so $(1)/lib
endef
-define Package/procd-nand/install
- $(INSTALL_DIR) $(1)/sbin $(1)/lib/upgrade
-
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/upgraded $(1)/sbin/
- $(INSTALL_DATA) ./files/nand.sh $(1)/lib/upgrade/
-endef
-
-define Package/procd-nand-firstboot/install
- $(INSTALL_DIR) $(1)/lib/preinit
-
- $(INSTALL_DATA) ./files/nand-preinit.sh $(1)/lib/preinit/60-nand-firstboot.sh
-endef
-
$(eval $(call BuildPackage,procd))
$(eval $(call BuildPackage,procd-ujail))
$(eval $(call BuildPackage,procd-seccomp))
-$(eval $(call BuildPackage,procd-nand))
-$(eval $(call BuildPackage,procd-nand-firstboot))
diff --git a/package/system/procd/files/nand-preinit.sh b/package/system/procd/files/nand-preinit.sh
deleted file mode 100644
index cf596246d1f2891cbeb7b5c7cac4bb6e002b13fb..0000000000000000000000000000000000000000
--- a/package/system/procd/files/nand-preinit.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh
-# Copyright (C) 2014 OpenWrt.org
-
-nand_takeover() {
- . /lib/upgrade/nand.sh
- mtd=$(find_mtd_index "$CI_UBIPART")
- esize=$(cat /proc/mtd | grep mtd$mtd |cut -d" " -f 3)
- [ -z "$esize" ] && return 1
- esize=$(printf "%d" 0x$esize)
- for a in `seq 0 64`; do
- mtd -o $((a * esize)) -l 400 dump /dev/mtd$mtd > /tmp/takeover.hdr
- MAGIC=$(dd if=/tmp/takeover.hdr bs=1 skip=261 count=5 2> /dev/null)
- SIZE=$(printf "%d" 0x$(dd if=/tmp/takeover.hdr bs=4 count=1 2> /dev/null | hexdump -v -n 4 -e '1/1 "%02x"'))
- [ "$MAGIC" = "ustar" ] && {
- mtd -o $((a * esize)) -l $((SIZE + 4)) dump /dev/mtd$mtd | dd bs=1 skip=4 of=/tmp/sysupgrade.tar
- nand_do_upgrade_stage2 /tmp/sysupgrade.tar
- }
- done
-}
-
-boot_hook_add initramfs nand_takeover
diff --git a/package/system/procd/files/nand.sh b/package/system/procd/files/nand.sh
deleted file mode 100644
index 6bd2005344c081df20e5a330a69e49e37225c39f..0000000000000000000000000000000000000000
--- a/package/system/procd/files/nand.sh
+++ /dev/null
@@ -1,376 +0,0 @@
-#!/bin/sh
-# Copyright (C) 2014 OpenWrt.org
-#
-
-. /lib/functions.sh
-
-# 'kernel' partition on NAND contains the kernel
-CI_KERNPART="kernel"
-
-# 'ubi' partition on NAND contains UBI
-CI_UBIPART="ubi"
-
-ubi_mknod() {
- local dir="$1"
- local dev="/dev/$(basename $dir)"
-
- [ -e "$dev" ] && return 0
-
- local devid="$(cat $dir/dev)"
- local major="${devid%%:*}"
- local minor="${devid##*:}"
- mknod "$dev" c $major $minor
-}
-
-nand_find_volume() {
- local ubidevdir ubivoldir
- ubidevdir="/sys/devices/virtual/ubi/$1"
- [ ! -d "$ubidevdir" ] && return 1
- for ubivoldir in $ubidevdir/${1}_*; do
- [ ! -d "$ubivoldir" ] && continue
- if [ "$( cat $ubivoldir/name )" = "$2" ]; then
- basename $ubivoldir
- ubi_mknod "$ubivoldir"
- return 0
- fi
- done
-}
-
-nand_find_ubi() {
- local ubidevdir ubidev mtdnum
- mtdnum="$( find_mtd_index $1 )"
- [ ! "$mtdnum" ] && return 1
- for ubidevdir in /sys/devices/virtual/ubi/ubi*; do
- [ ! -d "$ubidevdir" ] && continue
- cmtdnum="$( cat $ubidevdir/mtd_num )"
- [ ! "$mtdnum" ] && continue
- if [ "$mtdnum" = "$cmtdnum" ]; then
- ubidev=$( basename $ubidevdir )
- ubi_mknod "$ubidevdir"
- echo $ubidev
- return 0
- fi
- done
-}
-
-nand_get_magic_long() {
- dd if="$1" skip=$2 bs=4 count=1 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
-}
-
-get_magic_long_tar() {
- ( tar xf $1 $2 -O | dd bs=4 count=1 | hexdump -v -n 4 -e '1/1 "%02x"') 2> /dev/null
-}
-
-identify_magic() {
- local magic=$1
- case "$magic" in
- "55424923")
- echo "ubi"
- ;;
- "31181006")
- echo "ubifs"
- ;;
- "68737173")
- echo "squashfs"
- ;;
- "d00dfeed")
- echo "fit"
- ;;
- "4349"*)
- echo "combined"
- ;;
- *)
- echo "unknown $magic"
- ;;
- esac
-}
-
-
-identify() {
- identify_magic $(nand_get_magic_long "$1" "${2:-0}")
-}
-
-identify_tar() {
- identify_magic $(get_magic_long_tar "$1" "$2")
-}
-
-nand_restore_config() {
- sync
- local ubidev=$( nand_find_ubi $CI_UBIPART )
- local ubivol="$( nand_find_volume $ubidev rootfs_data )"
- [ ! "$ubivol" ] &&
- ubivol="$( nand_find_volume $ubidev rootfs )"
- mkdir /tmp/new_root
- if ! mount -t ubifs /dev/$ubivol /tmp/new_root; then
- echo "mounting ubifs $ubivol failed"
- rmdir /tmp/new_root
- return 1
- fi
- mv "$1" "/tmp/new_root/sysupgrade.tgz"
- umount /tmp/new_root
- sync
- rmdir /tmp/new_root
-}
-
-nand_upgrade_prepare_ubi() {
- local rootfs_length="$1"
- local rootfs_type="$2"
- local has_kernel="${3:-0}"
- local has_env="${4:-0}"
-
- local mtdnum="$( find_mtd_index "$CI_UBIPART" )"
- if [ ! "$mtdnum" ]; then
- echo "cannot find ubi mtd partition $CI_UBIPART"
- return 1
- fi
-
- local ubidev="$( nand_find_ubi "$CI_UBIPART" )"
- if [ ! "$ubidev" ]; then
- ubiattach -m "$mtdnum"
- sync
- ubidev="$( nand_find_ubi "$CI_UBIPART" )"
- fi
-
- if [ ! "$ubidev" ]; then
- ubiformat /dev/mtd$mtdnum -y
- ubiattach -m "$mtdnum"
- sync
- ubidev="$( nand_find_ubi "$CI_UBIPART" )"
- [ "$has_env" -gt 0 ] && {
- ubimkvol /dev/$ubidev -n 0 -N ubootenv -s 1MiB
- ubimkvol /dev/$ubidev -n 1 -N ubootenv2 -s 1MiB
- }
- fi
-
- local kern_ubivol="$( nand_find_volume $ubidev kernel )"
- local root_ubivol="$( nand_find_volume $ubidev rootfs )"
- local data_ubivol="$( nand_find_volume $ubidev rootfs_data )"
-
- # remove ubiblock device of rootfs
- local root_ubiblk="ubiblock${root_ubivol:3}"
- if [ "$root_ubivol" -a -e "/dev/$root_ubiblk" ]; then
- echo "removing $root_ubiblk"
- if ! ubiblock -r /dev/$root_ubivol; then
- echo "cannot remove $root_ubiblk"
- return 1;
- fi
- fi
-
- # kill volumes
- [ "$kern_ubivol" ] && ubirmvol /dev/$ubidev -N kernel || true
- [ "$root_ubivol" ] && ubirmvol /dev/$ubidev -N rootfs || true
- [ "$data_ubivol" ] && ubirmvol /dev/$ubidev -N rootfs_data || true
-
- # update kernel
- if [ "$has_kernel" = "1" ]; then
- if ! ubimkvol /dev/$ubidev -N kernel -s $kernel_length; then
- echo "cannot create kernel volume"
- return 1;
- fi
- fi
-
- # update rootfs
- local root_size_param
- if [ "$rootfs_type" = "ubifs" ]; then
- root_size_param="-m"
- else
- root_size_param="-s $rootfs_length"
- fi
- if ! ubimkvol /dev/$ubidev -N rootfs $root_size_param; then
- echo "cannot create rootfs volume"
- return 1;
- fi
-
- # create rootfs_data for non-ubifs rootfs
- if [ "$rootfs_type" != "ubifs" ]; then
- if ! ubimkvol /dev/$ubidev -N rootfs_data -m; then
- echo "cannot initialize rootfs_data volume"
- return 1
- fi
- fi
- sync
- return 0
-}
-
-nand_do_upgrade_success() {
- local conf_tar="/tmp/sysupgrade.tgz"
-
- sync
- [ -f "$conf_tar" ] && nand_restore_config "$conf_tar"
- echo "sysupgrade successful"
- umount -a
- reboot -f
-}
-
-# Flash the UBI image to MTD partition
-nand_upgrade_ubinized() {
- local ubi_file="$1"
- local mtdnum="$(find_mtd_index "$CI_UBIPART")"
-
- [ ! "$mtdnum" ] && {
- CI_UBIPART="rootfs"
- mtdnum="$(find_mtd_index "$CI_UBIPART")"
- }
-
- if [ ! "$mtdnum" ]; then
- echo "cannot find mtd device $CI_UBIPART"
- umount -a
- reboot -f
- fi
-
- local mtddev="/dev/mtd${mtdnum}"
- ubidetach -p "${mtddev}" || true
- sync
- ubiformat "${mtddev}" -y -f "${ubi_file}"
- ubiattach -p "${mtddev}"
- nand_do_upgrade_success
-}
-
-# Write the UBIFS image to UBI volume
-nand_upgrade_ubifs() {
- local rootfs_length=`(cat $1 | wc -c) 2> /dev/null`
-
- nand_upgrade_prepare_ubi "$rootfs_length" "ubifs" "0" "0"
-
- local ubidev="$( nand_find_ubi "$CI_UBIPART" )"
- local root_ubivol="$(nand_find_volume $ubidev rootfs)"
- ubiupdatevol /dev/$root_ubivol -s $rootfs_length $1
-
- nand_do_upgrade_success
-}
-
-nand_board_name() {
- if type 'platform_nand_board_name' >/dev/null 2>/dev/null; then
- platform_nand_board_name
- return
- fi
-
- cat /tmp/sysinfo/board_name
-}
-
-nand_upgrade_tar() {
- local tar_file="$1"
- local board_name="$(nand_board_name)"
- local kernel_mtd="$(find_mtd_index $CI_KERNPART)"
-
- local kernel_length=`(tar xf $tar_file sysupgrade-$board_name/kernel -O | wc -c) 2> /dev/null`
- local rootfs_length=`(tar xf $tar_file sysupgrade-$board_name/root -O | wc -c) 2> /dev/null`
-
- local rootfs_type="$(identify_tar "$tar_file" sysupgrade-$board_name/root)"
-
- local has_kernel=1
- local has_env=0
-
- [ "$kernel_length" != 0 -a -n "$kernel_mtd" ] && {
- tar xf $tar_file sysupgrade-$board_name/kernel -O | mtd write - $CI_KERNPART
- }
- [ "$kernel_length" = 0 -o ! -z "$kernel_mtd" ] && has_kernel=0
-
- nand_upgrade_prepare_ubi "$rootfs_length" "$rootfs_type" "$has_kernel" "$has_env"
-
- local ubidev="$( nand_find_ubi "$CI_UBIPART" )"
- [ "$has_kernel" = "1" ] && {
- local kern_ubivol="$(nand_find_volume $ubidev kernel)"
- tar xf $tar_file sysupgrade-$board_name/kernel -O | \
- ubiupdatevol /dev/$kern_ubivol -s $kernel_length -
- }
-
- local root_ubivol="$(nand_find_volume $ubidev rootfs)"
- tar xf $tar_file sysupgrade-$board_name/root -O | \
- ubiupdatevol /dev/$root_ubivol -s $rootfs_length -
-
- nand_do_upgrade_success
-}
-
-# Recognize type of passed file and start the upgrade process
-nand_do_upgrade_stage2() {
- local file_type=$(identify $1)
-
- if type 'platform_nand_pre_upgrade' >/dev/null 2>/dev/null; then
- platform_nand_pre_upgrade "$1"
- fi
-
- [ ! "$(find_mtd_index "$CI_UBIPART")" ] && CI_UBIPART="rootfs"
-
- case "$file_type" in
- "ubi") nand_upgrade_ubinized $1;;
- "ubifs") nand_upgrade_ubifs $1;;
- *) nand_upgrade_tar $1;;
- esac
-}
-
-nand_upgrade_stage2() {
- [ $1 = "nand" ] && {
- [ -f "$2" ] && {
- touch /tmp/sysupgrade
-
- killall -9 telnetd
- killall -9 dropbear
- killall -9 ash
-
- kill_remaining TERM
- sleep 3
- kill_remaining KILL
-
- sleep 1
-
- if [ -n "$(rootfs_type)" ]; then
- v "Switching to ramdisk..."
- run_ramfs ". /lib/functions.sh; include /lib/upgrade; nand_do_upgrade_stage2 $2"
- else
- nand_do_upgrade_stage2 $2
- fi
- return 0
- }
- echo "Nand upgrade failed"
- exit 1
- }
-}
-
-nand_upgrade_stage1() {
- [ -f /tmp/sysupgrade-nand-path ] && {
- path="$(cat /tmp/sysupgrade-nand-path)"
- [ "$SAVE_CONFIG" != 1 -a -f "$CONF_TAR" ] &&
- rm $CONF_TAR
-
- ubus call system nandupgrade "{\"prefix\": \"$RAM_ROOT\", \"path\": \"$path\" }"
- exit 0
- }
-}
-
-# Check if passed file is a valid one for NAND sysupgrade. Currently it accepts
-# 3 types of files:
-# 1) UBI - should contain an ubinized image, header is checked for the proper
-# MAGIC
-# 2) UBIFS - should contain UBIFS partition that will replace "rootfs" volume,
-# header is checked for the proper MAGIC
-# 3) TAR - archive has to include "sysupgrade-BOARD" directory with a non-empty
-# "CONTROL" file (at this point its content isn't verified)
-#
-# You usually want to call this function in platform_check_image.
-#
-# $(1): board name, used in case of passing TAR file
-# $(2): file to be checked
-nand_do_platform_check() {
- local board_name="$1"
- local tar_file="$2"
- local control_length=`(tar xf $tar_file sysupgrade-$board_name/CONTROL -O | wc -c) 2> /dev/null`
- local file_type="$(identify $2)"
-
- [ "$control_length" = 0 -a "$file_type" != "ubi" -a "$file_type" != "ubifs" ] && {
- echo "Invalid sysupgrade file."
- return 1
- }
-
- return 0
-}
-
-# Start NAND upgrade process
-#
-# $(1): file to be used for upgrade
-nand_do_upgrade() {
- echo -n $1 > /tmp/sysupgrade-nand-path
- install_bin /sbin/upgraded
- ln -s "$RAM_ROOT"/sbin/upgraded /tmp/upgraded
- nand_upgrade_stage1
-}

View File

@ -1,476 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sat, 22 Apr 2017 00:54:50 +0200
Subject: base-files: always use staged sysupgrade
Support for the -d and -p options is dropped; it may be added again at some
point by adding these flags to the ubus sysupgrade call.
A downside of this is that we get a lot less information about the progress
of the upgrade: as soon as the actual upgrade starts, all shell sessions
are killed to allow unmounting the root filesystem.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh
index 8c1b3b180e1ecfdd2c106dd3b8853cd487ff89b4..ef9aac709fc1619ba15eeb0aeb4a9a6a372369b2 100644
--- a/package/base-files/files/lib/upgrade/common.sh
+++ b/package/base-files/files/lib/upgrade/common.sh
@@ -56,7 +56,6 @@ run_ramfs() { # <command> [...]
/bin/rm /usr/bin/basename /bin/kill /bin/chmod /usr/bin/find \
/bin/mknod
- install_bin /bin/uclient-fetch /bin/wget
install_bin /sbin/mtd
install_bin /sbin/mount_root
install_bin /sbin/snapshot
@@ -96,51 +95,37 @@ run_ramfs() { # <command> [...]
exec /bin/busybox ash -c "$*"
}
-kill_remaining() { # [ <signal> ]
+kill_remaining() { # [ <signal> [ <loop> ] ]
local sig="${1:-TERM}"
+ local loop="${2:-0}"
+ local run=true
+ local stat
+
echo -n "Sending $sig to remaining processes ... "
- local my_pid=$$
- local my_ppid=$(cut -d' ' -f4 /proc/$my_pid/stat)
- local my_ppisupgraded=
- grep -q upgraded /proc/$my_ppid/cmdline >/dev/null && {
- local my_ppisupgraded=1
- }
-
- local stat
- for stat in /proc/[0-9]*/stat; do
- [ -f "$stat" ] || continue
-
- local pid name state ppid rest
- read pid name state ppid rest < $stat
- name="${name#(}"; name="${name%)}"
-
- local cmdline
- read cmdline < /proc/$pid/cmdline
-
- # Skip kernel threads
- [ -n "$cmdline" ] || continue
-
- if [ $$ -eq 1 ] || [ $my_ppid -eq 1 ] && [ -n "$my_ppisupgraded" ]; then
- # Running as init process, kill everything except me
- if [ $pid -ne $$ ] && [ $pid -ne $my_ppid ]; then
- echo -n "$name "
- kill -$sig $pid 2>/dev/null
- fi
- else
- case "$name" in
- # Skip essential services
- *procd*|*ash*|*init*|*watchdog*|*ssh*|*dropbear*|*telnet*|*login*|*hostapd*|*wpa_supplicant*|*nas*|*relayd*) : ;;
-
- # Killable process
- *)
- if [ $pid -ne $$ ] && [ $ppid -ne $$ ]; then
- echo -n "$name "
- kill -$sig $pid 2>/dev/null
- fi
- ;;
- esac
- fi
+ while $run; do
+ run=false
+ for stat in /proc/[0-9]*/stat; do
+ [ -f "$stat" ] || continue
+
+ local pid name state ppid rest
+ read pid name state ppid rest < $stat
+ name="${name#(}"; name="${name%)}"
+
+ # Skip PID1, ourself and our children
+ [ $pid -ne 1 -a $pid -ne $$ -a $ppid -ne $$ ] || continue
+
+ local cmdline
+ read cmdline < /proc/$pid/cmdline
+
+ # Skip kernel threads
+ [ -n "$cmdline" ] || continue
+
+ echo -n "$name "
+ kill -$sig $pid 2>/dev/null
+
+ [ $loop -eq 1 ] && run=true
+ done
done
echo ""
}
@@ -175,28 +160,31 @@ v() {
[ "$VERBOSE" -ge 1 ] && echo "$@"
}
+json_string() {
+ local v="$1"
+ v="${v//\\/\\\\}"
+ v="${v//\"/\\\"}"
+ echo "\"$v\""
+}
+
rootfs_type() {
/bin/mount | awk '($3 ~ /^\/$/) && ($5 !~ /rootfs/) { print $5 }'
}
get_image() { # <source> [ <command> ]
local from="$1"
- local conc="$2"
- local cmd
-
- case "$from" in
- http://*|ftp://*) cmd="wget -O- -q";;
- *) cmd="cat";;
- esac
- if [ -z "$conc" ]; then
- local magic="$(eval $cmd \"$from\" 2>/dev/null | dd bs=2 count=1 2>/dev/null | hexdump -n 2 -e '1/1 "%02x"')"
+ local cat="$2"
+
+ if [ -z "$cat" ]; then
+ local magic="$(dd if="$from" bs=2 count=1 2>/dev/null | hexdump -n 2 -e '1/1 "%02x"')"
case "$magic" in
- 1f8b) conc="zcat";;
- 425a) conc="bzcat";;
+ 1f8b) cat="zcat";;
+ 425a) cat="bzcat";;
+ *) cat="cat";;
esac
fi
- eval "$cmd \"$from\" 2>/dev/null ${conc:+| $conc}"
+ $cat "$from" 2>/dev/null
}
get_magic_word() {
@@ -331,12 +319,14 @@ default_do_upgrade() {
fi
}
-do_upgrade() {
+do_upgrade_stage2() {
v "Performing system upgrade..."
- if type 'platform_do_upgrade' >/dev/null 2>/dev/null; then
- platform_do_upgrade "$ARGV"
+ if [ -n "$do_upgrade" ]; then
+ $do_upgrade "$IMAGE"
+ elif type 'platform_do_upgrade' >/dev/null 2>/dev/null; then
+ platform_do_upgrade "$IMAGE"
else
- default_do_upgrade "$ARGV"
+ default_do_upgrade "$IMAGE"
fi
if [ "$SAVE_CONFIG" -eq 1 ] && type 'platform_copy_config' >/dev/null 2>/dev/null; then
@@ -344,12 +334,11 @@ do_upgrade() {
fi
v "Upgrade completed"
- [ -n "$DELAY" ] && sleep "$DELAY"
- ask_bool 1 "Reboot" && {
- v "Rebooting system..."
- umount -a
- reboot -f
- sleep 5
- echo b 2>/dev/null >/proc/sysrq-trigger
- }
+ sleep 1
+
+ v "Rebooting system..."
+ umount -a
+ reboot -f
+ sleep 5
+ echo b 2>/dev/null >/proc/sysrq-trigger
}
diff --git a/package/base-files/files/lib/upgrade/nand.sh b/package/base-files/files/lib/upgrade/nand.sh
index 6bd2005344c081df20e5a330a69e49e37225c39f..1e69c8f9657b39adf2a2c33bd9bac9303bcbc3d7 100644
--- a/package/base-files/files/lib/upgrade/nand.sh
+++ b/package/base-files/files/lib/upgrade/nand.sh
@@ -283,7 +283,16 @@ nand_upgrade_tar() {
}
# Recognize type of passed file and start the upgrade process
-nand_do_upgrade_stage2() {
+nand_do_upgrade() {
+ if [ -n "$IS_PRE_UPGRADE" ]; then
+ # Previously, nand_do_upgrade was called from the platform_pre_upgrade
+ # hook; this piece of code handles scripts that haven't been
+ # updated. All scripts should gradually move to call nand_do_upgrade
+ # from platform_do_upgrade instead.
+ export do_upgrade=nand_do_upgrade
+ return
+ fi
+
local file_type=$(identify $1)
if type 'platform_nand_pre_upgrade' >/dev/null 2>/dev/null; then
@@ -299,45 +308,6 @@ nand_do_upgrade_stage2() {
esac
}
-nand_upgrade_stage2() {
- [ $1 = "nand" ] && {
- [ -f "$2" ] && {
- touch /tmp/sysupgrade
-
- killall -9 telnetd
- killall -9 dropbear
- killall -9 ash
-
- kill_remaining TERM
- sleep 3
- kill_remaining KILL
-
- sleep 1
-
- if [ -n "$(rootfs_type)" ]; then
- v "Switching to ramdisk..."
- run_ramfs ". /lib/functions.sh; include /lib/upgrade; nand_do_upgrade_stage2 $2"
- else
- nand_do_upgrade_stage2 $2
- fi
- return 0
- }
- echo "Nand upgrade failed"
- exit 1
- }
-}
-
-nand_upgrade_stage1() {
- [ -f /tmp/sysupgrade-nand-path ] && {
- path="$(cat /tmp/sysupgrade-nand-path)"
- [ "$SAVE_CONFIG" != 1 -a -f "$CONF_TAR" ] &&
- rm $CONF_TAR
-
- ubus call system nandupgrade "{\"prefix\": \"$RAM_ROOT\", \"path\": \"$path\" }"
- exit 0
- }
-}
-
# Check if passed file is a valid one for NAND sysupgrade. Currently it accepts
# 3 types of files:
# 1) UBI - should contain an ubinized image, header is checked for the proper
@@ -364,13 +334,3 @@ nand_do_platform_check() {
return 0
}
-
-# Start NAND upgrade process
-#
-# $(1): file to be used for upgrade
-nand_do_upgrade() {
- echo -n $1 > /tmp/sysupgrade-nand-path
- install_bin /sbin/upgraded
- ln -s "$RAM_ROOT"/sbin/upgraded /tmp/upgraded
- nand_upgrade_stage1
-}
diff --git a/package/base-files/files/lib/upgrade/stage2 b/package/base-files/files/lib/upgrade/stage2
new file mode 100755
index 0000000000000000000000000000000000000000..4e2aa3a23c3bab07a795762a30a4d4f701081934
--- /dev/null
+++ b/package/base-files/files/lib/upgrade/stage2
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+. /lib/functions.sh
+. /lib/functions/system.sh
+
+export IMAGE="$1"
+COMMAND="$2"
+
+export ARGV="$IMAGE"
+export ARGC=1
+
+export SAVE_CONFIG=1
+export SAVE_PARTITIONS=1
+
+export INTERACTIVE=0
+export VERBOSE=1
+export CONFFILES=/tmp/sysupgrade.conffiles
+export CONF_TAR=/tmp/sysupgrade.tgz
+
+
+[ -f "$CONF_TAR" ] || export SAVE_CONFIG=0
+[ -f /tmp/sysupgrade.always.overwrite.bootdisk.partmap ] && export SAVE_PARTITIONS=0
+
+include /lib/upgrade
+
+
+killall -9 telnetd
+killall -9 dropbear
+killall -9 ash
+
+kill_remaining TERM
+sleep 3
+kill_remaining KILL 1
+
+sleep 1
+
+
+if [ -n "$IMAGE" ] && type 'platform_pre_upgrade' >/dev/null 2>/dev/null; then
+ IS_PRE_UPGRADE=1 platform_pre_upgrade "$IMAGE"
+
+ # Needs to be unset again because of busybox weirdness ...
+ IS_PRE_UPGRADE=
+fi
+
+if [ -n "$(rootfs_type)" ]; then
+ echo "Switching to ramdisk..."
+ run_ramfs "$COMMAND"
+else
+ exec /bin/busybox ash -c "$COMMAND"
+fi
diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade
index 71c7faa6dbc485ff33e776ff087e1aca58cfb0b0..fa08f4194daa0ee74758b9f49a23fe8dcb4b933d 100755
--- a/package/base-files/files/sbin/sysupgrade
+++ b/package/base-files/files/sbin/sysupgrade
@@ -1,4 +1,7 @@
#!/bin/sh
+
+[ "$1" = "nand" ] && exec /lib/upgrade/stage2 "$2" "$3"
+
. /lib/functions.sh
. /lib/functions/system.sh
@@ -11,7 +14,6 @@ export VERBOSE=1
export SAVE_CONFIG=1
export SAVE_OVERLAY=0
export SAVE_PARTITIONS=1
-export DELAY=
export CONF_IMAGE=
export CONF_BACKUP_LIST=0
export CONF_BACKUP=
@@ -25,7 +27,6 @@ export TEST=0
while [ -n "$1" ]; do
case "$1" in
-i) export INTERACTIVE=1;;
- -d) export DELAY="$2"; shift;;
-v) export VERBOSE="$(($VERBOSE + 1))";;
-q) export VERBOSE="$(($VERBOSE - 1))";;
-n) export SAVE_CONFIG=0;;
@@ -50,10 +51,9 @@ done
export CONFFILES=/tmp/sysupgrade.conffiles
export CONF_TAR=/tmp/sysupgrade.tgz
-export ARGV="$*"
-export ARGC="$#"
+IMAGE="$1"
-[ -z "$ARGV" -a -z "$NEED_IMAGE" -o $HELP -gt 0 ] && {
+[ -z "$IMAGE" -a -z "$NEED_IMAGE" -o $HELP -gt 0 ] && {
cat <<EOF
Usage: $0 [<upgrade-option>...] <image file or URL>
$0 [-q] [-i] <backup-command> <file>
@@ -90,7 +90,7 @@ EOF
exit 1
}
-[ -n "$ARGV" -a -n "$NEED_IMAGE" ] && {
+[ -n "$IMAGE" -a -n "$NEED_IMAGE" ] && {
cat <<-EOF
-b|--create-backup and -r|--restore-backup do not perform a firmware upgrade.
Do not specify both -b|-r and a firmware image.
@@ -155,14 +155,13 @@ sysupgrade_pre_upgrade="fwtool_pre_upgrade"
include /lib/upgrade
-[ "$1" = "nand" ] && nand_upgrade_stage2 $@
-
do_save_conffiles() {
local conf_tar="${1:-$CONF_TAR}"
[ -z "$(rootfs_type)" ] && {
echo "Cannot save config while running from ramdisk."
ask_bool 0 "Abort" && exit
+ rm -f "$conf_tar"
return 0
}
run_hooks "$CONFFILES" $sysupgrade_init_conffiles
@@ -203,8 +202,33 @@ type platform_check_image >/dev/null 2>/dev/null || {
exit 1
}
+case "$IMAGE" in
+ http://*)
+ wget -O/tmp/sysupgrade.img "$IMAGE"
+ IMAGE=/tmp/sysupgrade.img
+ ;;
+esac
+
+IMAGE="$(readlink -f "$IMAGE")"
+
+case "$IMAGE" in
+ '')
+ echo "Image file not found."
+ exit 1
+ ;;
+ /tmp/*) ;;
+ *)
+ v "Image not in /tmp, copying..."
+ cp -f "$IMAGE" /tmp/sysupgrade.img
+ IMAGE=/tmp/sysupgrade.img
+ ;;
+esac
+
+export ARGV="$IMAGE"
+export ARGC=1
+
for check in $sysupgrade_image_check; do
- ( eval "$check \"\$ARGV\"" ) || {
+ ( $check "$IMAGE" ) || {
if [ $FORCE -eq 1 ]; then
echo "Image check '$check' failed but --force given - will update anyway!"
break
@@ -230,6 +254,7 @@ elif ask_bool $SAVE_CONFIG "Keep config files over reflash"; then
[ $TEST -eq 1 ] || do_save_conffiles
export SAVE_CONFIG=1
else
+ [ $TEST -eq 1 ] || rm -f "$CONF_TAR"
export SAVE_CONFIG=0
fi
@@ -237,28 +262,18 @@ if [ $TEST -eq 1 ]; then
exit 0
fi
-run_hooks "" $sysupgrade_pre_upgrade
-
-# Some platforms/devices may want different sysupgrade process, e.g. without
-# killing processes yet or calling ubus system upgrade method.
-# This is needed e.g. on NAND devices where we just want to trigger stage1 at
-# this point.
-if type 'platform_pre_upgrade' >/dev/null 2>/dev/null; then
- platform_pre_upgrade "$ARGV"
+if [ $SAVE_PARTITIONS -eq 0 ]; then
+ touch /tmp/sysupgrade.always.overwrite.bootdisk.partmap
+else
+ rm -f /tmp/sysupgrade.always.overwrite.bootdisk.partmap
fi
-ubus call system upgrade
-touch /tmp/sysupgrade
-
-if [ ! -f /tmp/failsafe ] ; then
- kill_remaining TERM
- sleep 3
- kill_remaining KILL
-fi
+run_hooks "" $sysupgrade_pre_upgrade
-if [ -n "$(rootfs_type)" ]; then
- v "Switching to ramdisk..."
- run_ramfs '. /lib/functions.sh; include /lib/upgrade; do_upgrade'
-else
- do_upgrade
-fi
+install_bin /sbin/upgraded
+v "Commencing upgrade. All shell sessions will be closed now."
+ubus call system sysupgrade "{
+ \"prefix\": \"$RAM_ROOT\",
+ \"path\": $(json_string "$IMAGE"),
+ \"command\": \". /lib/functions.sh; include /lib/upgrade; do_upgrade_stage2\"
+}"

View File

@ -1,19 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Wed, 3 May 2017 08:29:24 +0200
Subject: fstools: clean up trailing whitespace in snapshot script
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/package/system/fstools/files/snapshot b/package/system/fstools/files/snapshot
index c1a5b733f3c70e2bb5f2e83d3589e2f10832760f..baf24f1e3e90fe7708e0f28c17ba270a35a2cd52 100644
--- a/package/system/fstools/files/snapshot
+++ b/package/system/fstools/files/snapshot
@@ -42,7 +42,7 @@ do_snapshot_upgrade() {
opkg list-upgradable
[ $? -eq 0 ] || exit 2
-
+
UPDATES=`opkg list-upgradable | cut -d" " -f1`
[ -z "${UPDATES}" ] && exit 0

View File

@ -1,49 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Wed, 3 May 2017 08:29:55 +0200
Subject: fstools: snapshot: handle jffs2 conversion using upgraded
We can reuse the kill_remaining and run_ramfs facilities of the stage2 run
by upgraded.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/package/system/fstools/Makefile b/package/system/fstools/Makefile
index 6f1f511d387e900426832f40966012bc11d53075..f2e0580912ab7d475fab576bea4fd84f0dfe6a3d 100644
--- a/package/system/fstools/Makefile
+++ b/package/system/fstools/Makefile
@@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=fstools
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(LEDE_GIT)/project/fstools.git
diff --git a/package/system/fstools/files/snapshot b/package/system/fstools/files/snapshot
index baf24f1e3e90fe7708e0f28c17ba270a35a2cd52..a495e3434523b7a4b1b2f1bc3f4c9298197fc745 100644
--- a/package/system/fstools/files/snapshot
+++ b/package/system/fstools/files/snapshot
@@ -64,14 +64,16 @@ do_convert_jffs2() {
do_convert() {
. /lib/functions.sh
. /lib/upgrade/common.sh
- ubus call system upgrade
- touch /tmp/sysupgrade
+
cd /overlay/upper
tar czf /tmp/snapshot.tar.gz *
- kill_remaining TERM
- sleep 3
- kill_remaining KILL
- run_ramfs '. /sbin/snapshot; do_convert_jffs2'
+
+ install_bin /sbin/upgraded
+ ubus call system sysupgrade "{
+ \"prefix\": \"$RAM_ROOT\",
+ \"path\": \"\",
+ \"command\": \". /sbin/snapshot; do_convert_jffs2\"
+ }"
}
[ -n "$(cat /proc/mounts|grep /overlay|grep jffs2)" ] && {

View File

@ -1,258 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sun, 23 Apr 2017 23:33:14 +0200
Subject: base-files: sysupgrade cleanup
Some functions only used by stage2 are moved there from common.sh.
One piece that could still use more cleanup is platform_pre_upgrade: many
targets reference files from there are aren't available in the ramfs, so
we need to evaluate it before the switch; conversely, flash writes happen
in that function on some targets. Targets that do the latter should be
fixed eventually to use platform_do_upgrade for that purpose.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh
index ef9aac709fc1619ba15eeb0aeb4a9a6a372369b2..af7682c29e005c6ca47b91e9be2d60c359a90d05 100644
--- a/package/base-files/files/lib/upgrade/common.sh
+++ b/package/base-files/files/lib/upgrade/common.sh
@@ -30,106 +30,6 @@ install_bin() { # <file> [ <symlink> ... ]
}; done
}
-supivot() { # <new_root> <old_root>
- /bin/mount | grep "on $1 type" 2>&- 1>&- || /bin/mount -o bind $1 $1
- mkdir -p $1$2 $1/proc $1/sys $1/dev $1/tmp $1/overlay && \
- /bin/mount -o noatime,move /proc $1/proc && \
- pivot_root $1 $1$2 || {
- /bin/umount -l $1 $1
- return 1
- }
-
- /bin/mount -o noatime,move $2/sys /sys
- /bin/mount -o noatime,move $2/dev /dev
- /bin/mount -o noatime,move $2/tmp /tmp
- /bin/mount -o noatime,move $2/overlay /overlay 2>&-
- return 0
-}
-
-run_ramfs() { # <command> [...]
- install_bin /bin/busybox /bin/ash /bin/sh /bin/mount /bin/umount \
- /sbin/pivot_root /sbin/reboot /bin/sync /bin/dd /bin/grep \
- /bin/cp /bin/mv /bin/tar /usr/bin/md5sum "/usr/bin/[" /bin/dd \
- /bin/vi /bin/ls /bin/cat /usr/bin/awk /usr/bin/hexdump \
- /bin/sleep /bin/zcat /usr/bin/bzcat /usr/bin/printf /usr/bin/wc \
- /bin/cut /usr/bin/printf /bin/sync /bin/mkdir /bin/rmdir \
- /bin/rm /usr/bin/basename /bin/kill /bin/chmod /usr/bin/find \
- /bin/mknod
-
- install_bin /sbin/mtd
- install_bin /sbin/mount_root
- install_bin /sbin/snapshot
- install_bin /sbin/snapshot_tool
- install_bin /usr/sbin/ubiupdatevol
- install_bin /usr/sbin/ubiattach
- install_bin /usr/sbin/ubiblock
- install_bin /usr/sbin/ubiformat
- install_bin /usr/sbin/ubidetach
- install_bin /usr/sbin/ubirsvol
- install_bin /usr/sbin/ubirmvol
- install_bin /usr/sbin/ubimkvol
- install_bin /usr/sbin/partx
- install_bin /usr/sbin/losetup
- install_bin /usr/sbin/mkfs.ext4
- for file in $RAMFS_COPY_BIN; do
- install_bin ${file//:/ }
- done
- install_file /etc/resolv.conf /lib/*.sh /lib/functions/*.sh /lib/upgrade/*.sh $RAMFS_COPY_DATA
-
- [ -L "/lib64" ] && ln -s /lib $RAM_ROOT/lib64
-
- supivot $RAM_ROOT /mnt || {
- echo "Failed to switch over to ramfs. Please reboot."
- exit 1
- }
-
- /bin/mount -o remount,ro /mnt
- /bin/umount -l /mnt
-
- grep /overlay /proc/mounts > /dev/null && {
- /bin/mount -o noatime,remount,ro /overlay
- /bin/umount -l /overlay
- }
-
- # spawn a new shell from ramdisk to reduce the probability of cache issues
- exec /bin/busybox ash -c "$*"
-}
-
-kill_remaining() { # [ <signal> [ <loop> ] ]
- local sig="${1:-TERM}"
- local loop="${2:-0}"
- local run=true
- local stat
-
- echo -n "Sending $sig to remaining processes ... "
-
- while $run; do
- run=false
- for stat in /proc/[0-9]*/stat; do
- [ -f "$stat" ] || continue
-
- local pid name state ppid rest
- read pid name state ppid rest < $stat
- name="${name#(}"; name="${name%)}"
-
- # Skip PID1, ourself and our children
- [ $pid -ne 1 -a $pid -ne $$ -a $ppid -ne $$ ] || continue
-
- local cmdline
- read cmdline < /proc/$pid/cmdline
-
- # Skip kernel threads
- [ -n "$cmdline" ] || continue
-
- echo -n "$name "
- kill -$sig $pid 2>/dev/null
-
- [ $loop -eq 1 ] && run=true
- done
- done
- echo ""
-}
-
run_hooks() {
local arg="$1"; shift
for func in "$@"; do
diff --git a/package/base-files/files/lib/upgrade/stage2 b/package/base-files/files/lib/upgrade/stage2
index 4e2aa3a23c3bab07a795762a30a4d4f701081934..cc8047d988e39ca9ba27d2588744aad469d1d978 100755
--- a/package/base-files/files/lib/upgrade/stage2
+++ b/package/base-files/files/lib/upgrade/stage2
@@ -24,6 +24,104 @@ export CONF_TAR=/tmp/sysupgrade.tgz
include /lib/upgrade
+supivot() { # <new_root> <old_root>
+ /bin/mount | grep "on $1 type" 2>&- 1>&- || /bin/mount -o bind $1 $1
+ mkdir -p $1$2 $1/proc $1/sys $1/dev $1/tmp $1/overlay && \
+ /bin/mount -o noatime,move /proc $1/proc && \
+ pivot_root $1 $1$2 || {
+ /bin/umount -l $1 $1
+ return 1
+ }
+
+ /bin/mount -o noatime,move $2/sys /sys
+ /bin/mount -o noatime,move $2/dev /dev
+ /bin/mount -o noatime,move $2/tmp /tmp
+ /bin/mount -o noatime,move $2/overlay /overlay 2>&-
+ return 0
+}
+
+switch_to_ramfs() {
+ install_bin /bin/busybox /bin/ash /bin/sh /bin/mount /bin/umount \
+ /sbin/pivot_root /sbin/reboot /bin/sync /bin/dd /bin/grep \
+ /bin/cp /bin/mv /bin/tar /usr/bin/md5sum "/usr/bin/[" /bin/dd \
+ /bin/vi /bin/ls /bin/cat /usr/bin/awk /usr/bin/hexdump \
+ /bin/sleep /bin/zcat /usr/bin/bzcat /usr/bin/printf /usr/bin/wc \
+ /bin/cut /usr/bin/printf /bin/sync /bin/mkdir /bin/rmdir \
+ /bin/rm /usr/bin/basename /bin/kill /bin/chmod /usr/bin/find \
+ /bin/mknod
+
+ install_bin /sbin/mtd
+ install_bin /sbin/mount_root
+ install_bin /sbin/snapshot
+ install_bin /sbin/snapshot_tool
+ install_bin /usr/sbin/ubiupdatevol
+ install_bin /usr/sbin/ubiattach
+ install_bin /usr/sbin/ubiblock
+ install_bin /usr/sbin/ubiformat
+ install_bin /usr/sbin/ubidetach
+ install_bin /usr/sbin/ubirsvol
+ install_bin /usr/sbin/ubirmvol
+ install_bin /usr/sbin/ubimkvol
+ install_bin /usr/sbin/partx
+ install_bin /usr/sbin/losetup
+ install_bin /usr/sbin/mkfs.ext4
+ for file in $RAMFS_COPY_BIN; do
+ install_bin ${file//:/ }
+ done
+ install_file /etc/resolv.conf /lib/*.sh /lib/functions/*.sh /lib/upgrade/*.sh $RAMFS_COPY_DATA
+
+ [ -L "/lib64" ] && ln -s /lib $RAM_ROOT/lib64
+
+ supivot $RAM_ROOT /mnt || {
+ echo "Failed to switch over to ramfs. Please reboot."
+ exit 1
+ }
+
+ /bin/mount -o remount,ro /mnt
+ /bin/umount -l /mnt
+
+ grep /overlay /proc/mounts > /dev/null && {
+ /bin/mount -o noatime,remount,ro /overlay
+ /bin/umount -l /overlay
+ }
+}
+
+kill_remaining() { # [ <signal> [ <loop> ] ]
+ local sig="${1:-TERM}"
+ local loop="${2:-0}"
+ local run=true
+ local stat
+
+ echo -n "Sending $sig to remaining processes ... "
+
+ while $run; do
+ run=false
+ for stat in /proc/[0-9]*/stat; do
+ [ -f "$stat" ] || continue
+
+ local pid name state ppid rest
+ read pid name state ppid rest < $stat
+ name="${name#(}"; name="${name%)}"
+
+ # Skip PID1, ourself and our children
+ [ $pid -ne 1 -a $pid -ne $$ -a $ppid -ne $$ ] || continue
+
+ local cmdline
+ read cmdline < /proc/$pid/cmdline
+
+ # Skip kernel threads
+ [ -n "$cmdline" ] || continue
+
+ echo -n "$name "
+ kill -$sig $pid 2>/dev/null
+
+ [ $loop -eq 1 ] && run=true
+ done
+ done
+ echo ""
+}
+
+
killall -9 telnetd
killall -9 dropbear
killall -9 ash
@@ -44,7 +142,8 @@ fi
if [ -n "$(rootfs_type)" ]; then
echo "Switching to ramdisk..."
- run_ramfs "$COMMAND"
-else
- exec /bin/busybox ash -c "$COMMAND"
+ switch_to_ramfs
fi
+
+# Exec new shell from ramfs
+exec /bin/busybox ash -c "$COMMAND"
diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade
index fa08f4194daa0ee74758b9f49a23fe8dcb4b933d..347860d00af27a61152703320bb210d30726db83 100755
--- a/package/base-files/files/sbin/sysupgrade
+++ b/package/base-files/files/sbin/sysupgrade
@@ -1,7 +1,5 @@
#!/bin/sh
-[ "$1" = "nand" ] && exec /lib/upgrade/stage2 "$2" "$3"
-
. /lib/functions.sh
. /lib/functions/system.sh

View File

@ -1,72 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Mon, 24 Apr 2017 01:31:04 +0200
Subject: base-files: add support for staged sysupgrades from failsafe mode
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/package/base-files/files/lib/preinit/40_run_failsafe_hook b/package/base-files/files/lib/preinit/40_run_failsafe_hook
index 7301f77349a1a1e42fcef9bcbc927ef55c83b991..533b0a9771e1aac603f00ecf7a4622ea9fee969d 100644
--- a/package/base-files/files/lib/preinit/40_run_failsafe_hook
+++ b/package/base-files/files/lib/preinit/40_run_failsafe_hook
@@ -5,8 +5,12 @@
run_failsafe_hook() {
[ "$pi_preinit_no_failsafe" = "y" ] && return
if [ "$FAILSAFE" = "true" ]; then
+ lock /tmp/.failsafe
boot_run_hook failsafe
- lock -w /tmp/.failsafe
+ while [ ! -e /tmp/sysupgrade ]; do
+ lock -w /tmp/.failsafe
+ done
+ exit
fi
}
diff --git a/package/base-files/files/lib/preinit/99_10_failsafe_login b/package/base-files/files/lib/preinit/99_10_failsafe_login
index 3147cdc5a68a69cef6b1af6618a4e2367a143c2c..728c63b2e8aebf970cd7dff0d15518ccda83029c 100644
--- a/package/base-files/files/lib/preinit/99_10_failsafe_login
+++ b/package/base-files/files/lib/preinit/99_10_failsafe_login
@@ -8,10 +8,13 @@ failsafe_netlogin () {
}
failsafe_shell() {
- lock /tmp/.failsafe
- ash --login
- echo "Please reboot system when done with failsafe network logins"
- while true; do sleep 1; done
+ local console="$(sed -e 's/ /\n/g' /proc/cmdline | grep '^console=' | head -1 | sed -e 's/^console=//' -e 's/,.*//')"
+ [ -n "$console" ] || console=console
+ [ -c "/dev/$console" ] || return 0
+ while true; do
+ ash --login <"/dev/$console" >"/dev/$console" 2>"/dev/$console"
+ sleep 1
+ done &
}
boot_hook_add failsafe failsafe_netlogin
diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade
index 347860d00af27a61152703320bb210d30726db83..4a133a65e0960619b9cd0d722b6c27ac7894de5b 100755
--- a/package/base-files/files/sbin/sysupgrade
+++ b/package/base-files/files/sbin/sysupgrade
@@ -270,8 +270,16 @@ run_hooks "" $sysupgrade_pre_upgrade
install_bin /sbin/upgraded
v "Commencing upgrade. All shell sessions will be closed now."
-ubus call system sysupgrade "{
- \"prefix\": \"$RAM_ROOT\",
- \"path\": $(json_string "$IMAGE"),
- \"command\": \". /lib/functions.sh; include /lib/upgrade; do_upgrade_stage2\"
-}"
+
+COMMAND='. /lib/functions.sh; include /lib/upgrade; do_upgrade_stage2'
+
+if [ -n "$FAILSAFE" ]; then
+ printf '%s\x00%s\x00%s' "$RAM_ROOT" "$IMAGE" "$COMMAND" >/tmp/sysupgrade
+ lock -u /tmp/.failsafe
+else
+ ubus call system sysupgrade "{
+ \"prefix\": $(json_string "$RAM_ROOT"),
+ \"path\": $(json_string "$IMAGE"),
+ \"command\": $(json_string "$COMMAND")
+ }"
+fi

View File

@ -1,35 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sat, 22 Apr 2017 21:27:04 +0200
Subject: ramips: sysupgrade: move nand_do_upgrade call to platform_do_upgrade
All targets with NAND support should gradually move their nand_do_upgrade
calls from platform_pre_upgrade to platform_do_upgrade.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 7f5b1dd070b1bfe0b86b093a55165b5a139eb37c..a5cca2080d3b96cef92286b1b15f4f8832d9f8c5 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -254,20 +254,13 @@ platform_nand_pre_upgrade() {
esac
}
-platform_pre_upgrade() {
+platform_do_upgrade() {
local board=$(ramips_board_name)
case "$board" in
ubnt-erx)
nand_do_upgrade "$ARGV"
;;
- esac
-}
-
-platform_do_upgrade() {
- local board=$(ramips_board_name)
-
- case "$board" in
*)
default_do_upgrade "$ARGV"
;;

View File

@ -1,62 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Wed, 3 May 2017 08:57:29 +0200
Subject: x86: sysupgrade: move partition table change check to platform_check_image
The staged sysupgrade will prevent us from using ask_bool in
platform_do_upgrade; therefore, the check is moved to platform_check_image.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/target/linux/x86/base-files/lib/upgrade/platform.sh b/target/linux/x86/base-files/lib/upgrade/platform.sh
index d3e9f360aadedad0995da55205364940c9884ba4..81b349a81816033eef9df464b2a70fdb998e5a1d 100644
--- a/target/linux/x86/base-files/lib/upgrade/platform.sh
+++ b/target/linux/x86/base-files/lib/upgrade/platform.sh
@@ -1,13 +1,37 @@
platform_check_image() {
+ local diskdev partdev diff
[ "$#" -gt 1 ] && return 1
case "$(get_magic_word "$1")" in
- eb48|eb63) return 0;;
+ eb48|eb63) ;;
*)
echo "Invalid image type"
return 1
;;
esac
+
+ export_bootdevice && export_partdevice diskdev 0 || {
+ echo "Unable to determine upgrade device"
+ return 1
+ }
+
+ get_partitions "/dev/$diskdev" bootdisk
+
+ #extract the boot sector from the image
+ get_image "$@" | dd of=/tmp/image.bs count=1 bs=512b 2>/dev/null
+
+ get_partitions /tmp/image.bs image
+
+ #compare tables
+ diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)"
+
+ rm -f /tmp/image.bs /tmp/partmap.bootdisk /tmp/partmap.image
+
+ if [ -n "$diff" ]; then
+ echo "Partition layout has changed. Full image will be written."
+ ask_bool 0 "Abort" && exit 1
+ return 0
+ fi
}
platform_copy_config() {
@@ -36,9 +60,6 @@ platform_do_upgrade() {
#compare tables
diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)"
if [ -n "$diff" ]; then
- echo "Partition layout is changed. Full image will be written."
- ask_bool 0 "Abort" && exit
-
get_image "$@" | dd of="/dev/$diskdev" bs=4096 conv=fsync
return 0
fi

View File

@ -1,90 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Wed, 3 May 2017 09:05:25 +0200
Subject: x86: sysupgrade: refactor platform_do_upgrade
By returning early when no upgrade device can be found and handling the
SAVE_PARTITIONS=0 case differently, we can get rid of two levels of if.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/target/linux/x86/base-files/lib/upgrade/platform.sh b/target/linux/x86/base-files/lib/upgrade/platform.sh
index 81b349a81816033eef9df464b2a70fdb998e5a1d..4fa71999be7be3972676a1019488972dccd57fa2 100644
--- a/target/linux/x86/base-files/lib/upgrade/platform.sh
+++ b/target/linux/x86/base-files/lib/upgrade/platform.sh
@@ -47,40 +47,43 @@ platform_copy_config() {
platform_do_upgrade() {
local diskdev partdev diff
- if export_bootdevice && export_partdevice diskdev 0; then
- sync
- if [ "$SAVE_PARTITIONS" = "1" ]; then
- get_partitions "/dev/$diskdev" bootdisk
-
- #extract the boot sector from the image
- get_image "$@" | dd of=/tmp/image.bs count=1 bs=512b
-
- get_partitions /tmp/image.bs image
-
- #compare tables
- diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)"
- if [ -n "$diff" ]; then
- get_image "$@" | dd of="/dev/$diskdev" bs=4096 conv=fsync
- return 0
- fi
-
- #iterate over each partition from the image and write it to the boot disk
- while read part start size; do
- if export_partdevice partdev $part; then
- echo "Writing image to /dev/$partdev..."
- get_image "$@" | dd of="/dev/$partdev" ibs="512" obs=1M skip="$start" count="$size" conv=fsync
- else
- echo "Unable to find partition $part device, skipped."
- fi
- done < /tmp/partmap.image
-
- #copy partition uuid
- echo "Writing new UUID to /dev/$diskdev..."
- get_image "$@" | dd of="/dev/$diskdev" bs=1 skip=440 count=4 seek=440 conv=fsync
+ export_bootdevice && export_partdevice diskdev 0 || {
+ echo "Unable to determine upgrade device"
+ return 1
+ }
+
+ sync
+
+ if [ "$SAVE_PARTITIONS" = "1" ]; then
+ get_partitions "/dev/$diskdev" bootdisk
+
+ #extract the boot sector from the image
+ get_image "$@" | dd of=/tmp/image.bs count=1 bs=512b
+
+ get_partitions /tmp/image.bs image
+
+ #compare tables
+ diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)"
+ else
+ diff=1
+ fi
+
+ if [ -n "$diff" ]; then
+ get_image "$@" | dd of="/dev/$diskdev" bs=4096 conv=fsync
+ return 0
+ fi
+
+ #iterate over each partition from the image and write it to the boot disk
+ while read part start size; do
+ if export_partdevice partdev $part; then
+ echo "Writing image to /dev/$partdev..."
+ get_image "$@" | dd of="/dev/$partdev" ibs="512" obs=1M skip="$start" count="$size" conv=fsync
else
- get_image "$@" | dd of="/dev/$diskdev" bs=4096 conv=fsync
+ echo "Unable to find partition $part device, skipped."
fi
+ done < /tmp/partmap.image
- sleep 1
- fi
+ #copy partition uuid
+ echo "Writing new UUID to /dev/$diskdev..."
+ get_image "$@" | dd of="/dev/$diskdev" bs=1 skip=440 count=4 seek=440 conv=fsync
}

View File

@ -1,26 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Wed, 3 May 2017 09:08:29 +0200
Subject: x86: sysupgrade: explicitly rescan disk after writing partition table
This should ensure that the kernel partition can be mounted in
platform_copy_config when its size has changed.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/target/linux/x86/base-files/lib/upgrade/platform.sh b/target/linux/x86/base-files/lib/upgrade/platform.sh
index 4fa71999be7be3972676a1019488972dccd57fa2..439ba8f5125d97932248ff966340165a84e1b24a 100644
--- a/target/linux/x86/base-files/lib/upgrade/platform.sh
+++ b/target/linux/x86/base-files/lib/upgrade/platform.sh
@@ -70,6 +70,12 @@ platform_do_upgrade() {
if [ -n "$diff" ]; then
get_image "$@" | dd of="/dev/$diskdev" bs=4096 conv=fsync
+
+ # Separate removal and addtion is necessary; otherwise, partition 1
+ # will be missing if it overlaps with the old partition 2
+ partx -d - "/dev/$diskdev"
+ partx -a - "/dev/$diskdev"
+
return 0
fi

View File

@ -1,29 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Thu, 4 May 2017 07:29:58 +0200
Subject: sunxi: sysupgrade: don't write partitions twice
When existing partitions are retained, the dd call writing the uboot image
in the space before the first partition was accidentally writing the whole
image, making the code for individual partitions redundant. Limit the copy
to 1016KiB (the first 8KiB are skipped, and the first partition starts at
1024KiB).
In addition, conv=notrunc is replaced with conv=fsync. It seems this was an
oversight, as notrunc doesn't make sense for block devices and all other dd
commands use conv=fsync.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/target/linux/sunxi/base-files/lib/upgrade/platform.sh b/target/linux/sunxi/base-files/lib/upgrade/platform.sh
index f2cd970d428a780d7497d8802765c656a47ff421..776bdf53bf89c5eafc24b7b59b943e12f3fab77e 100644
--- a/target/linux/sunxi/base-files/lib/upgrade/platform.sh
+++ b/target/linux/sunxi/base-files/lib/upgrade/platform.sh
@@ -43,7 +43,7 @@ platform_do_upgrade() {
fi
#write uboot image
- get_image "$@" | dd of="$diskdev" bs=1024 skip=8 seek=8 conv=notrunc
+ get_image "$@" | dd of="$diskdev" bs=1024 skip=8 seek=8 count=1016 conv=fsync
#iterate over each partition from the image and write it to the boot disk
while read part start size; do
part="$(($part - 2))"

View File

@ -1,163 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Thu, 4 May 2017 07:39:20 +0200
Subject: sunxi: sysupgrade: sync with x86
sunxi sysupgrade was based on the x86 implementation; sync fixes and other
changes from the current x86 version:
x86: fix sysupgrades on disks with 4k block size
x86: sysupgrade: move partition table change check to platform_check_image
x86: sysupgrade: refactor platform_do_upgrade
x86: sysupgrade: explicitly rescan disk after writing partition table
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/target/linux/sunxi/Makefile b/target/linux/sunxi/Makefile
index 3c2f14b8418e1d296a239027f6fdee9b5ba8f9b2..f8b8aa750a7145c9954df5a5a6a2e85f2610a72f 100644
--- a/target/linux/sunxi/Makefile
+++ b/target/linux/sunxi/Makefile
@@ -28,6 +28,6 @@ KERNELNAME:=zImage dtbs
include $(INCLUDE_DIR)/target.mk
DEFAULT_PACKAGES += uboot-envtools
-DEFAULT_PACKAGES += mkf2fs e2fsprogs
+DEFAULT_PACKAGES += partx-utils mkf2fs e2fsprogs
$(eval $(call BuildTarget))
diff --git a/target/linux/sunxi/base-files/lib/upgrade/platform.sh b/target/linux/sunxi/base-files/lib/upgrade/platform.sh
index 776bdf53bf89c5eafc24b7b59b943e12f3fab77e..88ef4790e9c1452f8ce57fe1c265ce47810830ee 100644
--- a/target/linux/sunxi/base-files/lib/upgrade/platform.sh
+++ b/target/linux/sunxi/base-files/lib/upgrade/platform.sh
@@ -1,5 +1,28 @@
platform_check_image() {
- true
+ local diskdev partdev diff
+
+ export_bootdevice && export_partdevice diskdev -2 || {
+ echo "Unable to determine upgrade device"
+ return 1
+ }
+
+ get_partitions "/dev/$diskdev" bootdisk
+
+ #extract the boot sector from the image
+ get_image "$@" | dd of=/tmp/image.bs count=1 bs=512b 2>/dev/null
+
+ get_partitions /tmp/image.bs image
+
+ #compare tables
+ diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)"
+
+ rm -f /tmp/image.bs /tmp/partmap.bootdisk /tmp/partmap.image
+
+ if [ -n "$diff" ]; then
+ echo "Partition layout has changed. Full image will be written."
+ ask_bool 0 "Abort" && exit 1
+ return 0
+ fi
}
platform_copy_config() {
@@ -13,55 +36,54 @@ platform_copy_config() {
}
platform_do_upgrade() {
- local diskdev partdev ibs diff
-
- if export_bootdevice && export_partdevice diskdev -2; then
- sync
- if [ "$SAVE_PARTITIONS" = "1" ]; then
- get_partitions "/dev/$diskdev" bootdisk
-
- #get block size
- if [ -f "/sys/block/$diskdev/queue/physical_block_size" ]; then
- ibs="$(cat "/sys/block/$diskdev/queue/physical_block_size")"
- else
- ibs=512
- fi
-
- #extract the boot sector from the image
- get_image "$@" | dd of=/tmp/image.bs count=1 bs=512b
-
- get_partitions /tmp/image.bs image
-
- #compare tables
- diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)"
- if [ -n "$diff" ]; then
- echo "Partition layout is changed. Full image will be written."
- ask_bool 0 "Abort" && exit
-
- get_image "$@" | dd of="/dev/$diskdev" bs=4096 conv=fsync
- return 0
- fi
-
- #write uboot image
- get_image "$@" | dd of="$diskdev" bs=1024 skip=8 seek=8 count=1016 conv=fsync
- #iterate over each partition from the image and write it to the boot disk
- while read part start size; do
- part="$(($part - 2))"
- if export_partdevice partdev $part; then
- echo "Writing image to /dev/$partdev..."
- get_image "$@" | dd of="/dev/$partdev" ibs="$ibs" obs=1M skip="$start" count="$size" conv=fsync
- else
- echo "Unable to find partition $part device, skipped."
- fi
- done < /tmp/partmap.image
-
- #copy partition uuid
- echo "Writing new UUID to /dev/$diskdev..."
- get_image "$@" | dd of="/dev/$diskdev" bs=1 skip=440 count=4 seek=440 conv=fsync
+ local diskdev partdev diff
+
+ export_bootdevice && export_partdevice diskdev -2 || {
+ echo "Unable to determine upgrade device"
+ return 1
+ }
+
+ sync
+
+ if [ "$SAVE_PARTITIONS" = "1" ]; then
+ get_partitions "/dev/$diskdev" bootdisk
+
+ #extract the boot sector from the image
+ get_image "$@" | dd of=/tmp/image.bs count=1 bs=512b
+
+ get_partitions /tmp/image.bs image
+
+ #compare tables
+ diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)"
+ else
+ diff=1
+ fi
+
+ if [ -n "$diff" ]; then
+ get_image "$@" | dd of="/dev/$diskdev" bs=4096 conv=fsync
+
+ # Separate removal and addtion is necessary; otherwise, partition 1
+ # will be missing if it overlaps with the old partition 2
+ partx -d - "/dev/$diskdev"
+ partx -a - "/dev/$diskdev"
+
+ return 0
+ fi
+
+ #write uboot image
+ get_image "$@" | dd of="$diskdev" bs=1024 skip=8 seek=8 count=1016 conv=fsync
+ #iterate over each partition from the image and write it to the boot disk
+ while read part start size; do
+ part="$(($part - 2))"
+ if export_partdevice partdev $part; then
+ echo "Writing image to /dev/$partdev..."
+ get_image "$@" | dd of="/dev/$partdev" ibs="512" obs=1M skip="$start" count="$size" conv=fsync
else
- get_image "$@" | dd of="/dev/$diskdev" bs=4096 conv=fsync
+ echo "Unable to find partition $part device, skipped."
fi
+ done < /tmp/partmap.image
- sleep 1
- fi
+ #copy partition uuid
+ echo "Writing new UUID to /dev/$diskdev..."
+ get_image "$@" | dd of="/dev/$diskdev" bs=1 skip=440 count=4 seek=440 conv=fsync
}

View File

@ -1,85 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Thu, 1 Jun 2017 18:39:12 +0200
Subject: mvebu: fix sysupgrade
mvebu was modifying RAMFS_COPY_BIN and RAMFS_COPY_DATA from a
sysupgrade_pre_upgrade hook. As the ramfs is created from stage2, this
did not have an effect anymore after the staged sysupgrade changes.
As it doesn't really hurt to copy fw_printenv and fw_setenv
unconditionally, simply add them in /lib/upgrade/platform.sh, so stage2
will see them.
Config copying is moved to a function called by platform_copy_config, where
it belongs.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Fixes: FS#821
Fixes: 30f61a34b4cf "base-files: always use staged sysupgrade"
diff --git a/package/base-files/files/lib/upgrade/stage2 b/package/base-files/files/lib/upgrade/stage2
index cc8047d988e39ca9ba27d2588744aad469d1d978..bdbb8926643287f48a4ae62c5d1d4b4a29130859 100755
--- a/package/base-files/files/lib/upgrade/stage2
+++ b/package/base-files/files/lib/upgrade/stage2
@@ -48,7 +48,7 @@ switch_to_ramfs() {
/bin/sleep /bin/zcat /usr/bin/bzcat /usr/bin/printf /usr/bin/wc \
/bin/cut /usr/bin/printf /bin/sync /bin/mkdir /bin/rmdir \
/bin/rm /usr/bin/basename /bin/kill /bin/chmod /usr/bin/find \
- /bin/mknod
+ /bin/mknod /bin/touch
install_bin /sbin/mtd
install_bin /sbin/mount_root
diff --git a/target/linux/mvebu/base-files/lib/upgrade/linksys.sh b/target/linux/mvebu/base-files/lib/upgrade/linksys.sh
index d06a1b8ed0534364b595618f24b65f9f3a3e275d..63d1cd14a4deed407b217a518ae25a752f62969e 100644
--- a/target/linux/mvebu/base-files/lib/upgrade/linksys.sh
+++ b/target/linux/mvebu/base-files/lib/upgrade/linksys.sh
@@ -73,21 +73,7 @@ platform_do_upgrade_linksys() {
}
}
-linksys_preupgrade() {
- local board=$(mvebu_board_name)
-
- case "$board" in
- armada-385-linksys-caiman|armada-385-linksys-cobra|armada-385-linksys-shelby|armada-xp-linksys-mamba|armada-385-linksys-rango)
- export RAMFS_COPY_BIN="${RAMFS_COPY_BIN} /usr/sbin/fw_printenv /usr/sbin/fw_setenv"
- export RAMFS_COPY_BIN="${RAMFS_COPY_BIN} /bin/mkdir /bin/touch"
- export RAMFS_COPY_DATA="${RAMFS_COPY_DATA} /etc/fw_env.config /var/lock/fw_printenv.lock"
-
- [ -f /tmp/sysupgrade.tgz ] && {
- cp /tmp/sysupgrade.tgz /tmp/syscfg/sysupgrade.tgz
- }
- ;;
- esac
+platform_copy_config_linksys() {
+ cp -f /tmp/sysupgrade.tgz /tmp/syscfg/sysupgrade.tgz
+ sync
}
-
-append sysupgrade_pre_upgrade linksys_preupgrade
-
diff --git a/target/linux/mvebu/base-files/lib/upgrade/platform.sh b/target/linux/mvebu/base-files/lib/upgrade/platform.sh
index 77578e28d42fb7ca5e3f057e42ac5818e851736f..55c084483995d548556a560e171462f2d5456172 100755
--- a/target/linux/mvebu/base-files/lib/upgrade/platform.sh
+++ b/target/linux/mvebu/base-files/lib/upgrade/platform.sh
@@ -5,7 +5,8 @@
. /lib/mvebu.sh
-RAMFS_COPY_DATA=/lib/mvebu.sh
+RAMFS_COPY_BIN='/usr/sbin/fw_printenv /usr/sbin/fw_setenv'
+RAMFS_COPY_DATA='/lib/mvebu.sh /etc/fw_env.config /var/lock/fw_printenv.lock'
REQUIRE_IMAGE_METADATA=1
platform_check_image() {
@@ -31,6 +32,9 @@ platform_copy_config() {
local board=$(mvebu_board_name)
case "$board" in
+ armada-385-linksys-caiman|armada-385-linksys-cobra|armada-385-linksys-rango|armada-385-linksys-shelby|armada-xp-linksys-mamba)
+ platform_copy_config_linksys
+ ;;
armada-388-clearfog)
platform_copy_config_clearfog "$ARGV"
;;

View File

@ -1,139 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Tue, 20 Jun 2017 11:01:27 +0200
Subject: generic: mtd: backport unlock support and asserted fixes for certain Winbond/Spansion flash chips
diff --git a/target/linux/generic/patches-4.4/049-0001-mtd-spi-nor-wait-until-lock-unlock-operations-are-re.patch b/target/linux/generic/patches-4.4/049-0001-mtd-spi-nor-wait-until-lock-unlock-operations-are-re.patch
new file mode 100644
index 0000000000000000000000000000000000000000..c8aafe2ebbf7368f47e8f4d7a24dd5e45583a136
--- /dev/null
+++ b/target/linux/generic/patches-4.4/049-0001-mtd-spi-nor-wait-until-lock-unlock-operations-are-re.patch
@@ -0,0 +1,66 @@
+From 32321e950d8a237d7e8f3a9b76220007dfa87544 Mon Sep 17 00:00:00 2001
+Message-Id: <32321e950d8a237d7e8f3a9b76220007dfa87544.1462572686.git.mschiffer@universe-factory.net>
+From: =?UTF-8?q?Ezequiel=20Garc=C3=ADa?= <ezequiel@vanguardiasur.com.ar>
+Date: Mon, 28 Dec 2015 17:54:51 -0300
+Subject: [PATCH] mtd: spi-nor: wait until lock/unlock operations are ready
+
+On Micron and Numonyx devices, the status register write command
+(WRSR), raises a work-in-progress bit (WIP) on the status register.
+The datasheets for these devices specify that while the status
+register write is in progress, the status register WIP bit can still
+be read to check the end of the operation.
+
+This commit adds a wait_till_ready call on lock/unlock operations,
+which is required for Micron and Numonyx but should be harmless for
+others. This is needed to prevent applications from issuing erase or
+program operations before the unlock operation is completed.
+
+Reported-by: Stas Sergeev <stsp@list.ru>
+Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
+Signed-off-by: Brian Norris <computersforpeace@gmail.com>
+---
+ drivers/mtd/spi-nor/spi-nor.c | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+--- a/drivers/mtd/spi-nor/spi-nor.c
++++ b/drivers/mtd/spi-nor/spi-nor.c
+@@ -463,6 +463,7 @@ static int stm_lock(struct spi_nor *nor,
+ u8 status_old, status_new;
+ u8 mask = SR_BP2 | SR_BP1 | SR_BP0;
+ u8 shift = ffs(mask) - 1, pow, val;
++ int ret;
+
+ status_old = read_sr(nor);
+
+@@ -499,7 +500,10 @@ static int stm_lock(struct spi_nor *nor,
+ return -EINVAL;
+
+ write_enable(nor);
+- return write_sr(nor, status_new);
++ ret = write_sr(nor, status_new);
++ if (ret)
++ return ret;
++ return spi_nor_wait_till_ready(nor);
+ }
+
+ /*
+@@ -513,6 +517,7 @@ static int stm_unlock(struct spi_nor *no
+ uint8_t status_old, status_new;
+ u8 mask = SR_BP2 | SR_BP1 | SR_BP0;
+ u8 shift = ffs(mask) - 1, pow, val;
++ int ret;
+
+ status_old = read_sr(nor);
+
+@@ -547,7 +552,10 @@ static int stm_unlock(struct spi_nor *no
+ return -EINVAL;
+
+ write_enable(nor);
+- return write_sr(nor, status_new);
++ ret = write_sr(nor, status_new);
++ if (ret)
++ return ret;
++ return spi_nor_wait_till_ready(nor);
+ }
+
+ /*
diff --git a/target/linux/generic/patches-4.4/049-0002-mtd-spi-nor-wait-for-SR_WIP-to-clear-on-initial-unlo.patch b/target/linux/generic/patches-4.4/049-0002-mtd-spi-nor-wait-for-SR_WIP-to-clear-on-initial-unlo.patch
new file mode 100644
index 0000000000000000000000000000000000000000..0541c95594ec14f62b5db787f4d52d5a42777cdc
--- /dev/null
+++ b/target/linux/generic/patches-4.4/049-0002-mtd-spi-nor-wait-for-SR_WIP-to-clear-on-initial-unlo.patch
@@ -0,0 +1,33 @@
+From edf891ef9ab773363f8e58022a26d7d31604aed6 Mon Sep 17 00:00:00 2001
+Message-Id: <edf891ef9ab773363f8e58022a26d7d31604aed6.1462572703.git.mschiffer@universe-factory.net>
+From: Brian Norris <computersforpeace@gmail.com>
+Date: Fri, 29 Jan 2016 11:25:30 -0800
+Subject: [PATCH] mtd: spi-nor: wait for SR_WIP to clear on initial unlock
+
+Fixup a piece leftover by commit 32321e950d8a ("mtd: spi-nor: wait until
+lock/unlock operations are ready"). That commit made us wait for the WIP
+bit to settle after lock/unlock operations, but it missed the open-coded
+"unlock" that happens at probe() time.
+
+We should probably have this code utilize the unlock() routines in the
+future, to avoid duplication, but unfortunately, flash which need to be
+unlocked don't all have a proper ->flash_unlock() callback.
+
+Signed-off-by: Brian Norris <computersforpeace@gmail.com>
+Cc: Stas Sergeev <stsp@users.sourceforge.net>
+Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
+Tested-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
+---
+ drivers/mtd/spi-nor/spi-nor.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/mtd/spi-nor/spi-nor.c
++++ b/drivers/mtd/spi-nor/spi-nor.c
+@@ -1169,6 +1169,7 @@ int spi_nor_scan(struct spi_nor *nor, co
+ info->flags & SPI_NOR_HAS_LOCK) {
+ write_enable(nor);
+ write_sr(nor, 0);
++ spi_nor_wait_till_ready(nor);
+ }
+
+ if (!mtd->name)
diff --git a/target/linux/generic/patches-4.4/466-revert-mtd-spi-nor-fix-Spansion-regressions-aliased-.patch b/target/linux/generic/patches-4.4/466-revert-mtd-spi-nor-fix-Spansion-regressions-aliased-.patch
new file mode 100644
index 0000000000000000000000000000000000000000..7c6530a5e0e8bc144e1d4497428e3c3691c2ef22
--- /dev/null
+++ b/target/linux/generic/patches-4.4/466-revert-mtd-spi-nor-fix-Spansion-regressions-aliased-.patch
@@ -0,0 +1,18 @@
+--- a/drivers/mtd/spi-nor/spi-nor.c
++++ b/drivers/mtd/spi-nor/spi-nor.c
+@@ -1161,6 +1161,7 @@ int spi_nor_scan(struct spi_nor *nor, co
+ JEDEC_MFR(info) == SNOR_MFR_INTEL ||
+ JEDEC_MFR(info) == SNOR_MFR_MACRONIX ||
+ JEDEC_MFR(info) == SNOR_MFR_SST ||
++ JEDEC_MFR(info) == SNOR_MFR_WINBOND ||
+ info->flags & SPI_NOR_HAS_LOCK) {
+ write_enable(nor);
+ write_sr(nor, 0);
+@@ -1178,6 +1179,7 @@ int spi_nor_scan(struct spi_nor *nor, co
+
+ /* NOR protection support for STmicro/Micron chips and similar */
+ if (JEDEC_MFR(info) == SNOR_MFR_MICRON ||
++ JEDEC_MFR(info) == SNOR_MFR_WINBOND ||
+ info->flags & SPI_NOR_HAS_LOCK) {
+ nor->flash_lock = stm_lock;
+ nor->flash_unlock = stm_unlock;

View File

@ -1,198 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Fri, 10 Mar 2017 01:23:50 +0100
Subject: vxlan: add new package for netifd VXLAN proto
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/package/network/config/vxlan/Makefile b/package/network/config/vxlan/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..a471d4e90cbe30c1d1dd01dbf7553995d8c0485e
--- /dev/null
+++ b/package/network/config/vxlan/Makefile
@@ -0,0 +1,32 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=vxlan
+PKG_VERSION:=1
+PKG_LICENSE:=GPL-2.0
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/vxlan
+ SECTION:=net
+ CATEGORY:=Network
+ MAINTAINER:=Matthias Schiffer <mschiffer@universe-factory.net>
+ TITLE:=Virtual eXtensible LAN config support
+ DEPENDS:=+kmod-vxlan
+endef
+
+define Package/vxlan/description
+ Virtual eXtensible LAN config support in /etc/config/network.
+endef
+
+define Build/Compile
+endef
+
+define Build/Configure
+endef
+
+define Package/vxlan/install
+ $(INSTALL_DIR) $(1)/lib/netifd/proto
+ $(INSTALL_BIN) ./files/vxlan.sh $(1)/lib/netifd/proto/vxlan.sh
+endef
+
+$(eval $(call BuildPackage,vxlan))
diff --git a/package/network/config/vxlan/files/vxlan.sh b/package/network/config/vxlan/files/vxlan.sh
new file mode 100755
index 0000000000000000000000000000000000000000..27ccd8f12759f69c7c226cac0c923335b8ccc6a8
--- /dev/null
+++ b/package/network/config/vxlan/files/vxlan.sh
@@ -0,0 +1,148 @@
+#!/bin/sh
+
+[ -n "$INCLUDE_ONLY" ] || {
+ . /lib/functions.sh
+ . /lib/functions/network.sh
+ . ../netifd-proto.sh
+ init_proto "$@"
+}
+
+vxlan_generic_setup() {
+ local cfg="$1"
+ local mode="$2"
+ local local="$3"
+ local remote="$4"
+
+ local link="$cfg"
+
+ local port vid ttl tos mtu macaddr zone
+ json_get_vars port vid ttl tos mtu macaddr zone
+
+
+ proto_init_update "$link" 1
+
+ proto_add_tunnel
+ json_add_string mode "$mode"
+
+ [ -n "$tunlink" ] && json_add_string link "$tunlink"
+ [ -n "$local" ] && json_add_string local "$local"
+ [ -n "$remote" ] && json_add_string remote "$remote"
+
+ [ -n "$ttl" ] && json_add_int ttl "$ttl"
+ [ -n "$tos" ] && json_add_string tos "$tos"
+ [ -n "$mtu" ] && json_add_int mtu "$mtu"
+
+ json_add_object 'data'
+ [ -n "$port" ] && json_add_int port "$port"
+ [ -n "$vid" ] && json_add_int id "$vid"
+ [ -n "$macaddr" ] && json_add_string macaddr "$macaddr"
+ json_close_object
+
+ proto_close_tunnel
+
+ proto_add_data
+ [ -n "$zone" ] && json_add_string zone "$zone"
+ proto_close_data
+
+ proto_send_update "$cfg"
+}
+
+proto_vxlan_setup() {
+ local cfg="$1"
+
+ local ipaddr peeraddr
+ json_get_vars ipaddr peeraddr tunlink
+
+ [ -z "$peeraddr" ] && {
+ proto_notify_error "$cfg" "MISSING_ADDRESS"
+ proto_block_restart "$cfg"
+ exit
+ }
+
+ ( proto_add_host_dependency "$cfg" '' "$tunlink" )
+
+ [ -z "$ipaddr" ] && {
+ local wanif="$tunlink"
+ if [ -z "$wanif" ] && ! network_find_wan wanif; then
+ proto_notify_error "$cfg" "NO_WAN_LINK"
+ exit
+ fi
+
+ if ! network_get_ipaddr ipaddr "$wanif"; then
+ proto_notify_error "$cfg" "NO_WAN_LINK"
+ exit
+ fi
+ }
+
+ vxlan_generic_setup "$cfg" 'vxlan' "$ipaddr" "$peeraddr"
+}
+
+proto_vxlan6_setup() {
+ local cfg="$1"
+
+ local ip6addr peer6addr
+ json_get_vars ip6addr peer6addr tunlink
+
+ [ -z "$peer6addr" ] && {
+ proto_notify_error "$cfg" "MISSING_ADDRESS"
+ proto_block_restart "$cfg"
+ exit
+ }
+
+ ( proto_add_host_dependency "$cfg" '' "$tunlink" )
+
+ [ -z "$ip6addr" ] && {
+ local wanif="$tunlink"
+ if [ -z "$wanif" ] && ! network_find_wan6 wanif; then
+ proto_notify_error "$cfg" "NO_WAN_LINK"
+ exit
+ fi
+
+ if ! network_get_ipaddr6 ip6addr "$wanif"; then
+ proto_notify_error "$cfg" "NO_WAN_LINK"
+ exit
+ fi
+ }
+
+ vxlan_generic_setup "$cfg" 'vxlan6' "$ip6addr" "$peer6addr"
+}
+
+proto_vxlan_teardown() {
+ local cfg="$1"
+}
+
+proto_vxlan6_teardown() {
+ local cfg="$1"
+}
+
+vxlan_generic_init_config() {
+ no_device=1
+ available=1
+
+ proto_config_add_string "tunlink"
+ proto_config_add_string "zone"
+
+ proto_config_add_int "vid"
+ proto_config_add_int "port"
+ proto_config_add_int "ttl"
+ proto_config_add_int "tos"
+ proto_config_add_int "mtu"
+ proto_config_add_string "macaddr"
+}
+
+proto_vxlan_init_config() {
+ vxlan_generic_init_config
+ proto_config_add_string "ipaddr"
+ proto_config_add_string "peeraddr"
+}
+
+proto_vxlan6_init_config() {
+ vxlan_generic_init_config
+ proto_config_add_string "ip6addr"
+ proto_config_add_string "peer6addr"
+}
+
+[ -n "$INCLUDE_ONLY" ] || {
+ add_protocol vxlan
+ add_protocol vxlan6
+}

View File

@ -1,88 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Tue, 9 Jan 2018 16:31:07 +0100
Subject: Revert "scripts/package-metadata.pl: inhibit compile deps on missing build types"
This reverts commit b616aa6db7a9952c182ab49d7942fb67c09803d5. The change
conflicts with our PROVIDES fix and is not strictly necessary for Gluon.
diff --git a/scripts/package-metadata.pl b/scripts/package-metadata.pl
index c49d132912828531c7125787f4f53d7130323123..2da32c770ef3333bfcc18922ede556f9734510c7 100755
--- a/scripts/package-metadata.pl
+++ b/scripts/package-metadata.pl
@@ -460,27 +460,20 @@ sub gen_package_mk() {
next unless $pkg->{"builddepends/$type"};
foreach my $dep (@{$pkg->{"builddepends/$type"}}) {
my $suffix = "";
- my $deptype = "";
my $condition;
if ($dep =~ /^(.+):(.+)/) {
$condition = $1;
$dep = $2;
}
- if ($dep =~ /^(.+)\/(.+)/) {
+ if ($dep =~ /^(.+)(\/.+)/) {
$dep = $1;
- $deptype = $2;
- $suffix = "/$2";
+ $suffix = $2;
}
my $idx = "";
my $pkg_dep = $package{$dep};
if (defined($pkg_dep) && defined($pkg_dep->{src})) {
- unless (!$deptype || grep { $_ eq $deptype } @{$pkg_dep->{buildtypes}}) {
- warn sprintf "WARNING: Makefile '%s' has a %s build dependency on '%s/%s' but '%s' does not implement a '%s' build type\n",
- $pkg->{makefile}, $type, $pkg_dep->{src}, $deptype, $pkg_dep->{makefile}, $deptype;
- next;
- }
$idx = $pkg_dep->{subdir}.$pkg_dep->{src};
} elsif (defined($srcpackage{$dep})) {
$idx = $subdir{$dep}.$dep;
@@ -506,16 +499,14 @@ sub gen_package_mk() {
my $condition;
my $prefix = "";
my $suffix = "";
- my $deptype = "";
if ($deps =~ /^(.+):(.+)/) {
$condition = $1;
$deps = $2;
}
- if ($deps =~ /^(.+)\/(.+)/) {
+ if ($deps =~ /^(.+)(\/.+)/) {
$deps = $1;
- $deptype = $2;
- $suffix = "/$2";
+ $suffix = $2;
}
my $pkg_dep = $package{$deps};
@@ -530,17 +521,7 @@ sub gen_package_mk() {
foreach my $dep (@deps) {
$pkg_dep = $package{$deps};
if (defined $pkg_dep->{src}) {
- unless (!$deptype || grep { $_ eq $deptype } @{$pkg_dep->{buildtypes}}) {
- warn sprintf "WARNING: Makefile '%s' has a build dependency on '%s/%s' but '%s' does not implement a '%s' build type\n",
- $pkg->{makefile}, $pkg_dep->{src}, $deptype, $pkg_dep->{makefile}, $deptype;
- next;
- }
- unless ($pkg->{src} ne $pkg_dep->{sec}.$suffix) {
- warn sprintf "WARNING: Makefile '%s' has a build dependency on itself\n",
- $pkg->{makefile};
- next;
- }
- $idx = $pkg_dep->{subdir}.$pkg_dep->{src};
+ ($pkg->{src} ne $pkg_dep->{src}.$suffix) and $idx = $pkg_dep->{subdir}.$pkg_dep->{src};
} elsif (defined($srcpackage{$dep})) {
$idx = $subdir{$dep}.$dep;
}
@@ -592,7 +573,7 @@ ifndef DUMP_TARGET_DB
( \\
$cmds \\
) > \$@
-
+
ifneq (\$(IMAGEOPT)\$(CONFIG_IMAGEOPT),)
package/preconfig: \$(TARGET_DIR)/etc/uci-defaults/$preconfig
endif

View File

@ -1,306 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sat, 8 Jul 2017 01:35:35 +0200
Subject: scripts: metadata: always resolve dependencies through provides list
Instead of adding virtual packages to the normal package list, keep a
separate list for provides, make each package provide itself, and resolve
all dependencies through this list. This allows to use PROVIDES to replace
existing packages.
A side effect of the changes in the makefile dependency logic is that
build dependencies are now always interpreted as source package names,
instead of putting build and runtime dependencies into the same list.
Fixes FS#837.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/scripts/feeds b/scripts/feeds
index 55c294ad0a4ec2f0419d12deddeda7324c349e04..a38eb454585f5dd27b707db23184b7df07ab2658 100755
--- a/scripts/feeds
+++ b/scripts/feeds
@@ -252,7 +252,6 @@ sub search_feed {
my $substr;
my $pkgmatch = 1;
- next if $pkg->{vdepends};
foreach my $substr (@substr) {
my $match;
foreach my $key (qw(name title description src)) {
@@ -306,7 +305,6 @@ sub list_feed {
get_feed($feed);
foreach my $name (sort { lc($a) cmp lc($b) } keys %$feed_package) {
my $pkg = $feed_package->{$name};
- next if $pkg->{vdepends};
if($pkg->{name}) {
printf "\%-32s\t\%s\n", $pkg->{name}, $pkg->{title};
}
@@ -588,7 +586,6 @@ sub install {
get_feed($f->[1]);
foreach my $name (sort { lc($a) cmp lc($b) } keys %$feed_package) {
my $p = $feed_package->{$name};
- next if $p->{vdepends};
if( $p->{name} ) {
install_package($feed, $p->{name}, exists($opts{f})) == 0 or $ret = 1;
get_feed($f->[1]);
diff --git a/scripts/metadata.pm b/scripts/metadata.pm
index 8334f26d3179a0eb83aa1aa976778ff5828faf45..e7bdbab4568ddd7e10c10b2ca6a718380c7d6308 100644
--- a/scripts/metadata.pm
+++ b/scripts/metadata.pm
@@ -2,9 +2,10 @@ package metadata;
use base 'Exporter';
use strict;
use warnings;
-our @EXPORT = qw(%package %srcpackage %category %subdir %preconfig %features %overrides clear_packages parse_package_metadata parse_target_metadata get_multiline @ignore);
+our @EXPORT = qw(%package %vpackage %srcpackage %category %subdir %preconfig %features %overrides clear_packages parse_package_metadata parse_target_metadata get_multiline @ignore);
our %package;
+our %vpackage;
our %preconfig;
our %srcpackage;
our %category;
@@ -124,6 +125,7 @@ sub clear_packages() {
%subdir = ();
%preconfig = ();
%package = ();
+ %vpackage = ();
%srcpackage = ();
%category = ();
%features = ();
@@ -179,6 +181,9 @@ sub parse_package_metadata($) {
$pkg->{override} = $override;
$package{$1} = $pkg;
push @{$srcpackage{$src}}, $pkg;
+
+ $vpackage{$1} or $vpackage{$1} = [];
+ unshift @{$vpackage{$1}}, $1;
};
/^Feature:\s*(.+?)\s*$/ and do {
undef $pkg;
@@ -210,14 +215,8 @@ sub parse_package_metadata($) {
/^Provides: \s*(.+)\s*$/ and do {
my @vpkg = split /\s+/, $1;
foreach my $vpkg (@vpkg) {
- $package{$vpkg} or $package{$vpkg} = {
- name => $vpkg,
- vdepends => [],
- src => $src,
- subdir => $subdir,
- makefile => $makefile
- };
- push @{$package{$vpkg}->{vdepends}}, $pkg->{name};
+ $vpackage{$vpkg} or $vpackage{$vpkg} = [];
+ push @{$vpackage{$vpkg}}, $pkg->{name};
}
};
/^Menu-Depends: \s*(.+)\s*$/ and $pkg->{mdepends} = [ split /\s+/, $1 ];
diff --git a/scripts/package-metadata.pl b/scripts/package-metadata.pl
index 2da32c770ef3333bfcc18922ede556f9734510c7..998d37dd415d89e7eccad2ddf73f855f6a9b017c 100755
--- a/scripts/package-metadata.pl
+++ b/scripts/package-metadata.pl
@@ -101,14 +101,16 @@ my %dep_check;
sub __find_package_dep($$) {
my $pkg = shift;
my $name = shift;
- my $deps = ($pkg->{vdepends} or $pkg->{depends});
+ my $deps = $pkg->{depends};
return 0 unless defined $deps;
- foreach my $dep (@{$deps}) {
- next if $dep_check{$dep};
- $dep_check{$dep} = 1;
- return 1 if $dep eq $name;
- return 1 if ($package{$dep} and (__find_package_dep($package{$dep},$name) == 1));
+ foreach my $vpkg (@{$deps}) {
+ foreach my $dep (@{$vpackage{$vpkg}}) {
+ next if $dep_check{$dep};
+ $dep_check{$dep} = 1;
+ return 1 if $dep eq $name;
+ return 1 if ($package{$dep} and (__find_package_dep($package{$dep},$name) == 1));
+ }
}
return 0;
}
@@ -156,7 +158,6 @@ sub mconf_depends {
my $m = "depends on";
my $flags = "";
$depend =~ s/^([@\+]+)// and $flags = $1;
- my $vdep;
my $condition = $parent_condition;
next if $condition eq $depend;
@@ -173,9 +174,9 @@ sub mconf_depends {
}
$depend = $2;
}
- next if $package{$depend} and $package{$depend}->{buildonly};
if ($flags =~ /\+/) {
- if ($vdep = $package{$depend}->{vdepends}) {
+ my $vdep = $vpackage{$depend};
+ if ($vdep and @$vdep > 0) {
my @vdeps;
$depend = undef;
@@ -209,7 +210,8 @@ sub mconf_depends {
$flags =~ /@/ or $depend = "PACKAGE_$depend";
} else {
- if ($vdep = $package{$depend}->{vdepends}) {
+ my $vdep = $vpackage{$depend};
+ if ($vdep and @$vdep > 0) {
$depend = join("||", map { "PACKAGE_".$_ } @$vdep);
} else {
$flags =~ /@/ or $depend = "PACKAGE_$depend";
@@ -413,7 +415,6 @@ sub get_conditional_dep($$) {
sub gen_package_mk() {
my %conf;
- my %dep;
my %done;
my $line;
@@ -423,8 +424,6 @@ sub gen_package_mk() {
my $pkg = $package{$name};
my @srcdeps;
- next if defined $pkg->{vdepends};
-
$config = "\$(CONFIG_PACKAGE_$name)";
if ($config) {
$pkg->{buildonly} and $config = "";
@@ -445,16 +444,7 @@ sub gen_package_mk() {
print "buildtypes-$pkg->{subdir}$pkg->{src} = ".join(' ', @{$pkg->{buildtypes}})."\n";
}
- foreach my $spkg (@{$srcpackage{$pkg->{src}}}) {
- foreach my $dep (@{$spkg->{depends}}, @{$spkg->{builddepends}}) {
- $dep =~ /@/ or do {
- $dep =~ s/\+//g;
- push @srcdeps, $dep;
- };
- }
- }
foreach my $type (@{$pkg->{buildtypes}}) {
- my @extra_deps;
my %deplines;
next unless $pkg->{"builddepends/$type"};
@@ -492,63 +482,70 @@ sub gen_package_mk() {
}
}
- my $hasdeps = 0;
my %deplines;
- foreach my $deps (@srcdeps) {
- my $idx;
- my $condition;
- my $prefix = "";
- my $suffix = "";
-
- if ($deps =~ /^(.+):(.+)/) {
- $condition = $1;
- $deps = $2;
- }
- if ($deps =~ /^(.+)(\/.+)/) {
- $deps = $1;
- $suffix = $2;
- }
+ foreach my $spkg (@{$srcpackage{$pkg->{src}}}) {
+ foreach my $bdep (@{$spkg->{builddepends}}) {
+ my $condition;
+ my $suffix = "";
- my $pkg_dep = $package{$deps};
- my @deps;
+ if ($bdep =~ /^(.+):(.+)/) {
+ $condition = $1;
+ $bdep = $2;
+ }
+ if ($bdep =~ /^(.+)(\/.+)/) {
+ $bdep = $1;
+ $suffix = $2;
+ }
- if ($pkg_dep->{vdepends}) {
- @deps = @{$pkg_dep->{vdepends}};
- } else {
- @deps = ($deps);
+ next unless $subdir{$bdep};
+ my $idx = $subdir{$bdep}.$bdep.$suffix;
+
+ my $depline = get_conditional_dep($condition, "\$(curdir)/$idx/compile");
+ if ($depline) {
+ $deplines{$depline}++;
+ }
}
- foreach my $dep (@deps) {
- $pkg_dep = $package{$deps};
- if (defined $pkg_dep->{src}) {
- ($pkg->{src} ne $pkg_dep->{src}.$suffix) and $idx = $pkg_dep->{subdir}.$pkg_dep->{src};
- } elsif (defined($srcpackage{$dep})) {
- $idx = $subdir{$dep}.$dep;
+ foreach my $dep (@{$spkg->{depends}}) {
+ my $condition;
+ my $suffix = "";
+
+ next if $dep =~ /@/;
+ $dep =~ s/\+//g;
+
+ if ($dep =~ /^(.+):(.+)/) {
+ $condition = $1;
+ $dep = $2;
}
- undef $idx if $idx eq 'base-files';
- if ($idx) {
- $idx .= $suffix;
+ if ($dep =~ /^(.+)(\/.+)/) {
+ $dep = $1;
+ $suffix = $2;
+ }
+
+ next unless $vpackage{$dep};
+
+ my @vdeps = @{$vpackage{$dep}};
+ foreach my $vdep (@vdeps) {
+ my $pkg_dep = $package{$vdep};
- my $depline;
+ next unless $pkg_dep;
next if $pkg->{src} eq $pkg_dep->{src}.$suffix;
- next if $dep{$condition.":".$pkg->{src}."->".$idx};
- next if $dep{$pkg->{src}."->($dep)".$idx} and $pkg_dep->{vdepends};
- my $depstr;
- if ($pkg_dep->{vdepends}) {
- $depstr = "\$(if \$(CONFIG_PACKAGE_$dep),\$(curdir)/$idx/compile)";
- $dep{$pkg->{src}."->($dep)".$idx} = 1;
+ my $idx = $pkg_dep->{subdir}.$pkg_dep->{src}.$suffix;
+ my $depstr;
+ if (@vdeps > 1) {
+ $depstr = "\$(if \$(CONFIG_PACKAGE_$vdep),\$(curdir)/$idx/compile)";
} else {
$depstr = "\$(curdir)/$idx/compile";
- $dep{$pkg->{src}."->".$idx} = 1;
}
- $depline = get_conditional_dep($condition, $depstr);
+ my $depline = get_conditional_dep($condition, $depstr);
if ($depline) {
$deplines{$depline}++;
}
}
}
}
+
my $depline = join(" ", sort keys %deplines);
if ($depline) {
$line .= "\$(curdir)/".$pkg->{subdir}."$pkg->{src}/compile += $depline\n";
@@ -573,7 +570,7 @@ ifndef DUMP_TARGET_DB
( \\
$cmds \\
) > \$@
-
+
ifneq (\$(IMAGEOPT)\$(CONFIG_IMAGEOPT),)
package/preconfig: \$(TARGET_DIR)/etc/uci-defaults/$preconfig
endif

View File

@ -1,33 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Mon, 10 Jul 2017 10:35:19 +0200
Subject: base-files: upgrade: correctly handle nand_do_upgrade argument passed from preupgrade
Fixes: 30f61a34b4cf "base-files: always use staged sysupgrade"
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh
index af7682c29e005c6ca47b91e9be2d60c359a90d05..6ccd84c5a95348124412adc8bf41d3fa4894435a 100644
--- a/package/base-files/files/lib/upgrade/common.sh
+++ b/package/base-files/files/lib/upgrade/common.sh
@@ -222,7 +222,7 @@ default_do_upgrade() {
do_upgrade_stage2() {
v "Performing system upgrade..."
if [ -n "$do_upgrade" ]; then
- $do_upgrade "$IMAGE"
+ eval "$do_upgrade"
elif type 'platform_do_upgrade' >/dev/null 2>/dev/null; then
platform_do_upgrade "$IMAGE"
else
diff --git a/package/base-files/files/lib/upgrade/nand.sh b/package/base-files/files/lib/upgrade/nand.sh
index 1e69c8f9657b39adf2a2c33bd9bac9303bcbc3d7..72f0fe0e10312e74ce085ad53f0adceb921fd013 100644
--- a/package/base-files/files/lib/upgrade/nand.sh
+++ b/package/base-files/files/lib/upgrade/nand.sh
@@ -289,7 +289,7 @@ nand_do_upgrade() {
# hook; this piece of code handles scripts that haven't been
# updated. All scripts should gradually move to call nand_do_upgrade
# from platform_do_upgrade instead.
- export do_upgrade=nand_do_upgrade
+ export do_upgrade="nand_do_upgrade '$1'"
return
fi

View File

@ -1,42 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Thu, 13 Jul 2017 00:19:32 +0200
Subject: base-files: upgrade: don't loop forever trying to kill processes
When processes don't die on SIGKILL (usually because of kernel bugs), it's
better to give up instead of looping forever.
upgraded will trigger a reboot in this case (and if this fails, a hardware
watchdog will eventually time out and reset the system, if present).
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/package/base-files/files/lib/upgrade/stage2 b/package/base-files/files/lib/upgrade/stage2
index bdbb8926643287f48a4ae62c5d1d4b4a29130859..097ad63adfecdd70019acaa5b652d2056e774c3f 100755
--- a/package/base-files/files/lib/upgrade/stage2
+++ b/package/base-files/files/lib/upgrade/stage2
@@ -87,6 +87,8 @@ switch_to_ramfs() {
}
kill_remaining() { # [ <signal> [ <loop> ] ]
+ local loop_limit=10
+
local sig="${1:-TERM}"
local loop="${2:-0}"
local run=true
@@ -117,8 +119,15 @@ kill_remaining() { # [ <signal> [ <loop> ] ]
[ $loop -eq 1 ] && run=true
done
+
+ let loop_limit--
+ [ $loop_limit -eq 0 ] && {
+ echo
+ echo "Failed to kill all processes."
+ exit 1
+ }
done
- echo ""
+ echo
}

View File

@ -1,39 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sat, 10 Jun 2017 16:14:54 +0200
Subject: bcm53xx: upgrade: fix RAMFS_COPY_*
Fixes: 30f61a34b4cf "base-files: always use staged sysupgrade"
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/package/base-files/files/lib/upgrade/stage2 b/package/base-files/files/lib/upgrade/stage2
index 097ad63adfecdd70019acaa5b652d2056e774c3f..8cc8c8b34e9f349f1d1283ac00f9782b52ab01c1 100755
--- a/package/base-files/files/lib/upgrade/stage2
+++ b/package/base-files/files/lib/upgrade/stage2
@@ -48,7 +48,7 @@ switch_to_ramfs() {
/bin/sleep /bin/zcat /usr/bin/bzcat /usr/bin/printf /usr/bin/wc \
/bin/cut /usr/bin/printf /bin/sync /bin/mkdir /bin/rmdir \
/bin/rm /usr/bin/basename /bin/kill /bin/chmod /usr/bin/find \
- /bin/mknod /bin/touch
+ /bin/mknod /bin/touch /bin/sed
install_bin /sbin/mtd
install_bin /sbin/mount_root
diff --git a/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh b/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
index f2e007db22fa8fde93bf0dd58b359f6515e0445c..6a9e4950450cb896db7ebb3eb901b5cf51030295 100644
--- a/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
@@ -1,3 +1,5 @@
+RAMFS_COPY_BIN='/usr/bin/osafeloader /usr/bin/oseama'
+
PART_NAME=firmware
# $(1): file to read magic from
@@ -260,8 +262,6 @@ platform_pre_upgrade_seama() {
}
platform_pre_upgrade() {
- export RAMFS_COPY_BIN="${RAMFS_COPY_BIN} /usr/bin/osafeloader /usr/bin/oseama /bin/sed"
-
local file_type=$(platform_identify "$1")
[ "$(platform_flash_type)" != "nand" ] && return

View File

@ -1,68 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Mon, 10 Jul 2017 18:03:39 +0200
Subject: ipq806x: upgrade: fix RAMFS_COPY_*
RAMFS_COPY_* are moved to platform.sh toplevel. The unneeded
linksys_preupgrade function is removed, and the nand_do_upgrade call is
moved to platform_do_upgrade.
Fixes: 30f61a34b4cf "base-files: always use staged sysupgrade"
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/target/linux/ipq806x/base-files/lib/upgrade/linksys.sh b/target/linux/ipq806x/base-files/lib/upgrade/linksys.sh
index 12f25efdae87979e79a252237f735932cb66d42f..0234ce0a51a0a92dcd719102f83e19686442574a 100644
--- a/target/linux/ipq806x/base-files/lib/upgrade/linksys.sh
+++ b/target/linux/ipq806x/base-files/lib/upgrade/linksys.sh
@@ -99,12 +99,3 @@ platform_do_upgrade_linksys() {
fi
}
}
-
-linksys_preupgrade() {
- export RAMFS_COPY_BIN="${RAMFS_COPY_BIN} /usr/sbin/fw_printenv /usr/sbin/fw_setenv"
- export RAMFS_COPY_BIN="${RAMFS_COPY_BIN} /bin/mkdir /bin/touch"
- export RAMFS_COPY_DATA="${RAMFS_COPY_DATA} /etc/fw_env.config /var/lock/fw_printenv.lock"
-
-}
-
-append sysupgrade_pre_upgrade linksys_preupgrade
diff --git a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
index c3741f9ff242cddb3c185c2f638c7b4dff781e1b..6455b57cfb1346b7cc9e103065080d8ae92edc19 100644
--- a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
@@ -3,11 +3,14 @@
PART_NAME=firmware
REQUIRE_IMAGE_METADATA=1
+RAMFS_COPY_BIN='/usr/sbin/fw_printenv /usr/sbin/fw_setenv'
+RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
+
platform_check_image() {
return 0;
}
-platform_pre_upgrade() {
+platform_do_upgrade() {
local board=$(ipq806x_board_name)
case "$board" in
@@ -17,18 +20,8 @@ platform_pre_upgrade() {
r7500 |\
r7500v2 |\
r7800)
- nand_do_upgrade "$1"
- ;;
- ea8500)
- linksys_preupgrade "$1"
+ nand_do_upgrade "$ARGV"
;;
- esac
-}
-
-platform_do_upgrade() {
- local board=$(ipq806x_board_name)
-
- case "$board" in
c2600)
PART_NAME="os-image:rootfs"
MTD_CONFIG_ARGS="-s 0x200000"

View File

@ -1,60 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Mon, 10 Jul 2017 18:16:23 +0200
Subject: kirkwood: upgrade: fix RAMFS_COPY_*
RAMFS_COPY_* are moved to platform.sh toplevel. The nand_do_upgrade call is
moved to platform_do_upgrade.
Fixes: 30f61a34b4cf "base-files: always use staged sysupgrade"
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/target/linux/kirkwood/base-files/lib/upgrade/linksys.sh b/target/linux/kirkwood/base-files/lib/upgrade/linksys.sh
index 13a8f1cb554462acf39a59c9d5c1e6cd4ec222f5..dde3bd1b2190d68ce54e6c2883a45032d58599b2 100644
--- a/target/linux/kirkwood/base-files/lib/upgrade/linksys.sh
+++ b/target/linux/kirkwood/base-files/lib/upgrade/linksys.sh
@@ -69,11 +69,3 @@ platform_do_upgrade_linksys() {
fi
}
}
-
-linksys_preupgrade() {
- export RAMFS_COPY_BIN="${RAMFS_COPY_BIN} /usr/sbin/fw_printenv /usr/sbin/fw_setenv"
- export RAMFS_COPY_BIN="${RAMFS_COPY_BIN} /bin/mkdir /bin/touch"
- export RAMFS_COPY_DATA="${RAMFS_COPY_DATA} /etc/fw_env.config /var/lock/fw_printenv.lock"
-}
-
-append sysupgrade_pre_upgrade linksys_preupgrade
diff --git a/target/linux/kirkwood/base-files/lib/upgrade/platform.sh b/target/linux/kirkwood/base-files/lib/upgrade/platform.sh
index e7c6a1120a90147380f4fcf644eb7078c1bc1659..c8c66c1b9d67759305ee836f9d84b9a2968a9493 100644
--- a/target/linux/kirkwood/base-files/lib/upgrade/platform.sh
+++ b/target/linux/kirkwood/base-files/lib/upgrade/platform.sh
@@ -1,5 +1,8 @@
. /lib/kirkwood.sh
+RAMFS_COPY_BIN='/usr/sbin/fw_printenv /usr/sbin/fw_setenv'
+RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
+
platform_check_image() {
[ "$#" -gt 1 ] && return 1
local board="$(kirkwood_board_name)"
@@ -33,19 +36,7 @@ platform_do_upgrade() {
platform_do_upgrade_linksys "$ARGV"
;;
*)
- default_do_upgrade "$@"
- ;;
- esac
-}
-
-platform_pre_upgrade() {
- local board=$(kirkwood_board_name)
-
- case "$board" in
- "linksys-audi"|\
- "linksys-viper") ;;
- *)
- nand_do_upgrade $1
+ nand_do_upgrade "$ARGV"
;;
esac
}

View File

@ -1,29 +0,0 @@
From: Andreas Ziegler <github@andreas-ziegler.de>
Date: Sun, 6 Aug 2017 16:27:53 +0200
Subject: ar71xx: add uImageArcher to tp-link.mk
backport from e39dc8d823c86559eedbbdcee5f5c14b827fed0f
ar71xx: add support to TP-Link Archer C59v1 and C60v1
Based-on-patch-by: Henryk Heisig <hyniu@o2.pl>
Signed-off-by: Andreas Ziegler <github@andreas-ziegler.de>
diff --git a/target/linux/ar71xx/image/tp-link.mk b/target/linux/ar71xx/image/tp-link.mk
index b76ed02ca394fc1a8b15218d64b5dc722552bbfd..9cd6c6372ac8f7e509a0a2422616097c1c19edf6 100644
--- a/target/linux/ar71xx/image/tp-link.mk
+++ b/target/linux/ar71xx/image/tp-link.mk
@@ -45,6 +45,14 @@ define Build/mktplinkfw-kernel
@mv $@.new $@
endef
+define Build/uImageArcher
+ mkimage -A $(LINUX_KARCH) \
+ -O linux -T kernel \
+ -C $(1) -a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
+ -n '$(call toupper,$(LINUX_KARCH)) LEDE Linux-$(LINUX_VERSION)' -d $@ $@.new
+ @mv $@.new $@
+endef
+
define Device/tplink
TPLINK_HWREV := 0x1
TPLINK_HEADER_VERSION := 1

View File

@ -1,444 +0,0 @@
From: Ludwig Thomeczek <ledesrc@wxorx.net>
Date: Sat, 22 Apr 2017 18:21:47 +0200
Subject: ar71xx: add support for TP-Link Archer C25 v1
The TP-Link Archer C25 is a low-cost dual-band router.
Specification:
- CPU: Atheros QCA9561 775 MHz
- RAM: 64 MB
- Flash: 8 MB
- Wifi: 3x3 2.4 GHz (integrated), 1x1 5 GHz QCA9887
- NET: 5x 10/100 Mbps Ethernet
Some LEDs are controlled by an additional 74HC595 chip.
Signed-off-by: Ludwig Thomeczek <ledesrc@wxorx.net>
[minor code style fixes, boards alphabetical order fixes,
reworked commit message]
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds b/target/linux/ar71xx/base-files/etc/board.d/01_leds
index 833522f27b61ac2208c2862bc0f29f34dea5e701..e1efb561b33da4dcfcb82ee953cd888170476dfb 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
@@ -53,6 +53,15 @@ ap121f)
ucidef_set_led_netdev "lan" "LAN" "$board:green:lan" "eth0"
ucidef_set_led_wlan "wlan" "WLAN" "$board:green:wlan" "phy0tpt"
;;
+archer-c25-v1)
+ ucidef_set_led_netdev "wan" "WAN" "$board:green:wan" "eth0"
+ ucidef_set_led_wlan "wlan" "WLAN" "$board:green:wlan2g" "phy1tpt"
+ ucidef_set_led_wlan "wlan5g" "WLAN5G" "$board:green:wlan5g" "phy0tpt"
+ ucidef_set_led_switch "lan1" "LAN1" "$board:green:lan1" "switch0" "0x10"
+ ucidef_set_led_switch "lan2" "LAN2" "$board:green:lan2" "switch0" "0x08"
+ ucidef_set_led_switch "lan3" "LAN3" "$board:green:lan3" "switch0" "0x04"
+ ucidef_set_led_switch "lan4" "LAN4" "$board:green:lan4" "switch0" "0x02"
+ ;;
arduino-yun)
ucidef_set_led_wlan "wlan" "WLAN" "arduino:blue:wlan" "phy0tpt"
ucidef_set_led_usbdev "usb" "USB" "arduino:white:usb" "1-1.1"
diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network b/target/linux/ar71xx/base-files/etc/board.d/02_network
index 6d8a5c3d0a86a627663dee6e2905e03d5dec99fb..cefb7413eac6ffc50e67f1eaf63def749314428b 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -122,6 +122,7 @@ ar71xx_setup_interfaces()
a60|\
alfa-ap96|\
alfa-nx|\
+ archer-c25-v1|\
dr344|\
gl-ar150|\
gl-ar300m|\
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index bc2fc2f774c4f2f0bbfa6e43d9b9a55e9b63153d..38cc5d7853c79f2a7800a387310a95abb3b4de1b 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -50,6 +50,7 @@ get_status_led() {
ap135-020)
status_led="ap135:green:status"
;;
+ archer-c25-v1|\
mr12|\
mr16|\
nbg6616|\
diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index b3e23c9a8f8c56870ef36fb55ae52e6b5ea61134..68f90de802ddd18e09a1da39c0d56292eea9489c 100644
--- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -92,6 +92,7 @@ case "$FIRMWARE" in
ath10kcal_extract "art" 20480 2116
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -2)
;;
+ archer-c25-v1|\
tl-wdr6500-v2)
ath10kcal_extract "art" 20480 2116
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2)
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 170c6f01b4310c4d6c261e9ba97af8786b21c93b..fc7d862c2911e96f76622cbed23e99863814da63 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -463,6 +463,9 @@ ar71xx_board_detect() {
*AP90Q)
name="ap90q"
;;
+ *"Archer C25 v1")
+ name="archer-c25-v1"
+ ;;
*"Archer C5")
name="archer-c5"
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index d2dc88127c02746cdecc4ced28f33548f35d037c..6258713dd0e3325ab109689f0ed3b51e27c41f89 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -214,6 +214,7 @@ platform_check_image() {
ap121f|\
ap132|\
ap90q|\
+ archer-c25-v1|\
bullet-m|\
c-55|\
carambola2|\
diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4
index a8622454b421c1c74a8a71134b53c50399114aa5..e10401d42ae06506f82f2f5538fbc7df79fd4c65 100644
--- a/target/linux/ar71xx/config-4.4
+++ b/target/linux/ar71xx/config-4.4
@@ -51,6 +51,7 @@ CONFIG_ATH79_MACH_AP152=y
# CONFIG_ATH79_MACH_AP81 is not set
CONFIG_ATH79_MACH_AP90Q=y
CONFIG_ATH79_MACH_AP96=y
+CONFIG_ATH79_MACH_ARCHER_C25_V1=y
CONFIG_ATH79_MACH_ARCHER_C7=y
CONFIG_ATH79_MACH_ARDUINO_YUN=y
CONFIG_ATH79_MACH_AW_NR580=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
index 58d7e435362e0bac105e8183206e593329e4ae96..fb2afb965c4641df7cdcaf0920f2d56b3717fa9b 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
@@ -1234,6 +1234,16 @@ config ATH79_MACH_BSB
select ATH79_DEV_USB
select ATH79_DEV_WMAC
+config ATH79_MACH_ARCHER_C25_V1
+ bool "TP-LINK Archer C25 v1 support"
+ select SOC_QCA956X
+ select ATH79_DEV_AP9X_PCI if PCI
+ select ATH79_DEV_ETH
+ select ATH79_DEV_GPIO_BUTTONS
+ select ATH79_DEV_LEDS_GPIO
+ select ATH79_DEV_M25P80
+ select ATH79_DEV_WMAC
+
config ATH79_MACH_ARCHER_C7
bool "TP-LINK Archer C5/C7/TL-WDR4900 v2 board support"
select SOC_QCA955X
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Makefile b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
index 7aee76019552e14ebdbf7bea357859dedb1a5bbb..3365a43ce16fc77b3212b39b92081efe678e8803 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
@@ -56,6 +56,7 @@ obj-$(CONFIG_ATH79_MACH_AP147) += mach-ap147.o
obj-$(CONFIG_ATH79_MACH_AP152) += mach-ap152.o
obj-$(CONFIG_ATH79_MACH_AP90Q) += mach-ap90q.o
obj-$(CONFIG_ATH79_MACH_AP96) += mach-ap96.o
+obj-$(CONFIG_ATH79_MACH_ARCHER_C25_V1) += mach-archer-c25-v1.o
obj-$(CONFIG_ATH79_MACH_ARCHER_C7) += mach-archer-c7.o
obj-$(CONFIG_ATH79_MACH_ARDUINO_YUN) += mach-arduino-yun.o
obj-$(CONFIG_ATH79_MACH_AW_NR580) += mach-aw-nr580.o
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c25-v1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c25-v1.c
new file mode 100644
index 0000000000000000000000000000000000000000..a0f001cb49af5aa501c6825c40f3a98ab99503b2
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c25-v1.c
@@ -0,0 +1,227 @@
+/*
+ * TP-Link Archer C25 v1 board support
+ *
+ * Copyright (C) 2017 Ludwig Thomeczek <ledesrc@wxorx.net>
+ * based on mach-archer-c60/C59-v1.c
+ * Copyright (C) 2016 Henryk Heisig <hyniu@o2.pl>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+#include <linux/platform_device.h>
+#include <linux/ath9k_platform.h>
+#include <linux/ar8216_platform.h>
+#include <asm/mach-ath79/ar71xx_regs.h>
+#include <linux/gpio.h>
+
+#include "common.h"
+#include "dev-m25p80.h"
+#include "machtypes.h"
+#include "pci.h"
+#include "dev-ap9x-pci.h"
+#include "dev-eth.h"
+#include "dev-gpio-buttons.h"
+#include "dev-leds-gpio.h"
+#include "dev-spi.h"
+#include "dev-usb.h"
+#include "dev-wmac.h"
+#include <linux/spi/spi_gpio.h>
+#include <linux/spi/74x164.h>
+
+#define ARCHER_C25_GPIO_SHIFT_OE 21 /* OE, Output Enable */
+#define ARCHER_C25_GPIO_SHIFT_SER 14 /* DS, Data Serial Input */
+#define ARCHER_C25_GPIO_SHIFT_SRCLK 15 /* SHCP, Shift Reg Clock Input */
+#define ARCHER_C25_GPIO_SHIFT_SRCLR 19 /* MR, Master Reset */
+#define ARCHER_C25_GPIO_SHIFT_RCLK 16 /* STCP, Storage Reg Clock Input */
+
+#define ARCHER_C25_74HC_GPIO_BASE QCA956X_GPIO_COUNT
+#define ARCHER_C25_74HC_GPIO_LED_WAN_AMBER 27
+#define ARCHER_C25_74HC_GPIO_LED_WAN_GREEN 28
+#define ARCHER_C25_74HC_GPIO_LED_WLAN2 29
+#define ARCHER_C25_74HC_GPIO_LED_WLAN5 30
+#define ARCHER_C25_74HC_GPIO_LED_LAN1 23
+#define ARCHER_C25_74HC_GPIO_LED_LAN2 24
+#define ARCHER_C25_74HC_GPIO_LED_LAN3 25
+#define ARCHER_C25_74HC_GPIO_LED_LAN4 26
+
+#define ARCHER_C25_V1_SSR_BIT_0 0
+#define ARCHER_C25_V1_SSR_BIT_1 1
+#define ARCHER_C25_V1_SSR_BIT_2 2
+#define ARCHER_C25_V1_SSR_BIT_3 3
+#define ARCHER_C25_V1_SSR_BIT_4 4
+#define ARCHER_C25_V1_SSR_BIT_5 5
+#define ARCHER_C25_V1_SSR_BIT_6 6
+#define ARCHER_C25_V1_SSR_BIT_7 7
+
+
+#define ARCHER_C25_V1_KEYS_POLL_INTERVAL 20
+#define ARCHER_C25_V1_KEYS_DEBOUNCE_INTERVAL \
+ (3 * ARCHER_C25_V1_KEYS_POLL_INTERVAL)
+
+#define ARCHER_C25_V1_GPIO_BTN_RESET 1
+#define ARCHER_C25_V1_GPIO_BTN_RFKILL 22
+
+#define ARCHER_C25_V1_GPIO_LED_POWER 17
+#define ARCHER_C25_V1_GPIO_LED_WPS 2
+
+#define ARCHER_C25_V1_WMAC_CALDATA_OFFSET 0x1000
+
+static struct spi_gpio_platform_data archer_c25_v1_spi_data = {
+ .sck = ARCHER_C25_GPIO_SHIFT_SRCLK,
+ .miso = SPI_GPIO_NO_MISO,
+ .mosi = ARCHER_C25_GPIO_SHIFT_SER,
+ .num_chipselect = 1,
+};
+
+static u8 archer_c25_v1_ssr_initdata[] __initdata = {
+ BIT(ARCHER_C25_V1_SSR_BIT_7) |
+ BIT(ARCHER_C25_V1_SSR_BIT_6) |
+ BIT(ARCHER_C25_V1_SSR_BIT_5) |
+ BIT(ARCHER_C25_V1_SSR_BIT_4) |
+ BIT(ARCHER_C25_V1_SSR_BIT_3) |
+ BIT(ARCHER_C25_V1_SSR_BIT_2) |
+ BIT(ARCHER_C25_V1_SSR_BIT_1)
+};
+
+static struct gen_74x164_chip_platform_data archer_c25_v1_ssr_data = {
+ .base = ARCHER_C25_74HC_GPIO_BASE,
+ .num_registers = ARRAY_SIZE(archer_c25_v1_ssr_initdata),
+ .init_data = archer_c25_v1_ssr_initdata,
+};
+
+static struct platform_device archer_c25_v1_spi_device = {
+ .name = "spi_gpio",
+ .id = 1,
+ .dev = {
+ .platform_data = &archer_c25_v1_spi_data,
+ },
+};
+
+static struct spi_board_info archer_c25_v1_spi_info[] = {
+ {
+ .bus_num = 1,
+ .chip_select = 0,
+ .max_speed_hz = 10000000,
+ .modalias = "74x164",
+ .platform_data = &archer_c25_v1_ssr_data,
+ .controller_data = (void *) ARCHER_C25_GPIO_SHIFT_RCLK,
+ },
+};
+
+static struct gpio_led archer_c25_v1_leds_gpio[] __initdata = {
+ {
+ .name = "archer-c25-v1:green:power",
+ .gpio = ARCHER_C25_V1_GPIO_LED_POWER,
+ .active_low = 1,
+ }, {
+ .name = "archer-c25-v1:green:wps",
+ .gpio = ARCHER_C25_V1_GPIO_LED_WPS,
+ .active_low = 1,
+ }, {
+ .name = "archer-c25-v1:green:wlan2g",
+ .gpio = ARCHER_C25_74HC_GPIO_LED_WLAN2,
+ .active_low = 1,
+ }, {
+ .name = "archer-c25-v1:green:wlan5g",
+ .gpio = ARCHER_C25_74HC_GPIO_LED_WLAN5,
+ .active_low = 1,
+ }, {
+ .name = "archer-c25-v1:green:lan1",
+ .gpio = ARCHER_C25_74HC_GPIO_LED_LAN1,
+ .active_low = 1,
+ }, {
+ .name = "archer-c25-v1:green:lan2",
+ .gpio = ARCHER_C25_74HC_GPIO_LED_LAN2,
+ .active_low = 1,
+ }, {
+ .name = "archer-c25-v1:green:lan3",
+ .gpio = ARCHER_C25_74HC_GPIO_LED_LAN3,
+ .active_low = 1,
+ }, {
+ .name = "archer-c25-v1:green:lan4",
+ .gpio = ARCHER_C25_74HC_GPIO_LED_LAN4,
+ .active_low = 1,
+ }, {
+ .name = "archer-c25-v1:green:wan",
+ .gpio = ARCHER_C25_74HC_GPIO_LED_WAN_GREEN,
+ .active_low = 1,
+ }, {
+ .name = "archer-c25-v1:amber:wan",
+ .gpio = ARCHER_C25_74HC_GPIO_LED_WAN_AMBER,
+ .active_low = 1,
+ },
+};
+
+static struct gpio_keys_button archer_c25_v1_gpio_keys[] __initdata = {
+ {
+ .desc = "Reset button",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = ARCHER_C25_V1_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = ARCHER_C25_V1_GPIO_BTN_RESET,
+ .active_low = 1,
+ }, {
+ .desc = "RFKILL button",
+ .type = EV_KEY,
+ .code = KEY_RFKILL,
+ .debounce_interval = ARCHER_C25_V1_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = ARCHER_C25_V1_GPIO_BTN_RFKILL,
+ .active_low = 1,
+ },
+};
+
+static void __init archer_c25_v1_setup(void)
+{
+ u8 *mac = (u8 *) KSEG1ADDR(0x1f7e0008);
+ u8 *art = (u8 *) KSEG1ADDR(0x1f7f0000);
+
+ ath79_register_m25p80(NULL);
+
+ spi_register_board_info(archer_c25_v1_spi_info,
+ ARRAY_SIZE(archer_c25_v1_spi_info));
+
+ platform_device_register(&archer_c25_v1_spi_device);
+
+ gpio_request_one(ARCHER_C25_GPIO_SHIFT_OE,
+ GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED,
+ "LED control");
+
+ gpio_request_one(ARCHER_C25_GPIO_SHIFT_SRCLR,
+ GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+ "LED reset");
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(archer_c25_v1_leds_gpio),
+ archer_c25_v1_leds_gpio);
+
+ ath79_register_gpio_keys_polled(-1, ARCHER_C25_V1_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(archer_c25_v1_gpio_keys),
+ archer_c25_v1_gpio_keys);
+
+ ath79_register_mdio(0, 0x0);
+ ath79_register_mdio(1, 0x0);
+
+ ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
+ ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1);
+
+ /* WAN port */
+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
+ ath79_eth0_data.speed = SPEED_100;
+ ath79_eth0_data.duplex = DUPLEX_FULL;
+ ath79_eth0_data.phy_mask = BIT(4);
+ ath79_register_eth(0);
+
+ /* LAN ports */
+ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
+ ath79_eth1_data.speed = SPEED_1000;
+ ath79_eth1_data.duplex = DUPLEX_FULL;
+ ath79_switch_data.phy_poll_mask |= BIT(4);
+ ath79_switch_data.phy4_mii_en = 1;
+ ath79_register_eth(1);
+
+ ath79_register_wmac(art + ARCHER_C25_V1_WMAC_CALDATA_OFFSET, mac);
+ ap91_pci_init(NULL, NULL);
+}
+
+MIPS_MACHINE(ATH79_MACH_ARCHER_C25_V1, "ARCHER-C25-V1", "TP-LINK Archer C25 v1",
+ archer_c25_v1_setup);
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
index a12685cd11a7a6cefe9b69991a5e41db55ccea85..8864e0deda57b926e88dceebd26056a2f8099380 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -40,6 +40,7 @@ enum ath79_mach_type {
ATH79_MACH_AP152, /* Atheros AP152 reference board */
ATH79_MACH_AP90Q, /* YunCore AP90Q */
ATH79_MACH_AP96, /* Atheros AP96 */
+ ATH79_MACH_ARCHER_C25_V1, /* TP-LINK Archer C25 V1 board */
ATH79_MACH_ARCHER_C5, /* TP-LINK Archer C5 board */
ATH79_MACH_ARCHER_C7, /* TP-LINK Archer C7 board */
ATH79_MACH_ARCHER_C7_V2, /* TP-LINK Archer C7 V2 board */
diff --git a/target/linux/ar71xx/image/tp-link.mk b/target/linux/ar71xx/image/tp-link.mk
index 9cd6c6372ac8f7e509a0a2422616097c1c19edf6..6933654e575a1ef2c92e4c656696a479cba4c594 100644
--- a/target/linux/ar71xx/image/tp-link.mk
+++ b/target/linux/ar71xx/image/tp-link.mk
@@ -103,6 +103,22 @@ $(Device/tplink)
IMAGE_SIZE := 15872k
endef
+define Device/archer-c25-v1
+ DEVICE_TITLE := TP-LINK Archer C25 v1
+ DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca9887
+ BOARDNAME := ARCHER-C25-V1
+ TPLINK_BOARD_NAME := ARCHER-C25-V1
+ DEVICE_PROFILE := ARCHERC25V1
+ IMAGE_SIZE := 7808k
+ LOADER_TYPE := elf
+ KERNEL := kernel-bin | patch-cmdline | lzma | uImageArcher lzma
+ IMAGES := sysupgrade.bin factory.bin
+ IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade
+ IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
+ MTDPARTS := spi0.0:128k(factory-uboot)ro,64k(u-boot)ro,1536k(kernel),6272k(rootfs),128k(config)ro,64k(art)ro,7808k@0x30000(firmware)
+endef
+TARGET_DEVICES += archer-c25-v1
+
define Device/cpe510-520
DEVICE_TITLE := TP-LINK CPE510/520
DEVICE_PACKAGES := rssileds
diff --git a/target/linux/ar71xx/mikrotik/config-default b/target/linux/ar71xx/mikrotik/config-default
index f8d255fd87b8c53511b34b42f4117422218219fe..376835a703f91532300d0dd7c8ef66704acc6e05 100644
--- a/target/linux/ar71xx/mikrotik/config-default
+++ b/target/linux/ar71xx/mikrotik/config-default
@@ -16,6 +16,7 @@
# CONFIG_ATH79_MACH_AP152 is not set
# CONFIG_ATH79_MACH_AP90Q is not set
# CONFIG_ATH79_MACH_AP96 is not set
+# CONFIG_ATH79_MACH_ARCHER_C25_V1 is not set
# CONFIG_ATH79_MACH_ARCHER_C7 is not set
# CONFIG_ATH79_MACH_ARDUINO_YUN is not set
# CONFIG_ATH79_MACH_AW_NR580 is not set
diff --git a/target/linux/ar71xx/nand/config-default b/target/linux/ar71xx/nand/config-default
index c1b5e61c3e9e5f02979584f72621f5e54cde2e36..62be218e33cc6366ea89f363983f36523c419650 100644
--- a/target/linux/ar71xx/nand/config-default
+++ b/target/linux/ar71xx/nand/config-default
@@ -9,6 +9,7 @@
# CONFIG_ATH79_MACH_AP136 is not set
# CONFIG_ATH79_MACH_AP147 is not set
# CONFIG_ATH79_MACH_AP96 is not set
+# CONFIG_ATH79_MACH_ARCHER_C25_V1 is not set
# CONFIG_ATH79_MACH_ARCHER_C7 is not set
# CONFIG_ATH79_MACH_AW_NR580 is not set
# CONFIG_ATH79_MACH_CAP324 is not set

View File

@ -1,102 +0,0 @@
From: Ludwig Thomeczek <ledesrc@wxorx.net>
Date: Sat, 13 May 2017 11:40:48 +0200
Subject: firmware-utils: tplink-safeloader: add TP-Link Archer C25 v1
This adds the necessary firmware layout definitions for the Archer C25.
It has an addtional partition containing some static data ("extra-para")
without which no factory flash is possible, therefore put_data() has been
added.
Signed-off-by: Ludwig Thomeczek <ledesrc@wxorx.net>
diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c
index 4e3d2058b286fb7220e5a8308dcdfb25626a1b59..7617566829e159ae9fec00d5de95919a0fb234c6 100644
--- a/tools/firmware-utils/src/tplink-safeloader.c
+++ b/tools/firmware-utils/src/tplink-safeloader.c
@@ -293,6 +293,48 @@ static struct device_info boards[] = {
.last_sysupgrade_partition = "file-system"
},
+ /** Firmware layout for the C25v1 */
+ {
+ .id = "ARCHER-C25-V1",
+ .support_list =
+ "SupportList:\n"
+ "{product_name:ArcherC25,product_ver:1.0.0,special_id:00000000}\n"
+ "{product_name:ArcherC25,product_ver:1.0.0,special_id:55530000}\n"
+ "{product_name:ArcherC25,product_ver:1.0.0,special_id:45550000}\n",
+ .support_trail = '\x00',
+ .soft_ver = "soft_ver:1.0.0\n",
+
+ /**
+ We use a bigger os-image partition than the stock images (and thus
+ smaller file-system), as our kernel doesn't fit in the stock firmware's
+ 1MB os-image.
+ */
+ .partitions = {
+ {"factory-boot", 0x00000, 0x20000},
+ {"fs-uboot", 0x20000, 0x10000},
+ {"os-image", 0x30000, 0x180000}, /* Stock: base 0x30000 size 0x100000 */
+ {"file-system", 0x1b0000, 0x620000}, /* Stock: base 0x130000 size 0x6a0000 */
+ {"user-config", 0x7d0000, 0x04000},
+ {"default-mac", 0x7e0000, 0x00100},
+ {"device-id", 0x7e0100, 0x00100},
+ {"extra-para", 0x7e0200, 0x00100},
+ {"pin", 0x7e0300, 0x00100},
+ {"support-list", 0x7e0400, 0x00400},
+ {"soft-version", 0x7e0800, 0x00400},
+ {"product-info", 0x7e0c00, 0x01400},
+ {"partition-table", 0x7e2000, 0x01000},
+ {"profile", 0x7e3000, 0x01000},
+ {"default-config", 0x7e4000, 0x04000},
+ {"merge-config", 0x7ec000, 0x02000},
+ {"qos-db", 0x7ee000, 0x02000},
+ {"radio", 0x7f0000, 0x10000},
+ {NULL, 0, 0}
+ },
+
+ .first_sysupgrade_partition = "os-image",
+ .last_sysupgrade_partition = "file-system",
+ },
+
/** Firmware layout for the C5 */
{
.id = "ARCHER-C5-V2",
@@ -615,6 +657,15 @@ static struct image_partition_entry read_file(const char *part_name, const char
return entry;
}
+/** Creates a new image partition from arbitrary data */
+static struct image_partition_entry put_data(const char *part_name, const char *datain, size_t len) {
+
+ struct image_partition_entry entry = alloc_image_partition(part_name, len);
+
+ memcpy(entry.data, datain, len);
+
+ return entry;
+}
/**
Copies a list of image partitions into an image buffer and generates the image partition table while doing so
@@ -796,7 +847,8 @@ static void build_image(const char *output,
bool add_jffs2_eof,
bool sysupgrade,
const struct device_info *info) {
- struct image_partition_entry parts[6] = {};
+
+ struct image_partition_entry parts[7] = {};
parts[0] = make_partition_table(info->partitions);
parts[1] = make_soft_version(rev);
@@ -804,6 +856,11 @@ static void build_image(const char *output,
parts[3] = read_file("os-image", kernel_image, false);
parts[4] = read_file("file-system", rootfs_image, add_jffs2_eof);
+ if (strcasecmp(info->id, "ARCHER-C25-V1") == 0) {
+ const char mdat[11] = {0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00};
+ parts[5] = put_data("extra-para", mdat, 11);
+ }
+
size_t len;
void *image;
if (sysupgrade)

View File

@ -1,152 +0,0 @@
From: Jan Niehusmann <jan@gondor.com>
Date: Fri, 19 May 2017 09:42:24 +0200
Subject: firmware-utils: tplink-safeloader: support strings as soft_version
Some TP-Link routers (C25, C59, C60) contain a version string instead
of a binary structure in the soft_version partition.
Flashing LEDE from the original firmware's GUI, this version string
taken from the soft_ver partition of the firmware image is written to
the router's config partition.
When using tftp recovery to go back to the original Archer C25 firmware,
a version check compares that version to the version of the firmware to
be flashed.
Without proper contents in the config partition, reverting to the
original firmware fails.
Therefore, write the string "soft_ver:1.0.0\n" to that soft_ver
partition.
Signed-off-by: Jan Niehusmann <jan@gondor.com>
diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c
index 7617566829e159ae9fec00d5de95919a0fb234c6..24684268b1a3fe491c4eb876a5ebefc700f2e56e 100644
--- a/tools/firmware-utils/src/tplink-safeloader.c
+++ b/tools/firmware-utils/src/tplink-safeloader.c
@@ -75,6 +75,7 @@ struct device_info {
const char *vendor;
const char *support_list;
char support_trail;
+ const char *soft_ver;
const struct flash_partition_entry partitions[MAX_PARTITIONS+1];
const char *first_sysupgrade_partition;
const char *last_sysupgrade_partition;
@@ -130,6 +131,7 @@ static struct device_info boards[] = {
"CPE220(TP-LINK|US|N300-2):1.1\r\n"
"CPE220(TP-LINK|EU|N300-2):1.1\r\n",
.support_trail = '\xff',
+ .soft_ver = NULL,
.partitions = {
{"fs-uboot", 0x00000, 0x20000},
@@ -167,6 +169,7 @@ static struct device_info boards[] = {
"CPE520(TP-LINK|US|N300-5):1.1\r\n"
"CPE520(TP-LINK|EU|N300-5):1.1\r\n",
.support_trail = '\xff',
+ .soft_ver = NULL,
.partitions = {
{"fs-uboot", 0x00000, 0x20000},
@@ -198,6 +201,7 @@ static struct device_info boards[] = {
"WBS210(TP-LINK|US|N300-2):1.20\r\n"
"WBS210(TP-LINK|EU|N300-2):1.20\r\n",
.support_trail = '\xff',
+ .soft_ver = NULL,
.partitions = {
{"fs-uboot", 0x00000, 0x20000},
@@ -229,6 +233,7 @@ static struct device_info boards[] = {
"WBS510(TP-LINK|US|N300-5):1.20\r\n"
"WBS510(TP-LINK|EU|N300-5):1.20\r\n",
.support_trail = '\xff',
+ .soft_ver = NULL,
.partitions = {
{"fs-uboot", 0x00000, 0x20000},
@@ -259,6 +264,7 @@ static struct device_info boards[] = {
"SupportList:\r\n"
"{product_name:Archer C2600,product_ver:1.0.0,special_id:00000000}\r\n",
.support_trail = '\x00',
+ .soft_ver = NULL,
.partitions = {
{"SBL1", 0x00000, 0x20000},
@@ -345,6 +351,7 @@ static struct device_info boards[] = {
"product_ver:2.0.0,"
"special_id:00000000}\r\n",
.support_trail = '\x00',
+ .soft_ver = NULL,
.partitions = {
{"fs-uboot", 0x00000, 0x40000},
@@ -379,6 +386,7 @@ static struct device_info boards[] = {
"product_ver:1.0.0,"
"special_id:00000000}\n",
.support_trail = '\x00',
+ .soft_ver = NULL,
.partitions = {
{"fs-uboot", 0x00000, 0x40000},
@@ -411,6 +419,7 @@ static struct device_info boards[] = {
"SupportList:\r\n"
"EAP120(TP-LINK|UN|N300-2):1.0\r\n",
.support_trail = '\xff',
+ .soft_ver = NULL,
.partitions = {
{"fs-uboot", 0x00000, 0x20000},
@@ -440,6 +449,7 @@ static struct device_info boards[] = {
"SupportList:\n"
"{product_name:TL-WR1043ND,product_ver:4.0.0,special_id:45550000}\n",
.support_trail = '\x00',
+ .soft_ver = NULL,
/**
We use a bigger os-image partition than the stock images (and thus
@@ -483,6 +493,7 @@ static struct device_info boards[] = {
"{product_name:RE450,product_ver:1.0.0,special_id:4B520000}\r\n"
"{product_name:RE450,product_ver:1.0.0,special_id:55534100}\r\n",
.support_trail = '\x00',
+ .soft_ver = NULL,
/**
The flash partition table for RE450;
@@ -611,6 +622,23 @@ static struct image_partition_entry make_soft_version(uint32_t rev) {
return entry;
}
+static struct image_partition_entry make_soft_version_from_string(const char *soft_ver) {
+ /** String length _including_ the terminating zero byte */
+ uint32_t ver_len = strlen(soft_ver) + 1;
+ /** Partition contains 64 bit header, the version string, and one additional null byte */
+ size_t partition_len = 2*sizeof(uint32_t) + ver_len + 1;
+ struct image_partition_entry entry = alloc_image_partition("soft-version", partition_len);
+
+ uint32_t *len = (uint32_t *)entry.data;
+ len[0] = htonl(ver_len);
+ len[1] = 0;
+ memcpy(&len[2], soft_ver, ver_len);
+
+ entry.data[partition_len - 1] = 0;
+
+ return entry;
+}
+
/** Generates the support-list partition */
static struct image_partition_entry make_support_list(const struct device_info *info) {
size_t len = strlen(info->support_list);
@@ -851,7 +879,11 @@ static void build_image(const char *output,
struct image_partition_entry parts[7] = {};
parts[0] = make_partition_table(info->partitions);
- parts[1] = make_soft_version(rev);
+ if (info->soft_ver)
+ parts[1] = make_soft_version_from_string(info->soft_ver);
+ else
+ parts[1] = make_soft_version(rev);
+
parts[2] = make_support_list(info);
parts[3] = read_file("os-image", kernel_image, false);
parts[4] = read_file("file-system", rootfs_image, add_jffs2_eof);

View File

@ -1,30 +0,0 @@
From: Andreas Ziegler <github@andreas-ziegler.de>
Date: Thu, 3 Aug 2017 03:34:19 +0200
Subject: add CONFIG_GPIO_74X164 and CONFIG_SPI_GPIO for Archer C25
backport from e39dc8d823c86559eedbbdcee5f5c14b827fed0f
introduced for Archer C59/C60
Based-on-patch-by: Henryk Heisig <hyniu@o2.pl>
Signed-off-by: Andreas Ziegler <github@andreas-ziegler.de>
diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4
index e10401d42ae06506f82f2f5538fbc7df79fd4c65..c82fcf09228be7063967f2517e0942651234afb8 100644
--- a/target/linux/ar71xx/config-4.4
+++ b/target/linux/ar71xx/config-4.4
@@ -272,6 +272,7 @@ CONFIG_GENERIC_TIME_VSYSCALL=y
CONFIG_GPIOLIB=y
CONFIG_GPIOLIB_IRQCHIP=y
CONFIG_GPIO_DEVRES=y
+CONFIG_GPIO_74X164=y
# CONFIG_GPIO_LATCH is not set
CONFIG_GPIO_NXP_74HC153=y
CONFIG_GPIO_PCF857X=y
@@ -429,6 +430,7 @@ CONFIG_SOC_QCA956X=y
CONFIG_SPI=y
CONFIG_SPI_ATH79=y
CONFIG_SPI_BITBANG=y
+CONFIG_SPI_GPIO=y
CONFIG_SPI_MASTER=y
# CONFIG_SPI_RB4XX is not set
# CONFIG_SPI_VSC7385 is not set

View File

@ -1,35 +0,0 @@
From: Sven Roederer <devel-sven@geroedel.de>
Date: Fri, 5 May 2017 22:18:44 +0200
Subject: ramips: use GPIO_ACTIVE macros in UBNT-ERX.dts
- reorder includes
- use GPIO_ACTIVE_LOW macro instead of hardcoded "1"
Signed-off-by: Sven Roederer <devel-sven@geroedel.de>
diff --git a/target/linux/ramips/dts/UBNT-ERX.dts b/target/linux/ramips/dts/UBNT-ERX.dts
index 0b2da95b30f0e181e1929502b8ef1aa50a684f69..cf86bbb7e67b1c521c279367ee9e99fee88fae85 100644
--- a/target/linux/ramips/dts/UBNT-ERX.dts
+++ b/target/linux/ramips/dts/UBNT-ERX.dts
@@ -1,9 +1,10 @@
-#include <dt-bindings/input/input.h>
-
/dts-v1/;
#include "mt7621.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
/ {
model = "UBNT-ERX";
@@ -24,7 +25,7 @@
reset {
label = "reset";
- gpios = <&gpio0 12 1>;
+ gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
};
};

View File

@ -1,413 +0,0 @@
From: Sven Roederer <devel-sven@geroedel.de>
Date: Mon, 29 May 2017 11:24:49 +0200
Subject: ramips: add support for Ubiquiti EdgeRouter X-SFP
This patch adds support for the Ubiquiti EdgeRouter X-SFP and
improves support for the EdgeRouter X (PoE-passthrough).
Specification:
- SoC: MediaTek MT7621AT
- Flash: 256 MiB
- RAM: 265 MiB
- Ethernet: 5 x LAN (1000 Mbps)
- UART: 1 x UART on PCB (3.3V, RX, TX, GND) - 57600 8N1
- EdgeRouter X:
- 1 x PoE-Passtrough (Eth4)
- powered by Wallwart or passive PoE
- EdgeRouter X-SFP:
- 5 x PoE-Out (24V, passive)
- 1 x SFP (unknown status)
- powered by Wallwart (24V)
Doesn't work:
* SoC has crypto engine but no open driver.
* SoC has nat acceleration, but no open driver.
* This router has 2MB spi flash soldered in but MT
nand/spi drivers do not support pin sharing,
so it is not accessable and disabled. Stock
firmware could read it and it was empty.
Installation
via vendor firmware:
- build an Initrd-image (> 3MiB) and upload the factory-image
- initrd can have luci-mod-failsafe
- flash final firmware via LuCI / sysupgrade on rebooted system
via TFTP:
- stop uboot into tftp-load into option "1"
- upload factory.bin image
Signed-off-by: Sven Roederer <devel-sven@geroedel.de>
diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network
index 17d25b1954e69d6d2a02ad94885cb54486fc904c..5a4042339c6761703578e014612062ac78babd9d 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -145,6 +145,7 @@ ramips_setup_interfaces()
rb750gr3|\
rt-n14u|\
ubnt-erx|\
+ ubnt-erx-sfp|\
ur-326n4g|\
wrtnode|\
wrtnode2p | \
diff --git a/target/linux/ramips/base-files/etc/board.d/03_gpio_switches b/target/linux/ramips/base-files/etc/board.d/03_gpio_switches
new file mode 100755
index 0000000000000000000000000000000000000000..859dfb31f51244e69d3dce5fc80b329cb57729f3
--- /dev/null
+++ b/target/linux/ramips/base-files/etc/board.d/03_gpio_switches
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+. /lib/functions/uci-defaults.sh
+. /lib/ramips.sh
+
+board_config_update
+
+board=$(ramips_board_name)
+
+case "$board" in
+ubnt-erx)
+ ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "0"
+ ;;
+ubnt-erx-sfp)
+ ucidef_add_gpio_switch "poe_power_port0" "PoE Power Port0" "496"
+ ucidef_add_gpio_switch "poe_power_port1" "PoE Power Port1" "497"
+ ucidef_add_gpio_switch "poe_power_port2" "PoE Power Port2" "498"
+ ucidef_add_gpio_switch "poe_power_port3" "PoE Power Port3" "499"
+ ucidef_add_gpio_switch "poe_power_port4" "PoE Power Port4" "500"
+ ;;
+esac
+
+board_config_flush
+
+exit 0
diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
index 17ada648931f16d3e85630dd341defb89ba50d6f..b1091f66b2897a19bd01d4a26a1b3647656fa62b 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -466,6 +466,9 @@ ramips_board_detect() {
*"UBNT-ERX")
name="ubnt-erx"
;;
+ *"UBNT-ERX-SFP")
+ name="ubnt-erx-sfp"
+ ;;
*"UR-326N4G")
name="ur-326n4g"
;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index a5cca2080d3b96cef92286b1b15f4f8832d9f8c5..d3efc2dd37ed855a1c0e966e448b67ae73324d5f 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -234,7 +234,8 @@ platform_check_image() {
}
return 0
;;
- ubnt-erx)
+ ubnt-erx|\
+ ubnt-erx-sfp)
nand_do_platform_check "$board" "$1"
return $?;
;;
@@ -248,7 +249,8 @@ platform_nand_pre_upgrade() {
local board=$(ramips_board_name)
case "$board" in
- ubnt-erx)
+ ubnt-erx|\
+ ubnt-erx-sfp)
platform_upgrade_ubnt_erx "$ARGV"
;;
esac
@@ -258,7 +260,8 @@ platform_do_upgrade() {
local board=$(ramips_board_name)
case "$board" in
- ubnt-erx)
+ ubnt-erx|\
+ ubnt-erx-sfp)
nand_do_upgrade "$ARGV"
;;
*)
diff --git a/target/linux/ramips/dts/UBNT-ER-e50.dtsi b/target/linux/ramips/dts/UBNT-ER-e50.dtsi
new file mode 100644
index 0000000000000000000000000000000000000000..b38c7194942db9f0a713fd8f707b53820d07c78e
--- /dev/null
+++ b/target/linux/ramips/dts/UBNT-ER-e50.dtsi
@@ -0,0 +1,106 @@
+#include "mt7621.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+ compatible = "ubiquiti,edgerouterx";
+
+ memory@0 {
+ device_type = "memory";
+ reg = <0x0 0x10000000>;
+ };
+
+ chosen {
+ bootargs = "console=ttyS0,57600";
+ };
+
+ gpio-keys-polled {
+ compatible = "gpio-keys-polled";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ poll-interval = <20>;
+
+ reset {
+ label = "reset";
+ gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
+ linux,code = <KEY_RESTART>;
+ };
+ };
+};
+
+&ethernet {
+ mtd-mac-address = <&factory 0x22>;
+};
+
+&nand {
+ status = "okay";
+
+ partition@0 {
+ label = "u-boot";
+ reg = <0x0 0x80000>;
+ read-only;
+ };
+
+ partition@80000 {
+ label = "u-boot-env";
+ reg = <0x80000 0x60000>;
+ read-only;
+ };
+
+ factory: partition@e0000 {
+ label = "factory";
+ reg = <0xe0000 0x60000>;
+ };
+
+ partition@140000 {
+ label = "kernel1";
+ reg = <0x140000 0x300000>;
+ };
+
+ partition@440000 {
+ label = "kernel2";
+ reg = <0x440000 0x300000>;
+ };
+
+ partition@740000 {
+ label = "ubi";
+ reg = <0x740000 0xf7c0000>;
+ };
+};
+
+&pinctrl {
+ state_default: pinctrl0 {
+ gpio {
+ ralink,group = "uart2", "uart3", "i2c", "pcie", "rgmii2", "jtag";
+ ralink,function = "gpio";
+ };
+ };
+};
+
+&spi0 {
+ /* This board has 2Mb spi flash soldered in and visible
+ from manufacturer's firmware.
+ But this SoC shares spi and nand pins,
+ and current driver does't handle this sharing well */
+ status = "disabled";
+
+ m25p80@0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "jedec,spi-nor";
+ reg = <1>;
+ spi-max-frequency = <10000000>;
+ m25p,chunked-io = <32>;
+
+ partition@0 {
+ label = "spi";
+ reg = <0x0 0x200000>;
+ read-only;
+ };
+ };
+};
+
+&xhci {
+ status = "disabled";
+};
diff --git a/target/linux/ramips/dts/UBNT-ERX-SFP.dts b/target/linux/ramips/dts/UBNT-ERX-SFP.dts
new file mode 100644
index 0000000000000000000000000000000000000000..ca26d817211e5a5a20a7da926cd2aee726875780
--- /dev/null
+++ b/target/linux/ramips/dts/UBNT-ERX-SFP.dts
@@ -0,0 +1,24 @@
+/dts-v1/;
+
+#include "UBNT-ER-e50.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+ model = "UBNT-ERX-SFP";
+ compatible = "ubiquiti,edgerouterx-sfp";
+
+ i2c-gpio {
+ compatible = "i2c-gpio";
+ gpios = <&gpio0 3 GPIO_ACTIVE_HIGH /* sda */
+ &gpio0 4 GPIO_ACTIVE_HIGH /* scl */
+ >;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ pca9555@25 {
+ compatible = "pca9555";
+ reg = <0x25>;
+ };
+ };
+};
diff --git a/target/linux/ramips/dts/UBNT-ERX.dts b/target/linux/ramips/dts/UBNT-ERX.dts
index cf86bbb7e67b1c521c279367ee9e99fee88fae85..556d1156c352f76a94c6e39bc3b58c88f08815be 100644
--- a/target/linux/ramips/dts/UBNT-ERX.dts
+++ b/target/linux/ramips/dts/UBNT-ERX.dts
@@ -1,108 +1,7 @@
/dts-v1/;
-#include "mt7621.dtsi"
-
-#include <dt-bindings/gpio/gpio.h>
-#include <dt-bindings/input/input.h>
+#include "UBNT-ER-e50.dtsi"
/ {
model = "UBNT-ERX";
-
- memory@0 {
- device_type = "memory";
- reg = <0x0 0x10000000>;
- };
-
- chosen {
- bootargs = "console=ttyS0,57600";
- };
-
- gpio-keys-polled {
- compatible = "gpio-keys-polled";
- #address-cells = <1>;
- #size-cells = <0>;
- poll-interval = <20>;
-
- reset {
- label = "reset";
- gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
- linux,code = <KEY_RESTART>;
- };
- };
-};
-
-&ethernet {
- mtd-mac-address = <&factory 0x22>;
-};
-
-&nand {
- status = "okay";
-
- partition@0 {
- label = "u-boot";
- reg = <0x0 0x80000>;
- read-only;
- };
-
- partition@80000 {
- label = "u-boot-env";
- reg = <0x80000 0x60000>;
- read-only;
- };
-
- factory: partition@e0000 {
- label = "factory";
- reg = <0xe0000 0x60000>;
- };
-
- partition@140000 {
- label = "kernel1";
- reg = <0x140000 0x300000>;
- };
-
- partition@440000 {
- label = "kernel2";
- reg = <0x440000 0x300000>;
- };
-
- partition@740000 {
- label = "ubi";
- reg = <0x740000 0xf7c0000>;
- };
-};
-
-&pinctrl {
- state_default: pinctrl0 {
- gpio {
- ralink,group = "uart2", "uart3", "i2c", "pcie", "rgmii2", "jtag";
- ralink,function = "gpio";
- };
- };
-};
-
-&spi0 {
- /* This board has 2Mb spi flash soldered in and visible
- from manufacturer's firmware.
- But this SoC shares spi and nand pins,
- and current driver does't handle this sharing well */
- status = "disabled";
-
- m25p80@0 {
- #address-cells = <1>;
- #size-cells = <1>;
- compatible = "jedec,spi-nor";
- reg = <1>;
- spi-max-frequency = <10000000>;
- m25p,chunked-io = <32>;
-
- partition@0 {
- label = "spi";
- reg = <0x0 0x200000>;
- read-only;
- };
- };
-};
-
-&xhci {
- status = "disabled";
};
diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index 15ea9a13b6310b1454b5b3b92cd8ed30ee6255b3..8218bea84410536151a216cd2cc0300369ad977a 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -144,6 +144,19 @@ define Device/ubnt-erx
endef
TARGET_DEVICES += ubnt-erx
+define Device/ubnt-erx-sfp
+ DTS := UBNT-ERX-SFP
+ FILESYSTEMS := squashfs
+ KERNEL_SIZE := 3145728
+ KERNEL := $(KERNEL_DTB) | uImage lzma
+ IMAGES := sysupgrade.tar
+ KERNEL_INITRAMFS := $$(KERNEL) | ubnt-erx-factory-image $(KDIR)/tmp/$$(KERNEL_INITRAMFS_PREFIX)-factory.tar
+ IMAGE/sysupgrade.tar := sysupgrade-tar | append-metadata
+ DEVICE_TITLE := Ubiquiti EdgeRouter X-SFP
+ DEVICE_PACKAGES := -kmod-mt76 -kmod-rt2x00-lib -kmod-mac80211 -kmod-cfg80211 -wpad-mini -iwinfo kmod-i2c-algo-pca kmod-gpio-pca953x kmod-i2c-gpio-custom
+endef
+TARGET_DEVICES += ubnt-erx-sfp
+
define Device/vr500
DTS := VR500
IMAGE_SIZE := 66453504

View File

@ -1,367 +0,0 @@
From: Tim Thorpe <tim@tfthorpe.net>
Date: Mon, 25 Sep 2017 04:38:49 -0500
Subject: ar71xx: add support for TP-Link TL-WR1043N v5
TP-Link TL-WR1043N v5 appears to be identical to the TL-WR1043ND v4,
except that the USB port has been removed and there is no longer a
removable antenna option.
The software is more in line with the Archer series in that it uses a
nested bootloader scheme.
Specifications:
- QCA9563 at 775 MHz
- 64 MB RAM
- 16 MB flash
- 3 (non-detachable) Antennas / 450 Mbit
- 1x/4x WAN/LAN Gbps Ethernet (QCA8337)
- reset and Wi-Fi buttons
Signed-off-by: Tim Thorpe <tim@tfthorpe.net>
Signed-off-by: Ludwig Thomeczek <ledesrc@wxorx.net>
diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds b/target/linux/ar71xx/base-files/etc/board.d/01_leds
index e1efb561b33da4dcfcb82ee953cd888170476dfb..e67b5e38561e841b88e486341950c52e1d454322 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
@@ -666,14 +666,20 @@ tl-wr1043nd-v2)
ucidef_set_led_usbdev "usb" "USB" "tp-link:green:usb" "1-1"
ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
;;
+tl-wr1043n-v5|\
tl-wr1043nd-v4)
- ucidef_set_led_usbdev "usb" "USB" "tp-link:green:usb" "1-1"
ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
ucidef_set_led_switch "wan" "WAN" "tp-link:green:wan" "switch0" "0x20"
ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x10"
ucidef_set_led_switch "lan2" "LAN2" "tp-link:green:lan2" "switch0" "0x08"
ucidef_set_led_switch "lan3" "LAN3" "tp-link:green:lan3" "switch0" "0x04"
ucidef_set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0" "0x02"
+
+ case "$board" in
+ tl-wr1043nd-v4)
+ ucidef_set_led_usbdev "usb" "USB" "tp-link:green:usb" "1-1"
+ ;;
+ esac
;;
tl-wr2543n)
ucidef_set_led_usbdev "usb" "USB" "tp-link:green:usb" "1-1"
diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network b/target/linux/ar71xx/base-files/etc/board.d/02_network
index cefb7413eac6ffc50e67f1eaf63def749314428b..454abe6a5005621967dd96e0282e7bce2a0b127e 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -243,7 +243,8 @@ ar71xx_setup_interfaces()
mynet-n750|\
sr3200|\
wndr3700v4|\
- wndr4300)
+ wndr4300|\
+ tl-wr1043n-v5)
ucidef_add_switch "switch0" \
"0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
;;
@@ -487,6 +488,7 @@ ar71xx_setup_macs()
lan_mac=$(mtd_get_mac_binary caldata 0)
wan_mac=$(mtd_get_mac_binary caldata 6)
;;
+ tl-wr1043n-v5|\
tl-wr1043nd-v4)
lan_mac=$(mtd_get_mac_binary product-info 8)
wan_mac=$(macaddr_add "$lan_mac" 1)
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index 38cc5d7853c79f2a7800a387310a95abb3b4de1b..61db387c9ecefd7090c25a5f5d75fdbf65a44d65 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -359,6 +359,7 @@ get_status_led() {
tl-wdr3320-v2|\
tl-wdr3500|\
tl-wr1041n-v2|\
+ tl-wr1043n-v5|\
tl-wr1043nd|\
tl-wr1043nd-v2|\
tl-wr1043nd-v4|\
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index fc7d862c2911e96f76622cbed23e99863814da63..8f8158bac8a28db4f4f15ce5c37f48a21084dc03 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -947,6 +947,9 @@ ar71xx_board_detect() {
*"TL-WR1043ND v4")
name="tl-wr1043nd-v4"
;;
+ *"TL-WR1043N v5")
+ name="tl-wr1043n-v5"
+ ;;
*TL-WR2543N*)
name="tl-wr2543n"
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 6258713dd0e3325ab109689f0ed3b51e27c41f89..774e3c8964ef724d1efbae56434aeaa9f1c298a4 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -269,6 +269,7 @@ platform_check_image() {
tew-712br|\
tew-732br|\
tew-823dru|\
+ tl-wr1043n-v5|\
unifi-outdoor|\
unifiac-lite|\
unifiac-pro|\
diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4
index c82fcf09228be7063967f2517e0942651234afb8..57b6d2e541d7ef9dea8570ba8de72164d97b9775 100644
--- a/target/linux/ar71xx/config-4.4
+++ b/target/linux/ar71xx/config-4.4
@@ -181,6 +181,7 @@ CONFIG_ATH79_MACH_TL_WR1041N_V2=y
CONFIG_ATH79_MACH_TL_WR1043ND=y
CONFIG_ATH79_MACH_TL_WR1043ND_V2=y
CONFIG_ATH79_MACH_TL_WR1043ND_V4=y
+CONFIG_ATH79_MACH_TL_WR1043N_V5=y
CONFIG_ATH79_MACH_TL_WR2543N=y
CONFIG_ATH79_MACH_TL_WR703N=y
CONFIG_ATH79_MACH_TL_WR720N_V3=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
index fb2afb965c4641df7cdcaf0920f2d56b3717fa9b..7ad5419f51ec9909d8b59f33178221a7d81ec184 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
@@ -1564,6 +1564,15 @@ config ATH79_MACH_TL_WR1041N_V2
select ATH79_DEV_USB
select ATH79_DEV_WMAC
+config ATH79_MACH_TL_WR1043N_V5
+ bool "TP-LINK TL-WR1043N v5 support"
+ select SOC_QCA956X
+ select ATH79_DEV_ETH
+ select ATH79_DEV_GPIO_BUTTONS
+ select ATH79_DEV_LEDS_GPIO
+ select ATH79_DEV_M25P80
+ select ATH79_DEV_WMAC
+
config ATH79_MACH_TL_WR1043ND
bool "TP-LINK TL-WR1043ND support"
select SOC_AR913X
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1043nd-v4.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1043nd-v4.c
index b1539c5d71a61806b88c50f1a78f6a27d98d7a2d..450819a9e6baa997dab2dfba4c5a19261aae9664 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1043nd-v4.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1043nd-v4.c
@@ -5,6 +5,7 @@
* Copyright (C) 2016 Matthias Schiffer <mschiffer@universe-factory.net>
* Copyright (C) 2016 Andreas Ziegler <github@andreas-ziegler.de>
* Copyright (C) 2016 Ludwig Thomeczek <ledesrc@wxorx.net>
+ * Copyright (C) 2017 Tim Thorpe <tim@tfthorpe.net>
*
* Derived from: mach-dir-869-a1.c
*
@@ -62,6 +63,8 @@
#define TL_WR1043_V4_EEPROM_ADDR 0x1fff0000
#define TL_WR1043_V4_WMAC_CALDATA_OFFSET 0x1000
+#define TL_WR1043N_V5_MAC_LOCATION 0x1ff00008
+
static struct gpio_led tl_wr1043nd_v4_leds_gpio[] __initdata = {
{
.name = "tp-link:green:wps",
@@ -188,3 +191,82 @@ static void __init tl_wr1043nd_v4_setup(void)
MIPS_MACHINE(ATH79_MACH_TL_WR1043ND_V4, "TL-WR1043ND-v4",
"TP-LINK TL-WR1043ND v4", tl_wr1043nd_v4_setup);
+
+static struct gpio_led tl_wr1043n_v5_leds_gpio[] __initdata = {
+ {
+ .name = "tp-link:green:wps",
+ .gpio = TL_WR1043_V4_GPIO_LED_WPS,
+ .active_low = 1,
+ },
+ {
+ .name = "tp-link:green:system",
+ .gpio = TL_WR1043_V4_GPIO_LED_SYSTEM,
+ .active_low = 1,
+ },
+ {
+ .name = "tp-link:green:wlan",
+ .gpio = TL_WR1043_V4_GPIO_LED_WLAN,
+ .active_low = 1,
+ },
+ {
+ .name = "tp-link:green:wan",
+ .gpio = TL_WR1043_V4_GPIO_LED_WAN,
+ .active_low = 1,
+ },
+ {
+ .name = "tp-link:green:lan1",
+ .gpio = TL_WR1043_V4_GPIO_LED_LAN1,
+ .active_low = 1,
+ },
+ {
+ .name = "tp-link:green:lan2",
+ .gpio = TL_WR1043_V4_GPIO_LED_LAN2,
+ .active_low = 1,
+ },
+ {
+ .name = "tp-link:green:lan3",
+ .gpio = TL_WR1043_V4_GPIO_LED_LAN3,
+ .active_low = 1,
+ },
+ {
+ .name = "tp-link:green:lan4",
+ .gpio = TL_WR1043_V4_GPIO_LED_LAN4,
+ .active_low = 1,
+ },
+};
+
+/* The 1043Nv5 is identical to the 1043NDv4,
+ * only missing the usb and small firmware layout changes */
+static void __init tl_wr1043nv5_setup(void)
+{
+ u8 *art = (u8 *) KSEG1ADDR(TL_WR1043_V4_EEPROM_ADDR);
+ u8 *mac = (u8 *) KSEG1ADDR(TL_WR1043N_V5_MAC_LOCATION);
+
+ ath79_register_m25p80(NULL);
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr1043n_v5_leds_gpio),
+ tl_wr1043n_v5_leds_gpio);
+ ath79_register_gpio_keys_polled(-1, TL_WR1043_V4_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(tl_wr1043nd_v4_gpio_keys),
+ tl_wr1043nd_v4_gpio_keys);
+
+ platform_device_register(&ath79_mdio0_device);
+
+ mdiobus_register_board_info(tl_wr1043nd_v4_mdio0_info,
+ ARRAY_SIZE(tl_wr1043nd_v4_mdio0_info));
+
+ ath79_register_wmac(art + TL_WR1043_V4_WMAC_CALDATA_OFFSET, mac);
+
+ ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
+
+ /* GMAC0 is connected to an AR8337 switch */
+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII;
+ ath79_eth0_data.speed = SPEED_1000;
+ ath79_eth0_data.duplex = DUPLEX_FULL;
+ ath79_eth0_data.phy_mask = BIT(0);
+ ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
+ ath79_register_eth(0);
+}
+
+MIPS_MACHINE(ATH79_MACH_TL_WR1043N_V5, "TL-WR1043N-v5", "TP-LINK TL-WR1043N v5",
+ tl_wr1043nv5_setup);
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
index 8864e0deda57b926e88dceebd26056a2f8099380..9cb4a7f2e1df641232289721b676a9b0149c76e5 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -214,6 +214,7 @@ enum ath79_mach_type {
ATH79_MACH_TL_WDR6500_V2, /* TP-LINK TL-WDR6500 v2 */
ATH79_MACH_TL_WPA8630, /* TP-Link TL-WPA8630 */
ATH79_MACH_TL_WR1041N_V2, /* TP-LINK TL-WR1041N v2 */
+ ATH79_MACH_TL_WR1043N_V5, /* TP-LINK TL-WR1043N v5 */
ATH79_MACH_TL_WR1043ND, /* TP-LINK TL-WR1043ND */
ATH79_MACH_TL_WR1043ND_V2, /* TP-LINK TL-WR1043ND v2 */
ATH79_MACH_TL_WR1043ND_V4, /* TP-LINK TL-WR1043ND v4 */
diff --git a/target/linux/ar71xx/image/tp-link.mk b/target/linux/ar71xx/image/tp-link.mk
index 6933654e575a1ef2c92e4c656696a479cba4c594..5be7cbfbd4ab7d73d679d52d2581459250e04302 100644
--- a/target/linux/ar71xx/image/tp-link.mk
+++ b/target/linux/ar71xx/image/tp-link.mk
@@ -858,7 +858,22 @@ define Device/tl-wr1043nd-v4
IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade
IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
endef
-TARGET_DEVICES += tl-wr1043nd-v1 tl-wr1043nd-v2 tl-wr1043nd-v3 tl-wr1043nd-v4
+
+define Device/tl-wr1043n-v5
+ DEVICE_TITLE := TP-LINK TL-WR1043N v5
+ BOARDNAME := TL-WR1043N-v5
+ SUPPORTED_DEVICES := tl-wr1043n-v5
+ DEVICE_PROFILE := TLWR1043
+ MTDPARTS := spi0.0:128k(factory-uboot)ro,128k(u-boot)ro,15104k(firmware),128k(product-info)ro,640k(config)ro,64k(partition-table)ro,128k(logs)ro,64k(art)ro
+ IMAGE_SIZE := 15104k
+ KERNEL := kernel-bin | patch-cmdline | lzma | uImageArcher lzma
+ IMAGES := sysupgrade.bin factory.bin
+ IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade | \
+ append-metadata | check-size $$$$(IMAGE_SIZE)
+ IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
+ TPLINK_BOARD_NAME := TLWR1043NV5
+endef
+TARGET_DEVICES += tl-wr1043nd-v1 tl-wr1043nd-v2 tl-wr1043nd-v3 tl-wr1043nd-v4 tl-wr1043n-v5
define Device/tl-wr2543-v1
$(Device/tplink-8mlzma)
diff --git a/target/linux/ar71xx/mikrotik/config-default b/target/linux/ar71xx/mikrotik/config-default
index 376835a703f91532300d0dd7c8ef66704acc6e05..f5af38a726f5ce33391223a4dbeb2fc0a8cac613 100644
--- a/target/linux/ar71xx/mikrotik/config-default
+++ b/target/linux/ar71xx/mikrotik/config-default
@@ -143,6 +143,7 @@ CONFIG_ATH79_MACH_RBSXTLITE=y
# CONFIG_ATH79_MACH_TL_WDR6500_V2 is not set
# CONFIG_ATH79_MACH_TL_WPA8630 is not set
# CONFIG_ATH79_MACH_TL_WR1041N_V2 is not set
+# CONFIG_ATH79_MACH_TL_WR1043N_V5 is not set
# CONFIG_ATH79_MACH_TL_WR1043ND is not set
# CONFIG_ATH79_MACH_TL_WR1043ND_V2 is not set
# CONFIG_ATH79_MACH_TL_WR1043ND_V4 is not set
diff --git a/target/linux/ar71xx/nand/config-default b/target/linux/ar71xx/nand/config-default
index 62be218e33cc6366ea89f363983f36523c419650..5c18f5d594d625f91ff10e21ddc5af2b3b4d768f 100644
--- a/target/linux/ar71xx/nand/config-default
+++ b/target/linux/ar71xx/nand/config-default
@@ -52,6 +52,7 @@
# CONFIG_ATH79_MACH_TL_WDR3500 is not set
# CONFIG_ATH79_MACH_TL_WDR4300 is not set
# CONFIG_ATH79_MACH_TL_WR1041N_V2 is not set
+# CONFIG_ATH79_MACH_TL_WR1043N_V5 is not set
# CONFIG_ATH79_MACH_TL_WR1043ND is not set
# CONFIG_ATH79_MACH_TL_WR1043ND_V4 is not set
# CONFIG_ATH79_MACH_TL_WR2543N is not set
diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c
index 24684268b1a3fe491c4eb876a5ebefc700f2e56e..478d5d8e9b43bbe37694732c138048c8fe8d807c 100644
--- a/tools/firmware-utils/src/tplink-safeloader.c
+++ b/tools/firmware-utils/src/tplink-safeloader.c
@@ -478,6 +478,42 @@ static struct device_info boards[] = {
.last_sysupgrade_partition = "file-system"
},
+ /** Firmware layout for the TL-WR1043 v5 */
+ {
+ .id = "TLWR1043NV5",
+ .vendor = "",
+ .support_list =
+ "SupportList:\n"
+ "{product_name:TL-WR1043N,product_ver:5.0.0,special_id:45550000}\n"
+ "{product_name:TL-WR1043N,product_ver:5.0.0,special_id:55530000}\n",
+ .support_trail = '\x00',
+ .soft_ver = "soft_ver:1.0.0\n",
+ .partitions = {
+ {"factory-boot", 0x00000, 0x20000},
+ {"fs-uboot", 0x20000, 0x20000},
+ {"os-image", 0x40000, 0x180000},
+ {"file-system", 0x1c0000, 0xd40000},
+ {"default-mac", 0xf00000, 0x00200},
+ {"pin", 0xf00200, 0x00200},
+ {"device-id", 0xf00400, 0x00100},
+ {"product-info", 0xf00500, 0x0fb00},
+ {"soft-version", 0xf10000, 0x01000},
+ {"extra-para", 0xf11000, 0x01000},
+ {"support-list", 0xf12000, 0x0a000},
+ {"profile", 0xf1c000, 0x04000},
+ {"default-config", 0xf20000, 0x10000},
+ {"user-config", 0xf30000, 0x40000},
+ {"qos-db", 0xf70000, 0x40000},
+ {"certificate", 0xfb0000, 0x10000},
+ {"partition-table", 0xfc0000, 0x10000},
+ {"log", 0xfd0000, 0x20000},
+ {"radio", 0xff0000, 0x10000},
+ {NULL, 0, 0}
+ },
+ .first_sysupgrade_partition = "os-image",
+ .last_sysupgrade_partition = "file-system"
+ },
+
/** Firmware layout for the RE450 */
{
.id = "RE450",
@@ -888,7 +924,9 @@ static void build_image(const char *output,
parts[3] = read_file("os-image", kernel_image, false);
parts[4] = read_file("file-system", rootfs_image, add_jffs2_eof);
- if (strcasecmp(info->id, "ARCHER-C25-V1") == 0) {
+ /* Some devices need the extra-para partition to accept the firmware */
+ if (strcasecmp(info->id, "ARCHER-C25-V1") == 0 ||
+ strcasecmp(info->id, "TLWR1043NV5") == 0) {
const char mdat[11] = {0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00};
parts[5] = put_data("extra-para", mdat, 11);
}

View File

@ -1,533 +0,0 @@
From: Felix Fietkau <nbd@nbd.name>
Date: Tue, 25 Jul 2017 13:32:47 +0200
Subject: ar71xx: add support for TP-LINK Archer C7 v4
TP-Link Archer C7 v4 is a dual-band AC1750 router, based on Qualcomm/Atheros
QCA9561+QCA9888.
Specification:
- 775/650/258 MHz (CPU/DDR/AHB)
- 128 MB of RAM (DDR2)
- 16 MB of FLASH (SPI NOR)
- 3T3R 2.4 GHz
- 3T3R 5 GHz
- 5x 10/100/1000 Mbps Ethernet
- 7x LED, 2x button
- UART header on PCB
Flash instruction:
1. Upload lede-ar71xx-generic-archer-c7-v4-squashfs-factory.bin via Web interface
Flash instruction using TFTP recovery:
1. Set PC to fixed ip address 192.168.0.66
2. Download lede-ar71xx-generic-archer-c7-v4-squashfs-factory.bin
and rename it to ArcherC7v4_tp_recovery.bin
3. Start a tftp server with the file tp_recovery.bin in its root directory
4. Turn off the router
5. Press and hold Reset button
6. Turn on router with the reset button pressed and wait ~15 seconds
7. Release the reset button and after a short time
the firmware should be transferred from the tftp server
8. Wait ~30 second to complete recovery.
Flash instruction under U-Boot, using UART:
1. tftp 0x81000000 lede-ar71xx-...-sysupgrade.bin
2. erase 0x9f040000 +$filesize
3. cp.b $fileaddr 0x9f040000 $filesize
4. reset
Signed-off-by: Felix Fietkau <nbd@nbd.name>
diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds b/target/linux/ar71xx/base-files/etc/board.d/01_leds
index e67b5e38561e841b88e486341950c52e1d454322..44b1c2837e8392596eed14b4bc0d761042109715 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
@@ -53,7 +53,8 @@ ap121f)
ucidef_set_led_netdev "lan" "LAN" "$board:green:lan" "eth0"
ucidef_set_led_wlan "wlan" "WLAN" "$board:green:wlan" "phy0tpt"
;;
-archer-c25-v1)
+archer-c25-v1|\
+archer-c7-v4)
ucidef_set_led_netdev "wan" "WAN" "$board:green:wan" "eth0"
ucidef_set_led_wlan "wlan" "WLAN" "$board:green:wlan2g" "phy1tpt"
ucidef_set_led_wlan "wlan5g" "WLAN5G" "$board:green:wlan5g" "phy0tpt"
@@ -61,6 +62,12 @@ archer-c25-v1)
ucidef_set_led_switch "lan2" "LAN2" "$board:green:lan2" "switch0" "0x08"
ucidef_set_led_switch "lan3" "LAN3" "$board:green:lan3" "switch0" "0x04"
ucidef_set_led_switch "lan4" "LAN4" "$board:green:lan4" "switch0" "0x02"
+ case "$board" in
+ archer-c7-v4)
+ ucidef_set_led_usbdev "usb1" "USB1" "$board:green:usb1" "1-1"
+ ucidef_set_led_usbdev "usb2" "USB2" "$board:green:usb2" "2-1"
+ ;;
+ esac
;;
arduino-yun)
ucidef_set_led_wlan "wlan" "WLAN" "arduino:blue:wlan" "phy0tpt"
diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network b/target/linux/ar71xx/base-files/etc/board.d/02_network
index 454abe6a5005621967dd96e0282e7bce2a0b127e..86ac949bca12561536ce2c8adb190eb004c162e4 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -386,6 +386,7 @@ ar71xx_setup_interfaces()
ucidef_set_interface_wan "eth0"
ucidef_set_interface_raw "wlan" "wlan0" "dhcp"
;;
+ archer-c7-v4|\
tl-wdr4300|\
tl-wr1041n-v2)
ucidef_add_switch "switch0" \
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index 61db387c9ecefd7090c25a5f5d75fdbf65a44d65..97372bed0ea2fadfab10f22916a1e0d6a9c65725 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -51,6 +51,7 @@ get_status_led() {
status_led="ap135:green:status"
;;
archer-c25-v1|\
+ archer-c7-v4|\
mr12|\
mr16|\
nbg6616|\
diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 68f90de802ddd18e09a1da39c0d56292eea9489c..96b8f6b9a4bdd6a1609a819e72ade315bccfb3c0 100644
--- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -92,6 +92,7 @@ case "$FIRMWARE" in
ath10kcal_extract "art" 20480 2116
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -2)
;;
+ archer-c7-v4|\
archer-c25-v1|\
tl-wdr6500-v2)
ath10kcal_extract "art" 20480 2116
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 8f8158bac8a28db4f4f15ce5c37f48a21084dc03..c32894d95b6b09b4b8b59ba64057c23e71b9f656 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -469,6 +469,9 @@ ar71xx_board_detect() {
*"Archer C5")
name="archer-c5"
;;
+ *"Archer C7 v4")
+ name="archer-c7-v4"
+ ;;
*"Archer C7")
name="archer-c7"
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 774e3c8964ef724d1efbae56434aeaa9f1c298a4..d6650e7719d268e1a500638b7eda2e15b9251aea 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -215,6 +215,7 @@ platform_check_image() {
ap132|\
ap90q|\
archer-c25-v1|\
+ archer-c7-v4|\
bullet-m|\
c-55|\
carambola2|\
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
index 7ad5419f51ec9909d8b59f33178221a7d81ec184..0a25294c40b5e2d3be825554ec7246a50b9c029b 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
@@ -1247,6 +1247,7 @@ config ATH79_MACH_ARCHER_C25_V1
config ATH79_MACH_ARCHER_C7
bool "TP-LINK Archer C5/C7/TL-WDR4900 v2 board support"
select SOC_QCA955X
+ select SOC_QCA956X
select ATH79_DEV_AP9X_PCI if PCI
select ATH79_DEV_ETH
select ATH79_DEV_GPIO_BUTTONS
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Makefile b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
index 3365a43ce16fc77b3212b39b92081efe678e8803..a0c73550eb0d5bf07ee731171be9e5ef9ff073e7 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
@@ -58,6 +58,7 @@ obj-$(CONFIG_ATH79_MACH_AP90Q) += mach-ap90q.o
obj-$(CONFIG_ATH79_MACH_AP96) += mach-ap96.o
obj-$(CONFIG_ATH79_MACH_ARCHER_C25_V1) += mach-archer-c25-v1.o
obj-$(CONFIG_ATH79_MACH_ARCHER_C7) += mach-archer-c7.o
+obj-$(CONFIG_ATH79_MACH_ARCHER_C7) += mach-archer-c7-v4.o
obj-$(CONFIG_ATH79_MACH_ARDUINO_YUN) += mach-arduino-yun.o
obj-$(CONFIG_ATH79_MACH_AW_NR580) += mach-aw-nr580.o
obj-$(CONFIG_ATH79_MACH_BHR_4GRV2) += mach-bhr-4grv2.o
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c7-v4.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c7-v4.c
new file mode 100644
index 0000000000000000000000000000000000000000..64955c79945c0b2c28d5a93be6e45662200e60ed
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c7-v4.c
@@ -0,0 +1,260 @@
+
+/*
+ * Atheros ARCHER_C7 reference board support
+ *
+ * Copyright (c) 2017 Felix Fietkau <nbd@nbd.name>
+ * Copyright (c) 2014 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012 Gabor Juhos <juhosg@openwrt.org>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#include <linux/platform_device.h>
+#include <linux/ath9k_platform.h>
+#include <linux/ar8216_platform.h>
+#include <linux/proc_fs.h>
+#include <linux/gpio.h>
+#include <linux/spi/spi_gpio.h>
+#include <linux/spi/74x164.h>
+
+#include <asm/mach-ath79/ar71xx_regs.h>
+
+#include "common.h"
+#include "dev-m25p80.h"
+#include "machtypes.h"
+#include "pci.h"
+#include "dev-eth.h"
+#include "dev-gpio-buttons.h"
+#include "dev-leds-gpio.h"
+#include "dev-spi.h"
+#include "dev-usb.h"
+#include "dev-wmac.h"
+
+
+#define ARCHER_C7_GPIO_SHIFT_OE 1
+#define ARCHER_C7_GPIO_SHIFT_SER 14
+#define ARCHER_C7_GPIO_SHIFT_SRCLK 15
+#define ARCHER_C7_GPIO_SHIFT_RCLK 16
+#define ARCHER_C7_GPIO_SHIFT_SRCLR 21
+
+#define ARCHER_C7_GPIO_BTN_RESET 5
+#define ARCHER_C7_GPIO_BTN_WPS_WIFI 2
+
+#define ARCHER_C7_GPIO_LED_WLAN5 9
+#define ARCHER_C7_GPIO_LED_POWER 6
+#define ARCHER_C7_GPIO_LED_USB1 7
+#define ARCHER_C7_GPIO_LED_USB2 8
+
+#define ARCHER_C7_74HC_GPIO_BASE QCA956X_GPIO_COUNT
+#define ARCHER_C7_GPIO_LED_WPS (ARCHER_C7_74HC_GPIO_BASE + 0)
+#define ARCHER_C7_GPIO_LED_LAN1 (ARCHER_C7_74HC_GPIO_BASE + 1)
+#define ARCHER_C7_GPIO_LED_LAN2 (ARCHER_C7_74HC_GPIO_BASE + 2)
+#define ARCHER_C7_GPIO_LED_LAN3 (ARCHER_C7_74HC_GPIO_BASE + 3)
+#define ARCHER_C7_GPIO_LED_LAN4 (ARCHER_C7_74HC_GPIO_BASE + 4)
+#define ARCHER_C7_GPIO_LED_WAN_GREEN (ARCHER_C7_74HC_GPIO_BASE + 5)
+#define ARCHER_C7_GPIO_LED_WAN_AMBER (ARCHER_C7_74HC_GPIO_BASE + 6)
+#define ARCHER_C7_GPIO_LED_WLAN2 (ARCHER_C7_74HC_GPIO_BASE + 7)
+
+#define ARCHER_C7_KEYS_POLL_INTERVAL 20 /* msecs */
+#define ARCHER_C7_KEYS_DEBOUNCE_INTERVAL (3 * ARCHER_C7_KEYS_POLL_INTERVAL)
+
+#define ARCHER_C7_MAC0_OFFSET 0
+#define ARCHER_C7_MAC1_OFFSET 6
+#define ARCHER_C7_WMAC_CALDATA_OFFSET 0x1000
+
+#define ARCHER_C7_GPIO_MDC 3
+#define ARCHER_C7_GPIO_MDIO 4
+
+static struct spi_gpio_platform_data archer_c7_v4_spi_data = {
+ .sck = ARCHER_C7_GPIO_SHIFT_SRCLK,
+ .miso = SPI_GPIO_NO_MISO,
+ .mosi = ARCHER_C7_GPIO_SHIFT_SER,
+ .num_chipselect = 1,
+};
+
+static u8 archer_c7_v4_ssr_initdata __initdata = 0xff;
+
+static struct gen_74x164_chip_platform_data archer_c7_v4_ssr_data = {
+ .base = ARCHER_C7_74HC_GPIO_BASE,
+ .num_registers = 1,
+ .init_data = &archer_c7_v4_ssr_initdata,
+};
+
+static struct platform_device archer_c7_v4_spi_device = {
+ .name = "spi_gpio",
+ .id = 1,
+ .dev = {
+ .platform_data = &archer_c7_v4_spi_data,
+ },
+};
+
+static struct spi_board_info archer_c7_v4_spi_info[] = {
+ {
+ .bus_num = 1,
+ .chip_select = 0,
+ .max_speed_hz = 10000000,
+ .modalias = "74x164",
+ .platform_data = &archer_c7_v4_ssr_data,
+ .controller_data = (void *) ARCHER_C7_GPIO_SHIFT_RCLK,
+ },
+};
+
+static struct gpio_led archer_c7_v4_leds_gpio[] __initdata = {
+ {
+ .name = "archer-c7-v4:green:power",
+ .gpio = ARCHER_C7_GPIO_LED_POWER,
+ .active_low = 1,
+ }, {
+ .name = "archer-c7-v4:green:wps",
+ .gpio = ARCHER_C7_GPIO_LED_WPS,
+ .active_low = 1,
+ }, {
+ .name = "archer-c7-v4:green:wlan2g",
+ .gpio = ARCHER_C7_GPIO_LED_WLAN2,
+ .active_low = 1,
+ }, {
+ .name = "archer-c7-v4:green:wlan5g",
+ .gpio = ARCHER_C7_GPIO_LED_WLAN5,
+ .active_low = 1,
+ }, {
+ .name = "archer-c7-v4:green:lan1",
+ .gpio = ARCHER_C7_GPIO_LED_LAN1,
+ .active_low = 1,
+ }, {
+ .name = "archer-c7-v4:green:lan2",
+ .gpio = ARCHER_C7_GPIO_LED_LAN2,
+ .active_low = 1,
+ }, {
+ .name = "archer-c7-v4:green:lan3",
+ .gpio = ARCHER_C7_GPIO_LED_LAN3,
+ .active_low = 1,
+ }, {
+ .name = "archer-c7-v4:green:lan4",
+ .gpio = ARCHER_C7_GPIO_LED_LAN4,
+ .active_low = 1,
+ }, {
+ .name = "archer-c7-v4:green:wan",
+ .gpio = ARCHER_C7_GPIO_LED_WAN_GREEN,
+ .active_low = 1,
+ }, {
+ .name = "archer-c7-v4:amber:wan",
+ .gpio = ARCHER_C7_GPIO_LED_WAN_AMBER,
+ .active_low = 1,
+ }, {
+ .name = "archer-c7-v4:green:usb1",
+ .gpio = ARCHER_C7_GPIO_LED_USB1,
+ .active_low = 1,
+ }, {
+ .name = "archer-c7-v4:green:usb2",
+ .gpio = ARCHER_C7_GPIO_LED_USB2,
+ .active_low = 1,
+ },
+};
+
+static struct gpio_keys_button archer_c7_v4_gpio_keys[] __initdata = {
+ {
+ .desc = "WPS and WIFI button",
+ .type = EV_KEY,
+ .code = KEY_WPS_BUTTON,
+ .debounce_interval = ARCHER_C7_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = ARCHER_C7_GPIO_BTN_WPS_WIFI,
+ .active_low = 1,
+ },
+ {
+ .desc = "Reset button",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = ARCHER_C7_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = ARCHER_C7_GPIO_BTN_RESET,
+ .active_low = 1,
+ },
+};
+
+static struct ar8327_pad_cfg archer_c7_v4_ar8337_pad0_cfg = {
+ .mode = AR8327_PAD_MAC_SGMII,
+ .sgmii_delay_en = true,
+};
+
+static struct ar8327_platform_data archer_c7_v4_ar8337_data = {
+ .pad0_cfg = &archer_c7_v4_ar8337_pad0_cfg,
+ .port0_cfg = {
+ .force_link = 1,
+ .speed = AR8327_PORT_SPEED_1000,
+ .duplex = 1,
+ .txpause = 1,
+ .rxpause = 1,
+ },
+};
+
+static struct mdio_board_info archer_c7_v4_mdio0_info[] = {
+ {
+ .bus_id = "ag71xx-mdio.0",
+ .phy_addr = 0,
+ .platform_data = &archer_c7_v4_ar8337_data,
+ },
+};
+
+
+static void __init archer_c7_v4_setup(void)
+{
+ u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
+ u8 *mac = (u8 *) KSEG1ADDR(0x1ff00008);
+
+ ath79_register_m25p80(NULL);
+
+ spi_register_board_info(archer_c7_v4_spi_info,
+ ARRAY_SIZE(archer_c7_v4_spi_info));
+
+ platform_device_register(&archer_c7_v4_spi_device);
+
+ gpio_request_one(ARCHER_C7_GPIO_SHIFT_OE,
+ GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED,
+ "LED control");
+
+ gpio_request_one(ARCHER_C7_GPIO_SHIFT_SRCLR,
+ GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+ "LED reset");
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(archer_c7_v4_leds_gpio),
+ archer_c7_v4_leds_gpio);
+
+ ath79_register_gpio_keys_polled(-1, ARCHER_C7_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(archer_c7_v4_gpio_keys),
+ archer_c7_v4_gpio_keys);
+
+ ath79_register_usb();
+
+ ath79_gpio_output_select(ARCHER_C7_GPIO_MDC, QCA956X_GPIO_OUT_MUX_GE0_MDC);
+ ath79_gpio_output_select(ARCHER_C7_GPIO_MDIO, QCA956X_GPIO_OUT_MUX_GE0_MDO);
+
+ ath79_register_mdio(0, 0x0);
+
+ mdiobus_register_board_info(archer_c7_v4_mdio0_info,
+ ARRAY_SIZE(archer_c7_v4_mdio0_info));
+
+ ath79_register_wmac(art + ARCHER_C7_WMAC_CALDATA_OFFSET, mac);
+ ath79_register_pci();
+
+ /* GMAC0 is connected to an AR8337 switch */
+ ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII;
+ ath79_eth0_data.speed = SPEED_1000;
+ ath79_eth0_data.duplex = DUPLEX_FULL;
+ ath79_eth0_data.phy_mask = BIT(0);
+ ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
+ ath79_register_eth(0);
+}
+
+MIPS_MACHINE(ATH79_MACH_ARCHER_C7_V4, "ARCHER-C7-V4", "TP-LINK Archer C7 v4",
+ archer_c7_v4_setup);
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
index 9cb4a7f2e1df641232289721b676a9b0149c76e5..e4623fd08836d59ad4e79e96f02e75e502a55ca6 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -44,6 +44,7 @@ enum ath79_mach_type {
ATH79_MACH_ARCHER_C5, /* TP-LINK Archer C5 board */
ATH79_MACH_ARCHER_C7, /* TP-LINK Archer C7 board */
ATH79_MACH_ARCHER_C7_V2, /* TP-LINK Archer C7 V2 board */
+ ATH79_MACH_ARCHER_C7_V4, /* TP-LINK Archer C7 V4 board */
ATH79_MACH_ARDUINO_YUN, /* Yun */
ATH79_MACH_AW_NR580, /* AzureWave AW-NR580 */
ATH79_MACH_BHR_4GRV2, /* Buffalo BHR-4GRV2 */
diff --git a/target/linux/ar71xx/image/tp-link.mk b/target/linux/ar71xx/image/tp-link.mk
index 5be7cbfbd4ab7d73d679d52d2581459250e04302..27d6c73454aef96e5da47033ec664d2caffca1d5 100644
--- a/target/linux/ar71xx/image/tp-link.mk
+++ b/target/linux/ar71xx/image/tp-link.mk
@@ -298,6 +298,22 @@ define Device/archer-c7-v2
IMAGE/factory-eu.bin := append-rootfs | mktplinkfw factory -C EU
endef
+define Device/archer-c7-v4
+ DEVICE_TITLE := TP-LINK Archer C7 v4
+ DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca988x
+ BOARDNAME := ARCHER-C7-V4
+ TPLINK_BOARD_NAME := ARCHER-C7-V4
+ IMAGE_SIZE := 15104k
+ LOADER_TYPE := elf
+ KERNEL := kernel-bin | patch-cmdline | lzma | uImageArcher lzma
+ IMAGES := sysupgrade.bin factory.bin
+ IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade | \
+ append-metadata | check-size $$$$(IMAGE_SIZE)
+ IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
+ MTDPARTS := spi0.0:128k(factory-uboot)ro,128k(u-boot)ro,1536k(kernel),13568k(rootfs),960k(config)ro,64k(art)ro,15104k@0x40000(firmware)
+ SUPPORTED_DEVICES := archer-c7-v4
+endef
+
define Device/archer-c7-v2-il
$(Device/tplink-16mlzma)
DEVICE_TITLE := TP-LINK Archer C7 v2 IL
@@ -316,7 +332,7 @@ define Device/tl-wdr7500-v3
DEVICE_PROFILE := ARCHERC7
TPLINK_HWID := 0x75000003
endef
-TARGET_DEVICES += archer-c5-v1 archer-c7-v1 archer-c7-v2 archer-c7-v2-il tl-wdr7500-v3
+TARGET_DEVICES += archer-c5-v1 archer-c7-v1 archer-c7-v2 archer-c7-v2-il archer-c7-v4 tl-wdr7500-v3
define Device/tl-mr10u-v1
$(Device/tplink-4mlzma)
diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c
index 478d5d8e9b43bbe37694732c138048c8fe8d807c..fec830c23ce6707755ddefc849f195872be1e877 100644
--- a/tools/firmware-utils/src/tplink-safeloader.c
+++ b/tools/firmware-utils/src/tplink-safeloader.c
@@ -376,6 +376,49 @@ static struct device_info boards[] = {
.last_sysupgrade_partition = "file-system"
},
+ /** Firmware layout for the C7 */
+ {
+ .id = "ARCHER-C7-V4",
+ .support_list =
+ "SupportList:\n"
+ "{product_name:Archer C7,product_ver:4.0.0,special_id:45550000}\n"
+ "{product_name:Archer C7,product_ver:4.0.0,special_id:55530000}\n"
+ "{product_name:Archer C7,product_ver:4.0.0,special_id:43410000}\n",
+ .support_trail = '\x00',
+ .soft_ver = "soft_ver:1.0.0\n",
+
+ /**
+ We use a bigger os-image partition than the stock images (and thus
+ smaller file-system), as our kernel doesn't fit in the stock firmware's
+ 1MB os-image.
+ */
+ .partitions = {
+ {"factory-boot", 0x00000, 0x20000},
+ {"fs-uboot", 0x20000, 0x20000},
+ {"os-image", 0x40000, 0x180000}, /* Stock: base 0x40000 size 0x120000 */
+ {"file-system", 0x1c0000, 0xd40000}, /* Stock: base 0x160000 size 0xda0000 */
+ {"default-mac", 0xf00000, 0x00200},
+ {"pin", 0xf00200, 0x00200},
+ {"device-id", 0xf00400, 0x00100},
+ {"product-info", 0xf00500, 0x0fb00},
+ {"soft-version", 0xf10000, 0x00100},
+ {"extra-para", 0xf11000, 0x01000},
+ {"support-list", 0xf12000, 0x0a000},
+ {"profile", 0xf1c000, 0x04000},
+ {"default-config", 0xf20000, 0x10000},
+ {"user-config", 0xf30000, 0x40000},
+ {"qos-db", 0xf70000, 0x40000},
+ {"certificate", 0xfb0000, 0x10000},
+ {"partition-table", 0xfc0000, 0x10000},
+ {"log", 0xfd0000, 0x20000},
+ {"radio", 0xff0000, 0x10000},
+ {NULL, 0, 0}
+ },
+
+ .first_sysupgrade_partition = "os-image",
+ .last_sysupgrade_partition = "file-system",
+ },
+
/** Firmware layout for the C9 */
{
.id = "ARCHERC9",
@@ -929,6 +972,9 @@ static void build_image(const char *output,
strcasecmp(info->id, "TLWR1043NV5") == 0) {
const char mdat[11] = {0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00};
parts[5] = put_data("extra-para", mdat, 11);
+ } else if (strcasecmp(info->id, "ARCHER-C7-V4") == 0) {
+ const char mdat[11] = {0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0xca, 0x00, 0x01, 0x00, 0x00};
+ parts[5] = put_data("extra-para", mdat, 11);
}
size_t len;

View File

@ -1,72 +0,0 @@
From: David Bauer <mail@david-bauer.net>
Date: Sat, 16 Dec 2017 15:43:02 +0100
Subject: ar71xx: fix TP-Link Archer C7 v4 switch LEDs
This fixes wrong switch LEDs on TP-Link Archer C7 v4.
Signed-off-by: David Bauer <mail@david-bauer.net>
diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds b/target/linux/ar71xx/base-files/etc/board.d/01_leds
index 44b1c2837e8392596eed14b4bc0d761042109715..47b90d9cb2f81936aed22cdf7d1f6d870d23c16e 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
@@ -53,8 +53,7 @@ ap121f)
ucidef_set_led_netdev "lan" "LAN" "$board:green:lan" "eth0"
ucidef_set_led_wlan "wlan" "WLAN" "$board:green:wlan" "phy0tpt"
;;
-archer-c25-v1|\
-archer-c7-v4)
+archer-c25-v1)
ucidef_set_led_netdev "wan" "WAN" "$board:green:wan" "eth0"
ucidef_set_led_wlan "wlan" "WLAN" "$board:green:wlan2g" "phy1tpt"
ucidef_set_led_wlan "wlan5g" "WLAN5G" "$board:green:wlan5g" "phy0tpt"
@@ -62,12 +61,6 @@ archer-c7-v4)
ucidef_set_led_switch "lan2" "LAN2" "$board:green:lan2" "switch0" "0x08"
ucidef_set_led_switch "lan3" "LAN3" "$board:green:lan3" "switch0" "0x04"
ucidef_set_led_switch "lan4" "LAN4" "$board:green:lan4" "switch0" "0x02"
- case "$board" in
- archer-c7-v4)
- ucidef_set_led_usbdev "usb1" "USB1" "$board:green:usb1" "1-1"
- ucidef_set_led_usbdev "usb2" "USB2" "$board:green:usb2" "2-1"
- ;;
- esac
;;
arduino-yun)
ucidef_set_led_wlan "wlan" "WLAN" "arduino:blue:wlan" "phy0tpt"
@@ -635,6 +628,17 @@ archer-c7)
ucidef_set_led_wlan "wlan2g" "WLAN2G" "tp-link:blue:wlan2g" "phy1tpt"
ucidef_set_led_wlan "wlan5g" "WLAN5G" "tp-link:blue:wlan5g" "phy0tpt"
;;
+archer-c7-v4)
+ ucidef_set_led_wlan "wlan" "WLAN" "$board:green:wlan2g" "phy1tpt"
+ ucidef_set_led_wlan "wlan5g" "WLAN5G" "$board:green:wlan5g" "phy0tpt"
+ ucidef_set_led_switch "wan" "WAN" "$board:green:wan" "switch0" "0x02"
+ ucidef_set_led_switch "lan1" "LAN1" "$board:green:lan1" "switch0" "0x04"
+ ucidef_set_led_switch "lan2" "LAN2" "$board:green:lan2" "switch0" "0x08"
+ ucidef_set_led_switch "lan3" "LAN3" "$board:green:lan3" "switch0" "0x10"
+ ucidef_set_led_switch "lan4" "LAN4" "$board:green:lan4" "switch0" "0x20"
+ ucidef_set_led_usbdev "usb1" "USB1" "$board:green:usb1" "1-1"
+ ucidef_set_led_usbdev "usb2" "USB2" "$board:green:usb2" "2-1"
+ ;;
tl-wpa8630)
ucidef_set_led_netdev "lan" "LAN" "$board:green:lan" "eth0"
ucidef_set_led_netdev "wlan" "WLAN" "$board:green:wlan" "wlan1"
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c7-v4.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c7-v4.c
index 64955c79945c0b2c28d5a93be6e45662200e60ed..9688b015356cb766c5966be2190e1aae29420d8d 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c7-v4.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c7-v4.c
@@ -58,10 +58,10 @@
#define ARCHER_C7_74HC_GPIO_BASE QCA956X_GPIO_COUNT
#define ARCHER_C7_GPIO_LED_WPS (ARCHER_C7_74HC_GPIO_BASE + 0)
-#define ARCHER_C7_GPIO_LED_LAN1 (ARCHER_C7_74HC_GPIO_BASE + 1)
-#define ARCHER_C7_GPIO_LED_LAN2 (ARCHER_C7_74HC_GPIO_BASE + 2)
-#define ARCHER_C7_GPIO_LED_LAN3 (ARCHER_C7_74HC_GPIO_BASE + 3)
-#define ARCHER_C7_GPIO_LED_LAN4 (ARCHER_C7_74HC_GPIO_BASE + 4)
+#define ARCHER_C7_GPIO_LED_LAN4 (ARCHER_C7_74HC_GPIO_BASE + 1)
+#define ARCHER_C7_GPIO_LED_LAN3 (ARCHER_C7_74HC_GPIO_BASE + 2)
+#define ARCHER_C7_GPIO_LED_LAN2 (ARCHER_C7_74HC_GPIO_BASE + 3)
+#define ARCHER_C7_GPIO_LED_LAN1 (ARCHER_C7_74HC_GPIO_BASE + 4)
#define ARCHER_C7_GPIO_LED_WAN_GREEN (ARCHER_C7_74HC_GPIO_BASE + 5)
#define ARCHER_C7_GPIO_LED_WAN_AMBER (ARCHER_C7_74HC_GPIO_BASE + 6)
#define ARCHER_C7_GPIO_LED_WLAN2 (ARCHER_C7_74HC_GPIO_BASE + 7)

View File

@ -1,36 +0,0 @@
From: David Bauer <mail@david-bauer.net>
Date: Tue, 19 Dec 2017 02:32:47 +0100
Subject: ar71xx: fix Archer C7 5GHz MAC-address
The TP-Link firmware uses (primary_mac-1) as MAC-address
for the 5GHz WiFi. This applies the same behaviour to LEDE.
Currently, the MAC-address is retrieved from eth1, which
does not exist on the Archer C7 v4. As a result from this,
every C7 v4 with LEDE carries the same MAC-Address on the 5GHz WiFi.
Signed-off-by: David Bauer <mail@david-bauer.net>
diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 96b8f6b9a4bdd6a1609a819e72ade315bccfb3c0..607bbd2c0ec4b59ba569550e9e0e87b80c7ddddb 100644
--- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -47,6 +47,10 @@ board=$(ar71xx_board_name)
case "$FIRMWARE" in
"ath10k/cal-pci-0000:00:00.0.bin")
case $board in
+ archer-c7-v4)
+ ath10kcal_extract "art" 20480 2116
+ ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -1)
+ ;;
cf-e380ac-v1|\
cf-e380ac-v2|\
dlan-pro-1200-ac|\
@@ -92,7 +96,6 @@ case "$FIRMWARE" in
ath10kcal_extract "art" 20480 2116
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -2)
;;
- archer-c7-v4|\
archer-c25-v1|\
tl-wdr6500-v2)
ath10kcal_extract "art" 20480 2116

View File

@ -1,146 +0,0 @@
From: Sven Eckelmann <sven@narfation.org>
Date: Wed, 20 Dec 2017 16:55:17 +0100
Subject: ebtables: Use flock() for --concurrent option
The previous locking mechanism was not atomic, hence it was possible
that a killed ebtables process would leave the lock file in place which
in turn made future ebtables processes wait indefinitely for the lock to
become free.
Fix this by using flock(). This also simplifies code quite a bit because
there is no need for a custom signal handler or an __exit routine
anymore.
diff --git a/package/network/utils/ebtables/patches/300-fix-concurrent.patch b/package/network/utils/ebtables/patches/300-fix-concurrent.patch
new file mode 100644
index 0000000000000000000000000000000000000000..1a99162bf51cd175e26d49e7ee5277b8b8645f48
--- /dev/null
+++ b/package/network/utils/ebtables/patches/300-fix-concurrent.patch
@@ -0,0 +1,127 @@
+From 6a826591878db3fa9e2a94b87a3d5edd8e0fc442 Mon Sep 17 00:00:00 2001
+From: Phil Sutter <phil@nwl.cc>
+Date: Fri, 6 Oct 2017 12:48:50 +0200
+Subject: Use flock() for --concurrent option
+
+The previous locking mechanism was not atomic, hence it was possible
+that a killed ebtables process would leave the lock file in place which
+in turn made future ebtables processes wait indefinitely for the lock to
+become free.
+
+Fix this by using flock(). This also simplifies code quite a bit because
+there is no need for a custom signal handler or an __exit routine
+anymore.
+
+Signed-off-by: Phil Sutter <phil@nwl.cc>
+Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
+
+Origin: upstream, https://git.netfilter.org/ebtables/commit/?id=6a826591878db3fa9e2a94b87a3d5edd8e0fc442
+---
+ ebtables.c | 8 --------
+ libebtc.c | 49 +++++--------------------------------------------
+ 2 files changed, 5 insertions(+), 52 deletions(-)
+
+diff --git a/ebtables.c b/ebtables.c
+index 62f1ba8..f7dfccf 100644
+--- a/ebtables.c
++++ b/ebtables.c
+@@ -528,12 +528,6 @@ void ebt_early_init_once()
+ ebt_iterate_targets(merge_target);
+ }
+
+-/* signal handler, installed when the option --concurrent is specified. */
+-static void sighandler(int signum)
+-{
+- exit(-1);
+-}
+-
+ /* We use exec_style instead of #ifdef's because ebtables.so is a shared object. */
+ int do_command(int argc, char *argv[], int exec_style,
+ struct ebt_u_replace *replace_)
+@@ -1047,8 +1041,6 @@ big_iface_length:
+ strcpy(replace->filename, optarg);
+ break;
+ case 13 : /* concurrent */
+- signal(SIGINT, sighandler);
+- signal(SIGTERM, sighandler);
+ use_lockfd = 1;
+ break;
+ case 1 :
+diff --git a/libebtc.c b/libebtc.c
+index 74830ec..c0ff8cc 100644
+--- a/libebtc.c
++++ b/libebtc.c
+@@ -31,6 +31,7 @@
+ #include "include/ethernetdb.h"
+ #include <unistd.h>
+ #include <fcntl.h>
++#include <sys/file.h>
+ #include <sys/wait.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+@@ -137,58 +138,18 @@ void ebt_list_extensions()
+ #define LOCKDIR "/var/lib/ebtables"
+ #define LOCKFILE LOCKDIR"/lock"
+ #endif
+-static int lockfd = -1, locked;
+ int use_lockfd;
+ /* Returns 0 on success, -1 when the file is locked by another process
+ * or -2 on any other error. */
+ static int lock_file()
+ {
+- int try = 0;
+- int ret = 0;
+- sigset_t sigset;
+-
+-tryagain:
+- /* the SIGINT handler will call unlock_file. To make sure the state
+- * of the variable locked is correct, we need to temporarily mask the
+- * SIGINT interrupt. */
+- sigemptyset(&sigset);
+- sigaddset(&sigset, SIGINT);
+- sigprocmask(SIG_BLOCK, &sigset, NULL);
+- lockfd = open(LOCKFILE, O_CREAT | O_EXCL | O_WRONLY, 00600);
+- if (lockfd < 0) {
+- if (errno == EEXIST)
+- ret = -1;
+- else if (try == 1)
+- ret = -2;
+- else {
+- if (mkdir(LOCKDIR, 00700))
+- ret = -2;
+- else {
+- try = 1;
+- goto tryagain;
+- }
+- }
+- } else {
+- close(lockfd);
+- locked = 1;
+- }
+- sigprocmask(SIG_UNBLOCK, &sigset, NULL);
+- return ret;
+-}
++ int fd = open(LOCKFILE, O_CREAT, 00600);
+
+-void unlock_file()
+-{
+- if (locked) {
+- remove(LOCKFILE);
+- locked = 0;
+- }
++ if (fd < 0)
++ return -2;
++ return flock(fd, LOCK_EX);
+ }
+
+-void __attribute__ ((destructor)) onexit()
+-{
+- if (use_lockfd)
+- unlock_file();
+-}
+ /* Get the table from the kernel or from a binary file
+ * init: 1 = ask the kernel for the initial contents of a table, i.e. the
+ * way it looks when the table is insmod'ed
+--
+cgit v1.1
+

View File

@ -1,757 +0,0 @@
From: Henryk Heisig <hyniu@o2.pl>
Date: Tue, 27 Dec 2016 22:41:41 +0100
Subject: ar71xx: add support to TP-Link Archer C59v1 and C60v1
TP-Link Archer C59v1 is a dual-band AC1350 router, based on Qualcomm/Atheros
QCA9561+QCA9886.
Specification:
- 775/650/258 MHz (CPU/DDR/AHB)
- 128 MB of RAM (DDR2)
- 16 MB of FLASH (SPI NOR)
- 3T3R 2.4 GHz
- 2T2R 5 GHz
- 5x 10/100 Mbps Ethernet
- USB 2.0 port
- 8x LED (controled by 74HC595), 3x button
- UART header on PCB
TP-Link Archer C60v1 is a dual-band AC1350 router, based on Qualcomm/Atheros
QCA9561+QCA9886.
Specification:
- 775/650/258 MHz (CPU/DDR/AHB)
- 64 MB of RAM (DDR2)
- 8 MB of FLASH (SPI NOR)
- 3T3R 2.4 GHz
- 2T2R 5 GHz
- 5x 10/100 Mbps Ethernet
- 7x LED, 2x button
- UART header on PCB
Currently not working:
- Port LAN1 on C59, LAN4 on C60
- WiFi 5GHz (missing ath10k firmware for QCA9886 chip)
- Update from oficial web interface ( tplink-saveloader not support "product-info")
Flash instruction:
1. Set PC to fixed ip address 192.168.0.66
2. Download lede-ar71xx-generic-archer-cXX-v1-squashfs-factory.bin
and rename it to tp_recovery.bin
3. Start a tftp server with the file tp_recovery.bin in its root directory
4. Turn off the router
5. Press and hold Reset button
6. Turn on router with the reset button pressed and wait ~15 seconds
7. Release the reset button and after a short time
the firmware should be transferred from the tftp server
8. Wait ~30 second to complete recovery.
Flash instruction under U-Boot, using UART:
1. tftp 0x81000000 lede-ar71xx-...-sysupgrade.bin
2. erase 0x9f020000 +$filesize
3. cp.b $fileaddr 0x9f020000 $filesize
4. reset
Signed-off-by: Henryk Heisig <hyniu@o2.pl>
[Jo-Philipp Wich: remove duplicate ATH79_MACH_ARCHER_C59/C60_V1 entries]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds b/target/linux/ar71xx/base-files/etc/board.d/01_leds
index 47b90d9cb2f81936aed22cdf7d1f6d870d23c16e..8552cde564b3fbed9425f42d5331f95fe5c3aaa8 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
@@ -62,6 +62,19 @@ archer-c25-v1)
ucidef_set_led_switch "lan3" "LAN3" "$board:green:lan3" "switch0" "0x04"
ucidef_set_led_switch "lan4" "LAN4" "$board:green:lan4" "switch0" "0x02"
;;
+archer-c59-v1|\
+archer-c60-v1)
+ ucidef_set_led_switch "lan" "LAN" "$board:green:lan" "switch0" "0x3C"
+ ucidef_set_led_switch "wan" "WAN" "$board:green:wan" "switch0" "0x02"
+ ucidef_set_led_wlan "wlan" "WLAN" "$board:green:wlan2g" "phy1tpt"
+ ucidef_set_led_wlan "wlan5g" "WLAN5G" "$board:green:wlan5g" "phy0tpt"
+
+ case "$board" in
+ archer-c59-v1)
+ ucidef_set_led_usbdev "usb" "USB" "$board:green:usb" "1-1"
+ ;;
+ esac
+ ;;
arduino-yun)
ucidef_set_led_wlan "wlan" "WLAN" "arduino:blue:wlan" "phy0tpt"
ucidef_set_led_usbdev "usb" "USB" "arduino:white:usb" "1-1.1"
diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network b/target/linux/ar71xx/base-files/etc/board.d/02_network
index 86ac949bca12561536ce2c8adb190eb004c162e4..3abe1114ee31c79abb125b85119876c3d75bb7c0 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -205,6 +205,11 @@ ar71xx_setup_interfaces()
ucidef_add_switch "switch0" \
"0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
;;
+ archer-c59-v1|\
+ archer-c60-v1)
+ ucidef_add_switch "switch0" \
+ "0@eth0" "2:lan:4" "3:lan:3" "4:lan:2" "5:lan:1" "1:wan"
+ ;;
arduino-yun|\
dir-505-a1|\
tl-wa801nd-v3)
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index 97372bed0ea2fadfab10f22916a1e0d6a9c65725..3aa1f054d4f791545a8b6644f7bd24f64ed546a3 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -52,6 +52,8 @@ get_status_led() {
;;
archer-c25-v1|\
archer-c7-v4|\
+ archer-c59-v1|\
+ archer-c60-v1|\
mr12|\
mr16|\
nbg6616|\
diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 607bbd2c0ec4b59ba569550e9e0e87b80c7ddddb..5dd1d69e7e163c938759ce476846e4d985184b7b 100644
--- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -97,6 +97,8 @@ case "$FIRMWARE" in
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -2)
;;
archer-c25-v1|\
+ archer-c59-v1|\
+ archer-c60-v1|\
tl-wdr6500-v2)
ath10kcal_extract "art" 20480 2116
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2)
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index c32894d95b6b09b4b8b59ba64057c23e71b9f656..d8e23d97e2cc20f8ba7b3b2fc516ce398c43a19b 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -472,6 +472,12 @@ ar71xx_board_detect() {
*"Archer C7 v4")
name="archer-c7-v4"
;;
+ *"Archer C59 v1")
+ name="archer-c59-v1"
+ ;;
+ *"Archer C60 v1")
+ name="archer-c60-v1"
+ ;;
*"Archer C7")
name="archer-c7"
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index d6650e7719d268e1a500638b7eda2e15b9251aea..f4ac73e40e1acb800433a0b1348c8264a4639c30 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -216,6 +216,8 @@ platform_check_image() {
ap90q|\
archer-c25-v1|\
archer-c7-v4|\
+ archer-c59-v1|\
+ archer-c60-v1|\
bullet-m|\
c-55|\
carambola2|\
diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4
index 57b6d2e541d7ef9dea8570ba8de72164d97b9775..5b33d48e52309b807dbdf2697524809ad08072ae 100644
--- a/target/linux/ar71xx/config-4.4
+++ b/target/linux/ar71xx/config-4.4
@@ -52,6 +52,8 @@ CONFIG_ATH79_MACH_AP152=y
CONFIG_ATH79_MACH_AP90Q=y
CONFIG_ATH79_MACH_AP96=y
CONFIG_ATH79_MACH_ARCHER_C25_V1=y
+CONFIG_ATH79_MACH_ARCHER_C59_V1=y
+CONFIG_ATH79_MACH_ARCHER_C60_V1=y
CONFIG_ATH79_MACH_ARCHER_C7=y
CONFIG_ATH79_MACH_ARDUINO_YUN=y
CONFIG_ATH79_MACH_AW_NR580=y
@@ -272,6 +274,7 @@ CONFIG_GENERIC_SMP_IDLE_THREAD=y
CONFIG_GENERIC_TIME_VSYSCALL=y
CONFIG_GPIOLIB=y
CONFIG_GPIOLIB_IRQCHIP=y
+CONFIG_GPIO_74X164=y
CONFIG_GPIO_DEVRES=y
CONFIG_GPIO_74X164=y
# CONFIG_GPIO_LATCH is not set
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
index 0a25294c40b5e2d3be825554ec7246a50b9c029b..468d9b333e43814cbadec8d85a20ab94e5cd6d01 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
@@ -1244,6 +1244,27 @@ config ATH79_MACH_ARCHER_C25_V1
select ATH79_DEV_M25P80
select ATH79_DEV_WMAC
+config ATH79_MACH_ARCHER_C59_V1
+ bool "TP-LINK Archer C59 v1 support"
+ select SOC_QCA956X
+ select ATH79_DEV_AP9X_PCI if PCI
+ select ATH79_DEV_ETH
+ select ATH79_DEV_GPIO_BUTTONS
+ select ATH79_DEV_LEDS_GPIO
+ select ATH79_DEV_M25P80
+ select ATH79_DEV_USB
+ select ATH79_DEV_WMAC
+
+config ATH79_MACH_ARCHER_C60_V1
+ bool "TP-LINK Archer C60 v1 support"
+ select SOC_QCA956X
+ select ATH79_DEV_AP9X_PCI if PCI
+ select ATH79_DEV_ETH
+ select ATH79_DEV_GPIO_BUTTONS
+ select ATH79_DEV_LEDS_GPIO
+ select ATH79_DEV_M25P80
+ select ATH79_DEV_WMAC
+
config ATH79_MACH_ARCHER_C7
bool "TP-LINK Archer C5/C7/TL-WDR4900 v2 board support"
select SOC_QCA955X
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Makefile b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
index a0c73550eb0d5bf07ee731171be9e5ef9ff073e7..fbe7fcb0aebb6577b96c27088a158eb025f201cb 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
@@ -57,6 +57,8 @@ obj-$(CONFIG_ATH79_MACH_AP152) += mach-ap152.o
obj-$(CONFIG_ATH79_MACH_AP90Q) += mach-ap90q.o
obj-$(CONFIG_ATH79_MACH_AP96) += mach-ap96.o
obj-$(CONFIG_ATH79_MACH_ARCHER_C25_V1) += mach-archer-c25-v1.o
+obj-$(CONFIG_ATH79_MACH_ARCHER_C59_V1) += mach-archer-c59-v1.o
+obj-$(CONFIG_ATH79_MACH_ARCHER_C60_V1) += mach-archer-c60-v1.o
obj-$(CONFIG_ATH79_MACH_ARCHER_C7) += mach-archer-c7.o
obj-$(CONFIG_ATH79_MACH_ARCHER_C7) += mach-archer-c7-v4.o
obj-$(CONFIG_ATH79_MACH_ARDUINO_YUN) += mach-arduino-yun.o
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c59-v1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c59-v1.c
new file mode 100644
index 0000000000000000000000000000000000000000..28353aa77b05078b895ab48cf6b1ae53abe98ce2
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c59-v1.c
@@ -0,0 +1,223 @@
+/*
+ * TP-Link Archer C59 v1 board support
+ *
+ * Copyright (C) 2016 Henryk Heisig <hyniu@o2.pl>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+#include <linux/platform_device.h>
+#include <linux/ath9k_platform.h>
+#include <linux/ar8216_platform.h>
+#include <asm/mach-ath79/ar71xx_regs.h>
+#include <linux/gpio.h>
+#include <linux/init.h>
+#include <linux/spi/spi_gpio.h>
+#include <linux/spi/74x164.h>
+
+#include "common.h"
+#include "dev-m25p80.h"
+#include "machtypes.h"
+#include "pci.h"
+#include "dev-ap9x-pci.h"
+#include "dev-eth.h"
+#include "dev-gpio-buttons.h"
+#include "dev-leds-gpio.h"
+#include "dev-spi.h"
+#include "dev-usb.h"
+#include "dev-wmac.h"
+
+#define ARCHER_C59_V1_KEYS_POLL_INTERVAL 20
+#define ARCHER_C59_V1_KEYS_DEBOUNCE_INTERVAL (3 * ARCHER_C59_V1_KEYS_POLL_INTERVAL)
+
+#define ARCHER_C59_V1_GPIO_BTN_RESET 21
+#define ARCHER_C59_V1_GPIO_BTN_RFKILL 2
+#define ARCHER_C59_V1_GPIO_BTN_WPS 1
+
+#define ARCHER_C59_V1_GPIO_USB_POWER 22
+
+#define ARCHER_C59_GPIO_SHIFT_OE 16
+#define ARCHER_C59_GPIO_SHIFT_SER 17
+#define ARCHER_C59_GPIO_SHIFT_SRCLK 18
+#define ARCHER_C59_GPIO_SHIFT_SRCLR 19
+#define ARCHER_C59_GPIO_SHIFT_RCLK 20
+
+#define ARCHER_C59_74HC_GPIO_BASE QCA956X_GPIO_COUNT
+#define ARCHER_C59_74HC_GPIO_LED_POWER 23
+#define ARCHER_C59_74HC_GPIO_LED_WLAN2 24
+#define ARCHER_C59_74HC_GPIO_LED_WLAN5 25
+#define ARCHER_C59_74HC_GPIO_LED_LAN 26
+#define ARCHER_C59_74HC_GPIO_LED_WAN_GREEN 27
+#define ARCHER_C59_74HC_GPIO_LED_WAN_AMBER 28
+#define ARCHER_C59_74HC_GPIO_LED_WPS 29
+#define ARCHER_C59_74HC_GPIO_LED_USB 30
+
+#define ARCHER_C59_V1_SSR_BIT_0 0
+#define ARCHER_C59_V1_SSR_BIT_1 1
+#define ARCHER_C59_V1_SSR_BIT_2 2
+#define ARCHER_C59_V1_SSR_BIT_3 3
+#define ARCHER_C59_V1_SSR_BIT_4 4
+#define ARCHER_C59_V1_SSR_BIT_5 5
+#define ARCHER_C59_V1_SSR_BIT_6 6
+#define ARCHER_C59_V1_SSR_BIT_7 7
+
+#define ARCHER_C59_V1_WMAC_CALDATA_OFFSET 0x1000
+#define ARCHER_C59_V1_PCI_CALDATA_OFFSET 0x5000
+
+static struct gpio_led archer_c59_v1_leds_gpio[] __initdata = {
+ {
+ .name = "archer-c59-v1:green:power",
+ .gpio = ARCHER_C59_74HC_GPIO_LED_POWER,
+ .active_low = 1,
+ },
+ {
+ .name = "archer-c59-v1:green:wlan2g",
+ .gpio = ARCHER_C59_74HC_GPIO_LED_WLAN2,
+ .active_low = 1,
+ },
+ {
+ .name = "archer-c59-v1:green:wlan5g",
+ .gpio = ARCHER_C59_74HC_GPIO_LED_WLAN5,
+ .active_low = 1,
+ },
+ {
+ .name = "archer-c59-v1:green:lan",
+ .gpio = ARCHER_C59_74HC_GPIO_LED_LAN,
+ .active_low = 1,
+ },
+ {
+ .name = "archer-c59-v1:green:wan",
+ .gpio = ARCHER_C59_74HC_GPIO_LED_WAN_GREEN,
+ .active_low = 1,
+ },
+ {
+ .name = "archer-c59-v1:amber:wan",
+ .gpio = ARCHER_C59_74HC_GPIO_LED_WAN_AMBER,
+ .active_low = 1,
+ },
+ {
+ .name = "archer-c59-v1:green:wps",
+ .gpio = ARCHER_C59_74HC_GPIO_LED_WPS,
+ .active_low = 1,
+ },
+ {
+ .name = "archer-c59-v1:green:usb",
+ .gpio = ARCHER_C59_74HC_GPIO_LED_USB,
+ .active_low = 1,
+ },
+};
+
+static struct gpio_keys_button archer_c59_v1_gpio_keys[] __initdata = {
+ {
+ .desc = "Reset button",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = ARCHER_C59_V1_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = ARCHER_C59_V1_GPIO_BTN_RESET,
+ .active_low = 1,
+ },
+ {
+ .desc = "RFKILL button",
+ .type = EV_KEY,
+ .code = KEY_RFKILL,
+ .debounce_interval = ARCHER_C59_V1_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = ARCHER_C59_V1_GPIO_BTN_RFKILL,
+ .active_low = 1,
+ },
+ {
+ .desc = "WPS button",
+ .type = EV_KEY,
+ .code = KEY_WPS_BUTTON,
+ .debounce_interval = ARCHER_C59_V1_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = ARCHER_C59_V1_GPIO_BTN_WPS,
+ .active_low = 1,
+ },
+};
+
+static struct spi_gpio_platform_data archer_c59_v1_spi_data = {
+ .sck = ARCHER_C59_GPIO_SHIFT_SRCLK,
+ .miso = SPI_GPIO_NO_MISO,
+ .mosi = ARCHER_C59_GPIO_SHIFT_SER,
+ .num_chipselect = 1,
+};
+
+static u8 archer_c59_v1_ssr_initdata[] __initdata = {
+ BIT(ARCHER_C59_V1_SSR_BIT_7) |
+ BIT(ARCHER_C59_V1_SSR_BIT_6) |
+ BIT(ARCHER_C59_V1_SSR_BIT_5) |
+ BIT(ARCHER_C59_V1_SSR_BIT_4) |
+ BIT(ARCHER_C59_V1_SSR_BIT_3) |
+ BIT(ARCHER_C59_V1_SSR_BIT_2) |
+ BIT(ARCHER_C59_V1_SSR_BIT_1)
+};
+
+static struct gen_74x164_chip_platform_data archer_c59_v1_ssr_data = {
+ .base = ARCHER_C59_74HC_GPIO_BASE,
+ .num_registers = ARRAY_SIZE(archer_c59_v1_ssr_initdata),
+ .init_data = archer_c59_v1_ssr_initdata,
+};
+
+static struct platform_device archer_c59_v1_spi_device = {
+ .name = "spi_gpio",
+ .id = 1,
+ .dev = {
+ .platform_data = &archer_c59_v1_spi_data,
+ },
+};
+
+static struct spi_board_info archer_c59_v1_spi_info[] = {
+ {
+ .bus_num = 1,
+ .chip_select = 0,
+ .max_speed_hz = 10000000,
+ .modalias = "74x164",
+ .platform_data = &archer_c59_v1_ssr_data,
+ .controller_data = (void *) ARCHER_C59_GPIO_SHIFT_RCLK,
+ },
+};
+
+static void __init archer_c59_v1_setup(void)
+{
+ u8 *mac = (u8 *) KSEG1ADDR(0x1f010008);
+ u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
+
+ ath79_register_m25p80(NULL);
+ spi_register_board_info(archer_c59_v1_spi_info,
+ ARRAY_SIZE(archer_c59_v1_spi_info));
+ platform_device_register(&archer_c59_v1_spi_device);
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(archer_c59_v1_leds_gpio),
+ archer_c59_v1_leds_gpio);
+
+ ath79_register_gpio_keys_polled(-1, ARCHER_C59_V1_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(archer_c59_v1_gpio_keys),
+ archer_c59_v1_gpio_keys);
+
+ ath79_register_mdio(1, 0x0);
+
+ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
+ ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
+ ath79_eth1_data.speed = SPEED_1000;
+ ath79_eth1_data.duplex = DUPLEX_FULL;
+ ath79_eth1_data.phy_mask = BIT(4);
+ ath79_register_eth(1);
+
+ ath79_register_wmac(art + ARCHER_C59_V1_WMAC_CALDATA_OFFSET, mac);
+ ap91_pci_init(art + ARCHER_C59_V1_PCI_CALDATA_OFFSET, NULL);
+
+
+ ath79_register_usb();
+ gpio_request_one(ARCHER_C59_V1_GPIO_USB_POWER,
+ GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+ "USB power");
+ gpio_request_one(ARCHER_C59_GPIO_SHIFT_OE,
+ GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED,
+ "LED control");
+ gpio_request_one(ARCHER_C59_GPIO_SHIFT_SRCLR,
+ GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+ "LED reset");
+}
+
+MIPS_MACHINE(ATH79_MACH_ARCHER_C59_V1, "ARCHER-C59-V1",
+ "TP-LINK Archer C59 v1", archer_c59_v1_setup);
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c60-v1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c60-v1.c
new file mode 100644
index 0000000000000000000000000000000000000000..78186f02cda0a231afda4e53a1d6ff696ecb6b4a
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c60-v1.c
@@ -0,0 +1,135 @@
+/*
+ * TP-Link Archer C60 v1 board support
+ *
+ * Copyright (C) 2016 Henryk Heisig <hyniu@o2.pl>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+#include <linux/platform_device.h>
+#include <linux/ath9k_platform.h>
+#include <linux/ar8216_platform.h>
+#include <asm/mach-ath79/ar71xx_regs.h>
+#include <linux/gpio.h>
+
+#include "common.h"
+#include "dev-m25p80.h"
+#include "machtypes.h"
+#include "pci.h"
+#include "dev-ap9x-pci.h"
+#include "dev-eth.h"
+#include "dev-gpio-buttons.h"
+#include "dev-leds-gpio.h"
+#include "dev-spi.h"
+#include "dev-usb.h"
+#include "dev-wmac.h"
+
+#define ARCHER_C60_V1_GPIO_LED_LAN 2
+#define ARCHER_C60_V1_GPIO_LED_POWER 16
+#define ARCHER_C60_V1_GPIO_LED_WLAN2 17
+#define ARCHER_C60_V1_GPIO_LED_WLAN5 18
+#define ARCHER_C60_V1_GPIO_LED_WPS 19
+#define ARCHER_C60_V1_GPIO_LED_WAN_GREEN 20
+#define ARCHER_C60_V1_GPIO_LED_WAN_AMBER 22
+
+
+#define ARCHER_C60_V1_KEYS_POLL_INTERVAL 20
+#define ARCHER_C60_V1_KEYS_DEBOUNCE_INTERVAL (3 * ARCHER_C60_V1_KEYS_POLL_INTERVAL)
+
+#define ARCHER_C60_V1_GPIO_BTN_RESET 21
+#define ARCHER_C60_V1_GPIO_BTN_RFKILL 1
+
+
+
+#define ARCHER_C60_V1_WMAC_CALDATA_OFFSET 0x1000
+#define ARCHER_C60_V1_PCI_CALDATA_OFFSET 0x5000
+
+static struct gpio_led archer_c60_v1_leds_gpio[] __initdata = {
+ {
+ .name = "archer-c60-v1:green:power",
+ .gpio = ARCHER_C60_V1_GPIO_LED_POWER,
+ .active_low = 1,
+ },
+ {
+ .name = "archer-c60-v1:green:wlan2g",
+ .gpio = ARCHER_C60_V1_GPIO_LED_WLAN2,
+ .active_low = 1,
+ },
+ {
+ .name = "archer-c60-v1:green:wlan5g",
+ .gpio = ARCHER_C60_V1_GPIO_LED_WLAN5,
+ .active_low = 1,
+ },
+ {
+ .name = "archer-c60-v1:green:lan",
+ .gpio = ARCHER_C60_V1_GPIO_LED_LAN,
+ .active_low = 1,
+ },
+ {
+ .name = "archer-c60-v1:green:wan",
+ .gpio = ARCHER_C60_V1_GPIO_LED_WAN_GREEN,
+ .active_low = 1,
+ },
+ {
+ .name = "archer-c60-v1:amber:wan",
+ .gpio = ARCHER_C60_V1_GPIO_LED_WAN_AMBER,
+ .active_low = 1,
+ },
+ {
+ .name = "archer-c60-v1:green:wps",
+ .gpio = ARCHER_C60_V1_GPIO_LED_WPS,
+ .active_low = 1,
+ },
+};
+
+static struct gpio_keys_button archer_c60_v1_gpio_keys[] __initdata = {
+ {
+ .desc = "Reset button",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = ARCHER_C60_V1_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = ARCHER_C60_V1_GPIO_BTN_RESET,
+ .active_low = 1,
+ },
+ {
+ .desc = "RFKILL button",
+ .type = EV_KEY,
+ .code = KEY_RFKILL,
+ .debounce_interval = ARCHER_C60_V1_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = ARCHER_C60_V1_GPIO_BTN_RFKILL,
+ .active_low = 1,
+ },
+};
+
+static void __init archer_c60_v1_setup(void)
+{
+ u8 *mac = (u8 *) KSEG1ADDR(0x1f010008);
+ u8 *art = (u8 *) KSEG1ADDR(0x1f7f0000);
+
+ ath79_register_m25p80(NULL);
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(archer_c60_v1_leds_gpio),
+ archer_c60_v1_leds_gpio);
+
+ ath79_register_gpio_keys_polled(-1, ARCHER_C60_V1_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(archer_c60_v1_gpio_keys),
+ archer_c60_v1_gpio_keys);
+
+ ath79_setup_qca956x_eth_cfg(QCA956X_ETH_CFG_SW_PHY_SWAP |
+ QCA956X_ETH_CFG_SW_PHY_ADDR_SWAP);
+ ath79_register_mdio(1, 0x0);
+
+ ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
+
+ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
+ ath79_eth1_data.speed = SPEED_1000;
+ ath79_eth1_data.duplex = DUPLEX_FULL;
+ ath79_register_eth(1);
+
+ ath79_register_wmac(art + ARCHER_C60_V1_WMAC_CALDATA_OFFSET, mac);
+ ap91_pci_init(art + ARCHER_C60_V1_PCI_CALDATA_OFFSET, NULL);
+}
+
+MIPS_MACHINE(ATH79_MACH_ARCHER_C60_V1, "ARCHER-C60-V1",
+ "TP-LINK Archer C60 v1", archer_c60_v1_setup);
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
index e4623fd08836d59ad4e79e96f02e75e502a55ca6..9fbf354e44992f4dff43df0fb0ea99c344801d97 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -42,6 +42,8 @@ enum ath79_mach_type {
ATH79_MACH_AP96, /* Atheros AP96 */
ATH79_MACH_ARCHER_C25_V1, /* TP-LINK Archer C25 V1 board */
ATH79_MACH_ARCHER_C5, /* TP-LINK Archer C5 board */
+ ATH79_MACH_ARCHER_C59_V1, /* TP-LINK Archer C59 V1 board */
+ ATH79_MACH_ARCHER_C60_V1, /* TP-LINK Archer C60 V1 board */
ATH79_MACH_ARCHER_C7, /* TP-LINK Archer C7 board */
ATH79_MACH_ARCHER_C7_V2, /* TP-LINK Archer C7 V2 board */
ATH79_MACH_ARCHER_C7_V4, /* TP-LINK Archer C7 V4 board */
diff --git a/target/linux/ar71xx/image/tp-link.mk b/target/linux/ar71xx/image/tp-link.mk
index 27d6c73454aef96e5da47033ec664d2caffca1d5..9e4aa8ea30aedba8050a77ebdcfc8f0034cc14d1 100644
--- a/target/linux/ar71xx/image/tp-link.mk
+++ b/target/linux/ar71xx/image/tp-link.mk
@@ -119,6 +119,36 @@ define Device/archer-c25-v1
endef
TARGET_DEVICES += archer-c25-v1
+define Device/archer-c59-v1
+ DEVICE_TITLE := TP-LINK Archer C59 v1
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport kmod-ath10k
+ BOARDNAME := ARCHER-C59-V1
+ TPLINK_BOARD_NAME := ARCHER-C59-V1
+ DEVICE_PROFILE := ARCHERC59V1
+ IMAGE_SIZE := 14528k
+ KERNEL := kernel-bin | patch-cmdline | lzma | uImageArcher lzma
+ IMAGES := sysupgrade.bin factory.bin
+ IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade
+ IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
+ MTDPARTS := spi0.0:64k(u-boot)ro,64k(mac)ro,1536k(kernel),12992k(rootfs),1664k(tplink)ro,64k(art)ro,14528k@0x20000(firmware)
+endef
+TARGET_DEVICES += archer-c59-v1
+
+define Device/archer-c60-v1
+ DEVICE_TITLE := TP-LINK Archer C60 v1
+ DEVICE_PACKAGES := kmod-ath10k
+ BOARDNAME := ARCHER-C60-V1
+ TPLINK_BOARD_NAME := ARCHER-C60-V1
+ DEVICE_PROFILE := ARCHERC60V1
+ IMAGE_SIZE := 7936k
+ KERNEL := kernel-bin | patch-cmdline | lzma | uImageArcher lzma
+ IMAGES := sysupgrade.bin factory.bin
+ IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade
+ IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
+ MTDPARTS := spi0.0:64k(u-boot)ro,64k(mac)ro,1344k(kernel),6592k(rootfs),64k(tplink)ro,64k(art)ro,7936k@0x20000(firmware)
+endef
+TARGET_DEVICES += archer-c60-v1
+
define Device/cpe510-520
DEVICE_TITLE := TP-LINK CPE510/520
DEVICE_PACKAGES := rssileds
diff --git a/target/linux/ar71xx/mikrotik/config-default b/target/linux/ar71xx/mikrotik/config-default
index f5af38a726f5ce33391223a4dbeb2fc0a8cac613..3f6884dcf44c83f9867e4e9936caa79c0abc5dc1 100644
--- a/target/linux/ar71xx/mikrotik/config-default
+++ b/target/linux/ar71xx/mikrotik/config-default
@@ -17,6 +17,8 @@
# CONFIG_ATH79_MACH_AP90Q is not set
# CONFIG_ATH79_MACH_AP96 is not set
# CONFIG_ATH79_MACH_ARCHER_C25_V1 is not set
+# CONFIG_ATH79_MACH_ARCHER_C59_V1 is not set
+# CONFIG_ATH79_MACH_ARCHER_C60_V1 is not set
# CONFIG_ATH79_MACH_ARCHER_C7 is not set
# CONFIG_ATH79_MACH_ARDUINO_YUN is not set
# CONFIG_ATH79_MACH_AW_NR580 is not set
diff --git a/target/linux/ar71xx/nand/config-default b/target/linux/ar71xx/nand/config-default
index 5c18f5d594d625f91ff10e21ddc5af2b3b4d768f..a50099aca12aafdcb27f4f2b77ca2a5ce4b4d6f2 100644
--- a/target/linux/ar71xx/nand/config-default
+++ b/target/linux/ar71xx/nand/config-default
@@ -10,6 +10,8 @@
# CONFIG_ATH79_MACH_AP147 is not set
# CONFIG_ATH79_MACH_AP96 is not set
# CONFIG_ATH79_MACH_ARCHER_C25_V1 is not set
+# CONFIG_ATH79_MACH_ARCHER_C59_V1 is not set
+# CONFIG_ATH79_MACH_ARCHER_C60_V1 is not set
# CONFIG_ATH79_MACH_ARCHER_C7 is not set
# CONFIG_ATH79_MACH_AW_NR580 is not set
# CONFIG_ATH79_MACH_CAP324 is not set
diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c
index fec830c23ce6707755ddefc849f195872be1e877..aeebf8e0bbdc3ec53c42d5cc01a3ffe892b46804 100644
--- a/tools/firmware-utils/src/tplink-safeloader.c
+++ b/tools/firmware-utils/src/tplink-safeloader.c
@@ -376,6 +376,79 @@ static struct device_info boards[] = {
.last_sysupgrade_partition = "file-system"
},
+ /** Firmware layout for the C59v1 */
+ {
+ .id = "ARCHER-C59-V1",
+ .vendor = "",
+ .support_list =
+ "SupportList:\r\n"
+ "{product_name:Archer C59,product_ver:1.0.0,special_id:00000000}\r\n"
+ "{product_name:Archer C59,product_ver:1.0.0,special_id:45550000}\r\n"
+ "{product_name:Archer C59,product_ver:1.0.0,special_id:55530000}\r\n",
+ .support_trail = '\x00',
+ .soft_ver = "soft_ver:1.0.0\n",
+
+ .partitions = {
+ {"fs-uboot", 0x00000, 0x10000},
+ {"default-mac", 0x10000, 0x00200},
+ {"pin", 0x10200, 0x00200},
+ {"device-id", 0x10400, 0x00100},
+ {"product-info", 0x10500, 0x0fb00},
+ {"os-image", 0x20000, 0x180000},
+ {"file-system", 0x1a0000, 0xcb0000},
+ {"partition-table", 0xe50000, 0x10000},
+ {"soft-version", 0xe60000, 0x10000},
+ {"support-list", 0xe70000, 0x10000},
+ {"profile", 0xe80000, 0x10000},
+ {"default-config", 0xe90000, 0x10000},
+ {"user-config", 0xea0000, 0x40000},
+ {"usb-config", 0xee0000, 0x10000},
+ {"certificate", 0xef0000, 0x10000},
+ {"qos-db", 0xf00000, 0x40000},
+ {"log", 0xfe0000, 0x10000},
+ {"radio", 0xff0000, 0x10000},
+ {NULL, 0, 0}
+ },
+
+ .first_sysupgrade_partition = "os-image",
+ .last_sysupgrade_partition = "file-system",
+ },
+
+ /** Firmware layout for the C60v1 */
+ {
+ .id = "ARCHER-C60-V1",
+ .vendor = "",
+ .support_list =
+ "SupportList:\r\n"
+ "{product_name:Archer C60,product_ver:1.0.0,special_id:00000000}\r\n"
+ "{product_name:Archer C60,product_ver:1.0.0,special_id:45550000}\r\n"
+ "{product_name:Archer C60,product_ver:1.0.0,special_id:55530000}\r\n",
+ .support_trail = '\x00',
+ .soft_ver = "soft_ver:1.0.0\n",
+
+ .partitions = {
+ {"fs-uboot", 0x00000, 0x10000},
+ {"default-mac", 0x10000, 0x00200},
+ {"pin", 0x10200, 0x00200},
+ {"product-info", 0x10400, 0x00100},
+ {"partition-table", 0x10500, 0x00800},
+ {"soft-version", 0x11300, 0x00200},
+ {"support-list", 0x11500, 0x00100},
+ {"device-id", 0x11600, 0x00100},
+ {"profile", 0x11700, 0x03900},
+ {"default-config", 0x15000, 0x04000},
+ {"user-config", 0x19000, 0x04000},
+ {"os-image", 0x20000, 0x150000},
+ {"file-system", 0x170000, 0x678000},
+ {"certyficate", 0x7e8000, 0x08000},
+ {"radio", 0x7f0000, 0x10000},
+ {NULL, 0, 0}
+ },
+
+ .first_sysupgrade_partition = "os-image",
+ .last_sysupgrade_partition = "file-system",
+ },
+
/** Firmware layout for the C7 */
{
.id = "ARCHER-C7-V4",

View File

@ -1,128 +0,0 @@
From: Henryk Heisig <hyniu@o2.pl>
Date: Thu, 16 Feb 2017 15:22:49 +0100
Subject: ar71xx: fix lan ports on archer C59 and C60
Signed-off-by: Henryk Heisig <hyniu@o2.pl>
diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds b/target/linux/ar71xx/base-files/etc/board.d/01_leds
index 8552cde564b3fbed9425f42d5331f95fe5c3aaa8..5c6b47d0249c979934d61078e16759fc22aa41c7 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
@@ -64,8 +64,8 @@ archer-c25-v1)
;;
archer-c59-v1|\
archer-c60-v1)
- ucidef_set_led_switch "lan" "LAN" "$board:green:lan" "switch0" "0x3C"
- ucidef_set_led_switch "wan" "WAN" "$board:green:wan" "switch0" "0x02"
+ ucidef_set_led_switch "lan" "LAN" "$board:green:lan" "switch0" "0x1E"
+ ucidef_set_led_netdev "wan" "WAN" "$board:green:wan" "eth0"
ucidef_set_led_wlan "wlan" "WLAN" "$board:green:wlan2g" "phy1tpt"
ucidef_set_led_wlan "wlan5g" "WLAN5G" "$board:green:wlan5g" "phy0tpt"
diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network b/target/linux/ar71xx/base-files/etc/board.d/02_network
index 3abe1114ee31c79abb125b85119876c3d75bb7c0..933ed22815ee076c98a83173aad143c010c9a131 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -206,9 +206,15 @@ ar71xx_setup_interfaces()
"0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
;;
archer-c59-v1|\
+ rb-450g)
+ ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
+ ucidef_add_switch "switch0" \
+ "0@eth1" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
+ ;;
archer-c60-v1)
+ ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
ucidef_add_switch "switch0" \
- "0@eth0" "2:lan:4" "3:lan:3" "4:lan:2" "5:lan:1" "1:wan"
+ "0@eth1" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4"
;;
arduino-yun|\
dir-505-a1|\
@@ -370,11 +376,6 @@ ar71xx_setup_interfaces()
ucidef_add_switch "switch0" \
"0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5@eth1"
;;
- rb-450g)
- ucidef_set_interfaces_lan_wan "eth1" "eth0"
- ucidef_add_switch "switch0" \
- "0@eth1" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
- ;;
routerstation-pro)
ucidef_set_interfaces_lan_wan "eth1" "eth0"
ucidef_add_switch "switch0" \
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c59-v1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c59-v1.c
index 28353aa77b05078b895ab48cf6b1ae53abe98ce2..d55f9b9f75b38159ed7209aa5acd73ff31088b51 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c59-v1.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c59-v1.c
@@ -194,19 +194,33 @@ static void __init archer_c59_v1_setup(void)
ARRAY_SIZE(archer_c59_v1_gpio_keys),
archer_c59_v1_gpio_keys);
+ ath79_setup_qca956x_eth_cfg(QCA956X_ETH_CFG_SW_PHY_SWAP |
+ QCA956X_ETH_CFG_SW_PHY_ADDR_SWAP);
+
+ ath79_register_mdio(0, 0x0);
ath79_register_mdio(1, 0x0);
- ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
+ ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
+
+ /* WAN port */
+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
+ ath79_eth0_data.speed = SPEED_100;
+ ath79_eth0_data.duplex = DUPLEX_FULL;
+ ath79_eth0_data.phy_mask = BIT(0);
+ ath79_register_eth(0);
+
+ /* LAN ports */
+ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
ath79_eth1_data.speed = SPEED_1000;
ath79_eth1_data.duplex = DUPLEX_FULL;
- ath79_eth1_data.phy_mask = BIT(4);
+ ath79_switch_data.phy_poll_mask |= BIT(4);
+ ath79_switch_data.phy4_mii_en = 1;
ath79_register_eth(1);
ath79_register_wmac(art + ARCHER_C59_V1_WMAC_CALDATA_OFFSET, mac);
ap91_pci_init(art + ARCHER_C59_V1_PCI_CALDATA_OFFSET, NULL);
-
ath79_register_usb();
gpio_request_one(ARCHER_C59_V1_GPIO_USB_POWER,
GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c60-v1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c60-v1.c
index 78186f02cda0a231afda4e53a1d6ff696ecb6b4a..4d83fa737b9650935b4f7f985d58f471c38cd9da 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c60-v1.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c60-v1.c
@@ -116,15 +116,25 @@ static void __init archer_c60_v1_setup(void)
ARRAY_SIZE(archer_c60_v1_gpio_keys),
archer_c60_v1_gpio_keys);
- ath79_setup_qca956x_eth_cfg(QCA956X_ETH_CFG_SW_PHY_SWAP |
- QCA956X_ETH_CFG_SW_PHY_ADDR_SWAP);
+ ath79_register_mdio(0, 0x0);
ath79_register_mdio(1, 0x0);
- ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
+ ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
+ ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1);
+ /* WAN port */
+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
+ ath79_eth0_data.speed = SPEED_100;
+ ath79_eth0_data.duplex = DUPLEX_FULL;
+ ath79_eth0_data.phy_mask = BIT(4);
+ ath79_register_eth(0);
+
+ /* LAN ports */
ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
ath79_eth1_data.speed = SPEED_1000;
ath79_eth1_data.duplex = DUPLEX_FULL;
+ ath79_switch_data.phy_poll_mask |= BIT(4);
+ ath79_switch_data.phy4_mii_en = 1;
ath79_register_eth(1);
ath79_register_wmac(art + ARCHER_C60_V1_WMAC_CALDATA_OFFSET, mac);

View File

@ -1,411 +0,0 @@
From: Henryk Heisig <hyniu@o2.pl>
Date: Fri, 16 Jun 2017 15:26:30 +0200
Subject: ar71xx: add support for TP-Link Archer C58 v1
TP-Link Archer C58 v1 is a dual-band AC1350 router, based on Qualcomm
QCA9561 + QCA9886. It looks like Archer C59 v1 without USB port.
Specification:
- 775/650/258 MHz (CPU/DDR/AHB)
- 64 MB of RAM (DDR2)
- 8 MB of FLASH (SPI NOR)
- 3T3R 2.4 GHz
- 2T2R 5 GHz
- 5x 10/100 Mbps Ethernet
- 6x LED, 3x button
- UART header on PCB, RX, TX at TP4+5 (backside)
QCA9886 wlan needs pre_cal_data file and enable ieee80211 phy hotplug to
patch macaddress.
Flash instruction:
Use "factory" image directly in vendor GUI.
Recovery method:
1. Set PC to fixed ip address 192.168.0.66/24.
2. Download "lede-ar71xx-generic-archer-c58-v1-squashfs-factory.bin" and
rename it to "tp_recovery.bin".
3. Start a tftp server with the file "tp_recovery.bin" in its root
directory.
4. Turn off the router.
5. Press and hold Reset button.
6. Turn on router with the reset button pressed and wait ~15 seconds.
7. Release the reset button and after a short time the firmware should
be transferred from the tftp server.
8. Wait ~30 second to complete recovery.
Flash instruction under U-Boot, using UART:
tftp 0x81000000 lede-ar71xx-...-sysupgrade.bin
erase 0x9f020000 +$filesize
cp.b $fileaddr 0x9f020000 $filesize
reset
This commit is based on GitHub PR#1112
Signed-off-by: Henryk Heisig <hyniu@o2.pl>
diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds b/target/linux/ar71xx/base-files/etc/board.d/01_leds
index 5c6b47d0249c979934d61078e16759fc22aa41c7..f9483e9a706fbd98ce6a42e968bc0d31e9da5c84 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
@@ -62,6 +62,7 @@ archer-c25-v1)
ucidef_set_led_switch "lan3" "LAN3" "$board:green:lan3" "switch0" "0x04"
ucidef_set_led_switch "lan4" "LAN4" "$board:green:lan4" "switch0" "0x02"
;;
+archer-c58-v1|\
archer-c59-v1|\
archer-c60-v1)
ucidef_set_led_switch "lan" "LAN" "$board:green:lan" "switch0" "0x1E"
diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network b/target/linux/ar71xx/base-files/etc/board.d/02_network
index 933ed22815ee076c98a83173aad143c010c9a131..57bc912aa5ede22a3fad4af6a1deb00c33f17cf8 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -205,6 +205,7 @@ ar71xx_setup_interfaces()
ucidef_add_switch "switch0" \
"0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
;;
+ archer-c58-v1|\
archer-c59-v1|\
rb-450g)
ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index 3aa1f054d4f791545a8b6644f7bd24f64ed546a3..382500b75ee6dc1fe1126fb3121f4ae205c901d4 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -52,6 +52,7 @@ get_status_led() {
;;
archer-c25-v1|\
archer-c7-v4|\
+ archer-c58-v1|\
archer-c59-v1|\
archer-c60-v1|\
mr12|\
diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 5dd1d69e7e163c938759ce476846e4d985184b7b..538c86e4743109f7665096da32620d7862248aea 100644
--- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -134,6 +134,13 @@ case "$FIRMWARE" in
;;
esac
;;
+"ath10k/pre-cal-pci-0000:00:00.0.bin")
+ case $board in
+ archer-c58-v1)
+ ath10kcal_extract "art" 20480 12064
+ ;;
+ esac
+ ;;
*)
exit 1
;;
diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ar71xx/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
new file mode 100644
index 0000000000000000000000000000000000000000..7d2eca546d76b771b12026788510f73a293a9a93
--- /dev/null
+++ b/target/linux/ar71xx/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
@@ -0,0 +1,21 @@
+#!/bin/ash
+
+[ "$ACTION" == "add" ] || exit 0
+
+PHYNBR=${DEVPATH##*/phy}
+
+[ -n $PHYNBR ] || exit 0
+
+. /lib/ar71xx.sh
+. /lib/functions/system.sh
+
+board=$(ar71xx_board_name)
+
+case "$board" in
+ archer-c58-v1)
+ echo $(macaddr_add $(mtd_get_mac_binary mac 8) $(($PHYNBR - 1)) ) > /sys${DEVPATH}/macaddress
+ ;;
+ *)
+ ;;
+esac
+
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index d8e23d97e2cc20f8ba7b3b2fc516ce398c43a19b..59ede17653bbb1994ce9fa734c86c877aedf67e4 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -472,6 +472,9 @@ ar71xx_board_detect() {
*"Archer C7 v4")
name="archer-c7-v4"
;;
+ *"Archer C58 v1")
+ name="archer-c58-v1"
+ ;;
*"Archer C59 v1")
name="archer-c59-v1"
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index f4ac73e40e1acb800433a0b1348c8264a4639c30..5e8a06a7ae70ec349693c09deedbfce41a52cfc2 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -216,6 +216,7 @@ platform_check_image() {
ap90q|\
archer-c25-v1|\
archer-c7-v4|\
+ archer-c58-v1|\
archer-c59-v1|\
archer-c60-v1|\
bullet-m|\
diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4
index 5b33d48e52309b807dbdf2697524809ad08072ae..396a4fa02adb37c6e5f9f7f1cc40fd1014361654 100644
--- a/target/linux/ar71xx/config-4.4
+++ b/target/linux/ar71xx/config-4.4
@@ -52,6 +52,7 @@ CONFIG_ATH79_MACH_AP152=y
CONFIG_ATH79_MACH_AP90Q=y
CONFIG_ATH79_MACH_AP96=y
CONFIG_ATH79_MACH_ARCHER_C25_V1=y
+CONFIG_ATH79_MACH_ARCHER_C58_V1=y
CONFIG_ATH79_MACH_ARCHER_C59_V1=y
CONFIG_ATH79_MACH_ARCHER_C60_V1=y
CONFIG_ATH79_MACH_ARCHER_C7=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
index 468d9b333e43814cbadec8d85a20ab94e5cd6d01..4c9012acc6b4c40d88ffc8752086cac86b9b9c92 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
@@ -1244,6 +1244,16 @@ config ATH79_MACH_ARCHER_C25_V1
select ATH79_DEV_M25P80
select ATH79_DEV_WMAC
+config ATH79_MACH_ARCHER_C58_V1
+ bool "TP-LINK Archer C58 v1 support"
+ select SOC_QCA956X
+ select ATH79_DEV_AP9X_PCI if PCI
+ select ATH79_DEV_ETH
+ select ATH79_DEV_GPIO_BUTTONS
+ select ATH79_DEV_LEDS_GPIO
+ select ATH79_DEV_M25P80
+ select ATH79_DEV_WMAC
+
config ATH79_MACH_ARCHER_C59_V1
bool "TP-LINK Archer C59 v1 support"
select SOC_QCA956X
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Makefile b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
index fbe7fcb0aebb6577b96c27088a158eb025f201cb..8408894669dc5f14f05701359073ef233a1b89f0 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
@@ -57,6 +57,7 @@ obj-$(CONFIG_ATH79_MACH_AP152) += mach-ap152.o
obj-$(CONFIG_ATH79_MACH_AP90Q) += mach-ap90q.o
obj-$(CONFIG_ATH79_MACH_AP96) += mach-ap96.o
obj-$(CONFIG_ATH79_MACH_ARCHER_C25_V1) += mach-archer-c25-v1.o
+obj-$(CONFIG_ATH79_MACH_ARCHER_C58_V1) += mach-archer-c59-v1.o
obj-$(CONFIG_ATH79_MACH_ARCHER_C59_V1) += mach-archer-c59-v1.o
obj-$(CONFIG_ATH79_MACH_ARCHER_C60_V1) += mach-archer-c60-v1.o
obj-$(CONFIG_ATH79_MACH_ARCHER_C7) += mach-archer-c7.o
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c59-v1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c59-v1.c
index d55f9b9f75b38159ed7209aa5acd73ff31088b51..f385d4a5a3148b83ee01007145e0eda2c0ef670f 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c59-v1.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c59-v1.c
@@ -1,7 +1,7 @@
/*
- * TP-Link Archer C59 v1 board support
+ * TP-Link Archer C58/C59 v1 board support
*
- * Copyright (C) 2016 Henryk Heisig <hyniu@o2.pl>
+ * Copyright (C) 2017 Henryk Heisig <hyniu@o2.pl>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
@@ -65,6 +65,44 @@
#define ARCHER_C59_V1_WMAC_CALDATA_OFFSET 0x1000
#define ARCHER_C59_V1_PCI_CALDATA_OFFSET 0x5000
+static struct gpio_led archer_c58_v1_leds_gpio[] __initdata = {
+ {
+ .name = "archer-c58-v1:green:power",
+ .gpio = ARCHER_C59_74HC_GPIO_LED_POWER,
+ .active_low = 1,
+ },
+ {
+ .name = "archer-c58-v1:green:wlan2g",
+ .gpio = ARCHER_C59_74HC_GPIO_LED_WLAN2,
+ .active_low = 1,
+ },
+ {
+ .name = "archer-c58-v1:green:wlan5g",
+ .gpio = ARCHER_C59_74HC_GPIO_LED_WLAN5,
+ .active_low = 1,
+ },
+ {
+ .name = "archer-c58-v1:green:lan",
+ .gpio = ARCHER_C59_74HC_GPIO_LED_LAN,
+ .active_low = 1,
+ },
+ {
+ .name = "archer-c58-v1:green:wan",
+ .gpio = ARCHER_C59_74HC_GPIO_LED_WAN_GREEN,
+ .active_low = 1,
+ },
+ {
+ .name = "archer-c58-v1:amber:wan",
+ .gpio = ARCHER_C59_74HC_GPIO_LED_WAN_AMBER,
+ .active_low = 1,
+ },
+ {
+ .name = "archer-c58-v1:green:wps",
+ .gpio = ARCHER_C59_74HC_GPIO_LED_WPS,
+ .active_low = 1,
+ },
+};
+
static struct gpio_led archer_c59_v1_leds_gpio[] __initdata = {
{
.name = "archer-c59-v1:green:power",
@@ -177,7 +215,7 @@ static struct spi_board_info archer_c59_v1_spi_info[] = {
},
};
-static void __init archer_c59_v1_setup(void)
+static void __init archer_c5x_v1_setup(void)
{
u8 *mac = (u8 *) KSEG1ADDR(0x1f010008);
u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
@@ -187,9 +225,6 @@ static void __init archer_c59_v1_setup(void)
ARRAY_SIZE(archer_c59_v1_spi_info));
platform_device_register(&archer_c59_v1_spi_device);
- ath79_register_leds_gpio(-1, ARRAY_SIZE(archer_c59_v1_leds_gpio),
- archer_c59_v1_leds_gpio);
-
ath79_register_gpio_keys_polled(-1, ARCHER_C59_V1_KEYS_POLL_INTERVAL,
ARRAY_SIZE(archer_c59_v1_gpio_keys),
archer_c59_v1_gpio_keys);
@@ -233,5 +268,22 @@ static void __init archer_c59_v1_setup(void)
"LED reset");
}
+static void __init archer_c58_v1_setup(void)
+{
+ archer_c5x_v1_setup();
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(archer_c58_v1_leds_gpio),
+ archer_c58_v1_leds_gpio);
+}
+
+MIPS_MACHINE(ATH79_MACH_ARCHER_C58_V1, "ARCHER-C58-V1",
+ "TP-LINK Archer C58 v1", archer_c58_v1_setup);
+
+static void __init archer_c59_v1_setup(void)
+{
+ archer_c5x_v1_setup();
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(archer_c59_v1_leds_gpio),
+ archer_c59_v1_leds_gpio);
+}
+
MIPS_MACHINE(ATH79_MACH_ARCHER_C59_V1, "ARCHER-C59-V1",
"TP-LINK Archer C59 v1", archer_c59_v1_setup);
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
index 9fbf354e44992f4dff43df0fb0ea99c344801d97..72c1e38c74707aba8fbd3aebc36f35becabd4987 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -42,6 +42,7 @@ enum ath79_mach_type {
ATH79_MACH_AP96, /* Atheros AP96 */
ATH79_MACH_ARCHER_C25_V1, /* TP-LINK Archer C25 V1 board */
ATH79_MACH_ARCHER_C5, /* TP-LINK Archer C5 board */
+ ATH79_MACH_ARCHER_C58_V1, /* TP-LINK Archer C58 V1 board */
ATH79_MACH_ARCHER_C59_V1, /* TP-LINK Archer C59 V1 board */
ATH79_MACH_ARCHER_C60_V1, /* TP-LINK Archer C60 V1 board */
ATH79_MACH_ARCHER_C7, /* TP-LINK Archer C7 board */
diff --git a/target/linux/ar71xx/image/tp-link.mk b/target/linux/ar71xx/image/tp-link.mk
index 9e4aa8ea30aedba8050a77ebdcfc8f0034cc14d1..557bcdab2237a03957313cc3cda471a9fe3a3706 100644
--- a/target/linux/ar71xx/image/tp-link.mk
+++ b/target/linux/ar71xx/image/tp-link.mk
@@ -119,6 +119,21 @@ define Device/archer-c25-v1
endef
TARGET_DEVICES += archer-c25-v1
+define Device/archer-c58-v1
+ DEVICE_TITLE := TP-LINK Archer C58 v1
+ DEVICE_PACKAGES := kmod-ath10k
+ BOARDNAME := ARCHER-C58-V1
+ TPLINK_BOARD_NAME := ARCHER-C58-V1
+ DEVICE_PROFILE := ARCHERC58V1
+ IMAGE_SIZE := 7936k
+ KERNEL := kernel-bin | patch-cmdline | lzma | uImageArcher lzma
+ IMAGES := sysupgrade.bin factory.bin
+ IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade
+ IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
+ MTDPARTS := spi0.0:64k(u-boot)ro,64k(mac)ro,1344k(kernel),6592k(rootfs),64k(tplink)ro,64k(art)ro,7936k@0x20000(firmware)
+endef
+TARGET_DEVICES += archer-c58-v1
+
define Device/archer-c59-v1
DEVICE_TITLE := TP-LINK Archer C59 v1
DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport kmod-ath10k
diff --git a/target/linux/ar71xx/mikrotik/config-default b/target/linux/ar71xx/mikrotik/config-default
index 3f6884dcf44c83f9867e4e9936caa79c0abc5dc1..23e862762600f0724a37fe1a390d4d09639c472c 100644
--- a/target/linux/ar71xx/mikrotik/config-default
+++ b/target/linux/ar71xx/mikrotik/config-default
@@ -17,6 +17,7 @@
# CONFIG_ATH79_MACH_AP90Q is not set
# CONFIG_ATH79_MACH_AP96 is not set
# CONFIG_ATH79_MACH_ARCHER_C25_V1 is not set
+# CONFIG_ATH79_MACH_ARCHER_C58_V1 is not set
# CONFIG_ATH79_MACH_ARCHER_C59_V1 is not set
# CONFIG_ATH79_MACH_ARCHER_C60_V1 is not set
# CONFIG_ATH79_MACH_ARCHER_C7 is not set
diff --git a/target/linux/ar71xx/nand/config-default b/target/linux/ar71xx/nand/config-default
index a50099aca12aafdcb27f4f2b77ca2a5ce4b4d6f2..c11ccfe29795d013776870cf21fb6ca8d907af1b 100644
--- a/target/linux/ar71xx/nand/config-default
+++ b/target/linux/ar71xx/nand/config-default
@@ -10,6 +10,7 @@
# CONFIG_ATH79_MACH_AP147 is not set
# CONFIG_ATH79_MACH_AP96 is not set
# CONFIG_ATH79_MACH_ARCHER_C25_V1 is not set
+# CONFIG_ATH79_MACH_ARCHER_C58_V1 is not set
# CONFIG_ATH79_MACH_ARCHER_C59_V1 is not set
# CONFIG_ATH79_MACH_ARCHER_C60_V1 is not set
# CONFIG_ATH79_MACH_ARCHER_C7 is not set
diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c
index aeebf8e0bbdc3ec53c42d5cc01a3ffe892b46804..67e2c4475bbd468bd20915767a481711ae872a3a 100644
--- a/tools/firmware-utils/src/tplink-safeloader.c
+++ b/tools/firmware-utils/src/tplink-safeloader.c
@@ -376,6 +376,41 @@ static struct device_info boards[] = {
.last_sysupgrade_partition = "file-system"
},
+ /** Firmware layout for the C58v1 */
+ {
+ .id = "ARCHER-C58-V1",
+ .vendor = "",
+ .support_list =
+ "SupportList:\r\n"
+ "{product_name:Archer C58,product_ver:1.0.0,special_id:00000000}\r\n"
+ "{product_name:Archer C58,product_ver:1.0.0,special_id:45550000}\r\n"
+ "{product_name:Archer C58,product_ver:1.0.0,special_id:55530000}\r\n",
+ .support_trail = '\x00',
+ .soft_ver = "soft_ver:1.0.0\n",
+
+ .partitions = {
+ {"fs-uboot", 0x00000, 0x10000},
+ {"default-mac", 0x10000, 0x00200},
+ {"pin", 0x10200, 0x00200},
+ {"product-info", 0x10400, 0x00100},
+ {"partition-table", 0x10500, 0x00800},
+ {"soft-version", 0x11300, 0x00200},
+ {"support-list", 0x11500, 0x00100},
+ {"device-id", 0x11600, 0x00100},
+ {"profile", 0x11700, 0x03900},
+ {"default-config", 0x15000, 0x04000},
+ {"user-config", 0x19000, 0x04000},
+ {"os-image", 0x20000, 0x150000},
+ {"file-system", 0x170000, 0x678000},
+ {"certyficate", 0x7e8000, 0x08000},
+ {"radio", 0x7f0000, 0x10000},
+ {NULL, 0, 0}
+ },
+
+ .first_sysupgrade_partition = "os-image",
+ .last_sysupgrade_partition = "file-system",
+ },
+
/** Firmware layout for the C59v1 */
{
.id = "ARCHER-C59-V1",

View File

@ -1,21 +0,0 @@
From: David Bauer <mail@david-bauer.net>
Date: Thu, 11 Jan 2018 21:17:15 +0100
Subject: ath10k-firmware: update repository
diff --git a/package/firmware/ath10k-firmware/Makefile b/package/firmware/ath10k-firmware/Makefile
index 8bf5729fff16677ef6449498f1df3cda19272583..81dce0eb7aeee20e2ed3be4cc6699bf867487a96 100644
--- a/package/firmware/ath10k-firmware/Makefile
+++ b/package/firmware/ath10k-firmware/Makefile
@@ -8,9 +8,9 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=ath10k-firmware
-PKG_SOURCE_DATE:=2017-01-11
-PKG_SOURCE_VERSION:=ab432c60437931a165f0aff1a6e3371f358b75dd
-PKG_MIRROR_HASH:=e3188ecd4d7470d3cdde89fefa6258f9ec4f404b23558d1474e5014679b28101
+PKG_SOURCE_DATE:=2017-03-29
+PKG_SOURCE_VERSION:=956e2609b7e42c8c710bba10ef925a5be1be5137
+PKG_MIRROR_HASH:=25f724ff38c830281b3efba4a4ddffaae0c4bd8fea0f4c1061591229ff05535b
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git

View File

@ -1,53 +0,0 @@
From: John Crispin <john@phrozen.org>
Date: Mon, 8 May 2017 08:51:46 +0200
Subject: ath10k-firmware: add qca9888 firmware
the firmware files for qca9888 were previously not packaged. add the meta
information for doing so.
Signed-off-by: John Crispin <john@phrozen.org>
diff --git a/package/firmware/ath10k-firmware/Makefile b/package/firmware/ath10k-firmware/Makefile
index 81dce0eb7aeee20e2ed3be4cc6699bf867487a96..aac8ee2b271678b03f58a6cb68beae6d53467dc1 100644
--- a/package/firmware/ath10k-firmware/Makefile
+++ b/package/firmware/ath10k-firmware/Makefile
@@ -32,6 +32,11 @@ $(Package/ath10k-firmware-default)
TITLE:=ath10k firmware for QCA9887 devices
endef
+define Package/ath10k-firmware-qca9888
+$(Package/ath10k-firmware-default)
+ TITLE:=ath10k firmware for QCA9888 devices
+endef
+
define Package/ath10k-firmware-qca9887-ct
$(Package/ath10k-firmware-default)
TITLE:=ath10k-CT firmware for QCA9887 devices
@@ -240,6 +245,19 @@ define Package/ath10k-firmware-qca9887/install
$(1)/lib/firmware/ath10k/QCA9887/hw1.0/board.bin
endef
+define Package/ath10k-firmware-qca9888/install
+ $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9888/hw2.0
+ $(INSTALL_DATA) \
+ $(PKG_BUILD_DIR)/QCA9888/hw2.0/board-2.bin \
+ $(1)/lib/firmware/ath10k/QCA9888/hw2.0/board-2.bin
+ $(INSTALL_DATA) \
+ $(PKG_BUILD_DIR)/QCA9888/hw2.0/board-2.bin \
+ $(1)/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
+ $(INSTALL_DATA) \
+ $(PKG_BUILD_DIR)/QCA9888/hw2.0/firmware-5.bin_10.4-3.2-00072 \
+ $(1)/lib/firmware/ath10k/QCA9888/hw2.0/firmware-5.bin
+endef
+
define Package/ath10k-firmware-qca988x/install
$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0
$(INSTALL_DATA) \
@@ -328,6 +346,7 @@ define Package/ath10k-firmware-qca9984-ct/install
endef
$(eval $(call BuildPackage,ath10k-firmware-qca9887))
+$(eval $(call BuildPackage,ath10k-firmware-qca9888))
$(eval $(call BuildPackage,ath10k-firmware-qca988x))
$(eval $(call BuildPackage,ath10k-firmware-qca99x0))
$(eval $(call BuildPackage,ath10k-firmware-qca6174))

View File

@ -1,20 +0,0 @@
From: Henryk Heisig <hyniu@o2.pl>
Date: Thu, 29 Jun 2017 15:38:22 +0200
Subject: ar71xx: fix board.bin used by QCA9886 in Archer C58/C59/C60
Signed-off-by: Henryk Heisig <hyniu@o2.pl>
(cherry picked from commit e917e51bf91fc7cb5085bda5e67d62520801f9cc)
diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 538c86e4743109f7665096da32620d7862248aea..cfdc20455d61c3900473f57c3267b1a3fd10e150 100644
--- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -138,6 +138,8 @@ case "$FIRMWARE" in
case $board in
archer-c58-v1)
ath10kcal_extract "art" 20480 12064
+ ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
+ /lib/firmware/ath10k/QCA9888/hw2.0/board.bin
;;
esac
;;

View File

@ -1,71 +0,0 @@
From: Henryk Heisig <hyniu@o2.pl>
Date: Thu, 29 Jun 2017 15:20:31 +0200
Subject: ar71xx: Archer C58/C59/C60 fix qca9886 wireless interface
This commit fix 5GHz wireless interface used in Archer C58/C59/C60v1
and set correctly MAC address on this interface.
Signed-off-by: Henryk Heisig <hyniu@o2.pl>
(cherry picked from commit 34958c826915cf864833ed8ba6e5b49d44c6cb41)
diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index cfdc20455d61c3900473f57c3267b1a3fd10e150..91bdf0d3c591516f58030b165052b3dd2751314f 100644
--- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -136,7 +136,9 @@ case "$FIRMWARE" in
;;
"ath10k/pre-cal-pci-0000:00:00.0.bin")
case $board in
- archer-c58-v1)
+ archer-c58-v1|\
+ archer-c59-v1|\
+ archer-c60-v1)
ath10kcal_extract "art" 20480 12064
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ar71xx/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
index 7d2eca546d76b771b12026788510f73a293a9a93..669b208231e43fe86e998c7202c133c86ae0bf8d 100644
--- a/target/linux/ar71xx/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
+++ b/target/linux/ar71xx/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
@@ -12,7 +12,9 @@ PHYNBR=${DEVPATH##*/phy}
board=$(ar71xx_board_name)
case "$board" in
- archer-c58-v1)
+ archer-c58-v1|\
+ archer-c59-v1|\
+ archer-c60-v1)
echo $(macaddr_add $(mtd_get_mac_binary mac 8) $(($PHYNBR - 1)) ) > /sys${DEVPATH}/macaddress
;;
*)
diff --git a/target/linux/ar71xx/image/tp-link.mk b/target/linux/ar71xx/image/tp-link.mk
index 557bcdab2237a03957313cc3cda471a9fe3a3706..ed45866fcbe8d35af663799a91b09b5c8fd613bc 100644
--- a/target/linux/ar71xx/image/tp-link.mk
+++ b/target/linux/ar71xx/image/tp-link.mk
@@ -121,7 +121,7 @@ TARGET_DEVICES += archer-c25-v1
define Device/archer-c58-v1
DEVICE_TITLE := TP-LINK Archer C58 v1
- DEVICE_PACKAGES := kmod-ath10k
+ DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca9888
BOARDNAME := ARCHER-C58-V1
TPLINK_BOARD_NAME := ARCHER-C58-V1
DEVICE_PROFILE := ARCHERC58V1
@@ -136,7 +136,7 @@ TARGET_DEVICES += archer-c58-v1
define Device/archer-c59-v1
DEVICE_TITLE := TP-LINK Archer C59 v1
- DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport kmod-ath10k
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport kmod-ath10k ath10k-firmware-qca9888
BOARDNAME := ARCHER-C59-V1
TPLINK_BOARD_NAME := ARCHER-C59-V1
DEVICE_PROFILE := ARCHERC59V1
@@ -151,7 +151,7 @@ TARGET_DEVICES += archer-c59-v1
define Device/archer-c60-v1
DEVICE_TITLE := TP-LINK Archer C60 v1
- DEVICE_PACKAGES := kmod-ath10k
+ DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca9888
BOARDNAME := ARCHER-C60-V1
TPLINK_BOARD_NAME := ARCHER-C60-V1
DEVICE_PROFILE := ARCHERC60V1

View File

@ -1,20 +0,0 @@
From: Henryk Heisig <hyniu@o2.pl>
Date: Mon, 3 Jul 2017 23:59:54 +0200
Subject: ath10k-firmware: qca9888 firmware: remove board.bin
Signed-off-by: Henryk Heisig <hyniu@o2.pl>
diff --git a/package/firmware/ath10k-firmware/Makefile b/package/firmware/ath10k-firmware/Makefile
index aac8ee2b271678b03f58a6cb68beae6d53467dc1..e8cc4b91c3f59f09e4281c7b36048dc66bd04f3b 100644
--- a/package/firmware/ath10k-firmware/Makefile
+++ b/package/firmware/ath10k-firmware/Makefile
@@ -250,9 +250,6 @@ define Package/ath10k-firmware-qca9888/install
$(INSTALL_DATA) \
$(PKG_BUILD_DIR)/QCA9888/hw2.0/board-2.bin \
$(1)/lib/firmware/ath10k/QCA9888/hw2.0/board-2.bin
- $(INSTALL_DATA) \
- $(PKG_BUILD_DIR)/QCA9888/hw2.0/board-2.bin \
- $(1)/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
$(INSTALL_DATA) \
$(PKG_BUILD_DIR)/QCA9888/hw2.0/firmware-5.bin_10.4-3.2-00072 \
$(1)/lib/firmware/ath10k/QCA9888/hw2.0/firmware-5.bin

View File

@ -1,22 +0,0 @@
From: David Bauer <mail@david-bauer.net>
Date: Mon, 27 Nov 2017 04:19:38 +0100
Subject: ar71xx: C58/C59 fix LAN1 working incorrectly
This commit fixes LAN Port 1 not transferring data in case no
other LAN Port has active link-state on TP-Link Archer C58/C59.
Signed-off-by: David Bauer <mail@david-bauer.net>
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c59-v1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c59-v1.c
index f385d4a5a3148b83ee01007145e0eda2c0ef670f..129aa53f304dd1a118ace9a2749855cb36f66cfc 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c59-v1.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c59-v1.c
@@ -249,7 +249,7 @@ static void __init archer_c5x_v1_setup(void)
ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
ath79_eth1_data.speed = SPEED_1000;
ath79_eth1_data.duplex = DUPLEX_FULL;
- ath79_switch_data.phy_poll_mask |= BIT(4);
+ ath79_switch_data.phy_poll_mask |= BIT(0);
ath79_switch_data.phy4_mii_en = 1;
ath79_register_eth(1);

View File

@ -1,17 +0,0 @@
From: David Bauer <mail@david-bauer.net>
Date: Thu, 11 Jan 2018 21:23:30 +0100
Subject: ar71xx: omit VLAN from Archer C58/C59 LAN interface
diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network b/target/linux/ar71xx/base-files/etc/board.d/02_network
index 57bc912aa5ede22a3fad4af6a1deb00c33f17cf8..1690172b5dfac1e1aa278c38c27ba64cfd61ade0 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -208,7 +208,7 @@ ar71xx_setup_interfaces()
archer-c58-v1|\
archer-c59-v1|\
rb-450g)
- ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
+ ucidef_set_interfaces_lan_wan "eth1" "eth0"
ucidef_add_switch "switch0" \
"0@eth1" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
;;

View File

@ -1,64 +0,0 @@
From: Henryk Heisig <hyniu@o2.pl>
Date: Fri, 27 Oct 2017 00:23:17 +0200
Subject: ar71xx: increase kernel partition size for some TP-Link boards
This patch increases kernel partition size and re-enables image
generation for below TP-Link boards:
- archer-c58-v1
- archer-c60-v1
- tl-wr902ac-v1
- tl-wr942n-v1
Signed-off-by: Henryk Heisig <hyniu@o2.pl>
[commit message and title reworded]
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
diff --git a/target/linux/ar71xx/image/tp-link.mk b/target/linux/ar71xx/image/tp-link.mk
index ed45866fcbe8d35af663799a91b09b5c8fd613bc..be7e846c88f9ebbb8a4e4840e690d7864386bf64 100644
--- a/target/linux/ar71xx/image/tp-link.mk
+++ b/target/linux/ar71xx/image/tp-link.mk
@@ -130,7 +130,7 @@ define Device/archer-c58-v1
IMAGES := sysupgrade.bin factory.bin
IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade
IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
- MTDPARTS := spi0.0:64k(u-boot)ro,64k(mac)ro,1344k(kernel),6592k(rootfs),64k(tplink)ro,64k(art)ro,7936k@0x20000(firmware)
+ MTDPARTS := spi0.0:64k(u-boot)ro,64k(mac)ro,7936k(firmware),64k(tplink)ro,64k(art)ro
endef
TARGET_DEVICES += archer-c58-v1
@@ -160,7 +160,7 @@ define Device/archer-c60-v1
IMAGES := sysupgrade.bin factory.bin
IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade
IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
- MTDPARTS := spi0.0:64k(u-boot)ro,64k(mac)ro,1344k(kernel),6592k(rootfs),64k(tplink)ro,64k(art)ro,7936k@0x20000(firmware)
+ MTDPARTS := spi0.0:64k(u-boot)ro,64k(mac)ro,7936k(firmware),64k(tplink)ro,64k(art)ro
endef
TARGET_DEVICES += archer-c60-v1
diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c
index 67e2c4475bbd468bd20915767a481711ae872a3a..11ff2e56e19ec3780f988baf7257810530165b23 100644
--- a/tools/firmware-utils/src/tplink-safeloader.c
+++ b/tools/firmware-utils/src/tplink-safeloader.c
@@ -400,8 +400,8 @@ static struct device_info boards[] = {
{"profile", 0x11700, 0x03900},
{"default-config", 0x15000, 0x04000},
{"user-config", 0x19000, 0x04000},
- {"os-image", 0x20000, 0x150000},
- {"file-system", 0x170000, 0x678000},
+ {"os-image", 0x20000, 0x180000},
+ {"file-system", 0x1a0000, 0x648000},
{"certyficate", 0x7e8000, 0x08000},
{"radio", 0x7f0000, 0x10000},
{NULL, 0, 0}
@@ -473,8 +473,8 @@ static struct device_info boards[] = {
{"profile", 0x11700, 0x03900},
{"default-config", 0x15000, 0x04000},
{"user-config", 0x19000, 0x04000},
- {"os-image", 0x20000, 0x150000},
- {"file-system", 0x170000, 0x678000},
+ {"os-image", 0x20000, 0x180000},
+ {"file-system", 0x1a0000, 0x648000},
{"certyficate", 0x7e8000, 0x08000},
{"radio", 0x7f0000, 0x10000},
{NULL, 0, 0}

View File

@ -1,130 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Wed, 24 Jan 2018 21:34:54 +0100
Subject: ar71xx: add unaligned access hacks for VXLAN
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/target/linux/ar71xx/patches-4.4/910-unaligned_access_hacks.patch b/target/linux/ar71xx/patches-4.4/910-unaligned_access_hacks.patch
index 374f9be3b4b76984842d3673ea78b70aadc9476a..3b6ed31556cbd1fa81bb6b616fc78e19b56099c4 100644
--- a/target/linux/ar71xx/patches-4.4/910-unaligned_access_hacks.patch
+++ b/target/linux/ar71xx/patches-4.4/910-unaligned_access_hacks.patch
@@ -929,3 +929,119 @@
};
if (skb->ip_summed != CHECKSUM_PARTIAL) {
*sum = csum_fold(csum_partial(diff, sizeof(diff),
+--- a/drivers/net/vxlan.c
++++ b/drivers/net/vxlan.c
+@@ -1759,8 +1759,8 @@ static int vxlan6_xmit_skb(struct dst_en
+ }
+
+ vxh = (struct vxlanhdr *) __skb_push(skb, sizeof(*vxh));
+- vxh->vx_flags = htonl(VXLAN_HF_VNI);
+- vxh->vx_vni = vni;
++ net_hdr_word(&vxh->vx_flags) = htonl(VXLAN_HF_VNI);
++ net_hdr_word(&vxh->vx_vni) = vni;
+
+ if (type & SKB_GSO_TUNNEL_REMCSUM) {
+ u32 data = (skb_checksum_start_offset(skb) - hdrlen) >>
+@@ -1769,8 +1769,8 @@ static int vxlan6_xmit_skb(struct dst_en
+ if (skb->csum_offset == offsetof(struct udphdr, check))
+ data |= VXLAN_RCO_UDP;
+
+- vxh->vx_vni |= htonl(data);
+- vxh->vx_flags |= htonl(VXLAN_HF_RCO);
++ net_hdr_word(&vxh->vx_vni) |= htonl(data);
++ net_hdr_word(&vxh->vx_flags) |= htonl(VXLAN_HF_RCO);
+
+ if (!skb_is_gso(skb)) {
+ skb->ip_summed = CHECKSUM_NONE;
+@@ -1838,8 +1838,8 @@ static int vxlan_xmit_skb(struct rtable
+ return PTR_ERR(skb);
+
+ vxh = (struct vxlanhdr *) __skb_push(skb, sizeof(*vxh));
+- vxh->vx_flags = htonl(VXLAN_HF_VNI);
+- vxh->vx_vni = vni;
++ net_hdr_word(&vxh->vx_flags) = htonl(VXLAN_HF_VNI);
++ net_hdr_word(&vxh->vx_vni) = vni;
+
+ if (type & SKB_GSO_TUNNEL_REMCSUM) {
+ u32 data = (skb_checksum_start_offset(skb) - hdrlen) >>
+@@ -1848,8 +1848,8 @@ static int vxlan_xmit_skb(struct rtable
+ if (skb->csum_offset == offsetof(struct udphdr, check))
+ data |= VXLAN_RCO_UDP;
+
+- vxh->vx_vni |= htonl(data);
+- vxh->vx_flags |= htonl(VXLAN_HF_RCO);
++ net_hdr_word(&vxh->vx_vni) |= htonl(data);
++ net_hdr_word(&vxh->vx_flags) |= htonl(VXLAN_HF_RCO);
+
+ if (!skb_is_gso(skb)) {
+ skb->ip_summed = CHECKSUM_NONE;
+--- a/include/linux/etherdevice.h
++++ b/include/linux/etherdevice.h
+@@ -409,7 +409,7 @@ static inline bool is_etherdev_addr(cons
+ * @b: Pointer to Ethernet header
+ *
+ * Compare two Ethernet headers, returns 0 if equal.
+- * This assumes that the network header (i.e., IP header) is 4-byte
++ * This assumes that the network header (i.e., IP header) is 2-byte
+ * aligned OR the platform can handle unaligned access. This is the
+ * case for all packets coming into netif_receive_skb or similar
+ * entry points.
+@@ -432,11 +432,12 @@ static inline unsigned long compare_ethe
+ fold |= *(unsigned long *)(a + 6) ^ *(unsigned long *)(b + 6);
+ return fold;
+ #else
+- u32 *a32 = (u32 *)((u8 *)a + 2);
+- u32 *b32 = (u32 *)((u8 *)b + 2);
++ const u16 *a16 = a;
++ const u16 *b16 = b;
+
+- return (*(u16 *)a ^ *(u16 *)b) | (a32[0] ^ b32[0]) |
+- (a32[1] ^ b32[1]) | (a32[2] ^ b32[2]);
++ return (a16[0] ^ b16[0]) | (a16[1] ^ b16[1]) | (a16[2] ^ b16[2]) |
++ (a16[3] ^ b16[3]) | (a16[4] ^ b16[4]) | (a16[5] ^ b16[5]) |
++ (a16[6] ^ b16[6]);
+ #endif
+ }
+
+--- a/net/ipv4/tcp_offload.c
++++ b/net/ipv4/tcp_offload.c
+@@ -221,7 +221,7 @@ struct sk_buff **tcp_gro_receive(struct
+
+ th2 = tcp_hdr(p);
+
+- if (*(u32 *)&th->source ^ *(u32 *)&th2->source) {
++ if (net_hdr_word(&th->source) ^ net_hdr_word(&th2->source)) {
+ NAPI_GRO_CB(p)->same_flow = 0;
+ continue;
+ }
+@@ -239,8 +239,8 @@ found:
+ ~(TCP_FLAG_CWR | TCP_FLAG_FIN | TCP_FLAG_PSH));
+ flush |= (__force int)(th->ack_seq ^ th2->ack_seq);
+ for (i = sizeof(*th); i < thlen; i += 4)
+- flush |= *(u32 *)((u8 *)th + i) ^
+- *(u32 *)((u8 *)th2 + i);
++ flush |= net_hdr_word((u8 *)th + i) ^
++ net_hdr_word((u8 *)th2 + i);
+
+ mss = skb_shinfo(p)->gso_size;
+
+--- a/net/ipv6/netfilter/ip6table_mangle.c
++++ b/net/ipv6/netfilter/ip6table_mangle.c
+@@ -55,7 +55,7 @@ ip6t_mangle_out(struct sk_buff *skb, con
+ hop_limit = ipv6_hdr(skb)->hop_limit;
+
+ /* flowlabel and prio (includes version, which shouldn't change either */
+- flowlabel = *((u_int32_t *)ipv6_hdr(skb));
++ flowlabel = net_hdr_word(ipv6_hdr(skb));
+
+ ret = ip6t_do_table(skb, state, state->net->ipv6.ip6table_mangle);
+
+@@ -64,7 +64,7 @@ ip6t_mangle_out(struct sk_buff *skb, con
+ !ipv6_addr_equal(&ipv6_hdr(skb)->daddr, &daddr) ||
+ skb->mark != mark ||
+ ipv6_hdr(skb)->hop_limit != hop_limit ||
+- flowlabel != *((u_int32_t *)ipv6_hdr(skb)))) {
++ flowlabel != net_hdr_word(ipv6_hdr(skb)))) {
+ err = ip6_route_me_harder(state->net, skb);
+ if (err < 0)
+ ret = NF_DROP_ERR(err);

View File

@ -1,75 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Wed, 24 Jan 2018 20:53:32 +0100
Subject: netifd: system-linux: VXLAN: add options to enable and disable UDP checksums
diff --git a/package/network/config/netifd/patches/0002-system-linux-VXLAN-add-options-to-enable-and-disable.patch b/package/network/config/netifd/patches/0002-system-linux-VXLAN-add-options-to-enable-and-disable.patch
new file mode 100644
index 0000000000000000000000000000000000000000..67a8bb864be37fa97dfcce4dd841bacafefcd0fc
--- /dev/null
+++ b/package/network/config/netifd/patches/0002-system-linux-VXLAN-add-options-to-enable-and-disable.patch
@@ -0,0 +1,65 @@
+From af3cadb6a46ba93e8a729e71d82b176275931e62 Mon Sep 17 00:00:00 2001
+Message-Id: <af3cadb6a46ba93e8a729e71d82b176275931e62.1516821520.git.mschiffer@universe-factory.net>
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Wed, 24 Jan 2018 13:21:44 +0100
+Subject: [PATCH] system-linux: VXLAN: add options to enable and disable UDP
+ checksums
+
+Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
+---
+ system-linux.c | 11 +++++++++++
+ system.c | 2 ++
+ system.h | 2 ++
+ 3 files changed, 15 insertions(+)
+
+diff --git a/system-linux.c b/system-linux.c
+index 32d6ffc..0277886 100644
+--- a/system-linux.c
++++ b/system-linux.c
+@@ -2841,6 +2841,17 @@ static int system_add_vxlan(const char *name, const unsigned int link, struct bl
+ }
+ nla_put_u16(msg, IFLA_VXLAN_PORT, htons(port));
+
++ if ((cur = tb_data[VXLAN_DATA_ATTR_RXCSUM])) {
++ bool rxcsum = blobmsg_get_bool(cur);
++ nla_put_u8(msg, IFLA_VXLAN_UDP_ZERO_CSUM6_RX, !rxcsum);
++ }
++
++ if ((cur = tb_data[VXLAN_DATA_ATTR_TXCSUM])) {
++ bool txcsum = blobmsg_get_bool(cur);
++ nla_put_u8(msg, IFLA_VXLAN_UDP_CSUM, txcsum);
++ nla_put_u8(msg, IFLA_VXLAN_UDP_ZERO_CSUM6_TX, !txcsum);
++ }
++
+ if ((cur = tb[TUNNEL_ATTR_TOS])) {
+ char *str = blobmsg_get_string(cur);
+ unsigned tos = 1;
+diff --git a/system.c b/system.c
+index 5555272..e236e96 100644
+--- a/system.c
++++ b/system.c
+@@ -36,6 +36,8 @@ static const struct blobmsg_policy vxlan_data_attrs[__VXLAN_DATA_ATTR_MAX] = {
+ [VXLAN_DATA_ATTR_ID] = { .name = "id", .type = BLOBMSG_TYPE_INT32 },
+ [VXLAN_DATA_ATTR_PORT] = { .name = "port", .type = BLOBMSG_TYPE_INT32 },
+ [VXLAN_DATA_ATTR_MACADDR] = { .name = "macaddr", .type = BLOBMSG_TYPE_STRING },
++ [VXLAN_DATA_ATTR_RXCSUM] = { .name = "rxcsum", .type = BLOBMSG_TYPE_BOOL },
++ [VXLAN_DATA_ATTR_TXCSUM] = { .name = "txcsum", .type = BLOBMSG_TYPE_BOOL },
+ };
+
+ const struct uci_blob_param_list vxlan_data_attr_list = {
+diff --git a/system.h b/system.h
+index 61c72c2..371a524 100644
+--- a/system.h
++++ b/system.h
+@@ -41,6 +41,8 @@ enum vxlan_data {
+ VXLAN_DATA_ATTR_ID,
+ VXLAN_DATA_ATTR_PORT,
+ VXLAN_DATA_ATTR_MACADDR,
++ VXLAN_DATA_ATTR_RXCSUM,
++ VXLAN_DATA_ATTR_TXCSUM,
+ __VXLAN_DATA_ATTR_MAX
+ };
+
+--
+2.16.1
+

View File

@ -1,43 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Wed, 24 Jan 2018 13:51:45 +0100
Subject: vxlan: add options to enable and disable UDP checksums
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/package/network/config/vxlan/Makefile b/package/network/config/vxlan/Makefile
index a471d4e90cbe30c1d1dd01dbf7553995d8c0485e..aeceb9cd884e517b2f274925637b62a538bfa70e 100644
--- a/package/network/config/vxlan/Makefile
+++ b/package/network/config/vxlan/Makefile
@@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=vxlan
-PKG_VERSION:=1
+PKG_VERSION:=2
PKG_LICENSE:=GPL-2.0
include $(INCLUDE_DIR)/package.mk
diff --git a/package/network/config/vxlan/files/vxlan.sh b/package/network/config/vxlan/files/vxlan.sh
index 27ccd8f12759f69c7c226cac0c923335b8ccc6a8..d055d41edc59f50c0c132849bbcd0235edeef5b9 100755
--- a/package/network/config/vxlan/files/vxlan.sh
+++ b/package/network/config/vxlan/files/vxlan.sh
@@ -15,8 +15,8 @@ vxlan_generic_setup() {
local link="$cfg"
- local port vid ttl tos mtu macaddr zone
- json_get_vars port vid ttl tos mtu macaddr zone
+ local port vid ttl tos mtu macaddr zone rxcsum txcsum
+ json_get_vars port vid ttl tos mtu macaddr zone rxcsum txcsum
proto_init_update "$link" 1
@@ -36,6 +36,8 @@ vxlan_generic_setup() {
[ -n "$port" ] && json_add_int port "$port"
[ -n "$vid" ] && json_add_int id "$vid"
[ -n "$macaddr" ] && json_add_string macaddr "$macaddr"
+ [ -n "$rxcsum" ] && json_add_boolean rxcsum "$rxcsum"
+ [ -n "$txcsum" ] && json_add_boolean txcsum "$txcsum"
json_close_object
proto_close_tunnel

View File

@ -1,456 +0,0 @@
From: Vincent Wiemann <me@bibbl.com>
Date: Sat, 6 Jan 2018 04:33:09 +0100
Subject: ramips: mtd: spi-nor: add support for switching between 3-byte and 4-byte addressing on w25q256 flash
CAUTION! NEEDS TESTING!
Tries to backport switching between 3-byte and 4-byte addressing on w25q256 flash from Lede master (62ede4f78389c313a8004e79330a7d055eda2f7d) by Felix Fietkau.
Applied patches:
mtd: spi-nor: rename SPINOR_OP_* macros of the 4-byte address op codes
mtd: spi-nor: add a stateless method to support memory size above 128Mib
mtd: spi-nor: add w25q256 3b-mode-switch
mtd: add chunked read-io to m25p80
On some devices the flash chip needs to be in 3-byte addressing mode during
reboot, otherwise the boot loader will fail to start.
This mode however does not allow regular reads/writes onto the upper 16M
half. W25Q256 has separate read commands for reading from >16M, however
it does not have any separate write commands.
This patch changes the code to leave the chip in 3-byte mode most of the
time and only switch during erase/write cycles that go to >16M
addresses.
Signed-off-by: Vincent Wiemann (me@bibbl.com)
diff --git a/target/linux/ramips/patches-4.4/400-mtd-spi-nor-add-w25q256-3b-mode-switch.patch b/target/linux/ramips/patches-4.4/400-mtd-spi-nor-add-w25q256-3b-mode-switch.patch
new file mode 100644
index 0000000000000000000000000000000000000000..5399f547e4edd0eb1cfee8c1ec5b35e69c692ee9
--- /dev/null
+++ b/target/linux/ramips/patches-4.4/400-mtd-spi-nor-add-w25q256-3b-mode-switch.patch
@@ -0,0 +1,399 @@
+--- a/drivers/mtd/devices/serial_flash_cmds.h
++++ b/drivers/mtd/devices/serial_flash_cmds.h
+@@ -18,19 +18,12 @@
+ #define SPINOR_OP_RDVCR 0x85
+
+ /* JEDEC Standard - Serial Flash Discoverable Parmeters (SFDP) Commands */
+-#define SPINOR_OP_READ_1_2_2 0xbb /* DUAL I/O READ */
+-#define SPINOR_OP_READ_1_4_4 0xeb /* QUAD I/O READ */
+-
+ #define SPINOR_OP_WRITE 0x02 /* PAGE PROGRAM */
+ #define SPINOR_OP_WRITE_1_1_2 0xa2 /* DUAL INPUT PROGRAM */
+ #define SPINOR_OP_WRITE_1_2_2 0xd2 /* DUAL INPUT EXT PROGRAM */
+ #define SPINOR_OP_WRITE_1_1_4 0x32 /* QUAD INPUT PROGRAM */
+ #define SPINOR_OP_WRITE_1_4_4 0x12 /* QUAD INPUT EXT PROGRAM */
+
+-/* READ commands with 32-bit addressing */
+-#define SPINOR_OP_READ4_1_2_2 0xbc
+-#define SPINOR_OP_READ4_1_4_4 0xec
+-
+ /* Configuration flags */
+ #define FLASH_FLAG_SINGLE 0x000000ff
+ #define FLASH_FLAG_READ_WRITE 0x00000001
+--- a/drivers/mtd/devices/st_spi_fsm.c
++++ b/drivers/mtd/devices/st_spi_fsm.c
+@@ -507,13 +507,13 @@ static struct seq_rw_config n25q_read3_c
+ * - 'FAST' variants configured for 8 dummy cycles (see note above.)
+ */
+ static struct seq_rw_config n25q_read4_configs[] = {
+- {FLASH_FLAG_READ_1_4_4, SPINOR_OP_READ4_1_4_4, 0, 4, 4, 0x00, 0, 8},
+- {FLASH_FLAG_READ_1_1_4, SPINOR_OP_READ4_1_1_4, 0, 1, 4, 0x00, 0, 8},
+- {FLASH_FLAG_READ_1_2_2, SPINOR_OP_READ4_1_2_2, 0, 2, 2, 0x00, 0, 8},
+- {FLASH_FLAG_READ_1_1_2, SPINOR_OP_READ4_1_1_2, 0, 1, 2, 0x00, 0, 8},
+- {FLASH_FLAG_READ_FAST, SPINOR_OP_READ4_FAST, 0, 1, 1, 0x00, 0, 8},
+- {FLASH_FLAG_READ_WRITE, SPINOR_OP_READ4, 0, 1, 1, 0x00, 0, 0},
+- {0x00, 0, 0, 0, 0, 0x00, 0, 0},
++ {FLASH_FLAG_READ_1_4_4, SPINOR_OP_READ_1_4_4_4B, 0, 4, 4, 0x00, 0, 8},
++ {FLASH_FLAG_READ_1_1_4, SPINOR_OP_READ_1_1_4_4B, 0, 1, 4, 0x00, 0, 8},
++ {FLASH_FLAG_READ_1_2_2, SPINOR_OP_READ_1_2_2_4B, 0, 2, 2, 0x00, 0, 8},
++ {FLASH_FLAG_READ_1_1_2, SPINOR_OP_READ_1_1_2_4B, 0, 1, 2, 0x00, 0, 8},
++ {FLASH_FLAG_READ_FAST, SPINOR_OP_READ_FAST_4B, 0, 1, 1, 0x00, 0, 8},
++ {FLASH_FLAG_READ_WRITE, SPINOR_OP_READ_4B, 0, 1, 1, 0x00, 0, 0},
++ {0x00, 0, 0, 0, 0, 0x00, 0, 0},
+ };
+
+ /*
+@@ -553,13 +553,13 @@ static int stfsm_mx25_en_32bit_addr_seq(
+ * entering a state that is incompatible with the SPIBoot Controller.
+ */
+ static struct seq_rw_config stfsm_s25fl_read4_configs[] = {
+- {FLASH_FLAG_READ_1_4_4, SPINOR_OP_READ4_1_4_4, 0, 4, 4, 0x00, 2, 4},
+- {FLASH_FLAG_READ_1_1_4, SPINOR_OP_READ4_1_1_4, 0, 1, 4, 0x00, 0, 8},
+- {FLASH_FLAG_READ_1_2_2, SPINOR_OP_READ4_1_2_2, 0, 2, 2, 0x00, 4, 0},
+- {FLASH_FLAG_READ_1_1_2, SPINOR_OP_READ4_1_1_2, 0, 1, 2, 0x00, 0, 8},
+- {FLASH_FLAG_READ_FAST, SPINOR_OP_READ4_FAST, 0, 1, 1, 0x00, 0, 8},
+- {FLASH_FLAG_READ_WRITE, SPINOR_OP_READ4, 0, 1, 1, 0x00, 0, 0},
+- {0x00, 0, 0, 0, 0, 0x00, 0, 0},
++ {FLASH_FLAG_READ_1_4_4, SPINOR_OP_READ_1_4_4_4B, 0, 4, 4, 0x00, 2, 4},
++ {FLASH_FLAG_READ_1_1_4, SPINOR_OP_READ_1_1_4_4B, 0, 1, 4, 0x00, 0, 8},
++ {FLASH_FLAG_READ_1_2_2, SPINOR_OP_READ_1_2_2_4B, 0, 2, 2, 0x00, 4, 0},
++ {FLASH_FLAG_READ_1_1_2, SPINOR_OP_READ_1_1_2_4B, 0, 1, 2, 0x00, 0, 8},
++ {FLASH_FLAG_READ_FAST, SPINOR_OP_READ_FAST_4B, 0, 1, 1, 0x00, 0, 8},
++ {FLASH_FLAG_READ_WRITE, SPINOR_OP_READ_4B, 0, 1, 1, 0x00, 0, 0},
++ {0x00, 0, 0, 0, 0, 0x00, 0, 0},
+ };
+
+ static struct seq_rw_config stfsm_s25fl_write4_configs[] = {
+--- a/drivers/mtd/spi-nor/spi-nor.c
++++ b/drivers/mtd/spi-nor/spi-nor.c
+@@ -69,6 +69,14 @@ struct flash_info {
+ #define SPI_NOR_QUAD_READ 0x40 /* Flash supports Quad Read */
+ #define USE_FSR 0x80 /* use flag status register */
+ #define SPI_NOR_HAS_LOCK 0x100 /* Flash supports lock/unlock via SR */
++#define SPI_NOR_4B_OPCODES 0x200 /*
++ * Use dedicated 4byte address op codes
++ * to support memory size above 128Mib.
++ */
++#define SPI_NOR_4B_READ_OP 0x400 /*
++ * Like SPI_NOR_4B_OPCODES, but for read
++ * op code only.
++ */
+ };
+
+ #define JEDEC_MFR(info) ((info)->id[0])
+@@ -182,6 +190,89 @@ static inline struct spi_nor *mtd_to_spi
+ return mtd->priv;
+ }
+
++
++static u8 spi_nor_convert_opcode(u8 opcode, const u8 table[][2], size_t size)
++{
++ size_t i;
++
++ for (i = 0; i < size; i++)
++ if (table[i][0] == opcode)
++ return table[i][1];
++
++ /* No conversion found, keep input op code. */
++ return opcode;
++}
++
++static inline u8 spi_nor_convert_3to4_read(u8 opcode)
++{
++ static const u8 spi_nor_3to4_read[][2] = {
++ { SPINOR_OP_READ, SPINOR_OP_READ_4B },
++ { SPINOR_OP_READ_FAST, SPINOR_OP_READ_FAST_4B },
++ { SPINOR_OP_READ_1_1_2, SPINOR_OP_READ_1_1_2_4B },
++ { SPINOR_OP_READ_1_2_2, SPINOR_OP_READ_1_2_2_4B },
++ { SPINOR_OP_READ_1_1_4, SPINOR_OP_READ_1_1_4_4B },
++ { SPINOR_OP_READ_1_4_4, SPINOR_OP_READ_1_4_4_4B },
++ };
++
++ return spi_nor_convert_opcode(opcode, spi_nor_3to4_read,
++ ARRAY_SIZE(spi_nor_3to4_read));
++}
++
++static inline u8 spi_nor_convert_3to4_program(u8 opcode)
++{
++ static const u8 spi_nor_3to4_program[][2] = {
++ { SPINOR_OP_PP, SPINOR_OP_PP_4B },
++ { SPINOR_OP_PP_1_1_4, SPINOR_OP_PP_1_1_4_4B },
++ { SPINOR_OP_PP_1_4_4, SPINOR_OP_PP_1_4_4_4B },
++ };
++
++ return spi_nor_convert_opcode(opcode, spi_nor_3to4_program,
++ ARRAY_SIZE(spi_nor_3to4_program));
++}
++
++static inline u8 spi_nor_convert_3to4_erase(u8 opcode)
++{
++ static const u8 spi_nor_3to4_erase[][2] = {
++ { SPINOR_OP_BE_4K, SPINOR_OP_BE_4K_4B },
++ { SPINOR_OP_BE_32K, SPINOR_OP_BE_32K_4B },
++ { SPINOR_OP_SE, SPINOR_OP_SE_4B },
++ };
++
++ return spi_nor_convert_opcode(opcode, spi_nor_3to4_erase,
++ ARRAY_SIZE(spi_nor_3to4_erase));
++}
++
++static void spi_nor_set_4byte_read(struct spi_nor *nor,
++ const struct flash_info *info)
++{
++ nor->addr_width = 3;
++ nor->ext_addr = 0;
++ nor->read_opcode = spi_nor_convert_3to4_read(nor->read_opcode);
++ nor->flags |= SNOR_F_4B_EXT_ADDR;
++}
++
++
++
++static void spi_nor_set_4byte_opcodes(struct spi_nor *nor,
++ const struct flash_info *info)
++{
++ /* Do some manufacturer fixups first */
++ switch (JEDEC_MFR(info)) {
++ case SNOR_MFR_SPANSION:
++ /* No small sector erase for 4-byte command set */
++ nor->erase_opcode = SPINOR_OP_SE;
++ nor->mtd.erasesize = info->sector_size;
++ break;
++
++ default:
++ break;
++ }
++
++ nor->read_opcode = spi_nor_convert_3to4_read(nor->read_opcode);
++ nor->program_opcode = spi_nor_convert_3to4_program(nor->program_opcode);
++ nor->erase_opcode = spi_nor_convert_3to4_erase(nor->erase_opcode);
++}
++
+ /* Enable/disable 4-byte addressing mode. */
+ static inline int set_4byte(struct spi_nor *nor, const struct flash_info *info,
+ int enable)
+@@ -313,6 +404,36 @@ static void spi_nor_unlock_and_unprep(st
+ mutex_unlock(&nor->lock);
+ }
+
++static int spi_nor_check_ext_addr(struct spi_nor *nor, u32 addr)
++{
++ bool ext_addr;
++ int ret;
++ u8 cmd;
++
++ if (!(nor->flags & SNOR_F_4B_EXT_ADDR))
++ return 0;
++
++ ext_addr = !!(addr & 0xff000000);
++ if (nor->ext_addr == ext_addr)
++ return 0;
++
++ cmd = ext_addr ? SPINOR_OP_EN4B : SPINOR_OP_EX4B;
++ write_enable(nor);
++ ret = nor->write_reg(nor, cmd, NULL, 0);
++ if (ret)
++ return ret;
++
++ cmd = 0;
++ ret = nor->write_reg(nor, SPINOR_OP_WREAR, &cmd, 1);
++ if (ret)
++ return ret;
++
++ nor->addr_width = 3 + ext_addr;
++ nor->ext_addr = ext_addr;
++ write_disable(nor);
++ return 0;
++}
++
+ /*
+ * Erase an address range on the nor chip. The address range may extend
+ * one or more erase sectors. Return an error is there is a problem erasing.
+@@ -338,6 +459,10 @@ static int spi_nor_erase(struct mtd_info
+ if (ret)
+ return ret;
+
++ ret = spi_nor_check_ext_addr(nor, addr + len);
++ if (ret)
++ return ret;
++
+ /* whole-chip erase? */
+ if (len == mtd->size) {
+ unsigned long timeout;
+@@ -396,6 +521,7 @@ static int spi_nor_erase(struct mtd_info
+ return ret;
+
+ erase_err:
++ spi_nor_check_ext_addr(nor, 0);
+ spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_ERASE);
+ instr->state = MTD_ERASE_FAILED;
+ return ret;
+@@ -585,7 +711,9 @@ static int spi_nor_lock(struct mtd_info
+ if (ret)
+ return ret;
+
++ spi_nor_check_ext_addr(nor, ofs + len);
+ ret = nor->flash_lock(nor, ofs, len);
++ spi_nor_check_ext_addr(nor, 0);
+
+ spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_UNLOCK);
+ return ret;
+@@ -600,7 +728,9 @@ static int spi_nor_unlock(struct mtd_inf
+ if (ret)
+ return ret;
+
++ spi_nor_check_ext_addr(nor, ofs + len);
+ ret = nor->flash_unlock(nor, ofs, len);
++ spi_nor_check_ext_addr(nor, 0);
+
+ spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_LOCK);
+ return ret;
+@@ -851,7 +981,7 @@ static const struct flash_info spi_nor_i
+ { "w25q80", INFO(0xef5014, 0, 64 * 1024, 16, SECT_4K) },
+ { "w25q80bl", INFO(0xef4014, 0, 64 * 1024, 16, SECT_4K) },
+ { "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, SECT_4K) },
+- { "w25q256", INFO(0xef4019, 0, 64 * 1024, 512, SECT_4K) },
++ { "w25q256", INFO(0xef4019, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_4B_READ_OP) },
+
+ /* Catalyst / On Semiconductor -- non-JEDEC */
+ { "cat25c11", CAT25_INFO( 16, 8, 16, 1, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) },
+@@ -898,8 +1028,23 @@ static int spi_nor_read(struct mtd_info
+ if (ret)
+ return ret;
+
++ if (nor->flags & SNOR_F_4B_EXT_ADDR)
++ nor->addr_width = 4;
++
+ ret = nor->read(nor, from, len, retlen, buf);
+
++ if (nor->flags & SNOR_F_4B_EXT_ADDR) {
++ u8 val = 0;
++
++ if ((from + len) & 0xff000000) {
++ write_enable(nor);
++ nor->write_reg(nor, SPINOR_OP_WREAR, &val, 1);
++ write_disable(nor);
++ }
++
++ nor->addr_width = 3;
++ }
++
+ spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_READ);
+ return ret;
+ }
+@@ -988,6 +1133,10 @@ static int spi_nor_write(struct mtd_info
+ if (ret)
+ return ret;
+
++ ret = spi_nor_check_ext_addr(nor, to + len);
++ if (ret < 0)
++ return ret;
++
+ write_enable(nor);
+
+ page_offset = to & (nor->page_size - 1);
+@@ -1018,6 +1167,7 @@ static int spi_nor_write(struct mtd_info
+
+ ret = spi_nor_wait_till_ready(nor);
+ write_err:
++ spi_nor_check_ext_addr(nor, 0);
+ spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_WRITE);
+ return ret;
+ }
+@@ -1366,27 +1516,12 @@ int spi_nor_scan(struct spi_nor *nor, co
+ else if (mtd->size > 0x1000000) {
+ /* enable 4-byte addressing if the device exceeds 16MiB */
+ nor->addr_width = 4;
+- if (JEDEC_MFR(info) == SNOR_MFR_SPANSION) {
+- /* Dedicated 4-byte command set */
+- switch (nor->flash_read) {
+- case SPI_NOR_QUAD:
+- nor->read_opcode = SPINOR_OP_READ4_1_1_4;
+- break;
+- case SPI_NOR_DUAL:
+- nor->read_opcode = SPINOR_OP_READ4_1_1_2;
+- break;
+- case SPI_NOR_FAST:
+- nor->read_opcode = SPINOR_OP_READ4_FAST;
+- break;
+- case SPI_NOR_NORMAL:
+- nor->read_opcode = SPINOR_OP_READ4;
+- break;
+- }
+- nor->program_opcode = SPINOR_OP_PP_4B;
+- /* No small sector erase for 4-byte command set */
+- nor->erase_opcode = SPINOR_OP_SE_4B;
+- mtd->erasesize = info->sector_size;
+- } else
++ if (info->flags & SPI_NOR_4B_READ_OP)
++ spi_nor_set_4byte_read(nor, info);
++ else if (JEDEC_MFR(info) == SNOR_MFR_SPANSION ||
++ info->flags & SPI_NOR_4B_OPCODES)
++ spi_nor_set_4byte_opcodes(nor, info);
++ else
+ set_4byte(nor, info, 1);
+ } else {
+ nor->addr_width = 3;
+--- a/include/linux/mtd/spi-nor.h
++++ b/include/linux/mtd/spi-nor.h
+@@ -42,9 +42,13 @@
+ #define SPINOR_OP_WRSR 0x01 /* Write status register 1 byte */
+ #define SPINOR_OP_READ 0x03 /* Read data bytes (low frequency) */
+ #define SPINOR_OP_READ_FAST 0x0b /* Read data bytes (high frequency) */
+-#define SPINOR_OP_READ_1_1_2 0x3b /* Read data bytes (Dual SPI) */
+-#define SPINOR_OP_READ_1_1_4 0x6b /* Read data bytes (Quad SPI) */
++#define SPINOR_OP_READ_1_1_2 0x3b /* Read data bytes (Dual Output SPI) */
++#define SPINOR_OP_READ_1_2_2 0xbb /* Read data bytes (Dual I/O SPI) */
++#define SPINOR_OP_READ_1_1_4 0x6b /* Read data bytes (Quad Output SPI) */
++#define SPINOR_OP_READ_1_4_4 0xeb /* Read data bytes (Quad I/O SPI) */
+ #define SPINOR_OP_PP 0x02 /* Page program (up to 256 bytes) */
++#define SPINOR_OP_PP_1_1_4 0x32 /* Quad page program */
++#define SPINOR_OP_PP_1_4_4 0x38 /* Quad page program */
+ #define SPINOR_OP_BE_4K 0x20 /* Erase 4KiB block */
+ #define SPINOR_OP_BE_4K_PMC 0xd7 /* Erase 4KiB block on PMC chips */
+ #define SPINOR_OP_BE_32K 0x52 /* Erase 32KiB block */
+@@ -55,11 +59,17 @@
+ #define SPINOR_OP_RDFSR 0x70 /* Read flag status register */
+
+ /* 4-byte address opcodes - used on Spansion and some Macronix flashes. */
+-#define SPINOR_OP_READ4 0x13 /* Read data bytes (low frequency) */
+-#define SPINOR_OP_READ4_FAST 0x0c /* Read data bytes (high frequency) */
+-#define SPINOR_OP_READ4_1_1_2 0x3c /* Read data bytes (Dual SPI) */
+-#define SPINOR_OP_READ4_1_1_4 0x6c /* Read data bytes (Quad SPI) */
++#define SPINOR_OP_READ_4B 0x13 /* Read data bytes (low frequency) */
++#define SPINOR_OP_READ_FAST_4B 0x0c /* Read data bytes (high frequency) */
++#define SPINOR_OP_READ_1_1_2_4B 0x3c /* Read data bytes (Dual Output SPI) */
++#define SPINOR_OP_READ_1_2_2_4B 0xbc /* Read data bytes (Dual I/O SPI) */
++#define SPINOR_OP_READ_1_1_4_4B 0x6c /* Read data bytes (Quad Output SPI) */
++#define SPINOR_OP_READ_1_4_4_4B 0xec /* Read data bytes (Quad I/O SPI) */
+ #define SPINOR_OP_PP_4B 0x12 /* Page program (up to 256 bytes) */
++#define SPINOR_OP_PP_1_1_4_4B 0x34 /* Quad page program */
++#define SPINOR_OP_PP_1_4_4_4B 0x3e /* Quad page program */
++#define SPINOR_OP_BE_4K_4B 0x21 /* Erase 4KiB block */
++#define SPINOR_OP_BE_32K_4B 0x5c /* Erase 32KiB block */
+ #define SPINOR_OP_SE_4B 0xdc /* Sector erase (usually 64KiB) */
+
+ /* Used for SST flashes only. */
+@@ -70,6 +80,7 @@
+ /* Used for Macronix and Winbond flashes. */
+ #define SPINOR_OP_EN4B 0xb7 /* Enter 4-byte mode */
+ #define SPINOR_OP_EX4B 0xe9 /* Exit 4-byte mode */
++#define SPINOR_OP_WREAR 0xc5 /* Write extended address register */
+
+ /* Used for Spansion flashes only. */
+ #define SPINOR_OP_BRWR 0x17 /* Bank register write */
+@@ -117,6 +128,7 @@ enum spi_nor_ops {
+ enum spi_nor_option_flags {
+ SNOR_F_USE_FSR = BIT(0),
+ SNOR_F_SST = BIT(1),
++ SNOR_F_4B_EXT_ADDR = BIT(5),
+ };
+
+ /**
+@@ -166,6 +178,7 @@ struct spi_nor {
+ enum read_mode flash_read;
+ bool sst_write_second;
+ u32 flags;
++ u8 ext_addr;
+ u8 cmd_buf[SPI_NOR_MAX_CMD_SIZE];
+
+ int (*prepare)(struct spi_nor *nor, enum spi_nor_ops ops);
diff --git a/target/linux/ramips/patches-4.4/401-mtd-add-chunked-read-io-to-m25p80.patch b/target/linux/ramips/patches-4.4/401-mtd-add-chunked-read-io-to-m25p80.patch
new file mode 100644
index 0000000000000000000000000000000000000000..b6111abad7063951c07688c66854fa743daeb6c6
--- /dev/null
+++ b/target/linux/ramips/patches-4.4/401-mtd-add-chunked-read-io-to-m25p80.patch
@@ -0,0 +1,21 @@
+--- a/drivers/mtd/spi-nor/spi-nor.c
++++ b/drivers/mtd/spi-nor/spi-nor.c
+@@ -1176,6 +1176,7 @@ static int spi_nor_chunked_write(struct
+ size_t *_retlen, const u_char *_buf)
+ {
+ struct spi_nor *nor = mtd_to_spi_nor(mtd);
++ u32 addr_width = nor->addr_width + !!(nor->flags & SNOR_F_4B_EXT_ADDR);
+ int chunk_size;
+ int retlen = 0;
+ int ret;
+@@ -1184,8 +1185,8 @@ static int spi_nor_chunked_write(struct
+ if (!chunk_size)
+ chunk_size = _len;
+
+- if (nor->addr_width > 3)
+- chunk_size -= nor->addr_width - 3;
++ if (addr_width > 3)
++ chunk_size -= addr_width - 3;
+
+ while (retlen < _len) {
+ size_t len = min_t(int, chunk_size, _len - retlen);

View File

@ -1,99 +0,0 @@
From: Mathias Kresin <dev@kresin.me>
Date: Fri, 7 Apr 2017 23:52:27 +0200
Subject: ramips: prepare ZBT-WG3526 for hardware variants
The ZBT-WG3526 is available with 16 or 32 MByte of flash. Rename the
current supported 16MByte version to indicate which flash size variant
is supported.
Signed-off-by: Mathias Kresin <dev@kresin.me>
Conflicts (Resolved):
target/linux/ramips/image/mt7621.mk
Signed-off-by: Vincent Wiemann <me@bibbl.com>
further adjustments for backport to lede-17.01 branch
Signed-off-by: Andreas Ziegler <github@andreas-ziegler.de>
diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
index b1091f66b2897a19bd01d4a26a1b3647656fa62b..8e27a79fc1744d6bed9db8d930207c418899cab1 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -637,8 +637,8 @@ ramips_board_detect() {
*"ZBT-WG2626")
name="zbt-wg2626"
;;
- *"ZBT-WG3526")
- name="zbt-wg3526"
+ *"ZBT-WG3526 (16M)")
+ name="zbt-wg3526-16M"
;;
*"ZBT-WR8305RT")
name="zbt-wr8305rt"
diff --git a/target/linux/ramips/dts/ZBT-WG3526-16M.dts b/target/linux/ramips/dts/ZBT-WG3526-16M.dts
new file mode 100644
index 0000000000000000000000000000000000000000..fb644502071d6641194c66baf552035937f35669
--- /dev/null
+++ b/target/linux/ramips/dts/ZBT-WG3526-16M.dts
@@ -0,0 +1,15 @@
+/dts-v1/;
+
+#include "ZBT-WG3526.dtsi"
+
+/ {
+ model = "ZBT-WG3526 (16M)";
+};
+
+&firmware {
+ reg = <0x50000 0xfb0000>;
+};
+
+&status_led {
+ label = "zbt-wg3526:green:status";
+};
diff --git a/target/linux/ramips/dts/ZBT-WG3526.dts b/target/linux/ramips/dts/ZBT-WG3526.dts
deleted file mode 100644
index c361bdd827bffdc24405b1a1b191403ebeec46d0..0000000000000000000000000000000000000000
--- a/target/linux/ramips/dts/ZBT-WG3526.dts
+++ /dev/null
@@ -1,15 +0,0 @@
-/dts-v1/;
-
-#include "ZBT-WG3526.dtsi"
-
-/ {
- model = "ZBT-WG3526";
-};
-
-&firmware {
- reg = <0x50000 0xfb0000>;
-};
-
-&status_led {
- label = "zbt-wg3526:green:status";
-};
diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index 8218bea84410536151a216cd2cc0300369ad977a..cabc86b28eb040f0d1e58d917e6edc4a97e80db7 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -226,13 +226,14 @@ define Device/zbt-wg2626
endef
TARGET_DEVICES += zbt-wg2626
-define Device/zbt-wg3526
- DTS := ZBT-WG3526
+define Device/zbt-wg3526-16M
+ DTS := ZBT-WG3526-16M
IMAGE_SIZE := $(ralink_default_fw_size_16M)
- DEVICE_TITLE := ZBT WG3526
+ SUPPORTED_DEVICES += zbt-wg3526
+ DEVICE_TITLE := ZBT WG3526 (16MB flash)
DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-ata-core kmod-ata-ahci
endef
-TARGET_DEVICES += zbt-wg3526
+TARGET_DEVICES += zbt-wg3526-16M
# FIXME: is this still needed?
define Image/Prepare

View File

@ -1,193 +0,0 @@
From: Mathias Kresin <dev@kresin.me>
Date: Sat, 1 Apr 2017 10:46:44 +0200
Subject: ramips: rename Digineo AC1200 Pro to ZBT-WG3526 32MB
The Digineo AC1200 Pro is the 32MB flash variant of the ZBT-WG3526 with
unpopulated/exposed sdhci slot. Rename to board to the OEM/ODM name and
add the sdhci kernel module to use it for multiple clones.
Signed-off-by: Mathias Kresin <dev@kresin.me>
Conflicts (Resolved):
target/linux/ramips/base-files/etc/diag.sh
Signed-off-by: Vincent Wiemann <me@bibbl.com>
further adjustments for backport to lede-17.01 branch
Signed-off-by: Andreas Ziegler <github@andreas-ziegler.de>
diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network
index 5a4042339c6761703578e014612062ac78babd9d..b9c8fe774fedab34267a8635033b9235d9d6c3aa 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -70,7 +70,6 @@ ramips_setup_interfaces()
ucidef_set_interface_lan "eth0.2"
;;
3g-6200n|\
- ac1200pro|\
ai-br100|\
d240|\
db-wrt01|\
diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh
index 9dbd6c4141d7facef2108cbb5cf3a7057522c88e..c4f521954c74635c61f42558f0d9b71f0f671c22 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -59,7 +59,10 @@ get_status_led() {
wn3000rpv3)
status_led="$board:red:power"
;;
- ac1200pro|\
+ ai-br100|\
+ ht-tm02)
+ status_led="$board:blue:wlan"
+ ;;
all0239-3g|\
dcs-930|\
dir-300-b1|\
@@ -85,10 +88,6 @@ get_status_led() {
zbt-wg3526)
status_led="$board:green:status"
;;
- ai-br100|\
- ht-tm02)
- status_led="$board:blue:wlan"
- ;;
atp-52b|\
ip2202)
status_led="$board:green:run"
diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
index 8e27a79fc1744d6bed9db8d930207c418899cab1..b9279a5a1e9baf55ca7f59dbb22ac0b0b7b01db4 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -130,9 +130,6 @@ ramips_board_detect() {
*"DCS-930L B1")
name="dcs-930l-b1"
;;
- *"Digineo AC1200 Pro")
- name="ac1200pro"
- ;;
*"DIR-300 B1")
name="dir-300-b1"
;;
@@ -640,6 +637,9 @@ ramips_board_detect() {
*"ZBT-WG3526 (16M)")
name="zbt-wg3526-16M"
;;
+ *"ZBT-WG3526 (32M)")
+ name="zbt-wg3526-32M"
+ ;;
*"ZBT-WR8305RT")
name="zbt-wr8305rt"
;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index d3efc2dd37ed855a1c0e966e448b67ae73324d5f..a45275077df8fa317c38adc8f0ab12fd4b0ecb83 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -17,7 +17,6 @@ platform_check_image() {
3g150b|\
3g300m|\
a5-v11|\
- ac1200pro|\
ai-br100|\
air3gii|\
all0239-3g|\
diff --git a/target/linux/ramips/dts/AC1200pro.dts b/target/linux/ramips/dts/AC1200pro.dts
deleted file mode 100644
index fbec81844025cf2a6544dec8dfeca02fce89fdc1..0000000000000000000000000000000000000000
--- a/target/linux/ramips/dts/AC1200pro.dts
+++ /dev/null
@@ -1,15 +0,0 @@
-/dts-v1/;
-
-#include "ZBT-WG3526.dtsi"
-
-/ {
- model = "Digineo AC1200 Pro";
-};
-
-&firmware {
- reg = <0x50000 0x1fb0000>;
-};
-
-&status_led {
- label = "ac1200pro:green:status";
-};
diff --git a/target/linux/ramips/dts/ZBT-WG3526-16M.dts b/target/linux/ramips/dts/ZBT-WG3526-16M.dts
index fb644502071d6641194c66baf552035937f35669..1e2f1525028f69468257cd8af8d5bad0319bc551 100644
--- a/target/linux/ramips/dts/ZBT-WG3526-16M.dts
+++ b/target/linux/ramips/dts/ZBT-WG3526-16M.dts
@@ -9,7 +9,3 @@
&firmware {
reg = <0x50000 0xfb0000>;
};
-
-&status_led {
- label = "zbt-wg3526:green:status";
-};
diff --git a/target/linux/ramips/dts/ZBT-WG3526-32M.dts b/target/linux/ramips/dts/ZBT-WG3526-32M.dts
new file mode 100644
index 0000000000000000000000000000000000000000..99a4b45824ba4ee6c1a1c81615291c8efde1a7ac
--- /dev/null
+++ b/target/linux/ramips/dts/ZBT-WG3526-32M.dts
@@ -0,0 +1,11 @@
+/dts-v1/;
+
+#include "ZBT-WG3526.dtsi"
+
+/ {
+ model = "ZBT-WG3526 (32M)";
+};
+
+&firmware {
+ reg = <0x50000 0x1fb0000>;
+};
diff --git a/target/linux/ramips/dts/ZBT-WG3526.dtsi b/target/linux/ramips/dts/ZBT-WG3526.dtsi
index 582e42083920c465588f14e59e10eafe735640fb..5e195fb8120d3a66f19acf83c9f76bb4b1ec3e7e 100644
--- a/target/linux/ramips/dts/ZBT-WG3526.dtsi
+++ b/target/linux/ramips/dts/ZBT-WG3526.dtsi
@@ -35,7 +35,8 @@
gpio-leds {
compatible = "gpio-leds";
- status_led: status {
+ status {
+ label = "zbt-wg3526:green:status";
gpios = <&gpio0 24 1>;
};
};
diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index cabc86b28eb040f0d1e58d917e6edc4a97e80db7..aa84d78b9e42259cbee7de6c052fa7ab500a040a 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -34,14 +34,6 @@ define Device/11acnas
endef
TARGET_DEVICES += 11acnas
-define Device/ac1200pro
- DTS := AC1200pro
- IMAGE_SIZE := $(ralink_default_fw_size_32M)
- DEVICE_TITLE := Digineo AC1200 Pro
- DEVICE_PACKAGES := kmod-usb3 kmod-ata-core kmod-ata-ahci
-endef
-TARGET_DEVICES += ac1200pro
-
define Device/dir-860l-b1
DTS := DIR-860L-B1
BLOCKSIZE := 64k
@@ -235,6 +227,15 @@ define Device/zbt-wg3526-16M
endef
TARGET_DEVICES += zbt-wg3526-16M
+define Device/zbt-wg3526-32M
+ DTS := ZBT-WG3526-32M
+ IMAGE_SIZE := $(ralink_default_fw_size_32M)
+ SUPPORTED_DEVICES += ac1200pro
+ DEVICE_TITLE := ZBT WG3526 (32MB flash)
+ DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-ata-core kmod-ata-ahci kmod-sdhci-mt7620
+endef
+TARGET_DEVICES += zbt-wg3526-32M
+
# FIXME: is this still needed?
define Image/Prepare
#define Build/Compile

View File

@ -1,63 +0,0 @@
From: Linus Lüssing <linus.luessing@c0d3.blue>
Date: Sun, 26 Nov 2017 05:19:21 +0100
Subject: kernel: bridge: ebtables: Avoid resetting limit rule state
Link: https://patchwork.ozlabs.org/patch/841210/
Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
diff --git a/target/linux/generic/patches-4.4/121-bridge-ebtables-Avoid-resetting-limit-rule-state.patch b/target/linux/generic/patches-4.4/121-bridge-ebtables-Avoid-resetting-limit-rule-state.patch
new file mode 100644
index 0000000000000000000000000000000000000000..417fdd75e543ebb6a3fdd56cb97fc83324eeb104
--- /dev/null
+++ b/target/linux/generic/patches-4.4/121-bridge-ebtables-Avoid-resetting-limit-rule-state.patch
@@ -0,0 +1,50 @@
+From 535097827e437bfa1906ed3210e6504750f4342b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
+Date: Sat, 25 Nov 2017 00:36:13 +0100
+Subject: [PATCH] bridge: ebtables: Avoid resetting limit rule state
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+So far any changes with ebtables will reset the state of limit rules,
+leading to spikes in traffic. This is especially noticeable if changes
+are done frequently, for instance via a daemon.
+
+This patch fixes this by bailing out from (re)setting if the limit
+rule was initialized before.
+
+When sending packets every 250ms for 600s, with a
+"--limit 1/sec --limit-burst 50" rule and a command like this
+in the background:
+
+$ ebtables -N VOIDCHAIN
+$ while true; do ebtables -F VOIDCHAIN; sleep 30; done
+
+The results are:
+
+Before: ~1600 packets
+After: 650 packets
+
+Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
+---
+ net/bridge/netfilter/ebt_limit.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/net/bridge/netfilter/ebt_limit.c b/net/bridge/netfilter/ebt_limit.c
+index 61a9f1be1263..f74b48633feb 100644
+--- a/net/bridge/netfilter/ebt_limit.c
++++ b/net/bridge/netfilter/ebt_limit.c
+@@ -69,6 +69,10 @@ static int ebt_limit_mt_check(const struct xt_mtchk_param *par)
+ {
+ struct ebt_limit_info *info = par->matchinfo;
+
++ /* Do not reset state on unrelated table changes */
++ if (info->prev)
++ return 0;
++
+ /* Check for overflow. */
+ if (info->burst == 0 ||
+ user2credits(info->avg * info->burst) < user2credits(info->avg)) {
+--
+2.11.0
+

View File

@ -1,31 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Thu, 12 Apr 2018 17:30:16 +0200
Subject: base-files: remove /etc/uci-defaults/11_migrate-sysctl
11_migrate-sysctl has not been updated with new file hashes since 2012.
Let's get rid of it.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/package/base-files/files/etc/uci-defaults/11_migrate-sysctl b/package/base-files/files/etc/uci-defaults/11_migrate-sysctl
deleted file mode 100644
index 464e275779ceec1d99a7323b6cbf7901aaa9fbb4..0000000000000000000000000000000000000000
--- a/package/base-files/files/etc/uci-defaults/11_migrate-sysctl
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-
-if [ ! -f "/rom/etc/sysctl.conf" ] || cmp -s "/rom/etc/sysctl.conf" "/etc/sysctl.conf"; then
- exit 0
-fi
-
-fingerprint="$(md5sum /etc/sysctl.conf)"
-fingerprint="${fingerprint%% *}"
-
-if [ "$fingerprint" = "1b05ebb41f72cb84e5510573cd4aca26" ] || \
- [ "$fingerprint" = "62deb895be1a7f496040187b7c930e4e" ]; then
- logger -t migrate-sysctl "Updating sysctl.conf to use current defaults"
- cp "/rom/etc/sysctl.conf" "/etc/sysctl.conf"
-fi
-
-exit 0

View File

@ -1,35 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Thu, 12 Apr 2018 17:33:51 +0200
Subject: base-files: evaluate /etc/sysctl.d/* before /etc/sysctl.conf
We can use /etc/sysctl.d/* for package-supplied sysctl snippets, giving
admins the option to use /etc/sysctl.conf to override settings.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/package/base-files/files/etc/hotplug.d/net/00-sysctl b/package/base-files/files/etc/hotplug.d/net/00-sysctl
index 7a71652c44f8bd1fb9f2e5643e7baa5d5d76c369..8abe7f8bbd698dc58716b770fe8bc7f8bd475b58 100644
--- a/package/base-files/files/etc/hotplug.d/net/00-sysctl
+++ b/package/base-files/files/etc/hotplug.d/net/00-sysctl
@@ -1,7 +1,7 @@
#!/bin/sh
if [ "$ACTION" = add ]; then
- for CONF in /etc/sysctl.conf /etc/sysctl.d/*.conf; do
+ for CONF in /etc/sysctl.d/*.conf /etc/sysctl.conf; do
[ ! -f "$CONF" ] && continue;
sed -ne "/^[[:space:]]*net\..*\.$DEVICENAME\./p" "$CONF" | \
sysctl -e -p - | logger -t sysctl
diff --git a/package/base-files/files/etc/init.d/sysctl b/package/base-files/files/etc/init.d/sysctl
index 65e6aa99250d09a3ccd9d023cb8f8205be86eee8..8722126a6612d67a3f615166a7fbec146207e97f 100755
--- a/package/base-files/files/etc/init.d/sysctl
+++ b/package/base-files/files/etc/init.d/sysctl
@@ -30,7 +30,7 @@ apply_defaults() {
start() {
apply_defaults
- for CONF in /etc/sysctl.conf /etc/sysctl.d/*.conf; do
+ for CONF in /etc/sysctl.d/*.conf /etc/sysctl.conf; do
[ -f "$CONF" ] && sysctl -p "$CONF" -e >&-
done
}

View File

@ -1,89 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Thu, 12 Apr 2018 17:37:29 +0200
Subject: base-files: move sysctl defaults to /etc/sysctl.d/10-default.conf
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/package/base-files/files/etc/sysctl.conf b/package/base-files/files/etc/sysctl.conf
index 91a3ac9a02d4344cf8c4c8f93a36193120fc4b95..ae04212f420b185ce525dae444b563128ddf0e11 100644
--- a/package/base-files/files/etc/sysctl.conf
+++ b/package/base-files/files/etc/sysctl.conf
@@ -1,30 +1 @@
-kernel.panic=3
-kernel.core_pattern=/tmp/%e.%t.%p.%s.core
-
-net.ipv4.conf.default.arp_ignore=1
-net.ipv4.conf.all.arp_ignore=1
-net.ipv4.ip_forward=1
-net.ipv4.icmp_echo_ignore_broadcasts=1
-net.ipv4.icmp_ignore_bogus_error_responses=1
-net.ipv4.igmp_max_memberships=100
-net.ipv4.tcp_fin_timeout=30
-net.ipv4.tcp_keepalive_time=120
-net.ipv4.tcp_syncookies=1
-net.ipv4.tcp_timestamps=1
-net.ipv4.tcp_sack=1
-net.ipv4.tcp_dsack=1
-
-net.ipv6.conf.default.forwarding=1
-net.ipv6.conf.all.forwarding=1
-
-net.netfilter.nf_conntrack_acct=1
-net.netfilter.nf_conntrack_checksum=0
-net.netfilter.nf_conntrack_max=16384
-net.netfilter.nf_conntrack_tcp_timeout_established=7440
-net.netfilter.nf_conntrack_udp_timeout=60
-net.netfilter.nf_conntrack_udp_timeout_stream=180
-
-# disable bridge firewalling by default
-net.bridge.bridge-nf-call-arptables=0
-net.bridge.bridge-nf-call-ip6tables=0
-net.bridge.bridge-nf-call-iptables=0
+# Defaults are configured in /etc/sysctl.d/* and can be customized in this file
diff --git a/package/base-files/files/etc/sysctl.d/10-default.conf b/package/base-files/files/etc/sysctl.d/10-default.conf
new file mode 100644
index 0000000000000000000000000000000000000000..7c3344dba339514c023c3b13c592e9ce9ca1ff55
--- /dev/null
+++ b/package/base-files/files/etc/sysctl.d/10-default.conf
@@ -0,0 +1,34 @@
+# Do not edit, changes to this file will be lost on upgrades
+# /etc/sysctl.conf can be used to customize sysctl settings
+
+kernel.panic=3
+kernel.core_pattern=/tmp/%e.%t.%p.%s.core
+fs.suid_dumpable=2
+
+net.ipv4.conf.default.arp_ignore=1
+net.ipv4.conf.all.arp_ignore=1
+net.ipv4.ip_forward=1
+net.ipv4.icmp_echo_ignore_broadcasts=1
+net.ipv4.icmp_ignore_bogus_error_responses=1
+net.ipv4.igmp_max_memberships=100
+net.ipv4.tcp_fin_timeout=30
+net.ipv4.tcp_keepalive_time=120
+net.ipv4.tcp_syncookies=1
+net.ipv4.tcp_timestamps=1
+net.ipv4.tcp_sack=1
+net.ipv4.tcp_dsack=1
+
+net.ipv6.conf.default.forwarding=1
+net.ipv6.conf.all.forwarding=1
+
+net.netfilter.nf_conntrack_acct=1
+net.netfilter.nf_conntrack_checksum=0
+net.netfilter.nf_conntrack_max=16384
+net.netfilter.nf_conntrack_tcp_timeout_established=7440
+net.netfilter.nf_conntrack_udp_timeout=60
+net.netfilter.nf_conntrack_udp_timeout_stream=180
+
+# disable bridge firewalling by default
+net.bridge.bridge-nf-call-arptables=0
+net.bridge.bridge-nf-call-ip6tables=0
+net.bridge.bridge-nf-call-iptables=0
diff --git a/package/base-files/files/etc/sysctl.d/local.conf b/package/base-files/files/etc/sysctl.d/local.conf
deleted file mode 100644
index 891da73df8d61e0c47069d4c6c8cc090f693c0b2..0000000000000000000000000000000000000000
--- a/package/base-files/files/etc/sysctl.d/local.conf
+++ /dev/null
@@ -1 +0,0 @@
-# local sysctl settings can be stored in this directory

View File

@ -1,85 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Thu, 12 Apr 2018 17:57:44 +0200
Subject: base-files: move netfilter sysctl defaults to specific kmod packages
Avoid warnings when applying settings for uninstalled kmods. See also
FS#1073.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/package/base-files/files/etc/sysctl.d/10-default.conf b/package/base-files/files/etc/sysctl.d/10-default.conf
index 7c3344dba339514c023c3b13c592e9ce9ca1ff55..98867b7c7ba1d1ce181f721cdfd17517069fcdf2 100644
--- a/package/base-files/files/etc/sysctl.d/10-default.conf
+++ b/package/base-files/files/etc/sysctl.d/10-default.conf
@@ -20,15 +20,3 @@ net.ipv4.tcp_dsack=1
net.ipv6.conf.default.forwarding=1
net.ipv6.conf.all.forwarding=1
-
-net.netfilter.nf_conntrack_acct=1
-net.netfilter.nf_conntrack_checksum=0
-net.netfilter.nf_conntrack_max=16384
-net.netfilter.nf_conntrack_tcp_timeout_established=7440
-net.netfilter.nf_conntrack_udp_timeout=60
-net.netfilter.nf_conntrack_udp_timeout_stream=180
-
-# disable bridge firewalling by default
-net.bridge.bridge-nf-call-arptables=0
-net.bridge.bridge-nf-call-ip6tables=0
-net.bridge.bridge-nf-call-iptables=0
diff --git a/package/kernel/linux/files/sysctl-br-netfilter.conf b/package/kernel/linux/files/sysctl-br-netfilter.conf
new file mode 100644
index 0000000000000000000000000000000000000000..b10ddc0874b6d393458e646e396716bd67b6b381
--- /dev/null
+++ b/package/kernel/linux/files/sysctl-br-netfilter.conf
@@ -0,0 +1,7 @@
+# Do not edit, changes to this file will be lost on upgrades
+# /etc/sysctl.conf can be used to customize sysctl settings
+
+# disable bridge firewalling by default
+net.bridge.bridge-nf-call-arptables=0
+net.bridge.bridge-nf-call-ip6tables=0
+net.bridge.bridge-nf-call-iptables=0
diff --git a/package/kernel/linux/files/sysctl-nf-conntrack.conf b/package/kernel/linux/files/sysctl-nf-conntrack.conf
new file mode 100644
index 0000000000000000000000000000000000000000..37baf5fd6ff9d99d37554f5e38bf1d749a7f21e2
--- /dev/null
+++ b/package/kernel/linux/files/sysctl-nf-conntrack.conf
@@ -0,0 +1,9 @@
+# Do not edit, changes to this file will be lost on upgrades
+# /etc/sysctl.conf can be used to customize sysctl settings
+
+net.netfilter.nf_conntrack_acct=1
+net.netfilter.nf_conntrack_checksum=0
+net.netfilter.nf_conntrack_max=16384
+net.netfilter.nf_conntrack_tcp_timeout_established=7440
+net.netfilter.nf_conntrack_udp_timeout=60
+net.netfilter.nf_conntrack_udp_timeout_stream=180
diff --git a/package/kernel/linux/modules/netfilter.mk b/package/kernel/linux/modules/netfilter.mk
index 3b26ad1fbf3e261d84ae18216c51c87c53579c06..bb882363f3df4df733424ca6bba72badc96f06f8 100644
--- a/package/kernel/linux/modules/netfilter.mk
+++ b/package/kernel/linux/modules/netfilter.mk
@@ -74,6 +74,11 @@ define KernelPackage/nf-conntrack
AUTOLOAD:=$(call AutoProbe,$(notdir $(NF_CONNTRACK-m)))
endef
+define KernelPackage/nf-conntrack/install
+ $(INSTALL_DIR) $(1)/etc/sysctl.d
+ $(INSTALL_DATA) ./files/sysctl-nf-conntrack.conf $(1)/etc/sysctl.d/11-nf-conntrack.conf
+endef
+
$(eval $(call KernelPackage,nf-conntrack))
@@ -674,6 +679,11 @@ define KernelPackage/br-netfilter
AUTOLOAD:=$(call AutoProbe,br_netfilter)
endef
+define KernelPackage/br-netfilter/install
+ $(INSTALL_DIR) $(1)/etc/sysctl.d
+ $(INSTALL_DATA) ./files/sysctl-br-netfilter.conf $(1)/etc/sysctl.d/11-br-netfilter.conf
+endef
+
$(eval $(call KernelPackage,br-netfilter))

View File

@ -1,23 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Fri, 13 Apr 2018 14:36:43 +0200
Subject: base-files: remove /etc/sysctl.d/ from conffiles
Let's use /etc/sysctl.d for package-provided snippets and leave
/etc/sysctl.conf to the admin. Don't backup /etc/sysctl.d on upgrades, so
old defaults get replaced properly.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/package/base-files/Makefile b/package/base-files/Makefile
index c971de4deee7cd331ddcad6b87eb9fefd7af6a64..55e67a97d03df7d96cf8a4aac3c5325ce7105c80 100644
--- a/package/base-files/Makefile
+++ b/package/base-files/Makefile
@@ -59,8 +59,6 @@ define Package/base-files/conffiles
/etc/shadow
/etc/shells
/etc/sysctl.conf
-/etc/sysctl.d/
-/etc/sysctl.d/local.conf
/etc/sysupgrade.conf
$(call $(TARGET)/conffiles)
endef

View File

@ -1,32 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Thu, 12 Apr 2018 22:14:56 +0200
Subject: kernel: disable accept_ra by default
Our commands setting accept_ra to 0 on all interfaces got lost in the
transition to procd. This remained unnoticed for a long time, as we also
enable forwarding on all interfaces, which prevents RA handling by default.
Restore the commands, while also fixing a possible race condition in the
old version.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/package/base-files/files/etc/init.d/sysctl b/package/base-files/files/etc/init.d/sysctl
index 8722126a6612d67a3f615166a7fbec146207e97f..a236a0194b665ff56c8330930bfd44709d1b0d3d 100755
--- a/package/base-files/files/etc/init.d/sysctl
+++ b/package/base-files/files/etc/init.d/sysctl
@@ -26,6 +26,14 @@ apply_defaults() {
net.ipv6.ip6frag_high_thresh="$frag_high_thresh" \
net.netfilter.nf_conntrack_frag6_low_thresh="$frag_low_thresh" \
net.netfilter.nf_conntrack_frag6_high_thresh="$frag_high_thresh"
+
+ # first set default, then all interfaces to avoid races with appearing interfaces
+ if [ -d /proc/sys/net/ipv6/conf ]; then
+ echo 0 > /proc/sys/net/ipv6/conf/default/accept_ra
+ for iface in /proc/sys/net/ipv6/conf/*/accept_ra; do
+ echo 0 > "$iface"
+ done
+ fi
}
start() {

View File

@ -1,23 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Mon, 9 Apr 2018 18:51:57 +0200
Subject: kernel: change dependency of kmod-ebtables-* on kmod-ebtables to selecting
Non-selecting dependencies easily lead to Kconfig failures due to recursive
dependencies. We hit such an issue in Gluon; the easiest fix is to make
the dependency selecting.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/package/kernel/linux/modules/netfilter.mk b/package/kernel/linux/modules/netfilter.mk
index bb882363f3df4df733424ca6bba72badc96f06f8..c1d08a54037e6b33834566dac58308f64a427ecd 100644
--- a/package/kernel/linux/modules/netfilter.mk
+++ b/package/kernel/linux/modules/netfilter.mk
@@ -707,7 +707,7 @@ $(eval $(call KernelPackage,ebtables))
define AddDepends/ebtables
SUBMENU:=$(NF_MENU)
- DEPENDS+=kmod-ebtables $(1)
+ DEPENDS+= +kmod-ebtables $(1)
endef

View File

@ -1,21 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Mon, 9 Apr 2018 18:56:53 +0200
Subject: kernel: unhide kmod-br-netfilter
kmod-br-netfilter is not only a support module, but can be useful on its
own, using the net.bridge.bridge-nf-call-* sysctls.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/package/kernel/linux/modules/netfilter.mk b/package/kernel/linux/modules/netfilter.mk
index c1d08a54037e6b33834566dac58308f64a427ecd..275147b8757a42c00de14502a072c8384a0526ab 100644
--- a/package/kernel/linux/modules/netfilter.mk
+++ b/package/kernel/linux/modules/netfilter.mk
@@ -672,7 +672,6 @@ $(eval $(call KernelPackage,arptables))
define KernelPackage/br-netfilter
SUBMENU:=$(NF_MENU)
TITLE:=Bridge netfilter support modules
- HIDDEN:=1
DEPENDS:=+kmod-ipt-core +kmod-bridge
FILES:=$(LINUX_DIR)/net/bridge/br_netfilter.ko
KCONFIG:=CONFIG_BRIDGE_NETFILTER

View File

@ -1,22 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Mon, 9 Apr 2018 19:01:56 +0200
Subject: kernel: kmod-ebtables: do not depend on kmod-br-netfilter
While ebtables can be combined with br-netfilter, there is no good reason
to make it a dependency.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/package/kernel/linux/modules/netfilter.mk b/package/kernel/linux/modules/netfilter.mk
index 275147b8757a42c00de14502a072c8384a0526ab..34eefcd892b9e8b3157603fa47578d0afc65dc4b 100644
--- a/package/kernel/linux/modules/netfilter.mk
+++ b/package/kernel/linux/modules/netfilter.mk
@@ -689,7 +689,7 @@ $(eval $(call KernelPackage,br-netfilter))
define KernelPackage/ebtables
SUBMENU:=$(NF_MENU)
TITLE:=Bridge firewalling modules
- DEPENDS:=+kmod-ipt-core +kmod-bridge +kmod-br-netfilter
+ DEPENDS:=+kmod-ipt-core +kmod-bridge
FILES:=$(foreach mod,$(EBTABLES-m),$(LINUX_DIR)/net/$(mod).ko)
KCONFIG:=$(KCONFIG_EBTABLES)
AUTOLOAD:=$(call AutoProbe,$(notdir $(EBTABLES-m)))

View File

@ -1,114 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Mon, 9 Apr 2018 19:41:26 +0200
Subject: iptables: split physdev match out as a separate package
Split physdev match out of ipt-extra to allow installing ipt-extra without
pulling in br-netfilter.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/include/netfilter.mk b/include/netfilter.mk
index 39c8e7c90fab2ba14cd75c80d1e357dd23ae6a1b..79ae3d5343ed77b559f50f40bb8a73a33dd13314 100644
--- a/include/netfilter.mk
+++ b/include/netfilter.mk
@@ -89,12 +89,14 @@ $(eval $(if $(NF_KMOD),,$(call nf_add,IPT_CONNTRACK_EXTRA,CONFIG_NETFILTER_XT_CO
$(eval $(call nf_add,IPT_EXTRA,CONFIG_NETFILTER_XT_MATCH_ADDRTYPE, $(if $(NF_KMOD),$(P_XT)xt_addrtype,$(P_XT)ipt_addrtype)))
$(eval $(call nf_add,IPT_EXTRA,CONFIG_NETFILTER_XT_MATCH_OWNER, $(P_XT)xt_owner))
-$(eval $(call nf_add,IPT_EXTRA,CONFIG_NETFILTER_XT_MATCH_PHYSDEV, $(P_XT)xt_physdev))
$(eval $(call nf_add,IPT_EXTRA,CONFIG_NETFILTER_XT_MATCH_PKTTYPE, $(P_XT)xt_pkttype))
$(eval $(call nf_add,IPT_EXTRA,CONFIG_NETFILTER_XT_MATCH_QUOTA, $(P_XT)xt_quota))
#$(eval $(call nf_add,IPT_EXTRA,CONFIG_IP_NF_TARGET_ROUTE, $(P_V4)ipt_ROUTE))
+# physdev
+
+$(eval $(call nf_add,IPT_PHYSDEV,CONFIG_NETFILTER_XT_MATCH_PHYSDEV, $(P_XT)xt_physdev))
# filter
@@ -347,6 +349,7 @@ IPT_BUILTIN += $(NF_CONNTRACK6-y)
IPT_BUILTIN += $(IPT_CONNTRACK-y)
IPT_BUILTIN += $(IPT_CONNTRACK_EXTRA-y)
IPT_BUILTIN += $(IPT_EXTRA-y)
+IPT_BUILTIN += $(IPT_PHYSDEV-y)
IPT_BUILTIN += $(IPT_FILTER-y)
IPT_BUILTIN += $(IPT_IPOPT-y)
IPT_BUILTIN += $(IPT_IPRANGE-y)
diff --git a/package/kernel/linux/modules/netfilter.mk b/package/kernel/linux/modules/netfilter.mk
index 34eefcd892b9e8b3157603fa47578d0afc65dc4b..a71904673ae53bffcc9fd88291520aacb4a4f8d7 100644
--- a/package/kernel/linux/modules/netfilter.mk
+++ b/package/kernel/linux/modules/netfilter.mk
@@ -604,7 +604,7 @@ define KernelPackage/ipt-extra
KCONFIG:=$(KCONFIG_IPT_EXTRA)
FILES:=$(foreach mod,$(IPT_EXTRA-m),$(LINUX_DIR)/net/$(mod).ko)
AUTOLOAD:=$(call AutoProbe,$(notdir $(IPT_EXTRA-m)))
- $(call AddDepends/ipt,+kmod-br-netfilter)
+ $(call AddDepends/ipt)
endef
define KernelPackage/ipt-extra/description
@@ -612,7 +612,6 @@ define KernelPackage/ipt-extra/description
Includes:
- addrtype
- owner
- - physdev (if bridge support was enabled in kernel)
- pkttype
- quota
endef
@@ -620,6 +619,21 @@ endef
$(eval $(call KernelPackage,ipt-extra))
+define KernelPackage/ipt-physdev
+ TITLE:=physdev module
+ KCONFIG:=$(KCONFIG_IPT_PHYSDEV)
+ FILES:=$(foreach mod,$(IPT_PHYSDEV-m),$(LINUX_DIR)/net/$(mod).ko)
+ AUTOLOAD:=$(call AutoProbe,$(notdir $(IPT_PHYSDEV-m)))
+ $(call AddDepends/ipt,+kmod-br-netfilter)
+endef
+
+define KernelPackage/ipt-physdev/description
+ The iptables physdev kernel module
+endef
+
+$(eval $(call KernelPackage,ipt-physdev))
+
+
define KernelPackage/ip6tables
SUBMENU:=$(NF_MENU)
TITLE:=IPv6 modules
diff --git a/package/network/utils/iptables/Makefile b/package/network/utils/iptables/Makefile
index 9761ed1820b5c092292d25aef28f8f9a8ffa91a6..af5ed8c6245a9d52f5aea695e71b08ac6f3e6eca 100644
--- a/package/network/utils/iptables/Makefile
+++ b/package/network/utils/iptables/Makefile
@@ -321,12 +321,20 @@ Other extra iptables extensions.
- addrtype
- condition
- owner
- - physdev (if ebtables is enabled)
- pkttype
- quota
endef
+define Package/iptables-mod-physdev
+$(call Package/iptables/Module, +kmod-ipt-physdev)
+ TITLE:=physdev iptables extension
+endef
+
+define Package/iptables-mod-physdev/description
+The iptables physdev match.
+endef
+
define Package/iptables-mod-led
$(call Package/iptables/Module, +kmod-ipt-led)
TITLE:=LED trigger iptables extension
@@ -561,6 +569,7 @@ endef
$(eval $(call BuildPackage,iptables))
$(eval $(call BuildPlugin,iptables-mod-conntrack-extra,$(IPT_CONNTRACK_EXTRA-m)))
$(eval $(call BuildPlugin,iptables-mod-extra,$(IPT_EXTRA-m)))
+$(eval $(call BuildPlugin,iptables-mod-physdev,$(IPT_PHYSDEV-m)))
$(eval $(call BuildPlugin,iptables-mod-filter,$(IPT_FILTER-m)))
$(eval $(call BuildPlugin,iptables-mod-ipopt,$(IPT_IPOPT-m)))
$(eval $(call BuildPlugin,iptables-mod-ipsec,$(IPT_IPSEC-m)))

View File

@ -1,24 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Tue, 10 Apr 2018 15:19:52 +0200
Subject: ar71xx: increase kernel partition size for UniFi AP Pro and Outdoor+
Tested on UAP Outdoor+.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/target/linux/ar71xx/image/ubnt.mk b/target/linux/ar71xx/image/ubnt.mk
index 899d5d030e44e64bc945f03babf8820d87451177..84bf13d2829c3e8cd250fe9a069245d0098b864d 100644
--- a/target/linux/ar71xx/image/ubnt.mk
+++ b/target/linux/ar71xx/image/ubnt.mk
@@ -254,9 +254,9 @@ TARGET_DEVICES += ubnt-rs ubnt-rspro ubnt-ls-sr71
define Device/ubnt-uap-pro
DEVICE_TITLE := Ubiquiti UAP Pro
- KERNEL_SIZE := 1536k
+ KERNEL_SIZE := 1792k
IMAGE_SIZE := 15744k
- MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1536k(kernel),14208k(rootfs),256k(cfg)ro,64k(EEPROM)ro,15744k@0x50000(firmware)
+ MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1792k(kernel),13952k(rootfs),256k(cfg)ro,64k(EEPROM)ro,15744k@0x50000(firmware)
UBNT_TYPE := BZ
UBNT_CHIP := ar934x
BOARDNAME := UAP-PRO

View File

@ -1,109 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Tue, 10 Apr 2018 17:26:34 +0200
Subject: firmware-utils: tplink-safeloader: move CPE/WBS 210/510 version metainfo to the end
Having the metainfo between kernel and rootfs prevents us from resizing
the kernel partition as necessary.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c
index 11ff2e56e19ec3780f988baf7257810530165b23..2a2329d1f188ea8520b6a4aeef25937e05d48a06 100644
--- a/tools/firmware-utils/src/tplink-safeloader.c
+++ b/tools/firmware-utils/src/tplink-safeloader.c
@@ -139,10 +139,10 @@ static struct device_info boards[] = {
{"default-mac", 0x30000, 0x00020},
{"product-info", 0x31100, 0x00100},
{"signature", 0x32000, 0x00400},
- {"os-image", 0x40000, 0x170000},
- {"soft-version", 0x1b0000, 0x00100},
- {"support-list", 0x1b1000, 0x00400},
- {"file-system", 0x1c0000, 0x600000},
+ {"os-image", 0x40000, 0x180000},
+ {"file-system", 0x1c0000, 0x5f0000},
+ {"soft-version", 0x7b0000, 0x00100},
+ {"support-list", 0x7b1000, 0x00400},
{"user-config", 0x7c0000, 0x10000},
{"default-config", 0x7d0000, 0x10000},
{"log", 0x7e0000, 0x10000},
@@ -151,7 +151,7 @@ static struct device_info boards[] = {
},
.first_sysupgrade_partition = "os-image",
- .last_sysupgrade_partition = "file-system",
+ .last_sysupgrade_partition = "support-list",
},
/** Firmware layout for the CPE510/520 */
@@ -177,10 +177,10 @@ static struct device_info boards[] = {
{"default-mac", 0x30000, 0x00020},
{"product-info", 0x31100, 0x00100},
{"signature", 0x32000, 0x00400},
- {"os-image", 0x40000, 0x170000},
- {"soft-version", 0x1b0000, 0x00100},
- {"support-list", 0x1b1000, 0x00400},
- {"file-system", 0x1c0000, 0x600000},
+ {"os-image", 0x40000, 0x180000},
+ {"file-system", 0x1c0000, 0x5f0000},
+ {"soft-version", 0x7b0000, 0x00100},
+ {"support-list", 0x7b1000, 0x00400},
{"user-config", 0x7c0000, 0x10000},
{"default-config", 0x7d0000, 0x10000},
{"log", 0x7e0000, 0x10000},
@@ -189,7 +189,7 @@ static struct device_info boards[] = {
},
.first_sysupgrade_partition = "os-image",
- .last_sysupgrade_partition = "file-system",
+ .last_sysupgrade_partition = "support-list",
},
{
@@ -209,10 +209,10 @@ static struct device_info boards[] = {
{"default-mac", 0x30000, 0x00020},
{"product-info", 0x31100, 0x00100},
{"signature", 0x32000, 0x00400},
- {"os-image", 0x40000, 0x170000},
- {"soft-version", 0x1b0000, 0x00100},
- {"support-list", 0x1b1000, 0x00400},
- {"file-system", 0x1c0000, 0x600000},
+ {"os-image", 0x40000, 0x180000},
+ {"file-system", 0x1c0000, 0x5f0000},
+ {"soft-version", 0x7b0000, 0x00100},
+ {"support-list", 0x7b1000, 0x00400},
{"user-config", 0x7c0000, 0x10000},
{"default-config", 0x7d0000, 0x10000},
{"log", 0x7e0000, 0x10000},
@@ -221,7 +221,7 @@ static struct device_info boards[] = {
},
.first_sysupgrade_partition = "os-image",
- .last_sysupgrade_partition = "file-system",
+ .last_sysupgrade_partition = "support-list",
},
{
@@ -241,10 +241,10 @@ static struct device_info boards[] = {
{"default-mac", 0x30000, 0x00020},
{"product-info", 0x31100, 0x00100},
{"signature", 0x32000, 0x00400},
- {"os-image", 0x40000, 0x170000},
- {"soft-version", 0x1b0000, 0x00100},
- {"support-list", 0x1b1000, 0x00400},
- {"file-system", 0x1c0000, 0x600000},
+ {"os-image", 0x40000, 0x180000},
+ {"file-system", 0x1c0000, 0x5f0000},
+ {"soft-version", 0x7b0000, 0x00100},
+ {"support-list", 0x7b1000, 0x00400},
{"user-config", 0x7c0000, 0x10000},
{"default-config", 0x7d0000, 0x10000},
{"log", 0x7e0000, 0x10000},
@@ -253,7 +253,7 @@ static struct device_info boards[] = {
},
.first_sysupgrade_partition = "os-image",
- .last_sysupgrade_partition = "file-system",
+ .last_sysupgrade_partition = "support-list",
},
/** Firmware layout for the C2600 */

View File

@ -1,67 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Tue, 10 Apr 2018 18:14:41 +0200
Subject: ar71xx: increase kernel partition size for CPE/WBS 210/510
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/target/linux/ar71xx/image/tp-link.mk b/target/linux/ar71xx/image/tp-link.mk
index be7e846c88f9ebbb8a4e4840e690d7864386bf64..1a6e58fca882fc9d122c184ee8167537751acf25 100644
--- a/target/linux/ar71xx/image/tp-link.mk
+++ b/target/linux/ar71xx/image/tp-link.mk
@@ -167,7 +167,7 @@ TARGET_DEVICES += archer-c60-v1
define Device/cpe510-520
DEVICE_TITLE := TP-LINK CPE510/520
DEVICE_PACKAGES := rssileds
- MTDPARTS := spi0.0:128k(u-boot)ro,64k(pation-table)ro,64k(product-info)ro,1536k(kernel),6144k(rootfs),192k(config)ro,64k(ART)ro,7680k@0x40000(firmware)
+ MTDPARTS := spi0.0:128k(u-boot)ro,64k(partition-table)ro,64k(product-info)ro,1792k(kernel),5888k(rootfs),192k(config)ro,64k(ART)ro,7680k@0x40000(firmware)
IMAGE_SIZE := 7680k
BOARDNAME := CPE510
TPLINK_BOARD_NAME := CPE510
diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c
index 2a2329d1f188ea8520b6a4aeef25937e05d48a06..ba86c71d870c8f38abb92c657c3656086a7782be 100644
--- a/tools/firmware-utils/src/tplink-safeloader.c
+++ b/tools/firmware-utils/src/tplink-safeloader.c
@@ -139,8 +139,8 @@ static struct device_info boards[] = {
{"default-mac", 0x30000, 0x00020},
{"product-info", 0x31100, 0x00100},
{"signature", 0x32000, 0x00400},
- {"os-image", 0x40000, 0x180000},
- {"file-system", 0x1c0000, 0x5f0000},
+ {"os-image", 0x40000, 0x1c0000},
+ {"file-system", 0x200000, 0x5b0000},
{"soft-version", 0x7b0000, 0x00100},
{"support-list", 0x7b1000, 0x00400},
{"user-config", 0x7c0000, 0x10000},
@@ -177,8 +177,8 @@ static struct device_info boards[] = {
{"default-mac", 0x30000, 0x00020},
{"product-info", 0x31100, 0x00100},
{"signature", 0x32000, 0x00400},
- {"os-image", 0x40000, 0x180000},
- {"file-system", 0x1c0000, 0x5f0000},
+ {"os-image", 0x40000, 0x1c0000},
+ {"file-system", 0x200000, 0x5b0000},
{"soft-version", 0x7b0000, 0x00100},
{"support-list", 0x7b1000, 0x00400},
{"user-config", 0x7c0000, 0x10000},
@@ -209,8 +209,8 @@ static struct device_info boards[] = {
{"default-mac", 0x30000, 0x00020},
{"product-info", 0x31100, 0x00100},
{"signature", 0x32000, 0x00400},
- {"os-image", 0x40000, 0x180000},
- {"file-system", 0x1c0000, 0x5f0000},
+ {"os-image", 0x40000, 0x1c0000},
+ {"file-system", 0x200000, 0x5b0000},
{"soft-version", 0x7b0000, 0x00100},
{"support-list", 0x7b1000, 0x00400},
{"user-config", 0x7c0000, 0x10000},
@@ -241,8 +241,8 @@ static struct device_info boards[] = {
{"default-mac", 0x30000, 0x00020},
{"product-info", 0x31100, 0x00100},
{"signature", 0x32000, 0x00400},
- {"os-image", 0x40000, 0x180000},
- {"file-system", 0x1c0000, 0x5f0000},
+ {"os-image", 0x40000, 0x1c0000},
+ {"file-system", 0x200000, 0x5b0000},
{"soft-version", 0x7b0000, 0x00100},
{"support-list", 0x7b1000, 0x00400},
{"user-config", 0x7c0000, 0x10000},

View File

@ -1,41 +0,0 @@
From: Piotr Dymacz <pepe2k@gmail.com>
Date: Mon, 6 Nov 2017 23:17:24 +0100
Subject: ar71xx: increase kernel partition size for TP-Link RE450 v1
This increases kernel partition size and fixes rootfs (file-system)
partition size on TP-Link RE450 v1. Also, while we are at it, switch
from statically defined kernel and rootfs partitions in kernel cmdline
to "tplink-fw" mtd splitter.
Fixes: FS#1072.
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
diff --git a/target/linux/ar71xx/image/tp-link.mk b/target/linux/ar71xx/image/tp-link.mk
index 1a6e58fca882fc9d122c184ee8167537751acf25..60dfe0e3edafcadad4ddc08be7645b49f269907c 100644
--- a/target/linux/ar71xx/image/tp-link.mk
+++ b/target/linux/ar71xx/image/tp-link.mk
@@ -207,7 +207,7 @@ TARGET_DEVICES += cpe210-220 cpe510-520 wbs210 wbs510
define Device/re450
DEVICE_TITLE := TP-LINK RE450
DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca988x
- MTDPARTS := spi0.0:128k(u-boot)ro,1344k(kernel),4672k(rootfs),64k(pation-table)ro,64k(product-info)ro,1856k(config)ro,64k(art)ro,6016k@0x20000(firmware)
+ MTDPARTS := spi0.0:128k(u-boot)ro,6016k(firmware),64k(partition-table)ro,64k(product-info)ro,1856k(config)ro,64k(art)ro
IMAGE_SIZE := 7936k
BOARDNAME := RE450
TPLINK_BOARD_NAME := RE450
diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c
index ba86c71d870c8f38abb92c657c3656086a7782be..23b69f3bd0eb66aca650eb2ffd7d5cd2a7cb5194 100644
--- a/tools/firmware-utils/src/tplink-safeloader.c
+++ b/tools/firmware-utils/src/tplink-safeloader.c
@@ -689,8 +689,8 @@ static struct device_info boards[] = {
*/
.partitions = {
{"fs-uboot", 0x00000, 0x20000},
- {"os-image", 0x20000, 0x150000},
- {"file-system", 0x170000, 0x4a0000},
+ {"os-image", 0x20000, 0x180000},
+ {"file-system", 0x1a0000, 0x460000},
{"partition-table", 0x600000, 0x02000},
{"default-mac", 0x610000, 0x00020},
{"pin", 0x610100, 0x00020},

View File

@ -1,37 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Tue, 10 Apr 2018 09:03:52 +0200
Subject: include/kernel.mk: build kmod packages with empty FILES
kmod packages without FILES did not have an install step defined, leading
to no package being built. This affected netfilter/iptables packages, which
filter out builtin modules from FILES.
Not building a package that it is selected in .config is problematic, as
the generated empty package may be necessary to satisfy dependencies.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/include/kernel.mk b/include/kernel.mk
index b1d0e8d927cb462b486cfd645d68963f1b6ab8ff..d8d457fe7a5d3584d8aa4e27430da84533c85ed0 100644
--- a/include/kernel.mk
+++ b/include/kernel.mk
@@ -194,8 +194,7 @@ $(call KernelPackage/$(1)/config)
$(call KernelPackage/depends)
ifneq ($(if $(filter-out %=y %=n %=m,$(KCONFIG)),$(filter m y,$(foreach c,$(filter-out %=y %=n %=m,$(KCONFIG)),$($(c)))),.),)
- ifneq ($(strip $(FILES)),)
- define Package/kmod-$(1)/install
+ define Package/kmod-$(1)/install
@for mod in $$(call version_filter,$$(FILES)); do \
if grep -q "$$$$$$$${mod##$(LINUX_DIR)/}" "$(LINUX_DIR)/modules.builtin"; then \
echo "NOTICE: module '$$$$$$$$mod' is built-in."; \
@@ -209,8 +208,7 @@ $(call KernelPackage/$(1)/config)
done;
$(call ModuleAutoLoad,$(1),$$(1),$(AUTOLOAD))
$(call KernelPackage/$(1)/install,$$(1))
- endef
- endif
+ endef
$(if $(CONFIG_PACKAGE_kmod-$(1)),
else
compile: $(1)-disabled

View File

@ -1,50 +0,0 @@
From: Mathias Kresin <dev@kresin.me>
Date: Sat, 25 Mar 2017 19:18:37 +0100
Subject: build: move lzma2eva build step to image-commands.mk
Move it to image-commands.mk so that it can used by other targets with
eva based boards as well.
Signed-off-by: Mathias Kresin <dev@kresin.me>
diff --git a/include/image-commands.mk b/include/image-commands.mk
index ec35e0fcfe97d9d98c731459d1f1681d2bcfe5ad..19d98feefe02b6deb43735ccd436aac39fc0a8ab 100644
--- a/include/image-commands.mk
+++ b/include/image-commands.mk
@@ -11,6 +11,11 @@ define Build/uImage
mv $@.new $@
endef
+define Build/eva-image
+ $(STAGING_DIR_HOST)/bin/lzma2eva $(KERNEL_LOADADDR) $(KERNEL_LOADADDR) $@ $@.new
+ mv $@.new $@
+endef
+
define Build/netgear-chk
$(STAGING_DIR_HOST)/bin/mkchkimg \
-o $@.new \
diff --git a/target/linux/lantiq/image/Makefile b/target/linux/lantiq/image/Makefile
index a96e528aab2c5c5c95f01b087f589cecc57c6e51..2cac925bfd95fedd5f76f30e72300cc0fd7d37a9 100644
--- a/target/linux/lantiq/image/Makefile
+++ b/target/linux/lantiq/image/Makefile
@@ -20,9 +20,8 @@ else
UBIFS_OPTS := -m 2048 -e 126KiB -c 4096
endif
-define Build/eva-image
- lzma2eva $(KERNEL_LOADADDR) $(KERNEL_LOADADDR) $@ $@.new
- ( dd if=$@.new bs=64k conv=sync; cat ./eva.dummy.squashfs; ) > $@
+define Build/append-avm-fakeroot
+ cat ./eva.dummy.squashfs >> $@
endef
define Build/dgn3500-sercom-footer
@@ -104,6 +103,8 @@ endef
define Device/AVM
KERNEL := kernel-bin | append-dtb | lzma | eva-image
+ IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | append-avm-fakeroot | \
+ append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
endef
ifeq ($(SUBTARGET),xway_legacy)

View File

@ -1,572 +0,0 @@
From: David Bauer <mail@david-bauer.net>
Date: Tue, 24 Apr 2018 19:52:13 +0200
Subject: ar71xx: add support for Fritz!Box 4020
This commit adds support for the AVM Fritz!Box 4020 WiFi-router.
SoC: Qualcomm Atheros QCA9561 (Dragonfly) 750MHz
RAM: Winbond W971GG6KB-25
FLASH: Macronix MX25L12835F
WiFi: QCA9561 b/g/n 3x3 450Mbit/s
USB: 1x USB 2.0
IN: WPS button, WiFi button
OUT: Power LED green, Internet LED green, WLAN LED green,
LAN LED green, INFO LED green, INFO LED red
UART: Header Next to Black metal shield
Pinout is 3.3V - RX - TX - GND (Square Pad is 3.3V)
The Serial setting is 115200-8-N-1.
Tested and working:
- Ethernet (LAN + WAN)
- WiFi (correct MAC)
- Installation via EVA bootloader
- OpenWRT sysupgrade
- Buttons
- LEDs
Not working:
- USB port
Installation via EVA:
In the first seconds after Power is connected, the bootloader will
listen for FTP connections on 169.254.157.1 (Might also be 192.168.178.1). Firmware can be uploaded
like following:
ftp> quote USER adam2
ftp> quote PASS adam2
ftp> binary
ftp> debug
ftp> passive
ftp> quote MEDIA FLSH
ftp> put openwrt-sysupgrade.bin mtd1
Note that this procedure might take up to two minutes. After transfer is
complete you need to powercycle the device to boot OpenWRT.
Signed-off-by: David Bauer <mail@david-bauer.net>
diff --git a/include/image-commands.mk b/include/image-commands.mk
index 19d98feefe02b6deb43735ccd436aac39fc0a8ab..7e77b878361ef5a4f6278733d25b0a1fed0ce5ff 100644
--- a/include/image-commands.mk
+++ b/include/image-commands.mk
@@ -16,6 +16,16 @@ define Build/eva-image
mv $@.new $@
endef
+define Build/append-squashfs-fakeroot-be
+ rm -rf $@.fakefs $@.fakesquashfs
+ mkdir $@.fakefs
+ $(STAGING_DIR_HOST)/bin/mksquashfs-lzma \
+ $@.fakefs $@.fakesquashfs \
+ -noappend -root-owned -be -nopad -b 65536 \
+ $(if $(SOURCE_DATE_EPOCH),-fixed-time $(SOURCE_DATE_EPOCH))
+ cat $@.fakesquashfs >> $@
+endef
+
define Build/netgear-chk
$(STAGING_DIR_HOST)/bin/mkchkimg \
-o $@.new \
diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds b/target/linux/ar71xx/base-files/etc/board.d/01_leds
index f9483e9a706fbd98ce6a42e968bc0d31e9da5c84..e8b13af7c24dea86519c962fa6381fd75971e8b9 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
@@ -305,6 +305,12 @@ dlan-pro-1200-ac)
ucidef_set_led_gpio "plcw" "dLAN" "devolo:status:dlan" "17" "0"
ucidef_set_led_gpio "plcr" "dLAN" "devolo:error:dlan" "16" "0"
;;
+fritz4020)
+ ucidef_set_led_default "power" "Power" "$board:green:power" "1"
+ ucidef_set_led_netdev "lan" "LAN" "$board:green:lan" "eth1"
+ ucidef_set_led_netdev "wan" "WAN" "$board:green:wan" "eth0"
+ ucidef_set_led_wlan "wlan" "WLAN" "$board:green:wlan" "phy0tpt"
+ ;;
gl-ar150|\
gl-ar300|\
gl-ar300m|\
diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network b/target/linux/ar71xx/base-files/etc/board.d/02_network
index 1690172b5dfac1e1aa278c38c27ba64cfd61ade0..1018ab4449f896d565b57ecbdc73b7e3d7fbe486 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -207,6 +207,7 @@ ar71xx_setup_interfaces()
;;
archer-c58-v1|\
archer-c59-v1|\
+ fritz4020|\
rb-450g)
ucidef_set_interfaces_lan_wan "eth1" "eth0"
ucidef_add_switch "switch0" \
diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
index 945167bee6f7dad76bc650a2bb8a7a71f96b738d..7cb708ebe2e9e7546f165022233d17224905a49c 100644
--- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
+++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
@@ -40,6 +40,24 @@ ath9k_ubi_eeprom_extract() {
ath9k_eeprom_die "failed to extract from $ubi"
}
+ath9k_eeprom_extract_reverse() {
+ local part=$1
+ local offset=$2
+ local count=$3
+ local mtd
+ local reversed
+ local caldata
+
+ mtd=$(find_mtd_chardev "$part")
+ reversed=$(hexdump -v -s $offset -n $count -e '/1 "%02x "' $mtd)
+
+ for byte in $reversed; do
+ caldata="\x${byte}${caldata}"
+ done
+
+ printf "%b" "$caldata" > /lib/firmware/$FIRMWARE
+}
+
ath9k_patch_firmware_mac() {
local mac=$1
@@ -58,6 +76,9 @@ case "$FIRMWARE" in
ath9k_eeprom_extract "art" 4096 2048
ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary art 0) +1)
;;
+ fritz4020)
+ ath9k_eeprom_extract_reverse "urlader" 5441 1088
+ ;;
mr18)
. /lib/upgrade/nand.sh
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 59ede17653bbb1994ce9fa734c86c877aedf67e4..a815ffe07322c20cddaa3c4f97e3bf62a3cf15ec 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -638,6 +638,9 @@ ar71xx_board_detect() {
name="gl-inet"
gl_inet_board_detect
;;
+ *"FRITZ!Box 4020")
+ name="fritz4020"
+ ;;
*"GL AR150")
name="gl-ar150"
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 5e8a06a7ae70ec349693c09deedbfce41a52cfc2..491b5d5a98b44844f14441d4024f2ad9667186e0 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -612,6 +612,9 @@ platform_check_image() {
return 0;
;;
+ fritz4020)
+ return 0
+ ;;
esac
echo "Sysupgrade is not yet supported on $board."
diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4
index 396a4fa02adb37c6e5f9f7f1cc40fd1014361654..45bf500643837a7270b45e32b22225c06c5fb841 100644
--- a/target/linux/ar71xx/config-4.4
+++ b/target/linux/ar71xx/config-4.4
@@ -106,6 +106,7 @@ CONFIG_ATH79_MACH_ESR1750=y
CONFIG_ATH79_MACH_ESR900=y
CONFIG_ATH79_MACH_EW_DORIN=y
CONFIG_ATH79_MACH_F9K1115V2=y
+CONFIG_ATH79_MACH_FRITZ4020=y
CONFIG_ATH79_MACH_GL_AR150=y
CONFIG_ATH79_MACH_GL_AR300=y
CONFIG_ATH79_MACH_GL_AR300M=y
@@ -373,6 +374,7 @@ CONFIG_MTD_PHYSMAP=y
CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-2
CONFIG_MTD_REDBOOT_PARTS=y
CONFIG_MTD_SPI_NOR=y
+CONFIG_MTD_SPLIT_EVA_FW=y
CONFIG_MTD_SPLIT_FIRMWARE=y
CONFIG_MTD_SPLIT_LZMA_FW=y
CONFIG_MTD_SPLIT_SEAMA_FW=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
index 4c9012acc6b4c40d88ffc8752086cac86b9b9c92..46366e0d922808e5e14fed0f2b5409cda11afd26 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
@@ -1918,3 +1918,12 @@ config ATH79_MACH_TL_WPA8630
select ATH79_DEV_LEDS_GPIO
select ATH79_DEV_M25P80
select ATH79_DEV_WMAC
+
+config ATH79_MACH_FRITZ4020
+ bool "AVM FRITZ!Box 4020 support"
+ select SOC_QCA956X
+ select ATH79_DEV_ETH
+ select ATH79_DEV_GPIO_BUTTONS
+ select ATH79_DEV_LEDS_GPIO
+ select ATH79_DEV_USB
+ select ATH79_DEV_M25P80
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Makefile b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
index 8408894669dc5f14f05701359073ef233a1b89f0..29c9c65bc122c0d02839adf1abb61dcda0795fb6 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
@@ -111,6 +111,7 @@ obj-$(CONFIG_ATH79_MACH_ESR1750) += mach-esr1750.o
obj-$(CONFIG_ATH79_MACH_ESR900) += mach-esr900.o
obj-$(CONFIG_ATH79_MACH_EW_DORIN) += mach-ew-dorin.o
obj-$(CONFIG_ATH79_MACH_F9K1115V2) += mach-f9k1115v2.o
+obj-$(CONFIG_ATH79_MACH_FRITZ4020) += mach-fritz4020.o
obj-$(CONFIG_ATH79_MACH_GL_AR150) += mach-gl-ar150.o
obj-$(CONFIG_ATH79_MACH_GL_AR300) += mach-gl-ar300.o
obj-$(CONFIG_ATH79_MACH_GL_AR300M) += mach-gl-ar300m.o
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
index 427de6a50d0fcbc9dae11f8e6921194c0a5b09ed..5f971ea32d35035617229076b7a7fc30ed4d2dcc 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
@@ -1224,6 +1224,15 @@ void __init ath79_parse_ascii_mac(char *mac_str, u8 *mac)
}
}
+void __init ath79_extract_mac_reverse(u8 *ptr, u8 *out)
+{
+ int i;
+
+ for (i = 0; i < ETH_ALEN; i++) {
+ out[i] = ptr[ETH_ALEN-i-1];
+ }
+}
+
static void __init ath79_set_mac_base_ascii(char *str)
{
u8 mac[ETH_ALEN];
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.h b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.h
index fb9e4f63c66ef9008e423007ecff02c93c321fb8..4d78260fbe35db20f8dc6dd245abcd0cbb275477 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.h
@@ -18,6 +18,7 @@ struct platform_device;
extern unsigned char ath79_mac_base[] __initdata;
void ath79_parse_ascii_mac(char *mac_str, u8 *mac);
+void ath79_extract_mac_reverse(u8 *ptr, u8 *out);
void ath79_init_mac(unsigned char *dst, const unsigned char *src,
int offset);
void ath79_init_local_mac(unsigned char *dst, const unsigned char *src);
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-fritz4020.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-fritz4020.c
new file mode 100644
index 0000000000000000000000000000000000000000..ed7f9a8b3ead80dbbe7f8d27c7dd5ecf0543d733
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-fritz4020.c
@@ -0,0 +1,242 @@
+/*
+ * AVM FRITZ!Box 4020 board support
+ *
+ * Copyright (C) 2018 David Bauer <mail@david-bauer.net>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+
+#include <linux/init.h>
+#include <linux/ath9k_platform.h>
+#include <linux/etherdevice.h>
+#include <linux/gpio.h>
+#include <linux/platform_device.h>
+
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+#include <linux/platform_data/mdio-gpio.h>
+#include <linux/spi/spi_gpio.h>
+#include <linux/spi/74x164.h>
+
+#include <asm/mach-ath79/ath79.h>
+#include <asm/mach-ath79/ar71xx_regs.h>
+
+#include "common.h"
+#include "dev-eth.h"
+#include "dev-gpio-buttons.h"
+#include "dev-leds-gpio.h"
+#include "dev-m25p80.h"
+#include "dev-spi.h"
+#include "dev-usb.h"
+#include "dev-wmac.h"
+#include "machtypes.h"
+
+
+#define FRITZ4020_GPIO_SHIFT_SER 19 /* DS, Data Serial Input */
+#define FRITZ4020_GPIO_SHIFT_SRCLK 20 /* SHCP, Shift Reg Clock Input */
+
+#define FRITZ4020_SSR_BIT_0 0
+#define FRITZ4020_SSR_BIT_1 1
+#define FRITZ4020_SSR_BIT_2 2
+#define FRITZ4020_SSR_BIT_3 3
+#define FRITZ4020_SSR_BIT_4 4
+#define FRITZ4020_SSR_BIT_5 5
+#define FRITZ4020_SSR_BIT_6 6
+#define FRITZ4020_SSR_BIT_7 7
+
+#define FRITZ4020_74HC_GPIO_BASE 32
+#define FRITZ4020_74HC_GPIO_LED_LAN (FRITZ4020_74HC_GPIO_BASE + 0)
+#define FRITZ4020_74HC_GPIO_LED_INFO_RED (FRITZ4020_74HC_GPIO_BASE + 1)
+#define FRITZ4020_74HC_GPIO_LED_POWER (FRITZ4020_74HC_GPIO_BASE + 2)
+#define FRITZ4020_74HC_GPIO_LED_WLAN (FRITZ4020_74HC_GPIO_BASE + 3)
+#define FRITZ4020_74HC_GPIO_LED_WAN (FRITZ4020_74HC_GPIO_BASE + 4)
+#define FRITZ4020_74HC_GPIO_USB_RST (FRITZ4020_74HC_GPIO_BASE + 5)
+#define FRITZ4020_74HC_GPIO_LED_INFO (FRITZ4020_74HC_GPIO_BASE + 6)
+
+
+#define FRITZ4020_GPIO_BTN_WPS 2
+#define FRITZ4020_GPIO_BTN_WLAN 21
+#define FRITZ4020_KEYS_POLL_INTERVAL 20 /* msecs */
+#define FRITZ4020_KEYS_DEBOUNCE_INTERVAL (3 * FRITZ4020_KEYS_POLL_INTERVAL)
+
+#define FRTIZ4020_OFFSET_URLADER_WIFI_MAC_REVERSE 0x1979
+
+
+static struct spi_gpio_platform_data fritz4020_spi_data = {
+ .sck = FRITZ4020_GPIO_SHIFT_SRCLK,
+ .miso = SPI_GPIO_NO_MISO,
+ .mosi = FRITZ4020_GPIO_SHIFT_SER,
+ .num_chipselect = 1,
+};
+
+static u8 fritz4020_ssr_initdata[] = {
+ BIT(FRITZ4020_SSR_BIT_7) |
+ BIT(FRITZ4020_SSR_BIT_6) |
+ BIT(FRITZ4020_SSR_BIT_5) |
+ BIT(FRITZ4020_SSR_BIT_4) |
+ BIT(FRITZ4020_SSR_BIT_3) |
+ BIT(FRITZ4020_SSR_BIT_2) |
+ BIT(FRITZ4020_SSR_BIT_1)
+};
+
+static struct gen_74x164_chip_platform_data fritz4020_ssr_data = {
+ .base = FRITZ4020_74HC_GPIO_BASE,
+ .num_registers = ARRAY_SIZE(fritz4020_ssr_initdata),
+ .init_data = fritz4020_ssr_initdata,
+};
+
+static struct platform_device fritz4020_spi_device = {
+ .name = "spi_gpio",
+ .id = 1,
+ .dev = {
+ .platform_data = &fritz4020_spi_data,
+ },
+};
+
+static struct spi_board_info fritz4020_spi_info[] = {
+ {
+ .bus_num = 1,
+ .chip_select = 0,
+ .max_speed_hz = 10000000,
+ .modalias = "74x164",
+ .platform_data = &fritz4020_ssr_data,
+ .controller_data = (void *) 0x0,
+ },
+};
+
+static struct mtd_partition fritz4020_flash_partitions[] = {
+ {
+ .name = "urlader",
+ .offset = 0,
+ .size = 0x0020000,
+ .mask_flags = MTD_WRITEABLE,
+ }, {
+ .name = "firmware",
+ .offset = 0x0020000,
+ .size = 0x0EE0000,
+ }, {
+ .name = "tffs (1)",
+ .offset = 0x0f00000,
+ .size = 0x0080000,
+ .mask_flags = MTD_WRITEABLE,
+ }, {
+ .name = "tffs (2)",
+ .offset = 0x0f80000,
+ .size = 0x0080000,
+ .mask_flags = MTD_WRITEABLE,
+ }
+};
+
+static struct flash_platform_data fritz4020_flash_data = {
+ .parts = fritz4020_flash_partitions,
+ .nr_parts = ARRAY_SIZE(fritz4020_flash_partitions),
+};
+
+static struct gpio_led fritz4020_leds_gpio[] __initdata = {
+ {
+ .name = "fritz4020:green:lan",
+ .gpio = FRITZ4020_74HC_GPIO_LED_LAN,
+ .active_low = 1,
+ }, {
+ .name = "fritz4020:green:info",
+ .gpio = FRITZ4020_74HC_GPIO_LED_INFO,
+ .active_low = 1,
+ }, {
+ .name = "fritz4020:red:info",
+ .gpio = FRITZ4020_74HC_GPIO_LED_INFO_RED,
+ .active_low = 1,
+ }, {
+ .name = "fritz4020:green:power",
+ .gpio = FRITZ4020_74HC_GPIO_LED_POWER,
+ .active_low = 1,
+ }, {
+ .name = "fritz4020:green:wlan",
+ .gpio = FRITZ4020_74HC_GPIO_LED_WLAN,
+ .active_low = 1,
+ }, {
+ .name = "fritz4020:green:wan",
+ .gpio = FRITZ4020_74HC_GPIO_LED_WAN,
+ .active_low = 1,
+ },
+};
+
+static struct gpio_keys_button fritz4020_gpio_keys[] __initdata = {
+ {
+ .desc = "RFKILL button",
+ .type = EV_KEY,
+ .code = KEY_RFKILL,
+ .debounce_interval = FRITZ4020_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = FRITZ4020_GPIO_BTN_WLAN,
+ .active_low = 0,
+ },
+ {
+ .desc = "WPS button",
+ .type = EV_KEY,
+ .code = KEY_WPS_BUTTON,
+ .debounce_interval = FRITZ4020_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = FRITZ4020_GPIO_BTN_WPS,
+ .active_low = 0,
+ },
+};
+
+static void __init fritz4020_setup(void) {
+ u8 *urlader = (u8 *) KSEG1ADDR(0x1f000000);
+ u8 wifi_mac[ETH_ALEN];
+
+ ath79_register_m25p80(&fritz4020_flash_data);
+
+ /* Initialize ethernet */
+ ath79_extract_mac_reverse(urlader + FRTIZ4020_OFFSET_URLADER_WIFI_MAC_REVERSE, wifi_mac);
+ ath79_setup_qca956x_eth_cfg(QCA956X_ETH_CFG_SW_PHY_SWAP |
+ QCA956X_ETH_CFG_SW_PHY_ADDR_SWAP);
+
+ ath79_register_mdio(0, 0x0);
+ ath79_register_mdio(1, 0x0);
+ ath79_init_mac(ath79_eth0_data.mac_addr, wifi_mac, -1);
+ ath79_init_mac(ath79_eth1_data.mac_addr, wifi_mac, -2);
+
+ /* WAN port */
+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
+ ath79_eth0_data.speed = SPEED_100;
+ ath79_eth0_data.duplex = DUPLEX_FULL;
+ ath79_eth0_data.phy_mask = BIT(0);
+ ath79_register_eth(0);
+
+ /* LAN ports */
+ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
+ ath79_eth1_data.speed = SPEED_1000;
+ ath79_eth1_data.duplex = DUPLEX_FULL;
+ ath79_switch_data.phy_poll_mask |= BIT(0);
+ ath79_switch_data.phy4_mii_en = 1;
+ ath79_register_eth(1);
+
+ /* Initialize 2.4GHz WiFi */
+ ath79_register_wmac_simple();
+
+ /* Activate USB Power */
+ gpio_request_one(FRITZ4020_74HC_GPIO_USB_RST,
+ GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+ "USB power");
+
+ /* Initialize USB port */
+ ath79_register_usb();
+
+ /* Register LED shift-register */
+ spi_register_board_info(fritz4020_spi_info,
+ ARRAY_SIZE(fritz4020_spi_info));
+ platform_device_register(&fritz4020_spi_device);
+
+ /* Register GPIO buttons */
+ ath79_register_gpio_keys_polled(-1, FRITZ4020_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(fritz4020_gpio_keys),
+ fritz4020_gpio_keys);
+
+ /* Register LEDs */
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(fritz4020_leds_gpio),
+ fritz4020_leds_gpio);
+}
+
+MIPS_MACHINE(ATH79_MACH_FRITZ4020, "FRITZ4020",
+ "AVM FRITZ!Box 4020", fritz4020_setup);
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
index 72c1e38c74707aba8fbd3aebc36f35becabd4987..07f1877180e27ff189387c5f34a61702d0fa9bd2 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -102,6 +102,7 @@ enum ath79_mach_type {
ATH79_MACH_EW_DORIN, /* embedded wireless Dorin Platform */
ATH79_MACH_EW_DORIN_ROUTER, /* embedded wireless Dorin Router Platform */
ATH79_MACH_F9K1115V2, /* Belkin AC1750DB */
+ ATH79_MACH_FRITZ4020, /* AVM FRITZ!Box 4020 */
ATH79_MACH_GL_AR150, /* GL-AR150 support */
ATH79_MACH_GL_AR300, /* GL-AR300 */
ATH79_MACH_GL_AR300M, /* GL-AR300M */
diff --git a/target/linux/ar71xx/image/generic.mk b/target/linux/ar71xx/image/generic.mk
index e11a8992f9c2f950079fddf121eb30c34926e33d..d113c5ad621bb2f15d4cbc4fd50e60904313a7da 100644
--- a/target/linux/ar71xx/image/generic.mk
+++ b/target/linux/ar71xx/image/generic.mk
@@ -738,3 +738,22 @@ define Device/bhr-4grv2
IMAGE/factory.bin = append-kernel | pad-to $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | mkbuffaloimg
endef
TARGET_DEVICES += bhr-4grv2
+
+define Device/AVM
+ DEVICE_PACKAGES := fritz-tffs -uboot-envtools
+ KERNEL := kernel-bin | patch-cmdline | lzma | eva-image
+ KERNEL_INITRAMFS := $$(KERNEL)
+ IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | \
+ append-squashfs-fakeroot-be | pad-to 256 | \
+ append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
+endef
+
+define Device/fritz4020
+ $(call Device/AVM)
+ DEVICE_TITLE := AVM FRITZ!Box 4020
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-storage
+ BOARDNAME := FRITZ4020
+ SUPPORTED_DEVICES := fritz4020
+ IMAGE_SIZE := 15232k
+endef
+TARGET_DEVICES += fritz4020
diff --git a/target/linux/ar71xx/mikrotik/config-default b/target/linux/ar71xx/mikrotik/config-default
index 23e862762600f0724a37fe1a390d4d09639c472c..e0401102229c00985e8000331dce43375903e1aa 100644
--- a/target/linux/ar71xx/mikrotik/config-default
+++ b/target/linux/ar71xx/mikrotik/config-default
@@ -71,6 +71,7 @@
# CONFIG_ATH79_MACH_ESR900 is not set
# CONFIG_ATH79_MACH_EW_DORIN is not set
# CONFIG_ATH79_MACH_F9K1115V2 is not set
+# CONFIG_ATH79_MACH_FRITZ4020 is not set
# CONFIG_ATH79_MACH_GL_AR150 is not set
# CONFIG_ATH79_MACH_GL_AR300 is not set
# CONFIG_ATH79_MACH_GL_AR300M is not set
@@ -217,6 +218,7 @@ CONFIG_MTD_NAND_ECC=y
CONFIG_MTD_NAND_RB4XX=y
CONFIG_MTD_NAND_RB750=y
CONFIG_MTD_NAND_RB91X=y
+# CONFIG_MTD_SPLIT_EVA_FW is not set
# CONFIG_MTD_REDBOOT_PARTS is not set
# CONFIG_MTD_TPLINK_PARTS is not set
CONFIG_MTD_UBI=y
diff --git a/target/linux/ar71xx/nand/config-default b/target/linux/ar71xx/nand/config-default
index c11ccfe29795d013776870cf21fb6ca8d907af1b..790fa8f9bd42aba8521b960c2a49a742285e6157 100644
--- a/target/linux/ar71xx/nand/config-default
+++ b/target/linux/ar71xx/nand/config-default
@@ -29,6 +29,7 @@
# CONFIG_ATH79_MACH_DIR_869_A1 is not set
# CONFIG_ATH79_MACH_EAP7660D is not set
# CONFIG_ATH79_MACH_EW_DORIN is not set
+# CONFIG_ATH79_MACH_FRITZ4020 is not set
# CONFIG_ATH79_MACH_HORNET_UB is not set
# CONFIG_ATH79_MACH_JA76PF is not set
# CONFIG_ATH79_MACH_JWAP003 is not set
@@ -104,6 +105,7 @@ CONFIG_MTD_NAND_ECC=y
CONFIG_MTD_NAND_ECC_BCH=y
# CONFIG_MTD_REDBOOT_PARTS is not set
# CONFIG_MTD_SM_COMMON is not set
+# CONFIG_MTD_SPLIT_EVA_FW is not set
# CONFIG_MTD_SPLIT_SEAMA_FW is not set
# CONFIG_MTD_TPLINK_PARTS is not set
CONFIG_MTD_UBI=y

View File

@ -1,233 +0,0 @@
From: Robert Marko <robimarko@gmail.com>
Date: Wed, 21 Feb 2018 13:15:17 +0100
Subject: ar71xx: add support for TP-Link TL-WR940N v6
Add support for TL-WR940N v6 board. It is pretty much the same as v5
except they only left WAN LED and removed other ones.
Installation: flash factory image through WEB UI or use TFTP.
Signed-off-by: Robert Marko <robimarko@gmail.com>
diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds b/target/linux/ar71xx/base-files/etc/board.d/01_leds
index e8b13af7c24dea86519c962fa6381fd75971e8b9..62d7f014be28782b9961551f2377a66ccadfb329 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
@@ -676,6 +676,9 @@ tl-wr941nd-v6)
ucidef_set_led_switch "lan4" "LAN4" "tp-link:blue:lan4" "switch0" "0x02"
ucidef_set_led_wlan "wlan" "WLAN" "tp-link:blue:wlan" "phy0tpt"
;;
+tl-wr940n-v6)
+ ucidef_set_led_netdev "wan" "WAN" "tp-link:blue:wan" "eth0"
+ ;;
tl-wr841n-v9|\
tl-wr841n-v11|\
tl-wr842n-v3)
diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network b/target/linux/ar71xx/base-files/etc/board.d/02_network
index 1018ab4449f896d565b57ecbdc73b7e3d7fbe486..ae82cfe008169a8282ac51746cf2299eec8c81d8 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -298,6 +298,7 @@ ar71xx_setup_interfaces()
tl-wdr6500-v2|\
tl-wr841n-v8|\
tl-wr940n-v4|\
+ tl-wr940n-v6|\
tl-wr941nd-v5|\
tl-wr941nd-v6|\
wnr1000-v2|\
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index 382500b75ee6dc1fe1126fb3121f4ae205c901d4..4d792e773c8efe0cb2e5e328d777db853cdd846b 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -397,6 +397,9 @@ get_status_led() {
tl-wr941nd-v6)
status_led="tp-link:blue:system"
;;
+ tl-wr940n-v6)
+ status_led="tp-link:orange:diag"
+ ;;
tl-wr841n-v9)
status_led="tp-link:green:qss"
;;
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index a815ffe07322c20cddaa3c4f97e3bf62a3cf15ec..21b1c44404d383ef99860caf95a8e19b9cbf5087 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -1082,6 +1082,9 @@ ar71xx_board_detect() {
*TL-WR941ND)
name="tl-wr941nd"
;;
+ *"TL-WR940N v6")
+ name="tl-wr940n-v6"
+ ;;
*"TL-WR941N/ND v5")
name="tl-wr941nd-v5"
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 491b5d5a98b44844f14441d4024f2ad9667186e0..03677ad1240c9a5af341354b95561f9d493a9cd8 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -443,6 +443,7 @@ platform_check_image() {
tl-wr941nd-v5|\
tl-wr941nd-v6|\
tl-wr940n-v4|\
+ tl-wr940n-v6|\
tl-wr941nd)
local magic_ver="0100"
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr940n-v4.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr940n-v4.c
index d693b947c843d2a74cd252503fa8bf68b20da4ab..b530622d9f00b8ce3b906ad5fe62de019d82763a 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr940n-v4.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr940n-v4.c
@@ -1,5 +1,5 @@
/*
- * TP-LINK TL-WR940N v4 board support
+ * TP-LINK TL-WR940N v4 and v6 board support
*
* Copyright (C) 2016 David Lutz <kpanic@ff3l.net>
*
@@ -32,12 +32,15 @@
#define TL_WR940N_V4_GPIO_LED_LAN1 8
#define TL_WR940N_V4_GPIO_LED_WLAN 7
#define TL_WR940N_V4_GPIO_LED_SYSTEM 5
+/* WR940N v6 specific GPIO*/
+#define TL_WR940N_V6_GPIO_LED_DIAG_ORANGE 15
+#define TL_WR940N_V6_GPIO_LED_WAN_BLUE 14
#define TL_WR940N_V4_GPIO_BTN_RESET 1
#define TL_WR940N_V4_GPIO_BTN_RFKILL 2
-#define TL_WR940N_V4_KEYS_POLL_INTERVAL 20
-#define TL_WR940N_V4_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR940N_V4_KEYS_POLL_INTERVAL)
+#define TL_WR940N_KEYS_POLL_INTERVAL 20
+#define TL_WR940N_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR940N_KEYS_POLL_INTERVAL)
static struct gpio_led tl_wr940n_v4_leds_gpio[] __initdata = {
@@ -93,43 +96,49 @@ static struct gpio_keys_button tl_wr940n_v4_gpio_keys[] __initdata = {
.desc = "Reset button",
.type = EV_KEY,
.code = KEY_RESTART,
- .debounce_interval = TL_WR940N_V4_KEYS_DEBOUNCE_INTERVAL,
+ .debounce_interval = TL_WR940N_KEYS_DEBOUNCE_INTERVAL,
.gpio = TL_WR940N_V4_GPIO_BTN_RESET,
.active_low = 1,
}, {
.desc = "RFKILL button",
.type = EV_KEY,
.code = KEY_RFKILL,
- .debounce_interval = TL_WR940N_V4_KEYS_DEBOUNCE_INTERVAL,
+ .debounce_interval = TL_WR940N_KEYS_DEBOUNCE_INTERVAL,
.gpio = TL_WR940N_V4_GPIO_BTN_RFKILL,
.active_low = 1,
}
};
+static struct gpio_led tl_wr940n_v6_leds_gpio[] __initdata = {
+ {
+ .name = "tp-link:blue:wan",
+ .gpio = TL_WR940N_V6_GPIO_LED_WAN_BLUE,
+ .active_low = 1,
+ },
+ {
+ .name = "tp-link:orange:diag",
+ .gpio = TL_WR940N_V6_GPIO_LED_DIAG_ORANGE,
+ .active_low = 0,
+ },
+};
+
-static const char *tl_wr940n_v4_part_probes[] = {
+static const char *tl_wr940n_part_probes[] = {
"tp-link",
NULL,
};
-static struct flash_platform_data tl_wr940n_v4_flash_data = {
- .part_probes = tl_wr940n_v4_part_probes,
+static struct flash_platform_data tl_wr940n_flash_data = {
+ .part_probes = tl_wr940n_part_probes,
};
-static void __init tl_wr940n_v4_setup(void)
+static void __init tl_wr940n_setup(void)
{
u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
- ath79_register_m25p80(&tl_wr940n_v4_flash_data);
-
- ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr940n_v4_leds_gpio),
- tl_wr940n_v4_leds_gpio);
-
- ath79_register_gpio_keys_polled(-1, TL_WR940N_V4_KEYS_POLL_INTERVAL,
- ARRAY_SIZE(tl_wr940n_v4_gpio_keys),
- tl_wr940n_v4_gpio_keys);
+ ath79_register_m25p80(&tl_wr940n_flash_data);
ath79_register_mdio(0, 0x0);
@@ -145,5 +154,31 @@ static void __init tl_wr940n_v4_setup(void)
}
+static void __init tl_wr940n_v4_setup(void)
+{
+ tl_wr940n_setup();
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr940n_v4_leds_gpio),
+ tl_wr940n_v4_leds_gpio);
+
+ ath79_register_gpio_keys_polled(-1, TL_WR940N_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(tl_wr940n_v4_gpio_keys),
+ tl_wr940n_v4_gpio_keys);
+}
+
+static void __init tl_wr940n_v6_setup(void)
+{
+ tl_wr940n_setup();
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr940n_v6_leds_gpio),
+ tl_wr940n_v6_leds_gpio);
+
+ ath79_register_gpio_keys_polled(-1, TL_WR940N_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(tl_wr940n_v4_gpio_keys),
+ tl_wr940n_v4_gpio_keys);
+}
+
MIPS_MACHINE(ATH79_MACH_TL_WR940N_V4, "TL-WR940N-v4", "TP-LINK TL-WR940N v4",
tl_wr940n_v4_setup);
+MIPS_MACHINE(ATH79_MACH_TL_WR940N_V6, "TL-WR940N-v6", "TP-LINK TL-WR940N v6",
+ tl_wr940n_v6_setup);
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
index 07f1877180e27ff189387c5f34a61702d0fa9bd2..89ddbbc976c9393608a80b9ce56e02a4d403ea2a 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -242,6 +242,7 @@ enum ath79_mach_type {
ATH79_MACH_TL_WR941ND_V5, /* TP-LINK TL-WR941ND v5 */
ATH79_MACH_TL_WR941ND_V6, /* TP-LINK TL-WR941ND v6 */
ATH79_MACH_TL_WR940N_V4, /* TP-LINK TL-WR940N v4 */
+ ATH79_MACH_TL_WR940N_V6, /* TP-LINK TL-WR940N v6 */
ATH79_MACH_TUBE2H, /* Alfa Network Tube2H */
ATH79_MACH_UBNT_AIRGW, /* Ubiquiti AirGateway */
ATH79_MACH_UBNT_AIRGWP, /* Ubiquiti AirGateway Pro */
diff --git a/target/linux/ar71xx/image/tp-link.mk b/target/linux/ar71xx/image/tp-link.mk
index 60dfe0e3edafcadad4ddc08be7645b49f269907c..1e40d943ac2aa43aea670fd86268708aea39a46c 100644
--- a/target/linux/ar71xx/image/tp-link.mk
+++ b/target/linux/ar71xx/image/tp-link.mk
@@ -857,6 +857,14 @@ define Device/tl-wr940n-v4
IMAGE/factory-eu.bin := append-rootfs | mktplinkfw factory -C EU
endef
+define Device/tl-wr940n-v6
+ $(Device/tl-wr940n-v4)
+ DEVICE_TITLE := TP-LINK TL-WR940N v6
+ BOARDNAME := TL-WR940N-v6
+ TPLINK_HWID := 0x09400006
+endef
+TARGET_DEVICES += tl-wr940n-v6
+
# Chinese version (unlike European) is similar to the TL-WDR3500
define Device/tl-wr941nd-v6-cn
$(Device/tplink-4mlzma)

View File

@ -1,348 +0,0 @@
From: Wojciech Jowsa <w.jowsa@radytek.com>
Date: Wed, 15 Feb 2017 12:38:07 +0100
Subject: ar71xx: set status led for the gl-* boards
Signed-off-by: Wojciech Jowsa <w.jowsa@radytek.com>
diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds b/target/linux/ar71xx/base-files/etc/board.d/01_leds
index 62d7f014be28782b9961551f2377a66ccadfb329..f4d83cee519406a188cc9dde355f509dd644625a 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
@@ -311,19 +311,18 @@ fritz4020)
ucidef_set_led_netdev "wan" "WAN" "$board:green:wan" "eth0"
ucidef_set_led_wlan "wlan" "WLAN" "$board:green:wlan" "phy0tpt"
;;
-gl-ar150|\
-gl-ar300|\
-gl-ar300m|\
+gl-ar300m)
+ ucidef_set_led_wlan "wlan" "WLAN" "$board:red:wlan" "phy0tpt"
+ ;;
gl-mifi)
+ ucidef_set_led_wlan "wlan" "WLAN" "$board:green:wlan" "phy0tpt"
+ ucidef_set_led_netdev "wan" "WAN" "$board:green:wan" "eth0"
+ ucidef_set_led_netdev "lan" "LAN" "$board:green:lan" "eth1"
+ ucidef_set_led_netdev "3gnet" "3GNET" "$board:green:net" "3g-wan"
+ ;;
+gl-ar150|\
+gl-ar300)
ucidef_set_led_wlan "wlan" "WLAN" "$board:wlan" "phy0tpt"
-
- case "$board" in
- gl-mifi)
- ucidef_set_led_netdev "wan" "WAN" "$board:wan" "eth0"
- ucidef_set_led_netdev "lan" "LAN" "$board:lan" "eth1"
- ucidef_set_led_netdev "3gnet" "3GNET" "$board:net" "3g-wan"
- ;;
- esac
;;
gl-domino|\
wrt160nl)
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index 4d792e773c8efe0cb2e5e328d777db853cdd846b..336d078f72a06073e3465c36ca98035c7d70282f 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -64,7 +64,9 @@ get_status_led() {
ap90q|\
cpe830|\
cpe870|\
- gl-inet)
+ gl-inet|\
+ gl-mifi|\
+ gl-ar300m)
status_led="$board:green:lan"
;;
ap96)
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar300m.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar300m.c
index 62906a1922f890eb36ad212e9542dc52dc56006c..ca44b364c51559350fedc5551a023b2772bb69a1 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar300m.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar300m.c
@@ -6,9 +6,9 @@
* Copyright (C) 2013 alzhao <alzhao@gmail.com>
* Copyright (C) 2014 Michel Stempin <michel.stempin@wanadoo.fr>
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
*/
#include <linux/gpio.h>
@@ -37,130 +37,130 @@
#define GL_AR300M_GPIO_BTN_LEFT 0
#define GL_AR300M_GPIO_BTN_RIGHT 1
-#define GL_AR300M_KEYS_POLL_INTERVAL 20 /* msecs */
-#define GL_AR300M_KEYS_DEBOUNCE_INTERVAL (3 * GL_AR300M_KEYS_POLL_INTERVAL)
+#define GL_AR300M_KEYS_POLL_INTERVAL 20 /* msecs */
+#define GL_AR300M_KEYS_DEBOUNCE_INTERVAL (3 * GL_AR300M_KEYS_POLL_INTERVAL)
-#define GL_AR300M_MAC0_OFFSET 0
-#define GL_AR300M_MAC1_OFFSET 6
-#define GL_AR300M_WMAC_CALDATA_OFFSET 0x1000
-#define GL_AR300M_PCIE_CALDATA_OFFSET 0x5000
+#define GL_AR300M_MAC0_OFFSET 0
+#define GL_AR300M_MAC1_OFFSET 6
+#define GL_AR300M_WMAC_CALDATA_OFFSET 0x1000
+#define GL_AR300M_PCIE_CALDATA_OFFSET 0x5000
static struct gpio_led gl_ar300m_leds_gpio[] __initdata = {
- {
- .name = "gl-ar300m:usb",
- .gpio = GL_AR300M_GPIO_LED_USB,
- .active_low = 0,
- .default_state = 1,
- },
- {
- .name = "gl-ar300m:wlan",
- .gpio = GL_AR300M_GPIO_LED_WLAN,
- .active_low = 1,
- },
- {
- .name = "gl-ar300m:lan",
- .gpio = GL_AR300M_GPIO_LED_LAN,
- .active_low = 1,
- },
- {
- .name = "gl-ar300m:system",
- .gpio = GL_AR300M_GPIO_LED_SYSTEM,
- .active_low = 1,
- .default_state = 1,
- },
+ {
+ .name = "gl-ar300m:green:usb",
+ .gpio = GL_AR300M_GPIO_LED_USB,
+ .active_low = 0,
+ .default_state = 1,
+ },
+ {
+ .name = "gl-ar300m:green:wlan",
+ .gpio = GL_AR300M_GPIO_LED_WLAN,
+ .active_low = 1,
+ },
+ {
+ .name = "gl-ar300m::green:lan",
+ .gpio = GL_AR300M_GPIO_LED_LAN,
+ .active_low = 1,
+ },
+ {
+ .name = "gl-ar300m:green:system",
+ .gpio = GL_AR300M_GPIO_LED_SYSTEM,
+ .active_low = 1,
+ .default_state = 1,
+ },
};
static struct gpio_keys_button gl_ar300m_gpio_keys[] __initdata = {
- {
- .desc = "reset",
- .type = EV_KEY,
- .code = KEY_RESTART,
- .debounce_interval = GL_AR300M_KEYS_DEBOUNCE_INTERVAL,
- .gpio = GL_AR300M_GPIO_BTN_RESET,
- .active_low = 1,
- },
- {
- .desc = "button right",
- .type = EV_KEY,
- .code = BTN_0,
- .debounce_interval = GL_AR300M_KEYS_DEBOUNCE_INTERVAL,
- .gpio = GL_AR300M_GPIO_BTN_LEFT,
- .active_low = 0,
- },
- {
- .desc = "button left",
- .type = EV_KEY,
- .code = BTN_1,
- .debounce_interval = GL_AR300M_KEYS_DEBOUNCE_INTERVAL,
- .gpio = GL_AR300M_GPIO_BTN_RIGHT,
- .active_low = 0,
- },
+ {
+ .desc = "reset",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = GL_AR300M_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = GL_AR300M_GPIO_BTN_RESET,
+ .active_low = 1,
+ },
+ {
+ .desc = "button right",
+ .type = EV_KEY,
+ .code = BTN_0,
+ .debounce_interval = GL_AR300M_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = GL_AR300M_GPIO_BTN_LEFT,
+ .active_low = 0,
+ },
+ {
+ .desc = "button left",
+ .type = EV_KEY,
+ .code = BTN_1,
+ .debounce_interval = GL_AR300M_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = GL_AR300M_GPIO_BTN_RIGHT,
+ .active_low = 0,
+ },
};
static struct spi_board_info gl_ar300m_spi_info[] = {
- {
- .bus_num = 0,
- .chip_select = 0,
- .max_speed_hz = 25000000,
- .modalias = "m25p80",
- .platform_data = NULL,
- },
- {
- .bus_num = 0,
- .chip_select = 1,
- .max_speed_hz = 25000000,
- .modalias = "ath79-spinand",
- .platform_data = NULL,
- }
+ {
+ .bus_num = 0,
+ .chip_select = 0,
+ .max_speed_hz = 25000000,
+ .modalias = "m25p80",
+ .platform_data = NULL,
+ },
+ {
+ .bus_num = 0,
+ .chip_select = 1,
+ .max_speed_hz = 25000000,
+ .modalias = "ath79-spinand",
+ .platform_data = NULL,
+ }
};
static struct ath79_spi_platform_data gl_ar300m_spi_data = {
- .bus_num = 0,
- .num_chipselect = 2,
+ .bus_num = 0,
+ .num_chipselect = 2,
};
static void __init gl_ar300m_setup(void)
{
- u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
- u8 tmpmac[ETH_ALEN];
-
- ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE);
- ath79_register_spi(&gl_ar300m_spi_data, gl_ar300m_spi_info, 2);
-
- /* register gpio LEDs and keys */
- ath79_register_leds_gpio(-1, ARRAY_SIZE(gl_ar300m_leds_gpio),
- gl_ar300m_leds_gpio);
- ath79_register_gpio_keys_polled(-1, GL_AR300M_KEYS_POLL_INTERVAL,
- ARRAY_SIZE(gl_ar300m_gpio_keys),
- gl_ar300m_gpio_keys);
-
- ath79_register_mdio(0, 0x0);
-
- /* WAN */
- ath79_init_mac(ath79_eth0_data.mac_addr, art + GL_AR300M_MAC0_OFFSET, 0);
- ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
- ath79_eth0_data.speed = SPEED_100;
- ath79_eth0_data.duplex = DUPLEX_FULL;
- ath79_eth0_data.phy_mask = BIT(4);
- ath79_register_eth(0);
-
- /* LAN */
- ath79_init_mac(ath79_eth1_data.mac_addr, art + GL_AR300M_MAC1_OFFSET, 0);
- ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
- ath79_eth1_data.speed = SPEED_1000;
- ath79_eth1_data.duplex = DUPLEX_FULL;
- ath79_switch_data.phy_poll_mask |= BIT(4);
- ath79_switch_data.phy4_mii_en = 1;
- ath79_register_eth(1);
-
- ath79_init_mac(tmpmac, art + GL_AR300M_WMAC_CALDATA_OFFSET + 2, 0);
- ath79_register_wmac(art + GL_AR300M_WMAC_CALDATA_OFFSET, tmpmac);
-
- /* enable usb */
- ath79_register_usb();
- /* enable pci */
- ath79_register_pci();
+ u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
+ u8 tmpmac[ETH_ALEN];
+
+ ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE);
+ ath79_register_spi(&gl_ar300m_spi_data, gl_ar300m_spi_info, 2);
+
+ /* register gpio LEDs and keys */
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(gl_ar300m_leds_gpio),
+ gl_ar300m_leds_gpio);
+ ath79_register_gpio_keys_polled(-1, GL_AR300M_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(gl_ar300m_gpio_keys),
+ gl_ar300m_gpio_keys);
+
+ ath79_register_mdio(0, 0x0);
+
+ /* WAN */
+ ath79_init_mac(ath79_eth0_data.mac_addr, art + GL_AR300M_MAC0_OFFSET, 0);
+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
+ ath79_eth0_data.speed = SPEED_100;
+ ath79_eth0_data.duplex = DUPLEX_FULL;
+ ath79_eth0_data.phy_mask = BIT(4);
+ ath79_register_eth(0);
+
+ /* LAN */
+ ath79_init_mac(ath79_eth1_data.mac_addr, art + GL_AR300M_MAC1_OFFSET, 0);
+ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
+ ath79_eth1_data.speed = SPEED_1000;
+ ath79_eth1_data.duplex = DUPLEX_FULL;
+ ath79_switch_data.phy_poll_mask |= BIT(4);
+ ath79_switch_data.phy4_mii_en = 1;
+ ath79_register_eth(1);
+
+ ath79_init_mac(tmpmac, art + GL_AR300M_WMAC_CALDATA_OFFSET + 2, 0);
+ ath79_register_wmac(art + GL_AR300M_WMAC_CALDATA_OFFSET, tmpmac);
+
+ /* enable usb */
+ ath79_register_usb();
+ /* enable pci */
+ ath79_register_pci();
}
MIPS_MACHINE(ATH79_MACH_GL_AR300M, "GL-AR300M", "GL-AR300M",
- gl_ar300m_setup);
+ gl_ar300m_setup);
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-mifi.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-mifi.c
index 42f4415d7fe0252aadf39e2ca50f96566c023728..412c562fa042e7abb0ccb35208bb55821efc8660 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-mifi.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-mifi.c
@@ -41,27 +41,27 @@
static struct gpio_led gl_mifi_leds_gpio[] __initdata = {
{
- .name = "gl-mifi:wan",
+ .name = "gl-mifi:greeen:wan",
.gpio = GL_MIFI_GPIO_LED_WAN,
.active_low = 0,
},
{
- .name = "gl-mifi:lan",
+ .name = "gl-mifi:green:lan",
.gpio = GL_MIFI_GPIO_LED_LAN,
.active_low = 0,
},
{
- .name = "gl-mifi:wlan",
+ .name = "gl-mifi:green:wlan",
.gpio = GL_MIFI_GPIO_LED_WLAN,
.active_low = 0,
},
{
- .name = "gl-mifi:net",
+ .name = "gl-mifi:green:net",
.gpio = GL_MIFI_GPIO_LED_NET,
.active_low = 0,
},
{
- .name = "gl-mifi:3gcontrol",
+ .name = "gl-mifi:green:3gcontrol",
.gpio = GL_MIFI_GPIO_LED_3GCONTROL,
.active_low = 0,
}

View File

@ -1,364 +0,0 @@
From: Piotr Dymacz <pepe2k@gmail.com>
Date: Tue, 17 Oct 2017 23:30:01 +0200
Subject: ar71xx: add support for GL.iNet GL-AR750
GL.iNet GL-AR750 is a small size, dual-band (AC750) router, based on
Qualcomm/Atheros QCA9531 v2 + QCA9887. FCC ID: 2AFIW-AR750.
Specification:
- 650/597/216 MHz (CPU/DDR/AHB)
- 128 MB of RAM (DDR2)
- 16 MB of FLASH (SPI NOR)
- 3x 10/100 Mbps Ethernet
- 2T2R 2.4 GHz (QCA9531)
- 1T1R 5 GHz (QCA9887)
- 1x USB 2.0 (power controlled by GPIO)
- 1x microSD (GL857L)
- 3x LED (all driven by GPIO)
- 1x button (reset)
- 1x 2-pos switch
- header for optional PoE module
- 1x micro USB for main power input
- UART + I2C header on PCB
Flash instruction:
Vendor firmware is based on OpenWrt/LEDE. GUI or sysupgrade can be used
to flash OpenWrt/LEDE firmware.
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds b/target/linux/ar71xx/base-files/etc/board.d/01_leds
index f4d83cee519406a188cc9dde355f509dd644625a..f94cc3c85b798458cc97c06bb0d44bdc426d057d 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
@@ -314,6 +314,10 @@ fritz4020)
gl-ar300m)
ucidef_set_led_wlan "wlan" "WLAN" "$board:red:wlan" "phy0tpt"
;;
+gl-ar750)
+ ucidef_set_led_wlan "wlan2g" "WLAN2G" "$board:white:wlan2g" "phy1tpt"
+ ucidef_set_led_wlan "wlan5g" "WLAN5G" "$board:white:wlan5g" "phy0tpt"
+ ;;
gl-mifi)
ucidef_set_led_wlan "wlan" "WLAN" "$board:green:wlan" "phy0tpt"
ucidef_set_led_netdev "wan" "WAN" "$board:green:wan" "eth0"
diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network b/target/linux/ar71xx/base-files/etc/board.d/02_network
index ae82cfe008169a8282ac51746cf2299eec8c81d8..c8990c60f504286d0fd28c7b17f54c9c3b5a891e 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -369,6 +369,7 @@ ar71xx_setup_interfaces()
onion-omega)
ucidef_set_interface_lan "wlan0"
;;
+ gl-ar750|\
rb-435g)
ucidef_set_interfaces_lan_wan "eth1" "eth0"
ucidef_add_switch "switch0" \
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index 336d078f72a06073e3465c36ca98035c7d70282f..01d3b787bedcab82a5797c9a4801e8139887cc2c 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -249,6 +249,7 @@ get_status_led() {
nbg460n_550n_550nh)
status_led="nbg460n:green:power"
;;
+ gl-ar750|\
nbg6716)
status_led="$board:white:power"
;;
@@ -489,7 +490,8 @@ set_state() {
done)
status_led_on
case $(ar71xx_board_name) in
- gl-ar300m)
+ gl-ar300m|\
+ gl-ar750)
fw_printenv lc >/dev/null 2>&1 && fw_setenv "bootcount" 0
;;
qihoo-c301)
diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 91bdf0d3c591516f58030b165052b3dd2751314f..1626622a8e46484bbf2719f19843e61d9cc92506 100644
--- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -103,6 +103,7 @@ case "$FIRMWARE" in
ath10kcal_extract "art" 20480 2116
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2)
;;
+ gl-ar750|\
tl-wpa8630)
ath10kcal_extract "art" 20480 2116
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1)
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 21b1c44404d383ef99860caf95a8e19b9cbf5087..35b742a5f1fee0bc24ab2d88e32f118c1df4e2b3 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -650,6 +650,9 @@ ar71xx_board_detect() {
*"GL-AR300M")
name="gl-ar300m"
;;
+ *"GL-AR750")
+ name="gl-ar750"
+ ;;
*"GL-MIFI")
name="gl-mifi"
;;
diff --git a/target/linux/ar71xx/base-files/lib/preinit/05_set_preinit_iface_ar71xx b/target/linux/ar71xx/base-files/lib/preinit/05_set_preinit_iface_ar71xx
index d677599d8c6380d9920e95abc9fb4b92cc0cec29..ba6e08b00d979bc73f7199756e22ca3941fad97d 100644
--- a/target/linux/ar71xx/base-files/lib/preinit/05_set_preinit_iface_ar71xx
+++ b/target/linux/ar71xx/base-files/lib/preinit/05_set_preinit_iface_ar71xx
@@ -17,6 +17,7 @@ set_preinit_iface() {
archer-c7 |\
bhr-4grv2 |\
dir-505-a1 |\
+ gl-ar750|\
gl-inet |\
jwap003 |\
pb42 |\
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 03677ad1240c9a5af341354b95561f9d493a9cd8..236520b27c4d6d0b1b7e483d1100fb5ab156d475 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -253,6 +253,7 @@ platform_check_image() {
gl-ar150|\
gl-ar300m|\
gl-ar300|\
+ gl-ar750|\
gl-domino|\
gl-mifi|\
hiwifi-hc6361|\
diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4
index 45bf500643837a7270b45e32b22225c06c5fb841..d96642b97c36187febb1f3843e7dd9acfab0e40d 100644
--- a/target/linux/ar71xx/config-4.4
+++ b/target/linux/ar71xx/config-4.4
@@ -110,6 +110,7 @@ CONFIG_ATH79_MACH_FRITZ4020=y
CONFIG_ATH79_MACH_GL_AR150=y
CONFIG_ATH79_MACH_GL_AR300=y
CONFIG_ATH79_MACH_GL_AR300M=y
+CONFIG_ATH79_MACH_GL_AR750=y
CONFIG_ATH79_MACH_GL_DOMINO=y
CONFIG_ATH79_MACH_GL_INET=y
CONFIG_ATH79_MACH_GL_MIFI=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
index 46366e0d922808e5e14fed0f2b5409cda11afd26..2449a8d6bce17f0a703d8fc4f82dd38e1f861ae3 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
@@ -691,6 +691,17 @@ config ATH79_MACH_GL_AR300M
select ATH79_DEV_USB
select ATH79_DEV_WMAC
+config ATH79_MACH_GL_AR750
+ bool "GL.iNet GL-AR750 support"
+ select SOC_QCA953X
+ select ATH79_DEV_AP9X_PCI if PCI
+ select ATH79_DEV_ETH
+ select ATH79_DEV_GPIO_BUTTONS
+ select ATH79_DEV_LEDS_GPIO
+ select ATH79_DEV_M25P80
+ select ATH79_DEV_USB
+ select ATH79_DEV_WMAC
+
config ATH79_MACH_GL_DOMINO
bool "DOMINO support"
select SOC_AR933X
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Makefile b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
index 29c9c65bc122c0d02839adf1abb61dcda0795fb6..98281db31a05713168713f3e0fd62f736a2e7614 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
@@ -115,6 +115,7 @@ obj-$(CONFIG_ATH79_MACH_FRITZ4020) += mach-fritz4020.o
obj-$(CONFIG_ATH79_MACH_GL_AR150) += mach-gl-ar150.o
obj-$(CONFIG_ATH79_MACH_GL_AR300) += mach-gl-ar300.o
obj-$(CONFIG_ATH79_MACH_GL_AR300M) += mach-gl-ar300m.o
+obj-$(CONFIG_ATH79_MACH_GL_AR750) += mach-gl-ar750.o
obj-$(CONFIG_ATH79_MACH_GL_DOMINO) += mach-gl-domino.o
obj-$(CONFIG_ATH79_MACH_GL_INET) += mach-gl-inet.o
obj-$(CONFIG_ATH79_MACH_GL_MIFI) += mach-gl-mifi.o
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar750.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar750.c
new file mode 100644
index 0000000000000000000000000000000000000000..9ee6e29c02139b972a83a555fcd693765bf8194f
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar750.c
@@ -0,0 +1,146 @@
+/*
+ * GL.iNet GL-AR750 board support
+ *
+ * Copyright (C) 2018 Piotr Dymacz <pepe2k@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+
+#include <linux/gpio.h>
+#include <linux/i2c.h>
+#include <linux/i2c-gpio.h>
+#include <linux/platform_device.h>
+
+#include <asm/mach-ath79/ath79.h>
+#include <asm/mach-ath79/ar71xx_regs.h>
+
+#include "common.h"
+#include "dev-ap9x-pci.h"
+#include "dev-eth.h"
+#include "dev-gpio-buttons.h"
+#include "dev-leds-gpio.h"
+#include "dev-m25p80.h"
+#include "dev-usb.h"
+#include "dev-wmac.h"
+#include "machtypes.h"
+
+#define GL_AR750_GPIO_LED_POWER 12
+#define GL_AR750_GPIO_LED_WLAN2G 14
+#define GL_AR750_GPIO_LED_WLAN5G 13
+
+#define GL_AR750_GPIO_BTN_RESET 3
+#define GL_AR750_GPIO_BTN_SW1 0
+
+#define GL_AR750_GPIO_I2C_SCL 16
+#define GL_AR750_GPIO_I2C_SDA 17
+
+#define GL_AR750_GPIO_USB_POWER 2
+
+#define GL_AR750_KEYS_POLL_INTERVAL 20
+#define GL_AR750_KEYS_DEBOUNCE_INTERVAL (3 * GL_AR750_KEYS_POLL_INTERVAL)
+
+#define GL_AR750_MAC0_OFFSET 0
+#define GL_AR750_WMAC2G_CALDATA_OFFSET 0x1000
+#define GL_AR750_WMAC5G_CALDATA_OFFSET 0x5000
+
+static struct gpio_led gl_ar750_leds_gpio[] __initdata = {
+ {
+ .name = "gl-ar750:white:power",
+ .gpio = GL_AR750_GPIO_LED_POWER,
+ .default_state = LEDS_GPIO_DEFSTATE_KEEP,
+ .active_low = 1,
+ }, {
+ .name = "gl-ar750:white:wlan2g",
+ .gpio = GL_AR750_GPIO_LED_WLAN2G,
+ .active_low = 1,
+ }, {
+ .name = "gl-ar750:white:wlan5g",
+ .gpio = GL_AR750_GPIO_LED_WLAN5G,
+ .active_low = 1,
+ },
+};
+
+static struct gpio_keys_button gl_ar750_gpio_keys[] __initdata = {
+ {
+ .desc = "reset",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = GL_AR750_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = GL_AR750_GPIO_BTN_RESET,
+ .active_low = 1,
+ }, {
+ .desc = "sw1",
+ .type = EV_KEY,
+ .code = BTN_0,
+ .debounce_interval = GL_AR750_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = GL_AR750_GPIO_BTN_SW1,
+ .active_low = 1,
+ },
+};
+
+static struct i2c_gpio_platform_data gl_ar750_i2c_gpio_data = {
+ .sda_pin = GL_AR750_GPIO_I2C_SDA,
+ .scl_pin = GL_AR750_GPIO_I2C_SCL,
+};
+
+static struct platform_device gl_ar750_i2c_gpio = {
+ .name = "i2c-gpio",
+ .id = 0,
+ .dev = {
+ .platform_data = &gl_ar750_i2c_gpio_data,
+ },
+};
+
+static void __init gl_ar750_setup(void)
+{
+ u8 *art = (u8 *) KSEG1ADDR(0x1f050000);
+
+ ath79_register_m25p80(NULL);
+
+ ath79_setup_ar933x_phy4_switch(false, false);
+ ath79_register_mdio(0, 0x0);
+
+ ath79_switch_data.phy4_mii_en = 1;
+ ath79_switch_data.phy_poll_mask = 0xfc;
+
+ /* WAN */
+ ath79_eth0_data.duplex = DUPLEX_FULL;
+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
+ ath79_eth0_data.phy_mask = BIT(4);
+ ath79_eth0_data.speed = SPEED_100;
+ ath79_init_mac(ath79_eth0_data.mac_addr, art + GL_AR750_MAC0_OFFSET, 0);
+ ath79_register_eth(0);
+
+ /* LAN */
+ ath79_eth1_data.duplex = DUPLEX_FULL;
+ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
+ ath79_init_mac(ath79_eth1_data.mac_addr, art + GL_AR750_MAC0_OFFSET, 1);
+ ath79_register_eth(1);
+
+ /* Disable JTAG (enables GPIO0-3) */
+ ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE);
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(gl_ar750_leds_gpio),
+ gl_ar750_leds_gpio);
+
+ ath79_register_gpio_keys_polled(-1, GL_AR750_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(gl_ar750_gpio_keys),
+ gl_ar750_gpio_keys);
+
+ gpio_request_one(GL_AR750_GPIO_USB_POWER,
+ GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+ "USB power");
+
+ platform_device_register(&gl_ar750_i2c_gpio);
+
+ ath79_register_usb();
+
+ ath79_register_wmac(art + GL_AR750_WMAC2G_CALDATA_OFFSET, NULL);
+
+ ap91_pci_init(art + GL_AR750_WMAC5G_CALDATA_OFFSET, NULL);
+}
+
+MIPS_MACHINE(ATH79_MACH_GL_AR750, "GL-AR750", "GL.iNet GL-AR750",
+ gl_ar750_setup);
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
index 89ddbbc976c9393608a80b9ce56e02a4d403ea2a..11ccdbb5083807ef137b8cd2d110de7a97a34e38 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -106,6 +106,7 @@ enum ath79_mach_type {
ATH79_MACH_GL_AR150, /* GL-AR150 support */
ATH79_MACH_GL_AR300, /* GL-AR300 */
ATH79_MACH_GL_AR300M, /* GL-AR300M */
+ ATH79_MACH_GL_AR750, /* GL.iNet GL-AR750 */
ATH79_MACH_GL_DOMINO, /* Domino */
ATH79_MACH_GL_INET, /* GL-CONNECT GL-INET */
ATH79_MACH_GL_MIFI, /* GL-MIFI support */
diff --git a/target/linux/ar71xx/image/generic.mk b/target/linux/ar71xx/image/generic.mk
index d113c5ad621bb2f15d4cbc4fd50e60904313a7da..d1375c8742d8aea6224f7aca3d9e9522d8056a94 100644
--- a/target/linux/ar71xx/image/generic.mk
+++ b/target/linux/ar71xx/image/generic.mk
@@ -161,6 +161,19 @@ define Device/gl-ar300m
endef
TARGET_DEVICES += gl-ar300m
+define Device/gl-ar750
+ DEVICE_TITLE := GL.iNet GL-AR750
+ DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca9887 kmod-usb-core \
+ kmod-usb2 kmod-usb-storage
+ BOARDNAME := GL-AR750
+ SUPPORTED_DEVICES := gl-ar750
+ IMAGE_SIZE := 16000k
+ MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env),64k(art)ro,-(firmware)
+ IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \
+ append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
+endef
+TARGET_DEVICES += gl-ar750
+
define Device/gl-domino
DEVICE_TITLE := GL Domino Pi
DEVICE_PACKAGES := kmod-usb-core kmod-usb2

View File

@ -1,18 +0,0 @@
From: Piotr Dymacz <pepe2k@gmail.com>
Date: Tue, 17 Oct 2017 23:32:11 +0200
Subject: uboot-envtools: add support for GL.iNet GL-AR750
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
diff --git a/package/boot/uboot-envtools/files/ar71xx b/package/boot/uboot-envtools/files/ar71xx
index 25bec7eb33fd691bae417512c4c03e133d93213d..26f1ff938b8191e84315cf308f78e0907264c671 100644
--- a/package/boot/uboot-envtools/files/ar71xx
+++ b/package/boot/uboot-envtools/files/ar71xx
@@ -29,6 +29,7 @@ cr3000|\
cr5000|\
eap300v2|\
gl-ar300m|\
+gl-ar750|\
hornet-ub|\
hornet-ub-x2|\
jwap230|\

View File

@ -1,54 +0,0 @@
From: David Bauer <mail@david-bauer.net>
Date: Sun, 25 Feb 2018 12:09:38 +0100
Subject: ar71xx: add model detection for UBNT AC-Mesh
This commit adds correct model detection for UniFi
AC-Mesh. Previously said device was incorrectly detected
as UniFi AC-Lite.
The Information about the device is stored at 0xC in the EEPROM
partition. It corresponds to the sysid in /etc/board.info of the
Ubiquiti stock firmware.
Signed-off-by: David Bauer <mail@david-bauer.net>
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 35b742a5f1fee0bc24ab2d88e32f118c1df4e2b3..59c1899a588007d6a6a1860fcf95064b0ec35561 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -98,6 +98,27 @@ ubnt_xm_board_detect() {
[ -z "$model" ] || AR71XX_MODEL="${model}${magic:3:1}"
}
+ubnt_ac_lite_get_mtd_part_magic() {
+ ar71xx_get_mtd_offset_size_format EEPROM 12 2 %02x
+}
+
+ubnt_ac_lite_board_detect() {
+ local model
+ local magic
+
+ magic="$(ubnt_ac_lite_get_mtd_part_magic)"
+ case ${magic:0:4} in
+ "e517")
+ model="Ubiquiti UniFi-AC-LITE"
+ ;;
+ "e557")
+ model="Ubiquiti UniFi-AC-MESH"
+ ;;
+ esac
+
+ [ -z "$model" ] || AR71XX_MODEL="${model}"
+}
+
cybertan_get_hw_magic() {
local part
@@ -1129,6 +1150,7 @@ ar71xx_board_detect() {
;;
*"UniFi-AC-LITE")
name="unifiac-lite"
+ ubnt_ac_lite_board_detect
;;
*"UniFi-AC-PRO")
name="unifiac-pro"

View File

@ -1,46 +0,0 @@
From: Piotr Dymacz <pepe2k@gmail.com>
Date: Mon, 3 Jul 2017 18:57:36 +0200
Subject: ar71xx: generic: enable CONFIG_MTD_SPLIT_TPLINK_FW
We can use "tplink-fw" mtd splitter for TP-Link devices which use kernel
with TP-Link header embedded inside "safeloader" image type and thus get
rid of statically defined "kernel" and "rootfs" partitions in cmdline.
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4
index d96642b97c36187febb1f3843e7dd9acfab0e40d..6c29cd7748b3ce7e53adf359cd5002ba01066fbd 100644
--- a/target/linux/ar71xx/config-4.4
+++ b/target/linux/ar71xx/config-4.4
@@ -379,6 +379,7 @@ CONFIG_MTD_SPLIT_EVA_FW=y
CONFIG_MTD_SPLIT_FIRMWARE=y
CONFIG_MTD_SPLIT_LZMA_FW=y
CONFIG_MTD_SPLIT_SEAMA_FW=y
+CONFIG_MTD_SPLIT_TPLINK_FW=y
CONFIG_MTD_SPLIT_UIMAGE_FW=y
CONFIG_MTD_SPLIT_WRGG_FW=y
CONFIG_MTD_TPLINK_PARTS=y
diff --git a/target/linux/ar71xx/mikrotik/config-default b/target/linux/ar71xx/mikrotik/config-default
index e0401102229c00985e8000331dce43375903e1aa..f5d48ae0f674883371f8d549594f695913c3d216 100644
--- a/target/linux/ar71xx/mikrotik/config-default
+++ b/target/linux/ar71xx/mikrotik/config-default
@@ -219,6 +219,7 @@ CONFIG_MTD_NAND_RB4XX=y
CONFIG_MTD_NAND_RB750=y
CONFIG_MTD_NAND_RB91X=y
# CONFIG_MTD_SPLIT_EVA_FW is not set
+# CONFIG_MTD_SPLIT_TPLINK_FW is not set
# CONFIG_MTD_REDBOOT_PARTS is not set
# CONFIG_MTD_TPLINK_PARTS is not set
CONFIG_MTD_UBI=y
diff --git a/target/linux/ar71xx/nand/config-default b/target/linux/ar71xx/nand/config-default
index 790fa8f9bd42aba8521b960c2a49a742285e6157..0eee52d3ee69990fadf77de9f03f03c9c9b59190 100644
--- a/target/linux/ar71xx/nand/config-default
+++ b/target/linux/ar71xx/nand/config-default
@@ -107,6 +107,7 @@ CONFIG_MTD_NAND_ECC_BCH=y
# CONFIG_MTD_SM_COMMON is not set
# CONFIG_MTD_SPLIT_EVA_FW is not set
# CONFIG_MTD_SPLIT_SEAMA_FW is not set
+# CONFIG_MTD_SPLIT_TPLINK_FW is not set
# CONFIG_MTD_TPLINK_PARTS is not set
CONFIG_MTD_UBI=y
CONFIG_MTD_UBI_BEB_LIMIT=20

View File

@ -1,71 +0,0 @@
From: Sven Eckelmann <sven.eckelmann@openmesh.com>
Date: Wed, 6 Jun 2018 11:21:53 +0200
Subject: mac80211: initialize sinfo in cfg80211_get_station
Most of the implementations behind cfg80211_get_station will not initialize
sinfo to zero before manipulating it. For example, the member "filled",
which indicates the filled in parts of this struct, is often only modified
by enabling certain bits in the bitfield while keeping the remaining bits
in their original state. A caller without a preinitialized sinfo.filled can
then no longer decide which parts of sinfo were filled in by
cfg80211_get_station (or actually the underlying implementations).
cfg80211_get_station must therefore take care that sinfo is initialized to
zero. Otherwise, the caller may tries to read information which was not
filled in and which must therefore also be considered uninitialized. In
batadv_v_elp_get_throughput's case, an invalid "random" expected throughput
may be stored for this neighbor and thus the B.A.T.M.A.N V algorithm may
switch to non-optimal neighbors for certain destinations.
Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
Forwarded: https://github.com/openwrt/openwrt/pull/1015
diff --git a/package/kernel/mac80211/patches/379-cfg80211-initialize-sinfo-in-cfg80211_get_station.patch b/package/kernel/mac80211/patches/379-cfg80211-initialize-sinfo-in-cfg80211_get_station.patch
new file mode 100644
index 0000000000000000000000000000000000000000..37323c1f7defee830b3f876a46f255acf21fce42
--- /dev/null
+++ b/package/kernel/mac80211/patches/379-cfg80211-initialize-sinfo-in-cfg80211_get_station.patch
@@ -0,0 +1,42 @@
+From 4f717a2589be649afddbbd3ac58b67ebfa7426f7 Mon Sep 17 00:00:00 2001
+From: Sven Eckelmann <sven@narfation.org>
+Date: Wed, 6 Jun 2018 10:18:31 +0200
+Subject: [PATCH v2] cfg80211: initialize sinfo in cfg80211_get_station
+
+Most of the implementations behind cfg80211_get_station will not initialize
+sinfo to zero before manipulating it. For example, the member "filled",
+which indicates the filled in parts of this struct, is often only modified
+by enabling certain bits in the bitfield while keeping the remaining bits
+in their original state. A caller without a preinitialized sinfo.filled can
+then no longer decide which parts of sinfo were filled in by
+cfg80211_get_station (or actually the underlying implementations).
+
+cfg80211_get_station must therefore take care that sinfo is initialized to
+zero. Otherwise, the caller may tries to read information which was not
+filled in and which must therefore also be considered uninitialized. In
+batadv_v_elp_get_throughput's case, an invalid "random" expected throughput
+may be stored for this neighbor and thus the B.A.T.M.A.N V algorithm may
+switch to non-optimal neighbors for certain destinations.
+
+Fixes: 7406353d43c8 ("cfg80211: implement cfg80211_get_station cfg80211 API")
+Reported-by: Thomas Lauer <holminateur@gmail.com>
+Reported-by: Marcel Schmidt <ff.z-casparistrasse@mailbox.org>
+Cc: b.a.t.m.a.n@lists.open-mesh.org
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+
+Forwarded: https://patchwork.kernel.org/patch/10449857/
+---
+ net/wireless/util.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/net/wireless/util.c
++++ b/net/wireless/util.c
+@@ -1749,6 +1749,8 @@ int cfg80211_get_station(struct net_devi
+ if (!rdev->ops->get_station)
+ return -EOPNOTSUPP;
+
++ memset(sinfo, 0, sizeof(*sinfo));
++
+ return rdev_get_station(rdev, dev, mac_addr, sinfo);
+ }
+ EXPORT_SYMBOL(cfg80211_get_station);

View File

@ -1,54 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Wed, 6 Jun 2018 20:51:05 +0200
Subject: ar71xx: lzma-loader: move padding workaround to gzip step
Some devices (TP-Link TL-WR1043ND v1) don't boot reliably when the
uncompressed loader is too small. This was workarounded in the loader by
adding 512KB of padding to the .data section of the loader binary.
This approach had two issues:
- The padding was only working when .data was non-empty (otherwise the
section would become NOBITS, omitting it in the binary). .data was only
empty when no CMDLINE was set, leading to further workarounds like
fe594bf90d09 ("ath79: fix loader-okli, lzma-loader"), and this
workaround was only effective because a missing "const" led to the kernel
argv being stored in .data instead of .rodata
- The padding was not only added to the compressed .gz loader, but also
uncompressed .bin and .elf loaders. The prevented embedding the kernel
cmdline in the loader for non-gz loader types.
To fix both issues, move the creation of the padding from the linker script
to the gzip step.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/target/linux/ar71xx/image/lzma-loader/Makefile b/target/linux/ar71xx/image/lzma-loader/Makefile
index 9b81e87306f235d1e7284401828240b9b9787011..738093a958013624abb8f84a3874e1c795da349d 100644
--- a/target/linux/ar71xx/image/lzma-loader/Makefile
+++ b/target/linux/ar71xx/image/lzma-loader/Makefile
@@ -47,7 +47,11 @@ loader-compile: $(PKG_BUILD_DIR)/.prepared
clean all
loader.gz: $(PKG_BUILD_DIR)/loader.bin
- gzip -nc9 $< > $(LOADER_GZ)
+ # Workaround for buggy bootloaders: Some devices
+ # (TP-Link TL-WR1043ND v1) don't work correctly when
+ # the uncompressed loader is too small (probably a cache
+ # invalidation issue)
+ dd if=$< bs=512K conv=sync | gzip -nc9 > $(LOADER_GZ)
loader.elf: $(PKG_BUILD_DIR)/loader.elf
$(CP) $< $(LOADER_ELF)
diff --git a/target/linux/ar71xx/image/lzma-loader/src/loader.lds b/target/linux/ar71xx/image/lzma-loader/src/loader.lds
index 80cc7ca3ecf53a747fc139560b89c233f4343293..01ff85236147dc62bae480b191a44005171b1561 100644
--- a/target/linux/ar71xx/image/lzma-loader/src/loader.lds
+++ b/target/linux/ar71xx/image/lzma-loader/src/loader.lds
@@ -13,7 +13,6 @@ SECTIONS {
.data : {
*(.data)
*(.data.*)
- . = . + 524288; /* workaround for buggy bootloaders */
}
. = ALIGN(32);

View File

@ -1,23 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Wed, 6 Jun 2018 00:27:42 +0200
Subject: ar71xx: lzma-loader: set page size to 4KB
The text section in the ELF loader is aligned to the maximum page size,
which defaults to 64KB. Reduce it to the actual page size to avoid wasting
flash space for this alignment.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/target/linux/ar71xx/image/lzma-loader/src/Makefile b/target/linux/ar71xx/image/lzma-loader/src/Makefile
index 5f10bdb8f1499f24f00a8bf4d53f370fef88bd1e..fadb7e6206070c07aab3e8b323324976c6998eea 100644
--- a/target/linux/ar71xx/image/lzma-loader/src/Makefile
+++ b/target/linux/ar71xx/image/lzma-loader/src/Makefile
@@ -95,7 +95,7 @@ loader2.o: loader.bin
$(LD) -r -b binary --oformat $(O_FORMAT) -o $@ $<
loader.elf: loader2.o
- $(LD) -e startup -T loader2.lds -Ttext $(LOADADDR) -o $@ $<
+ $(LD) -z max-page-size=0x1000 -e startup -T loader2.lds -Ttext $(LOADADDR) -o $@ $<
mrproper: clean

View File

@ -1,22 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Wed, 6 Jun 2018 00:30:57 +0200
Subject: ar71xx: lzma-loader: constify kernel argv array
By making the kernel argv array const, the .data section can always be
omitted from the laoder binary.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/target/linux/ar71xx/image/lzma-loader/src/loader.c b/target/linux/ar71xx/image/lzma-loader/src/loader.c
index cc73eb1721cbfbf2ad1bb94e8e6d3ab006983c5d..794c4b6285a7fa0423c22d172828415e6f2be93b 100644
--- a/target/linux/ar71xx/image/lzma-loader/src/loader.c
+++ b/target/linux/ar71xx/image/lzma-loader/src/loader.c
@@ -75,7 +75,7 @@ static unsigned long kernel_la;
#ifdef CONFIG_KERNEL_CMDLINE
#define kernel_argc 2
static const char kernel_cmdline[] = CONFIG_KERNEL_CMDLINE;
-static const char *kernel_argv[] = {
+static const char *const kernel_argv[] = {
NULL,
kernel_cmdline,
NULL,

Some files were not shown because too many files have changed in this diff Show More