Use LEDE as base for Gluon

This commit is contained in:
Matthias Schiffer 2017-01-18 17:21:43 +01:00
parent 04818c170b
commit 78b2775eec
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C
175 changed files with 1530 additions and 43175 deletions

5
.gitignore vendored
View File

@ -1,7 +1,6 @@
*~ *~
/build /lede
/output /output
/site /site
/openwrt /tmp
/packages /packages
/modules.local

10
LICENSE
View File

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

572
Makefile
View File

@ -4,503 +4,153 @@ LC_ALL:=C
LANG:=C LANG:=C
export LC_ALL LANG export LC_ALL LANG
export SHELL:=/usr/bin/env bash
GLUONPATH ?= $(PATH) GLUON_SITEDIR ?= $(CURDIR)/site
export GLUONPATH := $(GLUONPATH) GLUON_TMPDIR ?= $(CURDIR)/tmp
empty:= GLUON_OUTPUTDIR ?= $(CURDIR)/output
space:= $(empty) $(empty) GLUON_IMAGEDIR ?= $(GLUON_OUTPUTDIR)/images
GLUON_PACKAGEDIR ?= $(GLUON_OUTPUTDIR)/packages
GLUONMAKE_EARLY = PATH=$(GLUONPATH) $(SUBMAKE) -C $(GLUON_ORIGOPENWRTDIR) -f $(GLUONDIR)/Makefile GLUON_TOOLS=0 QUILT= export GLUON_TMPDIR GLUON_IMAGEDIR GLUON_PACKAGEDIR DEVICES
GLUONMAKE = PATH=$(GLUONPATH) $(SUBMAKE) -C $(GLUON_OPENWRTDIR) -f $(GLUONDIR)/Makefile
ifneq ($(OPENWRT_BUILD),1)
GLUONDIR:=${CURDIR} $(GLUON_SITEDIR)/site.mk:
$(error No site configuration was found. Please check out a site configuration to $(GLUON_SITEDIR))
include $(GLUONDIR)/include/gluon.mk -include $(GLUON_SITEDIR)/site.mk
TOPDIR:=$(GLUON_ORIGOPENWRTDIR) ifeq ($(GLUON_RELEASE),)
export TOPDIR $(error GLUON_RELEASE not set. GLUON_RELEASE can be set in site.mk or on the command line.)
endif
GLUON_LANGS ?= en
export GLUON_RELEASE GLUON_ATH10K_MESH GLUON_REGION
update: FORCE update: FORCE
$(GLUONDIR)/scripts/update.sh @scripts/update.sh
$(GLUONDIR)/scripts/patch.sh @scripts/patch.sh
@scripts/feeds.sh
update-patches: FORCE update-patches: FORCE
$(GLUONDIR)/scripts/update.sh @scripts/update.sh
$(GLUONDIR)/scripts/update-patches.sh @scripts/update-patches.sh
$(GLUONDIR)/scripts/patch.sh @scripts/patch.sh
-include $(TOPDIR)/include/host.mk update-feeds: FORCE
@scripts/feeds.sh
_SINGLE=export MAKEFLAGS=$(space);
override OPENWRT_BUILD=1
override GLUON_TOOLS=1
GREP_OPTIONS=
export OPENWRT_BUILD GLUON_TOOLS GREP_OPTIONS
-include $(TOPDIR)/include/debug.mk
-include $(TOPDIR)/include/depends.mk
include $(GLUONDIR)/include/toplevel.mk
include $(GLUONDIR)/targets/targets.mk GLUON_TARGETS :=
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))
endef
include targets/targets.mk
CheckTarget := [ -n '$(GLUON_TARGET)' -a -n '$(GLUON_TARGET_$(GLUON_TARGET)_BOARD)' ] \ LEDEMAKE = $(MAKE) -C lede
|| (echo -e 'Please set GLUON_TARGET to a valid target. Gluon supports the following targets:$(subst $(space),\n * ,$(GLUON_TARGETS))'; false)
BOARD := $(GLUON_TARGET_$(GLUON_TARGET)_BOARD)
SUBTARGET := $(GLUON_TARGET_$(GLUON_TARGET)_SUBTARGET)
LEDE_TARGET := $(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))
export LEDE_TARGET
CheckExternal := test -d $(GLUON_ORIGOPENWRTDIR) || (echo 'You don'"'"'t seem to have obtained the external repositories needed by Gluon; please call `make update` first!'; false) CheckTarget := [ '$(LEDE_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)
create-key: FORCE GLUON_DEFAULT_PACKAGES := -odhcpd -ppp -ppp-mod-pppoe -wpad-mini gluon-core ip6tables hostapd-mini
@$(CheckExternal)
+@$(GLUONMAKE_EARLY) create-key
prepare-target: FORCE GLUON_PACKAGES :=
define merge_packages
$(foreach pkg,$(1),
GLUON_PACKAGES := $$(strip $$(filter-out -$$(patsubst -%,%,$(pkg)) $$(patsubst -%,%,$(pkg)),$$(GLUON_PACKAGES)) $(pkg))
)
endef
$(eval $(call merge_packages,$(GLUON_DEFAULT_PACKAGES) $(GLUON_SITE_PACKAGES)))
GLUON_PACKAGES_YES := $(filter-out -%,$(GLUON_PACKAGES))
GLUON_PACKAGES_NO := $(patsubst -%,%,$(filter -%,$(GLUON_PACKAGES)))
config: FORCE
@$(CheckExternal) @$(CheckExternal)
@$(CheckTarget) @$(CheckTarget)
+@$(GLUONMAKE_EARLY) prepare-target
@( \
echo 'CONFIG_TARGET_$(BOARD)=y' \
$(if $(SUBTARGET),&& echo 'CONFIG_TARGET_$(BOARD)_$(SUBTARGET)=y') \
$(foreach pkg,$(GLUON_PACKAGES_NO),&& echo '# CONFIG_PACKAGE_$(pkg) is not set') \
&& scripts/target_config.sh generic \
&& GLUON_SITEDIR='$(GLUON_SITEDIR)' scripts/target_config.sh '$(GLUON_TARGET)' \
$(foreach pkg,$(GLUON_PACKAGES_YES),&& echo 'CONFIG_PACKAGE_$(pkg)=y') \
$(foreach lang,$(GLUON_LANGS),&& echo 'CONFIG_LUCI_LANG_$(lang)=y') \
&& echo 'CONFIG_GLUON_RELEASE="$(GLUON_RELEASE)"' \
&& echo 'CONFIG_GLUON_SITEDIR="$(GLUON_SITEDIR)"' \
&& echo 'CONFIG_GLUON_BRANCH="$(GLUON_BRANCH)"' \
) > lede/.config
+@$(LEDEMAKE) defconfig
@GLUON_SITEDIR='$(GLUON_SITEDIR)' scripts/target_config_check.sh '$(GLUON_TARGET)' '$(GLUON_PACKAGES_YES)'
LUA := lede/staging_dir/hostpkg/bin/lua
$(LUA):
@$(CheckExternal)
+@[ -e lede/.config ] || $(LEDEMAKE) defconfig
+@$(LEDEMAKE) tools/install
+@$(LEDEMAKE) package/lua/host/install
prepare-target: config $(LUA) ;
all: prepare-target all: prepare-target
+@$(GLUONMAKE) build-key @GLUON_SITEDIR='$(GLUON_SITEDIR)' $(LUA) scripts/site_config.lua \
+@$(GLUONMAKE) prepare || (echo 'Your site configuration did not pass validation.'; false)
+@$(GLUONMAKE) images
+@$(GLUONMAKE) modules
prepare: prepare-target @scripts/clean_output.sh
+@$(GLUONMAKE) build-key +@$(LEDEMAKE)
+@$(GLUONMAKE) $@ @GLUON_SITEDIR='$(GLUON_SITEDIR)' scripts/copy_output.sh '$(GLUON_TARGET)'
clean download images modules: FORCE clean download: config
@$(CheckExternal) +@$(LEDEMAKE) $@
@$(CheckTarget)
+@$(GLUONMAKE_EARLY) maybe-prepare-target
+@$(GLUONMAKE) build-key
+@$(GLUONMAKE) $@
toolchain/% package/% target/% image/%: FORCE dirclean: FORCE
@$(CheckExternal) +@[ -e lede/.config ] || $(LEDEMAKE) defconfig
@$(CheckTarget) +@$(LEDEMAKE) dirclean
+@$(GLUONMAKE_EARLY) maybe-prepare-target @rm -rf $(GLUON_TMPDIR) $(GLUON_OUTPUTDIR)
+@$(GLUONMAKE) build-key
+@$(GLUONMAKE) $@
manifest: FORCE manifest: $(LUA) FORCE
@[ -n '$(GLUON_BRANCH)' ] || (echo 'Please set GLUON_BRANCH to create a manifest.'; false) @[ '$(GLUON_BRANCH)' ] || (echo 'Please set GLUON_BRANCH to create a manifest.'; false)
@echo '$(GLUON_PRIORITY)' | grep -qE '^([0-9]*\.)?[0-9]+$$' || (echo 'Please specify a numeric value for GLUON_PRIORITY to create a manifest.'; false) @echo '$(GLUON_PRIORITY)' | grep -qE '^([0-9]*\.)?[0-9]+$$' || (echo 'Please specify a numeric value for GLUON_PRIORITY to create a manifest.'; false)
@$(CheckExternal) @$(CheckExternal)
( \ @( \
echo 'BRANCH=$(GLUON_BRANCH)' && \ echo 'BRANCH=$(GLUON_BRANCH)' && \
echo 'DATE=$(shell $(GLUON_ORIGOPENWRTDIR)/staging_dir/host/bin/lua $(GLUONDIR)/scripts/rfc3339date.lua)' && \ echo "DATE=$$($(LUA) scripts/rfc3339date.lua)" && \
echo 'PRIORITY=$(GLUON_PRIORITY)' && \ echo 'PRIORITY=$(GLUON_PRIORITY)' && \
echo \ echo && \
) > $(GLUON_BUILDDIR)/$(GLUON_BRANCH).manifest.tmp $(foreach GLUON_TARGET,$(GLUON_TARGETS), \
GLUON_SITEDIR='$(GLUON_SITEDIR)' scripts/generate_manifest.sh '$(GLUON_TARGET)' && \
+($(foreach GLUON_TARGET,$(GLUON_TARGETS), \
( [ ! -e $(BOARD_BUILDDIR)/prepared ] || ( $(GLUONMAKE) manifest GLUON_TARGET='$(GLUON_TARGET)' V=s$(OPENWRT_VERBOSE) ) ) && \
) :)
mkdir -p $(GLUON_IMAGEDIR)/sysupgrade
mv $(GLUON_BUILDDIR)/$(GLUON_BRANCH).manifest.tmp $(GLUON_IMAGEDIR)/sysupgrade/$(GLUON_BRANCH).manifest
dirclean : FORCE
for dir in build_dir dl staging_dir tmp; do \
rm -rf $(GLUON_ORIGOPENWRTDIR)/$$dir; \
done
rm -rf $(GLUON_BUILDDIR) $(GLUON_OUTPUTDIR)
else
TOPDIR=${CURDIR}
export TOPDIR
include rules.mk
include $(GLUONDIR)/include/gluon.mk
include $(INCLUDE_DIR)/host.mk
include $(INCLUDE_DIR)/depends.mk
include $(INCLUDE_DIR)/subdir.mk
include package/Makefile
include tools/Makefile
include toolchain/Makefile
include target/Makefile
PROFILES :=
PROFILE_PACKAGES :=
define Profile
$(eval $(call Profile/Default))
$(eval $(call Profile/$(1)))
endef
define GluonProfile
PROFILES += $(1)
PROFILE_PACKAGES += $(filter-out -%,$(2) $(GLUON_$(1)_SITE_PACKAGES))
GLUON_$(1)_PROFILE := $(if $(3),$(3),$(1))
GLUON_$(1)_DEFAULT_PACKAGES := $(2)
GLUON_$(1)_FACTORY_SUFFIX := -squashfs-factory
GLUON_$(1)_SYSUPGRADE_SUFFIX := -squashfs-sysupgrade
GLUON_$(1)_FACTORY_EXT := .bin
GLUON_$(1)_SYSUPGRADE_EXT := .bin
GLUON_$(1)_FACTORY_EXTRA :=
GLUON_$(1)_SYSUPGRADE_EXTRA :=
GLUON_$(1)_MODELS :=
endef
define GluonProfileFactorySuffix
GLUON_$(1)_FACTORY_SUFFIX := $(2)
GLUON_$(1)_FACTORY_EXT := $(3)
GLUON_$(1)_FACTORY_EXTRA := $(4)
endef
define GluonProfileSysupgradeSuffix
GLUON_$(1)_SYSUPGRADE_SUFFIX := $(2)
GLUON_$(1)_SYSUPGRADE_EXT := $(3)
GLUON_$(1)_SYSUPGRADE_EXTRA := $(4)
endef
define GluonModel
GLUON_$(1)_MODELS += $(3)
GLUON_$(1)_MODEL_$(3) := $(2)
GLUON_$(1)_MODEL_$(3)_ALIASES :=
endef
define GluonModelAlias
GLUON_$(1)_MODEL_$(2)_ALIASES += $(3)
endef
export SHA512SUM := $(GLUONDIR)/scripts/sha512sum.sh
prereq: FORCE
+$(NO_TRACE_MAKE) prereq
prepare-tmpinfo: FORCE
@+$(MAKE) -r -s staging_dir/host/.prereq-build OPENWRT_BUILD= QUIET=0
mkdir -p tmp/info
$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET="packageinfo" SCAN_DIR="package" SCAN_NAME="package" SCAN_DEPS="$(TOPDIR)/include/package*.mk $(TOPDIR)/overlay/*/*.mk" SCAN_EXTRA=""
$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET="targetinfo" SCAN_DIR="target/linux" SCAN_NAME="target" SCAN_DEPS="profiles/*.mk $(TOPDIR)/include/kernel*.mk $(TOPDIR)/include/target.mk" SCAN_DEPTH=2 SCAN_EXTRA="" SCAN_MAKEOPTS="TARGET_BUILD=1"
for type in package target; do \
f=tmp/.$${type}info; t=tmp/.config-$${type}.in; \
[ "$$t" -nt "$$f" ] || ./scripts/metadata.pl $${type}_config "$$f" > "$$t" || { rm -f "$$t"; echo "Failed to build $$t"; false; break; }; \
done
[ tmp/.config-feeds.in -nt tmp/.packagefeeds ] || ./scripts/feeds feed_config > tmp/.config-feeds.in
./scripts/metadata.pl package_mk tmp/.packageinfo > tmp/.packagedeps || { rm -f tmp/.packagedeps; false; }
./scripts/metadata.pl package_feeds tmp/.packageinfo > tmp/.packagefeeds || { rm -f tmp/.packagefeeds; false; }
touch $(TOPDIR)/tmp/.build
feeds: FORCE
rm -rf $(TOPDIR)/package/feeds
mkdir $(TOPDIR)/package/feeds
[ ! -f $(GLUON_SITEDIR)/modules ] || . $(GLUON_SITEDIR)/modules && for feed in $$GLUON_SITE_FEEDS; do ln -s ../../../packages/$$feed $(TOPDIR)/package/feeds/$$feed; done
ln -s ../../../package $(TOPDIR)/package/feeds/gluon
. $(GLUONDIR)/modules && for feed in $$GLUON_FEEDS; do ln -s ../../../packages/$$feed $(TOPDIR)/package/feeds/module_$$feed; done
+$(GLUONMAKE_EARLY) prepare-tmpinfo
gluon-tools: FORCE
+$(GLUONMAKE_EARLY) tools/patch/install
+$(GLUONMAKE_EARLY) tools/sed/install
+$(GLUONMAKE_EARLY) tools/cmake/install
+$(GLUONMAKE_EARLY) package/lua/host/install package/usign/host/install
early_prepared_stamp := $(GLUON_BUILDDIR)/prepared_$(shell \
( \
$(SHA512SUM) $(GLUONDIR)/modules; \
[ ! -r $(GLUON_SITEDIR)/modules ] || $(SHA512SUM) $(GLUON_SITEDIR)/modules \
) | $(SHA512SUM) )
prepare-early: FORCE
for dir in build_dir dl staging_dir; do \
mkdir -p $(GLUON_ORIGOPENWRTDIR)/$$dir; \
done
+$(GLUONMAKE_EARLY) feeds
+$(GLUONMAKE_EARLY) gluon-tools
mkdir -p $$(dirname $(early_prepared_stamp))
touch $(early_prepared_stamp)
$(early_prepared_stamp):
rm -f $(GLUON_BUILDDIR)/prepared_*
+$(GLUONMAKE_EARLY) prepare-early
$(GLUON_OPKG_KEY): $(early_prepared_stamp) FORCE
[ -s $(GLUON_OPKG_KEY) -a -s $(GLUON_OPKG_KEY).pub ] || \
( mkdir -p $$(dirname $(GLUON_OPKG_KEY)) && $(STAGING_DIR_HOST)/bin/usign -G -s $(GLUON_OPKG_KEY) -p $(GLUON_OPKG_KEY).pub -c "Gluon opkg key" )
$(GLUON_OPKG_KEY).pub: $(GLUON_OPKG_KEY)
create-key: $(GLUON_OPKG_KEY).pub
include $(GLUONDIR)/targets/targets.mk
ifneq ($(GLUON_TARGET),)
include $(GLUONDIR)/targets/$(GLUON_TARGET)/profiles.mk
BOARD := $(GLUON_TARGET_$(GLUON_TARGET)_BOARD)
override SUBTARGET := $(GLUON_TARGET_$(GLUON_TARGET)_SUBTARGET)
target_prepared_stamp := $(BOARD_BUILDDIR)/target-prepared
gluon_prepared_stamp := $(BOARD_BUILDDIR)/prepared
PREPARED_RELEASE = $$(cat $(gluon_prepared_stamp))
IMAGE_PREFIX = gluon-$(GLUON_SITE_CODE)-$(PREPARED_RELEASE)
MODULE_PREFIX = gluon-$(GLUON_SITE_CODE)-$(PREPARED_RELEASE)
include $(INCLUDE_DIR)/target.mk
build-key: FORCE
rm -f $(BUILD_KEY) $(BUILD_KEY).pub
cp $(GLUON_OPKG_KEY) $(BUILD_KEY)
cp $(GLUON_OPKG_KEY).pub $(BUILD_KEY).pub
config: FORCE
+$(NO_TRACE_MAKE) scripts/config/conf OPENWRT_BUILD= QUIET=0
+$(GLUONMAKE) prepare-tmpinfo
( \
cat $(GLUONDIR)/include/config; \
echo 'CONFIG_TARGET_$(GLUON_TARGET_$(GLUON_TARGET)_BOARD)=y'; \
$(if $(GLUON_TARGET_$(GLUON_TARGET)_SUBTARGET), \
echo 'CONFIG_TARGET_$(GLUON_TARGET_$(GLUON_TARGET)_BOARD)_$(GLUON_TARGET_$(GLUON_TARGET)_SUBTARGET)=y'; \
) \
cat $(GLUONDIR)/targets/$(GLUON_TARGET)/config 2>/dev/null; \
echo 'CONFIG_BUILD_SUFFIX="gluon-$(GLUON_TARGET)"'; \
echo '$(patsubst %,CONFIG_PACKAGE_%=m,$(sort $(filter-out -%,$(DEFAULT_PACKAGES) $(GLUON_DEFAULT_PACKAGES) $(GLUON_SITE_PACKAGES) $(PROFILE_PACKAGES))))' \
| sed -e 's/ /\n/g'; \
echo '$(patsubst %,CONFIG_LUCI_LANG_%=y,$(GLUON_LANGS))' \
| sed -e 's/ /\n/g'; \
) > $(BOARD_BUILDDIR)/config.tmp
scripts/config/conf --defconfig=$(BOARD_BUILDDIR)/config.tmp Config.in
+$(SUBMAKE) tools/install
prepare-target: $(GLUON_OPKG_KEY).pub
rm $(GLUON_OPENWRTDIR)/tmp || true
mkdir -p $(GLUON_OPENWRTDIR)/tmp
for link in build_dir config Config.in dl include Makefile package rules.mk scripts staging_dir target toolchain tools; do \
ln -sf $(GLUON_ORIGOPENWRTDIR)/$$link $(GLUON_OPENWRTDIR); \
done
+$(GLUONMAKE) config
touch $(target_prepared_stamp)
$(target_prepared_stamp):
+$(GLUONMAKE_EARLY) prepare-target
maybe-prepare-target: $(target_prepared_stamp)
+$(GLUONMAKE_EARLY) $(GLUON_OPKG_KEY).pub
$(BUILD_DIR)/.prepared: Makefile
@mkdir -p $$(dirname $@)
@touch $@
$(toolchain/stamp-install): $(tools/stamp-install)
$(package/stamp-compile): $(package/stamp-cleanup)
clean: FORCE
+$(SUBMAKE) clean
rm -f $(gluon_prepared_stamp)
download: FORCE
+$(SUBMAKE) tools/download
+$(SUBMAKE) toolchain/download
+$(SUBMAKE) package/download
+$(SUBMAKE) target/download
toolchain: $(toolchain/stamp-install) $(tools/stamp-install)
include $(INCLUDE_DIR)/kernel.mk
kernel: FORCE
+$(NO_TRACE_MAKE) -C $(TOPDIR)/target/linux/$(BOARD) $(LINUX_DIR)/.image TARGET_BUILD=1
+$(NO_TRACE_MAKE) -C $(TOPDIR)/target/linux/$(BOARD) $(LINUX_DIR)/.modules TARGET_BUILD=1
packages: $(package/stamp-compile)
$(_SINGLE)$(SUBMAKE) -r package/index
prepare-image: FORCE
rm -rf $(BOARD_KDIR)
mkdir -p $(BOARD_KDIR)
-cp $(KERNEL_BUILD_DIR)/* $(BOARD_KDIR)/
+$(SUBMAKE) -C $(TOPDIR)/target/linux/$(BOARD)/image image_prepare KDIR="$(BOARD_KDIR)"
prepare: FORCE
@$(STAGING_DIR_HOST)/bin/lua $(GLUONDIR)/scripts/site_config.lua \
|| (echo 'Your site configuration did not pass validation.'; false)
mkdir -p $(GLUON_IMAGEDIR) $(BOARD_BUILDDIR)
echo 'src packages file:../openwrt/bin/$(BOARD)/packages' > $(BOARD_BUILDDIR)/opkg.conf
+$(GLUONMAKE) toolchain
+$(GLUONMAKE) kernel
+$(GLUONMAKE) packages
+$(GLUONMAKE) prepare-image
echo "$(GLUON_RELEASE)" > $(gluon_prepared_stamp)
$(gluon_prepared_stamp):
+$(GLUONMAKE) prepare
modules: FORCE $(gluon_prepared_stamp)
-rm -f $(GLUON_MODULEDIR)/*/$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic)/*
-rmdir -p $(GLUON_MODULEDIR)/*/$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic)
mkdir -p $(GLUON_MODULEDIR)/$(MODULE_PREFIX)/$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic)
cp $(PACKAGE_DIR)/kmod-*.ipk $(GLUON_MODULEDIR)/$(MODULE_PREFIX)/$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic)
$(_SINGLE)$(SUBMAKE) -r package/index PACKAGE_DIR=$(GLUON_MODULEDIR)/$(MODULE_PREFIX)/$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic)
include $(INCLUDE_DIR)/package-ipkg.mk
# override variables from rules.mk
PACKAGE_DIR = $(GLUON_OPENWRTDIR)/bin/$(BOARD)/packages
PROFILE_BUILDDIR = $(BOARD_BUILDDIR)/profiles/$(PROFILE)
PROFILE_KDIR = $(PROFILE_BUILDDIR)/kernel
BIN_DIR = $(PROFILE_BUILDDIR)/images
TARGET_DIR = $(PROFILE_BUILDDIR)/root
OPKG:= \
TMPDIR="$(TMP_DIR)" \
IPKG_INSTROOT="$(TARGET_DIR)" \
IPKG_CONF_DIR="$(TMP_DIR)" \
IPKG_OFFLINE_ROOT="$(TARGET_DIR)" \
$(STAGING_DIR_HOST)/bin/opkg \
-f $(BOARD_BUILDDIR)/opkg.conf \
--cache $(TMP_DIR)/dl \
--offline-root $(TARGET_DIR) \
--force-postinstall \
--add-dest root:/ \
--add-arch all:100 \
--add-arch $(ARCH_PACKAGES):200
EnableInitscript = ! grep -q '\#!/bin/sh /etc/rc.common' $(1) || bash ./etc/rc.common $(1) enable
enable_initscripts: FORCE
cd $(TARGET_DIR) && ( export IPKG_INSTROOT=$(TARGET_DIR); \
$(foreach script,$(wildcard $(TARGET_DIR)/etc/init.d/*), \
$(call EnableInitscript,$(script)); \
) : \ ) : \
) ) > 'tmp/$(GLUON_BRANCH).manifest.tmp'
@mkdir -p '$(GLUON_IMAGEDIR)/sysupgrade'
@mv 'tmp/$(GLUON_BRANCH).manifest.tmp' '$(GLUON_IMAGEDIR)/sysupgrade/$(GLUON_BRANCH).manifest'
# Generate package list FORCE: ;
$(eval $(call merge-lists,INSTALL_PACKAGES,DEFAULT_PACKAGES GLUON_DEFAULT_PACKAGES GLUON_SITE_PACKAGES GLUON_$(PROFILE)_DEFAULT_PACKAGES GLUON_$(PROFILE)_SITE_PACKAGES))
package_install: FORCE .PHONY: FORCE
$(OPKG) update .NOTPARALLEL:
$(OPKG) install $(PACKAGE_DIR)/base-files_*.ipk $(PACKAGE_DIR)/libc_*.ipk
$(OPKG) install $(PACKAGE_DIR)/kernel_*.ipk
$(OPKG) install $(INSTALL_PACKAGES)
+$(GLUONMAKE) enable_initscripts
rm -f $(TARGET_DIR)/usr/lib/opkg/lists/* $(TARGET_DIR)/tmp/opkg.lock
rm -f $(TARGET_DIR)/usr/lib/opkg/info/*.postinst*
# Remove opkg database when opkg is not intalled
if [ ! -x $(TARGET_DIR)/bin/opkg ]; then rm -rf $(TARGET_DIR)/usr/lib/opkg; fi
include $(INCLUDE_DIR)/version.mk
opkg_config: FORCE
for d in base packages luci routing telephony management; do \
echo "src/gz %n_$$d %U/$$d"; \
done > $(TARGET_DIR)/etc/opkg/distfeeds.conf
$(VERSION_SED) $(TARGET_DIR)/etc/opkg/distfeeds.conf
image: FORCE
rm -rf $(TARGET_DIR) $(BIN_DIR) $(PROFILE_KDIR)
mkdir -p $(TARGET_DIR) $(BIN_DIR) $(TARGET_DIR)/tmp $(GLUON_IMAGEDIR)/factory $(GLUON_IMAGEDIR)/sysupgrade
cp -r $(BOARD_KDIR) $(PROFILE_KDIR)
+$(GLUONMAKE) package_install
+$(GLUONMAKE) opkg_config
$(call Image/mkfs/prepare)
$(_SINGLE)$(NO_TRACE_MAKE) -C $(TOPDIR)/target/linux/$(BOARD)/image install TARGET_BUILD=1 IMG_PREFIX=gluon \
PROFILE="$(GLUON_$(PROFILE)_PROFILE)" KDIR="$(PROFILE_KDIR)" TARGET_DIR="$(TARGET_DIR)" BIN_DIR="$(BIN_DIR)" TMP_DIR="$(TMP_DIR)"
$(foreach model,$(GLUON_$(PROFILE)_MODELS), \
$(if $(GLUON_$(PROFILE)_SYSUPGRADE_EXT), \
rm -f $(GLUON_IMAGEDIR)/sysupgrade/gluon-*-$(model)-sysupgrade$(GLUON_$(PROFILE)_SYSUPGRADE_EXT) && \
cp $(BIN_DIR)/gluon-$(GLUON_$(PROFILE)_MODEL_$(model))$(GLUON_$(PROFILE)_SYSUPGRADE_SUFFIX)$(GLUON_$(PROFILE)_SYSUPGRADE_EXT) $(GLUON_IMAGEDIR)/sysupgrade/$(IMAGE_PREFIX)-$(model)-sysupgrade$(GLUON_$(PROFILE)_SYSUPGRADE_EXT) && \
) \
$(if $(GLUON_$(PROFILE)_FACTORY_EXT), \
rm -f $(GLUON_IMAGEDIR)/factory/gluon-*-$(model)$(GLUON_$(PROFILE)_FACTORY_EXT) && \
cp $(BIN_DIR)/gluon-$(GLUON_$(PROFILE)_MODEL_$(model))$(GLUON_$(PROFILE)_FACTORY_SUFFIX)$(GLUON_$(PROFILE)_FACTORY_EXT) $(GLUON_IMAGEDIR)/factory/$(IMAGE_PREFIX)-$(model)$(GLUON_$(PROFILE)_FACTORY_EXT) && \
) \
\
$(if $(GLUON_$(PROFILE)_SYSUPGRADE_EXTRA), \
rm -f $(GLUON_IMAGEDIR)/sysupgrade/gluon-*-$(model)-sysupgrade$(GLUON_$(PROFILE)_SYSUPGRADE_EXTRA) && \
cp $(BIN_DIR)/gluon$(GLUON_$(PROFILE)_SYSUPGRADE_EXTRA) $(GLUON_IMAGEDIR)/sysupgrade/$(IMAGE_PREFIX)-$(model)-sysupgrade$(GLUON_$(PROFILE)_SYSUPGRADE_EXTRA) && \
) \
$(if $(GLUON_$(PROFILE)_FACTORY_EXTRA), \
rm -f $(GLUON_IMAGEDIR)/factory/gluon-*-$(model)$(GLUON_$(PROFILE)_FACTORY_EXTRA) && \
cp $(BIN_DIR)/gluon$(GLUON_$(PROFILE)_FACTORY_EXTRA) $(GLUON_IMAGEDIR)/factory/$(IMAGE_PREFIX)-$(model)$(GLUON_$(PROFILE)_FACTORY_EXTRA) && \
) \
\
$(foreach alias,$(GLUON_$(PROFILE)_MODEL_$(model)_ALIASES), \
$(if $(GLUON_$(PROFILE)_SYSUPGRADE_EXT), \
rm -f $(GLUON_IMAGEDIR)/sysupgrade/gluon-*-$(alias)-sysupgrade$(GLUON_$(PROFILE)_SYSUPGRADE_EXT) && \
ln -s $(IMAGE_PREFIX)-$(model)-sysupgrade$(GLUON_$(PROFILE)_SYSUPGRADE_EXT) $(GLUON_IMAGEDIR)/sysupgrade/$(IMAGE_PREFIX)-$(alias)-sysupgrade$(GLUON_$(PROFILE)_SYSUPGRADE_EXT) && \
) \
$(if $(GLUON_$(PROFILE)_FACTORY_EXT), \
rm -f $(GLUON_IMAGEDIR)/factory/gluon-*-$(alias)$(GLUON_$(PROFILE)_FACTORY_EXT) && \
ln -s $(IMAGE_PREFIX)-$(model)$(GLUON_$(PROFILE)_FACTORY_EXT) $(GLUON_IMAGEDIR)/factory/$(IMAGE_PREFIX)-$(alias)$(GLUON_$(PROFILE)_FACTORY_EXT) && \
) \
) \
) :
image/%: $(gluon_prepared_stamp)
+$(GLUONMAKE) image PROFILE="$(patsubst image/%,%,$@)" V=s$(OPENWRT_VERBOSE)
call_image/%: FORCE
+$(GLUONMAKE) $(patsubst call_image/%,image/%,$@)
images: $(patsubst %,call_image/%,$(PROFILES)) ;
manifest: FORCE
( \
cd $(GLUON_IMAGEDIR)/sysupgrade; \
$(foreach profile,$(PROFILES), \
$(if $(GLUON_$(profile)_SYSUPGRADE_EXT), \
$(foreach model,$(GLUON_$(profile)_MODELS), \
file="$(IMAGE_PREFIX)-$(model)-sysupgrade$(GLUON_$(profile)_SYSUPGRADE_EXT)"; \
[ -e "$$file" ] && echo '$(model)' "$(PREPARED_RELEASE)" "$$($(SHA512SUM) "$$file")" "$$file"; \
\
$(foreach alias,$(GLUON_$(profile)_MODEL_$(model)_ALIASES), \
file="$(IMAGE_PREFIX)-$(alias)-sysupgrade$(GLUON_$(profile)_SYSUPGRADE_EXT)"; \
[ -e "$$file" ] && echo '$(alias)' "$(PREPARED_RELEASE)" "$$($(SHA512SUM) "$$file")" "$$file"; \
) \
) \
) \
) : \
) >> $(GLUON_BUILDDIR)/$(GLUON_BRANCH).manifest.tmp
.PHONY: all create-key prepare images modules clean gluon-tools manifest
endif
endif

View File

@ -11,57 +11,114 @@ is a requirement. At the moment, Gluon's scripts can't handle devices
without WLAN adapters (although such environments may also be interesting, without WLAN adapters (although such environments may also be interesting,
e.g. for automated testing in virtual machines). e.g. for automated testing in virtual machines).
.. _hardware-adding-profiles: .. _hardware-adding-profiles:
Adding profiles Adding profiles
--------------- ---------------
The vast majority of devices with ath9k WLAN uses the ar71xx target of OpenWrt. The vast majority of devices with ath9k WLAN uses the ar71xx target of LEDE.
If the hardware you want to add support for is also ar71xx, adding a new profile If the hardware you want to add support for is also ar71xx, adding a new profile
is enough. is enough.
Profiles are defined in ``targets/<target>-<subtarget>/profiles.mk``. There are two macros Profiles are defined in ``targets/*`` in a shell-based DSL (so common shell
used to define which images are generated: ``GluonProfile`` and ``GluonModel``. The following examples commands syntax like ``if`` can be used.
are taken from ``profiles.mk`` of the ``ar71xx-generic`` target::
$(eval $(call GluonProfile,TLWR1043)) The ``device`` command is used to define an image build for a device. It takes
$(eval $(call GluonModel,TLWR1043,tl-wr1043nd-v1-squashfs,tp-link-tl-wr1043n-nd-v1)) two or three parameters.
$(eval $(call GluonModel,TLWR1043,tl-wr1043nd-v2-squashfs,tp-link-tl-wr1043n-nd-v2))
The ``GluonProfile`` macro takes at least one parameter, the profile name as it is The first parameter defines the Gluon profile name, which is used to refer to the
defined in the Makefiles of OpenWrt (``openwrt/target/linux/<target>/<subtarget>/profiles/*`` device and is part of the generated image name. The profile name must be same as
and ``openwrt/target/linux/<target>/image/Makefile``). If the target you are on doesn't define the output of the following command (on the target device), so the autoupdater
profiles (e.g. on x86), just add a single profile called ``Generic`` or similar. can work::
It may optionally take a second parameter which defines additional packages to include for the profile
(e.g. ath10k). The additional packages defined in ``openwrt/target/linux/<target>/<subtarget>/profiles/*``
aren't used.
The ``GluonModel`` macro takes three parameters: The profile name, the suffix of the image file
generated by OpenWrt (without the file extension), and the final image name of the Gluon image.
The final image name must be the same that is returned by the following command.
::
lua -e 'print(require("platform_info").get_image_name())' lua -e 'print(require("platform_info").get_image_name())'
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
can be found in the image Makefiles in ``lede/target/linux/<target>/image/Makefile``.
This is just so the autoupdater can work. The command has to be executed _on_ the target (eg. the hardware router with a flashed image). So you'll first have to build an image with a guessed name, and afterwards build a new, correctly named image. On targets which aren't supported by the autoupdater, Examples::
``require("platform_info").get_image_name()`` will just return ``nil`` and the final image name
may be defined arbitrarily. device tp-link-tl-wr1043n-nd-v1 tl-wr1043nd-v1
device alfa-network-hornet-ub hornet-ub HORNETUB
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
``-squashfs-factory`` and ``-squashfs-sysupgrade``.
This can be changed using the ``factory`` and ``sysupgrade`` commands, either at
the top of the file to set the defaults for all images, or for a single image. There
are three forms with 0 to 2 arguments (all work with ``sysupgrade`` as well)::
factory SUFFIX .EXT
factory .EXT
factory
When only an extension is given, the default suffix is retained. When no arguments
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``
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
can't be used. Instead, ``factory_image`` and ``sysupgrade_image`` are used::
factory_image PROFILE IMAGE .EXT
sysupgrade_image PROFILE IMAGE .EXT
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.
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
packages are excluded instead.
The ``packages`` command may be used at the top of a target definition to modify
the default package list for all images, or just for a single device (when the
target supports *per-default rootfs*).
Configuration
'''''''''''''
The ``config`` command allows to add arbitary target-specific LEDE configuration
to be emitted to ``.config``.
Notes
'''''
On devices with multiple WLAN adapters, care must also be taken that the primary MAC address is On devices with multiple WLAN adapters, care must also be taken that the primary MAC address is
configured correctly. ``/lib/gluon/core/sysconfig/primary_mac`` should contain the MAC address which 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`` 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 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 an OpenWrt bug was the cause). even on devices with only one WLAN adapter, in these cases a LEDE bug was the cause).
Adding support for new hardware targets Adding support for new hardware targets
--------------------------------------- ---------------------------------------
Adding a new target is much more complex than adding a new profile. There are two basic steps Adding a new target is much more complex than adding a new profile. There are two basic steps
required for adding a new target: required for adding a new target:
Adjust packages Package adjustments
''''''''''''''' '''''''''''''''''''
One package that definitely needs adjustments for every new target added is ``libplatforminfo`` (to be found in One package that definitely needs adjustments for every new target added is ``libplatforminfo`` (to be found in
`packages/gluon/libs/libplatforminfo <https://github.com/freifunk-gluon/packages/tree/master/libs/libplatforminfo>`_). `packages/gluon/libs/libplatforminfo <https://github.com/freifunk-gluon/packages/tree/master/libs/libplatforminfo>`_).
Start with a copy of an existing platform info source file and adjust it for the new target (or just add a symlink if Start with a copy of an existing platform info source file and adjust it for the new target (or just add a symlink if
@ -71,15 +128,14 @@ On many targets, Gluon's network setup scripts (mainly in the packages ``gluon-c
won't run correctly without some adjustments, so better double check that everything is fine there (and the files won't run correctly without some adjustments, so better double check that everything is fine there (and the files
``primary_mac``, ``lan_ifname`` and ``wan_ifname`` in ``/lib/gluon/core/sysconfig/`` contain sensible values). ``primary_mac``, ``lan_ifname`` and ``wan_ifname`` in ``/lib/gluon/core/sysconfig/`` contain sensible values).
Add support to the build system Build system support
''''''''''''''''''''''''''''''' ''''''''''''''''''''
A directory for the new target must be created under ``targets``, and it must be added
to ``targets/targets.mk``. In the new target directory, the following files must be created:
* profiles.mk A definition for the new target must be created under ``targets``, and it must be added
* config (optional) 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
For ``profiles.mk``, see :ref:`hardware-adding-profiles`. LEDE subtarget name (if it differs from the Gluon subtarget). The third argument
The file ``config`` can be used to add additional, target-specific options to the OpenWrt config. 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.
After this, is should be sufficient to call ``make GLUON_TARGET=<target>`` to build the images for the new target. After this, is should be sufficient to call ``make GLUON_TARGET=<target>`` to build the images for the new target.

View File

@ -1,11 +1,9 @@
## gluon site.mk makefile example ## gluon site.mk makefile example
## GLUON_SITE_PACKAGES ## GLUON_SITE_PACKAGES
# specify gluon/openwrt packages to include here # specify Gluon/LEDE packages to include here
# The gluon-mesh-batman-adv-* package must come first because of the dependency resolution
GLUON_SITE_PACKAGES := \ GLUON_SITE_PACKAGES := \
gluon-mesh-batman-adv-15 \
gluon-alfred \ gluon-alfred \
gluon-respondd \ gluon-respondd \
gluon-autoupdater \ gluon-autoupdater \
@ -21,6 +19,7 @@ GLUON_SITE_PACKAGES := \
gluon-luci-autoupdater \ gluon-luci-autoupdater \
gluon-luci-portconfig \ gluon-luci-portconfig \
gluon-luci-wifi-config \ gluon-luci-wifi-config \
gluon-mesh-batman-adv-15 \
gluon-mesh-vpn-fastd \ gluon-mesh-vpn-fastd \
gluon-radvd \ gluon-radvd \
gluon-setup-mode \ gluon-setup-mode \

View File

@ -85,7 +85,6 @@ Next go back to the top-level Gluon directory and build Gluon::
make update # Get other repositories used by Gluon make update # Get other repositories used by Gluon
make GLUON_TARGET=ar71xx-generic # Build Gluon make GLUON_TARGET=ar71xx-generic # Build Gluon
When calling make, the OpenWrt build environment is prepared/updated.
In case of errors read the messages carefully and try to fix the stated issues (e.g. install tools not available yet). In case of errors read the messages carefully and try to fix the stated issues (e.g. install tools not available yet).
``ar71xx-generic`` is the most common target and will generate images for most of the supported hardware. ``ar71xx-generic`` is the most common target and will generate images for most of the supported hardware.
@ -95,7 +94,7 @@ You should reserve about 10GB of disk space for each `GLUON_TARGET`.
The built images can be found in the directory `output/images`. Of these, the `factory` 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, 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-based and `sysupgrade` is to upgrade from other versions of Gluon or any other OpenWrt/LEDE-based
system. system.
**Note:** The images for some models are identical; to save disk space, symlinks are generated instead **Note:** The images for some models are identical; to save disk space, symlinks are generated instead
@ -111,39 +110,25 @@ There are two levels of `make clean`::
make clean GLUON_TARGET=ar71xx-generic make clean GLUON_TARGET=ar71xx-generic
will ensure all packages are rebuilt for a single target; this is what you normally want to do after an update. will ensure all packages are rebuilt for a single target. This normally not
necessary, but may fix certain kinds of build failures.
:: ::
make dirclean make dirclean
will clean the entire tree, so the toolchain will be rebuilt as well, which is will clean the entire tree, so the toolchain will be rebuilt as well, which will take a while.
not necessary in most cases, and will take a while.
So in summary, to update and rebuild a Gluon build tree, the following commands should be used (repeat the
``make clean`` and ``make`` for all targets you want to build):
::
git pull
(cd site && git pull)
make update
make clean GLUON_TARGET=ar71xx-generic
make GLUON_TARGET=ar71xx-generic
opkg repositories opkg repositories
----------------- -----------------
Gluon is mostly compatible with OpenWrt, so the normal OpenWrt package repositories Gluon is mostly compatible with LEDE, so the normal LEDE package repositories
can be used for Gluon as well. It is advisable to setup a mirror or reverse proxy can be used for Gluon as well.
reachable over IPv6 and add it to ``site.conf`` as http://downloads.openwrt.org/ does
not support IPv6.
This is not true for kernel modules; the Gluon kernel is incompatible with the This is not true for kernel modules; the Gluon kernel is incompatible with the
kernel of the default OpenWrt images. Therefore, Gluon will not only generate images, kernel of the default LEDE images. Therefore, Gluon will not only generate images,
but also an opkg repository containing all kernel modules provided by OpenWrt/Gluon but also an opkg repository containing all core packages provided by LEDE,
for the kernel of the generated images. including modules for the kernel of the generated images.
Signing keys Signing keys
............ ............
@ -151,18 +136,14 @@ Signing keys
Gluon does not support HTTPS for downloading packages; fortunately, opkg deploys Gluon does not support HTTPS for downloading packages; fortunately, opkg deploys
public-key cryptography to ensure package integrity. public-key cryptography to ensure package integrity.
The Gluon images will contain two public keys: the official OpenWrt signing key The Gluon images will contain public keys from two sources: the official LEDE keyring
(to allow installing userspace packages) and a Gluon-specific key (which is used (to allow installing userspace packages) and a Gluon-specific key (which is used
to sign the generated module repository). to sign the generated package repository).
By default, Gluon will handle the generation and handling of the keys itself. LEDE will handle the generation and handling of the keys itself.
When making firmware releases based on Gluon, it might make sense to store When making firmware releases based on Gluon, it might make sense to store
the keypair, so updating the module repository later is possible. the keypair, so updating the module repository later is possible.
The location the keys are stored at and read from can be changed
(see :ref:`getting-started-make-variables`). To only generate the keypair
at the configured location without doing a full build, use ``make create-key``.
.. _getting-started-make-variables: .. _getting-started-make-variables:
Make variables Make variables
@ -217,13 +198,8 @@ GLUON_BUILDDIR
GLUON_IMAGEDIR GLUON_IMAGEDIR
Path where images will be stored. Defaults to ``$(GLUON_OUTPUTDIR)/images``. Path where images will be stored. Defaults to ``$(GLUON_OUTPUTDIR)/images``.
GLUON_MODULEDIR GLUON_PACKAGEDIR
Path where the kernel module opkg repository will be stored. Defaults to ``$(GLUON_OUTPUTDIR)/modules``. Path where the opkg package repository will be stored. Defaults to ``$(GLUON_OUTPUTDIR)/packages``.
GLUON_OPKG_KEY
Path key file used to sign the module opkg repository. Defaults to ``$(GLUON_BULDDIR)/gluon-opkg-key``.
The private key will be stored as ``$(GLUON_OPKG_KEY)``, the public key as ``$(GLUON_OPKG_KEY).pub``.
GLUON_OUTPUTDIR GLUON_OUTPUTDIR
Path where output files will be stored. Defaults to ``output``. Path where output files will be stored. Defaults to ``output``.

View File

@ -56,23 +56,27 @@ opkg \: optional
There are two optional fields in the ``opkg`` section: There are two optional fields in the ``opkg`` section:
- ``openwrt`` overrides the default OpenWrt repository URL - ``lede`` overrides the default LEDE repository URL. The default URL would
correspond to ``http://downloads.lede-project.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) - ``extra`` specifies a table of additional repositories (with arbitrary keys)
:: ::
opkg = { opkg = {
openwrt = 'http://opkg.services.ffac/openwrt/%n/%v/%S/packages', lede = 'http://opkg.services.ffac/lede/snapshots/packages/%A',
extra = { extra = {
modules = 'http://opkg.services.ffac/modules/gluon-%GS-%GR/%S', gluon = 'http://opkg.services.ffac/modules/gluon-%GS-%GR/%S',
}, },
} }
There are various patterns which can be used in the URLs: There are various patterns which can be used in the URLs:
- ``%n`` is replaced by the OpenWrt version codename (e.g. "chaos_calmer") - ``%n`` is replaced by the LEDE version codename
- ``%v`` is replaced by the OpenWrt version number (e.g. "15.05") - ``%v`` is replaced by the LEDE version number (e.g. "17.01")
- ``%S`` is replaced by the target architecture (e.g. "ar71xx/generic") - ``%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``) - ``%GS`` is replaced by the Gluon site code (as specified in ``site.conf``)
- ``%GV`` is replaced by the Gluon version - ``%GV`` is replaced by the Gluon version
- ``%GR`` is replaced by the Gluon release (as specified in ``site.mk``) - ``%GR`` is replaced by the Gluon release (as specified in ``site.mk``)

View File

@ -1,22 +0,0 @@
CONFIG_IMAGEOPT=y
# CONFIG_PER_FEED_REPO is not set
# CONFIG_TARGET_ROOTFS_INITRAMFS is not set
CONFIG_DEVEL=y
CONFIG_ALL_KMODS=y
CONFIG_BUSYBOX_CUSTOM=y
CONFIG_BUSYBOX_CONFIG_SHA512SUM=y
# CONFIG_BUSYBOX_CONFIG_FEATURE_PREFER_IPV4_ADDRESS is not set
CONFIG_BUSYBOX_CONFIG_IP=y
CONFIG_BUSYBOX_CONFIG_FEATURE_IP_ADDRESS=y
CONFIG_BUSYBOX_CONFIG_FEATURE_IP_LINK=y
CONFIG_BUSYBOX_CONFIG_FEATURE_IP_ROUTE=y
CONFIG_BUSYBOX_CONFIG_FEATURE_IP_TUNNEL=y
CONFIG_BUSYBOX_CONFIG_FEATURE_IP_RULE=y
CONFIG_BUSYBOX_CONFIG_FEATURE_IP_SHORT_FORMS=y
CONFIG_BUSYBOX_CONFIG_FEATURE_WGET_TIMEOUT=y
CONFIG_ATH_USER_REGD=y
CONFIG_PACKAGE_ATH_DEBUG=y
CONFIG_LUCI_SRCDIET=y

View File

@ -1,85 +0,0 @@
ifneq ($(__gluon_inc),1)
__gluon_inc=1
GLUON_SITEDIR ?= $(GLUONDIR)/site
GLUON_BUILDDIR ?= $(GLUONDIR)/build
GLUON_ORIGOPENWRTDIR := $(GLUONDIR)/openwrt
GLUON_SITE_CONFIG := $(GLUON_SITEDIR)/site.conf
GLUON_OUTPUTDIR ?= $(GLUONDIR)/output
GLUON_IMAGEDIR ?= $(GLUON_OUTPUTDIR)/images
GLUON_MODULEDIR ?= $(GLUON_OUTPUTDIR)/modules
GLUON_OPKG_KEY ?= $(GLUON_BUILDDIR)/gluon-opkg-key
export GLUONDIR GLUON_SITEDIR GLUON_BUILDDIR GLUON_SITE_CONFIG GLUON_OUTPUTDIR GLUON_IMAGEDIR GLUON_MODULEDIR
BOARD_BUILDDIR = $(GLUON_BUILDDIR)/$(GLUON_TARGET)
BOARD_KDIR = $(BOARD_BUILDDIR)/kernel
export BOARD_BUILDDIR
LINUX_RELEASE := 2
export LINUX_RELEASE
GLUON_OPENWRTDIR = $(BOARD_BUILDDIR)/openwrt
$(GLUON_SITEDIR)/site.mk:
$(error There was no site configuration found. Please check out a site configuration to $(GLUON_SITEDIR))
-include $(GLUON_SITEDIR)/site.mk
GLUON_VERSION := $(shell cd $(GLUONDIR) && git describe --always --dirty=+ 2>/dev/null || echo unknown)
export GLUON_VERSION
GLUON_SITE_VERSION := $(shell cd $(GLUON_SITEDIR) && git --git-dir=.git describe --always --dirty=+ 2>/dev/null || echo unknown)
export GLUON_SITE_VERSION
GLUON_LANGS ?= en
export GLUON_LANGS
ifeq ($(OPENWRT_BUILD),1)
ifeq ($(GLUON_TOOLS),1)
GLUON_OPENWRT_FEEDS := base packages luci routing telephony management
export GLUON_OPENWRT_FEEDS
GLUON_SITE_CODE := $(shell $(GLUONDIR)/scripts/site.sh site_code)
export GLUON_SITE_CODE
ifeq ($(GLUON_RELEASE),)
$(error GLUON_RELEASE not set. GLUON_RELEASE can be set in site.mk or on the command line.)
endif
export GLUON_RELEASE
endif
endif
define merge-lists
$(1) :=
$(foreach var,$(2),$(1) := $$(filter-out -% $$(patsubst -%,%,$$(filter -%,$$($(var)))),$$($(1)) $$($(var)))
)
endef
GLUON_TARGETS :=
define GluonTarget
gluon_target := $(1)$$(if $(2),-$(2))
GLUON_TARGETS += $$(gluon_target)
GLUON_TARGET_$$(gluon_target)_BOARD := $(1)
GLUON_TARGET_$$(gluon_target)_SUBTARGET := $(2)
endef
GLUON_DEFAULT_PACKAGES := gluon-core firewall ip6tables -uboot-envtools -wpad-mini hostapd-mini
override DEFAULT_PACKAGES.router :=
endif #__gluon_inc

View File

@ -1,62 +0,0 @@
# Makefile for OpenWrt
#
# Copyright (C) 2007-2012 OpenWrt.org
# Copyright (C) 2013-2014 Project Gluon
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
RELEASE:=Chaos Calmer
PREP_MK= OPENWRT_BUILD= QUIET=0
export IS_TTY=$(shell tty -s && echo 1 || echo 0)
include $(GLUONDIR)/include/verbose.mk
REVISION:=$(shell [ -d $(TOPDIR) ] && cd $(TOPDIR) && ./scripts/getver.sh 2>/dev/null)
HOSTCC ?= gcc
OPENWRTVERSION:=$(RELEASE)$(if $(REVISION), ($(REVISION)))
export RELEASE
export REVISION
export OPENWRTVERSION
export IS_TTY=$(shell tty -s && echo 1 || echo 0)
export LD_LIBRARY_PATH:=$(subst ::,:,$(if $(LD_LIBRARY_PATH),$(LD_LIBRARY_PATH):)$(STAGING_DIR_HOST)/lib)
export DYLD_LIBRARY_PATH:=$(subst ::,:,$(if $(DYLD_LIBRARY_PATH),$(DYLD_LIBRARY_PATH):)$(STAGING_DIR_HOST)/lib)
export GIT_CONFIG_PARAMETERS='core.autocrlf=false'
export MAKE_JOBSERVER=$(filter --jobserver%,$(MAKEFLAGS))
# prevent perforce from messing with the patch utility
unexport P4PORT P4USER P4CONFIG P4CLIENT
# prevent user defaults for quilt from interfering
unexport QUILT_PATCHES QUILT_PATCH_OPTS
unexport C_INCLUDE_PATH CROSS_COMPILE ARCH
# prevent distro default LPATH from interfering
unexport LPATH
# make sure that a predefined CFLAGS variable does not disturb packages
export CFLAGS=
ifneq ($(shell $(HOSTCC) 2>&1 | grep clang),)
export HOSTCC_REAL?=$(HOSTCC)
export HOSTCC_WRAPPER:=$(TOPDIR)/scripts/clang-gcc-wrapper
else
export HOSTCC_WRAPPER:=$(HOSTCC)
endif
SCAN_COOKIE?=$(shell echo $$$$)
export SCAN_COOKIE
SUBMAKE:=umask 022; $(SUBMAKE)
ULIMIT_FIX=_limit=`ulimit -n`; [ "$$_limit" = "unlimited" -o "$$_limit" -ge 1024 ] || ulimit -n 1024;
FORCE: ;
.PHONY: FORCE
.NOTPARALLEL:

View File

@ -1,67 +0,0 @@
#
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
ifndef OPENWRT_VERBOSE
OPENWRT_VERBOSE:=
endif
ifeq ("$(origin V)", "command line")
OPENWRT_VERBOSE:=$(V)
endif
ifeq ($(OPENWRT_VERBOSE),1)
OPENWRT_VERBOSE:=w
endif
ifeq ($(OPENWRT_VERBOSE),99)
OPENWRT_VERBOSE:=s
endif
ifeq ($(NO_TRACE_MAKE),)
NO_TRACE_MAKE := $(MAKE) V=s$(OPENWRT_VERBOSE)
export NO_TRACE_MAKE
endif
ifeq ($(IS_TTY),1)
ifneq ($(strip $(NO_COLOR)),1)
_Y:=\\033[33m
_R:=\\033[31m
_N:=\\033[m
endif
endif
ifeq ($(findstring s,$(OPENWRT_VERBOSE)),)
define MESSAGE
printf "$(_Y)%s$(_N)\n" "$(1)" >&8
endef
define ERROR_MESSAGE
printf "$(_R)%s$(_N)\n" "$(1)" >&8
endef
ifeq ($(QUIET),1)
ifneq ($(CURDIR),$(TOPDIR))
_DIR:=$(patsubst $(TOPDIR)/%,%,${CURDIR})
else
_DIR:=
endif
_NULL:=$(if $(MAKECMDGOALS),$(shell \
$(call MESSAGE, make[$(MAKELEVEL)]$(if $(_DIR), -C $(_DIR)) $(MAKECMDGOALS)); \
))
SUBMAKE=$(MAKE)
else
SILENT:=>/dev/null $(if $(findstring w,$(OPENWRT_VERBOSE)),,2>&1)
export QUIET:=1
SUBMAKE=cmd() { $(SILENT) $(MAKE) -s $$* < /dev/null || { echo "make $$*: build failed. Please re-run make with V=s to see what's going on"; false; } } 8>&1 9>&2; cmd
endif
.SILENT: $(MAKECMDGOALS)
else
SUBMAKE=$(MAKE) -w
define MESSAGE
printf "%s\n" "$(1)"
endef
ERROR_MESSAGE=$(MESSAGE)
endif

10
modules
View File

@ -1,15 +1,13 @@
GLUON_FEEDS='openwrt gluon routing luci' GLUON_FEEDS='openwrt gluon routing luci'
OPENWRT_REPO=git://github.com/openwrt/openwrt.git LEDE_REPO=git://git.lede-project.org/source.git
OPENWRT_COMMIT=0f757bd2606971252f901ef3faf4dbd0086315f7 LEDE_COMMIT=b9a408c2b49ccfa0e906bda00ef77f4002e401fd
OPENWRT_BRANCH=chaos_calmer
PACKAGES_OPENWRT_REPO=git://github.com/openwrt/packages.git PACKAGES_OPENWRT_REPO=git://github.com/openwrt/packages.git
PACKAGES_OPENWRT_COMMIT=73776792f7d58e982be9e5819450d4875b273159 PACKAGES_OPENWRT_COMMIT=ee211f94ec292f7ec3d563fcbc147359b6cf8290
PACKAGES_OPENWRT_BRANCH=for-15.05
PACKAGES_GLUON_REPO=git://github.com/freifunk-gluon/packages.git PACKAGES_GLUON_REPO=git://github.com/freifunk-gluon/packages.git
PACKAGES_GLUON_COMMIT=5c25ed888f9f2e05652a994fc0212e34304d58fa PACKAGES_GLUON_COMMIT=ef405e224082c26807fe24c02da9b02135fa46d0
PACKAGES_ROUTING_REPO=git://github.com/openwrt-routing/packages.git PACKAGES_ROUTING_REPO=git://github.com/openwrt-routing/packages.git
PACKAGES_ROUTING_COMMIT=d848d49d2443448b147c564c2dd8f64433b5fb9c PACKAGES_ROUTING_COMMIT=d848d49d2443448b147c564c2dd8f64433b5fb9c

2
overlay/opkg.mk Normal file
View File

@ -0,0 +1,2 @@
FEEDS_ENABLED := $(FEEDS_DISABLED)
FEEDS_DISABLED :=

View File

@ -2,11 +2,13 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-autoupdater PKG_NAME:=gluon-autoupdater
PKG_VERSION:=4 PKG_VERSION:=4
PKG_RELEASE:=$(GLUON_BRANCH)
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
PKG_CONFIG_DEPENDS := CONFIG_GLUON_BRANCH
PKG_BUILD_DEPENDS := respondd PKG_BUILD_DEPENDS := respondd
include ../gluon.mk include ../gluon.mk
@ -17,6 +19,13 @@ define Package/gluon-autoupdater
TITLE:=Automatically update firmware TITLE:=Automatically update firmware
endef endef
define Package/gluon-autoupdater/config
config GLUON_BRANCH
string "Gluon autoupdater branch"
depends on PACKAGE_gluon-autoupdater
default ""
endef
define Build/Prepare define Build/Prepare
mkdir -p $(PKG_BUILD_DIR) mkdir -p $(PKG_BUILD_DIR)
$(CP) ./src/* $(PKG_BUILD_DIR)/ $(CP) ./src/* $(PKG_BUILD_DIR)/
@ -34,10 +43,10 @@ define Package/gluon-autoupdater/install
$(INSTALL_DIR) $(1)/lib/gluon/respondd $(INSTALL_DIR) $(1)/lib/gluon/respondd
$(CP) $(PKG_BUILD_DIR)/respondd.so $(1)/lib/gluon/respondd/autoupdater.so $(CP) $(PKG_BUILD_DIR)/respondd.so $(1)/lib/gluon/respondd/autoupdater.so
if [ '$(GLUON_BRANCH)' ]; then \ ifneq ($(CONFIG_GLUON_BRANCH),"")
$(INSTALL_DIR) $(1)/lib/gluon/autoupdater; \ $(INSTALL_DIR) $(1)/lib/gluon/autoupdater
echo '$(GLUON_BRANCH)' > $(1)/lib/gluon/autoupdater/default_branch; \ echo '$(call qstrip,$(CONFIG_GLUON_BRANCH))' > $(1)/lib/gluon/autoupdater/default_branch
fi endif
endef endef
define Package/gluon-autoupdater/postinst define Package/gluon-autoupdater/postinst

View File

@ -1,8 +1,10 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-core PKG_NAME:=gluon-core
PKG_VERSION:=3
PKG_RELEASE:=$(GLUON_VERSION) GLUON_VERSION = $(shell git describe --always --dirty=+ 2>/dev/null || echo unknown)
PKG_VERSION:=$(if $(DUMP),x,$(GLUON_VERSION))
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
@ -20,10 +22,6 @@ define Package/gluon-core/description
Gluon community wifi mesh firmware framework: core Gluon community wifi mesh firmware framework: core
endef endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure define Build/Configure
endef endef
@ -34,11 +32,9 @@ endef
define Package/gluon-core/install define Package/gluon-core/install
$(CP) ./files/* $(1)/ $(CP) ./files/* $(1)/
$(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/ $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/
$(SED) 's/__GLUON_OPENWRT_FEEDS__/{$(GLUON_OPENWRT_FEEDS:%="%",)}/' $(1)/lib/gluon/upgrade/500-opkg
$(INSTALL_DIR) $(1)/lib/gluon $(INSTALL_DIR) $(1)/lib/gluon
echo "$(GLUON_VERSION)" > $(1)/lib/gluon/gluon-version echo '$(GLUON_VERSION)' > $(1)/lib/gluon/gluon-version
echo "$(GLUON_SITE_VERSION)" > $(1)/lib/gluon/site-version
endef endef
define Package/gluon-core/postinst define Package/gluon-core/postinst

View File

@ -2,7 +2,7 @@ need_string 'site_code'
need_string 'site_name' need_string 'site_name'
if need_table('opkg', nil, false) then if need_table('opkg', nil, false) then
need_string('opkg.openwrt', false) need_string('opkg.lede', false)
function check_repo(k, _) function check_repo(k, _)
-- this is not actually a uci name, but using the same naming rules here is fine -- this is not actually a uci name, but using the same naming rules here is fine

View File

@ -8,7 +8,7 @@ local util = require 'luci.util'
local subst = {} local subst = {}
subst['%%v'] = util.trim(fs.readfile('/etc/openwrt_version')) subst['%%v'] = util.trim(fs.readfile('/etc/openwrt_version'))
subst['%%n'], subst['%%S'] = util.exec('. /etc/openwrt_release; echo $DISTRIB_CODENAME; echo $DISTRIB_TARGET'):match('([^\n]*)\n([^\n]*)') subst['%%n'], subst['%%S'], subst['%%A'] = util.exec('. /etc/openwrt_release; echo "$DISTRIB_CODENAME"; echo "$DISTRIB_TARGET"; echo "$DISTRIB_ARCH"'):match('([^\n]*)\n([^\n]*)\n([^\n]*)')
subst['%%GS'] = site.site_code subst['%%GS'] = site.site_code
subst['%%GV'] = util.trim(fs.readfile('/lib/gluon/gluon-version')) subst['%%GV'] = util.trim(fs.readfile('/lib/gluon/gluon-version'))
subst['%%GR'] = util.trim(fs.readfile('/lib/gluon/release')) subst['%%GR'] = util.trim(fs.readfile('/lib/gluon/release'))
@ -22,19 +22,29 @@ function replace_patterns(url)
end end
if site.opkg then local prefix = subst['%%n'] .. '_'
if site.opkg.openwrt then
local url = replace_patterns(site.opkg.openwrt)
local f = io.open('/etc/opkg/distfeeds.conf', 'w')
for _, v in ipairs(__GLUON_OPENWRT_FEEDS__) do local distfeeds = {}
f:write(replace_patterns(string.format('src/gz %%n_%s %s/%s\n', v, site.opkg.openwrt, v))) for line in io.lines('/etc/opkg/distfeeds.conf') do
table.insert(distfeeds, line)
end
local f = io.open('/etc/opkg/distfeeds.conf', 'w')
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 site.opkg and site.opkg.lede then
f:write(string.format('src/gz %s %s/%s\n', prefix .. name, replace_patterns(site.opkg.lede), name))
else
f:write(line .. '\n')
end end
end
f:close() f:close()
end
if site.opkg.extra and next(site.opkg.extra) then if site.opkg and site.opkg.extra and next(site.opkg.extra) then
local f = io.open('/etc/opkg/gluon.conf', 'w') local f = io.open('/etc/opkg/gluon.conf', 'w')
for k, v in pairs(site.opkg.extra) do for k, v in pairs(site.opkg.extra) do
@ -43,7 +53,6 @@ if site.opkg then
f:close() f:close()
else else
os.remove('/etc/opkg/gluon.conf') os.remove('/etc/opkg/gluon.conf')
end
end end

View File

@ -1 +0,0 @@
/etc/init.d/dropbear

View File

@ -1,5 +1,5 @@
#!/bin/sh /etc/rc.common #!/bin/sh /etc/rc.common
if /etc/init.d/haveged enabled; then if [ -x /etc/init.d/haveged ] && /etc/init.d/haveged enabled; then
. /etc/init.d/haveged . /etc/init.d/haveged
fi fi

View File

@ -1 +0,0 @@
/etc/init.d/dropbear

View File

@ -0,0 +1,21 @@
#!/bin/sh /etc/rc.common
USE_PROCD=1
PROG=/usr/sbin/dropbear
NAME=dropbear
start_service() {
[ -x /etc/init.d/dropbear ] || return 0
. /etc/init.d/dropbear
[ -s /etc/dropbear/dropbear_rsa_host_key ] || keygen
. /lib/functions.sh
. /lib/functions/network.sh
procd_open_instance
procd_set_param command "$PROG" -F -f
procd_set_param respawn
procd_close_instance
}

View File

@ -1,12 +0,0 @@
#!/bin/sh /etc/rc.common
START=50
USE_PROCD=1
PROG=/usr/sbin/telnetd
start_service() {
procd_open_instance
procd_set_param command "$PROG" -F -l /lib/gluon/setup-mode/ash-login
procd_close_instance
}

View File

@ -1,9 +1,13 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-site PKG_NAME:=gluon-site
PKG_VERSION:=$(if $(GLUON_SITE_CODE),$(GLUON_SITE_CODE),1)
PKG_RELEASE:=$(GLUON_RELEASE)
GLUON_SITEDIR = '$(call qstrip,$(CONFIG_GLUON_SITEDIR))'
GLUON_SITE_VERSION = $(shell ( cd $(GLUON_SITEDIR) && git --git-dir=.git describe --always --dirty=+ ) 2>/dev/null || echo unknown)
PKG_VERSION:=$(if $(DUMP),x,$(GLUON_SITE_VERSION))
PKG_CONFIG_DEPENDS := CONFIG_GLUON_RELEASE CONFIG_GLUON_SITEDIR
PKG_FILE_DEPENDS := $(GLUON_SITEDIR)/site.conf $(GLUON_SITEDIR)/i18n/ PKG_FILE_DEPENDS := $(GLUON_SITEDIR)/site.conf $(GLUON_SITEDIR)/i18n/
PKG_BUILD_DEPENDS := luci-base/host lua-cjson/host PKG_BUILD_DEPENDS := luci-base/host lua-cjson/host
@ -20,6 +24,18 @@ define Package/gluon-site
TITLE:=Site-specific files of Gluon TITLE:=Site-specific files of Gluon
endef endef
define Package/gluon-site/config
config GLUON_RELEASE
string "Gluon release number"
depends on PACKAGE_gluon-site
default ""
config GLUON_SITEDIR
string "Gluon site configuration directory"
depends on PACKAGE_gluon-site
default ""
endef
define Build/Prepare define Build/Prepare
mkdir -p $(PKG_BUILD_DIR) mkdir -p $(PKG_BUILD_DIR)
endef endef
@ -28,14 +44,15 @@ define Build/Configure
endef endef
define Build/Compile define Build/Compile
lua -e 'print(require("cjson").encode(assert(dofile("../../scripts/site_config.lua"))))' > $(PKG_BUILD_DIR)/site.json GLUON_SITEDIR='$(call qstrip,$(CONFIG_GLUON_SITEDIR))' lua -e 'print(require("cjson").encode(assert(dofile("../../scripts/site_config.lua"))))' > $(PKG_BUILD_DIR)/site.json
$(call GluonBuildI18N,gluon-site,$(GLUON_SITEDIR)/i18n) $(call GluonBuildI18N,gluon-site,$(GLUON_SITEDIR)/i18n)
endef endef
define Package/gluon-site/install define Package/gluon-site/install
$(INSTALL_DIR) $(1)/lib/gluon $(INSTALL_DIR) $(1)/lib/gluon
$(INSTALL_DATA) $(PKG_BUILD_DIR)/site.json $(1)/lib/gluon/ $(INSTALL_DATA) $(PKG_BUILD_DIR)/site.json $(1)/lib/gluon/
echo "$(GLUON_RELEASE)" > $(1)/lib/gluon/release echo '$(GLUON_SITE_VERSION)' > $(1)/lib/gluon/site-version
echo '$(call qstrip,$(CONFIG_GLUON_RELEASE))' > $(1)/lib/gluon/release
$(call GluonInstallI18N,gluon-site,$(1)) $(call GluonInstallI18N,gluon-site,$(1))
endef endef

View File

@ -5,8 +5,13 @@ include $(INCLUDE_DIR)/package.mk
# Annoyingly, make's shell function replaces all newlines with spaces, so we have to do some escaping work. Yuck. # Annoyingly, make's shell function replaces all newlines with spaces, so we have to do some escaping work. Yuck.
define GluonCheckSite define GluonCheckSite
[ -z "$$GLUONDIR" ] || sed -e 's/-@/\n/g' -e 's/+@/@/g' <<'END__GLUON__CHECK__SITE' | "$$GLUONDIR"/scripts/check_site.sh [ -z "$$IPKG_INSTROOT" ] || sed -e 's/-@/\n/g' -e 's/+@/@/g' <<'END__GLUON__CHECK__SITE' | "${TOPDIR}/staging_dir/hostpkg/bin/lua" -e 'dofile()'
$(shell cat $(1) | sed -ne '1h; 1!H; $$ {g; s/@/+@/g; s/\n/-@/g; p}') local f = assert(io.open(os.getenv('IPKG_INSTROOT') .. '/lib/gluon/site.json'))
local site_json = f:read('*a')
f:close()
site = require('cjson').decode(site_json)
$(shell cat '$(TOPDIR)/../scripts/check_site_lib.lua' '$(1)' | sed -ne '1h; 1!H; $$ {g; s/@/+@/g; s/\n/-@/g; p}')
END__GLUON__CHECK__SITE END__GLUON__CHECK__SITE
endef endef
@ -41,9 +46,7 @@ define GluonSrcDiet
rm -rf $(2) rm -rf $(2)
$(CP) $(1) $(2) $(CP) $(1) $(2)
$(FIND) $(2) -type f | while read src; do \ $(FIND) $(2) -type f | while read src; do \
if $(STAGING_DIR_HOST)/bin/lua $(STAGING_DIR_HOST)/bin/LuaSrcDiet \ if LuaSrcDiet --noopt-binequiv -o "$$$$src.o" "$$$$src"; then \
--noopt-binequiv -o "$$$$src.o" "$$$$src"; \
then \
chmod $$$$(stat -c%a "$$$$src") "$$$$src.o"; \ chmod $$$$(stat -c%a "$$$$src") "$$$$src.o"; \
mv "$$$$src.o" "$$$$src"; \ mv "$$$$src.o" "$$$$src"; \
fi; \ fi; \

View File

@ -0,0 +1,111 @@
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 5f572e9d7475e807ea56713ee2069dc98f5c1f6b..80c1b05937410cb9fce20e7b759577480cf390e7 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 5cfbdeba5138c4362f82b7ae86b910a1f41f082a..fee7c6ce8fca6160a7055a8ccb9c0ebd0759032b 100644
--- a/include/host-build.mk
+++ b/include/host-build.mk
@@ -115,7 +115,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 32485176577b040f6e4a561c5d1144509877bcdf..ea801288eadb139cc0dd2412b4c927c6bd7330e0 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 04fd936660bef4af49de5500cd2d7c3601c1b9f6..95b18f9e5c69de479db54c5bdb740103140dcf74 100644
--- a/rules.mk
+++ b/rules.mk
@@ -145,9 +145,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))
@@ -206,7 +206,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
@@ -232,9 +232,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

@ -0,0 +1,43 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sat, 21 Mar 2015 16:40:52 +0100
Subject: base-files: disable reset button handling
This conflicts with our reset button usage.
diff --git a/package/base-files/files/etc/rc.button/reset b/package/base-files/files/etc/rc.button/reset
deleted file mode 100755
index 4265767437e8eda3c758fe7f7941d7f608c95782..0000000000000000000000000000000000000000
--- a/package/base-files/files/etc/rc.button/reset
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/sh
-
-. /lib/functions.sh
-
-OVERLAY="$( grep ' /overlay ' /proc/mounts )"
-
-case "$ACTION" in
-pressed)
- [ -z "$OVERLAY" ] && return 0
-
- return 5
-;;
-timeout)
- . /etc/diag.sh
- set_state failsafe
-;;
-released)
- if [ "$SEEN" -lt 1 ]
- then
- echo "REBOOT" > /dev/console
- sync
- reboot
- elif [ "$SEEN" -gt 5 -a -n "$OVERLAY" ]
- then
- echo "FACTORY RESET" > /dev/console
- jffs2reset -y && reboot &
- fi
-;;
-esac
-
-return 0

View File

@ -0,0 +1,69 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Tue, 27 Sep 2016 03:55:55 +0200
Subject: dropbear: add a failsafe mode that will always allow password-less root login
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/package/network/services/dropbear/patches/700-failsafe-mode.patch b/package/network/services/dropbear/patches/700-failsafe-mode.patch
new file mode 100644
index 0000000000000000000000000000000000000000..c6e45423e2dba1258549a5bfe4b5a59ac32d73d8
--- /dev/null
+++ b/package/network/services/dropbear/patches/700-failsafe-mode.patch
@@ -0,0 +1,57 @@
+--- a/runopts.h
++++ b/runopts.h
+@@ -97,6 +97,8 @@ typedef struct svr_runopts {
+ int norootpass;
+ int allowblankpass;
+
++ int failsafe_mode;
++
+ #ifdef ENABLE_SVR_REMOTETCPFWD
+ int noremotetcp;
+ #endif
+--- a/svr-auth.c
++++ b/svr-auth.c
+@@ -149,10 +149,11 @@ void recv_msg_userauth_request() {
+ AUTH_METHOD_NONE_LEN) == 0) {
+ TRACE(("recv_msg_userauth_request: 'none' request"))
+ if (valid_user
+- && (svr_opts.allowblankpass || !strcmp(ses.authstate.pw_name, "root"))
+- && !svr_opts.noauthpass
+- && !(svr_opts.norootpass && ses.authstate.pw_uid == 0)
+- && ses.authstate.pw_passwd[0] == '\0')
++ && ((svr_opts.failsafe_mode && !strcmp(ses.authstate.pw_name, "root"))
++ || ((svr_opts.allowblankpass || !strcmp(ses.authstate.pw_name, "root"))
++ && !svr_opts.noauthpass
++ && !(svr_opts.norootpass && ses.authstate.pw_uid == 0)
++ && ses.authstate.pw_passwd[0] == '\0')))
+ {
+ dropbear_log(LOG_NOTICE,
+ "Auth succeeded with blank password for '%s' from %s",
+--- a/svr-runopts.c
++++ b/svr-runopts.c
+@@ -72,6 +72,7 @@ static void printhelp(const char * progn
+ "-s Disable password logins\n"
+ "-g Disable password logins for root\n"
+ "-B Allow blank password logins\n"
++ "-f Failsafe mode: always allow password-less root login\n"
+ #endif
+ #ifdef ENABLE_SVR_LOCALTCPFWD
+ "-j Disable local port forwarding\n"
+@@ -130,6 +131,7 @@ void svr_getopts(int argc, char ** argv)
+ svr_opts.noauthpass = 0;
+ svr_opts.norootpass = 0;
+ svr_opts.allowblankpass = 0;
++ svr_opts.failsafe_mode = 0;
+ svr_opts.inetdmode = 0;
+ svr_opts.portcount = 0;
+ svr_opts.hostkey = NULL;
+@@ -244,6 +246,9 @@ void svr_getopts(int argc, char ** argv)
+ case 'B':
+ svr_opts.allowblankpass = 1;
+ break;
++ case 'f':
++ svr_opts.failsafe_mode = 1;
++ break;
+ #endif
+ case 'h':
+ printhelp(argv[0]);

View File

@ -1,36 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sat, 26 Jul 2014 06:10:23 +0200
Subject: tools/Makefile: fix host tools build dependencies
diff --git a/tools/Makefile b/tools/Makefile
index d2fe2ffddf4b7207a937ca75efe1c2728e8067aa..c6cded8eccd81c422f99e7ee50754c4bc66decc7 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -95,10 +95,16 @@ define PrepareStaging
endef
# preparatory work
+ifneq ($(ARCH),)
+staging_prepared = $(STAGING_DIR)/.prepared
+
$(STAGING_DIR)/.prepared: $(TMP_DIR)/.build
$(call PrepareStaging,$(STAGING_DIR))
mkdir -p $(BUILD_DIR)/stamp
touch $@
+else
+staging_prepared :=
+endif
$(STAGING_DIR_HOST)/.prepared: $(TMP_DIR)/.build
$(call PrepareStaging,$(STAGING_DIR_HOST))
@@ -110,8 +116,8 @@ $(STAGING_DIR_HOST)/.prepared: $(TMP_DIR)/.build
endif
-$(curdir)//prepare = $(STAGING_DIR)/.prepared $(STAGING_DIR_HOST)/.prepared
-$(curdir)//compile = $(STAGING_DIR)/.prepared $(STAGING_DIR_HOST)/.prepared
+$(curdir)//prepare = $(staging_prepared) $(STAGING_DIR_HOST)/.prepared
+$(curdir)//compile = $(staging_prepared) $(STAGING_DIR_HOST)/.prepared
# prerequisites for the individual targets
$(curdir)/ := .config prereq

View File

@ -1,118 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Tue, 17 Jan 2017 22:08:21 +0100
Subject: odhcp6c: backport from LEDE 0d49f9f4b4da9d1960f82e68ae797290e4b9c434
diff --git a/package/network/ipv6/odhcp6c/Makefile b/package/network/ipv6/odhcp6c/Makefile
index 3705705f6540dc841c7041e81f6d208a41a1f08a..a8e45588a52859daf14c68c665a53690b9d09be2 100644
--- a/package/network/ipv6/odhcp6c/Makefile
+++ b/package/network/ipv6/odhcp6c/Makefile
@@ -8,15 +8,16 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=odhcp6c
-PKG_VERSION:=2016-02-08
+PKG_VERSION:=2017-01-07
PKG_RELEASE=$(PKG_SOURCE_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_URL:=https://github.com/openwrt/odhcp6c.git
+PKG_SOURCE_URL:=git://git.lede-project.org/project/odhcp6c.git
PKG_SOURCE_PROTO:=git
-PKG_SOURCE_VERSION:=dc186d6d2b0dd4ad23ca5fc69c00e81f796ff6d9
-PKG_MAINTAINER:=Steven Barth <steven@midlink.org>
+PKG_SOURCE_VERSION:=d420f49396c627ce1072b83170889baf0720bc8b
+PKG_MIRROR_HASH:=a7c599b5600b6cca9aec221dd32fc7754e0e942b0192bd902f1e789f53345127
+PKG_MAINTAINER:=Hans Dedecker <dedeckeh@gmail.com>
PKG_LICENSE:=GPL-2.0
include $(INCLUDE_DIR)/package.mk
@@ -30,7 +31,7 @@ define Package/odhcp6c
SECTION:=net
CATEGORY:=Network
TITLE:=Embedded DHCPv6-client for OpenWrt
- DEPENDS:=+kmod-ipv6
+ DEPENDS:=@IPV6 +libubox
endef
define Package/odhcp6c/config
diff --git a/package/network/ipv6/odhcp6c/files/dhcpv6.script b/package/network/ipv6/odhcp6c/files/dhcpv6.script
index 677d35f4f92e82d6a7fe9ca01a35e071097baca8..1bb5e771b6dc80c1f5bceef88508d92cc69b1d3a 100755
--- a/package/network/ipv6/odhcp6c/files/dhcpv6.script
+++ b/package/network/ipv6/odhcp6c/files/dhcpv6.script
@@ -77,6 +77,11 @@ setup_interface () {
-z "$RA_DNS" -a "$FAKE_ROUTES" = 1 ]; then
RA_ROUTES="::/0,$SERVER,$valid,4096"
fi
+
+ # RFC 7278
+ if [ "$mask" -eq 64 -a -z "$PREFIXES" -a -n "$EXTENDPREFIX" ]; then
+ proto_add_ipv6_prefix "$addr/$mask,$preferred,$valid"
+ fi
done
for entry in $RA_ROUTES; do
@@ -180,7 +185,7 @@ setup_interface () {
# Apply IPv6 / ND configuration
HOPLIMIT=$(cat /proc/sys/net/ipv6/conf/$device/hop_limit)
[ -n "$RA_HOPLIMIT" -a -n "$HOPLIMIT" ] && [ "$RA_HOPLIMIT" -gt "$HOPLIMIT" ] && echo "$RA_HOPLIMIT" > /proc/sys/net/ipv6/conf/$device/hop_limit
- [ -n "$RA_MTU" ] && [ "$RA_MTU" -gt 0 ] && echo "$RA_MTU" > /proc/sys/net/ipv6/conf/$device/mtu
+ [ -n "$RA_MTU" ] && [ "$RA_MTU" -ge 1280 ] && echo "$RA_MTU" > /proc/sys/net/ipv6/conf/$device/mtu 2>/dev/null
[ -n "$RA_REACHABLE" ] && [ "$RA_REACHABLE" -gt 0 ] && echo "$RA_REACHABLE" > /proc/sys/net/ipv6/neigh/$device/base_reachable_time_ms
[ -n "$RA_RETRANSMIT" ] && [ "$RA_RETRANSMIT" -gt 0 ] && echo "$RA_RETRANSMIT" > /proc/sys/net/ipv6/neigh/$device/retrans_time_ms
@@ -209,6 +214,6 @@ case "$2" in
esac
# user rules
-[ -f /etc/odhcp6c.user ] && . /etc/odhcp6c.user
+[ -f /etc/odhcp6c.user ] && . /etc/odhcp6c.user "@"
exit 0
diff --git a/package/network/ipv6/odhcp6c/files/dhcpv6.sh b/package/network/ipv6/odhcp6c/files/dhcpv6.sh
index 4a453fdc4d94d9298067a986b0e4c6054b6c0a60..9e3f6697335a55cf4be1751fec907a4ac93f09ec 100755
--- a/package/network/ipv6/odhcp6c/files/dhcpv6.sh
+++ b/package/network/ipv6/odhcp6c/files/dhcpv6.sh
@@ -13,6 +13,7 @@ proto_dhcpv6_init_config() {
proto_config_add_string 'reqopts:list(uinteger)'
proto_config_add_string 'noslaaconly:bool'
proto_config_add_string 'forceprefix:bool'
+ proto_config_add_string 'extendprefix:bool'
proto_config_add_string 'norelease:bool'
proto_config_add_string 'ip6prefix:ip6addr'
proto_config_add_string iface_dslite
@@ -29,14 +30,15 @@ proto_dhcpv6_init_config() {
proto_config_add_int "soltimeout"
proto_config_add_boolean fakeroutes
proto_config_add_boolean sourcefilter
+ proto_config_add_boolean keep_ra_dnslifetime
}
proto_dhcpv6_setup() {
local config="$1"
local iface="$2"
- local reqaddress reqprefix clientid reqopts noslaaconly forceprefix norelease ip6prefix iface_dslite iface_map iface_464xlat ifaceid userclass vendorclass delegate zone_dslite zone_map zone_464xlat zone soltimeout fakeroutes sourcefilter
- json_get_vars reqaddress reqprefix clientid reqopts noslaaconly forceprefix norelease ip6prefix iface_dslite iface_map iface_464xlat ifaceid userclass vendorclass delegate zone_dslite zone_map zone_464xlat zone soltimeout fakeroutes sourcefilter
+ local reqaddress reqprefix clientid reqopts noslaaconly forceprefix extendprefix norelease ip6prefix iface_dslite iface_map iface_464xlat ifaceid userclass vendorclass delegate zone_dslite zone_map zone_464xlat zone soltimeout fakeroutes sourcefilter keep_ra_dnslifetime
+ json_get_vars reqaddress reqprefix clientid reqopts noslaaconly forceprefix extendprefix norelease ip6prefix iface_dslite iface_map iface_464xlat ifaceid userclass vendorclass delegate zone_dslite zone_map zone_464xlat zone soltimeout fakeroutes sourcefilter keep_ra_dnslifetime
# Configure
@@ -60,6 +62,8 @@ proto_dhcpv6_setup() {
[ -n "$userclass" ] && append opts "-u$userclass"
+ [ "$keep_ra_dnslifetime" = "1" ] && append opts "-L"
+
for opt in $reqopts; do
append opts "-r$opt"
done
@@ -78,6 +82,7 @@ proto_dhcpv6_setup() {
[ -n "$zone" ] && proto_export "ZONE=$zone"
[ "$fakeroutes" != "0" ] && proto_export "FAKE_ROUTES=1"
[ "$sourcefilter" = "0" ] && proto_export "NOSOURCEFILTER=1"
+ [ "$extendprefix" = "1" ] && proto_export "EXTENDPREFIX=1"
proto_export "INTERFACE=$config"
proto_run_command "$config" odhcp6c \

View File

@ -1,26 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Fri, 5 Dec 2014 18:57:16 +0100
Subject: busybox: enable telnet only when root password is really empty, not when it is locked
diff --git a/package/utils/busybox/files/telnet b/package/utils/busybox/files/telnet
index a1d1cdf9b18d69895e7a08a8b1318f1ff591ea07..f95be90490597f6251d8c3e1247b522dfd9e72c0 100755
--- a/package/utils/busybox/files/telnet
+++ b/package/utils/busybox/files/telnet
@@ -11,7 +11,7 @@ has_root_pwd() {
pwd="${pwd#*root:}"
pwd="${pwd%%:*}"
- test -n "${pwd#[\!x]}"
+ test -n "${pwd}"
}
get_root_home() {
@@ -28,7 +28,7 @@ has_ssh_pubkey() {
start_service() {
if ( ! has_ssh_pubkey && \
- ! has_root_pwd /etc/passwd && ! has_root_pwd /etc/shadow ) || \
+ ( ! has_root_pwd /etc/passwd || ! has_root_pwd /etc/shadow ) ) || \
( ! /etc/init.d/dropbear enabled 2> /dev/null && ! /etc/init.d/sshd enabled 2> /dev/null );
then
procd_open_instance

View File

@ -1,32 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sat, 21 Mar 2015 16:40:52 +0100
Subject: base-files: disable reset button handling
This conflicts with our reset button usage.
diff --git a/package/base-files/files/etc/rc.button/reset b/package/base-files/files/etc/rc.button/reset
deleted file mode 100755
index 3e241460efbb08abaa775c1a7843b5fa3e237d44..0000000000000000000000000000000000000000
--- a/package/base-files/files/etc/rc.button/reset
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-
-[ "${ACTION}" = "released" ] || exit 0
-
-. /lib/functions.sh
-
-logger "$BUTTON pressed for $SEEN seconds"
-
-if [ "$SEEN" -lt 1 ]
-then
- echo "REBOOT" > /dev/console
- sync
- reboot
-elif [ "$SEEN" -gt 5 ]
-then
- echo "FACTORY RESET" > /dev/console
- jffs2reset -y && reboot &
-fi
-
-return 0

View File

@ -1,85 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Tue, 19 Jul 2016 17:48:53 +0200
Subject: ar71xx: define wmac reset function for QCA955x
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Backport of LEDE a176168a85477caa44eef7e979567d1d52868fde
diff --git a/target/linux/ar71xx/patches-3.18/640-MIPS-ath79-add-QCA955x-wmac-reset.patch b/target/linux/ar71xx/patches-3.18/640-MIPS-ath79-add-QCA955x-wmac-reset.patch
new file mode 100644
index 0000000000000000000000000000000000000000..4ac5acd618748fc9ad0f091d110d2503cdc39d53
--- /dev/null
+++ b/target/linux/ar71xx/patches-3.18/640-MIPS-ath79-add-QCA955x-wmac-reset.patch
@@ -0,0 +1,71 @@
+--- a/arch/mips/ath79/common.h
++++ b/arch/mips/ath79/common.h
+@@ -19,6 +19,8 @@
+ #define ATH79_MEM_SIZE_MIN (2 * 1024 * 1024)
+ #define ATH79_MEM_SIZE_MAX (128 * 1024 * 1024)
+
++extern void __iomem *ath79_ddr_base;
++
+ void ath79_clocks_init(void);
+ unsigned long ath79_get_sys_clk_rate(const char *id);
+
+--- a/arch/mips/ath79/dev-wmac.c
++++ b/arch/mips/ath79/dev-wmac.c
+@@ -149,6 +149,27 @@ static void ar934x_wmac_setup(void)
+ ath79_wmac_data.is_clk_25mhz = true;
+ }
+
++static int ar955x_wmac_reset(void)
++{
++ int i;
++
++ /* Try to wait for WMAC DDR activity to stop */
++ for (i = 0; i < 10; i++) {
++ if (!(__raw_readl(ath79_ddr_base + QCA955X_DDR_CTL_CONFIG) &
++ QCA955X_DDR_CTL_CONFIG_ACT_WMAC))
++ break;
++
++ udelay(10);
++ }
++
++ ath79_device_reset_set(QCA955X_RESET_RTC);
++ udelay(10);
++ ath79_device_reset_clear(QCA955X_RESET_RTC);
++ udelay(10);
++
++ return 0;
++}
++
+ static void qca955x_wmac_setup(void)
+ {
+ u32 t;
+@@ -165,6 +186,8 @@ static void qca955x_wmac_setup(void)
+ ath79_wmac_data.is_clk_25mhz = false;
+ else
+ ath79_wmac_data.is_clk_25mhz = true;
++
++ ath79_wmac_data.external_reset = ar955x_wmac_reset;
+ }
+
+ static bool __init
+--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
++++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
+@@ -32,7 +32,7 @@
+ #define AR71XX_SPI_SIZE 0x01000000
+
+ #define AR71XX_DDR_CTRL_BASE (AR71XX_APB_BASE + 0x00000000)
+-#define AR71XX_DDR_CTRL_SIZE 0x100
++#define AR71XX_DDR_CTRL_SIZE 0x200
+ #define AR71XX_UART_BASE (AR71XX_APB_BASE + 0x00020000)
+ #define AR71XX_UART_SIZE 0x100
+ #define AR71XX_USB_CTRL_BASE (AR71XX_APB_BASE + 0x00030000)
+@@ -173,6 +173,9 @@
+ #define AR934X_DDR_REG_FLUSH_PCIE 0xa8
+ #define AR934X_DDR_REG_FLUSH_WMAC 0xac
+
++#define QCA955X_DDR_CTL_CONFIG 0x108
++#define QCA955X_DDR_CTL_CONFIG_ACT_WMAC BIT(23)
++
+ /*
+ * PLL block
+ */

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Wed, 20 May 2015 23:15:20 +0200
Subject: iwinfo: update NanoStation (Loco) txpower offsets
diff --git a/package/network/utils/iwinfo/patches/001-update_nanostation_offsets.patch b/package/network/utils/iwinfo/patches/001-update_nanostation_offsets.patch
new file mode 100644
index 0000000000000000000000000000000000000000..1e13570fc2b585a8e33275116370f5438c899633
--- /dev/null
+++ b/package/network/utils/iwinfo/patches/001-update_nanostation_offsets.patch
@@ -0,0 +1,14 @@
+--- a/hardware.txt
++++ b/hardware.txt
+@@ -42,8 +42,9 @@
+ 0x168c 0x0027 0x0777 0x4082 7 0 "Ubiquiti" "SR71"
+ 0x168c 0x0029 0x0777 0x4005 7 0 "Ubiquiti" "SR71-15"
+ 0x168c 0x002a 0x0777 0xe302 12 0 "Ubiquiti" "PicoStation M2" /* ToDo: confirm offset */
+-0x168c 0x002a 0x0777 0xe012 12 0 "Ubiquiti" "NanoStation M2" /* ToDo: confirm offset */
+-0x168c 0x002a 0x0777 0xe005 5 0 "Ubiquiti" "NanoStation M5" /* ToDo: confirm offset */
++0x168c 0x002a 0x0777 0xe012 11 0 "Ubiquiti" "NanoStation M2"
++0x168c 0x002e 0x0777 0xe0a2 8 0 "Ubiquiti" "NanoStation Loco M2"
++0x168c 0x002a 0x0777 0xe005 16 0 "Ubiquiti" "NanoStation M5"
+ 0x168c 0x002a 0x0777 0xe202 12 0 "Ubiquiti" "Bullet M2"
+ 0x168c 0x002a 0x0777 0xe805 5 0 "Ubiquiti" "Bullet M5"
+ 0x168c 0x002a 0x0777 0xe345 0 0 "Ubiquiti" "WispStation M5" /* ToDo: confirm offset */

View File

@ -1,57 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Mon, 2 Nov 2015 02:02:02 +0100
Subject: ipv6: fix crash on ICMPv6 redirects with prohibited/blackholed source
There are other error values besides ip6_null_entry that can be returned by
ip6_route_redirect(): fib6_rule_action() can also result in
ip6_blk_hole_entry and ip6_prohibit_entry if such ip rules are installed.
Only checking for ip6_null_entry in rt6_do_redirect() causes ip6_ins_rt()
to be called with rt->rt6i_table == NULL in these cases, making the kernel
crash.
diff --git a/target/linux/generic/patches-3.18/672-ipv6-fix-crash-on-ICMPv6-redirects-with-prohibited-blackholed-source.patch b/target/linux/generic/patches-3.18/672-ipv6-fix-crash-on-ICMPv6-redirects-with-prohibited-blackholed-source.patch
new file mode 100644
index 0000000000000000000000000000000000000000..6e4b3da3ad820e789f57df71b33ccfc5eaead01e
--- /dev/null
+++ b/target/linux/generic/patches-3.18/672-ipv6-fix-crash-on-ICMPv6-redirects-with-prohibited-blackholed-source.patch
@@ -0,0 +1,39 @@
+From 7426eb388ade0f1ad800c408d7efa227d4f41408 Mon Sep 17 00:00:00 2001
+Message-Id: <7426eb388ade0f1ad800c408d7efa227d4f41408.1446425986.git.mschiffer@universe-factory.net>
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Mon, 2 Nov 2015 01:05:15 +0100
+Subject: [PATCH] ipv6: fix crash on ICMPv6 redirects with
+ prohibited/blackholed source
+
+There are other error values besides ip6_null_entry that can be returned by
+ip6_route_redirect(): fib6_rule_action() can also result in
+ip6_blk_hole_entry and ip6_prohibit_entry if such ip rules are installed.
+
+Only checking for ip6_null_entry in rt6_do_redirect() causes ip6_ins_rt()
+to be called with rt->rt6i_table == NULL in these cases, making the kernel
+crash.
+
+Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
+---
+ net/ipv6/route.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+--- a/net/ipv6/route.c
++++ b/net/ipv6/route.c
+@@ -1766,7 +1766,6 @@ static int ip6_route_del(struct fib6_con
+
+ static void rt6_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_buff *skb)
+ {
+- struct net *net = dev_net(skb->dev);
+ struct netevent_redirect netevent;
+ struct rt6_info *rt, *nrt = NULL;
+ struct ndisc_options ndopts;
+@@ -1827,7 +1826,7 @@ static void rt6_do_redirect(struct dst_e
+ }
+
+ rt = (struct rt6_info *) dst;
+- if (rt == net->ipv6.ip6_null_entry) {
++ if (rt->rt6i_flags & RTF_REJECT) {
+ net_dbg_ratelimited("rt6_redirect: source isn't a valid nexthop for redirect target\n");
+ return;
+ }

View File

@ -1,16 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Tue, 29 Dec 2015 22:48:52 +0100
Subject: lua: fix installation of headers for host build
diff --git a/package/utils/lua/Makefile b/package/utils/lua/Makefile
index 72d56316b45dc484888d219aebd98e651edbe415..c37d99b485d58d955b86a033ea776adb54cfa414 100644
--- a/package/utils/lua/Makefile
+++ b/package/utils/lua/Makefile
@@ -140,6 +140,7 @@ define Host/Install
$(MAKE) -C $(HOST_BUILD_DIR) \
INSTALL_TOP="$(STAGING_DIR_HOST)" \
install
+ $(CP) $(HOST_BUILD_DIR)/src/lnum_config.h $(STAGING_DIR_HOST)/include/
endef
define Build/InstallDev

View File

@ -1,63 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Mon, 4 Jan 2016 10:22:52 +0100
Subject: kernel: fs, seq_file: fallback to vmalloc instead of oom kill processes
diff --git a/target/linux/generic/patches-3.18/089-fs-seq_file-fallback-to-vmalloc-instead-of-oom-kill-.patch b/target/linux/generic/patches-3.18/089-fs-seq_file-fallback-to-vmalloc-instead-of-oom-kill-.patch
new file mode 100644
index 0000000000000000000000000000000000000000..cad56f4275287b73dd5e769ea34daee064ee8d69
--- /dev/null
+++ b/target/linux/generic/patches-3.18/089-fs-seq_file-fallback-to-vmalloc-instead-of-oom-kill-.patch
@@ -0,0 +1,53 @@
+From 5cec38ac866bfb8775638e71a86e4d8cac30caae Mon Sep 17 00:00:00 2001
+Message-Id: <5cec38ac866bfb8775638e71a86e4d8cac30caae.1451899087.git.mschiffer@universe-factory.net>
+From: David Rientjes <rientjes@google.com>
+Date: Fri, 12 Dec 2014 16:56:16 -0800
+Subject: [PATCH] fs, seq_file: fallback to vmalloc instead of oom kill
+ processes
+
+Since commit 058504edd026 ("fs/seq_file: fallback to vmalloc allocation"),
+seq_buf_alloc() falls back to vmalloc() when the kmalloc() for contiguous
+memory fails. This was done to address order-4 slab allocations for
+reading /proc/stat on large machines and noticed because
+PAGE_ALLOC_COSTLY_ORDER < 4, so there is no infinite loop in the page
+allocator when allocating new slab for such high-order allocations.
+
+Contiguous memory isn't necessary for caller of seq_buf_alloc(), however.
+Other GFP_KERNEL high-order allocations that are <=
+PAGE_ALLOC_COSTLY_ORDER will simply loop forever in the page allocator and
+oom kill processes as a result.
+
+We don't want to kill processes so that we can allocate contiguous memory
+in situations when contiguous memory isn't necessary.
+
+This patch does the kmalloc() allocation with __GFP_NORETRY for high-order
+allocations. This still utilizes memory compaction and direct reclaim in
+the allocation path, the only difference is that it will fail immediately
+instead of oom kill processes when out of memory.
+
+[akpm@linux-foundation.org: add comment]
+Signed-off-by: David Rientjes <rientjes@google.com>
+Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
+Cc: Christoph Hellwig <hch@infradead.org>
+Cc: Al Viro <viro@zeniv.linux.org.uk>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+---
+ fs/seq_file.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+--- a/fs/seq_file.c
++++ b/fs/seq_file.c
+@@ -36,7 +36,11 @@ static void *seq_buf_alloc(unsigned long
+ {
+ void *buf;
+
+- buf = kmalloc(size, GFP_KERNEL | __GFP_NOWARN);
++ /*
++ * __GFP_NORETRY to avoid oom-killings with high-order allocations -
++ * it's better to fall back to vmalloc() than to kill things.
++ */
++ buf = kmalloc(size, GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN);
+ if (!buf && size > PAGE_SIZE)
+ buf = vmalloc(size);
+ return buf;

View File

@ -1,74 +0,0 @@
From: Neal Oakey <neal.oakey@bingo-ev.de>
Date: Sun, 14 Feb 2016 20:58:20 +0100
Subject: fix UBNT XM model detection
Signed-off-by: Neal Oakey <neal.oakey@bingo-ev.de>
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index a9dca58847fe1fb62a69c5845fda3206407c6727..0aa1c865cbdeb0624147d4117d289a640d20a5ef 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -64,6 +64,40 @@ wndr3700_board_detect() {
AR71XX_MODEL="$machine"
}
+ubnt_get_mtd_part_magic() {
+ ar71xx_get_mtd_offset_size_format EEPROM 4118 2 %02x
+}
+
+ubnt_xm_board_detect() {
+ local model
+ local magic
+
+ magic="$(ubnt_get_mtd_part_magic)"
+ case ${magic:0:3} in
+ "e00"|\
+ "e01"|\
+ "e80")
+ model="Ubiquiti NanoStation M"
+ ;;
+ "e0a")
+ model="Ubiquiti NanoStation loco M"
+ ;;
+ "e1b"|\
+ "e1d")
+ model="Ubiquiti Rocket M"
+ ;;
+ "e20"|\
+ "e2d")
+ model="Ubiquiti Bullet M"
+ ;;
+ "e30")
+ model="Ubiquiti PicoStation M"
+ ;;
+ esac
+
+ [ ! -z "$model" ] && AR71XX_MODEL="${model}${magic:3:1}"
+}
+
cybertan_get_hw_magic() {
local part
@@ -478,12 +512,14 @@ ar71xx_board_detect() {
;;
*"Bullet M")
name="bullet-m"
+ ubnt_xm_board_detect
;;
*"Loco M XW")
name="loco-m-xw"
;;
*"Nanostation M")
name="nanostation-m"
+ ubnt_xm_board_detect
;;
*"Nanostation M XW")
name="nanostation-m-xw"
@@ -685,6 +721,7 @@ ar71xx_board_detect() {
;;
*"Rocket M")
name="rocket-m"
+ ubnt_xm_board_detect
;;
*"Rocket M XW")
name="rocket-m-xw"

View File

@ -1,133 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Mon, 7 Mar 2016 06:07:21 +0100
Subject: base-files: implemented basic GPIO control
Internal GPIO pins are used for PoE passthrough setups in multi-port
routers. This patch implemnets control over this hardware feature for
Ubiquiti Nanostations and TP-Link CPE510.
Signed-off-by: Lars Kruse <lists@sumpfralle.de>
Backport of r46271
diff --git a/package/base-files/files/etc/init.d/gpio_switch b/package/base-files/files/etc/init.d/gpio_switch
new file mode 100755
index 0000000000000000000000000000000000000000..1f1b44b2129ce2315943f6a10508eefb66412c48
--- /dev/null
+++ b/package/base-files/files/etc/init.d/gpio_switch
@@ -0,0 +1,42 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2015 OpenWrt.org
+
+START=98
+STOP=10
+USE_PROCD=1
+
+
+load_gpio_switch()
+{
+ local name
+ local gpio_pin
+ local value
+
+ config_get gpio_pin "$1" gpio_pin
+ config_get name "$1" name
+ config_get value "$1" value 0
+
+ local gpio_path="/sys/class/gpio/gpio${gpio_pin}"
+ # export GPIO pin for access
+ [ -d "$gpio_path" ] || {
+ echo "$gpio_pin" >/sys/class/gpio/export
+ # we need to wait a bit until the GPIO appears
+ [ -d "$gpio_path" ] || sleep 1
+ echo out >"$gpio_path/direction"
+ }
+ # write 0 or 1 to the "value" field
+ { [ "$value" = "0" ] && echo "0" || echo "1"; } >"$gpio_path/value"
+}
+
+service_triggers()
+{
+ procd_add_reload_trigger "system"
+}
+
+start_service()
+{
+ [ -e /sys/class/gpio/ ] && {
+ config_load system
+ config_foreach load_gpio_switch gpio_switch
+ }
+}
diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh
index 5a8809d68c89ac0431919f15dad5f5c33351bbf2..6577ecdcde0c856b3e6dd1b9337f23cb782ef2be 100644
--- a/package/base-files/files/lib/functions/uci-defaults.sh
+++ b/package/base-files/files/lib/functions/uci-defaults.sh
@@ -2,6 +2,7 @@
# Copyright (C) 2011 OpenWrt.org
UCIDEF_LEDS_CHANGED=0
+UCIDEF_GPIO_SWITCHES_CHANGED=0
ucidef_set_led_netdev() {
local cfg="led_$1"
@@ -180,6 +181,29 @@ ucidef_commit_leds()
[ "$UCIDEF_LEDS_CHANGED" = "1" ] && uci commit system
}
+ucidef_set_gpio_switch() {
+ local cfg="gpio_switch_$1"
+ local name="$2"
+ local gpio_pin="$3"
+ # use "0" as default value
+ local default="${4:-0}"
+
+ uci -q get "system.$cfg" && return 0
+
+ uci batch <<EOF
+set system.$cfg='gpio_switch'
+set system.$cfg.name='$name'
+set system.$cfg.gpio_pin='$gpio_pin'
+set system.$cfg.value='$default'
+EOF
+ UCIDEF_GPIO_SWITCHES_CHANGED=1
+}
+
+ucidef_commit_gpio_switches()
+{
+ [ "$UCIDEF_GPIO_SWITCHES_CHANGED" = "1" ] && uci commit system
+}
+
ucidef_set_interface_loopback() {
uci batch <<EOF
set network.loopback='interface'
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_gpio-switches b/target/linux/ar71xx/base-files/etc/uci-defaults/01_gpio-switches
new file mode 100644
index 0000000000000000000000000000000000000000..81d3982ed8bf98e01ce2e161017f088a1d0f60dc
--- /dev/null
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_gpio-switches
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+
+. /lib/functions/uci-defaults.sh
+. /lib/ar71xx.sh
+
+board=$(ar71xx_board_name)
+
+case "$board" in
+nanostation-m)
+ ucidef_set_gpio_switch "poe_passthrough" "PoE Passthrough" "2"
+ ;;
+nanostation-m-xw)
+ ucidef_set_gpio_switch "poe_passthrough" "PoE Passthrough" "8"
+ ;;
+cpe510)
+ ucidef_set_gpio_switch "poe_passthrough" "PoE Passthrough" "20"
+ ;;
+esac
+
+ucidef_commit_gpio_switches
+
+exit 0

View File

@ -1,32 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Mon, 7 Mar 2016 06:07:59 +0100
Subject: ar71xx: assign proper GPIO pin for Ubiquiti Nanostation models
The GPIO pins for "POE passthrough" of Ubiquiti Nanostation models are the
following:
* Ubiquiti Nanostation M XM: Pin 8
* Ubiquiti Nanostation M XW: Pin 2
The previous definition of the pins was mixed up between XM and XW model.
Signed-off-by: Lars Kruse <lists@sumpfralle.de>
Backport of r46922
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_gpio-switches b/target/linux/ar71xx/base-files/etc/uci-defaults/01_gpio-switches
index 81d3982ed8bf98e01ce2e161017f088a1d0f60dc..b41f27554b1e3eac19c22af59731771631a1135b 100644
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_gpio-switches
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_gpio-switches
@@ -10,10 +10,10 @@ board=$(ar71xx_board_name)
case "$board" in
nanostation-m)
- ucidef_set_gpio_switch "poe_passthrough" "PoE Passthrough" "2"
+ ucidef_set_gpio_switch "poe_passthrough" "PoE Passthrough" "8"
;;
nanostation-m-xw)
- ucidef_set_gpio_switch "poe_passthrough" "PoE Passthrough" "8"
+ ucidef_set_gpio_switch "poe_passthrough" "PoE Passthrough" "2"
;;
cpe510)
ucidef_set_gpio_switch "poe_passthrough" "PoE Passthrough" "20"

View File

@ -1,101 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Fri, 29 Jul 2016 21:28:24 +0200
Subject: netifd: update to latest version
diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile
index 619024bd708541dfb3bda28a963fc87a5d301a0d..dc83ca612bcd4c441e8fa0db77c98c8a1b97ad13 100644
--- a/package/network/config/netifd/Makefile
+++ b/package/network/config/netifd/Makefile
@@ -1,15 +1,15 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=netifd
-PKG_VERSION:=2015-12-16
+PKG_VERSION:=2016-07-29
PKG_RELEASE=$(PKG_SOURCE_VERSION)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=http://git.openwrt.org/project/netifd.git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_VERSION:=245527193e90906451be35c2b8e972b8712ea6ab
+PKG_SOURCE_VERSION:=656c387974879105c2aaec6b62478d0195067f2d
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
-PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
+PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
# PKG_MIRROR_MD5SUM:=
# CMAKE_INSTALL:=1
diff --git a/package/network/config/netifd/files/etc/init.d/network b/package/network/config/netifd/files/etc/init.d/network
index 542fc08958e001c2bfce7668ecd7d1c52a649e4e..bdadbbce6db6f9383a0e2c7fab25e7f5d8823091 100755
--- a/package/network/config/netifd/files/etc/init.d/network
+++ b/package/network/config/netifd/files/etc/init.d/network
@@ -21,7 +21,6 @@ start_service() {
procd_set_param watch network.interface
[ -e /proc/sys/kernel/core_pattern ] && {
procd_set_param limits core="unlimited"
- echo '/tmp/%e.%p.%s.%t.core' > /proc/sys/kernel/core_pattern
}
procd_close_instance
}
diff --git a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
index 0e88af9e96ad85e7c51ff0b497ce71342d2d1568..1d3a2091060aac6b89d8d10f915b11b251011a85 100755
--- a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
+++ b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
@@ -12,6 +12,7 @@ proto_dhcp_init_config() {
proto_config_add_string clientid
proto_config_add_string vendorid
proto_config_add_boolean 'broadcast:bool'
+ proto_config_add_boolean 'release:bool'
proto_config_add_string 'reqopts:list(string)'
proto_config_add_string iface6rd
proto_config_add_string sendopts
@@ -26,8 +27,8 @@ proto_dhcp_setup() {
local config="$1"
local iface="$2"
- local ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes
- json_get_vars ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes
+ local ipaddr hostname clientid vendorid broadcast release reqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes
+ json_get_vars ipaddr hostname clientid vendorid broadcast release reqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes
local opt dhcpopts
for opt in $reqopts; do
@@ -39,6 +40,7 @@ proto_dhcp_setup() {
done
[ "$broadcast" = 1 ] && broadcast="-B" || broadcast=
+ [ "$release" = 1 ] && release="-R" || release=
[ -n "$clientid" ] && clientid="-x 0x3d:${clientid//:/}" || clientid="-C"
[ -n "$iface6rd" ] && proto_export "IFACE6RD=$iface6rd"
[ "$iface6rd" != 0 -a -f /lib/netifd/proto/6rd.sh ] && append dhcpopts "-O 212"
@@ -54,9 +56,9 @@ proto_dhcp_setup() {
-s /lib/netifd/dhcp.script \
-f -t 0 -i "$iface" \
${ipaddr:+-r $ipaddr} \
- ${hostname:+-H $hostname} \
- ${vendorid:+-V $vendorid} \
- $clientid $broadcast $dhcpopts
+ ${hostname:+-x "hostname:$hostname"} \
+ ${vendorid:+-V "$vendorid"} \
+ $clientid $broadcast $release $dhcpopts
}
proto_dhcp_renew() {
diff --git a/package/network/config/netifd/files/sbin/ifup b/package/network/config/netifd/files/sbin/ifup
index af3aaa8453ce93f52c2b89e743f43f9c509ad696..5515b91f76df2b5c36d46ac4b86dfc9bdcd78b1d 100755
--- a/package/network/config/netifd/files/sbin/ifup
+++ b/package/network/config/netifd/files/sbin/ifup
@@ -67,12 +67,10 @@ if [ -n "$setup_wifi" ] && grep -sq config /etc/config/wireless; then
fi
}
- local radio_devs
- local network="$1"
+ network="$1"
config_load wireless
config_foreach find_related_radios wifi-iface
- local dev
for dev in $(echo "$radio_devs" | sort -u); do
/sbin/wifi up "$dev"
done

View File

@ -1,25 +0,0 @@
From: Alexander Dahl <alex@netz39.de>
Date: Thu, 17 Mar 2016 15:04:09 +0100
Subject: x86: fix platform_export_bootpart() for Xen virtual disks
Virtual disk devices in a Xen virtual machine (DomU) can be /dev/xvda,
/dev/xvdb and so on with partitions like /dev/xdva1. Devices named like
this where not considered before. This resulted in a non working
sysupgrade, because the boot partition could not be found.
Signed-off-by: Alexander Dahl <alex@netz39.de>
Suggested-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 73ab5ef0794c942495d18865fa2c2498b84e63e6..adc119c897ed840aef17c2041a48244d0922564e 100644
--- a/target/linux/x86/base-files/lib/upgrade/platform.sh
+++ b/target/linux/x86/base-files/lib/upgrade/platform.sh
@@ -17,7 +17,7 @@ platform_export_bootpart() {
PARTUUID=[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]-02)
uuid="${disk#PARTUUID=}"
uuid="${uuid%-02}"
- for disk in /dev/[hsv]d[a-z]; do
+ for disk in /dev/[hsv]d[a-z] /dev/xvd[a-z]; do
set -- $(dd if=$disk bs=1 skip=440 count=4 2>/dev/null | hexdump -v -e '4/1 "%02x "')
if [ "$4$3$2$1" = "$uuid" ]; then
export BOOTPART="${disk}1"

View File

@ -1,27 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Wed, 30 Mar 2016 02:59:19 +0200
Subject: Support LibreSSL as provider of openssl
The build scripts check for openssl by grepping the string "OpenSSL" in
the output of openssl version command. LibreSSL fails this test as it
outputs something like "LibreSSL 2.2.4". This patch fix the
prereq-bulid.mk file so that it accepts LibreSSL as openssl provider as
well.
Signed-off-by: Marek Behun <kabel@blackhole.sk>
Backport of r48267
diff --git a/include/prereq-build.mk b/include/prereq-build.mk
index 32c4adabb748c4026d507d40769b3201e2ac5599..f36d57ce06c46be7ac33f3034ad08a3ce603089d 100644
--- a/include/prereq-build.mk
+++ b/include/prereq-build.mk
@@ -151,7 +151,7 @@ $(eval $(call SetupHostCommand,file,Please install the 'file' package, \
file --version 2>&1 | grep file))
$(eval $(call SetupHostCommand,openssl,Please install the 'openssl' utility, \
- openssl version | grep OpenSSL))
+ openssl version | grep '\(OpenSSL\|LibreSSL\)'))
# Install ldconfig stub

View File

@ -1,48 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Fri, 1 Apr 2016 23:16:13 +0200
Subject: ar71xx: check both HWID and HWREV on upgrades of TP-LINK devices
There's no reason for us to be more lenient than the stock firmware, so
better check the HWREV as well to avoid bricked devices.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Backport of r49105
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 762cd760ceb9ff3917903dfd26a5a7a42175abfe..024e4930949c927efd36c3ac67cd351dcaa4bf7b 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -66,6 +66,10 @@ tplink_get_image_hwid() {
get_image "$@" | dd bs=4 count=1 skip=16 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
}
+tplink_get_image_mid() {
+ get_image "$@" | dd bs=4 count=1 skip=17 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
+}
+
tplink_get_image_boot_size() {
get_image "$@" | dd bs=4 count=1 skip=37 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
}
@@ -373,13 +377,17 @@ platform_check_image() {
}
local hwid
- local imageid
+ local mid
+ local imagehwid
+ local imagemid
hwid=$(tplink_get_hwid)
- imageid=$(tplink_get_image_hwid "$1")
+ mid=$(tplink_get_mid)
+ imagehwid=$(tplink_get_image_hwid "$1")
+ imagemid=$(tplink_get_image_mid "$1")
- [ "$hwid" != "$imageid" ] && {
- echo "Invalid image, hardware ID mismatch, hw:$hwid image:$imageid."
+ [ "$hwid" != "$imagehwid" -o "$mid" != "$imagemid" ] && {
+ echo "Invalid image, hardware ID mismatch, hw:$hwid $mid image:$imagehwid $imagemid."
return 1
}

View File

@ -1,45 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Fri, 1 Apr 2016 23:19:16 +0200
Subject: ar71xx: avoid AR71XX_MODEL ending with a space on some TP-LINK-like devices
Instead of adding the space when combining $model and $hwver, add the space
to the beginning of $hwver, so the resulting string won't end with a space
when $hwver is set to the empty string.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Backport of r49106
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 0aa1c865cbdeb0624147d4117d289a640d20a5ef..96a37b4bec019d06c9283afc44b7961d150c05fb 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -133,7 +133,7 @@ tplink_board_detect() {
hwid=$(tplink_get_hwid)
mid=$(tplink_get_mid)
hwver=${hwid:6:2}
- hwver="v${hwver#0}"
+ hwver=" v${hwver#0}"
case "$hwid" in
"015000"*)
@@ -196,8 +196,8 @@ tplink_board_detect() {
"083000"*)
model="TP-Link TL-WA830RE"
- if [ "$hwver" = 'v10' ]; then
- hwver='v1'
+ if [ "$hwver" = ' v10' ]; then
+ hwver=' v1'
fi
;;
"084100"*)
@@ -296,7 +296,7 @@ tplink_board_detect() {
;;
esac
- AR71XX_MODEL="$model $hwver"
+ AR71XX_MODEL="$model$hwver"
}
tplink_pharos_get_model_string() {

View File

@ -1,39 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Fri, 1 Apr 2016 23:21:32 +0200
Subject: ar71xx: fix the revision of a few TP-LINK devices in AR71XX_MODEL to match labels/image names
Let's not confuse users about the revisions of their devices when we can
easily avoid it.
Not tested on real hardware.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Backport of r49107
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 96a37b4bec019d06c9283afc44b7961d150c05fb..6c106179bfa0c01308a03678aef1b7cf4caaf05b 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -162,6 +162,10 @@ tplink_board_detect() {
;;
"071000"*)
model="TP-Link TL-WR710N"
+
+ if [ "$hwid" = '07100002' -a "$mid" = '00000002' ]; then
+ hwver=' v2.1'
+ fi
;;
"072001"*)
model="TP-Link TL-WR720N"
@@ -202,6 +206,10 @@ tplink_board_detect() {
;;
"084100"*)
model="TP-Link TL-WR841N/ND"
+
+ if [ "$hwid" = '08410002' -a "$mid" = '00000002' ]; then
+ hwver=' v1.5'
+ fi
;;
"084200"*)
model="TP-Link TL-WR842N/ND"

View File

@ -1,41 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sat, 2 Apr 2016 00:56:50 +0200
Subject: ar71xx: build image for TL-WR710N v2.1
This patch just extends target/linux/ar71xx/image/Makefile to build
images also for version 2.1 of TL-WR710N
patch against the latest git
Signed off by: Norbert Wegener <nw@wegener-net.de>
Backport of r47849
diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
index a8073f2ecadce8404dde77278302202fe494cd75..0783381baeddef2064df8faff89c49c2bed6a28b 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -476,6 +476,15 @@ define Device/tl-wr710n-v2
CONSOLE := ttyATH0,115200
endef
+define Device/tl-wr710n-v2.1
+ $(Device/tplink-8mlzma)
+ BOARDNAME := TL-WR710N
+ DEVICE_PROFILE := TLWR710
+ TPLINK_HWID := 0x07100002
+ TPLINK_HWREV := 0x00000002
+ CONSOLE := ttyATH0,115200
+endef
+
define Device/tl-wr720n-v3
$(Device/tplink-4mlzma)
BOARDNAME := TL-WR720N-v3
@@ -491,7 +500,7 @@ define Device/tl-wr720n-v4
TPLINK_HWID := 0x07200104
CONSOLE := ttyATH0,115200
endef
-TARGET_DEVICES += tl-wr703n-v1 tl-wr710n-v1 tl-wr710n-v2 tl-wr720n-v3 tl-wr720n-v4
+TARGET_DEVICES += tl-wr703n-v1 tl-wr710n-v1 tl-wr710n-v2 tl-wr710n-v2.1 tl-wr720n-v3 tl-wr720n-v4
define Device/tl-wr740n-v4
$(Device/tplink-4mlzma)

View File

@ -1,81 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sun, 24 Apr 2016 08:44:30 +0200
Subject: tools: add tar host build, required for --sort=name which was only added in the latest version
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Backport of r46876
diff --git a/tools/Makefile b/tools/Makefile
index c6cded8eccd81c422f99e7ee50754c4bc66decc7..98ce8c5f1577981136b277a800a3edd5edd4941e 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -81,6 +81,9 @@ endif
# dependency for tools which have patches directory
$(foreach tool, $(tools-y), $(if $(wildcard $(curdir)/$(tool)/patches),$(eval $(curdir)/$(tool)/compile += $(curdir)/patch/install)))
+$(foreach tool, $(tools-y), $(eval $(curdir)/$(tool)/compile += $(curdir)/tar/install))
+tools-y += tar
+
$(curdir)/builddirs := $(tools-y) $(tools-dep) $(tools-)
$(curdir)/builddirs-default := $(tools-y)
diff --git a/tools/tar/Makefile b/tools/tar/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..975e7835ef09131326ef10a7951c3866d6050801
--- /dev/null
+++ b/tools/tar/Makefile
@@ -0,0 +1,30 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=tar
+PKG_VERSION:=1.28
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=@GNU/tar
+PKG_MD5SUM:=49b6306167724fe48f419a33a5beb857
+
+HOST_BUILD_PARALLEL := 1
+
+include $(INCLUDE_DIR)/host-build.mk
+
+HOSTCC := $(HOSTCC_NOCACHE)
+HOSTCXX := $(HOSTCXX_NOCACHE)
+
+HOST_CONFIGURE_ARGS += \
+ --without-posix-acls \
+ --without-selinux \
+ --without-xattrs \
+ --disable-acl \
+ --disable-nls
+
+$(eval $(call HostBuild))
diff --git a/tools/tar/patches/100-fix_xattr_disable.patch b/tools/tar/patches/100-fix_xattr_disable.patch
new file mode 100644
index 0000000000000000000000000000000000000000..5735bd2364a4f324b54a3a49826921ead905d06f
--- /dev/null
+++ b/tools/tar/patches/100-fix_xattr_disable.patch
@@ -0,0 +1,17 @@
+--- a/lib/xattr-at.c
++++ b/lib/xattr-at.c
+@@ -18,6 +18,8 @@
+
+ #include <config.h>
+
++#ifdef HAVE_XATTRS
++
+ #include "xattr-at.h"
+ #include "openat.h"
+
+@@ -108,3 +110,5 @@
+ #undef AT_FUNC_RESULT
+ #undef AT_FUNC_POST_FILE_PARAM_DECLS
+ #undef AT_FUNC_POST_FILE_ARGS
++
++#endif

View File

@ -1,31 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sun, 24 Apr 2016 08:44:47 +0200
Subject: tools: compile flock before everything else
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Backport of r48413
diff --git a/tools/Makefile b/tools/Makefile
index 98ce8c5f1577981136b277a800a3edd5edd4941e..3402c08d5c6729a510446a3e9cf586f2d8e15be4 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -26,7 +26,7 @@ endif
tools-$(BUILD_TOOLCHAIN) += gmp mpfr mpc libelf
tools-y += m4 libtool autoconf automake flex bison pkg-config sed mklibs
tools-y += sstrip make-ext4fs e2fsprogs mtd-utils mkimage
-tools-y += firmware-utils patch-image patch quilt yaffs2 flock padjffs2
+tools-y += firmware-utils patch-image patch quilt yaffs2 padjffs2
tools-y += mm-macros missing-macros xz cmake scons bc findutils gengetopt patchelf
tools-$(CONFIG_TARGET_orion_generic) += wrt350nv2-builder upslug2
tools-$(CONFIG_powerpc) += upx
@@ -84,6 +84,9 @@ $(foreach tool, $(tools-y), $(if $(wildcard $(curdir)/$(tool)/patches),$(eval $(
$(foreach tool, $(tools-y), $(eval $(curdir)/$(tool)/compile += $(curdir)/tar/install))
tools-y += tar
+$(curdir)/tar/compile := $(curdir)/flock/install
+tools-y += flock
+
$(curdir)/builddirs := $(tools-y) $(tools-dep) $(tools-)
$(curdir)/builddirs-default := $(tools-y)

View File

@ -1,32 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sun, 24 Apr 2016 08:45:44 +0200
Subject: rules.mk: make the locked template available even if flock has not been built yet (fall back to unlocked shell command)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Backport of r48414
diff --git a/rules.mk b/rules.mk
index 9d0134d2b26a52b74d30546cc3d51f7e71d1bc75..ece502609bd08af21be782a706f0bf6599895568 100644
--- a/rules.mk
+++ b/rules.mk
@@ -310,12 +310,16 @@ endef
# Execute commands under flock
# $(1) => The shell expression.
# $(2) => The lock name. If not given, the global lock will be used.
-define locked
+ifneq ($(wildcard $(STAGING_DIR_HOST)/bin/flock),)
+ define locked
SHELL= \
- $(STAGING_DIR_HOST)/bin/flock \
+ flock \
$(TMP_DIR)/.$(if $(2),$(strip $(2)),global).flock \
-c '$(subst ','\'',$(1))'
-endef
+ endef
+else
+ locked=$(1)
+endif
# Recursively copy paths into another directory, purge dangling
# symlinks before.

View File

@ -1,20 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sun, 24 Apr 2016 08:48:45 +0200
Subject: build: add locking for downloads (fixes race conditions with multiple variants)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Backport of r48416
diff --git a/include/download.mk b/include/download.mk
index e518cce4b2793152b7f4ef92509f2be07fb5cd62..9176b11c836123a37533c3d6cbaa2650a4f7c73d 100644
--- a/include/download.mk
+++ b/include/download.mk
@@ -182,6 +182,6 @@ define Download
$(DL_DIR)/$(FILE):
mkdir -p $(DL_DIR)
- $(if $(DownloadMethod/$(call dl_method,$(URL),$(PROTO))),$(DownloadMethod/$(call dl_method,$(URL),$(PROTO))),$(DownloadMethod/unknown))
+ $(call locked,$(if $(DownloadMethod/$(call dl_method,$(URL),$(PROTO))),$(DownloadMethod/$(call dl_method,$(URL),$(PROTO))),$(DownloadMethod/unknown)),$(FILE))
endef

View File

@ -1,26 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sun, 24 Apr 2016 08:49:27 +0200
Subject: download.mk: fix packed checkout mirroring support
Changeset r48416 broke the downloading of mirrored, packed scm checkouts.
Fix this by removing the "@" sign in front of the download command which is
now executed as part of a larger shell command under flock.
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Backport of r48733
diff --git a/include/download.mk b/include/download.mk
index 9176b11c836123a37533c3d6cbaa2650a4f7c73d..130bbc57ba89b4ad0b8e8600f45bf553ad6ecfa1 100644
--- a/include/download.mk
+++ b/include/download.mk
@@ -48,7 +48,7 @@ define DownloadMethod/default
endef
define wrap_mirror
- $(if $(if $(MIRROR),$(filter-out x,$(MIRROR_MD5SUM))),@$(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(FILE)" "$(MIRROR_MD5SUM)" "" || ( $(1) ),$(1))
+$(if $(if $(MIRROR),$(filter-out x,$(MIRROR_MD5SUM))),$(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(FILE)" "$(MIRROR_MD5SUM)" "" || ( $(1) ),$(1))
endef
define DownloadMethod/cvs

View File

@ -1,115 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sat, 7 May 2016 00:17:55 +0200
Subject: kernel: mtd: spi-nor: wait until status register writes are ready
diff --git a/target/linux/generic/patches-3.18/094-0001-mtd-spi-nor-wait-until-lock-unlock-operations-are-re.patch b/target/linux/generic/patches-3.18/094-0001-mtd-spi-nor-wait-until-lock-unlock-operations-are-re.patch
new file mode 100644
index 0000000000000000000000000000000000000000..2c2e5f32259416f0cc7f342e420ffbd32c139d97
--- /dev/null
+++ b/target/linux/generic/patches-3.18/094-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
+@@ -462,6 +462,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);
+
+@@ -498,7 +499,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);
+ }
+
+ /*
+@@ -512,6 +516,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);
+
+@@ -546,7 +551,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-3.18/094-0002-mtd-spi-nor-wait-for-SR_WIP-to-clear-on-initial-unlo.patch b/target/linux/generic/patches-3.18/094-0002-mtd-spi-nor-wait-for-SR_WIP-to-clear-on-initial-unlo.patch
new file mode 100644
index 0000000000000000000000000000000000000000..a0573d5aea939c965cb44b2e72a2b7d498b0a5cd
--- /dev/null
+++ b/target/linux/generic/patches-3.18/094-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
+@@ -1167,6 +1167,7 @@ int spi_nor_scan(struct spi_nor *nor, co
+ JEDEC_MFR(info) == SNOR_MFR_SST) {
+ write_enable(nor);
+ write_sr(nor, 0);
++ spi_nor_wait_till_ready(nor);
+ }
+
+ if (!mtd->name)

View File

@ -1,56 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sat, 7 May 2016 00:29:06 +0200
Subject: kernel: mtd: spi-nor: unlock Winbond flashs
diff --git a/target/linux/generic/patches-3.18/463-Revert-mtd-spi-nor-fix-Spansion-regressions-aliased-.patch b/target/linux/generic/patches-3.18/463-Revert-mtd-spi-nor-fix-Spansion-regressions-aliased-.patch
new file mode 100644
index 0000000000000000000000000000000000000000..4682b7a77b160a0814012d26f0edf1a7bfaf5312
--- /dev/null
+++ b/target/linux/generic/patches-3.18/463-Revert-mtd-spi-nor-fix-Spansion-regressions-aliased-.patch
@@ -0,0 +1,46 @@
+From 20bbd73b6b04677a73933830363ab3178adc2ce9 Mon Sep 17 00:00:00 2001
+Message-Id: <20bbd73b6b04677a73933830363ab3178adc2ce9.1462573588.git.mschiffer@universe-factory.net>
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Sat, 7 May 2016 00:26:23 +0200
+Subject: [PATCH] Revert "mtd: spi-nor: fix Spansion regressions (aliased with
+ Winbond)"
+
+This reverts commit 67b9bcd36906e12a15ffec19463afbbd6a41660e.
+---
+ drivers/mtd/spi-nor/spi-nor.c | 6 ++++--
+ include/linux/mtd/spi-nor.h | 2 +-
+ 2 files changed, 5 insertions(+), 3 deletions(-)
+
+--- a/drivers/mtd/spi-nor/spi-nor.c
++++ b/drivers/mtd/spi-nor/spi-nor.c
+@@ -1165,7 +1165,8 @@ int spi_nor_scan(struct spi_nor *nor, co
+ if (JEDEC_MFR(info) == SNOR_MFR_ATMEL ||
+ JEDEC_MFR(info) == SNOR_MFR_INTEL ||
+ JEDEC_MFR(info) == SNOR_MFR_MACRONIX ||
+- JEDEC_MFR(info) == SNOR_MFR_SST) {
++ JEDEC_MFR(info) == SNOR_MFR_SST ||
++ JEDEC_MFR(info) == SNOR_MFR_WINBOND) {
+ write_enable(nor);
+ write_sr(nor, 0);
+ spi_nor_wait_till_ready(nor);
+@@ -1182,7 +1183,8 @@ int spi_nor_scan(struct spi_nor *nor, co
+ mtd->_read = spi_nor_read;
+
+ /* NOR protection support for STmicro/Micron chips and similar */
+- if (JEDEC_MFR(info) == SNOR_MFR_MICRON) {
++ if (JEDEC_MFR(info) == SNOR_MFR_MICRON ||
++ JEDEC_MFR(info) == SNOR_MFR_WINBOND) {
+ nor->flash_lock = stm_lock;
+ nor->flash_unlock = stm_unlock;
+ nor->flash_is_locked = stm_is_locked;
+--- a/include/linux/mtd/spi-nor.h
++++ b/include/linux/mtd/spi-nor.h
+@@ -25,7 +25,7 @@
+ #define SNOR_MFR_MACRONIX CFI_MFR_MACRONIX
+ #define SNOR_MFR_SPANSION CFI_MFR_AMD
+ #define SNOR_MFR_SST CFI_MFR_SST
+-#define SNOR_MFR_WINBOND 0xef /* Also used by some Spansion */
++#define SNOR_MFR_WINBOND 0xef
+
+ /*
+ * Note on opcode nomenclature: some opcodes have a format like

View File

@ -1,46 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Fri, 13 May 2016 20:59:44 +0200
Subject: ath79: dev-eth: fix QCA9561 set phy interface mode and mask
QCA9563 and QCA9561 are two series of Qualcomm SoC Dragonfly. The only different
is QCA9563 w/o internal switch. It has one GMAC with SGMII interface. But they
have the same device ID(0x1150). So they share the same codes.
Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
Backport of OpenWrt r46971
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 ff94e2ec3733b9473c4c3191cb47bd4ba8ac784d..31d24388d274b92e01642ad6d7f59d22f80dc2a6 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
@@ -633,7 +633,6 @@ static int __init ath79_setup_phy_if_mode(unsigned int id,
case ATH79_SOC_AR9330:
case ATH79_SOC_AR9331:
case ATH79_SOC_QCA9533:
- case ATH79_SOC_QCA9561:
case ATH79_SOC_TP9343:
pdata->phy_if_mode = PHY_INTERFACE_MODE_MII;
break;
@@ -667,6 +666,11 @@ static int __init ath79_setup_phy_if_mode(unsigned int id,
}
break;
+ case ATH79_SOC_QCA9561:
+ if (!pdata->phy_if_mode)
+ pdata->phy_if_mode = PHY_INTERFACE_MODE_MII;
+ break;
+
default:
BUG();
}
@@ -1035,7 +1039,8 @@ void __init ath79_register_eth(unsigned int id)
AR933X_RESET_GE0_MDIO;
pdata->set_speed = ath79_set_speed_dummy;
- pdata->phy_mask = BIT(4);
+ if (!pdata->phy_mask)
+ pdata->phy_mask = BIT(4);
} else {
pdata->reset_bit = AR933X_RESET_GE1_MAC |
AR933X_RESET_GE1_MDIO;

View File

@ -1,33 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Fri, 13 May 2016 22:58:50 +0200
Subject: ar71xx: use correct PLL configuration register bitmask for QCA956x SoC.
Incorrect value causes clock inaccuracy as huge as 1/60.
Signed-off-by: Dmitry Ivanov <dima@ubnt.com>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Backport of OpenWrt r47363
diff --git a/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch b/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch
index 0da81426ca7b1b1db46e869745f0ed00496bef78..2bb4286e5d805ff3c47486a1f091d2b5e6d78373 100644
--- a/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch
+++ b/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch
@@ -529,7 +529,7 @@
+#define QCA956X_PLL_CPU_CONFIG1_NFRAC_L_SHIFT 0
+#define QCA956X_PLL_CPU_CONFIG1_NFRAC_L_MASK 0x1f
+#define QCA956X_PLL_CPU_CONFIG1_NFRAC_H_SHIFT 5
-+#define QCA956X_PLL_CPU_CONFIG1_NFRAC_H_MASK 0x3fff
++#define QCA956X_PLL_CPU_CONFIG1_NFRAC_H_MASK 0x1fff
+#define QCA956X_PLL_CPU_CONFIG1_NINT_SHIFT 18
+#define QCA956X_PLL_CPU_CONFIG1_NINT_MASK 0x1ff
+
@@ -541,7 +541,7 @@
+#define QCA956X_PLL_DDR_CONFIG1_NFRAC_L_SHIFT 0
+#define QCA956X_PLL_DDR_CONFIG1_NFRAC_L_MASK 0x1f
+#define QCA956X_PLL_DDR_CONFIG1_NFRAC_H_SHIFT 5
-+#define QCA956X_PLL_DDR_CONFIG1_NFRAC_H_MASK 0x3fff
++#define QCA956X_PLL_DDR_CONFIG1_NFRAC_H_MASK 0x1fff
+#define QCA956X_PLL_DDR_CONFIG1_NINT_SHIFT 18
+#define QCA956X_PLL_DDR_CONFIG1_NINT_MASK 0x1ff
+

View File

@ -1,415 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Fri, 13 May 2016 22:18:40 +0200
Subject: ar71xx: update QCA956x support
- separate qca956x and tp9343 (they use different IDs)
- rename qca9561->qca956x for consistency
- add missing bits (device reset, gpio output select)
- fix wmac setup
Signed-off-by: Roman Yeryomin <roman@advem.lv>
Backport of OpenWrt r47981
diff --git a/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch b/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch
index 2bb4286e5d805ff3c47486a1f091d2b5e6d78373..61b897690a03fd46d2ea95451a09598b272266f9 100644
--- a/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch
+++ b/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch
@@ -105,7 +105,7 @@
qca953x_clocks_init();
else if (soc_is_qca955x())
qca955x_clocks_init();
-+ else if (soc_is_qca956x())
++ else if (soc_is_qca956x() || soc_is_tp9343())
+ qca956x_clocks_init();
else
BUG();
@@ -116,7 +116,7 @@
reg = QCA953X_RESET_REG_RESET_MODULE;
else if (soc_is_qca955x())
reg = QCA955X_RESET_REG_RESET_MODULE;
-+ else if (soc_is_qca956x())
++ else if (soc_is_qca956x() || soc_is_tp9343())
+ reg = QCA956X_RESET_REG_RESET_MODULE;
else
panic("Reset register not defined for this SOC");
@@ -125,20 +125,30 @@
reg = QCA953X_RESET_REG_RESET_MODULE;
else if (soc_is_qca955x())
reg = QCA955X_RESET_REG_RESET_MODULE;
-+ else if (soc_is_qca956x())
++ else if (soc_is_qca956x() || soc_is_tp9343())
+ reg = QCA956X_RESET_REG_RESET_MODULE;
else
panic("Reset register not defined for this SOC");
+@@ -133,6 +137,8 @@ u32 ath79_device_reset_get(u32 mask)
+ reg = AR933X_RESET_REG_RESET_MODULE;
+ else if (soc_is_ar934x())
+ reg = AR934X_RESET_REG_RESET_MODULE;
++ else if (soc_is_qca956x() || soc_is_tp9343())
++ reg = QCA956X_RESET_REG_RESET_MODULE;
+ else
+ BUG();
+
--- a/arch/mips/ath79/dev-common.c
+++ b/arch/mips/ath79/dev-common.c
-@@ -94,7 +94,8 @@ void __init ath79_register_uart(void)
+@@ -94,7 +94,9 @@ void __init ath79_register_uart(void)
soc_is_ar913x() ||
soc_is_ar934x() ||
soc_is_qca953x() ||
- soc_is_qca955x()) {
+ soc_is_qca955x() ||
-+ soc_is_qca956x()) {
++ soc_is_qca956x() ||
++ soc_is_tp9343()) {
ath79_uart_data[0].uartclk = uart_clk_rate;
platform_device_register(&ath79_uart_device);
} else if (soc_is_ar933x()) {
@@ -168,14 +178,14 @@
qca953x_usb_setup();
else if (soc_is_qca955x())
qca955x_usb_setup();
-+ else if (soc_is_qca9561())
++ else if (soc_is_qca956x())
+ qca956x_usb_setup();
else
BUG();
}
--- a/arch/mips/ath79/dev-wmac.c
+++ b/arch/mips/ath79/dev-wmac.c
-@@ -189,6 +189,24 @@ static void qca955x_wmac_setup(void)
+@@ -189,6 +189,26 @@ static void qca955x_wmac_setup(void)
ath79_wmac_data.is_clk_25mhz = true;
}
@@ -195,16 +205,18 @@
+ ath79_wmac_data.is_clk_25mhz = false;
+ else
+ ath79_wmac_data.is_clk_25mhz = true;
++
++ ath79_wmac_data.get_mac_revision = ar93xx_get_soc_revision;
+}
+
static bool __init
ar93xx_wmac_otp_read_word(void __iomem *base, int addr, u32 *data)
{
-@@ -392,6 +410,8 @@ void __init ath79_register_wmac(u8 *cal_
+@@ -392,6 +412,8 @@ void __init ath79_register_wmac(u8 *cal_
qca953x_wmac_setup();
else if (soc_is_qca955x())
qca955x_wmac_setup();
-+ else if (soc_is_qca956x())
++ else if (soc_is_qca956x() || soc_is_tp9343())
+ qca956x_wmac_setup();
else
BUG();
@@ -216,27 +228,38 @@
case REV_ID_MAJOR_QCA9556:
case REV_ID_MAJOR_QCA9558:
+ case REV_ID_MAJOR_TP9343:
-+ case REV_ID_MAJOR_QCA9561:
++ case REV_ID_MAJOR_QCA956X:
_prom_putchar = prom_putchar_ar71xx;
break;
--- a/arch/mips/ath79/gpio.c
+++ b/arch/mips/ath79/gpio.c
-@@ -148,7 +148,8 @@ static void __iomem *ath79_gpio_get_func
+@@ -148,7 +148,10 @@ static void __iomem *ath79_gpio_get_func
soc_is_ar913x() ||
soc_is_ar933x())
reg = AR71XX_GPIO_REG_FUNC;
- else if (soc_is_ar934x() || soc_is_qca953x())
+ else if (soc_is_ar934x() ||
-+ soc_is_qca953x() || soc_is_qca956x())
++ soc_is_qca953x() ||
++ soc_is_qca956x() ||
++ soc_is_tp9343())
reg = AR934X_GPIO_REG_FUNC;
else
BUG();
-@@ -228,12 +229,15 @@ void __init ath79_gpio_init(void)
+@@ -187,7 +190,7 @@ void __init ath79_gpio_output_select(uns
+ unsigned int reg;
+ u32 t, s;
+
+- BUG_ON(!soc_is_ar934x() && !soc_is_qca953x());
++ BUG_ON(!soc_is_ar934x() && !soc_is_qca953x() && !soc_is_qca956x());
+
+ if (gpio >= AR934X_GPIO_COUNT)
+ return;
+@@ -228,12 +231,15 @@ void __init ath79_gpio_init(void)
ath79_gpio_count = QCA953X_GPIO_COUNT;
else if (soc_is_qca955x())
ath79_gpio_count = QCA955X_GPIO_COUNT;
-+ else if (soc_is_qca956x())
++ else if (soc_is_qca956x() || soc_is_tp9343())
+ ath79_gpio_count = QCA956X_GPIO_COUNT;
else
BUG();
@@ -245,23 +268,24 @@
ath79_gpio_chip.ngpio = ath79_gpio_count;
- if (soc_is_ar934x() || soc_is_qca953x() || soc_is_qca955x()) {
+ if (soc_is_ar934x() || soc_is_qca953x() || soc_is_qca955x() ||
-+ soc_is_qca956x()) {
++ soc_is_qca956x() || soc_is_tp9343()) {
ath79_gpio_chip.direction_input = ar934x_gpio_direction_input;
ath79_gpio_chip.direction_output = ar934x_gpio_direction_output;
}
--- a/arch/mips/ath79/irq.c
+++ b/arch/mips/ath79/irq.c
-@@ -107,7 +107,8 @@ static void __init ath79_misc_irq_init(v
+@@ -107,7 +107,9 @@ static void __init ath79_misc_irq_init(v
soc_is_ar933x() ||
soc_is_ar934x() ||
soc_is_qca953x() ||
- soc_is_qca955x())
+ soc_is_qca955x() ||
-+ soc_is_qca956x())
++ soc_is_qca956x() ||
++ soc_is_tp9343())
ath79_misc_irq_chip.irq_ack = ar724x_misc_irq_ack;
else
BUG();
-@@ -268,6 +269,97 @@ static void qca955x_irq_init(void)
+@@ -268,6 +270,97 @@ static void qca955x_irq_init(void)
irq_set_chained_handler(ATH79_CPU_IRQ(3), qca955x_ip3_irq_dispatch);
}
@@ -359,21 +383,21 @@
asmlinkage void plat_irq_dispatch(void)
{
unsigned long pending;
-@@ -397,6 +489,9 @@ void __init arch_init_irq(void)
+@@ -397,6 +490,9 @@ void __init arch_init_irq(void)
} else if (soc_is_qca955x()) {
ath79_ip2_handler = ath79_default_ip2_handler;
ath79_ip3_handler = ath79_default_ip3_handler;
-+ } else if (soc_is_qca956x()) {
++ } else if (soc_is_qca956x() || soc_is_tp9343()) {
+ ath79_ip2_handler = ath79_default_ip2_handler;
+ ath79_ip3_handler = ath79_default_ip3_handler;
} else {
BUG();
}
-@@ -411,4 +506,6 @@ void __init arch_init_irq(void)
+@@ -411,4 +507,6 @@ void __init arch_init_irq(void)
qca953x_irq_init();
else if (soc_is_qca955x())
qca955x_irq_init();
-+ else if (soc_is_qca956x())
++ else if (soc_is_qca956x() || soc_is_tp9343())
+ qca956x_irq_init();
}
--- a/arch/mips/ath79/Kconfig
@@ -428,7 +452,7 @@
} else if (soc_is_qca955x()) {
ath79_pci_irq_map = qca955x_pci_irq_map;
ath79_pci_nr_irqs = ARRAY_SIZE(qca955x_pci_irq_map);
-+ } else if (soc_is_qca9561()) {
++ } else if (soc_is_qca956x()) {
+ ath79_pci_irq_map = qca956x_pci_irq_map;
+ ath79_pci_nr_irqs = ARRAY_SIZE(qca956x_pci_irq_map);
} else {
@@ -438,7 +462,7 @@
QCA955X_PCI_MEM_SIZE,
1,
ATH79_IP3_IRQ(2));
-+ } else if (soc_is_qca9561()) {
++ } else if (soc_is_qca956x()) {
+ pdev = ath79_register_pci_ar724x(0,
+ QCA956X_PCI_CFG_BASE1,
+ QCA956X_PCI_CTRL_BASE1,
@@ -456,15 +480,15 @@
rev = id & QCA955X_REV_ID_REVISION_MASK;
break;
-+ case REV_ID_MAJOR_TP9343:
-+ ath79_soc = ATH79_SOC_TP9343;
-+ chip = "9343";
++ case REV_ID_MAJOR_QCA956X:
++ ath79_soc = ATH79_SOC_QCA956X;
++ chip = "956X";
+ rev = id & QCA956X_REV_ID_REVISION_MASK;
+ break;
+
-+ case REV_ID_MAJOR_QCA9561:
-+ ath79_soc = ATH79_SOC_QCA9561;
-+ chip = "9561";
++ case REV_ID_MAJOR_TP9343:
++ ath79_soc = ATH79_SOC_TP9343;
++ chip = "9343";
+ rev = id & QCA956X_REV_ID_REVISION_MASK;
+ break;
+
@@ -476,7 +500,7 @@
ath79_soc_rev = rev;
- if (soc_is_qca953x() || soc_is_qca955x())
-+ if (soc_is_qca953x() || soc_is_qca955x() || soc_is_qca9561())
++ if (soc_is_qca953x() || soc_is_qca955x() || soc_is_qca956x())
sprintf(ath79_sys_type, "Qualcomm Atheros QCA%s ver %u rev %u",
chip, ver, rev);
+ else if (soc_is_tp9343())
@@ -511,7 +535,21 @@
#define AR9300_OTP_BASE 0x14000
#define AR9300_OTP_STATUS 0x15f18
#define AR9300_OTP_STATUS_TYPE 0x7
-@@ -375,6 +392,49 @@
+@@ -152,6 +169,13 @@
+ #define AR9300_OTP_READ_DATA 0x15f1c
+
+ /*
++ * Hidden Registers
++ */
++#define QCA956X_DAM_RESET_OFFSET 0xb90001bc
++#define QCA956X_DAM_RESET_SIZE 0x4
++#define QCA956X_INLINE_CHKSUM_ENG BIT(27)
++
++/*
+ * DDR_CTRL block
+ */
+ #define AR71XX_DDR_REG_PCI_WIN0 0x7c
+@@ -375,6 +399,49 @@
#define QCA955X_PLL_CLK_CTRL_DDRCLK_FROM_DDRPLL BIT(21)
#define QCA955X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24)
@@ -561,7 +599,7 @@
/*
* USB_CONFIG block
*/
-@@ -422,6 +482,11 @@
+@@ -422,6 +489,11 @@
#define QCA955X_RESET_REG_BOOTSTRAP 0xb0
#define QCA955X_RESET_REG_EXT_INT_STATUS 0xac
@@ -573,7 +611,7 @@
#define MISC_INT_ETHSW BIT(12)
#define MISC_INT_TIMER4 BIT(10)
#define MISC_INT_TIMER3 BIT(9)
-@@ -596,6 +661,8 @@
+@@ -596,6 +668,8 @@
#define QCA955X_BOOTSTRAP_REF_CLK_40 BIT(4)
@@ -582,7 +620,7 @@
#define AR934X_PCIE_WMAC_INT_WMAC_MISC BIT(0)
#define AR934X_PCIE_WMAC_INT_WMAC_TX BIT(1)
#define AR934X_PCIE_WMAC_INT_WMAC_RXLP BIT(2)
-@@ -663,6 +730,37 @@
+@@ -663,6 +737,37 @@
QCA955X_EXT_INT_PCIE_RC2_INT1 | QCA955X_EXT_INT_PCIE_RC2_INT2 | \
QCA955X_EXT_INT_PCIE_RC2_INT3)
@@ -620,16 +658,16 @@
#define REV_ID_MAJOR_MASK 0xfff0
#define REV_ID_MAJOR_AR71XX 0x00a0
#define REV_ID_MAJOR_AR913X 0x00b0
-@@ -678,6 +776,8 @@
+@@ -678,6 +783,8 @@
#define REV_ID_MAJOR_QCA9533_V2 0x0160
#define REV_ID_MAJOR_QCA9556 0x0130
#define REV_ID_MAJOR_QCA9558 0x1130
+#define REV_ID_MAJOR_TP9343 0x0150
-+#define REV_ID_MAJOR_QCA9561 0x1150
++#define REV_ID_MAJOR_QCA956X 0x1150
#define AR71XX_REV_ID_MINOR_MASK 0x3
#define AR71XX_REV_ID_MINOR_AR7130 0x0
-@@ -702,6 +802,8 @@
+@@ -702,6 +809,8 @@
#define QCA955X_REV_ID_REVISION_MASK 0xf
@@ -638,7 +676,7 @@
/*
* SPI block
*/
-@@ -774,6 +876,19 @@
+@@ -766,6 +875,19 @@
#define QCA953X_GPIO_OUT_MUX_LED_LINK4 44
#define QCA953X_GPIO_OUT_MUX_LED_LINK5 45
@@ -658,7 +696,7 @@
#define AR71XX_GPIO_COUNT 16
#define AR7240_GPIO_COUNT 18
#define AR7241_GPIO_COUNT 20
-@@ -782,6 +897,7 @@
+@@ -774,6 +896,7 @@
#define AR934X_GPIO_COUNT 23
#define QCA953X_GPIO_COUNT 18
#define QCA955X_GPIO_COUNT 24
@@ -673,11 +711,11 @@
ATH79_SOC_QCA9556,
ATH79_SOC_QCA9558,
+ ATH79_SOC_TP9343,
-+ ATH79_SOC_QCA9561,
++ ATH79_SOC_QCA956X,
};
extern enum ath79_soc_type ath79_soc;
-@@ -126,6 +128,21 @@ static inline int soc_is_qca955x(void)
+@@ -126,6 +128,26 @@ static inline int soc_is_qca955x(void)
return soc_is_qca9556() || soc_is_qca9558();
}
@@ -685,15 +723,20 @@
+{
+ return ath79_soc == ATH79_SOC_TP9343;
+}
-+
++
+static inline int soc_is_qca9561(void)
+{
-+ return ath79_soc == ATH79_SOC_QCA9561;
++ return ath79_soc == ATH79_SOC_QCA956X;
++}
++
++static inline int soc_is_qca9563(void)
++{
++ return ath79_soc == ATH79_SOC_QCA956X;
+}
+
+static inline int soc_is_qca956x(void)
+{
-+ return soc_is_tp9343() || soc_is_qca9561();
++ return soc_is_qca9561() || soc_is_qca9563();
+}
+
extern void __iomem *ath79_ddr_base;
diff --git a/target/linux/ar71xx/patches-3.18/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch b/target/linux/ar71xx/patches-3.18/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch
index a36b8c319f7d08fe5daab867a10edca4dfcd4706..44c9c6281e683792af37b6f9b32357b2a4ec2fd4 100644
--- a/target/linux/ar71xx/patches-3.18/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch
+++ b/target/linux/ar71xx/patches-3.18/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch
@@ -9,8 +9,8 @@
+ soc_is_qca955x())
reg = AR71XX_GPIO_REG_FUNC;
else if (soc_is_ar934x() ||
- soc_is_qca953x() || soc_is_qca956x())
-@@ -185,15 +186,27 @@ void __init ath79_gpio_output_select(uns
+ soc_is_qca953x() ||
+@@ -187,15 +188,30 @@ void __init ath79_gpio_output_select(uns
{
void __iomem *base = ath79_gpio_base;
unsigned long flags;
@@ -19,7 +19,7 @@
+ unsigned long gpio_count;
u32 t, s;
-- BUG_ON(!soc_is_ar934x() && !soc_is_qca953x());
+- BUG_ON(!soc_is_ar934x() && !soc_is_qca953x() && !soc_is_qca956x());
+ if (soc_is_ar934x()) {
+ gpio_count = AR934X_GPIO_COUNT;
+ reg_base = AR934X_GPIO_REG_OUT_FUNC0;
@@ -29,6 +29,9 @@
+ } else if (soc_is_qca955x()) {
+ gpio_count = QCA955X_GPIO_COUNT;
+ reg_base = QCA955X_GPIO_REG_OUT_FUNC0;
++ } else if (soc_is_qca956x()) {
++ gpio_count = QCA956X_GPIO_COUNT;
++ reg_base = QCA956X_GPIO_REG_OUT_FUNC0;
+ } else {
+ BUG();
+ }

View File

@ -1,176 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Fri, 13 May 2016 21:00:16 +0200
Subject: ar71xx: fold patch 622-MIPS-ath79-add-support-for-QCA956x-ethernet.patch into files/
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Backport of OpenWrt r48650
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 31d24388d274b92e01642ad6d7f59d22f80dc2a6..2efb9c70ff31f5c11bcdff6c6326743e4d5b5a11 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
@@ -198,7 +198,6 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask)
case ATH79_SOC_AR9330:
case ATH79_SOC_AR9331:
case ATH79_SOC_QCA9533:
- case ATH79_SOC_QCA9561:
case ATH79_SOC_TP9343:
mdio_dev = &ath79_mdio1_device;
mdio_data = &ath79_mdio1_data;
@@ -209,6 +208,7 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask)
case ATH79_SOC_AR9344:
case ATH79_SOC_QCA9556:
case ATH79_SOC_QCA9558:
+ case ATH79_SOC_QCA956X:
if (id == 0) {
mdio_dev = &ath79_mdio0_device;
mdio_data = &ath79_mdio0_data;
@@ -258,7 +258,6 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask)
break;
case ATH79_SOC_QCA9533:
- case ATH79_SOC_QCA9561:
case ATH79_SOC_TP9343:
mdio_data->builtin_switch = 1;
break;
@@ -268,6 +267,11 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask)
mdio_data->is_ar934x = 1;
break;
+ case ATH79_SOC_QCA956X:
+ if (id == 1)
+ mdio_data->builtin_switch = 1;
+ break;
+
default:
break;
}
@@ -387,6 +391,16 @@ static void qca955x_set_speed_sgmii(int speed)
iounmap(base);
}
+static void qca956x_set_speed_sgmii(int speed)
+{
+ void __iomem *base;
+ u32 val = ath79_get_eth_pll(0, speed);
+
+ base = ioremap_nocache(AR71XX_PLL_BASE, AR71XX_PLL_SIZE);
+ __raw_writel(val, base + QCA955X_PLL_ETH_SGMII_CONTROL_REG);
+ iounmap(base);
+}
+
static void ath79_set_speed_dummy(int speed)
{
}
@@ -517,6 +531,10 @@ struct ag71xx_switch_platform_data ath79_switch_data;
#define AR934X_PLL_VAL_100 0x00000101
#define AR934X_PLL_VAL_10 0x00001616
+#define QCA956X_PLL_VAL_1000 0x03000000
+#define QCA956X_PLL_VAL_100 0x00000101
+#define QCA956X_PLL_VAL_10 0x00001919
+
static void __init ath79_init_eth_pll_data(unsigned int id)
{
struct ath79_eth_pll_data *pll_data;
@@ -575,13 +593,18 @@ static void __init ath79_init_eth_pll_data(unsigned int id)
case ATH79_SOC_QCA9533:
case ATH79_SOC_QCA9556:
case ATH79_SOC_QCA9558:
- case ATH79_SOC_QCA9561:
case ATH79_SOC_TP9343:
pll_10 = AR934X_PLL_VAL_10;
pll_100 = AR934X_PLL_VAL_100;
pll_1000 = AR934X_PLL_VAL_1000;
break;
+ case ATH79_SOC_QCA956X:
+ pll_10 = QCA956X_PLL_VAL_10;
+ pll_100 = QCA956X_PLL_VAL_100;
+ pll_1000 = QCA956X_PLL_VAL_1000;
+ break;
+
default:
BUG();
}
@@ -656,6 +679,7 @@ static int __init ath79_setup_phy_if_mode(unsigned int id,
case ATH79_SOC_QCA9556:
case ATH79_SOC_QCA9558:
+ case ATH79_SOC_QCA956X:
switch (pdata->phy_if_mode) {
case PHY_INTERFACE_MODE_MII:
case PHY_INTERFACE_MODE_RGMII:
@@ -666,11 +690,6 @@ static int __init ath79_setup_phy_if_mode(unsigned int id,
}
break;
- case ATH79_SOC_QCA9561:
- if (!pdata->phy_if_mode)
- pdata->phy_if_mode = PHY_INTERFACE_MODE_MII;
- break;
-
default:
BUG();
}
@@ -699,7 +718,7 @@ static int __init ath79_setup_phy_if_mode(unsigned int id,
case ATH79_SOC_AR7241:
case ATH79_SOC_AR9330:
case ATH79_SOC_AR9331:
- case ATH79_SOC_QCA9561:
+ case ATH79_SOC_QCA956X:
case ATH79_SOC_TP9343:
pdata->phy_if_mode = PHY_INTERFACE_MODE_GMII;
break;
@@ -1032,7 +1051,6 @@ void __init ath79_register_eth(unsigned int id)
pdata->fifo_cfg3 = 0x01f00140;
break;
- case ATH79_SOC_QCA9561:
case ATH79_SOC_TP9343:
if (id == 0) {
pdata->reset_bit = AR933X_RESET_GE0_MAC |
@@ -1100,6 +1118,34 @@ void __init ath79_register_eth(unsigned int id)
pdata->fifo_cfg3 = 0x01f00140;
break;
+ case ATH79_SOC_QCA956X:
+ if (id == 0) {
+ pdata->reset_bit = QCA955X_RESET_GE0_MAC |
+ QCA955X_RESET_GE0_MDIO;
+ if (pdata->phy_if_mode == PHY_INTERFACE_MODE_SGMII)
+ pdata->set_speed = qca956x_set_speed_sgmii;
+ else
+ /* FIXME */
+ pdata->set_speed = ath79_set_speed_dummy;
+ } else {
+ pdata->reset_bit = QCA955X_RESET_GE1_MAC |
+ QCA955X_RESET_GE1_MDIO;
+ /* FIXME */
+ pdata->set_speed = ath79_set_speed_dummy;
+ }
+
+ pdata->ddr_flush = ath79_ddr_no_flush;
+ pdata->has_gbit = 1;
+ pdata->is_ar724x = 1;
+
+ if (!pdata->fifo_cfg1)
+ pdata->fifo_cfg1 = 0x0010ffff;
+ if (!pdata->fifo_cfg2)
+ pdata->fifo_cfg2 = 0x015500aa;
+ if (!pdata->fifo_cfg3)
+ pdata->fifo_cfg3 = 0x01f00140;
+ break;
+
default:
BUG();
}
@@ -1140,7 +1186,6 @@ void __init ath79_register_eth(unsigned int id)
case ATH79_SOC_AR9330:
case ATH79_SOC_AR9331:
case ATH79_SOC_QCA9533:
- case ATH79_SOC_QCA9561:
case ATH79_SOC_TP9343:
pdata->mii_bus_dev = &ath79_mdio1_device.dev;
break;

View File

@ -1,22 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Fri, 13 May 2016 21:00:41 +0200
Subject: ar71xx: fix MDIO bus probe on QCA956x
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Backport of OpenWrt r48651
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 2efb9c70ff31f5c11bcdff6c6326743e4d5b5a11..12a376e1322ae14dd714297ed5f8319ae09eeb64 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
@@ -183,7 +183,8 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask)
ath79_soc == ATH79_SOC_AR9342 ||
ath79_soc == ATH79_SOC_AR9344 ||
ath79_soc == ATH79_SOC_QCA9556 ||
- ath79_soc == ATH79_SOC_QCA9558)
+ ath79_soc == ATH79_SOC_QCA9558 ||
+ ath79_soc == ATH79_SOC_QCA956X)
max_id = 1;
else
max_id = 0;

View File

@ -1,64 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Fri, 13 May 2016 21:01:19 +0200
Subject: ar71xx: fix qca956x ethernet initialization
Complete internal switch initialization for QCA956X.
Set default mdio device if the interface mode of GE0 is not SGMII (fix ticket #21520).
Signed-off-by: Weijie Gao <hackpascal@gmail.com>
Backport of OpenWrt r48937
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 12a376e1322ae14dd714297ed5f8319ae09eeb64..b43c80a3762ddebe46d8443660714922165a2287 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
@@ -271,6 +271,7 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask)
case ATH79_SOC_QCA956X:
if (id == 1)
mdio_data->builtin_switch = 1;
+ mdio_data->is_ar934x = 1;
break;
default:
@@ -1123,16 +1124,25 @@ void __init ath79_register_eth(unsigned int id)
if (id == 0) {
pdata->reset_bit = QCA955X_RESET_GE0_MAC |
QCA955X_RESET_GE0_MDIO;
+
if (pdata->phy_if_mode == PHY_INTERFACE_MODE_SGMII)
pdata->set_speed = qca956x_set_speed_sgmii;
else
- /* FIXME */
- pdata->set_speed = ath79_set_speed_dummy;
+ pdata->set_speed = ath79_set_speed_ge0;
} else {
pdata->reset_bit = QCA955X_RESET_GE1_MAC |
QCA955X_RESET_GE1_MDIO;
- /* FIXME */
+
pdata->set_speed = ath79_set_speed_dummy;
+
+ pdata->switch_data = &ath79_switch_data;
+
+ pdata->speed = SPEED_1000;
+ pdata->duplex = DUPLEX_FULL;
+
+ /* reset the built-in switch */
+ ath79_device_reset_set(AR934X_RESET_ETH_SWITCH);
+ ath79_device_reset_clear(AR934X_RESET_ETH_SWITCH);
}
pdata->ddr_flush = ath79_ddr_no_flush;
@@ -1196,6 +1206,11 @@ void __init ath79_register_eth(unsigned int id)
/* don't assign any MDIO device by default */
break;
+ case ATH79_SOC_QCA956X:
+ if (pdata->phy_if_mode != PHY_INTERFACE_MODE_SGMII)
+ pdata->mii_bus_dev = &ath79_mdio1_device.dev;
+ break;
+
default:
pdata->mii_bus_dev = &ath79_mdio0_device.dev;
break;

View File

@ -1,562 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Fri, 13 May 2016 20:47:26 +0200
Subject: ar71xx: Support for Ubiquiti UniFi AP AC LITE
Add support for the Ubiquiti UniFi AP AC LITE
Signed-off-by: P.Wassi <p.wassi at gmx.at>
Backport of OpenWrt r48711
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index 486879f512cd28f1b80e828809359b55956fbcc3..3adc449b23e9c590d57cdd914b6c8d990a50e0b0 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -309,7 +309,8 @@ get_status_led() {
unifi)
status_led="ubnt:green:dome"
;;
- uap-pro)
+ uap-pro | \
+ unifiac)
status_led="ubnt:white:dome"
;;
unifi-outdoor-plus)
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
index 032c671341fd526c7e4e32cb9cba42217165cf5c..a79376a8cff56b144268130a24a930ff2bee95cd 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -369,6 +369,7 @@ tl-wa901nd-v3 |\
tl-wa901nd-v4 |\
tl-wr703n |\
tube2h |\
+unifiac |\
wndap360 |\
mynet-rext |\
wp543)
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 6c106179bfa0c01308a03678aef1b7cf4caaf05b..ecf584d30ecae7a0e2601bed38c6cfad42cab124 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -902,6 +902,9 @@ ar71xx_board_detect() {
*UniFi)
name="unifi"
;;
+ *"UniFi-AC")
+ name="unifiac"
+ ;;
*"UniFi AP Pro")
name="uap-pro"
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 024e4930949c927efd36c3ac67cd351dcaa4bf7b..fff1c3c912cee678ea88e225958b28ceb4c4b742 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -252,6 +252,7 @@ platform_check_image() {
wlae-ag300n | \
nbg460n_550n_550nh | \
unifi | \
+ unifiac | \
unifi-outdoor | \
carambola2 | \
weio )
diff --git a/target/linux/ar71xx/config-3.18 b/target/linux/ar71xx/config-3.18
index e0d52d9fcbad980f7220dd1f93388359e52dc8f9..a068cc5768aed6f29a67de27d24f00dc57e0695a 100644
--- a/target/linux/ar71xx/config-3.18
+++ b/target/linux/ar71xx/config-3.18
@@ -141,6 +141,7 @@ CONFIG_ATH79_MACH_TL_WR941ND=y
CONFIG_ATH79_MACH_TL_WR941ND_V6=y
CONFIG_ATH79_MACH_TUBE2H=y
CONFIG_ATH79_MACH_UBNT=y
+CONFIG_ATH79_MACH_UBNT_UNIFIAC=y
CONFIG_ATH79_MACH_UBNT_XM=y
CONFIG_ATH79_MACH_WEIO=y
CONFIG_ATH79_MACH_WHR_HP_G300N=y
@@ -324,7 +325,7 @@ CONFIG_SOC_AR933X=y
CONFIG_SOC_AR934X=y
CONFIG_SOC_QCA953X=y
CONFIG_SOC_QCA955X=y
-# CONFIG_SOC_QCA956X is not set
+CONFIG_SOC_QCA956X=y
CONFIG_SPI=y
CONFIG_SPI_AP83=y
CONFIG_SPI_ATH79=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c
new file mode 100644
index 0000000000000000000000000000000000000000..3617ca7d5fc0fff00fce9741b5d9169fac8c83c8
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c
@@ -0,0 +1,109 @@
+/*
+ * Ubiquiti UniFi AC (LITE) board support
+ *
+ * Copyright (C) 2015-2016 P. Wassi <p.wassi at gmx.at>
+ *
+ * Derived from: mach-ubnt-xm.c
+ *
+ * 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/pci.h>
+#include <linux/platform_device.h>
+#include <linux/ath9k_platform.h>
+#include <linux/etherdevice.h>
+
+#include <asm/mach-ath79/ath79.h>
+#include <asm/mach-ath79/irq.h>
+#include <asm/mach-ath79/ar71xx_regs.h>
+
+#include <linux/platform_data/phy-at803x.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-wmac.h"
+#include "machtypes.h"
+
+
+#define UNIFIAC_KEYS_POLL_INTERVAL 20
+#define UNIFIAC_KEYS_DEBOUNCE_INTERVAL (3 * UNIFIAC_KEYS_POLL_INTERVAL)
+
+#define UNIFIAC_GPIO_LED_WHITE 7
+#define UNIFIAC_GPIO_LED_BLUE 8
+
+#define UNIFIAC_GPIO_BTN_RESET 2
+
+#define UNIFIAC_MAC0_OFFSET 0x0000
+#define UNIFIAC_WMAC_CALDATA_OFFSET 0x1000
+#define UNIFIAC_PCI_CALDATA_OFFSET 0x5000
+
+
+static struct flash_platform_data ubnt_unifiac_flash_data = {
+ /* mx25l12805d and mx25l12835f have the same JEDEC ID */
+ .type = "mx25l12805d",
+};
+
+static struct gpio_led ubnt_unifiac_leds_gpio[] __initdata = {
+ {
+ .name = "ubnt:white:dome",
+ .gpio = UNIFIAC_GPIO_LED_WHITE,
+ .active_low = 0,
+ }, {
+ .name = "ubnt:blue:dome",
+ .gpio = UNIFIAC_GPIO_LED_BLUE,
+ .active_low = 0,
+ }
+};
+
+static struct gpio_keys_button ubnt_unifiac_gpio_keys[] __initdata = {
+ {
+ .desc = "reset",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = UNIFIAC_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = UNIFIAC_GPIO_BTN_RESET,
+ .active_low = 1,
+ }
+};
+
+static void __init ubnt_unifiac_setup(void)
+{
+ u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000);
+
+ ath79_register_m25p80(&ubnt_unifiac_flash_data);
+
+
+ ath79_init_mac(ath79_eth0_data.mac_addr,
+ eeprom + UNIFIAC_MAC0_OFFSET, 0);
+
+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII;
+ ath79_eth0_data.phy_mask = BIT(4);
+ ath79_eth0_pll_data.pll_10 = 0x00001313;
+
+ ath79_register_mdio(0, ~BIT(4));
+ ath79_register_eth(0);
+
+
+ ath79_register_wmac(eeprom + UNIFIAC_WMAC_CALDATA_OFFSET, NULL);
+
+
+ ap91_pci_init(eeprom + UNIFIAC_PCI_CALDATA_OFFSET, NULL);
+
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifiac_leds_gpio),
+ ubnt_unifiac_leds_gpio);
+
+ ath79_register_gpio_keys_polled(-1, UNIFIAC_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(ubnt_unifiac_gpio_keys),
+ ubnt_unifiac_gpio_keys);
+}
+
+MIPS_MACHINE(ATH79_MACH_UBNT_UNIFIAC, "UBNT-UF-AC", "Ubiquiti UniFi-AC",
+ ubnt_unifiac_setup);
diff --git a/target/linux/ar71xx/generic/profiles/ubnt.mk b/target/linux/ar71xx/generic/profiles/ubnt.mk
index d8e24d0032d75231d27be8207fe55294fd108282..94eff18318264de85ea459e94280c88726404888 100644
--- a/target/linux/ar71xx/generic/profiles/ubnt.mk
+++ b/target/linux/ar71xx/generic/profiles/ubnt.mk
@@ -38,6 +38,17 @@ endef
$(eval $(call Profile,UBNTUNIFI))
+define Profile/UBNTUNIFIAC
+ NAME:=Ubiquiti UniFi AP AC
+ PACKAGES:=kmod-ath10k ath10k-firmware-qca988x
+endef
+
+define Profile/UBNTUNIFIAC/Description
+ Package set optimized for the Ubiquiti UniFi AP AC.
+endef
+
+$(eval $(call Profile,UBNTUNIFIAC))
+
define Profile/UBNTUNIFIOUTDOOR
NAME:=Ubiquiti UniFiAP Outdoor
PACKAGES:=
diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
index 0783381baeddef2064df8faff89c49c2bed6a28b..aaaf89ac1a369431cf9bc15c13e774ba6826bbf3 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -740,6 +740,16 @@ define Device/oolite
endef
TARGET_DEVICES += oolite
+define Device/ubnt-unifiac
+ DEVICE_PROFILE := UBNT UBNTUNIFIAC
+ IMAGE_SIZE := 7744k
+ MTDPARTS = spi0.0:384k(u-boot)ro,64k(u-boot-env)ro,7744k(firmware),7744k(ubnt-airos)ro,128k(bs)ro,256k(cfg)ro,64k(EEPROM)ro
+ IMAGES := sysupgrade.bin
+ IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
+ BOARDNAME := UBNT-UF-AC
+endef
+TARGET_DEVICES += ubnt-unifiac
+
rootfs_type=$(patsubst jffs2-%,jffs2,$(patsubst squashfs-%,squashfs,$(1)))
# $(1): rootfs type.
diff --git a/target/linux/ar71xx/mikrotik/config-default b/target/linux/ar71xx/mikrotik/config-default
index b8a7bf13f2582b0b458d17f5e4b266a6e110faa1..2b1fe2491c7a00449453efdc4969015ec1b28291 100644
--- a/target/linux/ar71xx/mikrotik/config-default
+++ b/target/linux/ar71xx/mikrotik/config-default
@@ -97,6 +97,7 @@ CONFIG_ATH79_MACH_RBSXTLITE=y
# CONFIG_ATH79_MACH_TUBE2H is not set
# CONFIG_ATH79_MACH_UBNT is not set
# CONFIG_ATH79_MACH_UBNT_XM is not set
+# CONFIG_ATH79_MACH_UBNT_UNIFIAC is not set
# CONFIG_ATH79_MACH_WHR_HP_G300N is not set
# CONFIG_ATH79_MACH_WLAE_AG300N is not set
# CONFIG_ATH79_MACH_WLR8100 is not set
diff --git a/target/linux/ar71xx/nand/config-default b/target/linux/ar71xx/nand/config-default
index 626d676c621b90feb31a88e7b8c2daa587a8f603..f62cf1a4399718b2f4e94a974d26ddaf8d46a8ec 100644
--- a/target/linux/ar71xx/nand/config-default
+++ b/target/linux/ar71xx/nand/config-default
@@ -59,6 +59,7 @@
# CONFIG_ATH79_MACH_TL_WR941ND is not set
# CONFIG_ATH79_MACH_UBNT is not set
# CONFIG_ATH79_MACH_UBNT_XM is not set
+# CONFIG_ATH79_MACH_UBNT_UNIFIAC is not set
# CONFIG_ATH79_MACH_WHR_HP_G300N is not set
# CONFIG_ATH79_MACH_WLAE_AG300N is not set
# CONFIG_ATH79_MACH_WNDAP360 is not set
diff --git a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
index 76aeb94412e6f44b9a81fc44858e9c4540a08845..27dc73ffa239979a799bbede72440907e9d0e187 100644
--- a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
+++ b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
@@ -1,6 +1,6 @@
--- a/arch/mips/ath79/machtypes.h
+++ b/arch/mips/ath79/machtypes.h
-@@ -16,22 +16,200 @@
+@@ -16,22 +16,201 @@
enum ath79_mach_type {
ATH79_MACH_GENERIC = 0,
@@ -165,6 +165,7 @@
+ ATH79_MACH_UBNT_RS, /* Ubiquiti RouterStation */
ATH79_MACH_UBNT_UAP_PRO, /* Ubiquiti UniFi AP Pro */
ATH79_MACH_UBNT_UNIFI, /* Ubiquiti Unifi */
++ ATH79_MACH_UBNT_UNIFIAC, /* Ubiquiti Unifi AC */
ATH79_MACH_UBNT_UNIFI_OUTDOOR, /* Ubiquiti UnifiAP Outdoor */
+ ATH79_MACH_UBNT_UNIFI_OUTDOOR_PLUS, /* Ubiquiti UnifiAP Outdoor+ */
ATH79_MACH_UBNT_XM, /* Ubiquiti Networks XM board rev 1.0 */
@@ -1098,10 +1099,7 @@
+ select ATH79_DEV_M25P80
+ select ATH79_DEV_USB
+ select ATH79_DEV_WMAC
-
--config ATH79_MACH_AP136
-- bool "Atheros AP136/AP135 reference board"
-- select SOC_QCA955X
++
+config ATH79_MACH_TL_WA7210N_V2
+ bool "TP-LINK TL-WA7210N v2 support"
+ select SOC_AR724X
@@ -1116,19 +1114,12 @@
+ bool "TP-LINK TL-WA830RE v2 support"
+ select SOC_AR934X
+ select ATH79_DEV_ETH
- select ATH79_DEV_GPIO_BUTTONS
- select ATH79_DEV_LEDS_GPIO
-- select ATH79_DEV_NFC
-- select ATH79_DEV_SPI
++ select ATH79_DEV_GPIO_BUTTONS
++ select ATH79_DEV_LEDS_GPIO
+ select ATH79_DEV_M25P80
- select ATH79_DEV_USB
- select ATH79_DEV_WMAC
-- help
-- Say 'Y' here if you want your kernel to support the
-- Atheros AP136 or AP135 reference boards.
-
--config ATH79_MACH_AP81
-- bool "Atheros AP81 reference board"
++ select ATH79_DEV_USB
++ select ATH79_DEV_WMAC
++
+config ATH79_MACH_TL_WA901ND
+ bool "TP-LINK TL-WA901ND/TL-WA7510N support"
+ select SOC_AR724X
@@ -1140,11 +1131,11 @@
+
+config ATH79_MACH_TL_WA901ND_V2
+ bool "TP-LINK TL-WA901ND v2 support"
- select SOC_AR913X
- select ATH79_DEV_ETH
- select ATH79_DEV_GPIO_BUTTONS
- select ATH79_DEV_LEDS_GPIO
- select ATH79_DEV_M25P80
++ select SOC_AR913X
++ 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_WDR3500
@@ -1155,34 +1146,13 @@
+ select ATH79_DEV_GPIO_BUTTONS
+ select ATH79_DEV_LEDS_GPIO
+ select ATH79_DEV_M25P80
- select ATH79_DEV_USB
- select ATH79_DEV_WMAC
-- help
-- Say 'Y' here if you want your kernel to support the
-- Atheros AP81 reference board.
-
--config ATH79_MACH_DB120
-- bool "Atheros DB120 reference board"
++ select ATH79_DEV_USB
++ select ATH79_DEV_WMAC
++
+config ATH79_MACH_TL_WDR4300
+ bool "TP-LINK TL-WDR3600/4300/4310 board support"
- select SOC_AR934X
- 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_NFC
- select ATH79_DEV_USB
- select ATH79_DEV_WMAC
-- help
-- Say 'Y' here if you want your kernel to support the
-- Atheros DB120 reference board.
-
--config ATH79_MACH_PB44
-- bool "Atheros PB44 reference board"
-+config ATH79_MACH_TL_WR703N
-+ bool "TP-LINK TL-WR703N/TL-WR710N/TL-MR10U support"
-+ select SOC_AR933X
++ select SOC_AR934X
++ select ATH79_DEV_AP9X_PCI if PCI
+ select ATH79_DEV_ETH
+ select ATH79_DEV_GPIO_BUTTONS
+ select ATH79_DEV_LEDS_GPIO
@@ -1190,8 +1160,8 @@
+ select ATH79_DEV_USB
+ select ATH79_DEV_WMAC
+
-+config ATH79_MACH_TL_WR720N_V3
-+ bool "TP-LINK TL-WR720N v3/v4 support"
++config ATH79_MACH_TL_WR703N
++ bool "TP-LINK TL-WR703N/TL-WR710N/TL-MR10U support"
+ select SOC_AR933X
+ select ATH79_DEV_ETH
+ select ATH79_DEV_GPIO_BUTTONS
@@ -1199,7 +1169,28 @@
+ select ATH79_DEV_M25P80
+ select ATH79_DEV_USB
+ select ATH79_DEV_WMAC
-+
+
+-config ATH79_MACH_AP136
+- bool "Atheros AP136/AP135 reference board"
+- select SOC_QCA955X
++config ATH79_MACH_TL_WR720N_V3
++ bool "TP-LINK TL-WR720N v3/v4 support"
++ select SOC_AR933X
++ select ATH79_DEV_ETH
+ select ATH79_DEV_GPIO_BUTTONS
+ select ATH79_DEV_LEDS_GPIO
+- select ATH79_DEV_NFC
+- select ATH79_DEV_SPI
++ select ATH79_DEV_M25P80
+ select ATH79_DEV_USB
+ select ATH79_DEV_WMAC
+- help
+- Say 'Y' here if you want your kernel to support the
+- Atheros AP136 or AP135 reference boards.
+
+-config ATH79_MACH_AP81
+- bool "Atheros AP81 reference board"
+- select SOC_AR913X
+config ATH79_MACH_TL_WR741ND
+ bool "TP-LINK TL-WR741ND support"
+ select SOC_AR724X
@@ -1212,21 +1203,25 @@
+config ATH79_MACH_TL_WR741ND_V4
+ bool "TP-LINK TL-WR741ND v4/TL-MR3220 v2 support"
+ select SOC_AR933X
-+ 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_TL_WR841N_V1
-+ bool "TP-LINK TL-WR841N v1 support"
- select SOC_AR71XX
-+ select ATH79_DEV_DSA
select ATH79_DEV_ETH
select ATH79_DEV_GPIO_BUTTONS
select ATH79_DEV_LEDS_GPIO
-- select ATH79_DEV_SPI
+ select ATH79_DEV_M25P80
+ select ATH79_DEV_USB
+ select ATH79_DEV_WMAC
+- help
+- Say 'Y' here if you want your kernel to support the
+- Atheros AP81 reference board.
+
+-config ATH79_MACH_DB120
+- bool "Atheros DB120 reference board"
++config ATH79_MACH_TL_WR841N_V1
++ bool "TP-LINK TL-WR841N v1 support"
++ select SOC_AR71XX
++ select ATH79_DEV_DSA
++ select ATH79_DEV_ETH
++ select ATH79_DEV_GPIO_BUTTONS
++ select ATH79_DEV_LEDS_GPIO
+ select ATH79_DEV_M25P80
+
+config ATH79_MACH_TL_WR841N_V8
@@ -1269,15 +1264,21 @@
+
+config ATH79_MACH_TL_WR1041N_V2
+ bool "TP-LINK TL-WR1041N v2 support"
-+ select SOC_AR934X
-+ 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
-+
+ select SOC_AR934X
+ 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_NFC
+ select ATH79_DEV_USB
+ select ATH79_DEV_WMAC
+- help
+- Say 'Y' here if you want your kernel to support the
+- Atheros DB120 reference board.
+
+-config ATH79_MACH_PB44
+- bool "Atheros PB44 reference board"
+config ATH79_MACH_TL_WR1043ND
+ bool "TP-LINK TL-WR1043ND support"
+ select SOC_AR913X
@@ -1320,11 +1321,12 @@
+
+config ATH79_MACH_TEW_673GRU
+ bool "TRENDnet TEW-673GRU support"
-+ select SOC_AR71XX
+ select SOC_AR71XX
+ select ATH79_DEV_AP9X_PCI if PCI
-+ select ATH79_DEV_ETH
-+ select ATH79_DEV_GPIO_BUTTONS
-+ select ATH79_DEV_LEDS_GPIO
+ select ATH79_DEV_ETH
+ select ATH79_DEV_GPIO_BUTTONS
+ select ATH79_DEV_LEDS_GPIO
+- select ATH79_DEV_SPI
+ select ATH79_DEV_M25P80
+ select ATH79_DEV_USB
+ select ATH79_NVRAM
@@ -1362,10 +1364,20 @@
config ATH79_MACH_UBNT_XM
bool "Ubiquiti Networks XM/UniFi boards"
-@@ -83,6 +1144,106 @@ config ATH79_MACH_UBNT_XM
+@@ -83,6 +1144,116 @@ config ATH79_MACH_UBNT_XM
Say 'Y' here if you want your kernel to support the
Ubiquiti Networks XM (rev 1.0) board.
++config ATH79_MACH_UBNT_UNIFIAC
++ bool "Ubiquiti UniFi AC (LITE) 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_WEIO
+ bool "WeIO board"
+ select SOC_AR933X
@@ -1469,7 +1481,7 @@
endmenu
config SOC_AR71XX
-@@ -124,7 +1285,10 @@ config ATH79_DEV_DSA
+@@ -124,7 +1295,10 @@ config ATH79_DEV_DSA
config ATH79_DEV_ETH
def_bool n
@@ -1481,7 +1493,7 @@
def_bool n
config ATH79_DEV_GPIO_BUTTONS
-@@ -154,6 +1318,11 @@ config ATH79_PCI_ATH9K_FIXUP
+@@ -154,6 +1328,11 @@ config ATH79_PCI_ATH9K_FIXUP
def_bool n
config ATH79_ROUTERBOOT
@@ -1495,7 +1507,7 @@
endif
--- a/arch/mips/ath79/Makefile
+++ b/arch/mips/ath79/Makefile
-@@ -38,9 +38,128 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route
+@@ -38,9 +38,129 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route
#
# Machines
#
@@ -1597,6 +1609,7 @@
+obj-$(CONFIG_ATH79_MACH_TL_WR720N_V3) += mach-tl-wr720n-v3.o
+obj-$(CONFIG_ATH79_MACH_TUBE2H) += mach-tube2h.o
+obj-$(CONFIG_ATH79_MACH_UBNT) += mach-ubnt.o
++obj-$(CONFIG_ATH79_MACH_UBNT_UNIFIAC) += mach-ubnt-unifiac.o
obj-$(CONFIG_ATH79_MACH_UBNT_XM) += mach-ubnt-xm.o
+obj-$(CONFIG_ATH79_MACH_WEIO) += mach-weio.o
+obj-$(CONFIG_ATH79_MACH_WHR_HP_G300N) += mach-whr-hp-g300n.o

View File

@ -1,21 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Fri, 13 May 2016 21:02:55 +0200
Subject: ar71xx: Fix eth0 support for Ubiquiti UniFi AP AC
Fix eth0 support for the Ubiquiti UniFi AP AC
Signed-off-by: Paul Wassi <p.wassi at gmx.at>
Backport of OpenWrt r49277
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c
index 3617ca7d5fc0fff00fce9741b5d9169fac8c83c8..072cf12a31a0921a8e9b90689864f5d981cd2c32 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c
@@ -84,6 +84,7 @@ static void __init ubnt_unifiac_setup(void)
eeprom + UNIFIAC_MAC0_OFFSET, 0);
ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII;
+ ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
ath79_eth0_data.phy_mask = BIT(4);
ath79_eth0_pll_data.pll_10 = 0x00001313;

View File

@ -1,193 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Fri, 13 May 2016 21:24:44 +0200
Subject: ar71xx: Rename unifiac to unifiac-lite
To avoid confusion with different unifiac devices, rename existing target
"unifiac" to "unifiac-lite", before "unifiac-pro" is introduced.
Signed-off-by: P.Wassi <p.wassi at gmx.at>
Backport of LEDE c855e70491fbd5d432915c4cbeb3b80f3a117e30
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index 3adc449b23e9c590d57cdd914b6c8d990a50e0b0..924c1163e26eb84b71e4734b95221104674bfe3e 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -310,7 +310,7 @@ get_status_led() {
status_led="ubnt:green:dome"
;;
uap-pro | \
- unifiac)
+ unifiac-lite)
status_led="ubnt:white:dome"
;;
unifi-outdoor-plus)
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 ab7d93c693f8422bbb518c6accd4ffed169398cd..7777734ae3899840c1c47e7b24373b4bceee0adc 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
@@ -81,7 +81,7 @@ case "$FIRMWARE" in
ath10kcal_extract "ART" 20480 2116
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16)
;;
- unifiac)
+ unifiac-lite)
ath10kcal_extract "EEPROM" 20480 2116
;;
esac
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
index a79376a8cff56b144268130a24a930ff2bee95cd..20070426fd033e4ff2e904f9247deed9eb48c3c3 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -369,7 +369,7 @@ tl-wa901nd-v3 |\
tl-wa901nd-v4 |\
tl-wr703n |\
tube2h |\
-unifiac |\
+unifiac-lite |\
wndap360 |\
mynet-rext |\
wp543)
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index ecf584d30ecae7a0e2601bed38c6cfad42cab124..6bc0b868423ef68fb83147c13b00163b29cf2aec 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -902,8 +902,8 @@ ar71xx_board_detect() {
*UniFi)
name="unifi"
;;
- *"UniFi-AC")
- name="unifiac"
+ *"UniFi-AC-LITE")
+ name="unifiac-lite"
;;
*"UniFi AP Pro")
name="uap-pro"
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index fff1c3c912cee678ea88e225958b28ceb4c4b742..90f961f3f0aaf3c76a0a8022258fbf5404165ca8 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -252,7 +252,7 @@ platform_check_image() {
wlae-ag300n | \
nbg460n_550n_550nh | \
unifi | \
- unifiac | \
+ unifiac-lite | \
unifi-outdoor | \
carambola2 | \
weio )
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c
index 072cf12a31a0921a8e9b90689864f5d981cd2c32..31cbe30d3ff9b323cb336c62d6fe0d7a0c67ba42 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c
@@ -73,7 +73,7 @@ static struct gpio_keys_button ubnt_unifiac_gpio_keys[] __initdata = {
}
};
-static void __init ubnt_unifiac_setup(void)
+static void __init ubnt_unifiac_lite_setup(void)
{
u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000);
@@ -81,7 +81,7 @@ static void __init ubnt_unifiac_setup(void)
ath79_init_mac(ath79_eth0_data.mac_addr,
- eeprom + UNIFIAC_MAC0_OFFSET, 0);
+ eeprom + UNIFIAC_MAC0_OFFSET, 0);
ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII;
ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
@@ -99,12 +99,12 @@ static void __init ubnt_unifiac_setup(void)
ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifiac_leds_gpio),
- ubnt_unifiac_leds_gpio);
+ ubnt_unifiac_leds_gpio);
ath79_register_gpio_keys_polled(-1, UNIFIAC_KEYS_POLL_INTERVAL,
- ARRAY_SIZE(ubnt_unifiac_gpio_keys),
- ubnt_unifiac_gpio_keys);
+ ARRAY_SIZE(ubnt_unifiac_gpio_keys),
+ ubnt_unifiac_gpio_keys);
}
-MIPS_MACHINE(ATH79_MACH_UBNT_UNIFIAC, "UBNT-UF-AC", "Ubiquiti UniFi-AC",
- ubnt_unifiac_setup);
+MIPS_MACHINE(ATH79_MACH_UBNT_UNIFIAC_LITE, "UBNT-UF-AC-LITE", "Ubiquiti UniFi-AC-LITE",
+ ubnt_unifiac_lite_setup);
diff --git a/target/linux/ar71xx/generic/profiles/ubnt.mk b/target/linux/ar71xx/generic/profiles/ubnt.mk
index 94eff18318264de85ea459e94280c88726404888..eac02406bbbffebbcb20962929fb8254edba520e 100644
--- a/target/linux/ar71xx/generic/profiles/ubnt.mk
+++ b/target/linux/ar71xx/generic/profiles/ubnt.mk
@@ -38,16 +38,16 @@ endef
$(eval $(call Profile,UBNTUNIFI))
-define Profile/UBNTUNIFIAC
- NAME:=Ubiquiti UniFi AP AC
+define Profile/UBNTUNIFIACLITE
+ NAME:=Ubiquiti UniFi AP AC LITE/LR
PACKAGES:=kmod-ath10k ath10k-firmware-qca988x
endef
-define Profile/UBNTUNIFIAC/Description
- Package set optimized for the Ubiquiti UniFi AP AC.
+define Profile/UBNTUNIFIACLITE/Description
+ Package set optimized for the Ubiquiti UniFi AP AC LITE/LR.
endef
-$(eval $(call Profile,UBNTUNIFIAC))
+$(eval $(call Profile,UBNTUNIFIACLITE))
define Profile/UBNTUNIFIOUTDOOR
NAME:=Ubiquiti UniFiAP Outdoor
diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
index aaaf89ac1a369431cf9bc15c13e774ba6826bbf3..42ffc69ca3f9b1cffa542fc2d06ead2ef224d6b2 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -741,14 +741,19 @@ endef
TARGET_DEVICES += oolite
define Device/ubnt-unifiac
- DEVICE_PROFILE := UBNT UBNTUNIFIAC
+ DEVICE_PROFILE := UBNT
IMAGE_SIZE := 7744k
MTDPARTS = spi0.0:384k(u-boot)ro,64k(u-boot-env)ro,7744k(firmware),7744k(ubnt-airos)ro,128k(bs)ro,256k(cfg)ro,64k(EEPROM)ro
IMAGES := sysupgrade.bin
IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
- BOARDNAME := UBNT-UF-AC
endef
-TARGET_DEVICES += ubnt-unifiac
+
+define Device/ubnt-unifiac-lite
+ $(Device/ubnt-unifiac)
+ DEVICE_PROFILE := UBNT UBNTUNIFIACLITE
+ BOARDNAME := UBNT-UF-AC-LITE
+endef
+TARGET_DEVICES += ubnt-unifiac-lite
rootfs_type=$(patsubst jffs2-%,jffs2,$(patsubst squashfs-%,squashfs,$(1)))
diff --git a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
index 27dc73ffa239979a799bbede72440907e9d0e187..9a28f58f67d5f98fcd4aa83dc09698705e2dfa3e 100644
--- a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
+++ b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
@@ -165,7 +165,7 @@
+ ATH79_MACH_UBNT_RS, /* Ubiquiti RouterStation */
ATH79_MACH_UBNT_UAP_PRO, /* Ubiquiti UniFi AP Pro */
ATH79_MACH_UBNT_UNIFI, /* Ubiquiti Unifi */
-+ ATH79_MACH_UBNT_UNIFIAC, /* Ubiquiti Unifi AC */
++ ATH79_MACH_UBNT_UNIFIAC_LITE, /* Ubiquiti Unifi AC LITE/LR */
ATH79_MACH_UBNT_UNIFI_OUTDOOR, /* Ubiquiti UnifiAP Outdoor */
+ ATH79_MACH_UBNT_UNIFI_OUTDOOR_PLUS, /* Ubiquiti UnifiAP Outdoor+ */
ATH79_MACH_UBNT_XM, /* Ubiquiti Networks XM board rev 1.0 */
@@ -1369,7 +1369,7 @@
Ubiquiti Networks XM (rev 1.0) board.
+config ATH79_MACH_UBNT_UNIFIAC
-+ bool "Ubiquiti UniFi AC (LITE) support"
++ bool "Ubiquiti UniFi AC (LITE/LR) support"
+ select SOC_QCA956X
+ select ATH79_DEV_AP9X_PCI if PCI
+ select ATH79_DEV_ETH

View File

@ -1,274 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Fri, 13 May 2016 21:34:05 +0200
Subject: ar71xx: Add support for Ubiquiti UniFi AP AC PRO
Add support for the Ubiquiti UniFi AP AC PRO
Signed-off-by: P.Wassi <p.wassi at gmx.at>
Backport of LEDE 8307c2fe686ded345c80318359d5b6679e581fa2
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index 924c1163e26eb84b71e4734b95221104674bfe3e..cb92349cab833179a87a195b94e2539cc5ce3e79 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -310,7 +310,8 @@ get_status_led() {
status_led="ubnt:green:dome"
;;
uap-pro | \
- unifiac-lite)
+ unifiac-lite | \
+ unifiac-pro)
status_led="ubnt:white:dome"
;;
unifi-outdoor-plus)
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 7777734ae3899840c1c47e7b24373b4bceee0adc..5eb20bb26521258599898125d42f6b73b9c81f94 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
@@ -81,7 +81,8 @@ case "$FIRMWARE" in
ath10kcal_extract "ART" 20480 2116
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16)
;;
- unifiac-lite)
+ unifiac-lite | \
+ unifiac-pro)
ath10kcal_extract "EEPROM" 20480 2116
;;
esac
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
index 20070426fd033e4ff2e904f9247deed9eb48c3c3..b59844eac49a1269edb88890d89b0b4d8a7121d0 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -401,6 +401,13 @@ wpj344)
ucidef_add_switch_vlan "switch0" "2" "0t 2"
;;
+unifiac-pro)
+ ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0t 2"
+ ucidef_add_switch_vlan "switch0" "2" "0t 3"
+ ;;
+
wpj531)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
;;
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 6bc0b868423ef68fb83147c13b00163b29cf2aec..aded7ad117ffa1c1347c6f457c210d60b8e4df58 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -905,6 +905,9 @@ ar71xx_board_detect() {
*"UniFi-AC-LITE")
name="unifiac-lite"
;;
+ *"UniFi-AC-PRO")
+ name="unifiac-pro"
+ ;;
*"UniFi AP Pro")
name="uap-pro"
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 90f961f3f0aaf3c76a0a8022258fbf5404165ca8..0228f14774d5873a52f19b60ed84389c7be86e51 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() {
nbg460n_550n_550nh | \
unifi | \
unifiac-lite | \
+ unifiac-pro | \
unifi-outdoor | \
carambola2 | \
weio )
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c
index 31cbe30d3ff9b323cb336c62d6fe0d7a0c67ba42..9194bc1c0799d83fca3f6fe76b2602d72e5f4ef8 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c
@@ -21,6 +21,7 @@
#include <asm/mach-ath79/ar71xx_regs.h>
#include <linux/platform_data/phy-at803x.h>
+#include <linux/ar8216_platform.h>
#include "common.h"
#include "dev-ap9x-pci.h"
@@ -29,6 +30,7 @@
#include "dev-leds-gpio.h"
#include "dev-m25p80.h"
#include "dev-wmac.h"
+#include "dev-usb.h"
#include "machtypes.h"
@@ -108,3 +110,70 @@ static void __init ubnt_unifiac_lite_setup(void)
MIPS_MACHINE(ATH79_MACH_UBNT_UNIFIAC_LITE, "UBNT-UF-AC-LITE", "Ubiquiti UniFi-AC-LITE",
ubnt_unifiac_lite_setup);
+
+static struct ar8327_pad_cfg ubnt_unifiac_pro_ar8327_pad0_cfg = {
+ .mode = AR8327_PAD_MAC_SGMII,
+ .sgmii_delay_en = true,
+};
+
+static struct ar8327_platform_data ubnt_unifiac_pro_ar8327_data = {
+ .pad0_cfg = &ubnt_unifiac_pro_ar8327_pad0_cfg,
+ .port0_cfg = {
+ .force_link = 1,
+ .speed = AR8327_PORT_SPEED_1000,
+ .duplex = 1,
+ .txpause = 1,
+ .rxpause = 1,
+ },
+};
+
+
+static struct mdio_board_info ubnt_unifiac_pro_mdio0_info[] = {
+ {
+ .bus_id = "ag71xx-mdio.0",
+ .phy_addr = 0,
+ .platform_data = &ubnt_unifiac_pro_ar8327_data,
+ },
+};
+
+static void __init ubnt_unifiac_pro_setup(void)
+{
+ u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000);
+
+ ath79_register_m25p80(&ubnt_unifiac_flash_data);
+
+
+ ath79_init_mac(ath79_eth0_data.mac_addr,
+ eeprom + UNIFIAC_MAC0_OFFSET, 0);
+
+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII;
+ ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
+ ath79_eth0_data.phy_mask = BIT(0);
+
+ mdiobus_register_board_info(ubnt_unifiac_pro_mdio0_info,
+ ARRAY_SIZE(ubnt_unifiac_pro_mdio0_info));
+
+ ath79_register_mdio(0, 0x00);
+ ath79_register_eth(0);
+
+
+ ath79_register_usb();
+
+
+ ath79_register_wmac(eeprom + UNIFIAC_WMAC_CALDATA_OFFSET, NULL);
+
+
+ ap91_pci_init(eeprom + UNIFIAC_PCI_CALDATA_OFFSET, NULL);
+
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifiac_leds_gpio),
+ ubnt_unifiac_leds_gpio);
+
+ ath79_register_gpio_keys_polled(-1, UNIFIAC_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(ubnt_unifiac_gpio_keys),
+ ubnt_unifiac_gpio_keys);
+}
+
+
+MIPS_MACHINE(ATH79_MACH_UBNT_UNIFIAC_PRO, "UBNT-UF-AC-PRO", "Ubiquiti UniFi-AC-PRO",
+ ubnt_unifiac_pro_setup);
diff --git a/target/linux/ar71xx/generic/profiles/ubnt.mk b/target/linux/ar71xx/generic/profiles/ubnt.mk
index eac02406bbbffebbcb20962929fb8254edba520e..69b83985bd6623c0d6732399d3e2cc8c0af9f9f1 100644
--- a/target/linux/ar71xx/generic/profiles/ubnt.mk
+++ b/target/linux/ar71xx/generic/profiles/ubnt.mk
@@ -49,6 +49,17 @@ endef
$(eval $(call Profile,UBNTUNIFIACLITE))
+define Profile/UBNTUNIFIACPRO
+ NAME:=Ubiquiti UniFi AP AC PRO
+ PACKAGES:=kmod-ath10k ath10k-firmware-qca988x kmod-usb-core kmod-usb-ohci kmod-usb2
+endef
+
+define Profile/UBNTUNIFIACPRO/Description
+ Package set optimized for the Ubiquiti UniFi AP AC PRO.
+endef
+
+$(eval $(call Profile,UBNTUNIFIACPRO))
+
define Profile/UBNTUNIFIOUTDOOR
NAME:=Ubiquiti UniFiAP Outdoor
PACKAGES:=
diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
index 42ffc69ca3f9b1cffa542fc2d06ead2ef224d6b2..7c648f26e10c49000b848e9b300701b388410c04 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -753,7 +753,13 @@ define Device/ubnt-unifiac-lite
DEVICE_PROFILE := UBNT UBNTUNIFIACLITE
BOARDNAME := UBNT-UF-AC-LITE
endef
-TARGET_DEVICES += ubnt-unifiac-lite
+
+define Device/ubnt-unifiac-pro
+ $(Device/ubnt-unifiac)
+ DEVICE_PROFILE := UBNT UBNTUNIFIACPRO
+ BOARDNAME := UBNT-UF-AC-PRO
+endef
+TARGET_DEVICES += ubnt-unifiac-lite ubnt-unifiac-pro
rootfs_type=$(patsubst jffs2-%,jffs2,$(patsubst squashfs-%,squashfs,$(1)))
diff --git a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
index 9a28f58f67d5f98fcd4aa83dc09698705e2dfa3e..debde6e6a552e71b551d8c01ba06af03013407bf 100644
--- a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
+++ b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
@@ -1,6 +1,6 @@
--- a/arch/mips/ath79/machtypes.h
+++ b/arch/mips/ath79/machtypes.h
-@@ -16,22 +16,201 @@
+@@ -16,22 +16,202 @@
enum ath79_mach_type {
ATH79_MACH_GENERIC = 0,
@@ -166,6 +166,7 @@
ATH79_MACH_UBNT_UAP_PRO, /* Ubiquiti UniFi AP Pro */
ATH79_MACH_UBNT_UNIFI, /* Ubiquiti Unifi */
+ ATH79_MACH_UBNT_UNIFIAC_LITE, /* Ubiquiti Unifi AC LITE/LR */
++ ATH79_MACH_UBNT_UNIFIAC_PRO, /* Ubiquiti Unifi AC PRO */
ATH79_MACH_UBNT_UNIFI_OUTDOOR, /* Ubiquiti UnifiAP Outdoor */
+ ATH79_MACH_UBNT_UNIFI_OUTDOOR_PLUS, /* Ubiquiti UnifiAP Outdoor+ */
ATH79_MACH_UBNT_XM, /* Ubiquiti Networks XM board rev 1.0 */
@@ -1364,12 +1365,12 @@
config ATH79_MACH_UBNT_XM
bool "Ubiquiti Networks XM/UniFi boards"
-@@ -83,6 +1144,116 @@ config ATH79_MACH_UBNT_XM
+@@ -83,6 +1144,117 @@ config ATH79_MACH_UBNT_XM
Say 'Y' here if you want your kernel to support the
Ubiquiti Networks XM (rev 1.0) board.
+config ATH79_MACH_UBNT_UNIFIAC
-+ bool "Ubiquiti UniFi AC (LITE/LR) support"
++ bool "Ubiquiti UniFi AC (LITE/LR/PRO) support"
+ select SOC_QCA956X
+ select ATH79_DEV_AP9X_PCI if PCI
+ select ATH79_DEV_ETH
@@ -1377,6 +1378,7 @@
+ select ATH79_DEV_LEDS_GPIO
+ select ATH79_DEV_M25P80
+ select ATH79_DEV_WMAC
++ select ATH79_DEV_USB
+
+config ATH79_MACH_WEIO
+ bool "WeIO board"
@@ -1481,7 +1483,7 @@
endmenu
config SOC_AR71XX
-@@ -124,7 +1295,10 @@ config ATH79_DEV_DSA
+@@ -124,7 +1296,10 @@ config ATH79_DEV_DSA
config ATH79_DEV_ETH
def_bool n
@@ -1493,7 +1495,7 @@
def_bool n
config ATH79_DEV_GPIO_BUTTONS
-@@ -154,6 +1328,11 @@ config ATH79_PCI_ATH9K_FIXUP
+@@ -154,6 +1329,11 @@ config ATH79_PCI_ATH9K_FIXUP
def_bool n
config ATH79_ROUTERBOOT

View File

@ -1,395 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Thu, 3 Sep 2015 23:50:51 +0200
Subject: ath9k: add HSR tuner support for UniFi Outdoor Plus
Patch-by: Stefan Rompf <stefan@loplof.de>
diff --git a/package/kernel/mac80211/patches/931-ubnt-uap-plus-hsr.patch b/package/kernel/mac80211/patches/931-ubnt-uap-plus-hsr.patch
new file mode 100644
index 0000000000000000000000000000000000000000..8e09fee938951ab3636d23b5fe4dee3ab0e11c7a
--- /dev/null
+++ b/package/kernel/mac80211/patches/931-ubnt-uap-plus-hsr.patch
@@ -0,0 +1,349 @@
+--- a/drivers/net/wireless/ath/ath9k/channel.c
++++ b/drivers/net/wireless/ath/ath9k/channel.c
+@@ -15,6 +15,8 @@
+ */
+
+ #include "ath9k.h"
++#include <linux/ath9k_platform.h>
++#include "hsr.h"
+
+ /* Set/change channels. If the channel is really being changed, it's done
+ * by reseting the chip. To accomplish this we must first cleanup any pending
+@@ -22,6 +24,7 @@
+ */
+ static int ath_set_channel(struct ath_softc *sc)
+ {
++ struct ath9k_platform_data *pdata = sc->dev->platform_data;
+ struct ath_hw *ah = sc->sc_ah;
+ struct ath_common *common = ath9k_hw_common(ah);
+ struct ieee80211_hw *hw = sc->hw;
+@@ -41,6 +44,11 @@ static int ath_set_channel(struct ath_so
+ ath_dbg(common, CONFIG, "Set channel: %d MHz width: %d\n",
+ chan->center_freq, chandef->width);
+
++ if (pdata && pdata->ubnt_hsr) {
++ hsr_enable(ah, chandef->width, chan->center_freq);
++ hsr_status(ah);
++ }
++
+ /* update survey stats for the old channel before switching */
+ spin_lock_bh(&common->cc_lock);
+ ath_update_survey_stats(sc);
+--- /dev/null
++++ b/drivers/net/wireless/ath/ath9k/hsr.c
+@@ -0,0 +1,223 @@
++/*
++ *
++ * The MIT License (MIT)
++ *
++ * Copyright (c) 2015 Kirill Berezin
++ *
++ * Permission is hereby granted, free of charge, to any person obtaining a copy
++ * of this software and associated documentation files (the "Software"), to deal
++ * in the Software without restriction, including without limitation the rights
++ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
++ * copies of the Software, and to permit persons to whom the Software is
++ * furnished to do so, subject to the following conditions:
++ *
++ * The above copyright notice and this permission notice shall be included in all
++ * copies or substantial portions of the Software.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
++ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
++ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
++ * SOFTWARE.
++ *
++ */
++
++#include <linux/io.h>
++#include <linux/slab.h>
++#include <linux/module.h>
++#include <linux/time.h>
++#include <linux/bitops.h>
++#include <linux/etherdevice.h>
++#include <linux/rtnetlink.h>
++#include <asm/unaligned.h>
++
++#include "hw.h"
++#include "ath9k.h"
++
++#define HSR_GPIO_CSN 8
++#define HSR_GPIO_CLK 6
++#define HSR_GPIO_DOUT 7
++#define HSR_GPIO_DIN 5
++
++/* delays are in useconds */
++#define HSR_DELAY_HALF_TICK 100
++#define HSR_DELAY_PRE_WRITE 75
++#define HSR_DELAY_FINAL 20000
++#define HSR_DELAY_TRAILING 200
++
++
++void hsr_init(struct ath_hw* ah) {
++ ath9k_hw_gpio_request_in(ah, HSR_GPIO_DIN, NULL);
++ ath9k_hw_gpio_request_out(ah, HSR_GPIO_CSN, NULL,
++ AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
++ ath9k_hw_gpio_request_out(ah, HSR_GPIO_CLK, NULL,
++ AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
++ ath9k_hw_gpio_request_out(ah, HSR_GPIO_DOUT, NULL,
++ AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
++
++ ath9k_hw_set_gpio(ah, HSR_GPIO_CSN, 1);
++ ath9k_hw_set_gpio(ah, HSR_GPIO_CLK, 0);
++ ath9k_hw_set_gpio(ah, HSR_GPIO_DOUT, 0);
++
++ udelay(HSR_DELAY_TRAILING);
++}
++
++static u32 hsr_write_byte(struct ath_hw* ah, int delay, u32 value){
++ struct ath_common *common = ath9k_hw_common(ah);
++ int i;
++ u32 rval = 0;
++
++ udelay(delay);
++
++ ath9k_hw_set_gpio(ah, HSR_GPIO_CLK, 0);
++ udelay(HSR_DELAY_HALF_TICK);
++
++ ath9k_hw_set_gpio(ah, HSR_GPIO_CSN, 0);
++ udelay(HSR_DELAY_HALF_TICK);
++
++ for( i = 0; i < 8; ++i) {
++ rval = rval << 1;
++
++ // pattern is left to right, that is 7-th bit runs first
++ ath9k_hw_set_gpio(ah, HSR_GPIO_DOUT, (value >> (7 - i)) & 0x1);
++ udelay(HSR_DELAY_HALF_TICK);
++
++ ath9k_hw_set_gpio(ah, HSR_GPIO_CLK, 1);
++ udelay(HSR_DELAY_HALF_TICK);
++
++ rval |= ath9k_hw_gpio_get(ah, HSR_GPIO_DIN);
++
++ ath9k_hw_set_gpio(ah, HSR_GPIO_CLK, 0);
++ udelay(HSR_DELAY_HALF_TICK);
++ }
++
++ ath9k_hw_set_gpio(ah, HSR_GPIO_CSN, 1);
++ udelay(HSR_DELAY_HALF_TICK);
++
++ ath_dbg(common, CONFIG, "hsr_write_byte: write byte %d return value is %d %c\n",
++ value, rval, rval > 32 ? rval : '-');
++
++ return rval & 0xff;
++}
++
++static int hsr_write_a_chain(struct ath_hw* ah, char* chain, int items) {
++ int i = 0;
++ int status = 0;
++
++ // a preamble
++ hsr_write_byte(ah, HSR_DELAY_PRE_WRITE, 0);
++ status = hsr_write_byte(ah, HSR_DELAY_PRE_WRITE, 0);
++
++ // clear HSR's reply buffer
++ if (status) {
++ int loop = 0;
++ for ( loop = 0; (loop < 42) && status; ++loop) {
++ status = hsr_write_byte(ah, HSR_DELAY_PRE_WRITE, 0);
++ }
++ if ( loop >= 42) {
++ ATH_DBG_WARN(1, "hsr_write_a_chain: can't clear an output buffer after a 42 cycles.\n");
++ return -1;
++ }
++ }
++
++ for ( i =0; (i < items) && ( 0 != chain[i]); ++i) {
++ hsr_write_byte(ah, HSR_DELAY_PRE_WRITE, (u32)chain[i]);
++ }
++
++ hsr_write_byte(ah, HSR_DELAY_PRE_WRITE, 0);
++ mdelay(HSR_DELAY_FINAL / 1000);
++
++ // reply
++ memset(chain, 0, items);
++
++ hsr_write_byte(ah, HSR_DELAY_PRE_WRITE, 0);
++ udelay(HSR_DELAY_TRAILING);
++
++ for ( i = 0; i < (items - 1); ++i) {
++ u32 ret;
++ if ( 0 != (ret = hsr_write_byte(ah, HSR_DELAY_PRE_WRITE, 0))) {
++ chain[i] = (char)ret;
++ } else {
++ break;
++ }
++ udelay(HSR_DELAY_TRAILING);
++ }
++
++ return (1 < i) ? simple_strtol(chain + 1, NULL, 10) : 0;
++}
++
++int hsr_disable(struct ath_hw* ah) {
++ char cmd[10] = {'b', '4', '0', 0, 0, 0, 0, 0, 0, 0};
++ int ret;
++
++ ret = hsr_write_a_chain(ah, cmd, sizeof(cmd));
++ if ( (ret > 0) && (*cmd == 'B')) {
++ return 0;
++ }
++
++ return -1;
++}
++
++int hsr_enable(struct ath_hw* ah, int bw, int fq) {
++ char cmd[10];
++ int ret;
++
++ /* Bandwidth argument is 0 sometimes. Assume default 802.11bgn
++ 20MHz on invalid values */
++ if ( (bw != 5) && (bw != 10) && (bw != 20) && (bw != 40)) {
++ bw = 20;
++ }
++
++ memset(cmd, 0, sizeof(cmd));
++ *cmd = 'b'; // 98
++ snprintf(cmd + 1, 3, "%02d", bw);
++
++ ret = hsr_write_a_chain(ah, cmd, sizeof(cmd));
++ if ( (*cmd != 'B') || (ret != bw)) {
++ ATH_DBG_WARN(1, "hsr_enable: failed changing bandwidth -> set (%d,%d) reply (%d, %d) \n", 'b', bw, *cmd, ret);
++ return -1;
++ }
++
++ memset(cmd, 0, sizeof(cmd));
++ *cmd = 'x'; // 120
++ ret = hsr_write_a_chain(ah, cmd, sizeof(cmd));
++ if ( *cmd != 'X') {
++ ATH_DBG_WARN(1, "hsr_enable: failed 'x' command -> reply (%d, %d) \n", *cmd, ret);
++ return -1;
++ }
++
++ memset(cmd, 0, sizeof(cmd));
++ *cmd = 'm'; // 109
++ ret = hsr_write_a_chain(ah, cmd, sizeof(cmd));
++ if ( *cmd != 'M') {
++ ATH_DBG_WARN(1, "hsr_enable: failed 'm' command -> reply (%d, %d) \n", *cmd, ret);
++ return -1;
++ }
++
++ memset(cmd, 0, sizeof(cmd));
++ *cmd = 'f'; // 102
++ snprintf(cmd + 1, 6, "%05d", fq);
++ ret = hsr_write_a_chain(ah, cmd, sizeof(cmd));
++ if ( (*cmd != 'F') && (ret != fq)) {
++ ATH_DBG_WARN(1, "hsr_enable: failed set frequency -> reply (%d, %d) \n", *cmd, ret);
++ return -1;
++ }
++
++ return 0;
++}
++
++int hsr_status(struct ath_hw* ah) {
++ char cmd[10] = {'s', 0, 0, 0, 0, 0, 0, 0, 0, 0}; // 115
++ int ret;
++
++ ret = hsr_write_a_chain(ah, cmd, sizeof(cmd));
++ if ( (*cmd != 'S')) {
++ ATH_DBG_WARN(1, "hsr_status: returned %d,%d \n", *cmd, ret);
++ return -1;
++ }
++
++ return 0;
++}
++
+--- /dev/null
++++ b/drivers/net/wireless/ath/ath9k/hsr.h
+@@ -0,0 +1,33 @@
++/*
++ * The MIT License (MIT)
++ *
++ * Copyright (c) 2015 Kirill Berezin
++ *
++ * Permission is hereby granted, free of charge, to any person obtaining a copy
++ * of this software and associated documentation files (the "Software"), to deal
++ * in the Software without restriction, including without limitation the rights
++ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
++ * copies of the Software, and to permit persons to whom the Software is
++ * furnished to do so, subject to the following conditions:
++ *
++ * The above copyright notice and this permission notice shall be included in all
++ * copies or substantial portions of the Software.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
++ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
++ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
++ * SOFTWARE.
++ */
++
++#ifndef HSR_H_
++#define HSR_H_
++
++void hsr_init(struct ath_hw* ah);
++int hsr_disable(struct ath_hw* ah);
++int hsr_enable(struct ath_hw* ah, int bw, int fq);
++int hsr_status(struct ath_hw* ah);
++
++#endif /* HSR_H_ */
+--- a/drivers/net/wireless/ath/ath9k/main.c
++++ b/drivers/net/wireless/ath/ath9k/main.c
+@@ -16,8 +16,10 @@
+
+ #include <linux/nl80211.h>
+ #include <linux/delay.h>
++#include <linux/ath9k_platform.h>
+ #include "ath9k.h"
+ #include "btcoex.h"
++#include "hsr.h"
+
+ u8 ath9k_parse_mpdudensity(u8 mpdudensity)
+ {
+@@ -652,6 +654,7 @@ void ath_reset_work(struct work_struct *
+ static int ath9k_start(struct ieee80211_hw *hw)
+ {
+ struct ath_softc *sc = hw->priv;
++ struct ath9k_platform_data *pdata = sc->dev->platform_data;
+ struct ath_hw *ah = sc->sc_ah;
+ struct ath_common *common = ath9k_hw_common(ah);
+ struct ieee80211_channel *curchan = sc->cur_chan->chandef.chan;
+@@ -727,6 +730,11 @@ static int ath9k_start(struct ieee80211_
+ ath9k_hw_set_gpio(ah, ah->led_pin,
+ (ah->config.led_active_high) ? 1 : 0);
+
++ if (pdata && pdata->ubnt_hsr) {
++ hsr_init(ah);
++ hsr_disable(ah);
++ }
++
+ /*
+ * Reset key cache to sane defaults (all entries cleared) instead of
+ * semi-random values after suspend/resume.
+--- a/drivers/net/wireless/ath/ath9k/Makefile
++++ b/drivers/net/wireless/ath/ath9k/Makefile
+@@ -6,7 +6,8 @@ ath9k-y += beacon.o \
+ xmit.o \
+ link.o \
+ antenna.o \
+- channel.o
++ channel.o \
++ hsr.o
+
+ ath9k-$(CPTCFG_ATH9K_BTCOEX_SUPPORT) += mci.o
+ ath9k-$(CPTCFG_ATH9K_PCI) += pci.o
+--- a/include/linux/ath9k_platform.h
++++ b/include/linux/ath9k_platform.h
+@@ -54,6 +54,8 @@ struct ath9k_platform_data {
+ unsigned num_btns;
+ const struct gpio_keys_button *btns;
+ unsigned btn_poll_interval;
++
++ bool ubnt_hsr;
+ };
+
+ #endif /* _LINUX_ATH9K_PLATFORM_H */
diff --git a/target/linux/ar71xx/patches-3.18/608-MIPS-ath79-ubnt-xm-add-more-boards.patch b/target/linux/ar71xx/patches-3.18/608-MIPS-ath79-ubnt-xm-add-more-boards.patch
index 78035131db93f3e465585d7e96bfae9e88783d28..d865ed29ac268b6b49644c0841be6dfeace75038 100644
--- a/target/linux/ar71xx/patches-3.18/608-MIPS-ath79-ubnt-xm-add-more-boards.patch
+++ b/target/linux/ar71xx/patches-3.18/608-MIPS-ath79-ubnt-xm-add-more-boards.patch
@@ -254,6 +254,7 @@
+ ath79_register_eth(0);
+ ath79_register_eth(1);
+
++ ap9x_pci_get_wmac_data(0)->ubnt_hsr = true;
+ ap91_pci_init(ee, NULL);
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifi_outdoor_plus_leds_gpio),
diff --git a/target/linux/generic/patches-3.18/150-ath9k_ubnt_hsr_filter.patch b/target/linux/generic/patches-3.18/150-ath9k_ubnt_hsr_filter.patch
new file mode 100644
index 0000000000000000000000000000000000000000..b8844f1341f9a8a478730ef6ac440833b84b3e98
--- /dev/null
+++ b/target/linux/generic/patches-3.18/150-ath9k_ubnt_hsr_filter.patch
@@ -0,0 +1,16 @@
+Flag that this platform is an Ubiquiti UniFi Outdoor Plus
+containing a RF filter in ath9k's receive path.
+
+Signed-off-by: Stefan Rompf <stefan@loplof.de>
+
+--- a/include/linux/ath9k_platform.h
++++ b/include/linux/ath9k_platform.h
+@@ -54,6 +54,8 @@ struct ath9k_platform_data {
+ unsigned num_btns;
+ const struct gpio_keys_button *btns;
+ unsigned btn_poll_interval;
++
++ bool ubnt_hsr;
+ };
+
+ #endif /* _LINUX_ATH9K_PLATFORM_H */

View File

@ -1,41 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sun, 29 May 2016 11:37:08 +0200
Subject: ar71xx: Send power to USB port on WNR2200
This patch fixes ticket #15267 by enabling power on the
WNR2200's USB port. At present, the USB port on the WNR2200
is non-functional due to it not receiving power.
This patch defines an additional GPIO pin, but none of the
current GPIO definitions have been modified.
Signed-off-by: Riley Baird <BM-2cVqnDuYbAU5do2DfJTrN7ZbAJ246S4XiX@bitmessage.ch>
Backport of r47236
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c
index 0087cac62087786d45bd5c8b68b2ec2ce3b5715e..5d23f21763cd9f4ddafc97f79ff47e819a18f2a6 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c
@@ -36,7 +36,7 @@
#define WNR2200_GPIO_LED_LAN4_GREEN 16
#define WNR2200_GPIO_LED_PWR_AMBER 21
#define WNR2200_GPIO_LED_PWR_GREEN 22
-
+#define WNR2200_GPIO_USB_5V 4
#define WNR2200_GPIO_USB_POWER 24
#define WNR2200_KEYS_POLL_INTERVAL 20 /* msecs */
@@ -128,9 +128,9 @@ static void __init wnr2200_setup(void)
wnr2200_leds_gpio);
/* enable power for the USB port */
- gpio_request_one(WNR2200_GPIO_USB_POWER,
- GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
- "USB power");
+ ap9x_pci_setup_wmac_gpio(0,
+ BIT(WNR2200_GPIO_USB_5V),
+ BIT(WNR2200_GPIO_USB_5V));
ath79_register_usb();
}

View File

@ -1,86 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sun, 29 May 2016 11:45:14 +0200
Subject: ar71xx: WNR2200: fix for random WLAN MAC
Fix for invalid/random/duplicate WLAN MAC address in WNR2200.
Permanent platform MAC is calculated and assigned during system startup.
WLAN MAC follows wired Ethernet interface addresses.
Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
Backport of r49100
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c
index 5d23f21763cd9f4ddafc97f79ff47e819a18f2a6..37ffc4c56be33be96c43078117d7b123679378b3 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c
@@ -12,6 +12,7 @@
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
+#include <linux/kernel.h> /* for max() macro */
#include <asm/mach-ath79/ath79.h>
@@ -45,6 +46,7 @@
#define WNR2200_MAC0_OFFSET 0
#define WNR2200_MAC1_OFFSET 6
#define WNR2200_PCIE_CALDATA_OFFSET 0x1000
+#define WNR2200_WMAC_OFFSET 0x108c /* wireless MAC is inside ART */
static struct gpio_led wnr2200_leds_gpio[] __initdata = {
{
@@ -102,9 +104,40 @@ static struct gpio_led wnr2200_leds_gpio[] __initdata = {
}
};
+/*
+ * For WNR2200 ART flash area used for WLAN MAC is usually empty (0xff)
+ * so ath9k driver uses random MAC instead each time module is loaded.
+ * OpenWrt's original fix was to copy eth1 address to WLAN interface.
+ * New solution does not duplicate hardware addresses and is taken from
+ * WNR2000v3 code. It assigns permanent WLAN MAC equal to ethN's MAC
+ * plus 1, so network interfaces get sequential addresses.
+ * If ART wireless MAC address field has been filled by user, use it.
+ */
+static void __init wnr2200_get_wmac(u8 *wmac_gen_addr, int mac0_art_offset,
+ int mac1_art_offset, int wmac_art_offset)
+{
+ u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
+ u8 *eth0_mac_addr = (u8 *) (art + mac0_art_offset);
+ u8 *eth1_mac_addr = (u8 *) (art + mac1_art_offset);
+ u8 *wlan_mac_addr = (u8 *) (art + wmac_art_offset);
+
+ /* only 0xff if all bits are set - address is invalid, empty area */
+ if ((wlan_mac_addr[0] & wlan_mac_addr[1] & wlan_mac_addr[2] &
+ wlan_mac_addr[3] & wlan_mac_addr[4] & wlan_mac_addr[5]) == 0xff) {
+ memcpy(wmac_gen_addr, eth0_mac_addr, 5);
+ wmac_gen_addr[5] = max(eth0_mac_addr[5], eth1_mac_addr[5]) + 1;
+
+ /* Avoid potential conflict in case max(0xff,0x00)+1==0x00 */
+ if (!wmac_gen_addr[5])
+ wmac_gen_addr[5] = 1;
+ } else
+ memcpy(wmac_gen_addr, wlan_mac_addr, 6);
+}
+
static void __init wnr2200_setup(void)
{
u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
+ u8 wlan_mac_addr[6];
ath79_register_mdio(0, 0x0);
@@ -121,8 +154,10 @@ static void __init wnr2200_setup(void)
ath79_register_eth(1);
ath79_register_m25p80(NULL);
- ap91_pci_init(art + WNR2200_PCIE_CALDATA_OFFSET,
- art + WNR2200_MAC1_OFFSET);
+
+ wnr2200_get_wmac(wlan_mac_addr, WNR2200_MAC0_OFFSET,
+ WNR2200_MAC1_OFFSET, WNR2200_WMAC_OFFSET);
+ ap91_pci_init(art + WNR2200_PCIE_CALDATA_OFFSET, wlan_mac_addr);
ath79_register_leds_gpio(-1, ARRAY_SIZE(wnr2200_leds_gpio),
wnr2200_leds_gpio);

View File

@ -1,251 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sun, 29 May 2016 11:50:03 +0200
Subject: ar71xx: WNR2200: enable control of all LEDs and buttons
This patch provides full GPIO support for WNR2200 (LEDs and buttons).
It exposes all LEDs to operating system, including Ethernet ones.
Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
Backport of r49101
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
index f4d523418c8d59e3c96dbe3d68eedd8d85e33546..b8677960249c1e05703570fdf2be4197bde5cac5 100644
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
@@ -600,6 +600,21 @@ wnr2000-v4)
ucidef_set_led_usbdev "usb" "USB" "netgear:amber:status" "1-1"
;;
+wnr2200)
+ ucidef_set_led_netdev "wan-amber" "WAN (amber)" "netgear:amber:wan" "eth0"
+ ucidef_set_led_default "wan-green" "WAN (green)" "netgear:green:wan" "0"
+ ucidef_set_led_netdev "wlan" "WLAN" "netgear:blue:wlan" "wlan0"
+ ucidef_set_led_switch "lan1green" "LAN1 (green)" "netgear:green:lan1" "switch0" "0x02" "0x04"
+ ucidef_set_led_switch "lan2green" "LAN2 (green)" "netgear:green:lan2" "switch0" "0x04" "0x04"
+ ucidef_set_led_switch "lan3green" "LAN3 (green)" "netgear:green:lan3" "switch0" "0x08" "0x04"
+ ucidef_set_led_switch "lan4green" "LAN4 (green)" "netgear:green:lan4" "switch0" "0x10" "0x04"
+ ucidef_set_led_switch "lan1amber" "LAN1 (amber)" "netgear:amber:lan1" "switch0" "0x02" "0x02"
+ ucidef_set_led_switch "lan2amber" "LAN2 (amber)" "netgear:amber:lan2" "switch0" "0x04" "0x02"
+ ucidef_set_led_switch "lan3amber" "LAN3 (amber)" "netgear:amber:lan3" "switch0" "0x08" "0x02"
+ ucidef_set_led_switch "lan4amber" "LAN4 (amber)" "netgear:amber:lan4" "switch0" "0x10" "0x02"
+ ucidef_set_led_usbdev "usb" "USB" "netgear:green:usb" "1-1"
+ ;;
+
wpn824n)
ucidef_set_led_netdev "wan-amber" "WAN (amber)" "netgear:amber:wan" "eth0"
ucidef_set_led_wlan "wlan" "WLAN" "netgear:blue:wlan" "phy0tpt"
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c
index 37ffc4c56be33be96c43078117d7b123679378b3..258d254cf4abfc01a4d859f3f464b2a25aeec165 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c
@@ -15,6 +15,8 @@
#include <linux/kernel.h> /* for max() macro */
#include <asm/mach-ath79/ath79.h>
+#include <asm/mach-ath79/ar71xx_regs.h> /* needed to disable switch LEDs */
+#include "common.h" /* needed to disable switch LEDs */
#include "dev-ap9x-pci.h"
#include "dev-eth.h"
@@ -24,21 +26,28 @@
#include "dev-usb.h"
#include "machtypes.h"
+/* WNR2200 - connected through AR7241 */
#define WNR2200_GPIO_LED_LAN2_AMBER 0
#define WNR2200_GPIO_LED_LAN4_AMBER 1
-#define WNR2200_GPIO_LED_WPS 5
-#define WNR2200_GPIO_LED_WAN_GREEN 7
-#define WNR2200_GPIO_LED_USB 8
+#define WNR2200_GPIO_LED_LAN1_AMBER 6 /* AR724X_GPIO_FUNC_JTAG_DISABLE */
+#define WNR2200_GPIO_LED_WPS_GREEN 7 /* AR724X_GPIO_FUNC_JTAG_DISABLE */
+#define WNR2200_GPIO_LED_USB_GREEN 8 /* AR724X_GPIO_FUNC_JTAG_DISABLE */
#define WNR2200_GPIO_LED_LAN3_AMBER 11
#define WNR2200_GPIO_LED_WAN_AMBER 12
-#define WNR2200_GPIO_LED_LAN1_GREEN 13
-#define WNR2200_GPIO_LED_LAN2_GREEN 14
-#define WNR2200_GPIO_LED_LAN3_GREEN 15
-#define WNR2200_GPIO_LED_LAN4_GREEN 16
-#define WNR2200_GPIO_LED_PWR_AMBER 21
-#define WNR2200_GPIO_LED_PWR_GREEN 22
-#define WNR2200_GPIO_USB_5V 4
-#define WNR2200_GPIO_USB_POWER 24
+#define WNR2200_GPIO_LED_LAN1_GREEN 13 /* AR724X_..._ETH_SWITCH_LED0 */
+#define WNR2200_GPIO_LED_LAN2_GREEN 14 /* AR724X_..._ETH_SWITCH_LED1 */
+#define WNR2200_GPIO_LED_LAN3_GREEN 15 /* AR724X_..._ETH_SWITCH_LED2 */
+#define WNR2200_GPIO_LED_LAN4_GREEN 16 /* AR724X_..._ETH_SWITCH_LED3 */
+#define WNR2200_GPIO_LED_WAN_GREEN 17 /* AR724X_..._ETH_SWITCH_LED4 */
+
+/* WNR2200 - connected through AR9287 */
+#define WNR2200_GPIO_WMAC_LED_WLAN_BLUE 0
+#define WNR2200_GPIO_WMAC_LED_TEST_AMBER 1
+#define WNR2200_GPIO_WMAC_LED_POWER_GREEN 2
+#define WNR2200_GPIO_WMAC_BTN_RFKILL 3
+#define WNR2200_GPIO_WMAC_USB_5V 4
+#define WNR2200_GPIO_WMAC_BTN_WPS 5
+#define WNR2200_GPIO_WMAC_BTN_RESET 6
#define WNR2200_KEYS_POLL_INTERVAL 20 /* msecs */
#define WNR2200_KEYS_DEBOUNCE_INTERVAL (3 * WNR2200_KEYS_POLL_INTERVAL)
@@ -50,30 +59,22 @@
static struct gpio_led wnr2200_leds_gpio[] __initdata = {
{
- .name = "netgear:amber:lan2",
- .gpio = WNR2200_GPIO_LED_LAN2_AMBER,
- .active_low = 1,
- }, {
- .name = "netgear:amber:lan4",
- .gpio = WNR2200_GPIO_LED_LAN4_AMBER,
- .active_low = 1,
- }, {
- .name = "netgear:green:wps",
- .gpio = WNR2200_GPIO_LED_WPS,
- .active_low = 1,
- }, {
- .name = "netgear:green:wan",
- .gpio = WNR2200_GPIO_LED_WAN_GREEN,
+ .name = "netgear:amber:lan1",
+ .gpio = WNR2200_GPIO_LED_LAN1_AMBER,
.active_low = 1,
}, {
- .name = "netgear:green:usb",
- .gpio = WNR2200_GPIO_LED_USB,
+ .name = "netgear:amber:lan2",
+ .gpio = WNR2200_GPIO_LED_LAN2_AMBER,
.active_low = 1,
}, {
.name = "netgear:amber:lan3",
.gpio = WNR2200_GPIO_LED_LAN3_AMBER,
.active_low = 1,
}, {
+ .name = "netgear:amber:lan4",
+ .gpio = WNR2200_GPIO_LED_LAN4_AMBER,
+ .active_low = 1,
+ }, {
.name = "netgear:amber:wan",
.gpio = WNR2200_GPIO_LED_WAN_AMBER,
.active_low = 1,
@@ -94,12 +95,56 @@ static struct gpio_led wnr2200_leds_gpio[] __initdata = {
.gpio = WNR2200_GPIO_LED_LAN4_GREEN,
.active_low = 1,
}, {
- .name = "netgear:amber:power",
- .gpio = WNR2200_GPIO_LED_PWR_AMBER,
+ .name = "netgear:green:usb",
+ .gpio = WNR2200_GPIO_LED_USB_GREEN,
+ .active_low = 1,
+ }, {
+ .name = "netgear:green:wan",
+ .gpio = WNR2200_GPIO_LED_WAN_GREEN,
+ .active_low = 1,
+ }, {
+ .name = "netgear:green:wps",
+ .gpio = WNR2200_GPIO_LED_WPS_GREEN,
+ .active_low = 1,
+ }
+};
+
+static const char *wnr2200_wmac_led_name = "netgear:blue:wlan";
+
+static struct gpio_led wnr2200_wmac_leds_gpio[] = {
+ {
+ .name = "netgear:amber:test",
+ .gpio = WNR2200_GPIO_WMAC_LED_TEST_AMBER,
.active_low = 1,
}, {
.name = "netgear:green:power",
- .gpio = WNR2200_GPIO_LED_PWR_GREEN,
+ .gpio = WNR2200_GPIO_WMAC_LED_POWER_GREEN,
+ .active_low = 1,
+ .default_state = LEDS_GPIO_DEFSTATE_ON,
+ }
+};
+
+static struct gpio_keys_button wnr2200_wmac_keys_gpio[] = {
+ {
+ .desc = "reset",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = WNR2200_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = WNR2200_GPIO_WMAC_BTN_RESET,
+ .active_low = 1,
+ }, {
+ .desc = "rfkill",
+ .type = EV_KEY,
+ .code = KEY_RFKILL,
+ .debounce_interval = WNR2200_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = WNR2200_GPIO_WMAC_BTN_RFKILL,
+ .active_low = 1,
+ }, {
+ .desc = "wps",
+ .type = EV_KEY,
+ .code = KEY_WPS_BUTTON,
+ .debounce_interval = WNR2200_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = WNR2200_GPIO_WMAC_BTN_WPS,
.active_low = 1,
}
};
@@ -139,14 +184,32 @@ static void __init wnr2200_setup(void)
u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
u8 wlan_mac_addr[6];
+ /*
+ * Disable JTAG to use all AR724X GPIO LEDs. Disable CLKs.
+ * Allow OS to control all link LEDs.
+ */
+ ath79_gpio_function_setup(AR724X_GPIO_FUNC_JTAG_DISABLE |
+ AR724X_GPIO_FUNC_UART_EN,
+ AR724X_GPIO_FUNC_CLK_OBS1_EN |
+ AR724X_GPIO_FUNC_CLK_OBS2_EN |
+ AR724X_GPIO_FUNC_CLK_OBS3_EN |
+ AR724X_GPIO_FUNC_CLK_OBS4_EN |
+ AR724X_GPIO_FUNC_CLK_OBS5_EN |
+ AR724X_GPIO_FUNC_GE0_MII_CLK_EN |
+ AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
+ AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
+ AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
+ AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
+ AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN);
+
ath79_register_mdio(0, 0x0);
- ath79_init_mac(ath79_eth0_data.mac_addr, art+WNR2200_MAC0_OFFSET, 0);
+ ath79_init_mac(ath79_eth0_data.mac_addr, art + WNR2200_MAC0_OFFSET, 0);
ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
ath79_eth0_data.speed = SPEED_100;
ath79_eth0_data.duplex = DUPLEX_FULL;
- ath79_init_mac(ath79_eth1_data.mac_addr, art+WNR2200_MAC1_OFFSET, 0);
+ ath79_init_mac(ath79_eth1_data.mac_addr, art + WNR2200_MAC1_OFFSET, 0);
ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
ath79_eth1_data.phy_mask = 0x10;
@@ -160,12 +223,22 @@ static void __init wnr2200_setup(void)
ap91_pci_init(art + WNR2200_PCIE_CALDATA_OFFSET, wlan_mac_addr);
ath79_register_leds_gpio(-1, ARRAY_SIZE(wnr2200_leds_gpio),
- wnr2200_leds_gpio);
+ wnr2200_leds_gpio);
+
+ ap9x_pci_setup_wmac_led_pin(0, WNR2200_GPIO_WMAC_LED_WLAN_BLUE);
+ ap9x_pci_setup_wmac_led_name(0, wnr2200_wmac_led_name);
+
+ ap9x_pci_setup_wmac_leds(0, wnr2200_wmac_leds_gpio,
+ ARRAY_SIZE(wnr2200_wmac_leds_gpio));
+
+ /* All 3 buttons are connected to wireless chip */
+ ap9x_pci_setup_wmac_btns(0, wnr2200_wmac_keys_gpio,
+ ARRAY_SIZE(wnr2200_wmac_keys_gpio),
+ WNR2200_KEYS_POLL_INTERVAL);
/* enable power for the USB port */
- ap9x_pci_setup_wmac_gpio(0,
- BIT(WNR2200_GPIO_USB_5V),
- BIT(WNR2200_GPIO_USB_5V));
+ ap9x_pci_setup_wmac_gpio(0, BIT(WNR2200_GPIO_WMAC_USB_5V),
+ BIT(WNR2200_GPIO_WMAC_USB_5V));
ath79_register_usb();
}

View File

@ -1,326 +0,0 @@
From: Jan Niehusmann <jan@gondor.com>
Date: Wed, 15 Jun 2016 14:57:47 +0200
Subject: ar71xx: add GL-AR150 support
patch from https://github.com/domino-team/OpenWrt-patches
https://raw.githubusercontent.com/domino-team/OpenWrt-patches/master/AR150%2C%20AR300%2C%20Domino%20-%20CC1505/000-gl-ar150-cc.patch
(and fixed indentation in target/linux/ar71xx/base-files/lib/ar71xx.sh)
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
index b8677960249c1e05703570fdf2be4197bde5cac5..d81358d6bf9103ffeb2929b06d3ab01efffe931c 100644
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
@@ -188,6 +188,10 @@ dlan-pro-1200-ac)
ucidef_set_led_trigger_gpio "plcr" "dLAN" "devolo:error:dlan" "16" "0"
;;
+gl-ar150)
+ ucidef_set_led_wlan "wlan" "WLAN" "gl_ar150:wlan" "phy0tpt"
+ ;;
+
gl-inet)
ucidef_set_led_netdev "lan" "LAN" "gl-connect:green:lan" "eth1"
ucidef_set_led_wlan "wlan" "WLAN" "gl-connect:red:wlan" "phy0tpt"
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
index b59844eac49a1269edb88890d89b0b4d8a7121d0..ac3deb8aa2ed4717e2bd682cb4ffd7d32c50134f 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -383,6 +383,7 @@ dir-505-a1)
alfa-ap96 |\
alfa-nx |\
ap83 |\
+gl-ar150 |\
gl-inet |\
jwap003 |\
pb42 |\
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index aded7ad117ffa1c1347c6f457c210d60b8e4df58..f242980b3e401f2e9de2b8abe7e984b24a71db5a 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -503,6 +503,9 @@ ar71xx_board_detect() {
name="gl-inet"
gl_inet_board_detect
;;
+ *"GL AR150")
+ name="gl-ar150"
+ ;;
*"EnGenius EPG5000")
name="epg5000"
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 0228f14774d5873a52f19b60ed84389c7be86e51..d816f211891d6a259930f2781574504ea62b4e16 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() {
dlan-pro-500-wp | \
dlan-pro-1200-ac | \
dragino2 | \
+ gl-ar150 | \
epg5000 | \
esr1750 | \
esr900 | \
diff --git a/target/linux/ar71xx/config-3.18 b/target/linux/ar71xx/config-3.18
index a068cc5768aed6f29a67de27d24f00dc57e0695a..d4d92738d0ab010e1d43ebed0baef34fd9bc3f9d 100644
--- a/target/linux/ar71xx/config-3.18
+++ b/target/linux/ar71xx/config-3.18
@@ -70,6 +70,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_GL_AR150=y
CONFIG_ATH79_MACH_GL_INET=y
CONFIG_ATH79_MACH_GS_MINIBOX_V1=y
CONFIG_ATH79_MACH_GS_OOLITE=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar150.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar150.c
new file mode 100644
index 0000000000000000000000000000000000000000..310182cc8e9c22e2bfcb168996d4f01d117dc103
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar150.c
@@ -0,0 +1,125 @@
+/*
+ * GL_ar150 board support
+ *
+ * Copyright (C) 2011 dongyuqi <729650915@qq.com>
+ * Copyright (C) 2011-2012 Gabor Juhos <juhosg@openwrt.org>
+ * 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.
+*/
+
+#include <linux/gpio.h>
+
+#include <asm/mach-ath79/ath79.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_AR150_GPIO_LED_WLAN 0
+#define GL_AR150_GPIO_LED_LAN 13
+#define GL_AR150_GPIO_LED_WAN 15
+
+#define GL_AR150_GPIO_BIN_USB 6
+#define GL_AR150_GPIO_BTN_MANUAL 7
+#define GL_AR150_GPIO_BTN_AUTO 8
+#define GL_AR150_GPIO_BTN_RESET 11
+
+#define GL_AR150_KEYS_POLL_INTERVAL 20 /* msecs */
+#define GL_AR150_KEYS_DEBOUNCE_INTERVAL (3 * GL_AR150_KEYS_POLL_INTERVAL)
+
+#define GL_AR150_MAC0_OFFSET 0x0000
+#define GL_AR150_MAC1_OFFSET 0x0000
+#define GL_AR150_CALDATA_OFFSET 0x1000
+#define GL_AR150_WMAC_MAC_OFFSET 0x0000
+
+static struct gpio_led gl_ar150_leds_gpio[] __initdata = {
+ {
+ .name = "gl_ar150:wlan",
+ .gpio = GL_AR150_GPIO_LED_WLAN,
+ .active_low = 0,
+ },
+ {
+ .name = "gl_ar150:lan",
+ .gpio = GL_AR150_GPIO_LED_LAN,
+ .active_low = 0,
+ },
+ {
+ .name = "gl_ar150:wan",
+ .gpio = GL_AR150_GPIO_LED_WAN,
+ .active_low = 0,
+ .default_state = 1,
+ },
+};
+
+static struct gpio_keys_button gl_ar150_gpio_keys[] __initdata = {
+ {
+ .desc = "BTN_7",
+ .type = EV_KEY,
+ .code = BTN_7,
+ .debounce_interval = GL_AR150_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = GL_AR150_GPIO_BTN_MANUAL,
+ .active_low = 0,
+ },
+ {
+ .desc = "BTN_8",
+ .type = EV_KEY,
+ .code = BTN_8,
+ .debounce_interval = GL_AR150_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = GL_AR150_GPIO_BTN_AUTO,
+ .active_low = 0,
+ },
+ {
+ .desc = "reset",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = GL_AR150_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = GL_AR150_GPIO_BTN_RESET,
+ .active_low = 0,
+ },
+};
+
+static void __init gl_ar150_setup(void)
+{
+
+ /* ART base address */
+ u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
+
+ /* disable PHY_SWAP and PHY_ADDR_SWAP bits */
+ ath79_setup_ar933x_phy4_switch(false, false);
+
+ /* register flash. */
+ ath79_register_m25p80(NULL);
+
+ /* register gpio LEDs and keys */
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(gl_ar150_leds_gpio),
+ gl_ar150_leds_gpio);
+ ath79_register_gpio_keys_polled(-1, GL_AR150_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(gl_ar150_gpio_keys),
+ gl_ar150_gpio_keys);
+
+ /* enable usb */
+ gpio_request_one(GL_AR150_GPIO_BIN_USB,
+ GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+ "USB power");
+ ath79_register_usb();
+
+ /* register eth0 as WAN, eth1 as LAN */
+ ath79_init_mac(ath79_eth0_data.mac_addr, art+GL_AR150_MAC0_OFFSET, 0);
+ ath79_init_mac(ath79_eth1_data.mac_addr, art+GL_AR150_MAC1_OFFSET, 0);
+ ath79_register_mdio(0, 0x0);
+ ath79_register_eth(0);
+ ath79_register_eth(1);
+
+ /* register wireless mac with cal data */
+ ath79_register_wmac(art + GL_AR150_CALDATA_OFFSET, art + GL_AR150_WMAC_MAC_OFFSET);
+}
+
+MIPS_MACHINE(ATH79_MACH_GL_AR150, "GL-AR150", "GL AR150",gl_ar150_setup);
diff --git a/target/linux/ar71xx/generic/profiles/gl-connect.mk b/target/linux/ar71xx/generic/profiles/gl-connect.mk
deleted file mode 100644
index e9377dbbfa042f790f15817313c24b2700617f37..0000000000000000000000000000000000000000
--- a/target/linux/ar71xx/generic/profiles/gl-connect.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Copyright (C) 2014 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define Profile/GLINET
- NAME:=GL.iNet
- PACKAGES:=kmod-usb-core kmod-usb2
-endef
-
-define Profile/GLINET/Description
- Package set optimized for the GL-Connect GL.iNet v1.
-endef
-
-$(eval $(call Profile,GLINET))
diff --git a/target/linux/ar71xx/generic/profiles/gli.mk b/target/linux/ar71xx/generic/profiles/gli.mk
new file mode 100644
index 0000000000000000000000000000000000000000..a6ad661666a168a591319e74ef211277f8617fca
--- /dev/null
+++ b/target/linux/ar71xx/generic/profiles/gli.mk
@@ -0,0 +1,27 @@
+#
+# Copyright (C) 2013 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+define Profile/GLINET
+ NAME:=GL.iNet 6416
+ PACKAGES:=kmod-usb-core kmod-usb2
+endef
+
+define Profile/GLINET/Description
+ Package set optimized for the GL-Connect GL.iNet v1.
+endef
+
+$(eval $(call Profile,GLINET))
+
+define Profile/GL-AR150
+ NAME:=GL AR150
+ PACKAGES:=kmod-usb-core kmod-usb2
+endef
+
+define Profile/GL-AR150/Description
+ Configuration of GL AR150.
+endef
+
+$(eval $(call Profile,GL-AR150))
diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
index 7c648f26e10c49000b848e9b300701b388410c04..05eea0b16c362ba5f70c9f435dbe312087b319c2 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -144,6 +144,14 @@ define Device/weio
endef
TARGET_DEVICES += weio
+define Device/gl-ar150
+ BOARDNAME = GL-AR150
+ IMAGE_SIZE = 16000k
+ CONSOLE = ttyATH0,115200
+ MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,16000k(firmware),64k(art)ro
+endef
+TARGET_DEVICES += gl-ar150
+
define Device/wndr3700
BOARDNAME = WNDR3700
NETGEAR_KERNEL_MAGIC = 0x33373030
diff --git a/target/linux/ar71xx/patches-3.18/911-MIPS-ath79-add-gl_ar150.patch b/target/linux/ar71xx/patches-3.18/911-MIPS-ath79-add-gl_ar150.patch
new file mode 100644
index 0000000000000000000000000000000000000000..31db5816caf5dc8076ceec349884cf9a47b2fc68
--- /dev/null
+++ b/target/linux/ar71xx/patches-3.18/911-MIPS-ath79-add-gl_ar150.patch
@@ -0,0 +1,39 @@
+--- a/arch/mips/ath79/Kconfig
++++ b/arch/mips/ath79/Kconfig
+@@ -533,6 +533,16 @@ config ATH79_MACH_GL_INET
+ select ATH79_DEV_USB
+ select ATH79_DEV_WMAC
+
++config ATH79_MACH_GL_AR150
++ bool "GL AR150 support"
++ select SOC_AR933X
++ 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_EAP300V2
+ bool "EnGenius EAP300 v2 support"
+ select SOC_AR934X
+--- a/arch/mips/ath79/Makefile
++++ b/arch/mips/ath79/Makefile
+@@ -78,6 +78,7 @@ obj-$(CONFIG_ATH79_MACH_EL_MINI) += mach
+ obj-$(CONFIG_ATH79_MACH_EPG5000) += mach-epg5000.o
+ obj-$(CONFIG_ATH79_MACH_ESR1750) += mach-esr1750.o
+ obj-$(CONFIG_ATH79_MACH_F9K1115V2) += mach-f9k1115v2.o
++obj-$(CONFIG_ATH79_MACH_GL_AR150) += mach-gl-ar150.o
+ obj-$(CONFIG_ATH79_MACH_GL_INET) += mach-gl-inet.o
+ obj-$(CONFIG_ATH79_MACH_GS_MINIBOX_V1) += mach-gs-minibox-v1.o
+ obj-$(CONFIG_ATH79_MACH_GS_OOLITE) += mach-gs-oolite.o
+--- a/arch/mips/ath79/machtypes.h
++++ b/arch/mips/ath79/machtypes.h
+@@ -67,6 +67,7 @@ enum ath79_mach_type {
+ ATH79_MACH_ESR1750, /* EnGenius ESR1750 */
+ ATH79_MACH_EPG5000, /* EnGenius EPG5000 */
+ ATH79_MACH_F9K1115V2, /* Belkin AC1750DB */
++ ATH79_MACH_GL_AR150, /* GL-AR150 support */
+ ATH79_MACH_GL_INET, /* GL-CONNECT GL-INET */
+ ATH79_MACH_GS_MINIBOX_V1, /* Gainstrong MiniBox V1.0 */
+ ATH79_MACH_GS_OOLITE, /* GS OOLITE V1.0 */

View File

@ -1,48 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Wed, 15 Jun 2016 19:31:34 +0200
Subject: build: don't add -j for parallel builds with Make 4.2+
Make usually passes -j and jobserver arguments as part of MAKEFLAGS. LEDE
removes MAKEFLAGS to have better control of the build, and re-adds the
jobserver arguments with -j to the Make commandline where desired.
Make 4.2+ behave differently with these arguments passed on the commandline
than in MAKEFLAGS: -j will override the jobserver argument and the job
count will be unlimited.
Moving the flags to MAKEFLAGS will need many packages to be changed and
tested; therefore, we opt for a less invasive change for now and just
remove -j for Make 4.2+, as the jobserver argument alone is enough to
enable parallel builds for these Make versions.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Backport of LEDE 6fb212f2933bbbdf2935124205717c9d0ca72b32
diff --git a/include/host-build.mk b/include/host-build.mk
index e2b5f2f8d1882207e11697df3df1302076adfaa3..44401b866a4d637648bb093470a5e66b4a3e38fc 100644
--- a/include/host-build.mk
+++ b/include/host-build.mk
@@ -10,7 +10,7 @@ HOST_INSTALL_DIR ?= $(HOST_BUILD_DIR)/host-install
HOST_BUILD_PARALLEL ?=
ifneq ($(CONFIG_PKG_BUILD_USE_JOBSERVER),)
- HOST_MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) -j)
+ HOST_MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) $(if $(filter 3.% 4.0 4.1,$(MAKE_VERSION)),-j))
else
HOST_MAKE_J:=-j$(CONFIG_PKG_BUILD_JOBS)
endif
diff --git a/include/package.mk b/include/package.mk
index c69d92819779dd0ee92381620accd73ef2b80de6..a99cdc6990280d7ef83223861cd9f224c6eebc33 100644
--- a/include/package.mk
+++ b/include/package.mk
@@ -23,7 +23,7 @@ PKG_RELRO_PARTIAL ?= 1
PKG_RELRO_FULL ?= 1
ifneq ($(CONFIG_PKG_BUILD_USE_JOBSERVER),)
- MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) -j)
+ MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) $(if $(filter 3.% 4.0 4.1,$(MAKE_VERSION)),-j))
else
MAKE_J:=-j$(CONFIG_PKG_BUILD_JOBS)
endif

View File

@ -1,30 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Wed, 15 Jun 2016 19:31:49 +0200
Subject: tools/cmake: fix parallel build with Make 4.2+
Avoid using the --parallel argument to the CMake bootstrap, as that doesn't
allow us to remove the -j argument. Instead, pass the HOST_JOBS arguments
in MAKEFLAGS.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Backport of LEDE 96db10752483cb07f822686482b44be6c21fbb5f
diff --git a/tools/cmake/Makefile b/tools/cmake/Makefile
index 08e2b028150dd4f496e3a8ebccf27bd49b6937c2..6c211def540a6a41012349d5979b919481e1bcec 100644
--- a/tools/cmake/Makefile
+++ b/tools/cmake/Makefile
@@ -18,10 +18,11 @@ HOST_CONFIGURE_PARALLEL:=1
include $(INCLUDE_DIR)/host-build.mk
+HOST_CONFIGURE_CMD := MAKEFLAGS="$(HOST_JOBS)" $(BASH) ./configure
+
HOST_CONFIGURE_VARS :=
HOST_CONFIGURE_ARGS := \
- --prefix=$(STAGING_DIR_HOST) \
- $(if $(MAKE_JOBSERVER),--parallel="$(MAKE_JOBSERVER)")
+ --prefix=$(STAGING_DIR_HOST)
$(eval $(call HostBuild))

View File

@ -1,143 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Thu, 16 Jun 2016 00:51:07 +0200
Subject: linux: make IPv6 builtin if selected (saves >30KB)
Signed-off-by: Steven Barth <steven@midlink.org>
Backport of OpenWrt r46834
kmod-ipv6 is added to the PROVIDES of the kernel package, so we don't have
to adjust all packages depending on kmod-ipv6.
diff --git a/config/Config-build.in b/config/Config-build.in
index 4674d8403539a3b209d709342ab71a6e6ff79de2..cd50290f812f73bc6886a789a456956fa4fb1e42 100644
--- a/config/Config-build.in
+++ b/config/Config-build.in
@@ -83,7 +83,7 @@ menu "Global build settings"
prompt "Enable IPv6 support in packages"
default y
help
- Enable IPv6 support in packages (passes --enable-ipv6 to configure scripts).
+ Enables IPv6 support in kernel (builtin) and packages.
config PKG_BUILD_PARALLEL
bool
diff --git a/package/kernel/linux/Makefile b/package/kernel/linux/Makefile
index 45ca9faa923eb1a1db97d94d0406a46223c59a8f..b06c49a92fd396e8edcb0ca7a7a94b74b05a87e0 100644
--- a/package/kernel/linux/Makefile
+++ b/package/kernel/linux/Makefile
@@ -49,6 +49,7 @@ define Package/kernel
TITLE:=Virtual kernel package
VERSION:=$(LINUX_VERSION)-$(LINUX_RELEASE)-$(LINUX_VERMAGIC)
URL:=http://www.kernel.org/
+ PROVIDES:=$(if $(CONFIG_IPV6),kmod-ipv6)
endef
define Package/kernel/install
diff --git a/package/kernel/linux/modules/netsupport.mk b/package/kernel/linux/modules/netsupport.mk
index cea8e47a65b5283640a17ed6c311bd87c70373b2..8a2760d8a4a429f206eba41a8c83432e5b6ddab7 100644
--- a/package/kernel/linux/modules/netsupport.mk
+++ b/package/kernel/linux/modules/netsupport.mk
@@ -439,7 +439,7 @@ $(eval $(call KernelPackage,iptunnel4))
define KernelPackage/iptunnel6
SUBMENU:=$(NETWORK_SUPPORT_MENU)
TITLE:=IPv6 tunneling
- DEPENDS:= +kmod-ipv6
+ DEPENDS:=@IPV6
KCONFIG:= \
CONFIG_INET6_TUNNEL
FILES:=$(LINUX_DIR)/net/ipv6/tunnel6.ko
@@ -456,15 +456,16 @@ $(eval $(call KernelPackage,iptunnel6))
define KernelPackage/ipv6
SUBMENU:=$(NETWORK_SUPPORT_MENU)
TITLE:=IPv6 support
+ DEPENDS:=@IPV6
+ HIDDEN:=1
+ DEFAULT:=y
KCONFIG:= \
- CONFIG_IPV6 \
+ CONFIG_IPV6=y \
CONFIG_IPV6_PRIVACY=y \
CONFIG_IPV6_MULTIPLE_TABLES=y \
CONFIG_IPV6_MROUTE=y \
CONFIG_IPV6_PIMSM_V2=n \
CONFIG_IPV6_SUBTREES=y
- FILES:=$(LINUX_DIR)/net/ipv6/ipv6.ko
- AUTOLOAD:=$(call AutoLoad,20,ipv6)
endef
define KernelPackage/ipv6/description
@@ -476,7 +477,7 @@ $(eval $(call KernelPackage,ipv6))
define KernelPackage/sit
SUBMENU:=$(NETWORK_SUPPORT_MENU)
- DEPENDS:=+kmod-ipv6 +kmod-iptunnel +kmod-iptunnel4
+ DEPENDS:=@IPV6 +kmod-iptunnel +kmod-iptunnel4
TITLE:=IPv6-in-IPv4 tunnel
KCONFIG:=CONFIG_IPV6_SIT \
CONFIG_IPV6_SIT_6RD=y
@@ -494,7 +495,7 @@ $(eval $(call KernelPackage,sit))
define KernelPackage/ip6-tunnel
SUBMENU:=$(NETWORK_SUPPORT_MENU)
TITLE:=IP-in-IPv6 tunnelling
- DEPENDS:= +kmod-ipv6 +kmod-iptunnel6
+ DEPENDS:=@IPV6 +kmod-iptunnel6
KCONFIG:= CONFIG_IPV6_TUNNEL
FILES:=$(LINUX_DIR)/net/ipv6/ip6_tunnel.ko
AUTOLOAD:=$(call AutoLoad,32,ip6_tunnel)
@@ -510,7 +511,7 @@ $(eval $(call KernelPackage,ip6-tunnel))
define KernelPackage/gre
SUBMENU:=$(NETWORK_SUPPORT_MENU)
TITLE:=GRE support
- DEPENDS:=+PACKAGE_kmod-ipv6:kmod-ipv6 +kmod-iptunnel
+ DEPENDS:=+kmod-iptunnel
KCONFIG:=CONFIG_NET_IPGRE CONFIG_NET_IPGRE_DEMUX
FILES:=$(LINUX_DIR)/net/ipv4/ip_gre.ko $(LINUX_DIR)/net/ipv4/gre.ko
AUTOLOAD:=$(call AutoLoad,39,gre ip_gre)
@@ -526,7 +527,7 @@ $(eval $(call KernelPackage,gre))
define KernelPackage/gre6
SUBMENU:=$(NETWORK_SUPPORT_MENU)
TITLE:=GRE support over IPV6
- DEPENDS:=+kmod-ipv6 +kmod-iptunnel +kmod-ip6-tunnel
+ DEPENDS:=@IPV6 +kmod-iptunnel +kmod-ip6-tunnel
KCONFIG:=CONFIG_IPV6_GRE
FILES:=$(LINUX_DIR)/net/ipv6/ip6_gre.ko
AUTOLOAD:=$(call AutoLoad,39,ip6_gre)
@@ -862,7 +863,6 @@ define KernelPackage/l2tp
SUBMENU:=$(NETWORK_SUPPORT_MENU)
TITLE:=Layer Two Tunneling Protocol (L2TP)
DEPENDS:= \
- +IPV6:kmod-ipv6 \
+kmod-udptunnel4 \
+IPV6:kmod-udptunnel6
KCONFIG:=CONFIG_L2TP \
@@ -898,7 +898,7 @@ $(eval $(call KernelPackage,l2tp-eth))
define KernelPackage/l2tp-ip
SUBMENU:=$(NETWORK_SUPPORT_MENU)
TITLE:=L2TP IP encapsulation for L2TPv3
- DEPENDS:=+kmod-l2tp +IPV6:kmod-ipv6
+ DEPENDS:=+kmod-l2tp
KCONFIG:=CONFIG_L2TP_IP
FILES:= \
$(LINUX_DIR)/net/l2tp/l2tp_ip.ko \
@@ -930,7 +930,7 @@ define KernelPackage/sctp
CONFIG_SCTP_DEFAULT_COOKIE_HMAC_MD5=y
FILES:= $(LINUX_DIR)/net/sctp/sctp.ko
AUTOLOAD:= $(call AutoLoad,32,sctp)
- DEPENDS:=+kmod-lib-crc32c +kmod-crypto-md5 +kmod-crypto-hmac +IPV6:kmod-ipv6
+ DEPENDS:=+kmod-lib-crc32c +kmod-crypto-md5 +kmod-crypto-hmac
endef
define KernelPackage/sctp/description
diff --git a/package/network/services/dnsmasq/Makefile b/package/network/services/dnsmasq/Makefile
index 19a8df9009da7fee967b84f65248470db3b34150..8fd51fe8748082b072710b718300a706832b25be 100644
--- a/package/network/services/dnsmasq/Makefile
+++ b/package/network/services/dnsmasq/Makefile
@@ -52,7 +52,6 @@ define Package/dnsmasq-full
$(call Package/dnsmasq/Default)
TITLE += (with DNSSEC, DHCPv6, Auth DNS, IPset enabled by default)
DEPENDS:=+PACKAGE_dnsmasq_full_dnssec:libnettle \
- +PACKAGE_dnsmasq_full_dhcpv6:kmod-ipv6 \
+PACKAGE_dnsmasq_full_ipset:kmod-ipt-ipset
VARIANT:=full
endef

View File

@ -1,21 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Thu, 16 Jun 2016 04:28:44 +0200
Subject: package-ipkg.mk: fix Provides for packages with multiple PROVIDES entries
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Backport of LEDE 3ee6c17cd14ec1fed0b0491542c499c03fc6d211
diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk
index eb4c874047e8a9e24a4d77b13f7ba66e1221cbb5..1830d644c36fa3dad342d3283529a18b8d70a377 100644
--- a/include/package-ipkg.mk
+++ b/include/package-ipkg.mk
@@ -154,7 +154,7 @@ Package: $(1)
Version: $(VERSION)
$$(call addfield,Depends,$$(Package/$(1)/DEPENDS)
)$$(call addfield,Conflicts,$$(call mergelist,$(CONFLICTS))
-)$$(call addfield,Provides,$(PROVIDES)
+)$$(call addfield,Provides,$$(call mergelist,$(PROVIDES))
)$$(call addfield,Source,$(SOURCE)
)$$(call addfield,License,$$(PKG_LICENSE)
)$$(call addfield,LicenseFiles,$$(PKG_LICENSE_FILES)

View File

@ -1,154 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Thu, 16 Jun 2016 03:42:03 +0200
Subject: kernel: remove packaging of kmod-crypto-core and kmod-crypto-arc4
Everything except for blkcipher was already built-in, so make blkcipher
built-in as well.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Backport of OpenWrt r46820
The packages kmod-crypto-{core,arc4} are added to kernel PROVIDES to
satisfy dependencies of CC packages.
diff --git a/package/kernel/linux/Makefile b/package/kernel/linux/Makefile
index b06c49a92fd396e8edcb0ca7a7a94b74b05a87e0..19bcbd582ba06cb8cdb9ee869c50a67dbfd470bb 100644
--- a/package/kernel/linux/Makefile
+++ b/package/kernel/linux/Makefile
@@ -49,7 +49,7 @@ define Package/kernel
TITLE:=Virtual kernel package
VERSION:=$(LINUX_VERSION)-$(LINUX_RELEASE)-$(LINUX_VERMAGIC)
URL:=http://www.kernel.org/
- PROVIDES:=$(if $(CONFIG_IPV6),kmod-ipv6)
+ PROVIDES:=kmod-crypto-core kmod-crypto-arc4 $(if $(CONFIG_IPV6),kmod-ipv6)
endef
define Package/kernel/install
diff --git a/package/kernel/linux/modules/crypto.mk b/package/kernel/linux/modules/crypto.mk
index c8e0fbb04397c9b1fa7ebde3579f663b5d756e1b..926dab0e3379efbc92aeac865b02673928c18644 100644
--- a/package/kernel/linux/modules/crypto.mk
+++ b/package/kernel/linux/modules/crypto.mk
@@ -15,24 +15,9 @@ crypto_confvar=CONFIG_CRYPTO_$(word 1,$(subst =,$(space),$(1)))
crypto_file=$(LINUX_DIR)/crypto/$(word 2,$(subst =,$(space),$(1))).ko
crypto_name=$(if $(findstring y,$($(call crypto_confvar,$(1)))),,$(word 2,$(subst =,$(space),$(1))))
-define KernelPackage/crypto-core
- SUBMENU:=$(CRYPTO_MENU)
- TITLE:=Core CryptoAPI modules
- KCONFIG:= \
- CONFIG_CRYPTO=y \
- CONFIG_CRYPTO_HW=y \
- CONFIG_CRYPTO_BLKCIPHER \
- CONFIG_CRYPTO_ALGAPI \
- $(foreach mod,$(CRYPTO_MODULES),$(call crypto_confvar,$(mod)))
- FILES:=$(foreach mod,$(CRYPTO_MODULES),$(call crypto_file,$(mod)))
-endef
-
-$(eval $(call KernelPackage,crypto-core))
-
-
define AddDepends/crypto
SUBMENU:=$(CRYPTO_MENU)
- DEPENDS+=+kmod-crypto-core $(1)
+ DEPENDS+= $(1)
endef
define KernelPackage/crypto-aead
@@ -272,17 +257,6 @@ endif
$(eval $(call KernelPackage,crypto-aes))
-define KernelPackage/crypto-arc4
- TITLE:=ARC4 (RC4) cipher CryptoAPI module
- KCONFIG:=CONFIG_CRYPTO_ARC4
- FILES:=$(LINUX_DIR)/crypto/arc4.ko
- AUTOLOAD:=$(call AutoLoad,09,arc4)
- $(call AddDepends/crypto)
-endef
-
-$(eval $(call KernelPackage,crypto-arc4))
-
-
define KernelPackage/crypto-authenc
TITLE:=Combined mode wrapper for IPsec
DEPENDS:=+kmod-crypto-manager
diff --git a/package/kernel/linux/modules/fs.mk b/package/kernel/linux/modules/fs.mk
index fa182375ea8b0224753141620bd168328194ddf4..cc87a45961d04d93badce575530495f994deee86 100644
--- a/package/kernel/linux/modules/fs.mk
+++ b/package/kernel/linux/modules/fs.mk
@@ -91,7 +91,6 @@ define KernelPackage/fs-cifs
AUTOLOAD:=$(call AutoLoad,30,cifs)
$(call AddDepends/nls)
DEPENDS+= \
- +kmod-crypto-arc4 \
+kmod-crypto-hmac \
+kmod-crypto-md5 \
+kmod-crypto-md4 \
diff --git a/package/kernel/linux/modules/netsupport.mk b/package/kernel/linux/modules/netsupport.mk
index 8a2760d8a4a429f206eba41a8c83432e5b6ddab7..ab76946d2ab30e748ea5bc69c24051dbfc411036 100644
--- a/package/kernel/linux/modules/netsupport.mk
+++ b/package/kernel/linux/modules/netsupport.mk
@@ -714,7 +714,7 @@ $(eval $(call KernelPackage,ipoa))
define KernelPackage/mppe
SUBMENU:=$(NETWORK_SUPPORT_MENU)
TITLE:=Microsoft PPP compression/encryption
- DEPENDS:=kmod-ppp +kmod-crypto-core +kmod-crypto-arc4 +kmod-crypto-sha1 +kmod-crypto-ecb
+ DEPENDS:=kmod-ppp +kmod-crypto-sha1 +kmod-crypto-ecb
KCONFIG:= \
CONFIG_PPP_MPPE_MPPC \
CONFIG_PPP_MPPE
@@ -998,7 +998,7 @@ define KernelPackage/rxrpc
$(LINUX_DIR)/net/rxrpc/af-rxrpc.ko \
$(LINUX_DIR)/net/rxrpc/rxkad.ko
AUTOLOAD:=$(call AutoLoad,30,rxkad af-rxrpc)
- DEPENDS:=+kmod-crypto-core +kmod-crypto-manager +kmod-crypto-pcbc +kmod-crypto-fcrypt
+ DEPENDS:= +kmod-crypto-manager +kmod-crypto-pcbc +kmod-crypto-fcrypt
endef
define KernelPackage/rxrpc/description
diff --git a/target/linux/generic/config-3.18 b/target/linux/generic/config-3.18
index 6038692b7e81334e4864d30453f734f4fe829aa0..a0dc3c9b607abe32c1ca021b7fad293a8f742ec1 100644
--- a/target/linux/generic/config-3.18
+++ b/target/linux/generic/config-3.18
@@ -700,9 +700,10 @@ CONFIG_CRYPTO_ALGAPI=y
CONFIG_CRYPTO_ALGAPI2=y
# CONFIG_CRYPTO_ANSI_CPRNG is not set
# CONFIG_CRYPTO_ANUBIS is not set
-# CONFIG_CRYPTO_ARC4 is not set
+CONFIG_CRYPTO_ARC4=y
# CONFIG_CRYPTO_AUTHENC is not set
-# CONFIG_CRYPTO_BLKCIPHER is not set
+CONFIG_CRYPTO_BLKCIPHER=y
+CONFIG_CRYPTO_BLKCIPHER2=y
# CONFIG_CRYPTO_BLOWFISH is not set
# CONFIG_CRYPTO_CAMELLIA is not set
# CONFIG_CRYPTO_CAST5 is not set
diff --git a/target/linux/omap/config-3.18 b/target/linux/omap/config-3.18
index a06a350a37c035c66ec8d6242f28379e7992685e..d5003c275b2b2a167d4614f5e33269941a02173e 100644
--- a/target/linux/omap/config-3.18
+++ b/target/linux/omap/config-3.18
@@ -114,9 +114,6 @@ CONFIG_CPU_V7=y
CONFIG_CRC16=y
CONFIG_CRYPTO_AEAD=m
CONFIG_CRYPTO_AEAD2=m
-CONFIG_CRYPTO_ARC4=m
-CONFIG_CRYPTO_BLKCIPHER=m
-CONFIG_CRYPTO_BLKCIPHER2=m
CONFIG_CRYPTO_CCM=m
CONFIG_CRYPTO_CRC32C=y
CONFIG_CRYPTO_CTR=m
diff --git a/target/linux/sunxi/config-3.18 b/target/linux/sunxi/config-3.18
index ddc3f7acb82064fb3be16f5111b0c4344b01c362..57651bbd65ebc61b14d45aefaaf20e5b8d59e27a 100644
--- a/target/linux/sunxi/config-3.18
+++ b/target/linux/sunxi/config-3.18
@@ -110,9 +110,6 @@ CONFIG_CPU_TLB_V7=y
CONFIG_CPU_V7=y
CONFIG_CRC16=y
CONFIG_CRC_T10DIF=y
-CONFIG_CRYPTO_ARC4=y
-CONFIG_CRYPTO_BLKCIPHER=y
-CONFIG_CRYPTO_BLKCIPHER2=y
CONFIG_CRYPTO_CRC32C=y
CONFIG_CRYPTO_CRCT10DIF=y
CONFIG_CRYPTO_DES=y

View File

@ -1,24 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sun, 3 Jul 2016 19:15:49 +0200
Subject: x86: stop relying on hexdump for image build signature
Use perl to generate random number instead.
See https://github.com/freifunk-gluon/gluon/issues/811
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Backport of LEDE d5ee23ee275fcd6550b0051de59706cc928cdac8
diff --git a/target/linux/x86/image/Makefile b/target/linux/x86/image/Makefile
index e7e02f15fbb3d1638b26982e7ddff305464e6851..6f64eba398e34093308b766839e69780512a4ca8 100644
--- a/target/linux/x86/image/Makefile
+++ b/target/linux/x86/image/Makefile
@@ -40,7 +40,7 @@ ifneq ($(GRUB_TERMINALS),)
GRUB_TERMINAL_CONFIG := terminal_input $(GRUB_TERMINALS); terminal_output $(GRUB_TERMINALS)
endif
-SIGNATURE:=$(shell dd if=/dev/urandom bs=4 count=1 2>/dev/null | hexdump -v -e '"%08x"')
+SIGNATURE:=$(shell perl -e 'printf("%08x", rand(0xFFFFFFFF))')
ROOTPART:=$(call qstrip,$(CONFIG_TARGET_ROOTFS_PARTNAME))
ROOTPART:=$(if $(ROOTPART),$(ROOTPART),PARTUUID=$(SIGNATURE)-02)

View File

@ -1,34 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Thu, 30 Jun 2016 21:52:02 +0200
Subject: mt76: fix build with kernel 3.18
diff --git a/package/kernel/mac80211/patches/945-netdev_alloc_frag.patch b/package/kernel/mac80211/patches/945-netdev_alloc_frag.patch
new file mode 100644
index 0000000000000000000000000000000000000000..ea389cd85cb15c7ecb20a1e0c934fcf8b58c0eda
--- /dev/null
+++ b/package/kernel/mac80211/patches/945-netdev_alloc_frag.patch
@@ -0,0 +1,11 @@
+--- a/backport-include/linux/netdevice.h
++++ b/backport-include/linux/netdevice.h
+@@ -233,7 +233,7 @@ static inline void backport_unregister_n
+ #endif
+
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
+-#define napi_alloc_frag(fragsz) netdev_alloc_frag(fragsz)
++#define napi_alloc_frag netdev_alloc_frag
+ #endif
+
+ /*
diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile
index bd851e61910c9a57ca45a570855ca22329c9ae4b..989ba0c2e8d10f6e7bb8fbd31e7181efff19be7c 100644
--- a/package/kernel/mt76/Makefile
+++ b/package/kernel/mt76/Makefile
@@ -24,7 +24,7 @@ include $(INCLUDE_DIR)/package.mk
define KernelPackage/mt76
SUBMENU:=Wireless Drivers
TITLE:=MediaTek MT76x2/MT7603 wireless driver
- DEPENDS:=+kmod-mac80211 +@DRIVER_11N_SUPPORT @PCI_SUPPORT @!LINUX_3_18
+ DEPENDS:=+kmod-mac80211 +@DRIVER_11N_SUPPORT @PCI_SUPPORT
FILES:=\
$(PKG_BUILD_DIR)/mt76.ko \
$(PKG_BUILD_DIR)/mt76x2e.ko \

View File

@ -1,41 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Thu, 30 Jun 2016 15:34:32 +0200
Subject: ramips: Support LEDs on D-Link DIR-860L B1
Adds the required gpio definitions.
Signed-off-by: Johannes Wienke <languitar@semipol.de>
Backport of OpenWrt r48715
diff --git a/target/linux/ramips/dts/DIR-860L-B1.dts b/target/linux/ramips/dts/DIR-860L-B1.dts
index 23ec1140bc89fa06aa2920bc43efc8bb7465fb42..2582b3d4182d3a0fcee6e6ea6f97ab8007edf3a2 100644
--- a/target/linux/ramips/dts/DIR-860L-B1.dts
+++ b/target/linux/ramips/dts/DIR-860L-B1.dts
@@ -97,6 +97,26 @@
gpio-leds {
compatible = "gpio-leds";
+
+ power {
+ label = "d-link:orange:power";
+ gpios = <&gpio0 13 1>;
+ };
+
+ power2 {
+ label = "d-link:green:power";
+ gpios = <&gpio0 15 1>;
+ };
+
+ net {
+ label = "d-link:orange:net";
+ gpios = <&gpio0 14 1>;
+ };
+
+ net2 {
+ label = "d-link:green:net";
+ gpios = <&gpio0 16 1>;
+ };
};
gpio-keys-polled {

View File

@ -1,56 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Thu, 30 Jun 2016 15:18:03 +0200
Subject: ramips: add button support and make LEDs known to userspace for DIR-860L B1
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds b/target/linux/ramips/base-files/etc/board.d/01_leds
index 5327d006299ed94c645542f687e20962c83e842d..5fb28a52f7632bf09e7f62ff77dcd7254a2ebcc2 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -114,6 +114,9 @@ case $board in
esr-9753)
set_wifi_led "rt2800pci-phy0::radio"
;;
+ dir-860l-b1)
+ ucidef_set_led_netdev "wan" "wan" "d-link:green:net" "eth0.2"
+ ;;
ex2700)
ucidef_set_led_default "power_r" "POWER (red)" "ex2700:red:power" "0"
set_wifi_led "ex2700:green:router"
diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh
index 6474ebdde354b51648fcafd426e3256f0b6fe8b4..37360a417cb24eaedef24766510db7146c92e3cb 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -54,6 +54,9 @@ get_status_led() {
dir-645)
status_led="d-link:green:wps"
;;
+ dir-860l-b1)
+ status_led="d-link:green:power"
+ ;;
dap-1350)
status_led="d-link:blue:power"
;;
diff --git a/target/linux/ramips/dts/DIR-860L-B1.dts b/target/linux/ramips/dts/DIR-860L-B1.dts
index 2582b3d4182d3a0fcee6e6ea6f97ab8007edf3a2..c0bcc86216cf4bd343b688aa7e717b5c45775c50 100644
--- a/target/linux/ramips/dts/DIR-860L-B1.dts
+++ b/target/linux/ramips/dts/DIR-860L-B1.dts
@@ -124,5 +124,17 @@
#address-cells = <1>;
#size-cells = <0>;
poll-interval = <20>;
+
+ reset {
+ label = "reset";
+ gpios = <&gpio0 7 1>;
+ linux,code = <0x198>;
+ };
+
+ wps {
+ label = "wps";
+ gpios = <&gpio0 18 1>;
+ linux,code = <0x211>;
+ };
};
};

View File

@ -1,22 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Thu, 30 Jun 2016 16:16:30 +0200
Subject: ramips: set correct LAN/WAN MAC addresses on DIR-860L B1
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
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 a78912dbc9b5ecdc8a9fb0c583c1e47fdb579015..4e6e507625adf8c706e2311ee121769cadb2aeaf 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -346,6 +346,11 @@ ramips_setup_macs()
wan_mac=$(mtd_get_mac_ascii nvram wanmac)
;;
+ dir-860l-b1)
+ lan_mac=$(mtd_get_mac_ascii factory lanmac)
+ wan_mac=$(mtd_get_mac_ascii factory wanmac)
+ ;;
+
e1700)
wan_mac=$(mtd_get_mac_ascii config WAN_MAC_ADDR)
;;

View File

@ -1,323 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sun, 3 Jul 2016 22:14:18 +0200
Subject: ar71xx: add support for TP-LINK TL-WR842N/ND v3
- CPU QCA9531-BL3A
- RAM: 64MB
- flash: 16MB
- USB
AP143 platform, similar to tl-wr841n v10/v11, but with USB
Signed-off-by: Cezary Jackiewicz <cezary@eko.one.pl>
Backport of LEDE 0b45bec22c59cc6e6b2fa71dc9a88386c5587132
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index cb92349cab833179a87a195b94e2539cc5ce3e79..2c5d6af8f4e2c5ce71adc0b63d32b8506e01b6a2 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -280,6 +280,7 @@ get_status_led() {
tl-wr841n-v11 | \
tl-wa830re-v2 | \
tl-wr842n-v2 | \
+ tl-wr842n-v3 | \
tl-wr941nd | \
tl-wr941nd-v5)
status_led="tp-link:green:system"
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
index d81358d6bf9103ffeb2929b06d3ab01efffe931c..14aa7bc5e56c0d7be435ba3a1803416075eccb58 100644
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
@@ -523,6 +523,16 @@ tl-wr842n-v2)
ucidef_set_led_usbdev "usb" "USB" "tp-link:green:3g" "1-1"
;;
+tl-wr842n-v3)
+ ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth1"
+ 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"
+ ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
+ ucidef_set_led_usbdev "usb" "USB" "tp-link:green:3g" "1-1"
+ ;;
+
tl-wa801nd-v2 | \
tl-wa901nd-v3)
ucidef_set_led_netdev "lan" "LAN" "tp-link:green:lan" "eth0"
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
index ac3deb8aa2ed4717e2bd682cb4ffd7d32c50134f..ca9c5771d72681557f4139c0e58f4d7a656bd741 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -449,6 +449,7 @@ tl-wr741nd-v4 |\
tl-wr841n-v7 |\
tl-wr841n-v9 |\
tl-wr841n-v11 |\
+tl-wr842n-v3 |\
whr-g301n |\
whr-hp-g300n |\
whr-hp-gn |\
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index f242980b3e401f2e9de2b8abe7e984b24a71db5a..fcd0bc35227de9b6a02c10c1bebf2413bdc555bf 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -869,6 +869,9 @@ ar71xx_board_detect() {
*"TL-WR842N/ND v2")
name="tl-wr842n-v2"
;;
+ *"TL-WR842N/ND v3")
+ name="tl-wr842n-v3"
+ ;;
*TL-WR941ND)
name="tl-wr941nd"
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index d816f211891d6a259930f2781574504ea62b4e16..53284df5e2da19d8012361e9560244af898d3c2c 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -367,6 +367,7 @@ platform_check_image() {
tl-wr841n-v9 | \
tl-wr841n-v11 | \
tl-wr842n-v2 | \
+ tl-wr842n-v3 | \
tl-wr941nd | \
tl-wr941nd-v5 | \
tl-wr941nd-v6 | \
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n-v9.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n-v9.c
index 004f71961396cd33cfd381aca386706104a7b757..ebaed15a49113133f59f069325898a00f5612fef 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n-v9.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n-v9.c
@@ -1,9 +1,16 @@
/*
+<<<<<<< HEAD
* TP-LINK TL-WR841N/ND v9/v11
*
* Copyright (C) 2014 Matthias Schiffer <mschiffer@universe-factory.net>
* Copyright (C) 2016 Cezary Jackiewicz <cezary@eko.one.pl>
* Copyright (C) 2016 Stijn Segers <francesco.borromini@gmail.com>
+=======
+ * TP-LINK TL-WR841N/ND v9/TL-WR842N/ND v3
+ *
+ * Copyright (C) 2014 Matthias Schiffer <mschiffer@universe-factory.net>
+ * Copyright (C) 2016 Cezary Jackiewicz <cezary@eko.one.pl>
+>>>>>>> ar71xx: add support for TP-LINK TL-WR842N/ND v3
*
* 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
@@ -49,6 +56,20 @@
#define TL_WR841NV11_GPIO_BTN_RESET 12
#define TL_WR841NV11_GPIO_BTN_WIFI 17
+#define TL_WR842NV3_GPIO_LED_SYSTEM 2
+#define TL_WR842NV3_GPIO_LED_WLAN 3
+#define TL_WR842NV3_GPIO_LED_WAN_RED 4
+#define TL_WR842NV3_GPIO_LED_WAN_GREEN 11
+#define TL_WR842NV3_GPIO_LED_LAN1 12
+#define TL_WR842NV3_GPIO_LED_LAN2 13
+#define TL_WR842NV3_GPIO_LED_LAN3 14
+#define TL_WR842NV3_GPIO_LED_LAN4 15
+#define TL_WR842NV3_GPIO_LED_3G 16
+#define TL_WR842NV3_GPIO_LED_WPS 17
+
+#define TL_WR842NV3_GPIO_BTN_RESET 1
+#define TL_WR842NV3_GPIO_BTN_WIFI 0
+
#define TL_WR841NV9_KEYS_POLL_INTERVAL 20 /* msecs */
#define TL_WR841NV9_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR841NV9_KEYS_POLL_INTERVAL)
@@ -151,6 +172,68 @@ static struct gpio_led tl_wr841n_v11_leds_gpio[] __initdata = {
},
};
+static struct gpio_led tl_wr842n_v3_leds_gpio[] __initdata = {
+ {
+ .name = "tp-link:green:lan1",
+ .gpio = TL_WR842NV3_GPIO_LED_LAN1,
+ .active_low = 1,
+ }, {
+ .name = "tp-link:green:lan2",
+ .gpio = TL_WR842NV3_GPIO_LED_LAN2,
+ .active_low = 1,
+ }, {
+ .name = "tp-link:green:lan3",
+ .gpio = TL_WR842NV3_GPIO_LED_LAN3,
+ .active_low = 1,
+ }, {
+ .name = "tp-link:green:lan4",
+ .gpio = TL_WR842NV3_GPIO_LED_LAN4,
+ .active_low = 1,
+ }, {
+ .name = "tp-link:green:wan",
+ .gpio = TL_WR842NV3_GPIO_LED_WAN_GREEN,
+ .active_low = 1,
+ }, {
+ .name = "tp-link:red:wan",
+ .gpio = TL_WR842NV3_GPIO_LED_WAN_RED,
+ .active_low = 1,
+ }, {
+ .name = "tp-link:green:wlan",
+ .gpio = TL_WR842NV3_GPIO_LED_WLAN,
+ .active_low = 1,
+ }, {
+ .name = "tp-link:green:system",
+ .gpio = TL_WR842NV3_GPIO_LED_SYSTEM,
+ .active_low = 1,
+ }, {
+ .name = "tp-link:green:3g",
+ .gpio = TL_WR842NV3_GPIO_LED_3G,
+ .active_low = 1,
+ }, {
+ .name = "tp-link:green:wps",
+ .gpio = TL_WR842NV3_GPIO_LED_WPS,
+ .active_low = 1,
+ },
+};
+
+static struct gpio_keys_button tl_wr842n_v3_gpio_keys[] __initdata = {
+ {
+ .desc = "Reset button",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = TL_WR841NV9_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = TL_WR842NV3_GPIO_BTN_RESET,
+ .active_low = 1,
+ }, {
+ .desc = "WIFI button",
+ .type = EV_KEY,
+ .code = KEY_RFKILL,
+ .debounce_interval = TL_WR841NV9_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = TL_WR842NV3_GPIO_BTN_WIFI,
+ .active_low = 1,
+ }
+};
+
static void __init tl_ap143_setup(void)
{
u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
@@ -212,3 +295,20 @@ static void __init tl_wr841n_v11_setup(void)
MIPS_MACHINE(ATH79_MACH_TL_WR841N_V11, "TL-WR841N-v11", "TP-LINK TL-WR841N/ND v11",
tl_wr841n_v11_setup);
+
+static void __init tl_wr842n_v3_setup(void)
+{
+ tl_ap143_setup();
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr842n_v3_leds_gpio),
+ tl_wr842n_v3_leds_gpio);
+
+ ath79_register_gpio_keys_polled(1, TL_WR841NV9_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(tl_wr842n_v3_gpio_keys),
+ tl_wr842n_v3_gpio_keys);
+
+ ath79_register_usb();
+}
+
+MIPS_MACHINE(ATH79_MACH_TL_WR842N_V3, "TL-WR842N-v3", "TP-LINK TL-WR842N/ND v3",
+ tl_wr842n_v3_setup);
diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
index 05eea0b16c362ba5f70c9f435dbe312087b319c2..d66bd25fe01544224a69e3f35f020f2e4130c8b3 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -607,6 +607,13 @@ define Device/tl-wr842n-v2
TPLINK_HWID := 0x8420002
endef
+define Device/tl-wr842n-v3
+ $(Device/tplink-16mlzma)
+ BOARDNAME := TL-WR842N-v3
+ DEVICE_PROFILE := TLWR842
+ TPLINK_HWID := 0x08420003
+endef
+
define Device/tl-wr843nd-v1
$(Device/tplink-4mlzma)
BOARDNAME := TL-WR841N-v8
@@ -620,7 +627,7 @@ define Device/tl-wr847n-v8
DEVICE_PROFILE := TLWR841
TPLINK_HWID := 0x08470008
endef
-TARGET_DEVICES += tl-wr841n-v8 tl-wr841n-v9 tl-wr841n-v10 tl-wr841n-v11 tl-wr842n-v2 tl-wr843nd-v1 tl-wr847n-v8
+TARGET_DEVICES += tl-wr841n-v8 tl-wr841n-v9 tl-wr841n-v10 tl-wr841n-v11 tl-wr842n-v2 tl-wr842n-v3 tl-wr843nd-v1 tl-wr847n-v8
define Device/tl-wr941nd-v5
$(Device/tplink-4mlzma)
diff --git a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
index debde6e6a552e71b551d8c01ba06af03013407bf..d4b417bfb78606ddb84076ad8c927952e65118c2 100644
--- a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
+++ b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
@@ -1,6 +1,6 @@
--- a/arch/mips/ath79/machtypes.h
+++ b/arch/mips/ath79/machtypes.h
-@@ -16,22 +16,202 @@
+@@ -16,22 +16,203 @@
enum ath79_mach_type {
ATH79_MACH_GENERIC = 0,
@@ -148,6 +148,7 @@
+ ATH79_MACH_TL_WR841N_V9, /* TP-LINK TL-WR841N/ND v9 */
+ ATH79_MACH_TL_WR841N_V11, /* TP-LINK TL-WR841N/ND v11 */
+ ATH79_MACH_TL_WR842N_V2, /* TP-LINK TL-WR842N/ND v2 */
++ ATH79_MACH_TL_WR842N_V3, /* TP-LINK TL-WR842N/ND v3 */
+ ATH79_MACH_TL_WR941ND, /* TP-LINK TL-WR941ND */
+ ATH79_MACH_TL_WR941ND_V5, /* TP-LINK TL-WR941ND v5 */
+ ATH79_MACH_TL_WR941ND_V6, /* TP-LINK TL-WR941ND v6 */
@@ -285,7 +286,7 @@
config ATH79_MACH_AP121
bool "Atheros AP121 reference board"
select SOC_AR933X
-@@ -11,62 +84,1050 @@ config ATH79_MACH_AP121
+@@ -11,62 +84,1051 @@ config ATH79_MACH_AP121
select ATH79_DEV_M25P80
select ATH79_DEV_USB
select ATH79_DEV_WMAC
@@ -1236,13 +1237,14 @@
+ select ATH79_DEV_WMAC
+
+config ATH79_MACH_TL_WR841N_V9
-+ bool "TP-LINK TL-WR841N/ND v9 support"
-+ select SOC_QCA953X
-+ select ATH79_DEV_ETH
-+ select ATH79_DEV_GPIO_BUTTONS
-+ select ATH79_DEV_LEDS_GPIO
-+ select ATH79_DEV_M25P80
-+ select ATH79_DEV_WMAC
++ bool "TP-LINK TL-WR841N/ND v9/TL-WR842N/ND v3 support"
++ select SOC_QCA953X
++ 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_TL_WR941ND
+ bool "TP-LINK TL-WR941ND support"
@@ -1365,7 +1367,7 @@
config ATH79_MACH_UBNT_XM
bool "Ubiquiti Networks XM/UniFi boards"
-@@ -83,6 +1144,117 @@ config ATH79_MACH_UBNT_XM
+@@ -83,6 +1145,117 @@ config ATH79_MACH_UBNT_XM
Say 'Y' here if you want your kernel to support the
Ubiquiti Networks XM (rev 1.0) board.
@@ -1483,7 +1485,7 @@
endmenu
config SOC_AR71XX
-@@ -124,7 +1296,10 @@ config ATH79_DEV_DSA
+@@ -124,7 +1297,10 @@ config ATH79_DEV_DSA
config ATH79_DEV_ETH
def_bool n
@@ -1495,7 +1497,7 @@
def_bool n
config ATH79_DEV_GPIO_BUTTONS
-@@ -154,6 +1329,11 @@ config ATH79_PCI_ATH9K_FIXUP
+@@ -154,6 +1330,11 @@ config ATH79_PCI_ATH9K_FIXUP
def_bool n
config ATH79_ROUTERBOOT

View File

@ -1,18 +0,0 @@
From: Florian Klink <flokli@flokli.de>
Date: Mon, 18 Jul 2016 13:53:25 +0200
Subject: x86/generic: enable CONFIG_SATA_VIA
This enables support for VIA SATA.
diff --git a/target/linux/x86/generic/config-default b/target/linux/x86/generic/config-default
index 9e963bf725b222dc94792dc8760f6f747cfffb78..4fc513154bd566319d77e6e42622ef362baeb094 100644
--- a/target/linux/x86/generic/config-default
+++ b/target/linux/x86/generic/config-default
@@ -174,6 +174,7 @@ CONFIG_PNP_DEBUG_MESSAGES=y
CONFIG_RAS=y
# CONFIG_SAMSUNG_Q10 is not set
CONFIG_SATA_AHCI=y
+CONFIG_SATA_VIA=y
# CONFIG_SCx200_ACB is not set
# CONFIG_SERIAL_8250_FINTEK is not set
CONFIG_SERIAL_8250_PNP=y

View File

@ -1,45 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Thu, 21 Jul 2016 17:45:26 +0200
Subject: libpcap: fix dependency of install-shared-so make target
There seems to be a situation in which a rebuild of libpcap.so is triggered
in the install step of the libpcap Makefile. libpcap.so is the wrong
target, leading to the build failure reported in [1].
Fix the dependency of install-shared-so to $(SHAREDLIB) so the build can
succeed in this case.
[1] https://dev.openwrt.org/ticket/19894
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Backport of LEDE b82c8ddf8c15e91d6eecfd6d237606a4ce1f756f
diff --git a/package/libs/libpcap/patches/100-debian_shared_lib.patch b/package/libs/libpcap/patches/100-debian_shared_lib.patch
index b294e51576f9b9f363fa0143bd0945f03f9d13cd..f8df7f3636cb62845930843a4b208fe4e91a54f2 100644
--- a/package/libs/libpcap/patches/100-debian_shared_lib.patch
+++ b/package/libs/libpcap/patches/100-debian_shared_lib.patch
@@ -97,7 +97,7 @@ build a shared library.
+grammar_pic.o: grammar.c
+ @rm -f $@
-+ $(CC) -fPIC $(FULL_CFLAGS) -Dyylval=pcap_lval -o $@ -c grammar.c
++ $(CC) -fPIC $(FULL_CFLAGS) -Dyylval=pcap_lval -o $@ -c grammar.c
+
version.o: version.c
$(CC) $(FULL_CFLAGS) -c version.c
@@ -118,8 +118,12 @@ build a shared library.
#
# Generate the pcap-config script.
#
-@@ -618,11 +652,9 @@ install-shared: install-shared-$(DYEXT)
- install-shared-so: libpcap.so
+@@ -615,14 +649,12 @@ install: install-shared install-archive
+ $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@/`echo $$i | sed 's/.manmisc.in/.@MAN_MISC_INFO@/'`; done
+
+ install-shared: install-shared-$(DYEXT)
+-install-shared-so: libpcap.so
++install-shared-so: $(SHAREDLIB)
[ -d $(DESTDIR)$(libdir) ] || \
(mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
- VER=`cat $(srcdir)/VERSION`; \

View File

@ -1,38 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Thu, 28 Jul 2016 15:43:25 +0200
Subject: ar71xx: add revision detection for D-Link DIR-505 A1/A2
The A1 image also works on the A2, correctly set AR71XX_MODEL in this case.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Backport of LEDE 500a67a167a256002f8ab05171f49dfb86b03260
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index fcd0bc35227de9b6a02c10c1bebf2413bdc555bf..20250e96fdcc1783f9b6818c340425206c67016f 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -107,6 +107,15 @@ cybertan_get_hw_magic() {
dd bs=8 count=1 skip=0 if=$part 2>/dev/null | hexdump -v -n 8 -e '1/1 "%02x"'
}
+dir505_board_detect() {
+ local dev=$(find_mtd_part 'mac')
+ [ -z "$dev" ] && return
+
+ # The revision is stored at the beginning of the "mac" partition
+ local rev="$(LC_CTYPE=C awk -v 'FS=[^[:print:]]' '{print $1; exit}' $dev)"
+ AR71XX_MODEL="D-Link DIR-505 rev. $rev"
+}
+
tplink_get_hwid() {
local part
@@ -453,6 +462,7 @@ ar71xx_board_detect() {
;;
*"DIR-505 rev. A1")
name="dir-505-a1"
+ dir505_board_detect
;;
*"DIR-600 rev. A1")
name="dir-600-a1"

View File

@ -1,28 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Thu, 28 Jul 2016 15:59:04 +0200
Subject: ar71xx: don't use D-Link DIR-505 status LED as ethernet indicator
The stock firmware uses the single LED as status indicator only. Using the
same LED both for status and as ethernet indicator is uncommon, and has
been confusing users who were using the device as a WLAN mesh node (so the
LED was just off, as no ethernet was connected).
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Backport of LEDE adbbfb7ff900c489e6be34b2ec2834172dff7943
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
index 14aa7bc5e56c0d7be435ba3a1803416075eccb58..3d240fb076bf40b07e7f0b5974d7b5fd4435a044 100644
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
@@ -139,10 +139,6 @@ dhp-1565-a1)
ucidef_set_led_switch "wan" "WAN" "d-link:green:planet" "switch0" "0x20"
;;
-dir-505-a1)
- ucidef_set_led_netdev "lan" "LAN" "d-link:green:power" "eth1"
- ;;
-
dir-600-a1|\
dir-615-e1|\
dir-615-e4)

View File

@ -1,35 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Thu, 9 Jun 2016 04:39:08 +0200
Subject: ar71xx/cpe510: enable LNA for CPE210/220/510/520
The LNA improves the rx path. Within a simple test setup
it improved the signal from -60dbm to -40dbm.
Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
Backport of LEDE 94e23bf7409d6cc4c9efb55ed32aba8e5a497966
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c
index 8bf5c0f6226cbba10da10af4798b67b76db94e2b..5cb052a84aee451b9fbd449910acfde80dcf8aa7 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c
@@ -30,6 +30,9 @@
#define CPE510_GPIO_LED_L3 15
#define CPE510_GPIO_LED_L4 16
+#define CPE510_GPIO_EXTERNAL_LNA0 18
+#define CPE510_GPIO_EXTERNAL_LNA1 19
+
#define CPE510_GPIO_BTN_RESET 4
#define CPE510_KEYS_POLL_INTERVAL 20 /* msecs */
@@ -93,6 +96,9 @@ static void __init cpe510_setup(void)
ARRAY_SIZE(cpe510_gpio_keys),
cpe510_gpio_keys);
+ ath79_wmac_set_ext_lna_gpio(0, CPE510_GPIO_EXTERNAL_LNA0);
+ ath79_wmac_set_ext_lna_gpio(1, CPE510_GPIO_EXTERNAL_LNA1);
+
ath79_register_m25p80(NULL);
ath79_register_mdio(1, 0);

View File

@ -1,169 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Thu, 9 Jun 2016 04:55:37 +0200
Subject: ar71xx/cpe510: split profile into 2 profiles cpe210 and cpe510
Split profile into 2GHz and 5GHz. The 5GHz devices are
quite "special". The 2 GHz works perfect.
Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
Backport of LEDE c5ff273d85f69981e5b126eeaed3dee5b4061fb4
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_gpio-switches b/target/linux/ar71xx/base-files/etc/uci-defaults/01_gpio-switches
index b41f27554b1e3eac19c22af59731771631a1135b..0f7a41589384755ff596d4355ad9fbf1e1087d91 100644
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_gpio-switches
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_gpio-switches
@@ -15,6 +15,7 @@ nanostation-m)
nanostation-m-xw)
ucidef_set_gpio_switch "poe_passthrough" "PoE Passthrough" "2"
;;
+cpe210|\
cpe510)
ucidef_set_gpio_switch "poe_passthrough" "PoE Passthrough" "20"
;;
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
index 3d240fb076bf40b07e7f0b5974d7b5fd4435a044..f1266d88f1b6a441e58b0a008ca915a4b5958928 100644
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
@@ -78,6 +78,7 @@ carambola2)
ucidef_set_led_wlan "wlan" "WLAN" "carambola2:green:wlan" "phy0tpt"
;;
+cpe210|\
cpe510)
ucidef_set_led_switch "lan0" "LAN0" "tp-link:green:lan0" "switch0" "0x20"
ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x10"
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
index ca9c5771d72681557f4139c0e58f4d7a656bd741..6c3ecf54dccd111231d93e539346f7839252794c 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -72,6 +72,7 @@ bsb)
ucidef_set_interface_wlan
;;
+cpe210|\
cpe510)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1"
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 20250e96fdcc1783f9b6818c340425206c67016f..0d8ccd21c3f552b7ae7aff6905a08ff6a4fdadf7 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -447,7 +447,11 @@ ar71xx_board_detect() {
*CAP4200AG)
name="cap4200ag"
;;
- *"CPE210/220/510/520")
+ *"CPE210/220")
+ name="cpe210"
+ tplink_pharos_board_detect
+ ;;
+ *"CPE510/520")
name="cpe510"
tplink_pharos_board_detect
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 53284df5e2da19d8012361e9560244af898d3c2c..4003b21df26917a521ed96db82a970a82cdbc2cb 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -265,6 +265,7 @@ platform_check_image() {
return 0
;;
+ cpe210|\
cpe510)
tplink_pharos_check_image "$1" && return 0
return 1
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c
index 5cb052a84aee451b9fbd449910acfde80dcf8aa7..74daf434e611d1f9d05f7d7516ae918d334b32b7 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c
@@ -78,12 +78,8 @@ static struct gpio_keys_button cpe510_gpio_keys[] __initdata = {
}
};
-
-static void __init cpe510_setup(void)
+static void __init cpe_setup(u8 *mac)
{
- u8 *mac = (u8 *) KSEG1ADDR(0x1f830008);
- u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
-
/* Disable JTAG, enabling GPIOs 0-3 */
/* Configure OBS4 line, for GPIO 4*/
ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE,
@@ -105,9 +101,31 @@ static void __init cpe510_setup(void)
ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
ath79_register_eth(1);
+}
+
+
+static void __init cpe210_setup(void)
+{
+ u8 *mac = (u8 *) KSEG1ADDR(0x1f830008);
+ u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
+
+ cpe_setup(mac);
ath79_register_wmac(ee, mac);
}
-MIPS_MACHINE(ATH79_MACH_CPE510, "CPE510", "TP-LINK CPE210/220/510/520",
+static void __init cpe510_setup(void)
+{
+ u8 *mac = (u8 *) KSEG1ADDR(0x1f830008);
+ u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
+
+ cpe_setup(mac);
+
+ ath79_register_wmac(ee, mac);
+}
+
+MIPS_MACHINE(ATH79_MACH_CPE210, "CPE210", "TP-LINK CPE210/220",
+ cpe210_setup);
+
+MIPS_MACHINE(ATH79_MACH_CPE510, "CPE510", "TP-LINK CPE510/520",
cpe510_setup);
diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
index d66bd25fe01544224a69e3f35f020f2e4130c8b3..75083f9b698ba8a438256209a34369eb626a3b3d 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -2111,7 +2111,8 @@ $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR1043V2,tl-wr1043nd-v2,TL-WR10
$(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR1043V3,tl-wr1043nd-v3,TL-WR1043ND-v2,ttyS0,115200,0x10430003,1,8M))
$(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR2543,tl-wr2543-v1,TL-WR2543N,ttyS0,115200,0x25430001,1,8Mlzma,-v 3.13.99))
-$(eval $(call SingleProfile,TPLINK-SAFELOADER,64kraw,CPE510,cpe210-220-510-520,CPE510,ttyS0,115200,$$(cpe510_mtdlayout),CPE510))
+$(eval $(call SingleProfile,TPLINK-SAFELOADER,64kraw,CPE210_220,cpe210-220,CPE210,ttyS0,115200,$$(cpe510_mtdlayout),CPE510))
+$(eval $(call SingleProfile,TPLINK-SAFELOADER,64kraw,CPE510_520,cpe510-520,CPE510,ttyS0,115200,$$(cpe510_mtdlayout),CPE510))
$(eval $(call SingleProfile,UAPPRO,64k,UAPPRO,ubnt-uap-pro,UAP-PRO,ttyS0,115200,BZ,BZ,ar934x))
$(eval $(call SingleProfile,UAPPRO,64k,UBNTUNIFIOUTDOORPLUS,ubnt-unifi-outdoor-plus,UBNT-UOP,ttyS0,115200,BZ,BZ,ar7240))
@@ -2175,6 +2176,7 @@ $(eval $(call MultiProfile,TLWR842,TLWR842V1))
$(eval $(call MultiProfile,TLWR941,TLWR941NV2 TLWR941NV3 TLWR941NV4))
$(eval $(call MultiProfile,TLWR1043,TLWR1043V1 TLWR1043V2 TLWR1043V3))
$(eval $(call MultiProfile,TLWDR4300,TLWDR3500V1 TLWDR3600V1 TLWDR4300V1 TLWDR4300V1IL TLWDR4310V1 MW4530RV1))
+$(eval $(call MultiProfile,CPE510,CPE210_220 CPE510_520))
$(eval $(call MultiProfile,TUBE2H,TUBE2H8M TUBE2H16M))
$(eval $(call MultiProfile,UBNT,UBNTAIRROUTER UBNTRS UBNTRSPRO UBNTLSSR71 UBNTBULLETM UBNTROCKETM UBNTROCKETMXW UBNTNANOM UBNTNANOMXW UBNTLOCOXW UBNTUNIFI UBNTUNIFIOUTDOOR UBNTUNIFIOUTDOORPLUS UAPPRO UBNTAIRGW))
$(eval $(call MultiProfile,WNR612V2,REALWNR612V2 N150R))
diff --git a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
index d4b417bfb78606ddb84076ad8c927952e65118c2..c83ac2e89324deda3135aab84e8c4f4112ea728d 100644
--- a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
+++ b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
@@ -1,6 +1,6 @@
--- a/arch/mips/ath79/machtypes.h
+++ b/arch/mips/ath79/machtypes.h
-@@ -16,22 +16,203 @@
+@@ -16,22 +16,204 @@
enum ath79_mach_type {
ATH79_MACH_GENERIC = 0,
@@ -26,6 +26,7 @@
+ ATH79_MACH_BHU_BXU2000N2_A1, /* BHU BXU2000n-2 A1 */
+ ATH79_MACH_CAP4200AG, /* Senao CAP4200AG */
+ ATH79_MACH_CARAMBOLA2, /* 8devices Carambola2 */
++ ATH79_MACH_CPE210, /* TP-LINK CPE210 */
+ ATH79_MACH_CPE510, /* TP-LINK CPE510 */
ATH79_MACH_DB120, /* Atheros DB120 reference board */
ATH79_MACH_PB44, /* Atheros PB44 reference board */

View File

@ -1,555 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Wed, 21 Dec 2016 19:22:56 +0100
Subject: firmware-utils: backport tplink-safeloader from LEDE 05abcf518d5e2b7d6526fd7a87a88a268030694a
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 77a894b237281f6211dd1123ead4b5b0f2f58370..016c118787f3b5332b76f65c85930065a569d6b8 100644
--- a/tools/firmware-utils/src/tplink-safeloader.c
+++ b/tools/firmware-utils/src/tplink-safeloader.c
@@ -53,6 +53,8 @@
#define ALIGN(x,a) ({ typeof(a) __a = (a); (((x) + __a - 1) & ~(__a - 1)); })
+#define MAX_PARTITIONS 32
+
/** An image partition table entry */
struct image_partition_entry {
const char *name;
@@ -67,6 +69,16 @@ struct flash_partition_entry {
uint32_t size;
};
+/** Firmware layout description */
+struct device_info {
+ const char *id;
+ const char *vendor;
+ const char *support_list;
+ char support_trail;
+ const struct flash_partition_entry partitions[MAX_PARTITIONS+1];
+ const char *first_sysupgrade_partition;
+ const char *last_sysupgrade_partition;
+};
/** The content of the soft-version structure */
struct __attribute__((__packed__)) soft_version {
@@ -102,45 +114,225 @@ static const uint8_t md5_salt[16] = {
};
-/** Vendor information for CPE210/220/510/520 */
-static const char cpe510_vendor[] = "CPE510(TP-LINK|UN|N300-5):1.0\r\n";
-
-
-/**
- The flash partition table for CPE210/220/510/520;
- it is the same as the one used by the stock images.
-*/
-static const struct flash_partition_entry cpe510_partitions[] = {
- {"fs-uboot", 0x00000, 0x20000},
- {"partition-table", 0x20000, 0x02000},
- {"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},
- {"user-config", 0x7c0000, 0x10000},
- {"default-config", 0x7d0000, 0x10000},
- {"log", 0x7e0000, 0x10000},
- {"radio", 0x7f0000, 0x10000},
- {NULL, 0, 0}
+/** Firmware layout table */
+static struct device_info boards[] = {
+ /** Firmware layout for the CPE210/220 */
+ {
+ .id = "CPE210",
+ .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
+ .support_list =
+ "SupportList:\r\n"
+ "CPE210(TP-LINK|UN|N300-2):1.0\r\n"
+ "CPE210(TP-LINK|UN|N300-2):1.1\r\n"
+ "CPE210(TP-LINK|US|N300-2):1.1\r\n"
+ "CPE210(TP-LINK|EU|N300-2):1.1\r\n"
+ "CPE220(TP-LINK|UN|N300-2):1.1\r\n"
+ "CPE220(TP-LINK|US|N300-2):1.1\r\n"
+ "CPE220(TP-LINK|EU|N300-2):1.1\r\n",
+ .support_trail = '\xff',
+
+ .partitions = {
+ {"fs-uboot", 0x00000, 0x20000},
+ {"partition-table", 0x20000, 0x02000},
+ {"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},
+ {"user-config", 0x7c0000, 0x10000},
+ {"default-config", 0x7d0000, 0x10000},
+ {"log", 0x7e0000, 0x10000},
+ {"radio", 0x7f0000, 0x10000},
+ {NULL, 0, 0}
+ },
+
+ .first_sysupgrade_partition = "os-image",
+ .last_sysupgrade_partition = "file-system",
+ },
+
+ /** Firmware layout for the CPE510/520 */
+ {
+ .id = "CPE510",
+ .vendor = "CPE510(TP-LINK|UN|N300-5):1.0\r\n",
+ .support_list =
+ "SupportList:\r\n"
+ "CPE510(TP-LINK|UN|N300-5):1.0\r\n"
+ "CPE510(TP-LINK|UN|N300-5):1.1\r\n"
+ "CPE510(TP-LINK|UN|N300-5):1.1\r\n"
+ "CPE510(TP-LINK|US|N300-5):1.1\r\n"
+ "CPE510(TP-LINK|EU|N300-5):1.1\r\n"
+ "CPE520(TP-LINK|UN|N300-5):1.1\r\n"
+ "CPE520(TP-LINK|US|N300-5):1.1\r\n"
+ "CPE520(TP-LINK|EU|N300-5):1.1\r\n",
+ .support_trail = '\xff',
+
+ .partitions = {
+ {"fs-uboot", 0x00000, 0x20000},
+ {"partition-table", 0x20000, 0x02000},
+ {"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},
+ {"user-config", 0x7c0000, 0x10000},
+ {"default-config", 0x7d0000, 0x10000},
+ {"log", 0x7e0000, 0x10000},
+ {"radio", 0x7f0000, 0x10000},
+ {NULL, 0, 0}
+ },
+
+ .first_sysupgrade_partition = "os-image",
+ .last_sysupgrade_partition = "file-system",
+ },
+
+ /** Firmware layout for the C2600 */
+ {
+ .id = "C2600",
+ .vendor = "",
+ .support_list =
+ "SupportList:\r\n"
+ "{product_name:Archer C2600,product_ver:1.0.0,special_id:00000000}\r\n",
+ .support_trail = '\x00',
+
+ .partitions = {
+ {"SBL1", 0x00000, 0x20000},
+ {"MIBIB", 0x20000, 0x20000},
+ {"SBL2", 0x40000, 0x20000},
+ {"SBL3", 0x60000, 0x30000},
+ {"DDRCONFIG", 0x90000, 0x10000},
+ {"SSD", 0xa0000, 0x10000},
+ {"TZ", 0xb0000, 0x30000},
+ {"RPM", 0xe0000, 0x20000},
+ {"fs-uboot", 0x100000, 0x70000},
+ {"uboot-env", 0x170000, 0x40000},
+ {"radio", 0x1b0000, 0x40000},
+ {"os-image", 0x1f0000, 0x200000},
+ {"file-system", 0x3f0000, 0x1b00000},
+ {"default-mac", 0x1ef0000, 0x00200},
+ {"pin", 0x1ef0200, 0x00200},
+ {"product-info", 0x1ef0400, 0x0fc00},
+ {"partition-table", 0x1f00000, 0x10000},
+ {"soft-version", 0x1f10000, 0x10000},
+ {"support-list", 0x1f20000, 0x10000},
+ {"profile", 0x1f30000, 0x10000},
+ {"default-config", 0x1f40000, 0x10000},
+ {"user-config", 0x1f50000, 0x40000},
+ {"qos-db", 0x1f90000, 0x40000},
+ {"usb-config", 0x1fd0000, 0x10000},
+ {"log", 0x1fe0000, 0x20000},
+ {NULL, 0, 0}
+ },
+
+ .first_sysupgrade_partition = "os-image",
+ .last_sysupgrade_partition = "file-system"
+ },
+
+ /** Firmware layout for the C9 */
+ {
+ .id = "ARCHERC9",
+ .vendor = "",
+ .support_list =
+ "SupportList:\n"
+ "{product_name:ArcherC9,"
+ "product_ver:1.0.0,"
+ "special_id:00000000}\n",
+ .support_trail = '\x00',
+
+ .partitions = {
+ {"fs-uboot", 0x00000, 0x40000},
+ {"os-image", 0x40000, 0x200000},
+ {"file-system", 0x240000, 0xc00000},
+ {"default-mac", 0xe40000, 0x00200},
+ {"pin", 0xe40200, 0x00200},
+ {"product-info", 0xe40400, 0x00200},
+ {"partition-table", 0xe50000, 0x10000},
+ {"soft-version", 0xe60000, 0x00200},
+ {"support-list", 0xe61000, 0x0f000},
+ {"profile", 0xe70000, 0x10000},
+ {"default-config", 0xe80000, 0x10000},
+ {"user-config", 0xe90000, 0x50000},
+ {"log", 0xee0000, 0x100000},
+ {"radio_bk", 0xfe0000, 0x10000},
+ {"radio", 0xff0000, 0x10000},
+ {NULL, 0, 0}
+ },
+
+ .first_sysupgrade_partition = "os-image",
+ .last_sysupgrade_partition = "file-system"
+ },
+
+ /** Firmware layout for the EAP120 */
+ {
+ .id = "EAP120",
+ .vendor = "EAP120(TP-LINK|UN|N300-2):1.0\r\n",
+ .support_list =
+ "SupportList:\r\n"
+ "EAP120(TP-LINK|UN|N300-2):1.0\r\n",
+ .support_trail = '\xff',
+
+ .partitions = {
+ {"fs-uboot", 0x00000, 0x20000},
+ {"partition-table", 0x20000, 0x02000},
+ {"default-mac", 0x30000, 0x00020},
+ {"support-list", 0x31000, 0x00100},
+ {"product-info", 0x31100, 0x00100},
+ {"soft-version", 0x32000, 0x00100},
+ {"os-image", 0x40000, 0x180000},
+ {"file-system", 0x1c0000, 0x600000},
+ {"user-config", 0x7c0000, 0x10000},
+ {"backup-config", 0x7d0000, 0x10000},
+ {"log", 0x7e0000, 0x10000},
+ {"radio", 0x7f0000, 0x10000},
+ {NULL, 0, 0}
+ },
+
+ .first_sysupgrade_partition = "os-image",
+ .last_sysupgrade_partition = "file-system"
+ },
+
+ /** Firmware layout for the TL-WR1043 v4 */
+ {
+ .id = "TLWR1043NDV4",
+ .vendor = "",
+ .support_list =
+ "SupportList:\n"
+ "{product_name:TL-WR1043ND,product_ver:4.0.0,special_id:45550000}\n",
+ .support_trail = '\x00',
+
+ /**
+ 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 = {
+ {"fs-uboot", 0x00000, 0x20000},
+ {"os-image", 0x20000, 0x180000},
+ {"file-system", 0x1a0000, 0xdb0000},
+ {"default-mac", 0xf50000, 0x00200},
+ {"pin", 0xf50200, 0x00200},
+ {"product-info", 0xf50400, 0x0fc00},
+ {"soft-version", 0xf60000, 0x0b000},
+ {"support-list", 0xf6b000, 0x04000},
+ {"profile", 0xf70000, 0x04000},
+ {"default-config", 0xf74000, 0x0b000},
+ {"user-config", 0xf80000, 0x40000},
+ {"partition-table", 0xfc0000, 0x10000},
+ {"log", 0xfd0000, 0x20000},
+ {"radio", 0xff0000, 0x10000},
+ {NULL, 0, 0}
+ },
+
+ .first_sysupgrade_partition = "os-image",
+ .last_sysupgrade_partition = "file-system"
+ },
+
+ {}
};
-/**
- The support list for CPE210/220/510/520
-*/
-static const char cpe510_support_list[] =
- "SupportList:\r\n"
- "CPE510(TP-LINK|UN|N300-5):1.0\r\n"
- "CPE510(TP-LINK|UN|N300-5):1.1\r\n"
- "CPE520(TP-LINK|UN|N300-5):1.0\r\n"
- "CPE520(TP-LINK|UN|N300-5):1.1\r\n"
- "CPE210(TP-LINK|UN|N300-2):1.0\r\n"
- "CPE210(TP-LINK|UN|N300-2):1.1\r\n"
- "CPE220(TP-LINK|UN|N300-2):1.0\r\n"
- "CPE220(TP-LINK|UN|N300-2):1.1\r\n";
-
#define error(_ret, _errno, _str, ...) \
do { \
fprintf(stderr, _str ": %s\n", ## __VA_ARGS__, \
@@ -240,14 +432,14 @@ static struct image_partition_entry make_soft_version(uint32_t rev) {
}
/** Generates the support-list partition */
-static struct image_partition_entry make_support_list(const char *support_list) {
- size_t len = strlen(support_list);
+static struct image_partition_entry make_support_list(const struct device_info *info) {
+ size_t len = strlen(info->support_list);
struct image_partition_entry entry = alloc_image_partition("support-list", len + 9);
put32(entry.data, len);
memset(entry.data+4, 0, 4);
- memcpy(entry.data+8, support_list, len);
- entry.data[len+8] = '\xff';
+ memcpy(entry.data+8, info->support_list, len);
+ entry.data[len+8] = info->support_trail;
return entry;
}
@@ -313,12 +505,22 @@ static struct image_partition_entry read_file(const char *part_name, const char
I think partition-table must be the first partition in the firmware image.
*/
-static void put_partitions(uint8_t *buffer, const struct image_partition_entry *parts) {
- size_t i;
+static void put_partitions(uint8_t *buffer, const struct flash_partition_entry *flash_parts, const struct image_partition_entry *parts) {
+ size_t i, j;
char *image_pt = (char *)buffer, *end = image_pt + 0x800;
size_t base = 0x800;
for (i = 0; parts[i].name; i++) {
+ for (j = 0; flash_parts[j].name; j++) {
+ if (!strcmp(flash_parts[j].name, parts[i].name)) {
+ if (parts[i].size > flash_parts[j].size)
+ error(1, 0, "%s partition too big (more than %u bytes)", flash_parts[j].name, (unsigned)flash_parts[j].size);
+ break;
+ }
+ }
+
+ assert(flash_parts[j].name);
+
memcpy(buffer + base, parts[i].data, parts[i].size);
size_t len = end-image_pt;
@@ -331,10 +533,6 @@ static void put_partitions(uint8_t *buffer, const struct image_partition_entry *
base += parts[i].size;
}
-
- image_pt++;
-
- memset(image_pt, 0xff, end-image_pt);
}
/** Generates and writes the image MD5 checksum */
@@ -363,7 +561,7 @@ static void put_md5(uint8_t *md5, uint8_t *buffer, unsigned int len) {
1014-1813 Image partition table (2048 bytes, padded with 0xff)
1814-xxxx Firmware partitions
*/
-static void * generate_factory_image(const char *vendor, const struct image_partition_entry *parts, size_t *len) {
+static void * generate_factory_image(const struct device_info *info, const struct image_partition_entry *parts, size_t *len) {
*len = 0x1814;
size_t i;
@@ -374,14 +572,16 @@ static void * generate_factory_image(const char *vendor, const struct image_part
if (!image)
error(1, errno, "malloc");
+ memset(image, 0xff, *len);
put32(image, *len);
- size_t vendor_len = strlen(vendor);
- put32(image+0x14, vendor_len);
- memcpy(image+0x18, vendor, vendor_len);
- memset(image+0x18+vendor_len, 0xff, 4092-vendor_len);
+ if (info->vendor) {
+ size_t vendor_len = strlen(info->vendor);
+ put32(image+0x14, vendor_len);
+ memcpy(image+0x18, info->vendor, vendor_len);
+ }
- put_partitions(image + 0x1014, parts);
+ put_partitions(image + 0x1014, info->partitions, parts);
put_md5(image+0x04, image+0x14, *len-0x14);
return image;
@@ -394,33 +594,39 @@ static void * generate_factory_image(const char *vendor, const struct image_part
should be generalized when TP-LINK starts building its safeloader into hardware with
different flash layouts.
*/
-static void * generate_sysupgrade_image(const struct flash_partition_entry *flash_parts, const struct image_partition_entry *image_parts, size_t *len) {
- const struct flash_partition_entry *flash_os_image = &flash_parts[5];
- const struct flash_partition_entry *flash_soft_version = &flash_parts[6];
- const struct flash_partition_entry *flash_support_list = &flash_parts[7];
- const struct flash_partition_entry *flash_file_system = &flash_parts[8];
-
- const struct image_partition_entry *image_os_image = &image_parts[3];
- const struct image_partition_entry *image_soft_version = &image_parts[1];
- const struct image_partition_entry *image_support_list = &image_parts[2];
- const struct image_partition_entry *image_file_system = &image_parts[4];
-
- assert(strcmp(flash_os_image->name, "os-image") == 0);
- assert(strcmp(flash_soft_version->name, "soft-version") == 0);
- assert(strcmp(flash_support_list->name, "support-list") == 0);
- assert(strcmp(flash_file_system->name, "file-system") == 0);
-
- assert(strcmp(image_os_image->name, "os-image") == 0);
- assert(strcmp(image_soft_version->name, "soft-version") == 0);
- assert(strcmp(image_support_list->name, "support-list") == 0);
- assert(strcmp(image_file_system->name, "file-system") == 0);
-
- if (image_os_image->size > flash_os_image->size)
- error(1, 0, "kernel image too big (more than %u bytes)", (unsigned)flash_os_image->size);
- if (image_file_system->size > flash_file_system->size)
- error(1, 0, "rootfs image too big (more than %u bytes)", (unsigned)flash_file_system->size);
-
- *len = flash_file_system->base - flash_os_image->base + image_file_system->size;
+static void * generate_sysupgrade_image(const struct device_info *info, const struct image_partition_entry *image_parts, size_t *len) {
+ size_t i, j;
+ size_t flash_first_partition_index = 0;
+ size_t flash_last_partition_index = 0;
+ const struct flash_partition_entry *flash_first_partition = NULL;
+ const struct flash_partition_entry *flash_last_partition = NULL;
+ const struct image_partition_entry *image_last_partition = NULL;
+
+ /** Find first and last partitions */
+ for (i = 0; info->partitions[i].name; i++) {
+ if (!strcmp(info->partitions[i].name, info->first_sysupgrade_partition)) {
+ flash_first_partition = &info->partitions[i];
+ flash_first_partition_index = i;
+ } else if (!strcmp(info->partitions[i].name, info->last_sysupgrade_partition)) {
+ flash_last_partition = &info->partitions[i];
+ flash_last_partition_index = i;
+ }
+ }
+
+ assert(flash_first_partition && flash_last_partition);
+ assert(flash_first_partition_index < flash_last_partition_index);
+
+ /** Find last partition from image to calculate needed size */
+ for (i = 0; image_parts[i].name; i++) {
+ if (!strcmp(image_parts[i].name, info->last_sysupgrade_partition)) {
+ image_last_partition = &image_parts[i];
+ break;
+ }
+ }
+
+ assert(image_last_partition);
+
+ *len = flash_last_partition->base - flash_first_partition->base + image_last_partition->size;
uint8_t *image = malloc(*len);
if (!image)
@@ -428,31 +634,44 @@ static void * generate_sysupgrade_image(const struct flash_partition_entry *flas
memset(image, 0xff, *len);
- memcpy(image, image_os_image->data, image_os_image->size);
- memcpy(image + flash_soft_version->base - flash_os_image->base, image_soft_version->data, image_soft_version->size);
- memcpy(image + flash_support_list->base - flash_os_image->base, image_support_list->data, image_support_list->size);
- memcpy(image + flash_file_system->base - flash_os_image->base, image_file_system->data, image_file_system->size);
+ for (i = flash_first_partition_index; i <= flash_last_partition_index; i++) {
+ for (j = 0; image_parts[j].name; j++) {
+ if (!strcmp(info->partitions[i].name, image_parts[j].name)) {
+ if (image_parts[j].size > info->partitions[i].size)
+ error(1, 0, "%s partition too big (more than %u bytes)", info->partitions[i].name, (unsigned)info->partitions[i].size);
+ memcpy(image + info->partitions[i].base - flash_first_partition->base, image_parts[j].data, image_parts[j].size);
+ break;
+ }
+
+ assert(image_parts[j].name);
+ }
+ }
return image;
}
-
-/** Generates an image for CPE210/220/510/520 and writes it to a file */
-static void do_cpe510(const char *output, const char *kernel_image, const char *rootfs_image, uint32_t rev, bool add_jffs2_eof, bool sysupgrade) {
+/** Generates an image according to a given layout and writes it to a file */
+static void build_image(const char *output,
+ const char *kernel_image,
+ const char *rootfs_image,
+ uint32_t rev,
+ bool add_jffs2_eof,
+ bool sysupgrade,
+ const struct device_info *info) {
struct image_partition_entry parts[6] = {};
- parts[0] = make_partition_table(cpe510_partitions);
+ parts[0] = make_partition_table(info->partitions);
parts[1] = make_soft_version(rev);
- parts[2] = make_support_list(cpe510_support_list);
+ 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);
size_t len;
void *image;
if (sysupgrade)
- image = generate_sysupgrade_image(cpe510_partitions, parts, &len);
+ image = generate_sysupgrade_image(info, parts, &len);
else
- image = generate_factory_image(cpe510_vendor, parts, &len);
+ image = generate_factory_image(info, parts, &len);
FILE *file = fopen(output, "wb");
if (!file)
@@ -470,7 +689,6 @@ static void do_cpe510(const char *output, const char *kernel_image, const char *
free_image_partition(parts[i]);
}
-
/** Usage output */
static void usage(const char *argv0) {
fprintf(stderr,
@@ -490,10 +708,22 @@ static void usage(const char *argv0) {
};
+static const struct device_info *find_board(const char *id)
+{
+ struct device_info *board = NULL;
+
+ for (board = boards; board->id != NULL; board++)
+ if (strcasecmp(id, board->id) == 0)
+ return board;
+
+ return NULL;
+}
+
int main(int argc, char *argv[]) {
const char *board = NULL, *kernel_image = NULL, *rootfs_image = NULL, *output = NULL;
bool add_jffs2_eof = false, sysupgrade = false;
unsigned rev = 0;
+ const struct device_info *info;
while (true) {
int c;
@@ -550,10 +780,12 @@ int main(int argc, char *argv[]) {
if (!output)
error(1, 0, "no output filename has been specified");
- if (strcmp(board, "CPE510") == 0)
- do_cpe510(output, kernel_image, rootfs_image, rev, add_jffs2_eof, sysupgrade);
- else
+ info = find_board(board);
+
+ if (info == NULL)
error(1, 0, "unsupported board %s", board);
+ build_image(output, kernel_image, rootfs_image, rev, add_jffs2_eof, sysupgrade, info);
+
return 0;
}

View File

@ -1,26 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Thu, 9 Jun 2016 05:03:35 +0200
Subject: ar71xx: split CPE210 from CPE510 profile
The CPE210 was still described for the OEM upgrade as compatible,
even the wireless configuration isn't compatible anymore between
both series (2ghz and 5ghz).
Update the CPE210 image profile to use the new profile.
Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
Backport of LEDE 824147960569f2c1cd22140c9074c62c3df911a5
diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
index 75083f9b698ba8a438256209a34369eb626a3b3d..bb2bb94e04ee8f59db62907ace49952061b411dc 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -2111,7 +2111,7 @@ $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR1043V2,tl-wr1043nd-v2,TL-WR10
$(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR1043V3,tl-wr1043nd-v3,TL-WR1043ND-v2,ttyS0,115200,0x10430003,1,8M))
$(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR2543,tl-wr2543-v1,TL-WR2543N,ttyS0,115200,0x25430001,1,8Mlzma,-v 3.13.99))
-$(eval $(call SingleProfile,TPLINK-SAFELOADER,64kraw,CPE210_220,cpe210-220,CPE210,ttyS0,115200,$$(cpe510_mtdlayout),CPE510))
+$(eval $(call SingleProfile,TPLINK-SAFELOADER,64kraw,CPE210_220,cpe210-220,CPE210,ttyS0,115200,$$(cpe510_mtdlayout),CPE210))
$(eval $(call SingleProfile,TPLINK-SAFELOADER,64kraw,CPE510_520,cpe510-520,CPE510,ttyS0,115200,$$(cpe510_mtdlayout),CPE510))
$(eval $(call SingleProfile,UAPPRO,64k,UAPPRO,ubnt-uap-pro,UAP-PRO,ttyS0,115200,BZ,BZ,ar934x))

View File

@ -1,437 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Mon, 22 Aug 2016 19:14:52 +0200
Subject: dropbear: update to LEDE 277f85c21ae0ede4e15e66cbd801b9fb502531df
Includes a few security updates and enables Curve25519 support.
The patches 600-allow-blank-root-password.patch and
610-skip-default-keys-in-custom-runs.patch are left out for now to avoid
allowing password-less root login.
diff --git a/package/network/services/dropbear/Config.in b/package/network/services/dropbear/Config.in
index e2a761034fa64225439db4a18030dee75fb0775c..7c2edd79f23708f9ef01c6a62a54073b0c7a33ed 100644
--- a/package/network/services/dropbear/Config.in
+++ b/package/network/services/dropbear/Config.in
@@ -1,6 +1,15 @@
menu "Configuration"
depends on PACKAGE_dropbear
+config DROPBEAR_CURVE25519
+ bool "Curve25519 support"
+ default y
+ help
+ This enables the following key exchange algorithm:
+ curve25519-sha256@libssh.org
+
+ Increases binary size by about 13 kB uncompressed (MIPS).
+
config DROPBEAR_ECC
bool "Elliptic curve cryptography (ECC)"
default n
@@ -12,7 +21,6 @@ config DROPBEAR_ECC
ecdh-sha2-nistp256
ecdh-sha2-nistp384
ecdh-sha2-nistp521
- curve25519-sha256@libssh.org
Public key algorithms:
ecdsa-sha2-nistp256
@@ -22,6 +30,21 @@ config DROPBEAR_ECC
Does not generate ECC host keys by default (ECC key exchange will not be used,
only ECC public key auth).
- Increases binary size by about 36 kB (MIPS).
+ Increases binary size by about 23 kB (MIPS).
+
+config DROPBEAR_UTMP
+ bool "Utmp support"
+ default n
+ depends on BUSYBOX_CONFIG_FEATURE_UTMP
+ help
+ This enables dropbear utmp support, the file /var/run/utmp is used to
+ track who is currently logged in.
+
+config DROPBEAR_PUTUTLINE
+ bool "Pututline support"
+ default n
+ depends on DROPBEAR_UTMP
+ help
+ Dropbear will use pututline() to write the utmp structure into the utmp file.
endmenu
diff --git a/package/network/services/dropbear/Makefile b/package/network/services/dropbear/Makefile
index 35958d332cd0c9796ba50c433b13a3e24cd4441c..36bcb4ab7b6c57460cd15da1bcc130af62e32bc6 100644
--- a/package/network/services/dropbear/Makefile
+++ b/package/network/services/dropbear/Makefile
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2006-2014 OpenWrt.org
+# Copyright (C) 2006-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@@ -8,14 +8,14 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=dropbear
-PKG_VERSION:=2015.67
+PKG_VERSION:=2016.74
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:= \
http://matt.ucc.asn.au/dropbear/releases/ \
https://dropbear.nl/mirror/releases/
-PKG_MD5SUM:=e967e320344cd4bfebe321e3ab8514d6
+PKG_MD5SUM:=9ad0172731e0f16623937804643b5bd8
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE libtomcrypt/LICENSE libtommath/LICENSE
@@ -23,10 +23,14 @@ PKG_LICENSE_FILES:=LICENSE libtomcrypt/LICENSE libtommath/LICENSE
PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0
-PKG_CONFIG_DEPENDS:=CONFIG_DROPBEAR_ECC
+PKG_CONFIG_DEPENDS:=CONFIG_TARGET_INIT_PATH CONFIG_DROPBEAR_ECC CONFIG_DROPBEAR_CURVE25519
include $(INCLUDE_DIR)/package.mk
+ifneq ($(DUMP),1)
+ STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell $(SH_FUNC) echo $(CONFIG_TARGET_INIT_PATH) | md5s)
+endif
+
define Package/dropbear/Default
URL:=http://matt.ucc.asn.au/dropbear/
endef
@@ -48,7 +52,6 @@ endef
define Package/dropbear/conffiles
/etc/dropbear/dropbear_rsa_host_key
-/etc/dropbear/dropbear_dss_host_key
/etc/config/dropbear
endef
@@ -65,25 +68,35 @@ CONFIGURE_ARGS += \
--enable-syslog \
$(if $(CONFIG_SHADOW_PASSWORDS),,--disable-shadow) \
--disable-lastlog \
- --disable-utmp \
--disable-utmpx \
+ $(if $(CONFIG_DROPBEAR_UTMP),,--disable-utmp) \
--disable-wtmp \
--disable-wtmpx \
--disable-loginfunc \
- --disable-pututline \
+ $(if $(CONFIG_DROPBEAR_PUTUTLINE),,--disable-pututline) \
--disable-pututxline \
--disable-zlib \
--enable-bundled-libtom
-TARGET_CFLAGS += -DARGTYPE=3 -ffunction-sections -fdata-sections
+TARGET_CFLAGS += -DDEFAULT_PATH=\\\"$(CONFIG_TARGET_INIT_PATH)\\\" -DARGTYPE=3 -ffunction-sections -fdata-sections
TARGET_LDFLAGS += -Wl,--gc-sections
define Build/Configure
$(Build/Configure/Default)
+ $(SED) 's,^#define DEFAULT_PATH .*$$$$,#define DEFAULT_PATH "$(CONFIG_TARGET_INIT_PATH)",g' \
+ $(PKG_BUILD_DIR)/options.h
+
+ awk 'BEGIN { rc = 1 } \
+ /'DROPBEAR_CURVE25519'/ { $$$$0 = "$(if $(CONFIG_DROPBEAR_CURVE25519),,// )#define 'DROPBEAR_CURVE25519'"; rc = 0 } \
+ { print } \
+ END { exit(rc) }' $(PKG_BUILD_DIR)/options.h \
+ >$(PKG_BUILD_DIR)/options.h.new && \
+ mv $(PKG_BUILD_DIR)/options.h.new $(PKG_BUILD_DIR)/options.h
+
# Enforce that all replacements are made, otherwise options.h has changed
# format and this logic is broken.
- for OPTION in DROPBEAR_ECDSA DROPBEAR_ECDH DROPBEAR_CURVE25519; do \
+ for OPTION in DROPBEAR_ECDSA DROPBEAR_ECDH; do \
awk 'BEGIN { rc = 1 } \
/'$$$$OPTION'/ { $$$$0 = "$(if $(CONFIG_DROPBEAR_ECC),,// )#define '$$$$OPTION'"; rc = 0 } \
{ print } \
@@ -91,6 +104,9 @@ define Build/Configure
>$(PKG_BUILD_DIR)/options.h.new && \
mv $(PKG_BUILD_DIR)/options.h.new $(PKG_BUILD_DIR)/options.h || exit 1; \
done
+
+ # Enforce rebuild of svr-chansession.c
+ rm -f $(PKG_BUILD_DIR)/svr-chansession.o
endef
define Build/Compile
@@ -118,7 +134,6 @@ define Package/dropbear/install
$(INSTALL_DIR) $(1)/usr/lib/opkg/info
$(INSTALL_DIR) $(1)/etc/dropbear
touch $(1)/etc/dropbear/dropbear_rsa_host_key
- touch $(1)/etc/dropbear/dropbear_dss_host_key
endef
define Package/dropbearconvert/install
diff --git a/package/network/services/dropbear/files/dropbear.init b/package/network/services/dropbear/files/dropbear.init
index 6de0142728dfa127652ecceef1d25080069d800a..1653efbdb38b1037c3630595b903c839887a4e52 100755
--- a/package/network/services/dropbear/files/dropbear.init
+++ b/package/network/services/dropbear/files/dropbear.init
@@ -37,7 +37,6 @@ validate_section_dropbear()
'RootPasswordAuth:bool:1' \
'RootLogin:bool:1' \
'rsakeyfile:file' \
- 'dsskeyfile:file' \
'BannerFile:file' \
'Port:list(port):22' \
'SSHKeepAlive:uinteger:300' \
@@ -49,7 +48,7 @@ dropbear_instance()
{
local PasswordAuth enable Interface GatewayPorts \
RootPasswordAuth RootLogin rsakeyfile \
- dsskeyfile BannerFile Port SSHKeepAlive IdleTimeout \
+ BannerFile Port SSHKeepAlive IdleTimeout \
mdns ipaddrs
validate_section_dropbear "${1}" || {
@@ -75,18 +74,18 @@ dropbear_instance()
[ "${RootPasswordAuth}" -eq 0 ] && procd_append_param command -g
[ "${RootLogin}" -eq 0 ] && procd_append_param command -w
[ -n "${rsakeyfile}" ] && procd_append_param command -r "${rsakeyfile}"
- [ -n "${dsskeyfile}" ] && procd_append_param command -d "${dsskeyfile}"
[ -n "${BannerFile}" ] && procd_append_param command -b "${BannerFile}"
append_ports "${ipaddrs}" "${Port}"
[ "${IdleTimeout}" -ne 0 ] && procd_append_param command -I "${IdleTimeout}"
[ "${SSHKeepAlive}" -ne 0 ] && procd_append_param command -K "${SSHKeepAlive}"
[ "${mdns}" -ne 0 ] && procd_add_mdns "ssh" "tcp" "$Port" "daemon=dropbear"
+ procd_set_param respawn
procd_close_instance
}
keygen()
{
- for keytype in rsa dss; do
+ for keytype in rsa; do
# check for keys
key=dropbear/dropbear_${keytype}_host_key
[ -f /tmp/$key -o -s /etc/$key ] || {
@@ -107,10 +106,15 @@ keygen()
chmod 0700 /etc/dropbear
}
+load_interfaces()
+{
+ config_get interface "$1" Interface
+ interfaces=" ${interface} ${interfaces}"
+}
+
start_service()
{
- [ -s /etc/dropbear/dropbear_rsa_host_key -a \
- -s /etc/dropbear/dropbear_dss_host_key ] || keygen
+ [ -s /etc/dropbear/dropbear_rsa_host_key ] || keygen
. /lib/functions.sh
. /lib/functions/network.sh
@@ -121,7 +125,19 @@ start_service()
service_triggers()
{
- procd_add_reload_trigger "dropbear"
+ local interfaces
+
+ procd_add_config_trigger "config.change" "dropbear" /etc/init.d/dropbear reload
+
+ config_load "${NAME}"
+ config_foreach load_interfaces dropbear
+
+ [ -n "${interfaces}" ] & {
+ for n in $interfaces ; do
+ procd_add_interface_trigger "interface.*" $n /etc/init.d/dropbear reload
+ done
+ }
+
procd_add_validation validate_section_dropbear
}
diff --git a/package/network/services/dropbear/patches/100-pubkey_path.patch b/package/network/services/dropbear/patches/100-pubkey_path.patch
index 456874b730272f157bd3f4b2e9f65e14eda49b0b..41fdc1adab96cf9efffa8593000336c504fdf6fb 100644
--- a/package/network/services/dropbear/patches/100-pubkey_path.patch
+++ b/package/network/services/dropbear/patches/100-pubkey_path.patch
@@ -1,6 +1,6 @@
--- a/svr-authpubkey.c
+++ b/svr-authpubkey.c
-@@ -208,17 +208,21 @@ static int checkpubkey(unsigned char* al
+@@ -218,17 +218,21 @@ static int checkpubkey(char* algo, unsig
goto out;
}
@@ -33,7 +33,7 @@
if (authfile == NULL) {
goto out;
}
-@@ -371,26 +375,35 @@ static int checkpubkeyperms() {
+@@ -381,26 +385,35 @@ static int checkpubkeyperms() {
goto out;
}
diff --git a/package/network/services/dropbear/patches/110-change_user.patch b/package/network/services/dropbear/patches/110-change_user.patch
index 7982af631539e351d3d46f50541115f9311612db..4b5c1cb51bb16a7229c03b6298796769e5752f6b 100644
--- a/package/network/services/dropbear/patches/110-change_user.patch
+++ b/package/network/services/dropbear/patches/110-change_user.patch
@@ -1,6 +1,6 @@
--- a/svr-chansession.c
+++ b/svr-chansession.c
-@@ -920,12 +920,12 @@ static void execchild(void *user_data) {
+@@ -922,12 +922,12 @@ static void execchild(void *user_data) {
/* We can only change uid/gid as root ... */
if (getuid() == 0) {
diff --git a/package/network/services/dropbear/patches/120-openwrt_options.patch b/package/network/services/dropbear/patches/120-openwrt_options.patch
index 48dae73b1f7bcb052172f0a8d22d06203c80f993..f16aaf001eee11811be81fa1db399cf117e66595 100644
--- a/package/network/services/dropbear/patches/120-openwrt_options.patch
+++ b/package/network/services/dropbear/patches/120-openwrt_options.patch
@@ -18,7 +18,28 @@
/* Whether to support "-c" and "-m" flags to choose ciphers/MACs at runtime */
#define ENABLE_USER_ALGO_LIST
-@@ -126,9 +126,9 @@ much traffic. */
+@@ -91,16 +91,16 @@ much traffic. */
+ * Including multiple keysize variants the same cipher
+ * (eg AES256 as well as AES128) will result in a minimal size increase.*/
+ #define DROPBEAR_AES128
+-#define DROPBEAR_3DES
++/*#define DROPBEAR_3DES*/
+ #define DROPBEAR_AES256
+ /* Compiling in Blowfish will add ~6kB to runtime heap memory usage */
+ /*#define DROPBEAR_BLOWFISH*/
+-#define DROPBEAR_TWOFISH256
+-#define DROPBEAR_TWOFISH128
++/*#define DROPBEAR_TWOFISH256*/
++/*#define DROPBEAR_TWOFISH128*/
+
+ /* Enable CBC mode for ciphers. This has security issues though
+ * is the most compatible with older SSH implementations */
+-#define DROPBEAR_ENABLE_CBC_MODE
++/*#define DROPBEAR_ENABLE_CBC_MODE*/
+
+ /* Enable "Counter Mode" for ciphers. This is more secure than normal
+ * CBC mode against certain attacks. It is recommended for security
+@@ -131,9 +131,9 @@ If you test it please contact the Dropbe
* If you disable MD5, Dropbear will fall back to SHA1 fingerprints,
* which are not the standard form. */
#define DROPBEAR_SHA1_HMAC
@@ -31,7 +52,16 @@
#define DROPBEAR_MD5_HMAC
/* You can also disable integrity. Don't bother disabling this if you're
-@@ -184,7 +184,7 @@ much traffic. */
+@@ -146,7 +146,7 @@ If you test it please contact the Dropbe
+ * Removing either of these won't save very much space.
+ * SSH2 RFC Draft requires dss, recommends rsa */
+ #define DROPBEAR_RSA
+-#define DROPBEAR_DSS
++/*#define DROPBEAR_DSS*/
+ /* ECDSA is significantly faster than RSA or DSS. Compiling in ECC
+ * code (either ECDSA or ECDH) increases binary size - around 30kB
+ * on x86-64 */
+@@ -194,7 +194,7 @@ If you test it please contact the Dropbe
/* Whether to print the message of the day (MOTD). This doesn't add much code
* size */
@@ -40,7 +70,7 @@
/* The MOTD file path */
#ifndef MOTD_FILENAME
-@@ -226,7 +226,7 @@ much traffic. */
+@@ -242,7 +242,7 @@ Homedir is prepended unless path begins
* note that it will be provided for all "hidden" client-interactive
* style prompts - if you want something more sophisticated, use
* SSH_ASKPASS instead. Comment out this var to remove this functionality.*/
diff --git a/package/network/services/dropbear/patches/130-ssh_ignore_o_and_x_args.patch b/package/network/services/dropbear/patches/130-ssh_ignore_o_and_x_args.patch
deleted file mode 100644
index edb29093aece5423554ccd406e34b41466c25511..0000000000000000000000000000000000000000
--- a/package/network/services/dropbear/patches/130-ssh_ignore_o_and_x_args.patch
+++ /dev/null
@@ -1,21 +0,0 @@
---- a/cli-runopts.c
-+++ b/cli-runopts.c
-@@ -315,6 +315,10 @@ void cli_getopts(int argc, char ** argv)
- debug_trace = 1;
- break;
- #endif
-+ case 'o':
-+ next = &dummy;
-+ case 'x':
-+ break;
- case 'F':
- case 'e':
- #ifndef ENABLE_USER_ALGO_LIST
-@@ -332,7 +336,6 @@ void cli_getopts(int argc, char ** argv)
- print_version();
- exit(EXIT_SUCCESS);
- break;
-- case 'o':
- case 'b':
- next = &dummy;
- default:
diff --git a/package/network/services/dropbear/patches/130-ssh_ignore_x_args.patch b/package/network/services/dropbear/patches/130-ssh_ignore_x_args.patch
new file mode 100644
index 0000000000000000000000000000000000000000..ab09c2f3dc3a253fd18acae8d7d3b4b0f668e3dd
--- /dev/null
+++ b/package/network/services/dropbear/patches/130-ssh_ignore_x_args.patch
@@ -0,0 +1,11 @@
+--- a/cli-runopts.c
++++ b/cli-runopts.c
+@@ -296,6 +296,8 @@ void cli_getopts(int argc, char ** argv)
+ debug_trace = 1;
+ break;
+ #endif
++ case 'x':
++ break;
+ case 'F':
+ case 'e':
+ #ifndef ENABLE_USER_ALGO_LIST
diff --git a/package/network/services/dropbear/patches/140-disable_assert.patch b/package/network/services/dropbear/patches/140-disable_assert.patch
index 0717228ef3de0576967b3824ca9709f95a326f61..78b54acfa0f52a4abbae497ed57a04cca7368c41 100644
--- a/package/network/services/dropbear/patches/140-disable_assert.patch
+++ b/package/network/services/dropbear/patches/140-disable_assert.patch
@@ -1,6 +1,6 @@
--- a/dbutil.h
+++ b/dbutil.h
-@@ -101,7 +101,11 @@ int m_str_to_uint(const char* str, unsig
+@@ -78,7 +78,11 @@ int m_str_to_uint(const char* str, unsig
#define DEF_MP_INT(X) mp_int X = {0, 0, 0, NULL}
/* Dropbear assertion */
diff --git a/package/network/services/dropbear/patches/150-dbconvert_standalone.patch b/package/network/services/dropbear/patches/150-dbconvert_standalone.patch
index 367dc2c68122f382273464fc7bf570fde18386ab..ccc2cb792598de77b4db6aa7b7b46e8eb7bf93a5 100644
--- a/package/network/services/dropbear/patches/150-dbconvert_standalone.patch
+++ b/package/network/services/dropbear/patches/150-dbconvert_standalone.patch
@@ -1,8 +1,8 @@
--- a/options.h
+++ b/options.h
@@ -5,6 +5,11 @@
- #ifndef _OPTIONS_H_
- #define _OPTIONS_H_
+ #ifndef DROPBEAR_OPTIONS_H_
+ #define DROPBEAR_OPTIONS_H_
+#if !defined(DROPBEAR_CLIENT) && !defined(DROPBEAR_SERVER)
+#define DROPBEAR_SERVER
diff --git a/package/network/services/dropbear/patches/500-set-default-path.patch b/package/network/services/dropbear/patches/500-set-default-path.patch
index e2add9415fd4e7884a007ce7337ee8026bcc62a7..da6b9ae0ce0ae6a270f8c7bc6152cf09efbee15d 100644
--- a/package/network/services/dropbear/patches/500-set-default-path.patch
+++ b/package/network/services/dropbear/patches/500-set-default-path.patch
@@ -1,11 +1,12 @@
--- a/options.h
+++ b/options.h
-@@ -336,7 +336,7 @@ be overridden at runtime with -I. 0 disa
+@@ -352,7 +352,9 @@ be overridden at runtime with -I. 0 disa
#define DEFAULT_IDLE_TIMEOUT 0
/* The default path. This will often get replaced by the shell */
--#define DEFAULT_PATH "/usr/bin:/bin"
-+#define DEFAULT_PATH "/bin:/sbin:/usr/bin:/usr/sbin"
++#ifndef DEFAULT_PATH
+ #define DEFAULT_PATH "/usr/bin:/bin"
++#endif
/* Some other defines (that mostly should be left alone) are defined
* in sysoptions.h */

View File

@ -1,567 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Mon, 22 Aug 2016 23:55:22 +0200
Subject: ar71xx: Added support for TL-WA801NDv3
Signed-off-by: Tiziano Bacocco <tizbac2@gmail.com>
Backport of OpenWrt r48705
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
index 6c3ecf54dccd111231d93e539346f7839252794c..027a671215e5acd70cee06620c6648506ad6be47 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -377,6 +377,7 @@ wp543)
ucidef_set_interface_lan "eth0"
;;
+tl-wa801nd-v3 |\
dir-505-a1)
ucidef_set_interface_lan "eth1"
;;
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 0d8ccd21c3f552b7ae7aff6905a08ff6a4fdadf7..5928439f3ae253fc15eeb2ac30451ff467411e88 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -838,6 +838,9 @@ ar71xx_board_detect() {
*"TL-WA801ND v2")
name="tl-wa801nd-v2"
;;
+ *"TL-WA801ND v3")
+ name="tl-wa801nd-v3"
+ ;;
*TL-WA901ND)
name="tl-wa901nd"
;;
diff --git a/target/linux/ar71xx/config-3.18 b/target/linux/ar71xx/config-3.18
index d4d92738d0ab010e1d43ebed0baef34fd9bc3f9d..d7cbe2e79af31a0ff88d946323e237f3215620a0 100644
--- a/target/linux/ar71xx/config-3.18
+++ b/target/linux/ar71xx/config-3.18
@@ -120,6 +120,7 @@ CONFIG_ATH79_MACH_TL_MR3020=y
CONFIG_ATH79_MACH_TL_MR3X20=y
CONFIG_ATH79_MACH_TL_WA701ND_V2=y
CONFIG_ATH79_MACH_TL_WA7210N_V2=y
+CONFIG_ATH79_MACH_TL_WA801ND_V3=y
CONFIG_ATH79_MACH_TL_WA830RE_V2=y
CONFIG_ATH79_MACH_TL_WA901ND=y
CONFIG_ATH79_MACH_TL_WA901ND_V2=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa801nd-v3.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa801nd-v3.c
new file mode 100644
index 0000000000000000000000000000000000000000..39cdb10ee340650bc69e4f6054b06a4ae7421e57
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa801nd-v3.c
@@ -0,0 +1,136 @@
+/*
+ * TP-LINK TL-WA801ND v3 adapted from TP-LINK TL-WR841N/ND v9
+ *
+ * Copyright (C) 2014 Matthias Schiffer <mschiffer@universe-factory.net>
+ * Copyright (C) 2016 Tiziano Bacocco <tizbac2@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/platform_device.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-wmac.h"
+#include "machtypes.h"
+
+#define TL_WA801NDV3_GPIO_LED_WLAN 12
+#define TL_WA801NDV3_GPIO_LED_QSS 13
+#define TL_WA801NDV3_GPIO_LED_SECURITY_RED 11
+#define TL_WA801NDV3_GPIO_LED_SECURITY_GREEN 15
+#define TL_WA801NDV3_GPIO_LED_LAN 3
+
+#define TL_WA801NDV3_GPIO_BTN_RESET 2
+#define TL_WA801NDV3_GPIO_BTN_WIFI 1
+
+#define TL_WA801NDV3_KEYS_POLL_INTERVAL 20 /* msecs */
+#define TL_WA801NDV3_KEYS_DEBOUNCE_INTERVAL (3 * TL_WA801NDV3_KEYS_POLL_INTERVAL)
+
+static const char *tl_wa801n_v3_part_probes[] = {
+ "tp-link",
+ NULL,
+};
+
+static struct flash_platform_data tl_wa801n_v3_flash_data = {
+ .part_probes = tl_wa801n_v3_part_probes,
+};
+
+static struct gpio_led tl_wa801n_v3_leds_gpio[] __initdata = {
+ {
+ .name = "tp-link:green:qss",
+ .gpio = TL_WA801NDV3_GPIO_LED_QSS,
+ .active_low = 1,
+ }, {
+ .name = "tp-link:green:lan",
+ .gpio = TL_WA801NDV3_GPIO_LED_LAN,
+ .active_low = 1,
+ }, {
+ .name = "tp-link:green:wlan",
+ .gpio = TL_WA801NDV3_GPIO_LED_WLAN,
+ .active_low = 1,
+ }, {
+ .name = "tp-link:red:security",
+ .gpio = TL_WA801NDV3_GPIO_LED_SECURITY_RED,
+ .active_low = 0,
+ }, {
+ .name = "tp-link:green:security",
+ .gpio = TL_WA801NDV3_GPIO_LED_SECURITY_GREEN,
+ .active_low = 0,
+ }
+
+};
+
+static struct gpio_keys_button tl_wa801n_v3_gpio_keys[] __initdata = {
+ {
+ .desc = "Reset button",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = TL_WA801NDV3_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = TL_WA801NDV3_GPIO_BTN_RESET,
+ .active_low = 1,
+ }, {
+ .desc = "WIFI button",
+ .type = EV_KEY,
+ .code = KEY_RFKILL,
+ .debounce_interval = TL_WA801NDV3_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = TL_WA801NDV3_GPIO_BTN_WIFI,
+ .active_low = 1,
+ }
+};
+
+
+static void __init tl_ap143_setup(void)
+{
+ u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
+ u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
+ u8 tmpmac[ETH_ALEN];
+
+ ath79_register_m25p80(&tl_wa801n_v3_flash_data);
+
+ ath79_setup_ar933x_phy4_switch(false, false);
+
+ ath79_register_mdio(0, 0x0);
+
+ /* LAN */
+ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
+ ath79_eth1_data.duplex = DUPLEX_FULL;
+ ath79_switch_data.phy_poll_mask |= BIT(4);
+ ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
+ ath79_register_eth(1);
+
+ /* WAN */
+ ath79_switch_data.phy4_mii_en = 1;
+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
+ ath79_eth0_data.duplex = DUPLEX_FULL;
+ ath79_eth0_data.speed = SPEED_100;
+ ath79_eth0_data.phy_mask = BIT(4);
+ ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
+ ath79_register_eth(0);
+
+ ath79_init_mac(tmpmac, mac, 0);
+ ath79_register_wmac(ee, tmpmac);
+}
+
+static void __init tl_wa801n_v3_setup(void)
+{
+ tl_ap143_setup();
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wa801n_v3_leds_gpio),
+ tl_wa801n_v3_leds_gpio);
+
+ ath79_register_gpio_keys_polled(1, TL_WA801NDV3_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(tl_wa801n_v3_gpio_keys),
+ tl_wa801n_v3_gpio_keys);
+}
+
+MIPS_MACHINE(ATH79_MACH_TL_WA801ND_V3, "TL-WA801ND-v3", "TP-LINK TL-WA801ND v3",
+ tl_wa801n_v3_setup);
diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
index bb2bb94e04ee8f59db62907ace49952061b411dc..868a5021acb49878359497c90509de07faa3ca49 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -691,6 +691,13 @@ define Device/tl-wa801nd-v2
TPLINK_HWID := 0x08010002
endef
+define Device/tl-wa801nd-v3
+ $(Device/tplink-4mlzma)
+ BOARDNAME := TL-WA801ND-v3
+ DEVICE_PROFILE := TLWA801
+ TPLINK_HWID := 0x08010003
+endef
+
define Device/tl-wa830re-v2
$(Device/tplink-4mlzma)
BOARDNAME := TL-WA830RE-v2
@@ -711,7 +718,7 @@ define Device/tl-wa860re-v1
DEVICE_PROFILE := TLWA860
TPLINK_HWID := 0x08600001
endef
-TARGET_DEVICES += tl-wa801nd-v2 tl-wa830re-v2 tl-wa850re-v1 tl-wa860re-v1
+TARGET_DEVICES += tl-wa801nd-v2 tl-wa801nd-v3 tl-wa830re-v2 tl-wa850re-v1 tl-wa860re-v1
define Device/tl-wa901nd-v3
$(Device/tplink-4mlzma)
diff --git a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
index c83ac2e89324deda3135aab84e8c4f4112ea728d..d23f0cf33e50da891e7135861f1defda047ff2c8 100644
--- a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
+++ b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
@@ -1,6 +1,6 @@
--- a/arch/mips/ath79/machtypes.h
+++ b/arch/mips/ath79/machtypes.h
-@@ -16,22 +16,204 @@
+@@ -16,22 +16,205 @@
enum ath79_mach_type {
ATH79_MACH_GENERIC = 0,
@@ -127,6 +127,7 @@
+ ATH79_MACH_TL_WA850RE, /* TP-LINK TL-WA850RE */
+ ATH79_MACH_TL_WA860RE, /* TP-LINK TL-WA860RE */
+ ATH79_MACH_TL_WA801ND_V2, /* TP-LINK TL-WA801ND v2 */
++ ATH79_MACH_TL_WA801ND_V3, /* TP-LINK TL-WA801ND v3 */
+ ATH79_MACH_TL_WA830RE_V2, /* TP-LINK TL-WA830RE v2 */
+ ATH79_MACH_TL_WA901ND, /* TP-LINK TL-WA901ND */
+ ATH79_MACH_TL_WA901ND_V2, /* TP-LINK TL-WA901ND v2 */
@@ -287,17 +288,10 @@
config ATH79_MACH_AP121
bool "Atheros AP121 reference board"
select SOC_AR933X
-@@ -11,62 +84,1051 @@ config ATH79_MACH_AP121
- select ATH79_DEV_M25P80
- select ATH79_DEV_USB
- select ATH79_DEV_WMAC
-- help
-- Say 'Y' here if you want your kernel to support the
-- Atheros AP121 reference board.
-+ help
-+ Say 'Y' here if you want your kernel to support the
-+ Atheros AP121 reference board.
-+
+@@ -15,13 +88,25 @@ config ATH79_MACH_AP121
+ Say 'Y' here if you want your kernel to support the
+ Atheros AP121 reference board.
+
+config ATH79_MACH_AP132
+ bool "Atheros AP132 reference board"
+ select SOC_QCA955X
@@ -310,32 +304,21 @@
+ Say 'Y' here if you want your kernel to support the
+ Atheros AP132 reference boards.
+
-+config ATH79_MACH_AP136
-+ bool "Atheros AP136/AP135 reference board"
-+ select SOC_QCA955X
-+ select ATH79_DEV_GPIO_BUTTONS
-+ select ATH79_DEV_LEDS_GPIO
-+ select ATH79_DEV_NFC
-+ select ATH79_DEV_M25P80
-+ select ATH79_DEV_USB
-+ select ATH79_DEV_WMAC
-+ help
-+ Say 'Y' here if you want your kernel to support the
-+ Atheros AP136 or AP135 reference boards.
-+
-+config ATH79_MACH_AP81
-+ bool "Atheros AP81 reference board"
-+ select SOC_AR913X
-+ select ATH79_DEV_ETH
-+ select ATH79_DEV_GPIO_BUTTONS
-+ select ATH79_DEV_LEDS_GPIO
+ config ATH79_MACH_AP136
+ bool "Atheros AP136/AP135 reference board"
+ select SOC_QCA955X
+ select ATH79_DEV_GPIO_BUTTONS
+ select ATH79_DEV_LEDS_GPIO
+ select ATH79_DEV_NFC
+- select ATH79_DEV_SPI
+ select ATH79_DEV_M25P80
-+ select ATH79_DEV_USB
-+ select ATH79_DEV_WMAC
-+ help
-+ Say 'Y' here if you want your kernel to support the
-+ Atheros AP81 reference board.
-+
+ select ATH79_DEV_USB
+ select ATH79_DEV_WMAC
+ help
+@@ -41,6 +126,24 @@ config ATH79_MACH_AP81
+ Say 'Y' here if you want your kernel to support the
+ Atheros AP81 reference board.
+
+config ATH79_MACH_AP83
+ bool "Atheros AP83 board support"
+ select SOC_AR913X
@@ -354,21 +337,13 @@
+ select ATH79_DEV_M25P80
+ select ATH79_DEV_USB
+
-+config ATH79_MACH_DB120
-+ bool "Atheros DB120 reference board"
-+ select SOC_AR934X
-+ 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_NFC
-+ select ATH79_DEV_USB
-+ select ATH79_DEV_WMAC
-+ help
-+ Say 'Y' here if you want your kernel to support the
-+ Atheros DB120 reference board.
-+
+ config ATH79_MACH_DB120
+ bool "Atheros DB120 reference board"
+ select SOC_AR934X
+@@ -56,6 +159,13 @@ config ATH79_MACH_DB120
+ Say 'Y' here if you want your kernel to support the
+ Atheros DB120 reference board.
+
+config ATH79_MACH_PB42
+ bool "Atheros PB42 board support"
+ select SOC_AR71XX
@@ -376,18 +351,13 @@
+ select ATH79_DEV_GPIO_BUTTONS
+ select ATH79_DEV_M25P80
+
-+config ATH79_MACH_PB44
-+ bool "Atheros PB44 reference board"
-+ select SOC_AR71XX
-+ select ATH79_DEV_ETH
-+ select ATH79_DEV_GPIO_BUTTONS
-+ select ATH79_DEV_LEDS_GPIO
-+ select ATH79_DEV_SPI
-+ select ATH79_DEV_USB
-+ help
-+ Say 'Y' here if you want your kernel to support the
-+ Atheros PB44 reference board.
-+
+ config ATH79_MACH_PB44
+ bool "Atheros PB44 reference board"
+ select SOC_AR71XX
+@@ -68,6 +178,967 @@ config ATH79_MACH_PB44
+ Say 'Y' here if you want your kernel to support the
+ Atheros PB44 reference board.
+
+config ATH79_MACH_PB92
+ bool "Atheros PB92 board support"
+ select SOC_AR724X
@@ -1113,6 +1083,15 @@
+ select ATH79_DEV_M25P80
+ select ATH79_DEV_WMAC
+
++config ATH79_MACH_TL_WA801ND_V3
++ bool "TP-LINK TL-WA801ND v3 support"
++ select SOC_QCA953X
++ 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_WA830RE_V2
+ bool "TP-LINK TL-WA830RE v2 support"
+ select SOC_AR934X
@@ -1172,28 +1151,17 @@
+ select ATH79_DEV_M25P80
+ select ATH79_DEV_USB
+ select ATH79_DEV_WMAC
-
--config ATH79_MACH_AP136
-- bool "Atheros AP136/AP135 reference board"
-- select SOC_QCA955X
++
+config ATH79_MACH_TL_WR720N_V3
+ bool "TP-LINK TL-WR720N v3/v4 support"
+ select SOC_AR933X
+ select ATH79_DEV_ETH
- select ATH79_DEV_GPIO_BUTTONS
- select ATH79_DEV_LEDS_GPIO
-- select ATH79_DEV_NFC
-- select ATH79_DEV_SPI
++ select ATH79_DEV_GPIO_BUTTONS
++ select ATH79_DEV_LEDS_GPIO
+ select ATH79_DEV_M25P80
- select ATH79_DEV_USB
- select ATH79_DEV_WMAC
-- help
-- Say 'Y' here if you want your kernel to support the
-- Atheros AP136 or AP135 reference boards.
-
--config ATH79_MACH_AP81
-- bool "Atheros AP81 reference board"
-- select SOC_AR913X
++ select ATH79_DEV_USB
++ select ATH79_DEV_WMAC
++
+config ATH79_MACH_TL_WR741ND
+ bool "TP-LINK TL-WR741ND support"
+ select SOC_AR724X
@@ -1206,18 +1174,13 @@
+config ATH79_MACH_TL_WR741ND_V4
+ bool "TP-LINK TL-WR741ND v4/TL-MR3220 v2 support"
+ select SOC_AR933X
- 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
-- help
-- Say 'Y' here if you want your kernel to support the
-- Atheros AP81 reference board.
-
--config ATH79_MACH_DB120
-- bool "Atheros DB120 reference board"
++ 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_TL_WR841N_V1
+ bool "TP-LINK TL-WR841N v1 support"
+ select SOC_AR71XX
@@ -1268,21 +1231,15 @@
+
+config ATH79_MACH_TL_WR1041N_V2
+ bool "TP-LINK TL-WR1041N v2 support"
- select SOC_AR934X
- 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_NFC
- select ATH79_DEV_USB
- select ATH79_DEV_WMAC
-- help
-- Say 'Y' here if you want your kernel to support the
-- Atheros DB120 reference board.
-
--config ATH79_MACH_PB44
-- bool "Atheros PB44 reference board"
++ select SOC_AR934X
++ 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_TL_WR1043ND
+ bool "TP-LINK TL-WR1043ND support"
+ select SOC_AR913X
@@ -1325,12 +1282,11 @@
+
+config ATH79_MACH_TEW_673GRU
+ bool "TRENDnet TEW-673GRU support"
- select SOC_AR71XX
++ select SOC_AR71XX
+ select ATH79_DEV_AP9X_PCI if PCI
- select ATH79_DEV_ETH
- select ATH79_DEV_GPIO_BUTTONS
- select ATH79_DEV_LEDS_GPIO
-- select ATH79_DEV_SPI
++ select ATH79_DEV_ETH
++ select ATH79_DEV_GPIO_BUTTONS
++ select ATH79_DEV_LEDS_GPIO
+ select ATH79_DEV_M25P80
+ select ATH79_DEV_USB
+ select ATH79_NVRAM
@@ -1361,14 +1317,12 @@
+ select ATH79_DEV_GPIO_BUTTONS
+ select ATH79_DEV_LEDS_GPIO
+ select ATH79_DEV_M25P80
- select ATH79_DEV_USB
-- help
-- Say 'Y' here if you want your kernel to support the
-- Atheros PB44 reference board.
-
++ select ATH79_DEV_USB
++
config ATH79_MACH_UBNT_XM
bool "Ubiquiti Networks XM/UniFi boards"
-@@ -83,6 +1145,117 @@ config ATH79_MACH_UBNT_XM
+ select SOC_AR724X
+@@ -83,6 +1154,117 @@ config ATH79_MACH_UBNT_XM
Say 'Y' here if you want your kernel to support the
Ubiquiti Networks XM (rev 1.0) board.
@@ -1486,7 +1440,7 @@
endmenu
config SOC_AR71XX
-@@ -124,7 +1297,10 @@ config ATH79_DEV_DSA
+@@ -124,7 +1306,10 @@ config ATH79_DEV_DSA
config ATH79_DEV_ETH
def_bool n
@@ -1498,7 +1452,7 @@
def_bool n
config ATH79_DEV_GPIO_BUTTONS
-@@ -154,6 +1330,11 @@ config ATH79_PCI_ATH9K_FIXUP
+@@ -154,6 +1339,11 @@ config ATH79_PCI_ATH9K_FIXUP
def_bool n
config ATH79_ROUTERBOOT
@@ -1512,7 +1466,7 @@
endif
--- a/arch/mips/ath79/Makefile
+++ b/arch/mips/ath79/Makefile
-@@ -38,9 +38,129 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route
+@@ -38,9 +38,130 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route
#
# Machines
#
@@ -1595,6 +1549,7 @@
+obj-$(CONFIG_ATH79_MACH_TL_WA701ND_V2) += mach-tl-wa701nd-v2.o
+obj-$(CONFIG_ATH79_MACH_TL_WA7210N_V2) += mach-tl-wa7210n-v2.o
+obj-$(CONFIG_ATH79_MACH_TL_WA830RE_V2) += mach-tl-wa830re-v2.o
++obj-$(CONFIG_ATH79_MACH_TL_WA801ND_V3) += mach-tl-wa801nd-v3.o
+obj-$(CONFIG_ATH79_MACH_TL_WA901ND) += mach-tl-wa901nd.o
+obj-$(CONFIG_ATH79_MACH_TL_WA901ND_V2) += mach-tl-wa901nd-v2.o
+obj-$(CONFIG_ATH79_MACH_TL_WDR3500) += mach-tl-wdr3500.o
diff --git a/tools/firmware-utils/src/mktplinkfw.c b/tools/firmware-utils/src/mktplinkfw.c
index 6df869d59a6138d4c0dd1fbec5337a71c31eccd3..9785a3f232ed4457e77aee249c0da86b4e99c532 100644
--- a/tools/firmware-utils/src/mktplinkfw.c
+++ b/tools/firmware-utils/src/mktplinkfw.c
@@ -50,6 +50,7 @@
#define HWID_TL_WA830RE_V1 0x08300010
#define HWID_TL_WA830RE_V2 0x08300002
#define HWID_TL_WA801ND_V2 0x08010002
+#define HWID_TL_WA801ND_V3 0x08010003
#define HWID_TL_WA901ND_V1 0x09010001
#define HWID_TL_WA901ND_V2 0x09010002
#define HWID_TL_WA901ND_V4 0x09010004
@@ -296,6 +297,11 @@ static struct board_info boards[] = {
.hw_id = HWID_TL_WA801ND_V2,
.hw_rev = 1,
.layout_id = "4Mlzma",
+ },{
+ .id = "TL-WA801NDv3",
+ .hw_id = HWID_TL_WA801ND_V3,
+ .hw_rev = 1,
+ .layout_id = "4Mlzma",
}, {
.id = "TL-WA901NDv1",
.hw_id = HWID_TL_WA901ND_V1,
@@ -1207,4 +1213,3 @@ int main(int argc, char *argv[])
out:
return ret;
}
-

View File

@ -1,856 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sun, 28 Aug 2016 20:20:35 +0200
Subject: firmware-utils: mktplinkfw: backport from LEDE a4fc62bc0ea4010ddbfbd738453c9db70988a57c
diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile
index 03978456636ad50fc8128c0a5a51845135301a3d..aee8e87a1c0839f3220686e97cd8458516fc17cf 100644
--- a/tools/firmware-utils/Makefile
+++ b/tools/firmware-utils/Makefile
@@ -40,7 +40,7 @@ define Host/Compile
$(call cc,encode_crc)
$(call cc,nand_ecc)
$(call cc,mkplanexfw sha1)
- $(call cc,mktplinkfw md5)
+ $(call cc,mktplinkfw md5, -Wall)
$(call cc,mktplinkfw2 md5)
$(call cc,tplink-safeloader md5, -Wall)
$(call cc,pc1crypt)
diff --git a/tools/firmware-utils/src/mktplinkfw.c b/tools/firmware-utils/src/mktplinkfw.c
index 9785a3f232ed4457e77aee249c0da86b4e99c532..34e6546a2d7db72748146ef233830c2e8de9ce97 100644
--- a/tools/firmware-utils/src/mktplinkfw.c
+++ b/tools/firmware-utils/src/mktplinkfw.c
@@ -28,53 +28,10 @@
#include "md5.h"
#define ALIGN(x,a) ({ typeof(a) __a = (a); (((x) + __a - 1) & ~(__a - 1)); })
+#define ARRAY_SIZE(a) (sizeof((a)) / sizeof((a)[0]))
#define HEADER_VERSION_V1 0x01000000
-#define HWID_ANTMINER_S1 0x04440101
-#define HWID_ANTMINER_S3 0x04440301
-#define HWID_GL_INET_V1 0x08000001
-#define HWID_GS_OOLITE_V1 0x3C000101
-#define HWID_ONION_OMEGA 0x04700001
-#define HWID_TL_MR10U_V1 0x00100101
-#define HWID_TL_MR13U_V1 0x00130101
-#define HWID_TL_MR3020_V1 0x30200001
-#define HWID_TL_MR3220_V1 0x32200001
-#define HWID_TL_MR3220_V2 0x32200002
-#define HWID_TL_MR3420_V1 0x34200001
-#define HWID_TL_MR3420_V2 0x34200002
-#define HWID_TL_WA701N_V1 0x07010001
-#define HWID_TL_WA701N_V2 0x07010002
-#define HWID_TL_WA7210N_V2 0x72100002
-#define HWID_TL_WA7510N_V1 0x75100001
-#define HWID_TL_WA801ND_V1 0x08010001
-#define HWID_TL_WA830RE_V1 0x08300010
-#define HWID_TL_WA830RE_V2 0x08300002
-#define HWID_TL_WA801ND_V2 0x08010002
-#define HWID_TL_WA801ND_V3 0x08010003
-#define HWID_TL_WA901ND_V1 0x09010001
-#define HWID_TL_WA901ND_V2 0x09010002
-#define HWID_TL_WA901ND_V4 0x09010004
-#define HWID_TL_WDR4300_V1_IL 0x43008001
-#define HWID_TL_WDR4900_V1 0x49000001
-#define HWID_TL_WR703N_V1 0x07030101
-#define HWID_TL_WR720N_V3 0x07200103
-#define HWID_TL_WR720N_V4 0x07200104
-#define HWID_TL_WR741ND_V1 0x07410001
-#define HWID_TL_WR741ND_V4 0x07410004
-#define HWID_TL_WR740N_V1 0x07400001
-#define HWID_TL_WR740N_V3 0x07400003
-#define HWID_TL_WR743ND_V1 0x07430001
-#define HWID_TL_WR743ND_V2 0x07430002
-#define HWID_TL_WR841N_V1_5 0x08410002
-#define HWID_TL_WR841ND_V3 0x08410003
-#define HWID_TL_WR841ND_V5 0x08410005
-#define HWID_TL_WR841ND_V7 0x08410007
-#define HWID_TL_WR941ND_V2 0x09410002
-#define HWID_TL_WR941ND_V4 0x09410004
-#define HWID_TL_WR1043ND_V1 0x10430001
-#define HWID_TL_WR1043ND_V2 0x10430002
-#define HWID_TL_WR1041N_V2 0x10410002
-#define HWID_TL_WR2543N_V1 0x25430001
+#define HEADER_VERSION_V2 0x02000000
#define MD5SUM_LEN 16
@@ -89,7 +46,7 @@ struct fw_header {
char fw_version[36];
uint32_t hw_id; /* hardware id */
uint32_t hw_rev; /* hardware revision */
- uint32_t unk1;
+ uint32_t region_code; /* region code */
uint8_t md5sum1[MD5SUM_LEN];
uint32_t unk2;
uint8_t md5sum2[MD5SUM_LEN];
@@ -106,7 +63,10 @@ struct fw_header {
uint16_t ver_hi;
uint16_t ver_mid;
uint16_t ver_lo;
- uint8_t pad[354];
+ uint8_t pad[130];
+ char region_str1[32];
+ char region_str2[32];
+ uint8_t pad2[160];
} __attribute__ ((packed));
struct flash_layout {
@@ -117,13 +77,12 @@ struct flash_layout {
uint32_t rootfs_ofs;
};
-struct board_info {
- char *id;
- uint32_t hw_id;
- uint32_t hw_rev;
- char *layout_id;
+struct fw_region {
+ char name[4];
+ uint32_t code;
};
+
/*
* Globals
*/
@@ -132,15 +91,17 @@ static char *progname;
static char *vendor = "TP-LINK Technologies";
static char *version = "ver. 1.0";
static char *fw_ver = "0.0.0";
+static uint32_t hdr_ver = HEADER_VERSION_V1;
-static char *board_id;
-static struct board_info *board;
static char *layout_id;
static struct flash_layout *layout;
static char *opt_hw_id;
static uint32_t hw_id;
static char *opt_hw_rev;
static uint32_t hw_rev;
+static uint32_t opt_hdr_ver = 1;
+static char *country;
+static const struct fw_region *region;
static int fw_ver_lo;
static int fw_ver_mid;
static int fw_ver_hi;
@@ -163,12 +124,12 @@ static uint32_t reserved_space;
static struct file_info inspect_info;
static int extract = 0;
-char md5salt_normal[MD5SUM_LEN] = {
+static const char md5salt_normal[MD5SUM_LEN] = {
0xdc, 0xd7, 0x3a, 0xa5, 0xc3, 0x95, 0x98, 0xfb,
0xdd, 0xf9, 0xe7, 0xf4, 0x0e, 0xae, 0x47, 0x38,
};
-char md5salt_boot[MD5SUM_LEN] = {
+static const char md5salt_boot[MD5SUM_LEN] = {
0x8c, 0xef, 0x33, 0x5b, 0xd5, 0xc5, 0xce, 0xfa,
0xa7, 0x9c, 0x28, 0xda, 0xb2, 0xe9, 0x0f, 0x42,
};
@@ -213,7 +174,7 @@ static struct flash_layout layouts[] = {
}, {
.id = "16Mppc",
.fw_max_len = 0xf80000,
- .kernel_la = 0x00000000,
+ .kernel_la = 0x00000000 ,
.kernel_ep = 0xc0000000,
.rootfs_ofs = 0x2a0000,
}, {
@@ -221,235 +182,10 @@ static struct flash_layout layouts[] = {
}
};
-static struct board_info boards[] = {
- {
- .id = "TL-MR10Uv1",
- .hw_id = HWID_TL_MR10U_V1,
- .hw_rev = 1,
- .layout_id = "4Mlzma",
- }, {
- .id = "TL-MR13Uv1",
- .hw_id = HWID_TL_MR13U_V1,
- .hw_rev = 1,
- .layout_id = "4Mlzma",
- }, {
- .id = "TL-MR3020v1",
- .hw_id = HWID_TL_MR3020_V1,
- .hw_rev = 1,
- .layout_id = "4Mlzma",
- }, {
- .id = "TL-MR3220v1",
- .hw_id = HWID_TL_MR3220_V1,
- .hw_rev = 1,
- .layout_id = "4M",
- }, {
- .id = "TL-MR3220v2",
- .hw_id = HWID_TL_MR3220_V2,
- .hw_rev = 1,
- .layout_id = "4Mlzma",
- }, {
- .id = "TL-MR3420v1",
- .hw_id = HWID_TL_MR3420_V1,
- .hw_rev = 1,
- .layout_id = "4M",
- }, {
- .id = "TL-MR3420v2",
- .hw_id = HWID_TL_MR3420_V2,
- .hw_rev = 1,
- .layout_id = "4Mlzma",
- }, {
- .id = "TL-WA701Nv1",
- .hw_id = HWID_TL_WA701N_V1,
- .hw_rev = 1,
- .layout_id = "4M",
- }, {
- .id = "TL-WA701Nv2",
- .hw_id = HWID_TL_WA701N_V2,
- .hw_rev = 1,
- .layout_id = "4Mlzma",
- }, {
- .id = "TL-WA7210N",
- .hw_id = HWID_TL_WA7210N_V2,
- .hw_rev = 2,
- .layout_id = "4Mlzma",
- }, {
- .id = "TL-WA7510N",
- .hw_id = HWID_TL_WA7510N_V1,
- .hw_rev = 1,
- .layout_id = "4M",
- }, {
- .id = "TL-WA801NDv1",
- .hw_id = HWID_TL_WA801ND_V1,
- .hw_rev = 1,
- .layout_id = "4M",
- }, {
- .id = "TL-WA830REv1",
- .hw_id = HWID_TL_WA830RE_V1,
- .hw_rev = 1,
- .layout_id = "4M",
- }, {
- .id = "TL-WA830REv2",
- .hw_id = HWID_TL_WA830RE_V2,
- .hw_rev = 1,
- .layout_id = "4M",
- }, {
- .id = "TL-WA801NDv2",
- .hw_id = HWID_TL_WA801ND_V2,
- .hw_rev = 1,
- .layout_id = "4Mlzma",
- },{
- .id = "TL-WA801NDv3",
- .hw_id = HWID_TL_WA801ND_V3,
- .hw_rev = 1,
- .layout_id = "4Mlzma",
- }, {
- .id = "TL-WA901NDv1",
- .hw_id = HWID_TL_WA901ND_V1,
- .hw_rev = 1,
- .layout_id = "4M",
- }, {
- .id = "TL-WA901NDv2",
- .hw_id = HWID_TL_WA901ND_V2,
- .hw_rev = 1,
- .layout_id = "4M",
- }, {
- .id = "TL-WA901NDv4",
- .hw_id = HWID_TL_WA901ND_V4,
- .hw_rev = 1,
- .layout_id = "4Mlzma",
- }, {
- .id = "TL-WDR4300v1",
- .hw_id = HWID_TL_WDR4300_V1_IL,
- .hw_rev = 1,
- .layout_id = "8Mlzma",
- }, {
- .id = "TL-WDR4900v1",
- .hw_id = HWID_TL_WDR4900_V1,
- .hw_rev = 1,
- .layout_id = "16Mppc",
- }, {
- .id = "TL-WR741NDv1",
- .hw_id = HWID_TL_WR741ND_V1,
- .hw_rev = 1,
- .layout_id = "4M",
- }, {
- .id = "TL-WR741NDv4",
- .hw_id = HWID_TL_WR741ND_V4,
- .hw_rev = 1,
- .layout_id = "4Mlzma",
- }, {
- .id = "TL-WR740Nv1",
- .hw_id = HWID_TL_WR740N_V1,
- .hw_rev = 1,
- .layout_id = "4M",
- }, {
- .id = "TL-WR740Nv3",
- .hw_id = HWID_TL_WR740N_V3,
- .hw_rev = 1,
- .layout_id = "4M",
- }, {
- .id = "TL-WR743NDv1",
- .hw_id = HWID_TL_WR743ND_V1,
- .hw_rev = 1,
- .layout_id = "4M",
- }, {
- .id = "TL-WR743NDv2",
- .hw_id = HWID_TL_WR743ND_V2,
- .hw_rev = 1,
- .layout_id = "4Mlzma",
- }, {
- .id = "TL-WR841Nv1.5",
- .hw_id = HWID_TL_WR841N_V1_5,
- .hw_rev = 2,
- .layout_id = "4M",
- }, {
- .id = "TL-WR841NDv3",
- .hw_id = HWID_TL_WR841ND_V3,
- .hw_rev = 3,
- .layout_id = "4M",
- }, {
- .id = "TL-WR841NDv5",
- .hw_id = HWID_TL_WR841ND_V5,
- .hw_rev = 1,
- .layout_id = "4M",
- }, {
- .id = "TL-WR841NDv7",
- .hw_id = HWID_TL_WR841ND_V7,
- .hw_rev = 1,
- .layout_id = "4M",
- }, {
- .id = "TL-WR941NDv2",
- .hw_id = HWID_TL_WR941ND_V2,
- .hw_rev = 2,
- .layout_id = "4M",
- }, {
- .id = "TL-WR941NDv4",
- .hw_id = HWID_TL_WR941ND_V4,
- .hw_rev = 1,
- .layout_id = "4M",
- }, {
- .id = "TL-WR1041Nv2",
- .hw_id = HWID_TL_WR1041N_V2,
- .hw_rev = 1,
- .layout_id = "4Mlzma",
- }, {
- .id = "TL-WR1043NDv1",
- .hw_id = HWID_TL_WR1043ND_V1,
- .hw_rev = 1,
- .layout_id = "8M",
- }, {
- .id = "TL-WR1043NDv2",
- .hw_id = HWID_TL_WR1043ND_V2,
- .hw_rev = 1,
- .layout_id = "8Mlzma",
- }, {
- .id = "TL-WR2543Nv1",
- .hw_id = HWID_TL_WR2543N_V1,
- .hw_rev = 1,
- .layout_id = "8Mlzma",
- }, {
- .id = "TL-WR703Nv1",
- .hw_id = HWID_TL_WR703N_V1,
- .hw_rev = 1,
- .layout_id = "4Mlzma",
- }, {
- .id = "TL-WR720Nv3",
- .hw_id = HWID_TL_WR720N_V3,
- .hw_rev = 1,
- .layout_id = "4Mlzma",
- }, {
- .id = "TL-WR720Nv4",
- .hw_id = HWID_TL_WR720N_V4,
- .hw_rev = 1,
- .layout_id = "4Mlzma",
- }, {
- .id = "GL-INETv1",
- .hw_id = HWID_GL_INET_V1,
- .hw_rev = 1,
- .layout_id = "8Mlzma",
- }, {
- .id = "GS-OOLITEv1",
- .hw_id = HWID_GS_OOLITE_V1,
- .hw_rev = 1,
- .layout_id = "16Mlzma",
- }, {
- .id = "ONION-OMEGA",
- .hw_id = HWID_ONION_OMEGA,
- .hw_rev = 1,
- .layout_id = "16Mlzma",
- }, {
- .id = "ANTMINER-S1",
- .hw_id = HWID_ANTMINER_S1,
- .hw_rev = 1,
- .layout_id = "8Mlzma",
- }, {
- .id = "ANTMINER-S3",
- .hw_id = HWID_ANTMINER_S3,
- .hw_rev = 1,
- .layout_id = "8Mlzma",
- }, {
- /* terminating entry */
- }
+static const struct fw_region regions[] = {
+ /* Default region (universal) uses code 0 as well */
+ {"US", 1},
+ {"EU", 0},
};
/*
@@ -464,7 +200,7 @@ static struct board_info boards[] = {
#define ERRS(fmt, ...) do { \
int save = errno; \
fflush(0); \
- fprintf(stderr, "[%s] *** error: " fmt "\n", \
+ fprintf(stderr, "[%s] *** error: " fmt ": %s\n", \
progname, ## __VA_ARGS__, strerror(save)); \
} while (0)
@@ -472,35 +208,7 @@ static struct board_info boards[] = {
fprintf(stderr, "[%s] " fmt "\n", progname, ## __VA_ARGS__ ); \
} while (0)
-static struct board_info *find_board(char *id)
-{
- struct board_info *ret;
- struct board_info *board;
-
- ret = NULL;
- for (board = boards; board->id != NULL; board++){
- if (strcasecmp(id, board->id) == 0) {
- ret = board;
- break;
- }
- };
-
- return ret;
-}
-
-static struct board_info *find_board_by_hwid(uint32_t hw_id)
-{
- struct board_info *board;
-
- for (board = boards; board->id != NULL; board++) {
- if (hw_id == board->hw_id)
- return board;
- };
-
- return NULL;
-}
-
-static struct flash_layout *find_layout(char *id)
+static struct flash_layout *find_layout(const char *id)
{
struct flash_layout *ret;
struct flash_layout *l;
@@ -516,21 +224,29 @@ static struct flash_layout *find_layout(char *id)
return ret;
}
+static const struct fw_region * find_region(const char *country) {
+ size_t i;
+
+ for (i = 0; i < ARRAY_SIZE(regions); i++) {
+ if (strcasecmp(regions[i].name, country) == 0)
+ return &regions[i];
+ }
+
+ return NULL;
+}
+
static void usage(int status)
{
- FILE *stream = (status != EXIT_SUCCESS) ? stderr : stdout;
- struct board_info *board;
-
- fprintf(stream, "Usage: %s [OPTIONS...]\n", progname);
- fprintf(stream,
+ fprintf(stderr, "Usage: %s [OPTIONS...]\n", progname);
+ fprintf(stderr,
"\n"
"Options:\n"
-" -B <board> create image for the board specified with <board>\n"
" -c use combined kernel image\n"
" -E <ep> overwrite kernel entry point with <ep> (hexval prefixed with 0x)\n"
" -L <la> overwrite kernel load address with <la> (hexval prefixed with 0x)\n"
" -H <hwid> use hardware id specified with <hwid>\n"
" -W <hwrev> use hardware revision specified with <hwrev>\n"
+" -C <country> set region code to <country>\n"
" -F <id> use flash layout specified with <id>\n"
" -k <file> read kernel image from the file <file>\n"
" -r <file> read rootfs image from the file <file>\n"
@@ -543,6 +259,7 @@ static void usage(int status)
" -N <vendor> set image vendor to <vendor>\n"
" -V <version> set image version to <version>\n"
" -v <version> set firmware version to <version>\n"
+" -m <version> set header version to <version>\n"
" -i <file> inspect given firmware file <file>\n"
" -x extract kernel and rootfs while inspecting (requires -i)\n"
" -X <size> reserve <size> bytes in the firmware image (hexval prefixed with 0x)\n"
@@ -552,7 +269,7 @@ static void usage(int status)
exit(status);
}
-static int get_md5(char *data, int size, char *md5)
+static void get_md5(const char *data, int size, uint8_t *md5)
{
MD5_CTX ctx;
@@ -579,7 +296,7 @@ static int get_file_stat(struct file_info *fdata)
return 0;
}
-static int read_to_buf(struct file_info *fdata, char *buf)
+static int read_to_buf(const struct file_info *fdata, char *buf)
{
FILE *f;
int ret = EXIT_FAILURE;
@@ -608,6 +325,7 @@ static int read_to_buf(struct file_info *fdata, char *buf)
static int check_options(void)
{
int ret;
+ int exceed_bytes;
if (inspect_info.file_name) {
ret = get_file_stat(&inspect_info);
@@ -620,33 +338,28 @@ static int check_options(void)
return -1;
}
- if (board_id == NULL && opt_hw_id == NULL) {
- ERR("either board or hardware id must be specified");
+ if (opt_hw_id == NULL) {
+ ERR("hardware id not specified");
return -1;
}
+ hw_id = strtoul(opt_hw_id, NULL, 0);
- if (board_id) {
- board = find_board(board_id);
- if (board == NULL) {
- ERR("unknown/unsupported board id \"%s\"", board_id);
- return -1;
- }
- if (layout_id == NULL)
- layout_id = board->layout_id;
+ if (layout_id == NULL) {
+ ERR("flash layout is not specified");
+ return -1;
+ }
- hw_id = board->hw_id;
- hw_rev = board->hw_rev;
- } else {
- if (layout_id == NULL) {
- ERR("flash layout is not specified");
+ if (opt_hw_rev)
+ hw_rev = strtoul(opt_hw_rev, NULL, 0);
+ else
+ hw_rev = 1;
+
+ if (country) {
+ region = find_region(country);
+ if (!region) {
+ ERR("unknown region code \"%s\"", country);
return -1;
}
- hw_id = strtoul(opt_hw_id, NULL, 0);
-
- if (opt_hw_rev)
- hw_rev = strtoul(opt_hw_rev, NULL, 0);
- else
- hw_rev = 1;
}
layout = find_layout(layout_id);
@@ -681,10 +394,10 @@ static int check_options(void)
kernel_len = kernel_info.file_size;
if (combined) {
- if (kernel_info.file_size >
- fw_max_len - sizeof(struct fw_header)) {
+ exceed_bytes = kernel_info.file_size - (fw_max_len - sizeof(struct fw_header));
+ if (exceed_bytes > 0) {
if (!ignore_size) {
- ERR("kernel image is too big");
+ ERR("kernel image is too big by %i bytes", exceed_bytes);
return -1;
}
layout->fw_max_len = sizeof(struct fw_header) +
@@ -708,21 +421,21 @@ static int check_options(void)
DBG("kernel length aligned to %u", kernel_len);
- if (kernel_len + rootfs_info.file_size >
- fw_max_len - sizeof(struct fw_header)) {
- ERR("images are too big");
+ exceed_bytes = kernel_len + rootfs_info.file_size - (fw_max_len - sizeof(struct fw_header));
+ if (exceed_bytes > 0) {
+ ERR("images are too big by %i bytes", exceed_bytes);
return -1;
}
} else {
- if (kernel_info.file_size >
- rootfs_ofs - sizeof(struct fw_header)) {
- ERR("kernel image is too big");
+ exceed_bytes = kernel_info.file_size - (rootfs_ofs - sizeof(struct fw_header));
+ if (exceed_bytes > 0) {
+ ERR("kernel image is too big by %i bytes", exceed_bytes);
return -1;
}
- if (rootfs_info.file_size >
- (fw_max_len - rootfs_ofs)) {
- ERR("rootfs image is too big");
+ exceed_bytes = rootfs_info.file_size - (fw_max_len - rootfs_ofs);
+ if (exceed_bytes > 0) {
+ ERR("rootfs image is too big by %i bytes", exceed_bytes);
return -1;
}
}
@@ -739,6 +452,15 @@ static int check_options(void)
return -1;
}
+ if (opt_hdr_ver == 1) {
+ hdr_ver = HEADER_VERSION_V1;
+ } else if (opt_hdr_ver == 2) {
+ hdr_ver = HEADER_VERSION_V2;
+ } else {
+ ERR("invalid header version '%u'", opt_hdr_ver);
+ return -1;
+ }
+
return 0;
}
@@ -748,7 +470,7 @@ static void fill_header(char *buf, int len)
memset(hdr, 0, sizeof(struct fw_header));
- hdr->version = htonl(HEADER_VERSION_V1);
+ hdr->version = htonl(hdr_ver);
strncpy(hdr->vendor_name, vendor, sizeof(hdr->vendor_name));
strncpy(hdr->fw_version, version, sizeof(hdr->fw_version));
hdr->hw_id = htonl(hw_id);
@@ -773,6 +495,18 @@ static void fill_header(char *buf, int len)
hdr->ver_mid = htons(fw_ver_mid);
hdr->ver_lo = htons(fw_ver_lo);
+ if (region) {
+ hdr->region_code = htonl(region->code);
+ snprintf(
+ hdr->region_str1, sizeof(hdr->region_str1), "00000000;%02X%02X%02X%02X;",
+ region->name[0], region->name[1], region->name[2], region->name[3]
+ );
+ snprintf(
+ hdr->region_str2, sizeof(hdr->region_str2), "%02X%02X%02X%02X",
+ region->name[0], region->name[1], region->name[2], region->name[3]
+ );
+ }
+
get_md5(buf, len, hdr->md5sum1);
}
@@ -810,7 +544,7 @@ static int pad_jffs2(char *buf, int currlen)
return len;
}
-static int write_fw(char *data, int len)
+static int write_fw(const char *data, int len)
{
FILE *f;
int ret = EXIT_FAILURE;
@@ -902,61 +636,22 @@ static int build_fw(void)
}
/* Helper functions to inspect_fw() representing different output formats */
-static inline void inspect_fw_pstr(char *label, char *str)
+static inline void inspect_fw_pstr(const char *label, const char *str)
{
printf("%-23s: %s\n", label, str);
}
-static inline void inspect_fw_phex(char *label, uint32_t val)
+static inline void inspect_fw_phex(const char *label, uint32_t val)
{
printf("%-23s: 0x%08x\n", label, val);
}
-static inline void inspect_fw_phexpost(char *label,
- uint32_t val, char *post)
-{
- printf("%-23s: 0x%08x (%s)\n", label, val, post);
-}
-
-static inline void inspect_fw_phexdef(char *label,
- uint32_t val, uint32_t defval)
-{
- printf("%-23s: 0x%08x ", label, val);
-
- if (val == defval)
- printf("(== OpenWrt default)\n");
- else
- printf("(OpenWrt default: 0x%08x)\n", defval);
-}
-
-static inline void inspect_fw_phexexp(char *label,
- uint32_t val, uint32_t expval)
-{
- printf("%-23s: 0x%08x ", label, val);
-
- if (val == expval)
- printf("(ok)\n");
- else
- printf("(expected: 0x%08x)\n", expval);
-}
-
-static inline void inspect_fw_phexdec(char *label, uint32_t val)
+static inline void inspect_fw_phexdec(const char *label, uint32_t val)
{
printf("%-23s: 0x%08x / %8u bytes\n", label, val, val);
}
-static inline void inspect_fw_phexdecdef(char *label,
- uint32_t val, uint32_t defval)
-{
- printf("%-23s: 0x%08x / %8u bytes ", label, val, val);
-
- if (val == defval)
- printf("(== OpenWrt default)\n");
- else
- printf("(OpenWrt default: 0x%08x)\n", defval);
-}
-
-static inline void inspect_fw_pmd5sum(char *label, uint8_t *val, char *text)
+static inline void inspect_fw_pmd5sum(const char *label, const uint8_t *val, const char *text)
{
int i;
@@ -971,7 +666,6 @@ static int inspect_fw(void)
char *buf;
struct fw_header *hdr;
uint8_t md5sum[MD5SUM_LEN];
- struct board_info *board;
int ret = EXIT_FAILURE;
buf = malloc(inspect_info.file_size);
@@ -988,16 +682,14 @@ static int inspect_fw(void)
inspect_fw_pstr("File name", inspect_info.file_name);
inspect_fw_phexdec("File size", inspect_info.file_size);
- if (ntohl(hdr->version) != HEADER_VERSION_V1) {
- ERR("file does not seem to have V1 header!\n");
+ if ((ntohl(hdr->version) != HEADER_VERSION_V1) &&
+ (ntohl(hdr->version) != HEADER_VERSION_V2)) {
+ ERR("file does not seem to have V1/V2 header!\n");
goto out_free_buf;
}
inspect_fw_phexdec("Version 1 Header size", sizeof(struct fw_header));
- if (ntohl(hdr->unk1) != 0)
- inspect_fw_phexdec("Unknown value 1", hdr->unk1);
-
memcpy(md5sum, hdr->md5sum1, sizeof(md5sum));
if (ntohl(hdr->boot_len) == 0)
memcpy(hdr->md5sum1, md5salt_normal, sizeof(md5sum));
@@ -1022,19 +714,9 @@ static int inspect_fw(void)
inspect_fw_pstr("Vendor name", hdr->vendor_name);
inspect_fw_pstr("Firmware version", hdr->fw_version);
- board = find_board_by_hwid(ntohl(hdr->hw_id));
- if (board) {
- layout = find_layout(board->layout_id);
- inspect_fw_phexpost("Hardware ID",
- ntohl(hdr->hw_id), board->id);
- inspect_fw_phexexp("Hardware Revision",
- ntohl(hdr->hw_rev), board->hw_rev);
- } else {
- inspect_fw_phexpost("Hardware ID",
- ntohl(hdr->hw_id), "unknown");
- inspect_fw_phex("Hardware Revision",
- ntohl(hdr->hw_rev));
- }
+ inspect_fw_phex("Hardware ID", ntohl(hdr->hw_id));
+ inspect_fw_phex("Hardware Revision", ntohl(hdr->hw_rev));
+ inspect_fw_phex("Region code", ntohl(hdr->region_code));
printf("\n");
@@ -1042,24 +724,12 @@ static int inspect_fw(void)
ntohl(hdr->kernel_ofs));
inspect_fw_phexdec("Kernel data length",
ntohl(hdr->kernel_len));
- if (board) {
- inspect_fw_phexdef("Kernel load address",
- ntohl(hdr->kernel_la),
- layout ? layout->kernel_la : 0xffffffff);
- inspect_fw_phexdef("Kernel entry point",
- ntohl(hdr->kernel_ep),
- layout ? layout->kernel_ep : 0xffffffff);
- inspect_fw_phexdecdef("Rootfs data offset",
- ntohl(hdr->rootfs_ofs),
- layout ? layout->rootfs_ofs : 0xffffffff);
- } else {
- inspect_fw_phex("Kernel load address",
- ntohl(hdr->kernel_la));
- inspect_fw_phex("Kernel entry point",
- ntohl(hdr->kernel_ep));
- inspect_fw_phexdec("Rootfs data offset",
- ntohl(hdr->rootfs_ofs));
- }
+ inspect_fw_phex("Kernel load address",
+ ntohl(hdr->kernel_la));
+ inspect_fw_phex("Kernel entry point",
+ ntohl(hdr->kernel_ep));
+ inspect_fw_phexdec("Rootfs data offset",
+ ntohl(hdr->rootfs_ofs));
inspect_fw_phexdec("Rootfs data length",
ntohl(hdr->rootfs_len));
inspect_fw_phexdec("Boot loader data offset",
@@ -1115,16 +785,13 @@ static int inspect_fw(void)
int main(int argc, char *argv[])
{
int ret = EXIT_FAILURE;
- int err;
-
- FILE *outfile;
progname = basename(argv[0]);
while ( 1 ) {
int c;
- c = getopt(argc, argv, "a:B:H:E:F:L:V:N:W:ci:k:r:R:o:xX:hsSjv:");
+ c = getopt(argc, argv, "a:H:E:F:L:m:V:N:W:C:ci:k:r:R:o:xX:hsSjv:");
if (c == -1)
break;
@@ -1132,9 +799,6 @@ int main(int argc, char *argv[])
case 'a':
sscanf(optarg, "0x%x", &rootfs_align);
break;
- case 'B':
- board_id = optarg;
- break;
case 'H':
opt_hw_id = optarg;
break;
@@ -1147,9 +811,15 @@ int main(int argc, char *argv[])
case 'W':
opt_hw_rev = optarg;
break;
+ case 'C':
+ country = optarg;
+ break;
case 'L':
sscanf(optarg, "0x%x", &kernel_la);
break;
+ case 'm':
+ sscanf(optarg, "%u", &opt_hdr_ver);
+ break;
case 'V':
version = optarg;
break;

View File

@ -1,38 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sun, 28 Aug 2016 20:38:58 +0200
Subject: ar71xx: backport support for new TP-Link region codes
Generate flashable images for the Archer C7 v2 with current stock firmware
again.
diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
index 868a5021acb49878359497c90509de07faa3ca49..95f6d46d15b43faabb0bbf9301476d3ea5bee470 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -58,13 +58,14 @@ define Build/mktplinkfw
-o $@.new \
-j -X 0x40000 \
-a $(call rootfs_align,$(FILESYSTEM)) \
- $(if $(findstring sysupgrade,$1),-s) && mv $@.new $@ || rm -f $@
+ $(wordlist 2,$(words $(1)),$(1)) \
+ $(if $(findstring sysupgrade,$(word 1,$(1))),-s) && mv $@.new $@ || rm -f $@
endef
# -c combined image
define Build/mktplinkfw-initramfs
$(STAGING_DIR_HOST)/bin/mktplinkfw \
- -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -F $(TPLINK_FLASHLAYOUT) -N OpenWrt -V $(REVISION) \
+ -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -F $(TPLINK_FLASHLAYOUT) -N OpenWrt -V $(REVISION) $(1) \
-k $@ \
-o $@.new \
-s -S \
@@ -300,6 +301,9 @@ define Device/archer-c7-v2
BOARDNAME := ARCHER-C7
DEVICE_PROFILE := ARCHERC7
TPLINK_HWID := 0xc7000002
+ IMAGES := sysupgrade.bin factory.bin factory-us.bin factory-eu.bin
+ IMAGE/factory-us.bin := append-rootfs | mktplinkfw factory -C US
+ IMAGE/factory-eu.bin := append-rootfs | mktplinkfw factory -C EU
endef
TARGET_DEVICES += archer-c5 archer-c7-v1 archer-c7-v2

View File

@ -1,68 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Fri, 9 Sep 2016 01:54:44 +0200
Subject: ath10k-firmware: add ath10k-firmware-qca988x-11s
diff --git a/package/firmware/ath10k-firmware/Makefile b/package/firmware/ath10k-firmware/Makefile
index 624da6a1ed43ea37bbb3409b3dbe4b3af01263b5..3a4f0c59eb89a32f78f0104d2420b921d6660ddc 100644
--- a/package/firmware/ath10k-firmware/Makefile
+++ b/package/firmware/ath10k-firmware/Makefile
@@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=ath10k-firmware
-PKG_SOURCE_VERSION:=b00eb8d30fbebb6a5047ccacefa8c37e072fca9c
+PKG_SOURCE_VERSION:=307cb46b06661ebd3186723b5002de769c7add83
PKG_VERSION:=2014-11-13-$(PKG_SOURCE_VERSION)
PKG_RELEASE:=1
@@ -104,6 +104,11 @@ $(Package/ath10k-firmware-default)
TITLE:=ath10k firmware for QCA99x0 devices
endef
+define Package/ath10k-firmware-qca988x-11s
+$(Package/ath10k-firmware-default)
+ TITLE:=ath10k firmware for QCA988x devices (with 11s support)
+endef
+
define Package/ath10k-firmware-qca988x-ct
$(Package/ath10k-firmware-default)
TITLE:=ath10k CT 10.1 firmware for QCA988x devices
@@ -188,17 +193,27 @@ endef
define Package/ath10k-firmware-qca988x/install
$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0
$(INSTALL_DATA) \
- $(PKG_BUILD_DIR)/QCA988X/board.bin \
+ $(PKG_BUILD_DIR)/QCA988X/hw2.0/board.bin \
$(1)/lib/firmware/ath10k/QCA988X/hw2.0/
$(INSTALL_DATA) \
$(DL_DIR)/$(QCA988X_FIRMWARE_FILE) \
$(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin
endef
+define Package/ath10k-firmware-qca988x-11s/install
+ $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0
+ $(INSTALL_DATA) \
+ $(PKG_BUILD_DIR)/QCA988X/hw2.0/board.bin \
+ $(1)/lib/firmware/ath10k/QCA988X/hw2.0/
+ $(INSTALL_DATA) \
+ $(PKG_BUILD_DIR)/QCA988X/hw2.0/10.2.4.70/firmware-5.bin_10.2.4.70.54 \
+ $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin
+endef
+
define Package/ath10k-firmware-qca988x-ct/install
$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0
$(INSTALL_DATA) \
- $(PKG_BUILD_DIR)/QCA988X/board.bin \
+ $(PKG_BUILD_DIR)/QCA988X/hw2.0/board.bin \
$(1)/lib/firmware/ath10k/QCA988X/hw2.0/
$(INSTALL_DATA) \
$(DL_DIR)/$(QCA988X_FIRMWARE_FILE_CT) \
@@ -268,6 +283,8 @@ $(eval $(call BuildPackage,ath10k-firmware-qca99x0))
$(eval $(call BuildPackage,ath10k-firmware-qca6174))
$(eval $(call BuildPackage,ath10k-firmware-qca9984))
+$(eval $(call BuildPackage,ath10k-firmware-qca988x-11s))
+
$(eval $(call BuildPackage,ath10k-firmware-qca988x-ct))
$(eval $(call BuildPackage,ath10k-firmware-qca99x0-ct))
$(eval $(call BuildPackage,ath10k-firmware-qca9984-ct))

View File

@ -1,124 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Tue, 11 Oct 2016 02:54:27 +0200
Subject: ath9k: revert temperature compensation support patch (FS#111)
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Backport of LEDE 3e4d0e3e77dcf9b2116e5ed53f30e2bf53b1c6b7
diff --git a/package/kernel/mac80211/patches/328-ath9k_hw-implement-temperature-compensation-support-.patch b/package/kernel/mac80211/patches/328-ath9k_hw-implement-temperature-compensation-support-.patch
deleted file mode 100644
index cff32ad47cb0b905d9cfa4eb021258b644b2a47a..0000000000000000000000000000000000000000
--- a/package/kernel/mac80211/patches/328-ath9k_hw-implement-temperature-compensation-support-.patch
+++ /dev/null
@@ -1,97 +0,0 @@
-From: Felix Fietkau <nbd@nbd.name>
-Date: Mon, 11 Jul 2016 11:35:55 +0200
-Subject: [PATCH] ath9k_hw: implement temperature compensation support for
- AR9003+
-
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
----
-
---- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
-+++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
-@@ -33,6 +33,7 @@ struct coeff {
-
- enum ar9003_cal_types {
- IQ_MISMATCH_CAL = BIT(0),
-+ TEMP_COMP_CAL = BIT(1),
- };
-
- static void ar9003_hw_setup_calibration(struct ath_hw *ah,
-@@ -58,6 +59,12 @@ static void ar9003_hw_setup_calibration(
- /* Kick-off cal */
- REG_SET_BIT(ah, AR_PHY_TIMING4, AR_PHY_TIMING4_DO_CAL);
- break;
-+ case TEMP_COMP_CAL:
-+ ath_dbg(common, CALIBRATE,
-+ "starting Temperature Compensation Calibration\n");
-+ REG_SET_BIT(ah, AR_CH0_THERM, AR_CH0_THERM_LOCAL);
-+ REG_SET_BIT(ah, AR_CH0_THERM, AR_CH0_THERM_START);
-+ break;
- default:
- ath_err(common, "Invalid calibration type\n");
- break;
-@@ -86,7 +93,8 @@ static bool ar9003_hw_per_calibration(st
- /*
- * Accumulate cal measures for active chains
- */
-- cur_caldata->calCollect(ah);
-+ if (cur_caldata->calCollect)
-+ cur_caldata->calCollect(ah);
- ah->cal_samples++;
-
- if (ah->cal_samples >= cur_caldata->calNumSamples) {
-@@ -99,7 +107,8 @@ static bool ar9003_hw_per_calibration(st
- /*
- * Process accumulated data
- */
-- cur_caldata->calPostProc(ah, numChains);
-+ if (cur_caldata->calPostProc)
-+ cur_caldata->calPostProc(ah, numChains);
-
- /* Calibration has finished. */
- caldata->CalValid |= cur_caldata->calType;
-@@ -314,9 +323,16 @@ static const struct ath9k_percal_data iq
- ar9003_hw_iqcalibrate
- };
-
-+static const struct ath9k_percal_data temp_cal_single_sample = {
-+ TEMP_COMP_CAL,
-+ MIN_CAL_SAMPLES,
-+ PER_MAX_LOG_COUNT,
-+};
-+
- static void ar9003_hw_init_cal_settings(struct ath_hw *ah)
- {
- ah->iq_caldata.calData = &iq_cal_single_sample;
-+ ah->temp_caldata.calData = &temp_cal_single_sample;
-
- if (AR_SREV_9300_20_OR_LATER(ah)) {
- ah->enabled_cals |= TX_IQ_CAL;
-@@ -324,7 +340,7 @@ static void ar9003_hw_init_cal_settings(
- ah->enabled_cals |= TX_IQ_ON_AGC_CAL;
- }
-
-- ah->supp_cals = IQ_MISMATCH_CAL;
-+ ah->supp_cals = IQ_MISMATCH_CAL | TEMP_COMP_CAL;
- }
-
- #define OFF_UPPER_LT 24
-@@ -1383,6 +1399,9 @@ static void ar9003_hw_init_cal_common(st
- INIT_CAL(&ah->iq_caldata);
- INSERT_CAL(ah, &ah->iq_caldata);
-
-+ INIT_CAL(&ah->temp_caldata);
-+ INSERT_CAL(ah, &ah->temp_caldata);
-+
- /* Initialize current pointer to first element in list */
- ah->cal_list_curr = ah->cal_list;
-
---- a/drivers/net/wireless/ath/ath9k/hw.h
-+++ b/drivers/net/wireless/ath/ath9k/hw.h
-@@ -830,6 +830,7 @@ struct ath_hw {
- /* Calibration */
- u32 supp_cals;
- struct ath9k_cal_list iq_caldata;
-+ struct ath9k_cal_list temp_caldata;
- struct ath9k_cal_list adcgain_caldata;
- struct ath9k_cal_list adcdc_caldata;
- struct ath9k_cal_list *cal_list;
diff --git a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
index 461564350feb43410e5c702a8a67514cdfaa3961..6edef0975431165285a7b937442b5d89b362c807 100644
--- a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
+++ b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
@@ -84,7 +84,7 @@
bool reset_power_on;
bool htc_reset_init;
-@@ -1068,6 +1076,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
+@@ -1067,6 +1075,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
bool ath9k_hw_check_alive(struct ath_hw *ah);
bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode);

View File

@ -1,885 +0,0 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Thu, 13 Oct 2016 10:01:19 +0200
Subject: ath9k: remove intermediate queueing patch until it is fixed properly
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Backport of LEDE 04a69843198f2252992812e35ac05016db4a1a94
diff --git a/package/kernel/mac80211/patches/320-ath9k-Switch-to-using-mac80211-intermediate-software.patch b/package/kernel/mac80211/patches/320-ath9k-Switch-to-using-mac80211-intermediate-software.patch
deleted file mode 100644
index f8b8f86e03ba0786ef410db31d6de2ab691430bd..0000000000000000000000000000000000000000
--- a/package/kernel/mac80211/patches/320-ath9k-Switch-to-using-mac80211-intermediate-software.patch
+++ /dev/null
@@ -1,871 +0,0 @@
-From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= <toke@toke.dk>
-Date: Wed, 6 Jul 2016 21:34:17 +0200
-Subject: [PATCH] ath9k: Switch to using mac80211 intermediate software queues.
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This switches ath9k over to using the mac80211 intermediate software
-queueing mechanism for data packets. It removes the queueing inside the
-driver, except for the retry queue, and instead pulls from mac80211 when
-a packet is needed. The retry queue is used to store a packet that was
-pulled but can't be sent immediately.
-
-The old code path in ath_tx_start that would queue packets has been
-removed completely, as has the qlen limit tunables (since there's no
-longer a queue in the driver to limit).
-
-Based on Tim's original patch set, but reworked quite thoroughly.
-
-Cc: Tim Shepard <shep@alum.mit.edu>
-Cc: Felix Fietkau <nbd@nbd.name>
-Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
----
-
---- a/drivers/net/wireless/ath/ath9k/ath9k.h
-+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
-@@ -91,7 +91,6 @@ int ath_descdma_setup(struct ath_softc *
- #define ATH_RXBUF 512
- #define ATH_TXBUF 512
- #define ATH_TXBUF_RESERVE 5
--#define ATH_MAX_QDEPTH (ATH_TXBUF / 4 - ATH_TXBUF_RESERVE)
- #define ATH_TXMAXTRY 13
- #define ATH_MAX_SW_RETRIES 30
-
-@@ -145,7 +144,9 @@ int ath_descdma_setup(struct ath_softc *
- #define BAW_WITHIN(_start, _bawsz, _seqno) \
- ((((_seqno) - (_start)) & 4095) < (_bawsz))
-
--#define ATH_AN_2_TID(_an, _tidno) (&(_an)->tid[(_tidno)])
-+#define ATH_STA_2_TID(_sta, _tidno) ((struct ath_atx_tid *)(_sta)->txq[_tidno]->drv_priv)
-+#define ATH_VIF_2_TID(_vif) ((struct ath_atx_tid *)(_vif)->txq->drv_priv)
-+#define ATH_AN_2_TID(_an, _tidno) ((_an)->sta ? ATH_STA_2_TID((_an)->sta, _tidno) : ATH_VIF_2_TID((_an)->vif))
-
- #define IS_HT_RATE(rate) (rate & 0x80)
- #define IS_CCK_RATE(rate) ((rate >= 0x18) && (rate <= 0x1e))
-@@ -164,7 +165,6 @@ struct ath_txq {
- spinlock_t axq_lock;
- u32 axq_depth;
- u32 axq_ampdu_depth;
-- bool stopped;
- bool axq_tx_inprogress;
- struct list_head txq_fifo[ATH_TXFIFO_DEPTH];
- u8 txq_headidx;
-@@ -232,7 +232,6 @@ struct ath_buf {
-
- struct ath_atx_tid {
- struct list_head list;
-- struct sk_buff_head buf_q;
- struct sk_buff_head retry_q;
- struct ath_node *an;
- struct ath_txq *txq;
-@@ -247,13 +246,13 @@ struct ath_atx_tid {
- s8 bar_index;
- bool active;
- bool clear_ps_filter;
-+ bool has_queued;
- };
-
- struct ath_node {
- struct ath_softc *sc;
- struct ieee80211_sta *sta; /* station struct we're part of */
- struct ieee80211_vif *vif; /* interface with which we're associated */
-- struct ath_atx_tid tid[IEEE80211_NUM_TIDS];
-
- u16 maxampdu;
- u8 mpdudensity;
-@@ -276,7 +275,6 @@ struct ath_tx_control {
- struct ath_node *an;
- struct ieee80211_sta *sta;
- u8 paprd;
-- bool force_channel;
- };
-
-
-@@ -293,7 +291,6 @@ struct ath_tx {
- struct ath_descdma txdma;
- struct ath_txq *txq_map[IEEE80211_NUM_ACS];
- struct ath_txq *uapsdq;
-- u32 txq_max_pending[IEEE80211_NUM_ACS];
- u16 max_aggr_framelen[IEEE80211_NUM_ACS][4][32];
- };
-
-@@ -585,6 +582,7 @@ void ath9k_release_buffered_frames(struc
- u16 tids, int nframes,
- enum ieee80211_frame_release_type reason,
- bool more_data);
-+void ath9k_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *queue);
-
- /********/
- /* VIFs */
---- a/drivers/net/wireless/ath/ath9k/channel.c
-+++ b/drivers/net/wireless/ath/ath9k/channel.c
-@@ -1007,7 +1007,6 @@ static void ath_scan_send_probe(struct a
- goto error;
-
- txctl.txq = sc->tx.txq_map[IEEE80211_AC_VO];
-- txctl.force_channel = true;
- if (ath_tx_start(sc->hw, skb, &txctl))
- goto error;
-
-@@ -1130,7 +1129,6 @@ ath_chanctx_send_vif_ps_frame(struct ath
- memset(&txctl, 0, sizeof(txctl));
- txctl.txq = sc->tx.txq_map[IEEE80211_AC_VO];
- txctl.sta = sta;
-- txctl.force_channel = true;
- if (ath_tx_start(sc->hw, skb, &txctl)) {
- ieee80211_free_txskb(sc->hw, skb);
- return false;
---- a/drivers/net/wireless/ath/ath9k/debug.c
-+++ b/drivers/net/wireless/ath/ath9k/debug.c
-@@ -600,7 +600,6 @@ static int read_file_xmit(struct seq_fil
- PR("MPDUs XRetried: ", xretries);
- PR("Aggregates: ", a_aggr);
- PR("AMPDUs Queued HW:", a_queued_hw);
-- PR("AMPDUs Queued SW:", a_queued_sw);
- PR("AMPDUs Completed:", a_completed);
- PR("AMPDUs Retried: ", a_retries);
- PR("AMPDUs XRetried: ", a_xretries);
-@@ -629,8 +628,7 @@ static void print_queue(struct ath_softc
- seq_printf(file, "%s: %d ", "qnum", txq->axq_qnum);
- seq_printf(file, "%s: %2d ", "qdepth", txq->axq_depth);
- seq_printf(file, "%s: %2d ", "ampdu-depth", txq->axq_ampdu_depth);
-- seq_printf(file, "%s: %3d ", "pending", txq->pending_frames);
-- seq_printf(file, "%s: %d\n", "stopped", txq->stopped);
-+ seq_printf(file, "%s: %3d\n", "pending", txq->pending_frames);
-
- ath_txq_unlock(sc, txq);
- }
-@@ -1208,7 +1206,6 @@ static const char ath9k_gstrings_stats[]
- AMKSTR(d_tx_mpdu_xretries),
- AMKSTR(d_tx_aggregates),
- AMKSTR(d_tx_ampdus_queued_hw),
-- AMKSTR(d_tx_ampdus_queued_sw),
- AMKSTR(d_tx_ampdus_completed),
- AMKSTR(d_tx_ampdu_retries),
- AMKSTR(d_tx_ampdu_xretries),
-@@ -1288,7 +1285,6 @@ void ath9k_get_et_stats(struct ieee80211
- AWDATA(xretries);
- AWDATA(a_aggr);
- AWDATA(a_queued_hw);
-- AWDATA(a_queued_sw);
- AWDATA(a_completed);
- AWDATA(a_retries);
- AWDATA(a_xretries);
-@@ -1346,14 +1342,6 @@ int ath9k_init_debug(struct ath_hw *ah)
- read_file_xmit);
- debugfs_create_devm_seqfile(sc->dev, "queues", sc->debug.debugfs_phy,
- read_file_queues);
-- debugfs_create_u32("qlen_bk", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
-- &sc->tx.txq_max_pending[IEEE80211_AC_BK]);
-- debugfs_create_u32("qlen_be", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
-- &sc->tx.txq_max_pending[IEEE80211_AC_BE]);
-- debugfs_create_u32("qlen_vi", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
-- &sc->tx.txq_max_pending[IEEE80211_AC_VI]);
-- debugfs_create_u32("qlen_vo", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
-- &sc->tx.txq_max_pending[IEEE80211_AC_VO]);
- debugfs_create_devm_seqfile(sc->dev, "misc", sc->debug.debugfs_phy,
- read_file_misc);
- debugfs_create_devm_seqfile(sc->dev, "reset", sc->debug.debugfs_phy,
---- a/drivers/net/wireless/ath/ath9k/debug.h
-+++ b/drivers/net/wireless/ath/ath9k/debug.h
-@@ -147,7 +147,6 @@ struct ath_interrupt_stats {
- * @completed: Total MPDUs (non-aggr) completed
- * @a_aggr: Total no. of aggregates queued
- * @a_queued_hw: Total AMPDUs queued to hardware
-- * @a_queued_sw: Total AMPDUs queued to software queues
- * @a_completed: Total AMPDUs completed
- * @a_retries: No. of AMPDUs retried (SW)
- * @a_xretries: No. of AMPDUs dropped due to xretries
-@@ -174,7 +173,6 @@ struct ath_tx_stats {
- u32 xretries;
- u32 a_aggr;
- u32 a_queued_hw;
-- u32 a_queued_sw;
- u32 a_completed;
- u32 a_retries;
- u32 a_xretries;
---- a/drivers/net/wireless/ath/ath9k/debug_sta.c
-+++ b/drivers/net/wireless/ath/ath9k/debug_sta.c
-@@ -52,8 +52,8 @@ static ssize_t read_file_node_aggr(struc
- "TID", "SEQ_START", "SEQ_NEXT", "BAW_SIZE",
- "BAW_HEAD", "BAW_TAIL", "BAR_IDX", "SCHED", "PAUSED");
-
-- for (tidno = 0, tid = &an->tid[tidno];
-- tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
-+ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) {
-+ tid = ATH_STA_2_TID(an->sta, tidno);
- txq = tid->txq;
- ath_txq_lock(sc, txq);
- if (tid->active) {
---- a/drivers/net/wireless/ath/ath9k/init.c
-+++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -358,7 +358,6 @@ static int ath9k_init_queues(struct ath_
- for (i = 0; i < IEEE80211_NUM_ACS; i++) {
- sc->tx.txq_map[i] = ath_txq_setup(sc, ATH9K_TX_QUEUE_DATA, i);
- sc->tx.txq_map[i]->mac80211_qnum = i;
-- sc->tx.txq_max_pending[i] = ATH_MAX_QDEPTH;
- }
- return 0;
- }
-@@ -873,6 +872,7 @@ static void ath9k_set_hw_capab(struct at
- hw->max_rate_tries = 10;
- hw->sta_data_size = sizeof(struct ath_node);
- hw->vif_data_size = sizeof(struct ath_vif);
-+ hw->txq_data_size = sizeof(struct ath_atx_tid);
- hw->extra_tx_headroom = 4;
-
- hw->wiphy->available_antennas_rx = BIT(ah->caps.max_rxchains) - 1;
---- a/drivers/net/wireless/ath/ath9k/main.c
-+++ b/drivers/net/wireless/ath/ath9k/main.c
-@@ -2695,4 +2695,5 @@ struct ieee80211_ops ath9k_ops = {
- .sw_scan_start = ath9k_sw_scan_start,
- .sw_scan_complete = ath9k_sw_scan_complete,
- .get_txpower = ath9k_get_txpower,
-+ .wake_tx_queue = ath9k_wake_tx_queue,
- };
---- a/drivers/net/wireless/ath/ath9k/xmit.c
-+++ b/drivers/net/wireless/ath/ath9k/xmit.c
-@@ -65,6 +65,8 @@ static struct ath_buf *ath_tx_setup_buff
- struct ath_txq *txq,
- struct ath_atx_tid *tid,
- struct sk_buff *skb);
-+static int ath_tx_prepare(struct ieee80211_hw *hw, struct sk_buff *skb,
-+ struct ath_tx_control *txctl);
-
- enum {
- MCS_HT20,
-@@ -118,6 +120,26 @@ static void ath_tx_queue_tid(struct ath_
- list_add_tail(&tid->list, list);
- }
-
-+void ath9k_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *queue)
-+{
-+ struct ath_softc *sc = hw->priv;
-+ struct ath_common *common = ath9k_hw_common(sc->sc_ah);
-+ struct ath_atx_tid *tid = (struct ath_atx_tid *) queue->drv_priv;
-+ struct ath_txq *txq = tid->txq;
-+
-+ ath_dbg(common, QUEUE, "Waking TX queue: %pM (%d)\n",
-+ queue->sta ? queue->sta->addr : queue->vif->addr,
-+ tid->tidno);
-+
-+ ath_txq_lock(sc, txq);
-+
-+ tid->has_queued = true;
-+ ath_tx_queue_tid(sc, txq, tid);
-+ ath_txq_schedule(sc, txq);
-+
-+ ath_txq_unlock(sc, txq);
-+}
-+
- static struct ath_frame_info *get_frame_info(struct sk_buff *skb)
- {
- struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
-@@ -160,7 +182,6 @@ static void ath_set_rates(struct ieee802
- static void ath_txq_skb_done(struct ath_softc *sc, struct ath_txq *txq,
- struct sk_buff *skb)
- {
-- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
- struct ath_frame_info *fi = get_frame_info(skb);
- int q = fi->txq;
-
-@@ -171,14 +192,6 @@ static void ath_txq_skb_done(struct ath_
- if (WARN_ON(--txq->pending_frames < 0))
- txq->pending_frames = 0;
-
-- if (txq->stopped &&
-- txq->pending_frames < sc->tx.txq_max_pending[q]) {
-- if (ath9k_is_chanctx_enabled())
-- ieee80211_wake_queue(sc->hw, info->hw_queue);
-- else
-- ieee80211_wake_queue(sc->hw, q);
-- txq->stopped = false;
-- }
- }
-
- static struct ath_atx_tid *
-@@ -188,9 +201,47 @@ ath_get_skb_tid(struct ath_softc *sc, st
- return ATH_AN_2_TID(an, tidno);
- }
-
-+static struct sk_buff *
-+ath_tid_pull(struct ath_atx_tid *tid)
-+{
-+ struct ath_softc *sc = tid->an->sc;
-+ struct ieee80211_hw *hw = sc->hw;
-+ struct ath_tx_control txctl = {
-+ .txq = tid->txq,
-+ .sta = tid->an->sta,
-+ };
-+ struct sk_buff *skb;
-+ struct ath_frame_info *fi;
-+ int q;
-+
-+ if (!tid->has_queued)
-+ return NULL;
-+
-+ skb = ieee80211_tx_dequeue(hw, container_of((void*)tid, struct ieee80211_txq, drv_priv));
-+ if (!skb) {
-+ tid->has_queued = false;
-+ return NULL;
-+ }
-+
-+ if (ath_tx_prepare(hw, skb, &txctl)) {
-+ ieee80211_free_txskb(hw, skb);
-+ return NULL;
-+ }
-+
-+ q = skb_get_queue_mapping(skb);
-+ if (tid->txq == sc->tx.txq_map[q]) {
-+ fi = get_frame_info(skb);
-+ fi->txq = q;
-+ ++tid->txq->pending_frames;
-+ }
-+
-+ return skb;
-+ }
-+
-+
- static bool ath_tid_has_buffered(struct ath_atx_tid *tid)
- {
-- return !skb_queue_empty(&tid->buf_q) || !skb_queue_empty(&tid->retry_q);
-+ return !skb_queue_empty(&tid->retry_q) || tid->has_queued;
- }
-
- static struct sk_buff *ath_tid_dequeue(struct ath_atx_tid *tid)
-@@ -199,46 +250,11 @@ static struct sk_buff *ath_tid_dequeue(s
-
- skb = __skb_dequeue(&tid->retry_q);
- if (!skb)
-- skb = __skb_dequeue(&tid->buf_q);
-+ skb = ath_tid_pull(tid);
-
- return skb;
- }
-
--/*
-- * ath_tx_tid_change_state:
-- * - clears a-mpdu flag of previous session
-- * - force sequence number allocation to fix next BlockAck Window
-- */
--static void
--ath_tx_tid_change_state(struct ath_softc *sc, struct ath_atx_tid *tid)
--{
-- struct ath_txq *txq = tid->txq;
-- struct ieee80211_tx_info *tx_info;
-- struct sk_buff *skb, *tskb;
-- struct ath_buf *bf;
-- struct ath_frame_info *fi;
--
-- skb_queue_walk_safe(&tid->buf_q, skb, tskb) {
-- fi = get_frame_info(skb);
-- bf = fi->bf;
--
-- tx_info = IEEE80211_SKB_CB(skb);
-- tx_info->flags &= ~IEEE80211_TX_CTL_AMPDU;
--
-- if (bf)
-- continue;
--
-- bf = ath_tx_setup_buffer(sc, txq, tid, skb);
-- if (!bf) {
-- __skb_unlink(skb, &tid->buf_q);
-- ath_txq_skb_done(sc, txq, skb);
-- ieee80211_free_txskb(sc->hw, skb);
-- continue;
-- }
-- }
--
--}
--
- static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
- {
- struct ath_txq *txq = tid->txq;
-@@ -873,20 +889,16 @@ static int ath_compute_num_delims(struct
-
- static struct ath_buf *
- ath_tx_get_tid_subframe(struct ath_softc *sc, struct ath_txq *txq,
-- struct ath_atx_tid *tid, struct sk_buff_head **q)
-+ struct ath_atx_tid *tid)
- {
- struct ieee80211_tx_info *tx_info;
- struct ath_frame_info *fi;
-- struct sk_buff *skb;
-+ struct sk_buff *skb, *first_skb = NULL;
- struct ath_buf *bf;
- u16 seqno;
-
- while (1) {
-- *q = &tid->retry_q;
-- if (skb_queue_empty(*q))
-- *q = &tid->buf_q;
--
-- skb = skb_peek(*q);
-+ skb = ath_tid_dequeue(tid);
- if (!skb)
- break;
-
-@@ -898,7 +910,6 @@ ath_tx_get_tid_subframe(struct ath_softc
- bf->bf_state.stale = false;
-
- if (!bf) {
-- __skb_unlink(skb, *q);
- ath_txq_skb_done(sc, txq, skb);
- ieee80211_free_txskb(sc->hw, skb);
- continue;
-@@ -927,8 +938,19 @@ ath_tx_get_tid_subframe(struct ath_softc
- seqno = bf->bf_state.seqno;
-
- /* do not step over block-ack window */
-- if (!BAW_WITHIN(tid->seq_start, tid->baw_size, seqno))
-+ if (!BAW_WITHIN(tid->seq_start, tid->baw_size, seqno)) {
-+ __skb_queue_tail(&tid->retry_q, skb);
-+
-+ /* If there are other skbs in the retry q, they are
-+ * probably within the BAW, so loop immediately to get
-+ * one of them. Otherwise the queue can get stuck. */
-+ if (!skb_queue_is_first(&tid->retry_q, skb) && skb != first_skb) {
-+ if(!first_skb) /* infinite loop prevention */
-+ first_skb = skb;
-+ continue;
-+ }
- break;
-+ }
-
- if (tid->bar_index > ATH_BA_INDEX(tid->seq_start, seqno)) {
- struct ath_tx_status ts = {};
-@@ -936,7 +958,6 @@ ath_tx_get_tid_subframe(struct ath_softc
-
- INIT_LIST_HEAD(&bf_head);
- list_add(&bf->list, &bf_head);
-- __skb_unlink(skb, *q);
- ath_tx_update_baw(sc, tid, seqno);
- ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
- continue;
-@@ -948,11 +969,10 @@ ath_tx_get_tid_subframe(struct ath_softc
- return NULL;
- }
-
--static bool
-+static int
- ath_tx_form_aggr(struct ath_softc *sc, struct ath_txq *txq,
- struct ath_atx_tid *tid, struct list_head *bf_q,
-- struct ath_buf *bf_first, struct sk_buff_head *tid_q,
-- int *aggr_len)
-+ struct ath_buf *bf_first)
- {
- #define PADBYTES(_len) ((4 - ((_len) % 4)) % 4)
- struct ath_buf *bf = bf_first, *bf_prev = NULL;
-@@ -962,12 +982,13 @@ ath_tx_form_aggr(struct ath_softc *sc, s
- struct ieee80211_tx_info *tx_info;
- struct ath_frame_info *fi;
- struct sk_buff *skb;
-- bool closed = false;
-+
-
- bf = bf_first;
- aggr_limit = ath_lookup_rate(sc, bf, tid);
-
-- do {
-+ while (bf)
-+ {
- skb = bf->bf_mpdu;
- fi = get_frame_info(skb);
-
-@@ -976,12 +997,12 @@ ath_tx_form_aggr(struct ath_softc *sc, s
- if (nframes) {
- if (aggr_limit < al + bpad + al_delta ||
- ath_lookup_legacy(bf) || nframes >= h_baw)
-- break;
-+ goto stop;
-
- tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
- if ((tx_info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) ||
- !(tx_info->flags & IEEE80211_TX_CTL_AMPDU))
-- break;
-+ goto stop;
- }
-
- /* add padding for previous frame to aggregation length */
-@@ -1003,20 +1024,18 @@ ath_tx_form_aggr(struct ath_softc *sc, s
- ath_tx_addto_baw(sc, tid, bf);
- bf->bf_state.ndelim = ndelim;
-
-- __skb_unlink(skb, tid_q);
- list_add_tail(&bf->list, bf_q);
- if (bf_prev)
- bf_prev->bf_next = bf;
-
- bf_prev = bf;
-
-- bf = ath_tx_get_tid_subframe(sc, txq, tid, &tid_q);
-- if (!bf) {
-- closed = true;
-- break;
-- }
-- } while (ath_tid_has_buffered(tid));
--
-+ bf = ath_tx_get_tid_subframe(sc, txq, tid);
-+ }
-+ goto finish;
-+stop:
-+ __skb_queue_tail(&tid->retry_q, bf->bf_mpdu);
-+finish:
- bf = bf_first;
- bf->bf_lastbf = bf_prev;
-
-@@ -1027,9 +1046,7 @@ ath_tx_form_aggr(struct ath_softc *sc, s
- TX_STAT_INC(txq->axq_qnum, a_aggr);
- }
-
-- *aggr_len = al;
--
-- return closed;
-+ return al;
- #undef PADBYTES
- }
-
-@@ -1406,18 +1423,15 @@ static void ath_tx_fill_desc(struct ath_
- static void
- ath_tx_form_burst(struct ath_softc *sc, struct ath_txq *txq,
- struct ath_atx_tid *tid, struct list_head *bf_q,
-- struct ath_buf *bf_first, struct sk_buff_head *tid_q)
-+ struct ath_buf *bf_first)
- {
- struct ath_buf *bf = bf_first, *bf_prev = NULL;
-- struct sk_buff *skb;
- int nframes = 0;
-
- do {
- struct ieee80211_tx_info *tx_info;
-- skb = bf->bf_mpdu;
-
- nframes++;
-- __skb_unlink(skb, tid_q);
- list_add_tail(&bf->list, bf_q);
- if (bf_prev)
- bf_prev->bf_next = bf;
-@@ -1426,13 +1440,15 @@ ath_tx_form_burst(struct ath_softc *sc,
- if (nframes >= 2)
- break;
-
-- bf = ath_tx_get_tid_subframe(sc, txq, tid, &tid_q);
-+ bf = ath_tx_get_tid_subframe(sc, txq, tid);
- if (!bf)
- break;
-
- tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
-- if (tx_info->flags & IEEE80211_TX_CTL_AMPDU)
-+ if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) {
-+ __skb_queue_tail(&tid->retry_q, bf->bf_mpdu);
- break;
-+ }
-
- ath_set_rates(tid->an->vif, tid->an->sta, bf, false);
- } while (1);
-@@ -1443,34 +1459,33 @@ static bool ath_tx_sched_aggr(struct ath
- {
- struct ath_buf *bf;
- struct ieee80211_tx_info *tx_info;
-- struct sk_buff_head *tid_q;
- struct list_head bf_q;
- int aggr_len = 0;
-- bool aggr, last = true;
-+ bool aggr;
-
- if (!ath_tid_has_buffered(tid))
- return false;
-
- INIT_LIST_HEAD(&bf_q);
-
-- bf = ath_tx_get_tid_subframe(sc, txq, tid, &tid_q);
-+ bf = ath_tx_get_tid_subframe(sc, txq, tid);
- if (!bf)
- return false;
-
- tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
- aggr = !!(tx_info->flags & IEEE80211_TX_CTL_AMPDU);
- if ((aggr && txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH) ||
-- (!aggr && txq->axq_depth >= ATH_NON_AGGR_MIN_QDEPTH)) {
-+ (!aggr && txq->axq_depth >= ATH_NON_AGGR_MIN_QDEPTH)) {
-+ __skb_queue_tail(&tid->retry_q, bf->bf_mpdu);
- *stop = true;
- return false;
- }
-
- ath_set_rates(tid->an->vif, tid->an->sta, bf, false);
- if (aggr)
-- last = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf,
-- tid_q, &aggr_len);
-+ aggr_len = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf);
- else
-- ath_tx_form_burst(sc, txq, tid, &bf_q, bf, tid_q);
-+ ath_tx_form_burst(sc, txq, tid, &bf_q, bf);
-
- if (list_empty(&bf_q))
- return false;
-@@ -1513,9 +1528,6 @@ int ath_tx_aggr_start(struct ath_softc *
- an->mpdudensity = density;
- }
-
-- /* force sequence number allocation for pending frames */
-- ath_tx_tid_change_state(sc, txtid);
--
- txtid->active = true;
- *ssn = txtid->seq_start = txtid->seq_next;
- txtid->bar_index = -1;
-@@ -1540,7 +1552,6 @@ void ath_tx_aggr_stop(struct ath_softc *
- ath_txq_lock(sc, txq);
- txtid->active = false;
- ath_tx_flush_tid(sc, txtid);
-- ath_tx_tid_change_state(sc, txtid);
- ath_txq_unlock_complete(sc, txq);
- }
-
-@@ -1550,14 +1561,12 @@ void ath_tx_aggr_sleep(struct ieee80211_
- struct ath_common *common = ath9k_hw_common(sc->sc_ah);
- struct ath_atx_tid *tid;
- struct ath_txq *txq;
-- bool buffered;
- int tidno;
-
- ath_dbg(common, XMIT, "%s called\n", __func__);
-
-- for (tidno = 0, tid = &an->tid[tidno];
-- tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
--
-+ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) {
-+ tid = ATH_AN_2_TID(an, tidno);
- txq = tid->txq;
-
- ath_txq_lock(sc, txq);
-@@ -1567,13 +1576,12 @@ void ath_tx_aggr_sleep(struct ieee80211_
- continue;
- }
-
-- buffered = ath_tid_has_buffered(tid);
-+ if (!skb_queue_empty(&tid->retry_q))
-+ ieee80211_sta_set_buffered(sta, tid->tidno, true);
-
- list_del_init(&tid->list);
-
- ath_txq_unlock(sc, txq);
--
-- ieee80211_sta_set_buffered(sta, tidno, buffered);
- }
- }
-
-@@ -1586,19 +1594,16 @@ void ath_tx_aggr_wakeup(struct ath_softc
-
- ath_dbg(common, XMIT, "%s called\n", __func__);
-
-- for (tidno = 0, tid = &an->tid[tidno];
-- tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
--
-+ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) {
-+ tid = ATH_AN_2_TID(an, tidno);
- txq = tid->txq;
-
- ath_txq_lock(sc, txq);
- tid->clear_ps_filter = true;
--
- if (ath_tid_has_buffered(tid)) {
- ath_tx_queue_tid(sc, txq, tid);
- ath_txq_schedule(sc, txq);
- }
--
- ath_txq_unlock_complete(sc, txq);
- }
- }
-@@ -1621,11 +1626,6 @@ void ath_tx_aggr_resume(struct ath_softc
-
- tid->baw_size = IEEE80211_MIN_AMPDU_BUF << sta->ht_cap.ampdu_factor;
-
-- if (ath_tid_has_buffered(tid)) {
-- ath_tx_queue_tid(sc, txq, tid);
-- ath_txq_schedule(sc, txq);
-- }
--
- ath_txq_unlock_complete(sc, txq);
- }
-
-@@ -1641,7 +1641,6 @@ void ath9k_release_buffered_frames(struc
- struct ieee80211_tx_info *info;
- struct list_head bf_q;
- struct ath_buf *bf_tail = NULL, *bf;
-- struct sk_buff_head *tid_q;
- int sent = 0;
- int i;
-
-@@ -1656,11 +1655,10 @@ void ath9k_release_buffered_frames(struc
-
- ath_txq_lock(sc, tid->txq);
- while (nframes > 0) {
-- bf = ath_tx_get_tid_subframe(sc, sc->tx.uapsdq, tid, &tid_q);
-+ bf = ath_tx_get_tid_subframe(sc, sc->tx.uapsdq, tid);
- if (!bf)
- break;
-
-- __skb_unlink(bf->bf_mpdu, tid_q);
- list_add_tail(&bf->list, &bf_q);
- ath_set_rates(tid->an->vif, tid->an->sta, bf, true);
- if (bf_isampdu(bf)) {
-@@ -1675,7 +1673,7 @@ void ath9k_release_buffered_frames(struc
- sent++;
- TX_STAT_INC(txq->axq_qnum, a_queued_hw);
-
-- if (an->sta && !ath_tid_has_buffered(tid))
-+ if (an->sta && skb_queue_empty(&tid->retry_q))
- ieee80211_sta_set_buffered(an->sta, i, false);
- }
- ath_txq_unlock_complete(sc, tid->txq);
-@@ -1902,13 +1900,7 @@ bool ath_drain_all_txq(struct ath_softc
- if (!ATH_TXQ_SETUP(sc, i))
- continue;
-
-- /*
-- * The caller will resume queues with ieee80211_wake_queues.
-- * Mark the queue as not stopped to prevent ath_tx_complete
-- * from waking the queue too early.
-- */
- txq = &sc->tx.txq[i];
-- txq->stopped = false;
- ath_draintxq(sc, txq);
- }
-
-@@ -2308,15 +2300,12 @@ int ath_tx_start(struct ieee80211_hw *hw
- struct ath_txq *txq = txctl->txq;
- struct ath_atx_tid *tid = NULL;
- struct ath_buf *bf;
-- bool queue, ps_resp;
-+ bool ps_resp;
- int q, ret;
-
- if (vif)
- avp = (void *)vif->drv_priv;
-
-- if (info->flags & IEEE80211_TX_CTL_TX_OFFCHAN)
-- txctl->force_channel = true;
--
- ps_resp = !!(info->control.flags & IEEE80211_TX_CTRL_PS_RESPONSE);
-
- ret = ath_tx_prepare(hw, skb, txctl);
-@@ -2331,63 +2320,13 @@ int ath_tx_start(struct ieee80211_hw *hw
-
- q = skb_get_queue_mapping(skb);
-
-+ if (ps_resp)
-+ txq = sc->tx.uapsdq;
-+
- ath_txq_lock(sc, txq);
- if (txq == sc->tx.txq_map[q]) {
- fi->txq = q;
-- if (++txq->pending_frames > sc->tx.txq_max_pending[q] &&
-- !txq->stopped) {
-- if (ath9k_is_chanctx_enabled())
-- ieee80211_stop_queue(sc->hw, info->hw_queue);
-- else
-- ieee80211_stop_queue(sc->hw, q);
-- txq->stopped = true;
-- }
-- }
--
-- queue = ieee80211_is_data_present(hdr->frame_control);
--
-- /* If chanctx, queue all null frames while NOA could be there */
-- if (ath9k_is_chanctx_enabled() &&
-- ieee80211_is_nullfunc(hdr->frame_control) &&
-- !txctl->force_channel)
-- queue = true;
--
-- /* Force queueing of all frames that belong to a virtual interface on
-- * a different channel context, to ensure that they are sent on the
-- * correct channel.
-- */
-- if (((avp && avp->chanctx != sc->cur_chan) ||
-- sc->cur_chan->stopped) && !txctl->force_channel) {
-- if (!txctl->an)
-- txctl->an = &avp->mcast_node;
-- queue = true;
-- ps_resp = false;
-- }
--
-- if (txctl->an && queue)
-- tid = ath_get_skb_tid(sc, txctl->an, skb);
--
-- if (ps_resp) {
-- ath_txq_unlock(sc, txq);
-- txq = sc->tx.uapsdq;
-- ath_txq_lock(sc, txq);
-- } else if (txctl->an && queue) {
-- WARN_ON(tid->txq != txctl->txq);
--
-- if (info->flags & IEEE80211_TX_CTL_CLEAR_PS_FILT)
-- tid->clear_ps_filter = true;
--
-- /*
-- * Add this frame to software queue for scheduling later
-- * for aggregation.
-- */
-- TX_STAT_INC(txq->axq_qnum, a_queued_sw);
-- __skb_queue_tail(&tid->buf_q, skb);
-- if (!txctl->an->sleeping)
-- ath_tx_queue_tid(sc, txq, tid);
--
-- ath_txq_schedule(sc, txq);
-- goto out;
-+ ++txq->pending_frames;
- }
-
- bf = ath_tx_setup_buffer(sc, txq, tid, skb);
-@@ -2871,9 +2810,8 @@ void ath_tx_node_init(struct ath_softc *
- struct ath_atx_tid *tid;
- int tidno, acno;
-
-- for (tidno = 0, tid = &an->tid[tidno];
-- tidno < IEEE80211_NUM_TIDS;
-- tidno++, tid++) {
-+ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) {
-+ tid = ATH_AN_2_TID(an, tidno);
- tid->an = an;
- tid->tidno = tidno;
- tid->seq_start = tid->seq_next = 0;
-@@ -2881,11 +2819,14 @@ void ath_tx_node_init(struct ath_softc *
- tid->baw_head = tid->baw_tail = 0;
- tid->active = false;
- tid->clear_ps_filter = true;
-- __skb_queue_head_init(&tid->buf_q);
-+ tid->has_queued = false;
- __skb_queue_head_init(&tid->retry_q);
- INIT_LIST_HEAD(&tid->list);
- acno = TID_TO_WME_AC(tidno);
- tid->txq = sc->tx.txq_map[acno];
-+
-+ if (!an->sta)
-+ break; /* just one multicast ath_atx_tid */
- }
- }
-
-@@ -2895,9 +2836,8 @@ void ath_tx_node_cleanup(struct ath_soft
- struct ath_txq *txq;
- int tidno;
-
-- for (tidno = 0, tid = &an->tid[tidno];
-- tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
--
-+ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) {
-+ tid = ATH_AN_2_TID(an, tidno);
- txq = tid->txq;
-
- ath_txq_lock(sc, txq);
-@@ -2909,6 +2849,9 @@ void ath_tx_node_cleanup(struct ath_soft
- tid->active = false;
-
- ath_txq_unlock(sc, txq);
-+
-+ if (!an->sta)
-+ break; /* just one multicast ath_atx_tid */
- }
- }
-

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