Browse Source

Fresh pull from upstream

RISCi_ATOM 7 years ago
parent
commit
71a6d1298d
100 changed files with 3221 additions and 1223 deletions
  1. 6 0
      Makefile
  2. 0 53
      config/Config-build.in
  3. 1 2
      config/Config-images.in
  4. 22 0
      config/Config-kernel.in
  5. 1 1
      include/depends.mk
  6. 112 20
      include/download.mk
  7. 12 27
      include/host-build.mk
  8. 5 0
      include/image-commands.mk
  9. 3 3
      include/image-legacy.mk
  10. 9 7
      include/image.mk
  11. 1 1
      include/kernel-build.mk
  12. 1 1
      include/kernel-defaults.mk
  13. 5 7
      include/kernel-version.mk
  14. 10 1
      include/kernel.mk
  15. 1 4
      include/netfilter.mk
  16. 9 0
      include/package-ipkg.mk
  17. 17 29
      include/package.mk
  18. 4 17
      include/prereq-build.mk
  19. 2 1
      include/quilt.mk
  20. 2 2
      include/scan.mk
  21. 0 22
      include/shell.sh
  22. 1 1
      include/subdir.mk
  23. 4 1
      include/toplevel.mk
  24. 2 7
      include/unpack.mk
  25. 1 1
      include/version.mk
  26. 7 29
      package/Makefile
  27. 1 1
      package/base-files/Makefile
  28. 1 1
      package/base-files/files/bin/config_generate
  29. 1 1
      package/base-files/files/etc/profile
  30. 5 0
      package/base-files/files/lib/functions.sh
  31. 92 1
      package/base-files/files/lib/upgrade/common.sh
  32. 14 44
      package/base-files/image-config.in
  33. 1 1
      package/devel/binutils/Makefile
  34. 1 1
      package/devel/gdb-arc/Makefile
  35. 1 1
      package/devel/gdb/Makefile
  36. 0 16
      package/devel/gdb/patches/002-remove-arguments.patch
  37. 2 2
      package/devel/strace/Makefile
  38. 1 3
      package/devel/strace/patches/100-workaround--pt-reg-collisions-ppc.patch
  39. 1 3
      package/devel/trace-cmd/Makefile
  40. 1 1
      package/devel/valgrind/Makefile
  41. 30 0
      package/kernel/hwmon-gsc/Makefile
  42. 1 0
      package/kernel/hwmon-gsc/src/Makefile
  43. 308 0
      package/kernel/hwmon-gsc/src/gsc.c
  44. 5 7
      package/kernel/kmod-sched-cake/Makefile
  45. 1 2
      package/kernel/linux/Makefile
  46. 0 19
      package/kernel/linux/modules/block.mk
  47. 22 90
      package/kernel/linux/modules/crypto.mk
  48. 3 3
      package/kernel/linux/modules/fs.mk
  49. 24 9
      package/kernel/linux/modules/hwmon.mk
  50. 0 47
      package/kernel/linux/modules/i2c.mk
  51. 17 9
      package/kernel/linux/modules/lib.mk
  52. 33 51
      package/kernel/linux/modules/netdevices.mk
  53. 22 0
      package/kernel/linux/modules/netfilter.mk
  54. 4 137
      package/kernel/linux/modules/other.mk
  55. 47 8
      package/kernel/linux/modules/pcmcia.mk
  56. 0 17
      package/kernel/linux/modules/spi.mk
  57. 4 234
      package/kernel/linux/modules/usb.mk
  58. 1 1
      package/kernel/linux/modules/w1.mk
  59. 94 11
      package/kernel/mac80211/Makefile
  60. 36 1
      package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  61. 1 1
      package/kernel/mac80211/patches/004-fix_duplicate_skcipher_backport.patch
  62. 3 2
      package/kernel/mac80211/patches/315-ath9k_hw-issue-external-reset-for-QCA955x.patch
  63. 1 1
      package/kernel/mac80211/patches/325-ath9k-fix-ath9k_hw_gpio_get-to-return-0-or-1-on-succ.patch
  64. 65 0
      package/kernel/mac80211/patches/329-ath9k-unlock-rcu-read-when-returning-early.patch
  65. 196 0
      package/kernel/mac80211/patches/334-mac80211-minstrel_ht-move-supported-bitrate-mask-out.patch
  66. 70 0
      package/kernel/mac80211/patches/335-mac80211-minstrel_ht-move-short-preamble-check-out-o.patch
  67. 22 0
      package/kernel/mac80211/patches/336-mac80211-minstrel_ht-make-att_hist-and-succ_hist-u32.patch
  68. 34 0
      package/kernel/mac80211/patches/337-mac80211-check-for-MCS-in-ieee80211_duration-before-.patch
  69. 192 0
      package/kernel/mac80211/patches/338-mac80211-minstrel-remove-cur_prob-from-debugfs.patch
  70. 22 0
      package/kernel/mac80211/patches/339-mac80211-minstrel-reduce-MINSTREL_SCALE.patch
  71. 186 0
      package/kernel/mac80211/patches/340-mac80211-minstrel-store-probability-variance-instead.patch
  72. 20 0
      package/kernel/mac80211/patches/341-mac80211-minstrel-make-prob_ewma-u16-instead-of-u32.patch
  73. 80 0
      package/kernel/mac80211/patches/342-mac80211-minstrel_ht-remove-obsolete-if-for-3-stream.patch
  74. 150 0
      package/kernel/mac80211/patches/343-cfg80211-limit-scan-results-cache-size.patch
  75. 23 0
      package/kernel/mac80211/patches/346-ath5k-drop-bogus-warning-on-drv_set_key-with-unsuppo.patch
  76. 101 0
      package/kernel/mac80211/patches/347-0001-cfg80211-move-function-checking-range-fit-to-util.c.patch
  77. 211 0
      package/kernel/mac80211/patches/347-0002-cfg80211-support-ieee80211-freq-limit-DT-property.patch
  78. 26 0
      package/kernel/mac80211/patches/347-ath9k-don-t-run-periodic-and-nf-calibation-at-the-sa.patch
  79. 3 2
      package/kernel/mac80211/patches/400-ath_move_debug_code.patch
  80. 1 1
      package/kernel/mac80211/patches/401-ath9k_blink_default.patch
  81. 1 1
      package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
  82. 1 1
      package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  83. 1 1
      package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  84. 0 28
      package/kernel/mac80211/patches/541-ath9k_rx_dma_stop_check.patch
  85. 2 2
      package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  86. 3 3
      package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  87. 4 4
      package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch
  88. 23 27
      package/kernel/mac80211/patches/556-ath9k-define-all-EEPROM-fields-in-Little-Endian-form.patch
  89. 0 77
      package/kernel/mmc_over_gpio/Makefile
  90. 0 8
      package/kernel/mmc_over_gpio/files/mmc_over_gpio.config
  91. 0 83
      package/kernel/mmc_over_gpio/files/mmc_over_gpio.init
  92. 33 0
      package/kernel/rtc-rv5c386a/Makefile
  93. 18 0
      package/kernel/rtc-rv5c386a/src/Makefile
  94. 613 0
      package/kernel/rtc-rv5c386a/src/rtc.c
  95. 1 1
      package/libs/argp-standalone/Makefile
  96. 4 3
      package/libs/cyassl/Makefile
  97. 5 3
      package/libs/elfutils/Makefile
  98. 0 14
      package/libs/elfutils/patches/004-memcpy_def.patch
  99. 1 1
      package/libs/elfutils/patches/006-libdw_LIBS.patch
  100. 92 0
      package/libs/elfutils/patches/007-fix_TEMP_FAILURE_RETRY.patch

+ 6 - 0
Makefile

@@ -44,6 +44,7 @@ $(target/stamp-compile): $(toolchain/stamp-install) $(tools/stamp-install) $(BUI
 $(package/stamp-compile): $(target/stamp-compile) $(package/stamp-cleanup)
 $(package/stamp-install): $(package/stamp-compile)
 $(target/stamp-install): $(package/stamp-compile) $(package/stamp-install)
+check: $(tools/stamp-check) $(toolchain/stamp-check) $(package/stamp-check)
 
 printdb:
 	@true
@@ -86,9 +87,14 @@ prereq: $(target/stamp-prereq) tmp/.prereq_packages
 checksum: FORCE
 	$(call sha256sums,$(BIN_DIR))
 
+diffconfig: FORCE
+	mkdir -p $(BIN_DIR)
+	$(SCRIPT_DIR)/diffconfig.sh > $(BIN_DIR)/config.seed
+
 prepare: .config $(tools/stamp-install) $(toolchain/stamp-install)
 world: prepare $(target/stamp-compile) $(package/stamp-compile) $(package/stamp-install) $(target/stamp-install) FORCE
 	$(_SINGLE)$(SUBMAKE) -r package/index
+	$(_SINGLE)$(SUBMAKE) -r diffconfig
 	$(_SINGLE)$(SUBMAKE) -r checksum
 
 .PHONY: clean dirclean prereq prepare world package/symlinks package/symlinks-install package/symlinks-clean

+ 0 - 53
config/Config-build.in

@@ -87,59 +87,6 @@ menu "Global build settings"
 		help
 		  Enables IPv6 support in kernel (builtin) and packages.
 
-	config PKG_BUILD_PARALLEL
-		bool
-		prompt "Compile certain packages parallelized"
-		default y
-		help
-		  This adds a -jX option to certain packages that are known to behave well
-		  for parallel build. By default, the package make processes use the main
-		  jobserver, in which case this option only takes effect when you add -jX
-		  to the make command.
-
-		  If you are unsure, select N.
-
-	config PKG_BUILD_USE_JOBSERVER
-		bool
-		prompt "Use top-level make jobserver for packages"
-		depends on PKG_BUILD_PARALLEL
-		default y
-		help
-		  This passes the main make process jobserver fds to package builds,
-		  enabling full parallelization across different packages.
-
-		  Note that disabling this may overcommit CPU resources depending on the
-		  -j level of the main make process, the number of package submake jobs
-		  selected below and the number of actual CPUs present.
-		  Example: If the main make is passed a -j4 and the submake -j
-		  is also set to 4, we may end up with 16 parallel make processes
-		  in the worst case.
-
-	config PKG_BUILD_JOBS
-		int
-		prompt "Number of package submake jobs (2-512)"
-		range 2 512
-		default 2
-		depends on PKG_BUILD_PARALLEL && !PKG_BUILD_USE_JOBSERVER
-		help
-		  The number of jobs (-jX) to pass to packages submake.
-
-	config PKG_DEFAULT_PARALLEL
-		bool
-		prompt "Parallelize the default package build rule (May break build)"
-		depends on PKG_BUILD_PARALLEL
-		depends on BROKEN
-		default n
-		help
-		  Always set the default package build rules to parallel build.
-
-		  WARNING: This may break build or kill your cat, as it builds packages
-		  with multiple jobs that are probably not tested in a parallel build
-		  environment.
-
-		  Only say Y if you don't mind fixing broken packages.  Before reporting
-		  build bugs, set this to N and re-run the build.
-
 	comment "Stripping options"
 
 	choice

+ 1 - 2
config/Config-images.in

@@ -253,8 +253,7 @@ menu "Target Images"
 	config TARGET_ROOTFS_PARTSIZE
 		int "Root filesystem partition size (in MB)"
 		depends on GRUB_IMAGES || TARGET_ROOTFS_EXT4FS || TARGET_rb532 || TARGET_mvebu || TARGET_uml
-		default 2048 if TARGET_x86
-		default 256 if ! TARGET_x86
+		default 256
 		help
 		  Select the root filesystem partition size.
 

+ 22 - 0
config/Config-kernel.in

@@ -190,6 +190,14 @@ config KERNEL_MAGIC_SYSRQ
 	bool "Compile the kernel with SysRq support"
 	default y
 
+config KERNEL_DEBUG_PINCTRL
+	bool "Compile the kernel with pinctrl debugging"
+	select KERNEL_DEBUG_KERNEL
+
+config KERNEL_DEBUG_GPIO
+	bool "Compile the kernel with gpio debugging"
+	select KERNEL_DEBUG_KERNEL
+
 config KERNEL_COREDUMP
 	bool
 
@@ -737,3 +745,17 @@ menu "Filesystem ACL and attr support options"
 		default y if USE_FS_ACL_ATTR
 
 endmenu
+
+config KERNEL_DEVMEM
+	bool "/dev/mem virtual device support"
+	help
+	  Say Y here if you want to support the /dev/mem device.
+	  The /dev/mem device is used to access areas of physical
+	  memory.
+
+config KERNEL_DEVKMEM
+	bool "/dev/kmem virtual device support"
+	help
+	  Say Y here if you want to support the /dev/kmem device. The
+	  /dev/kmem device is rarely used, but can be used for certain
+	  kind of kernel debugging operations.

+ 1 - 1
include/depends.mk

@@ -13,7 +13,7 @@
 
 DEP_FINDPARAMS := -x "*/.svn*" -x ".*" -x "*:*" -x "*\!*" -x "* *" -x "*\\\#*" -x "*/.*_check" -x "*/.*.swp"
 
-find_md5=$(SH_FUNC) find $(wildcard $(1)) -type f $(patsubst -x,-and -not -path,$(DEP_FINDPARAMS) $(2)) | md5s
+find_md5=find $(wildcard $(1)) -type f $(patsubst -x,-and -not -path,$(DEP_FINDPARAMS) $(2)) | mkhash md5
 
 define rdep
   .PRECIOUS: $(2)

+ 112 - 20
include/download.mk

@@ -9,6 +9,12 @@
 OPENWRT_GIT = http://git.openwrt.org
 LEDE_GIT = https://git.lede-project.org
 
+ifdef PKG_SOURCE_VERSION
+PKG_VERSION ?= $(if $(PKG_SOURCE_DATE),$(PKG_SOURCE_DATE)-)$(call version_abbrev,$(PKG_SOURCE_VERSION))
+PKG_SOURCE_SUBDIR ?= $(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE ?= $(PKG_SOURCE_SUBDIR).tar.xz
+endif
+
 DOWNLOAD_RDEP=$(STAMP_PREPARED) $(HOST_STAMP_PREPARED)
 
 # Try to guess the download method from the URL
@@ -33,28 +39,94 @@ $(strip \
 endef
 
 # code for creating tarballs from cvs/svn/git/bzr/hg/darcs checkouts - useful for mirror support
-dl_pack/bz2=$(TAR) --owner=0 --group=0 --sort=name $$$${TAR_TIMESTAMP:+--mtime="$$$$TAR_TIMESTAMP"} -cjf $(1) $(2)
-dl_pack/gz=$(TAR) --owner=0 --group=0 --sort=name $$$${TAR_TIMESTAMP:+--mtime="$$$$TAR_TIMESTAMP"} -c $(2) | gzip -nc > $(1)
-dl_pack/xz=$(TAR) --owner=0 --group=0 --sort=name $$$${TAR_TIMESTAMP:+--mtime="$$$$TAR_TIMESTAMP"} -c $(2) | xz -zc -7e > $(1)
-dl_pack/unknown=echo "ERROR: Unknown pack format for file $(1)"; false
+dl_pack/bz2=bzip2 -c > $(1)
+dl_pack/gz=gzip -nc > $(1)
+dl_pack/xz=xz -zc -7e > $(1)
+dl_pack/unknown=$(error ERROR: Unknown pack format for file $(1))
 define dl_pack
 	$(if $(dl_pack/$(call ext,$(1))),$(dl_pack/$(call ext,$(1))),$(dl_pack/unknown))
 endef
+define dl_tar_pack
+	$(TAR) --numeric-owner --owner=0 --group=0 --sort=name $$$${TAR_TIMESTAMP:+--mtime="$$$$TAR_TIMESTAMP"} -c $(2) | $(call dl_pack,$(1))
+endef
+
+ifdef CHECK
+check_escape=$(subst ','\'',$(1))
+#')
+
+check_warn_nofix = $(info $(shell printf "$(_R)WARNING: %s$(_N)" '$(call check_escape,$(call C_$(1),$(2),$(3),$(4)))'))
+ifndef FIXUP
+  check_warn = $(check_warn_nofix)
+else
+  check_warn = $(if $(filter-out undefined,$(origin F_$(1))),$(filter ,$(shell $(call F_$(1),$(2),$(3),$(4)) >&2)),$(check_warn_nofix))
+endif
+
+gen_sha256sum = $(shell mkhash sha256 $(DL_DIR)/$(1))
+
+ifdef FIXUP
+F_hash_deprecated = $(SCRIPT_DIR)/fixup-makefile.pl $(CURDIR)/Makefile fix-hash $(3) $(call gen_sha256sum,$(1)) $(2)
+F_hash_mismatch = $(F_hash_deprecated)
+F_hash_missing = $(SCRIPT_DIR)/fixup-makefile.pl $(CURDIR)/Makefile add-hash $(3) $(call gen_sha256sum,$(1))
+endif
+
+C_download_missing = $(1) is missing, please run make download before re-running this check
+C_hash_mismatch = $(3) does not match $(1) hash $(call gen_sha256sum,$(1))
+C_hash_deprecated = $(3) uses deprecated hash, set to $(call gen_sha256sum,$(1))
+C_hash_missing = $(3) is missing, set to $(call gen_sha256sum,$(1))
+
+check_hash = \
+  $(if $(wildcard $(DL_DIR)/$(1)), \
+    $(if $(filter-out x,$(2)), \
+      $(if $(filter 64,$(shell printf '%s' '$(2)' | wc -c)), \
+        $(if $(filter $(2),$(call gen_sha256sum,$(1))),, \
+          $(call check_warn,hash_mismatch,$(1),$(2),$(3)) \
+        ), \
+        $(call check_warn,hash_deprecated,$(1),$(2),$(3)), \
+      ), \
+      $(call check_warn,hash_missing,$(1),$(2),$(3)) \
+    ), \
+    $(call check_warn,download_missing,$(1),$(2),$(3)) \
+  )
+
+ifdef FIXUP
+F_md5_deprecated = $(SCRIPT_DIR)/fixup-makefile.pl $(CURDIR)/Makefile rename-var $(2) $(3)
+endif
+
+C_md5_deprecated = Use of $(2) is deprecated, switch to $(3)
+
+# Skip MD5SUM check in feeds until OpenWrt is updated
+ifneq ($(filter $(foreach dir,package tools toolchain, $(TOPDIR)/$(dir)/%),$(CURDIR)),)
+check_md5 = \
+  $(if $(filter-out x,$(1)), \
+    $(call check_warn,md5_deprecated,$(1),$(2),$(3)) \
+  )
+endif
+
+hash_var = $(if $(filter-out x,$(1)),MD5SUM,HASH)
+endif
 
 define DownloadMethod/unknown
 	@echo "ERROR: No download method available"; false
 endef
 
 define DownloadMethod/default
-	$(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(FILE)" "$(MD5SUM)" "$(URL_FILE)" $(foreach url,$(URL),"$(url)")
+	$(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(FILE)" "$(HASH)" "$(URL_FILE)" $(foreach url,$(URL),"$(url)") \
+	$(if $(filter check,$(1)), \
+		$(call check_hash,$(FILE),$(HASH),$(2)$(call hash_var,$(MD5SUM))) \
+		$(call check_md5,$(MD5SUM),$(2)MD5SUM,$(2)HASH) \
+	)
 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_HASH))),$(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(FILE)" "$(MIRROR_HASH)" "" || ( $(3) ),$(3)) \
+$(if $(filter check,$(1)), \
+	$(call check_hash,$(FILE),$(MIRROR_HASH),$(2)MIRROR_$(call hash_var,$(MIRROR_MD5SUM))) \
+	$(call check_md5,$(MIRROR_MD5SUM),$(2)MIRROR_MD5SUM,$(2)MIRROR_HASH) \
+)
 endef
 
 define DownloadMethod/cvs
-	$(call wrap_mirror, \
+	$(call wrap_mirror,$(1),$(2), \
 		echo "Checking out files from the cvs repository..."; \
 		mkdir -p $(TMP_DIR)/dl && \
 		cd $(TMP_DIR)/dl && \
@@ -62,14 +134,14 @@ define DownloadMethod/cvs
 		[ \! -d $(SUBDIR) ] && \
 		cvs -d $(URL) export $(VERSION) $(SUBDIR) && \
 		echo "Packing checkout..." && \
-		$(call dl_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \
+		$(call dl_tar_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \
 		mv $(TMP_DIR)/dl/$(FILE) $(DL_DIR)/ && \
 		rm -rf $(SUBDIR); \
 	)
 endef
 
 define DownloadMethod/svn
-	$(call wrap_mirror, \
+	$(call wrap_mirror,$(1),$(2), \
 		echo "Checking out files from the svn repository..."; \
 		mkdir -p $(TMP_DIR)/dl && \
 		cd $(TMP_DIR)/dl && \
@@ -80,14 +152,14 @@ define DownloadMethod/svn
 		svn export --non-interactive -r$(VERSION) $(URL) $(SUBDIR) ) && \
 		echo "Packing checkout..." && \
 		export TAR_TIMESTAMP="" && \
-		$(call dl_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \
+		$(call dl_tar_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \
 		mv $(TMP_DIR)/dl/$(FILE) $(DL_DIR)/ && \
 		rm -rf $(SUBDIR); \
 	)
 endef
 
 define DownloadMethod/git
-	$(call wrap_mirror, \
+	$(call wrap_mirror,$(1),$(2), \
 		echo "Checking out files from the git repository..."; \
 		mkdir -p $(TMP_DIR)/dl && \
 		cd $(TMP_DIR)/dl && \
@@ -99,14 +171,14 @@ define DownloadMethod/git
 		echo "Packing checkout..." && \
 		export TAR_TIMESTAMP=`cd $(SUBDIR) && git log -1 --format='@%ct'` && \
 		rm -rf $(SUBDIR)/.git && \
-		$(call dl_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \
+		$(call dl_tar_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \
 		mv $(TMP_DIR)/dl/$(FILE) $(DL_DIR)/ && \
 		rm -rf $(SUBDIR); \
 	)
 endef
 
 define DownloadMethod/bzr
-	$(call wrap_mirror, \
+	$(call wrap_mirror,$(1),$(2), \
 		echo "Checking out files from the bzr repository..."; \
 		mkdir -p $(TMP_DIR)/dl && \
 		cd $(TMP_DIR)/dl && \
@@ -115,14 +187,14 @@ define DownloadMethod/bzr
 		bzr export --per-file-timestamps -r$(VERSION) $(SUBDIR) $(URL) && \
 		echo "Packing checkout..." && \
 		export TAR_TIMESTAMP="" && \
-		$(call dl_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \
+		$(call dl_tar_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \
 		mv $(TMP_DIR)/dl/$(FILE) $(DL_DIR)/ && \
 		rm -rf $(SUBDIR); \
 	)
 endef
 
 define DownloadMethod/hg
-	$(call wrap_mirror, \
+	$(call wrap_mirror,$(1),$(2), \
 		echo "Checking out files from the hg repository..."; \
 		mkdir -p $(TMP_DIR)/dl && \
 		cd $(TMP_DIR)/dl && \
@@ -132,14 +204,14 @@ define DownloadMethod/hg
 		export TAR_TIMESTAMP=`cd $(SUBDIR) && hg log --template '@{date}' -l 1` && \
 		find $(SUBDIR) -name .hg | xargs rm -rf && \
 		echo "Packing checkout..." && \
-		$(call dl_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \
+		$(call dl_tar_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \
 		mv $(TMP_DIR)/dl/$(FILE) $(DL_DIR)/ && \
 		rm -rf $(SUBDIR); \
 	)
 endef
 
 define DownloadMethod/darcs
-	$(call wrap_mirror, \
+	$(call wrap_mirror, $(1), $(2), \
 		echo "Checking out files from the darcs repository..."; \
 		mkdir -p $(TMP_DIR)/dl && \
 		cd $(TMP_DIR)/dl && \
@@ -149,7 +221,7 @@ define DownloadMethod/darcs
 		export TAR_TIMESTAMP=`cd $(SUBDIR) && LC_ALL=C darcs log --last 1 | sed -ne 's!^Date: \+!!p'` && \
 		find $(SUBDIR) -name _darcs | xargs rm -rf && \
 		echo "Packing checkout..." && \
-		$(call dl_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \
+		$(call dl_tar_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \
 		mv $(TMP_DIR)/dl/$(FILE) $(DL_DIR)/ && \
 		rm -rf $(SUBDIR); \
 	)
@@ -167,14 +239,29 @@ define Download/Defaults
   FILE:=
   URL_FILE:=
   PROTO:=
-  MD5SUM:=
+  HASH=$$(MD5SUM)
+  MD5SUM:=x
   SUBDIR:=
   MIRROR:=1
+  MIRROR_HASH=$$(MIRROR_MD5SUM)
   MIRROR_MD5SUM:=x
   VERSION:=
   OPTS:=
 endef
 
+define Download/default
+  FILE:=$(PKG_SOURCE)
+  URL:=$(PKG_SOURCE_URL)
+  SUBDIR:=$(PKG_SOURCE_SUBDIR)
+  PROTO:=$(PKG_SOURCE_PROTO)
+  $(if $(PKG_SOURCE_MIRROR),MIRROR:=$(filter 1,$(PKG_MIRROR)))
+  $(if $(PKG_MIRROR_MD5SUM),MIRROR_MD5SUM:=$(PKG_MIRROR_MD5SUM))
+  $(if $(PKG_MIRROR_HASH),MIRROR_HASH:=$(PKG_MIRROR_HASH))
+  VERSION:=$(PKG_SOURCE_VERSION)
+  $(if $(PKG_MD5SUM),MD5SUM:=$(PKG_MD5SUM))
+  $(if $(PKG_HASH),HASH:=$(PKG_HASH))
+endef
+
 define Download
   $(eval $(Download/Defaults))
   $(eval $(Download/$(1)))
@@ -191,6 +278,11 @@ define Download
 
   $(DL_DIR)/$(FILE):
 	mkdir -p $(DL_DIR)
-	$(call locked,$(if $(DownloadMethod/$(call dl_method,$(URL),$(PROTO))),$(DownloadMethod/$(call dl_method,$(URL),$(PROTO))),$(DownloadMethod/unknown)),$(FILE))
+	$(call locked, \
+		$(if $(DownloadMethod/$(call dl_method,$(URL),$(PROTO))), \
+			$(call DownloadMethod/$(call dl_method,$(URL),$(PROTO)),check,$(if $(filter default,$(1)),PKG_,Download/$(1):)), \
+			$(DownloadMethod/unknown) \
+		),\
+		$(FILE))
 
 endef

+ 12 - 27
include/host-build.mk

@@ -5,21 +5,18 @@
 # See /LICENSE for more information.
 #
 
+include $(INCLUDE_DIR)/download.mk
+
 HOST_BUILD_DIR ?= $(BUILD_DIR_HOST)/$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION))
 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) $(if $(filter 3.% 4.0 4.1,$(MAKE_VERSION)),-j))
-else
-  HOST_MAKE_J:=-j$(CONFIG_PKG_BUILD_JOBS)
-endif
+HOST_MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) $(if $(filter 3.% 4.0 4.1,$(MAKE_VERSION)),-j))
 
 ifeq ($(strip $(HOST_BUILD_PARALLEL)),0)
 HOST_JOBS?=-j1
 else
-HOST_JOBS?=$(if $(HOST_BUILD_PARALLEL)$(CONFIG_PKG_DEFAULT_PARALLEL),\
-	$(if $(CONFIG_PKG_BUILD_PARALLEL),$(HOST_MAKE_J),-j1),-j1)
+HOST_JOBS?=$(if $(HOST_BUILD_PARALLEL),$(HOST_MAKE_J),-j1)
 endif
 
 include $(INCLUDE_DIR)/host.mk
@@ -35,7 +32,6 @@ HOST_STAMP_INSTALLED:=$(HOST_BUILD_PREFIX)/stamp/.$(PKG_NAME)_installed
 
 override MAKEFLAGS=
 
-include $(INCLUDE_DIR)/download.mk
 include $(INCLUDE_DIR)/quilt.mk
 include $(INCLUDE_DIR)/autotools.mk
 
@@ -52,17 +48,12 @@ define Host/Prepare
   $(call Host/Prepare/Default)
 endef
 
-ifeq ($(HOST_OS),Darwin)
-  HOST_CFLAGS += -I/usr/local/opt/openssl/include
-  HOST_LDFLAGS += -L/usr/local/opt/openssl/lib
-endif
-
 HOST_CONFIGURE_VARS = \
 	CC="$(HOSTCC)" \
 	CFLAGS="$(HOST_CFLAGS)" \
 	CPPFLAGS="$(HOST_CPPFLAGS)" \
 	LDFLAGS="$(HOST_LDFLAGS)" \
-	SHELL="$(SHELL)"
+	CONFIG_SHELL="$(SHELL)"
 
 HOST_CONFIGURE_ARGS = \
 	--target=$(GNU_HOST_NAME) \
@@ -84,9 +75,9 @@ define Host/Configure/Default
 	$(if $(HOST_CONFIGURE_PARALLEL),+)(cd $(HOST_BUILD_DIR)/$(3); \
 		if [ -x configure ]; then \
 			$(CP) $(SCRIPT_DIR)/config.{guess,sub} $(HOST_BUILD_DIR)/$(3)/ && \
+			$(HOST_CONFIGURE_VARS) \
 			$(2) \
 			$(HOST_CONFIGURE_CMD) \
-			$(HOST_CONFIGURE_VARS) \
 			$(HOST_CONFIGURE_ARGS) \
 			$(1); \
 		fi \
@@ -123,16 +114,6 @@ ifneq ($(if $(HOST_QUILT),,$(CONFIG_AUTOREBUILD)),)
   endef
 endif
 
-define Download/default
-  FILE:=$(PKG_SOURCE)
-  URL:=$(PKG_SOURCE_URL)
-  PROTO:=$(PKG_SOURCE_PROTO)
-  SUBDIR:=$(PKG_SOURCE_SUBDIR)
-  VERSION:=$(PKG_SOURCE_VERSION)
-  MD5SUM:=$(PKG_MD5SUM)
-  MIRROR_MD5SUM:=$(PKG_MIRROR_MD5SUM)
-endef
-
 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 STAGING_PREFIX=$$(HOST_BUILD_PREFIX)
@@ -146,9 +127,8 @@ Host/Exports=$(Host/Exports/Default)
 .NOTPARALLEL:
 
 ifndef DUMP
-  define HostBuild
+  define HostBuild/Core
   $(if $(HOST_QUILT),$(Host/Quilt))
-  $(if $(if $(PKG_HOST_ONLY),,$(STAMP_PREPARED)),,$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default)))
   $(if $(DUMP),,$(call HostHost/Autoclean))
 
   $(HOST_STAMP_PREPARED):
@@ -208,3 +188,8 @@ ifndef DUMP
   clean:
 
 endif
+
+define HostBuild
+  $(HostBuild/Core)
+  $(if $(if $(PKG_HOST_ONLY),,$(STAMP_PREPARED)),,$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default)))
+endef

+ 5 - 0
include/image-commands.mk

@@ -190,3 +190,8 @@ metadata_json = \
 define Build/append-metadata
 	$(if $(SUPPORTED_DEVICES),echo $(call metadata_json,$(SUPPORTED_DEVICES)) | fwtool -I - $@)
 endef
+
+define Build/kernel2minor
+	kernel2minor -k $@ -r $@.new $(1)
+	mv $@.new $@
+endef

+ 3 - 3
include/image-legacy.mk

@@ -15,9 +15,9 @@ ifneq ($(CONFIG_TARGET_ROOTFS_UBIFS),)
 		$(STAGING_DIR_HOST)/bin/mkfs.ubifs \
 			$(if $($(PROFILE)_UBIFS_OPTS),$($(PROFILE)_UBIFS_OPTS),$(UBIFS_OPTS)) \
 			$(if $(CONFIG_TARGET_UBIFS_FREE_SPACE_FIXUP),--space-fixup) \
-			$(if $(CONFIG_TARGET_UBIFS_COMPRESSION_NONE),--force-compr=none) \
-			$(if $(CONFIG_TARGET_UBIFS_COMPRESSION_LZO),--force-compr=lzo) \
-			$(if $(CONFIG_TARGET_UBIFS_COMPRESSION_ZLIB),--force-compr=zlib) \
+			$(if $(CONFIG_TARGET_UBIFS_COMPRESSION_NONE),--compr=none) \
+			$(if $(CONFIG_TARGET_UBIFS_COMPRESSION_LZO),--compr=lzo) \
+			$(if $(CONFIG_TARGET_UBIFS_COMPRESSION_ZLIB),--compr=zlib) \
 			$(if $(shell echo $(CONFIG_TARGET_UBIFS_JOURNAL_SIZE)),--jrn-size=$(CONFIG_TARGET_UBIFS_JOURNAL_SIZE)) \
 			--squash-uids \
 			-o $(KDIR)/root.ubifs \

+ 9 - 7
include/image.mk

@@ -33,16 +33,18 @@ param_get_default = $(firstword $(call param_get,$(1),$(2)) $(3))
 param_mangle = $(subst $(space),_,$(strip $(1)))
 param_unmangle = $(subst _,$(space),$(1))
 
-mkfs_packages_id = $(shell echo $(sort $(1)) | md5sum | head -c 8)
+mkfs_packages_id = $(shell echo $(sort $(1)) | mkhash md5 | head -c 8)
 mkfs_target_dir = $(if $(call param_get,pkg,$(1)),$(KDIR)/target-dir-$(call param_get,pkg,$(1)),$(TARGET_DIR))
 
 KDIR=$(KERNEL_BUILD_DIR)
 KDIR_TMP=$(KDIR)/tmp
 DTS_DIR:=$(LINUX_DIR)/arch/$(LINUX_KARCH)/boot/dts
 
-EXTRA_NAME_SANITIZED=$(call sanitize,$(EXTRA_IMAGE_NAME))
+IMG_PREFIX_EXTRA:=$(if $(EXTRA_IMAGE_NAME),$(call sanitize,$(EXTRA_IMAGE_NAME))-)
+IMG_PREFIX_VERNUM:=$(if $(CONFIG_VERSION_FILENAMES),$(call sanitize,$(VERSION_NUMBER))-)
+IMG_PREFIX_VERCODE:=$(if $(CONFIG_VERSION_CODE_FILENAMES),$(call sanitize,$(VERSION_CODE))-)
 
-IMG_PREFIX:=$(VERSION_DIST_SANITIZED)-$(if $(CONFIG_VERSION_FILENAMES),$(VERSION_NUMBER)-)$(if $(EXTRA_NAME_SANITIZED),$(EXTRA_NAME_SANITIZED)-)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))
+IMG_PREFIX:=$(VERSION_DIST_SANITIZED)-$(IMG_PREFIX_VERNUM)$(IMG_PREFIX_VERCODE)$(IMG_PREFIX_EXTRA)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))
 
 MKFS_DEVTABLE_OPT := -D $(INCLUDE_DIR)/device_table.txt
 
@@ -195,7 +197,7 @@ define Image/mkfs/squashfs
 	$(STAGING_DIR_HOST)/bin/mksquashfs4 $(call mkfs_target_dir,$(1)) $@ \
 		-nopad -noappend -root-owned \
 		-comp $(SQUASHFSCOMP) $(SQUASHFSOPT) \
-		-processors $(if $(CONFIG_PKG_BUILD_JOBS),$(CONFIG_PKG_BUILD_JOBS),1) \
+		-processors 1 \
 		$(if $(SOURCE_DATE_EPOCH),-fixed-time $(SOURCE_DATE_EPOCH))
 endef
 
@@ -231,9 +233,9 @@ define Image/mkfs/ubifs
 	$(STAGING_DIR_HOST)/bin/mkfs.ubifs \
 		$(UBIFS_OPTS) $(call param_unmangle,$(call param_get,fs,$(1))) \
 		$(if $(CONFIG_TARGET_UBIFS_FREE_SPACE_FIXUP),--space-fixup) \
-		$(if $(CONFIG_TARGET_UBIFS_COMPRESSION_NONE),--force-compr=none) \
-		$(if $(CONFIG_TARGET_UBIFS_COMPRESSION_LZO),--force-compr=lzo) \
-		$(if $(CONFIG_TARGET_UBIFS_COMPRESSION_ZLIB),--force-compr=zlib) \
+		$(if $(CONFIG_TARGET_UBIFS_COMPRESSION_NONE),--compr=none) \
+		$(if $(CONFIG_TARGET_UBIFS_COMPRESSION_LZO),--compr=lzo) \
+		$(if $(CONFIG_TARGET_UBIFS_COMPRESSION_ZLIB),--compr=zlib) \
 		$(if $(shell echo $(CONFIG_TARGET_UBIFS_JOURNAL_SIZE)),--jrn-size=$(CONFIG_TARGET_UBIFS_JOURNAL_SIZE)) \
 		--squash-uids \
 		-o $@ -d $(call mkfs_target_dir,$(1))

+ 1 - 1
include/kernel-build.mk

@@ -43,7 +43,7 @@ endef
 define Download/kernel
   URL:=$(LINUX_SITE)
   FILE:=$(LINUX_SOURCE)
-  MD5SUM:=$(LINUX_KERNEL_MD5SUM)
+  HASH:=$(LINUX_KERNEL_HASH)
 endef
 
 KERNEL_GIT_OPTS:=

+ 1 - 1
include/kernel-defaults.mk

@@ -125,7 +125,7 @@ define Kernel/Configure/Default
 		cp $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config.prev; \
 	}
 	$(_SINGLE) [ -d $(LINUX_DIR)/user_headers ] || $(MAKE) $(KERNEL_MAKEOPTS) INSTALL_HDR_PATH=$(LINUX_DIR)/user_headers headers_install
-	$(SH_FUNC) grep '=[ym]' $(LINUX_DIR)/.config.set | LC_ALL=C sort | md5s > $(LINUX_DIR)/.vermagic
+	grep '=[ym]' $(LINUX_DIR)/.config.set | LC_ALL=C sort | mkhash md5 > $(LINUX_DIR)/.vermagic
 endef
 
 define Kernel/Configure/Initramfs

+ 5 - 7
include/kernel-version.mk

@@ -3,12 +3,10 @@
 LINUX_RELEASE?=1
 
 LINUX_VERSION-3.18 = .43
-LINUX_VERSION-4.1 = .34
-LINUX_VERSION-4.4 = .36
+LINUX_VERSION-4.4 = .40
 
-LINUX_KERNEL_MD5SUM-3.18.43 = b1faeb4a2e1e70ffe061bdbb3452840a
-LINUX_KERNEL_MD5SUM-4.1.34 = fba99f0f4765ebf01033e69518740a3c
-LINUX_KERNEL_MD5SUM-4.4.36 = 505548da130599c866d92105a8b04758
+LINUX_KERNEL_HASH-3.18.43 = 1236e8123a6ce537d5029232560966feed054ae31776fe8481dd7d18cdd5492c
+LINUX_KERNEL_HASH-4.4.40 = c381411888dd3a78ed86eefabc7b1e63f5c26aaa803184f3325ef4570d14c94e
 
 ifdef KERNEL_PATCHVER
   LINUX_VERSION:=$(KERNEL_PATCHVER)$(strip $(LINUX_VERSION-$(KERNEL_PATCHVER)))
@@ -21,5 +19,5 @@ KERNEL=$(call merge_version,$(wordlist 1,2,$(call split_version,$(KERNEL_BASE)))
 KERNEL_PATCHVER ?= $(KERNEL)
 
 # disable the md5sum check for unknown kernel versions
-LINUX_KERNEL_MD5SUM:=$(LINUX_KERNEL_MD5SUM-$(strip $(LINUX_VERSION)))
-LINUX_KERNEL_MD5SUM?=x
+LINUX_KERNEL_HASH:=$(LINUX_KERNEL_HASH-$(strip $(LINUX_VERSION)))
+LINUX_KERNEL_HASH?=x

+ 10 - 1
include/kernel.mk

@@ -5,8 +5,15 @@
 # See /LICENSE for more information.
 #
 
+ifneq ($(filter check,$(MAKECMDGOALS)),)
+CHECK:=1
+DUMP:=1
+endif
+
 ifeq ($(__target_inc),)
-  include $(INCLUDE_DIR)/target.mk
+  ifndef CHECK
+    include $(INCLUDE_DIR)/target.mk
+  endif
 endif
 
 ifeq ($(DUMP),1)
@@ -148,6 +155,7 @@ define KernelPackage
   $(eval $(call KernelPackage/Defaults))
   $(eval $(call KernelPackage/$(1)))
   $(eval $(call KernelPackage/$(1)/$(BOARD)))
+  $(eval $(call KernelPackage/$(1)/$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic)))
 
   define Package/kmod-$(1)
     TITLE:=$(TITLE)
@@ -159,6 +167,7 @@ define KernelPackage
     PKGFLAGS:=$(PKGFLAGS)
     $(call KernelPackage/$(1))
     $(call KernelPackage/$(1)/$(BOARD))
+    $(call KernelPackage/$(1)/$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic))
   endef
 
   ifdef KernelPackage/$(1)/conffiles

+ 1 - 4
include/netfilter.mk

@@ -39,13 +39,12 @@ $(eval $(if $(NF_KMOD),$(call nf_add,IPT_CORE,CONFIG_IP_NF_FILTER, $(P_V4)iptabl
 $(eval $(if $(NF_KMOD),$(call nf_add,IPT_CORE,CONFIG_IP_NF_MANGLE, $(P_V4)iptable_mangle),))
 
 # userland only
-$(eval $(if $(NF_KMOD),,$(call nf_add,IPT_CORE,CONFIG_IP_NF_IPTABLES, xt_standard ipt_icmp xt_tcp xt_udp xt_comment xt_id xt_set xt_SET)))
+$(eval $(if $(NF_KMOD),,$(call nf_add,IPT_CORE,CONFIG_IP_NF_IPTABLES, xt_standard ipt_icmp xt_tcp xt_udp xt_comment xt_set xt_SET)))
 
 $(eval $(call nf_add,IPT_CORE,CONFIG_NETFILTER_XT_MATCH_LIMIT, $(P_XT)xt_limit))
 $(eval $(call nf_add,IPT_CORE,CONFIG_NETFILTER_XT_MATCH_MAC, $(P_XT)xt_mac))
 $(eval $(call nf_add,IPT_CORE,CONFIG_NETFILTER_XT_MATCH_MULTIPORT, $(P_XT)xt_multiport))
 $(eval $(call nf_add,IPT_CORE,CONFIG_NETFILTER_XT_MATCH_COMMENT, $(P_XT)xt_comment))
-$(eval $(call nf_add,IPT_CORE,CONFIG_NETFILTER_XT_MATCH_ID, $(P_XT)xt_id))
 
 #cluster
 $(eval $(call nf_add,IPT_CLUSTER,CONFIG_NETFILTER_XT_MATCH_CLUSTER, $(P_XT)xt_cluster))
@@ -72,7 +71,6 @@ $(eval $(if $(NF_KMOD),$(call nf_add,NF_CONNTRACK,CONFIG_NF_DEFRAG_IPV4, $(P_V4)
 $(eval $(if $(NF_KMOD),$(call nf_add,NF_CONNTRACK,CONFIG_NF_CONNTRACK_IPV4, $(P_V4)nf_conntrack_ipv4),))
 
 $(eval $(call nf_add,IPT_CONNTRACK,CONFIG_NETFILTER_XT_MATCH_STATE, $(P_XT)xt_state))
-$(eval $(call nf_add,IPT_CONNTRACK,CONFIG_IP_NF_RAW, $(P_V4)iptable_raw))
 $(eval $(call nf_add,IPT_CONNTRACK,CONFIG_NETFILTER_XT_TARGET_CT, $(P_XT)xt_CT))
 $(eval $(call nf_add,IPT_CONNTRACK,CONFIG_NETFILTER_XT_MATCH_CONNTRACK, $(P_XT)xt_conntrack))
 
@@ -151,7 +149,6 @@ $(eval $(if $(NF_KMOD),$(call nf_add,NF_CONNTRACK6,CONFIG_NF_CONNTRACK_IPV6, $(P
 $(eval $(if $(NF_KMOD),$(call nf_add,IPT_IPV6,CONFIG_IP6_NF_FILTER, $(P_V6)ip6table_filter),))
 $(eval $(if $(NF_KMOD),$(call nf_add,IPT_IPV6,CONFIG_IP6_NF_MANGLE, $(P_V6)ip6table_mangle),))
 $(eval $(if $(NF_KMOD),$(call nf_add,IPT_IPV6,CONFIG_IP6_NF_QUEUE, $(P_V6)ip6_queue),))
-$(eval $(if $(NF_KMOD),$(call nf_add,IPT_IPV6,CONFIG_IP6_NF_RAW, $(P_V6)ip6table_raw),))
 $(eval $(if $(NF_KMOD),$(call nf_add,IPT_IPV6,CONFIG_NF_LOG_IPV6, $(P_V6)nf_log_ipv6),))
 
 $(eval $(if $(NF_KMOD),,$(call nf_add,IPT_IPV6,CONFIG_IP6_NF_IPTABLES, ip6t_icmp6)))

+ 9 - 0
include/package-ipkg.mk

@@ -96,7 +96,14 @@ ifeq ($(DUMP),)
     KEEP_$(1):=$(strip $(call Package/$(1)/conffiles))
 
     ifeq ($(BUILD_VARIANT),$$(if $$(VARIANT),$$(VARIANT),$(BUILD_VARIANT)))
+    do_install=
     ifdef Package/$(1)/install
+      do_install=yes
+    endif
+    ifdef Package/$(1)/install-overlay
+      do_install=yes
+    endif
+    ifdef do_install
       ifneq ($(CONFIG_PACKAGE_$(1))$(DEVELOPER),)
         IPKGS += $(1)
         compile: $$(IPKG_$(1)) $(PKG_INFO_DIR)/$(1).provides $(STAGING_DIR_ROOT)/stamp/.$(1)_installed
@@ -178,6 +185,8 @@ $(_endef)
 	@rm -rf $$(IDIR_$(1)) $$(call opkg_package_files,$(1))
 	mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/CONTROL $(PKG_INFO_DIR)
 	$(call Package/$(1)/install,$$(IDIR_$(1)))
+	$(if $(Package/$(1)/install-overlay),mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/rootfs-overlay)
+	$(call Package/$(1)/install-overlay,$$(IDIR_$(1))/rootfs-overlay)
 	-find $$(IDIR_$(1)) -name 'CVS' -o -name '.svn' -o -name '.#*' -o -name '*~'| $(XARGS) rm -rf
 	@( \
 		find $$(IDIR_$(1)) -name lib\*.so\* -or -name \*.ko | awk -F/ '{ print $$$$NF }'; \

+ 17 - 29
include/package.mk

@@ -7,26 +7,22 @@
 
 __package_mk:=1
 
-all: $(if $(DUMP),dumpinfo,compile)
+all: $(if $(DUMP),dumpinfo,$(if $(CHECK),check,compile))
+
+include $(INCLUDE_DIR)/download.mk
 
 PKG_BUILD_DIR ?= $(BUILD_DIR)/$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION))
 PKG_INSTALL_DIR ?= $(PKG_BUILD_DIR)/ipkg-install
-PKG_MD5SUM ?= unknown
 PKG_BUILD_PARALLEL ?=
 PKG_USE_MIPS16 ?= 1
 PKG_IREMAP ?= 1
 
-ifneq ($(CONFIG_PKG_BUILD_USE_JOBSERVER),)
-  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
+MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) $(if $(filter 3.% 4.0 4.1,$(MAKE_VERSION)),-j))
 
 ifeq ($(strip $(PKG_BUILD_PARALLEL)),0)
 PKG_JOBS?=-j1
 else
-PKG_JOBS?=$(if $(PKG_BUILD_PARALLEL)$(CONFIG_PKG_DEFAULT_PARALLEL),\
-	$(if $(CONFIG_PKG_BUILD_PARALLEL),$(MAKE_J),-j1),-j1)
+PKG_JOBS?=$(if $(PKG_BUILD_PARALLEL),$(MAKE_J),-j1)
 endif
 ifdef CONFIG_USE_MIPS16
   ifeq ($(strip $(PKG_USE_MIPS16)),1)
@@ -93,7 +89,6 @@ endif
 
 PKG_INSTALL_STAMP:=$(PKG_INFO_DIR)/$(PKG_DIR_NAME).$(if $(BUILD_VARIANT),$(BUILD_VARIANT),default).install
 
-include $(INCLUDE_DIR)/download.mk
 include $(INCLUDE_DIR)/quilt.mk
 include $(INCLUDE_DIR)/package-defaults.mk
 include $(INCLUDE_DIR)/package-dumpinfo.mk
@@ -118,17 +113,6 @@ ifeq ($(DUMP)$(filter prereq clean refresh update,$(MAKECMDGOALS)),)
   endif
 endif
 
-define Download/default
-  FILE:=$(PKG_SOURCE)
-  URL:=$(PKG_SOURCE_URL)
-  SUBDIR:=$(PKG_SOURCE_SUBDIR)
-  PROTO:=$(PKG_SOURCE_PROTO)
-  $(if $(PKG_SOURCE_MIRROR),MIRROR:=$(filter 1,$(PKG_MIRROR)))
-  $(if $(PKG_MIRROR_MD5SUM),MIRROR_MD5SUM:=$(PKG_MIRROR_MD5SUM))
-  VERSION:=$(PKG_SOURCE_VERSION)
-  MD5SUM:=$(PKG_MD5SUM)
-endef
-
 ifdef USE_GIT_TREE
   define Build/Prepare/Default
 	mkdir -p $(PKG_BUILD_DIR)
@@ -156,9 +140,8 @@ define Build/Exports/Default
 endef
 Build/Exports=$(Build/Exports/Default)
 
-define Build/DefaultTargets
+define Build/CoreTargets
   $(if $(QUILT),$(Build/Quilt))
-  $(if $(USE_SOURCE_DIR)$(USE_GIT_TREE),,$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default)))
   $(call Build/Autoclean)
 
   download:
@@ -223,15 +206,20 @@ define Build/DefaultTargets
     compile: $(STAMP_INSTALLED)
   endif
 
-  define Build/DefaultTargets
-  endef
-
   prepare: $(STAMP_PREPARED)
   configure: $(STAMP_CONFIGURED)
   dist: $(STAMP_CONFIGURED)
   distcheck: $(STAMP_CONFIGURED)
 endef
 
+define Build/DefaultTargets
+  $(if $(USE_SOURCE_DIR)$(USE_GIT_TREE),,$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default)))
+  $(if $(DUMP),,$(Build/CoreTargets))
+
+  define Build/DefaultTargets
+  endef
+endef
+
 define Build/IncludeOverlay
   $(eval -include $(wildcard $(TOPDIR)/overlay/*/$(PKG_DIR_NAME).mk))
   define Build/IncludeOverlay
@@ -263,14 +251,14 @@ endif
   )
 
   $(if $(DUMP), \
-    $(Dumpinfo/Package), \
+    $(if $(CHECK),,$(Dumpinfo/Package)), \
     $(foreach target, \
       $(if $(Package/$(1)/targets),$(Package/$(1)/targets), \
         $(if $(PKG_TARGETS),$(PKG_TARGETS), ipkg) \
       ), $(BuildTarget/$(target)) \
     ) \
   )
-  $(if $(PKG_HOST_ONLY)$(DUMP),,$(call Build/DefaultTargets,$(1)))
+  $(if $(PKG_HOST_ONLY),,$(call Build/DefaultTargets,$(1)))
 endef
 
 define pkg_install_files
@@ -298,7 +286,7 @@ prepare-package-install:
 
 $(PACKAGE_DIR):
 	mkdir -p $@
-	
+
 dumpinfo:
 download:
 prepare:

+ 4 - 17
include/prereq-build.mk

@@ -75,14 +75,6 @@ $(eval $(call TestHostCommand,zlib, \
 	echo 'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' | \
 		gcc -include zlib.h -x c -o $(TMP_DIR)/a.out - $(zlib_link_flags)))
 
-# Xcode deprecated openssl, MacPorts doesn't work nicely for other packages
-ifneq ($(HOST_OS),Darwin)
-$(eval $(call TestHostCommand,libssl, \
-	Please install the openssl library (with development headers), \
-	echo 'int main(int argc, char **argv) { SSL_library_init(); return 0; }' | \
-		gcc $(HOST_CFLAGS) -include openssl/ssl.h -x c -o $(TMP_DIR)/a.out - -lcrypto -lssl $(HOST_LDFLAGS)))
-endif
-
 $(eval $(call TestHostCommand,perl-thread-queue, \
 	Please install the Perl Thread::Queue module, \
 	perl -MThread::Queue -e 1))
@@ -135,11 +127,6 @@ $(eval $(call SetupHostCommand,stat,Cannot find a file stat utility, \
 	gstat -c%s $(TMP_DIR)/.host.mk, \
 	stat -c%s $(TMP_DIR)/.host.mk))
 
-$(eval $(call SetupHostCommand,md5sum,, \
-	gmd5sum /dev/null | grep d41d8cd98f00b204e9800998ecf8427e, \
-	md5sum /dev/null | grep d41d8cd98f00b204e9800998ecf8427e, \
-	$(SCRIPT_DIR)/md5sum /dev/null | grep d41d8cd98f00b204e9800998ecf8427e))
-
 $(eval $(call SetupHostCommand,unzip,Please install 'unzip', \
 	unzip 2>&1 | grep zipfile, \
 	unzip))
@@ -164,11 +151,11 @@ $(eval $(call SetupHostCommand,git,Please install Git (git-core) >= 1.7.12.2, \
 $(eval $(call SetupHostCommand,file,Please install the 'file' package, \
 	file --version 2>&1 | grep file))
 
-ifneq ($(HOST_OS),Darwin)
-$(eval $(call SetupHostCommand,openssl,Please install the 'openssl' utility, \
-	openssl version | grep '\(OpenSSL\|LibreSSL\)'))
-endif
+$(STAGING_DIR_HOST)/bin/mkhash: $(SCRIPT_DIR)/mkhash.c
+	mkdir -p $(dir $@)
+	$(CC) -O2 -I$(TOPDIR)/tools/include -o $@ $<
 
+prereq: $(STAGING_DIR_HOST)/bin/mkhash
 
 # Install ldconfig stub
 $(eval $(call TestHostCommand,ldconfig-stub,Failed to install stub, \

+ 2 - 1
include/quilt.mk

@@ -149,7 +149,8 @@ define Quilt/Template
 		echo "The source directory contains no quilt patches."; \
 		false; \
 	}
-	@[ -n "$$$$(ls $(1)/patches/series)" -o "$$$$(cat $(1)/patches/series | md5sum)" = "$$(sort $(1)/patches/series | md5sum)" ] || { \
+	@[ -n "$$$$(ls $(1)/patches/series)" -o \
+	   "$$$$(cat $(1)/patches/series | mkhash md5)" = "$$(sort $(1)/patches/series | mkhash md5)" ] || { \
 		echo "The patches are not sorted in the right order. Please fix."; \
 		false; \
 	}

+ 2 - 2
include/scan.mk

@@ -51,7 +51,7 @@ $(OVERRIDELIST):
 ifeq ($(SCAN_NAME),target)
   GREP_STRING=BuildTarget
 else
-  GREP_STRING=(Build/DefaultTargets|BuildPackage|.+Package)
+  GREP_STRING=(Build/DefaultTargets|BuildPackage|KernelPackage)
 endif
 
 $(FILELIST): $(OVERRIDELIST)
@@ -85,7 +85,7 @@ $(TMP_DIR)/info/.files-$(SCAN_TARGET).mk: $(FILELIST)
 $(TARGET_STAMP)::
 	+( \
 		$(NO_TRACE_MAKE) $(FILELIST); \
-		MD5SUM=$$(cat $(FILELIST) $(OVERRIDELIST) | (md5sum || md5) 2>/dev/null | awk '{print $$1}'); \
+		MD5SUM=$$(cat $(FILELIST) $(OVERRIDELIST) | mkhash md5 | awk '{print $$1}'); \
 		[ -f "$@.$$MD5SUM" ] || { \
 			rm -f $@.*; \
 			touch $@.$$MD5SUM; \

+ 0 - 22
include/shell.sh

@@ -13,25 +13,3 @@ isset() {
 	eval "var=\"\${$1}\""
 	[ -n "$var" ]
 }
-
-trapret() {(
-	local retvals="$1"; shift
-	local cmd="$1"; shift
-	for retval in $(echo $retvals); do
-		local trap_$retval=1
-	done
-	"$cmd" "$@" || {
-		local retval="$?"
-		eval "trapped=\${trap_$retval}"
-		[ -n "$trapped" ] || {
-			return $retval
-		}
-	}
-)}
-
-md5s() {
-	cat "$@" | (
-		md5sum 2>/dev/null ||
-		md5
-	) | awk '{print $1}'
-}

+ 1 - 1
include/subdir.mk

@@ -9,7 +9,7 @@ ifeq ($(MAKECMDGOALS),prereq)
   SUBTARGETS:=prereq
   PREREQ_ONLY:=1
 else
-  SUBTARGETS:=clean download prepare compile install update refresh prereq dist distcheck configure
+  SUBTARGETS:=clean download prepare compile install update refresh prereq dist distcheck configure check
 endif
 
 subtarget-default = $(filter-out ., \

+ 4 - 1
include/toplevel.mk

@@ -67,7 +67,7 @@ SUBMAKE:=umask 022; $(SUBMAKE)
 
 ULIMIT_FIX=_limit=`ulimit -n`; [ "$$_limit" = "unlimited" -o "$$_limit" -ge 1024 ] || ulimit -n 1024;
 
-prepare-mk: FORCE ;
+prepare-mk: staging_dir/host/.prereq-build FORCE ;
 
 ifdef SDK
   IGNORE_PACKAGES = linux
@@ -179,6 +179,9 @@ clean dirclean: .config
 prereq:: prepare-tmpinfo .config
 	@+$(NO_TRACE_MAKE) -r -s $@
 
+check: .config FORCE
+	@+$(NO_TRACE_MAKE) -r -s $@ QUIET= V=s
+
 WARN_PARALLEL_ERROR = $(if $(BUILD_LOG),,$(and $(filter -j,$(MAKEFLAGS)),$(findstring s,$(OPENWRT_VERBOSE))))
 
 ifeq ($(SDK),1)

+ 2 - 7
include/unpack.mk

@@ -5,14 +5,9 @@
 # See /LICENSE for more information.
 #
 
-# unpacking files with +s may break on some platforms. this typically emits error code 2
-ifneq ($(HOST_OS),Linux)
-  HOST_TAR:=trapret 2 $(TAR)
-else
-  HOST_TAR:=$(TAR)
-endif
+HOST_TAR:=$(TAR)
 TAR_CMD=$(HOST_TAR) -C $(1)/.. $(TAR_OPTIONS)
-UNZIP_CMD=unzip -d $(1)/.. $(DL_DIR)/$(PKG_SOURCE)
+UNZIP_CMD=unzip -q -d $(1)/.. $(DL_DIR)/$(PKG_SOURCE)
 
 ifeq ($(PKG_SOURCE),)
   PKG_UNPACK ?= true

+ 1 - 1
include/version.mk

@@ -50,7 +50,7 @@ VERSION_MANUFACTURER:=$(call qstrip_escape,$(CONFIG_VERSION_MANUFACTURER))
 VERSION_MANUFACTURER:=$(if $(VERSION_MANUFACTURER),$(VERSION_MANUFACTURER),libreCMC)
 
 VERSION_MANUFACTURER_URL:=$(call qstrip_escape,$(CONFIG_VERSION_MANUFACTURER_URL))
-VERSION_MANUFACTURER_URL:=$(if $(VERSION_MANUFACTURER_URL),$(VERSION_MANUFACTURER_URL),https://librecmc.org/librecmc)
+VERSION_MANUFACTURER_URL:=$(if $(VERSION_MANUFACTURER_URL),$(VERSION_MANUFACTURER_URL),https://librecmc.org)
 
 VERSION_BUG_URL:=$(call qstrip_escape,$(CONFIG_VERSION_BUG_URL))
 VERSION_BUG_URL:=$(if $(VERSION_BUG_URL),$(VERSION_BUG_URL))

+ 7 - 29
package/Makefile

@@ -14,6 +14,10 @@ $(curdir)/builddirs:=$(sort $(package-) $(package-y) $(package-m))
 $(curdir)/builddirs-install:=.
 $(curdir)/builddirs-default:=. $(sort $(package-y) $(package-m))
 $(curdir)/builddirs-prereq:=. $(sort $(prereq-y) $(prereq-m))
+ifdef CHECK_ALL
+$(curdir)/builddirs-check:=$($(curdir)/builddirs)
+$(curdir)/builddirs-download:=$($(curdir)/builddirs)
+endif
 ifneq ($(IGNORE_ERRORS),)
   package-y-filter := $(package-y)
   package-m-filter := $(filter-out $(package-y),$(package-m))
@@ -70,21 +74,13 @@ $(curdir)/install: $(TMP_DIR)/.build $(curdir)/system/opkg/host/install $(curdir
 
 	$(call prepare_rootfs,$(TARGET_DIR))
 
-PASSOPT=""
-PASSARG=""
-ifndef CONFIG_OPKGSMIME_PASSPHRASE
-  ifneq ($(call qstrip,$(CONFIG_OPKGSMIME_PASSFILE)),)
-    PASSOPT="-passin"
-    PASSARG="file:$(call qstrip,$(CONFIG_OPKGSMIME_PASSFILE))"
-  endif
-endif
-
 $(curdir)/index: FORCE
 	@echo Generating package index...
 	@for d in $(PACKAGE_SUBDIRS); do ( \
 		mkdir -p $$d; \
 		cd $$d || continue; \
-		$(SCRIPT_DIR)/ipkg-make-index.sh . 2>&1 > Packages && \
+		$(SCRIPT_DIR)/ipkg-make-index.sh . 2>&1 > Packages.manifest; \
+		grep -vE '^(Maintainer|LicenseFiles|Source|Require)' Packages.manifest > Packages && \
 			gzip -9nc Packages > Packages.gz; \
 	); done
 ifdef CONFIG_SIGNED_PACKAGES
@@ -94,25 +90,6 @@ ifdef CONFIG_SIGNED_PACKAGES
 			cd $$d || continue; \
 		$(STAGING_DIR_HOST)/bin/usign -S -m Packages -s $(BUILD_KEY); \
 	); done
-else
-ifeq ($(call qstrip,$(CONFIG_OPKGSMIME_KEY)),)
-	@echo Signing key has not been configured
-else
-ifeq ($(call qstrip,$(CONFIG_OPKGSMIME_CERT)),)
-	@echo Certificate has not been configured
-else
-	@echo Signing package index...
-	@for d in $(PACKAGE_SUBDIRS); do ( \
-		[ -d $$d ] && \
-			cd $$d || continue; \
-		openssl smime -binary -in Packages.gz \
-			-out Packages.sig -outform PEM -sign \
-			-signer $(CONFIG_OPKGSMIME_CERT) \
-			-inkey $(CONFIG_OPKGSMIME_KEY) \
-			$(PASSOPT) $(PASSARG); \
-	); done
-endif
-endif
 endif
 
 $(curdir)/preconfig:
@@ -123,5 +100,6 @@ $(eval $(call stampfile,$(curdir),package,prereq,.config))
 $(eval $(call stampfile,$(curdir),package,cleanup,$(TMP_DIR)/.build))
 $(eval $(call stampfile,$(curdir),package,compile,$(TMP_DIR)/.build))
 $(eval $(call stampfile,$(curdir),package,install,$(TMP_DIR)/.build))
+$(eval $(call stampfile,$(curdir),package,check,$(TMP_DIR)/.build))
 
 $(eval $(call subdir,$(curdir)))

+ 1 - 1
package/base-files/Makefile

@@ -23,7 +23,7 @@ PKG_CONFIG_DEPENDS := CONFIG_SIGNED_PACKAGES CONFIG_TARGET_INIT_PATH CONFIG_TARG
 include $(INCLUDE_DIR)/package.mk
 
 ifneq ($(DUMP),1)
-  STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell $(SH_FUNC) echo $(CONFIG_TARGET_INIT_PATH) | md5s)
+  STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell echo $(CONFIG_TARGET_INIT_PATH) | mkhash md5)
   TARGET:=-$(BOARD)
 endif
 

+ 1 - 1
package/base-files/files/bin/config_generate

@@ -401,7 +401,7 @@ generate_gpioswitch() {
 				set system.$cfg='gpio_switch'
 				set system.$cfg.name='$name'
 				set system.$cfg.gpio_pin='$pin'
-				set system.$cfg.default='$default'
+				set system.$cfg.value='$default'
 			EOF
 		json_select ..
 	json_select ..

+ 1 - 1
package/base-files/files/etc/profile

@@ -44,7 +44,7 @@ fi
 
 service() {
 	[ -f "/etc/init.d/$1" ] || {
-		echo -n "$1 does not exist. the following services are available :"
+		echo "service "'"'"$1"'"'" not found, the following services are available:"
 		ls "/etc/init.d"
 		return 1
 	}

+ 5 - 0
package/base-files/files/lib/functions.sh

@@ -230,6 +230,11 @@ default_postinst() {
 		ret=$?
 	fi
 
+	if [ -d "$root/rootfs-overlay" ]; then
+		cp -R $root/rootfs-overlay/. $root/
+		rm -fR $root/rootfs-overlay/
+	fi
+
 	if [ -z "$root" ] && grep -q -s "^/etc/uci-defaults/" "/usr/lib/opkg/info/${pkgname}.list"; then
 		. /lib/functions/system.sh
 		[ -d /tmp/.uci ] || mkdir -p /tmp/.uci

+ 92 - 1
package/base-files/files/lib/upgrade/common.sh

@@ -53,7 +53,8 @@ run_ramfs() { # <command> [...]
 		/bin/vi /bin/ls /bin/cat /usr/bin/awk /usr/bin/hexdump		\
 		/bin/sleep /bin/zcat /usr/bin/bzcat /usr/bin/printf /usr/bin/wc \
 		/bin/cut /usr/bin/printf /bin/sync /bin/mkdir /bin/rmdir	\
-		/bin/rm /usr/bin/basename /bin/kill /bin/chmod /usr/bin/find
+		/bin/rm /usr/bin/basename /bin/kill /bin/chmod /usr/bin/find \
+		/bin/mknod
 
 	install_bin /bin/uclient-fetch /bin/wget
 	install_bin /sbin/mtd
@@ -206,6 +207,96 @@ get_magic_long() {
 	(get_image "$@" | dd bs=4 count=1 | hexdump -v -n 4 -e '1/1 "%02x"') 2>/dev/null
 }
 
+export_bootdevice() {
+	local cmdline uuid disk uevent
+	local MAJOR MINOR DEVNAME DEVTYPE
+
+	if read cmdline < /proc/cmdline; then
+		case "$cmdline" in
+			*block2mtd=*)
+				disk="${cmdline##*block2mtd=}"
+				disk="${disk%%,*}"
+			;;
+			*root=*)
+				disk="${cmdline##*root=}"
+				disk="${disk%% *}"
+			;;
+		esac
+
+		case "$disk" in
+			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 $(find /dev -type b); 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
+						uevent="/sys/class/block/${disk##*/}/uevent"
+						break
+					fi
+				done
+			;;
+			/dev/*)
+				uevent="/sys/class/block/${disk##*/}/uevent"
+			;;
+		esac
+
+		if [ -e "$uevent" ]; then
+			. "$uevent"
+
+			export BOOTDEV_MAJOR=$MAJOR
+			export BOOTDEV_MINOR=$MINOR
+			return 0
+		fi
+	fi
+
+	return 1
+}
+
+export_partdevice() {
+	local var="$1" offset="$2"
+	local uevent MAJOR MINOR DEVNAME DEVTYPE
+
+	for uevent in /sys/class/block/*/uevent; do
+		. "$uevent"
+		if [ $BOOTDEV_MAJOR = $MAJOR -a $(($BOOTDEV_MINOR + $offset)) = $MINOR -a -b "/dev/$DEVNAME" ]; then
+			export "$var=$DEVNAME"
+			return 0
+		fi
+	done
+
+	return 1
+}
+
+get_partitions() { # <device> <filename>
+	local disk="$1"
+	local filename="$2"
+
+	if [ -b "$disk" -o -f "$disk" ]; then
+		v "Reading partition table from $filename..."
+
+		local magic="$(hexdump -v -n 2 -s 0x1FE -e '1/2 "0x%04X"' "$disk")"
+		if [ "$magic" != 0xAA55 ]; then
+			v "Invalid partition table on $disk"
+			exit
+		fi
+
+		rm -f "/tmp/partmap.$filename"
+
+		local part
+		for part in 1 2 3 4; do
+			set -- $(hexdump -v -n 12 -s "$((0x1B2 + $part * 16))" -e '3/4 "0x%08X "' "$disk")
+
+			local type="$(($1 % 256))"
+			local lba="$(($2))"
+			local num="$(($3))"
+
+			[ $type -gt 0 ] || continue
+
+			printf "%2d %5d %7d\n" $part $lba $num >> "/tmp/partmap.$filename"
+		done
+	fi
+}
+
 jffs2_copy_config() {
 	if grep rootfs_data /proc/mtd >/dev/null; then
 		# squashfs+jffs2

+ 14 - 44
package/base-files/image-config.in

@@ -158,7 +158,7 @@ if VERSIONOPT
 	config VERSION_DIST
 		string
 		prompt "Release distribution"
-		default "Lede"
+		default "LEDE"
 		help
 			This is the name of the release distribution.
 			If unspecified, it defaults to OpenWrt.
@@ -175,8 +175,8 @@ if VERSIONOPT
 		prompt "Release version number"
 		help
 			This is the release version number embedded in the image.
-			If unspecified, it defaults to CURRENT for the master branch
-			or to ##.##-CURRENT on release branches.
+			If unspecified, it defaults to SNAPSHOT for the master branch
+			or to ##.##-SNAPSHOT on release branches.
 
 	config VERSION_CODE
 		string
@@ -195,8 +195,8 @@ if VERSIONOPT
 			This is the repository address embedded in the image, it defaults
 			to the trunk snapshot repo; the url may contain the following placeholders:
 			 %R .. Repository revision ID
-			 %V .. Configured release version number or "CURRENT", uppercase
-			 %v .. Configured release version number or "current", lowercase
+			 %V .. Configured release version number or "SNAPSHOT", uppercase
+			 %v .. Configured release version number or "snapshot", lowercase
 			 %C .. Configured release revision code or value of %R, uppercase
 			 %c .. Configured release revision code or value of %R, lowercase
 			 %N .. Release name, uppercase
@@ -258,6 +258,15 @@ if VERSIONOPT
 		help
 			Enable this to include the version number in firmware image, SDK-
 			and Image Builder archive file names
+
+	config VERSION_CODE_FILENAMES
+		bool
+		prompt "Revision code in filenames"
+		default y
+		help
+			Enable this to include the revision identifier or the configured
+			version code into the firmware image, SDK- and Image Builder archive
+			file names
 endif
 
 
@@ -283,42 +292,3 @@ menuconfig PER_FEED_REPO
 		  Add not enabled feeds as commented out source lines to opkg.conf.
 
 source "tmp/.config-feeds.in"
-
-
-menuconfig SMIMEOPT
-	bool "Package signing options" if IMAGEOPT
-        default n
-	help
-		These options configure the signing key and certificate to
-		be used for signing and verifying packages.
-
-	config OPKGSMIME_CERT
-		string
-		prompt "Path to certificate (PEM certificate format)" if SMIMEOPT
-		help
-		  Path to the certificate to use for signature verification
-
-	config OPKGSMIME_KEY
-		string
-		prompt "Path to signing key (PEM private key format)" if SMIMEOPT
-		help
-		  Path to the key to use for signing packages
-
-	config OPKGSMIME_PASSPHRASE
-		bool
-		default y
-		prompt "Wait for a passphrase when signing packages?" if SMIMEOPT
-		help
-		  If this value is set, then the build will pause and request a passphrase
-                  from the command line when signing packages. This SHOULD NOT be used with
-                  automatic builds. If this value is not set, a file can be specified from
-                  which the passphrase will be read.
-
-	config OPKGSMIME_PASSFILE
-		string
-		prompt "Path to a file containing the passphrase" if SMIMEOPT
-                depends on !OPKGSMIME_PASSPHRASE
-		help
-		  Path to a file containing the passphrase for the signing key.
-                  If the signing key is not encrypted and does not require a passphrase,
-                  this option may be left blank.

+ 1 - 1
package/devel/binutils/Makefile

@@ -14,7 +14,7 @@ PKG_RELEASE:=1
 PKG_SOURCE_URL:=@GNU/binutils
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_VERSION:=$(PKG_VERSION)
-PKG_MD5SUM:=2869c9bf3e60ee97c74ac2a6bf4e9d68
+PKG_HASH:=369737ce51587f92466041a97ab7d2358c6d9e1b6490b3940eb09fb0a9a6ac88
 
 PKG_FIXUP:=autoreconf
 PKG_LIBTOOL_PATHS:=. gas bfd opcodes gprof binutils ld libiberty gold intl

+ 1 - 1
package/devel/gdb-arc/Makefile

@@ -13,7 +13,7 @@ PKG_RELEASE:=1
 
 PKG_SOURCE:=gdb-arc-2016.03-gdb.tar.gz
 PKG_SOURCE_URL:=https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb/archive/$(PKG_VERSION)
-PKG_MD5SUM:=775caaf6385c16f20b6f53c0a2b95f79
+PKG_HASH:=6a91f86cc487c1548d3f5d4f29f7226d2019c0db8a63633aeabd5914a340f3f9
 
 PKG_BUILD_DIR:=$(BUILD_DIR)/binutils-gdb-arc-2016.03-gdb
 

+ 1 - 1
package/devel/gdb/Makefile

@@ -13,7 +13,7 @@ PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=@GNU/gdb
-PKG_MD5SUM:=5aa71522e488e358243917967db87476
+PKG_HASH:=e9216da4e3755e9f414c1aa0026b626251dfc57ffe572a266e98da4f6988fc70
 
 PKG_BUILD_PARALLEL:=1
 PKG_INSTALL:=1

+ 0 - 16
package/devel/gdb/patches/002-remove-arguments.patch

@@ -1,16 +0,0 @@
-# The additional warnings are causing compile errors on gcc version 4.1.2 as
-# a host compiler.
-
---- a/sim/igen/configure
-+++ b/sim/igen/configure
-@@ -4768,8 +4768,8 @@ build_warnings="-Wall -Wdeclaration-afte
- -Wpointer-sign \
- -Wno-unused -Wunused-value -Wunused-function \
- -Wno-switch -Wno-char-subscripts -Wmissing-prototypes
---Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type \
---Wold-style-declaration -Wold-style-definition"
-+-Wdeclaration-after-statement \
-+-Wold-style-definition"
- 
- # Enable -Wno-format by default when using gcc on mingw since many
- # GCC versions complain about %I64.

+ 2 - 2
package/devel/strace/Makefile

@@ -10,9 +10,9 @@ include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=strace
 
-PKG_VERSION:=4.14
+PKG_VERSION:=4.15
 PKG_RELEASE:=1
-PKG_MD5SUM:=1e39b5f7583256d7dc21170b9da529ae
+PKG_HASH:=c0cdc094d6141fd9dbf6aaad605142d651ae10998b660fda57fc61f7ad583ca9
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=@SF/$(PKG_NAME)

+ 1 - 3
package/devel/strace/patches/100-workaround--pt-reg-collisions-ppc.patch

@@ -1,8 +1,6 @@
-diff --git a/ptrace.h b/ptrace.h
-index ddb46cb..48a54b8 100644
 --- a/ptrace.h
 +++ b/ptrace.h
-@@ -55,7 +55,14 @@ extern long ptrace(int, int, char *, long);
+@@ -55,7 +55,14 @@ extern long ptrace(int, int, char *, lon
  # define ptrace_peeksiginfo_args XXX_ptrace_peeksiginfo_args
  #endif
  

+ 1 - 3
package/devel/trace-cmd/Makefile

@@ -8,10 +8,8 @@ PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL:=\
 		https://kernel.googlesource.com/pub/scm/linux/kernel/git/rostedt/trace-cmd \
 		https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git
-PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
 PKG_SOURCE_VERSION:=9be5d74805830a291615f2f34a27c903f6a37b1e
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_MIRROR_MD5SUM:=735b69f61a8c627037dcc01361cdb8415e5ab0ec892fbd731236c444003b0c71
+PKG_MIRROR_HASH:=735b69f61a8c627037dcc01361cdb8415e5ab0ec892fbd731236c444003b0c71
 PKG_INSTALL:=1
 PKG_USE_MIPS16:=0
 PKG_LICENSE:=GPL-2.0

+ 1 - 1
package/devel/valgrind/Makefile

@@ -13,7 +13,7 @@ PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=http://valgrind.org/downloads/
-PKG_MD5SUM:=67ca4395b2527247780f36148b084f5743a68ab0c850cb43e4a5b4b012cf76a1
+PKG_HASH:=67ca4395b2527247780f36148b084f5743a68ab0c850cb43e4a5b4b012cf76a1
 
 PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
 PKG_LICENSE:=GPL-2.0+

+ 30 - 0
package/kernel/hwmon-gsc/Makefile

@@ -0,0 +1,30 @@
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=hwmon-gsc
+PKG_RELEASE:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define KernelPackage/hwmon-gsc
+  SUBMENU:=Hardware Monitoring Support
+  DEPENDS:=@TARGET_imx6||TARGET_cns3xxx kmod-hwmon-core +kmod-i2c-core
+  TITLE:=Driver for the Gateworks System Controller
+  AUTOLOAD:=$(call AutoLoad,60,gsc)
+  FILES:=$(PKG_BUILD_DIR)/gsc.ko
+endef
+
+define KernelPackage/hwmon-gsc/description
+  Kernel module for the Gateworks System Controller chips.
+endef
+
+define Build/Compile
+	$(MAKE) -C "$(LINUX_DIR)" \
+		CROSS_COMPILE="$(TARGET_CROSS)" \
+		ARCH="$(LINUX_KARCH)" \
+		SUBDIRS="$(PKG_BUILD_DIR)" \
+		EXTRA_CFLAGS="$(BUILDFLAGS)" \
+		modules
+endef
+
+$(eval $(call KernelPackage,hwmon-gsc))

+ 1 - 0
package/kernel/hwmon-gsc/src/Makefile

@@ -0,0 +1 @@
+obj-m := gsc.o

+ 308 - 0
package/kernel/hwmon-gsc/src/gsc.c

@@ -0,0 +1,308 @@
+/*
+ * A hwmon driver for the Gateworks System Controller 
+ * Copyright (C) 2009 Gateworks Corporation
+ *
+ * Author: Chris Lang <clang@gateworks.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License,
+ * as published by the Free Software Foundation - version 2.
+ */
+
+#include <linux/module.h>
+#include <linux/i2c.h>
+#include <linux/hwmon.h>
+#include <linux/hwmon-sysfs.h>
+#include <linux/err.h>
+#include <linux/slab.h>
+
+#define DRV_VERSION "0.2"
+
+enum chips { gsp };
+
+/* AD7418 registers */
+#define GSP_REG_TEMP_IN		0x00
+#define GSP_REG_VIN		0x02
+#define GSP_REG_3P3		0x05
+#define GSP_REG_BAT		0x08
+#define GSP_REG_5P0		0x0b
+#define GSP_REG_CORE		0x0e
+#define GSP_REG_CPU1		0x11
+#define GSP_REG_CPU2		0x14
+#define GSP_REG_DRAM		0x17
+#define GSP_REG_EXT_BAT		0x1a
+#define GSP_REG_IO1		0x1d
+#define GSP_REG_IO2 		0x20
+#define GSP_REG_PCIE		0x23
+#define GSP_REG_CURRENT		0x26
+#define GSP_FAN_0		0x2C
+#define GSP_FAN_1		0x2E
+#define GSP_FAN_2		0x30
+#define GSP_FAN_3		0x32
+#define GSP_FAN_4		0x34
+#define GSP_FAN_5		0x36
+
+struct gsp_sensor_info {
+	const char* name;
+	int reg;
+};
+
+static const struct gsp_sensor_info gsp_sensors[] = {
+	{"temp", GSP_REG_TEMP_IN},
+	{"vin", GSP_REG_VIN},
+	{"3p3", GSP_REG_3P3},
+	{"bat", GSP_REG_BAT},
+	{"5p0", GSP_REG_5P0},
+	{"core", GSP_REG_CORE},
+	{"cpu1", GSP_REG_CPU1},
+	{"cpu2", GSP_REG_CPU2},
+	{"dram", GSP_REG_DRAM},
+	{"ext_bat", GSP_REG_EXT_BAT},
+	{"io1", GSP_REG_IO1},
+	{"io2", GSP_REG_IO2},
+	{"pci2", GSP_REG_PCIE},
+	{"current", GSP_REG_CURRENT},
+	{"fan_point0", GSP_FAN_0},
+	{"fan_point1", GSP_FAN_1},
+	{"fan_point2", GSP_FAN_2},
+	{"fan_point3", GSP_FAN_3},
+	{"fan_point4", GSP_FAN_4},
+	{"fan_point5", GSP_FAN_5},
+};
+
+struct gsp_data {
+	struct device		*hwmon_dev;
+	struct attribute_group	attrs;
+	enum chips		type;
+};
+
+static int gsp_probe(struct i2c_client *client,
+			const struct i2c_device_id *id);
+static int gsp_remove(struct i2c_client *client);
+
+static const struct i2c_device_id gsp_id[] = {
+	{ "gsp", 0 },
+	{ }
+};
+MODULE_DEVICE_TABLE(i2c, gsp_id);
+
+static struct i2c_driver gsp_driver = {
+	.driver = {
+		.name	= "gsp",
+	},
+	.probe		= gsp_probe,
+	.remove		= gsp_remove,
+	.id_table	= gsp_id,
+};
+
+/* All registers are word-sized, except for the configuration registers.
+ * AD7418 uses a high-byte first convention. Do NOT use those functions to
+ * access the configuration registers CONF and CONF2, as they are byte-sized.
+ */
+static inline int gsp_read(struct i2c_client *client, u8 reg)
+{
+	unsigned int adc = 0;
+	if (reg == GSP_REG_TEMP_IN || reg > GSP_REG_CURRENT)
+	{
+		adc |= i2c_smbus_read_byte_data(client, reg);
+		adc |= i2c_smbus_read_byte_data(client, reg + 1) << 8;
+		return adc;
+	}
+	else
+	{
+		adc |= i2c_smbus_read_byte_data(client, reg);
+		adc |= i2c_smbus_read_byte_data(client, reg + 1) << 8;
+		adc |= i2c_smbus_read_byte_data(client, reg + 2) << 16;
+		return adc;
+	}
+}
+
+static inline int gsp_write(struct i2c_client *client, u8 reg, u16 value)
+{
+	i2c_smbus_write_byte_data(client, reg, value & 0xff);
+	i2c_smbus_write_byte_data(client, reg + 1, ((value >> 8) & 0xff));
+	return 1;
+}
+
+static ssize_t show_adc(struct device *dev, struct device_attribute *devattr,
+			char *buf)
+{
+	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
+	struct i2c_client *client = to_i2c_client(dev);
+	return sprintf(buf, "%d\n", gsp_read(client, gsp_sensors[attr->index].reg));
+}
+
+static ssize_t show_label(struct device *dev,
+			struct device_attribute *devattr, char *buf)
+{
+	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
+
+	return sprintf(buf, "%s\n", gsp_sensors[attr->index].name);
+}
+
+static ssize_t store_fan(struct device *dev,
+			struct device_attribute *devattr, const char *buf, size_t count)
+{
+	u16 val;
+	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
+	struct i2c_client *client = to_i2c_client(dev);
+	val = simple_strtoul(buf, NULL, 10);
+	gsp_write(client, gsp_sensors[attr->index].reg, val);
+	return count;
+}
+
+static SENSOR_DEVICE_ATTR(temp0_input, S_IRUGO, show_adc, NULL, 0);
+static SENSOR_DEVICE_ATTR(temp0_label, S_IRUGO, show_label, NULL, 0);
+
+static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_adc, NULL, 1);
+static SENSOR_DEVICE_ATTR(in0_label, S_IRUGO, show_label, NULL, 1);
+static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_adc, NULL, 2);
+static SENSOR_DEVICE_ATTR(in1_label, S_IRUGO, show_label, NULL, 2);
+static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_adc, NULL, 3);
+static SENSOR_DEVICE_ATTR(in2_label, S_IRUGO, show_label, NULL, 3);
+static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, show_adc, NULL, 4);
+static SENSOR_DEVICE_ATTR(in3_label, S_IRUGO, show_label, NULL, 4);
+static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, show_adc, NULL, 5);
+static SENSOR_DEVICE_ATTR(in4_label, S_IRUGO, show_label, NULL, 5);
+static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, show_adc, NULL, 6);
+static SENSOR_DEVICE_ATTR(in5_label, S_IRUGO, show_label, NULL, 6);
+static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_adc, NULL, 7);
+static SENSOR_DEVICE_ATTR(in6_label, S_IRUGO, show_label, NULL, 7);
+static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_adc, NULL, 8);
+static SENSOR_DEVICE_ATTR(in7_label, S_IRUGO, show_label, NULL, 8);
+static SENSOR_DEVICE_ATTR(in8_input, S_IRUGO, show_adc, NULL, 9);
+static SENSOR_DEVICE_ATTR(in8_label, S_IRUGO, show_label, NULL, 9);
+static SENSOR_DEVICE_ATTR(in9_input, S_IRUGO, show_adc, NULL, 10);
+static SENSOR_DEVICE_ATTR(in9_label, S_IRUGO, show_label, NULL, 10);
+static SENSOR_DEVICE_ATTR(in10_input, S_IRUGO, show_adc, NULL, 11);
+static SENSOR_DEVICE_ATTR(in10_label, S_IRUGO, show_label, NULL, 11);
+static SENSOR_DEVICE_ATTR(in11_input, S_IRUGO, show_adc, NULL, 12);
+static SENSOR_DEVICE_ATTR(in11_label, S_IRUGO, show_label, NULL, 12);
+static SENSOR_DEVICE_ATTR(in12_input, S_IRUGO, show_adc, NULL, 13);
+static SENSOR_DEVICE_ATTR(in12_label, S_IRUGO, show_label, NULL, 13);
+
+static SENSOR_DEVICE_ATTR(fan0_point0, S_IRUGO | S_IWUSR, show_adc, store_fan, 14);
+static SENSOR_DEVICE_ATTR(fan0_point1, S_IRUGO | S_IWUSR, show_adc, store_fan, 15);
+static SENSOR_DEVICE_ATTR(fan0_point2, S_IRUGO | S_IWUSR, show_adc, store_fan, 16);
+static SENSOR_DEVICE_ATTR(fan0_point3, S_IRUGO | S_IWUSR, show_adc, store_fan, 17);
+static SENSOR_DEVICE_ATTR(fan0_point4, S_IRUGO | S_IWUSR, show_adc, store_fan, 18);
+static SENSOR_DEVICE_ATTR(fan0_point5, S_IRUGO | S_IWUSR, show_adc, store_fan, 19);
+
+static struct attribute *gsp_attributes[] = {
+	&sensor_dev_attr_temp0_input.dev_attr.attr,
+	&sensor_dev_attr_in0_input.dev_attr.attr,
+	&sensor_dev_attr_in1_input.dev_attr.attr,
+	&sensor_dev_attr_in2_input.dev_attr.attr,
+	&sensor_dev_attr_in3_input.dev_attr.attr,
+	&sensor_dev_attr_in4_input.dev_attr.attr,
+	&sensor_dev_attr_in5_input.dev_attr.attr,
+	&sensor_dev_attr_in6_input.dev_attr.attr,
+	&sensor_dev_attr_in7_input.dev_attr.attr,
+	&sensor_dev_attr_in8_input.dev_attr.attr,
+	&sensor_dev_attr_in9_input.dev_attr.attr,
+	&sensor_dev_attr_in10_input.dev_attr.attr,
+	&sensor_dev_attr_in11_input.dev_attr.attr,
+	&sensor_dev_attr_in12_input.dev_attr.attr,
+
+	&sensor_dev_attr_temp0_label.dev_attr.attr,
+	&sensor_dev_attr_in0_label.dev_attr.attr,
+	&sensor_dev_attr_in1_label.dev_attr.attr,
+	&sensor_dev_attr_in2_label.dev_attr.attr,
+	&sensor_dev_attr_in3_label.dev_attr.attr,
+	&sensor_dev_attr_in4_label.dev_attr.attr,
+	&sensor_dev_attr_in5_label.dev_attr.attr,
+	&sensor_dev_attr_in6_label.dev_attr.attr,
+	&sensor_dev_attr_in7_label.dev_attr.attr,
+	&sensor_dev_attr_in8_label.dev_attr.attr,
+	&sensor_dev_attr_in9_label.dev_attr.attr,
+	&sensor_dev_attr_in10_label.dev_attr.attr,
+	&sensor_dev_attr_in11_label.dev_attr.attr,
+	&sensor_dev_attr_in12_label.dev_attr.attr,
+
+	&sensor_dev_attr_fan0_point0.dev_attr.attr,
+	&sensor_dev_attr_fan0_point1.dev_attr.attr,
+	&sensor_dev_attr_fan0_point2.dev_attr.attr,
+	&sensor_dev_attr_fan0_point3.dev_attr.attr,
+	&sensor_dev_attr_fan0_point4.dev_attr.attr,
+	&sensor_dev_attr_fan0_point5.dev_attr.attr,
+	NULL
+};
+
+
+static int gsp_probe(struct i2c_client *client,
+			 const struct i2c_device_id *id)
+{
+	struct i2c_adapter *adapter = client->adapter;
+	struct gsp_data *data;
+	int err;
+
+	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA |
+					I2C_FUNC_SMBUS_WORD_DATA)) {
+		err = -EOPNOTSUPP;
+		goto exit;
+	}
+
+	if (!(data = kzalloc(sizeof(struct gsp_data), GFP_KERNEL))) {
+		err = -ENOMEM;
+		goto exit;
+	}
+
+	i2c_set_clientdata(client, data);
+
+	data->type = id->driver_data;
+
+	switch (data->type) {
+	case 0:
+		data->attrs.attrs = gsp_attributes;
+		break;
+	}
+
+	dev_info(&client->dev, "%s chip found\n", client->name);
+
+	/* Register sysfs hooks */
+	if ((err = sysfs_create_group(&client->dev.kobj, &data->attrs)))
+		goto exit_free;
+
+	data->hwmon_dev = hwmon_device_register(&client->dev);
+	if (IS_ERR(data->hwmon_dev)) {
+		err = PTR_ERR(data->hwmon_dev);
+		goto exit_remove;
+	}
+
+	return 0;
+
+exit_remove:
+	sysfs_remove_group(&client->dev.kobj, &data->attrs);
+exit_free:
+	kfree(data);
+exit:
+	return err;
+}
+
+static int gsp_remove(struct i2c_client *client)
+{
+	struct gsp_data *data = i2c_get_clientdata(client);
+	hwmon_device_unregister(data->hwmon_dev);
+	sysfs_remove_group(&client->dev.kobj, &data->attrs);
+	kfree(data);
+	return 0;
+}
+
+static int __init gsp_init(void)
+{
+	return i2c_add_driver(&gsp_driver);
+}
+
+static void __exit gsp_exit(void)
+{
+	i2c_del_driver(&gsp_driver);
+}
+
+module_init(gsp_init);
+module_exit(gsp_exit);
+
+MODULE_AUTHOR("Chris Lang <clang@gateworks.com>");
+MODULE_DESCRIPTION("GSC HWMON driver");
+MODULE_LICENSE("GPL");
+MODULE_VERSION(DRV_VERSION);
+

+ 5 - 7
package/kernel/kmod-sched-cake/Makefile

@@ -9,15 +9,13 @@ include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=sched-cake
-PKG_SOURCE_VERSION:=4f62bd17fa34036cb3c8fd4800a709b2734c3de3
-PKG_VERSION:=2016-10-02-$(PKG_SOURCE_VERSION)
 PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
-PKG_SOURCE_URL:=https://github.com/dtaht/sch_cake.git
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_MIRROR_MD5SUM:=d6fd82607862c16ba5f1007ecfb251eba9e2cc82c55bb3f4aee2fbebf9fa6d2a
+PKG_SOURCE_URL:=https://github.com/kdarbyshirebryant/sch_cake.git
+PKG_SOURCE_DATE:=2016-12-19
+PKG_SOURCE_VERSION:=70c8eb766d5afcf3cf187594b7cd776da92bee3c
+PKG_MIRROR_HASH:=16174db5dad0a5b5ba522d4cfc058cff9851ed013a3a05166b04eb127bb12a24
 PKG_MAINTAINER:=Kevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk>
 
 include $(INCLUDE_DIR)/package.mk
@@ -28,7 +26,7 @@ define KernelPackage/sched-cake
   URL:=https://github.com/dtaht/sch_cake
   FILES:=$(PKG_BUILD_DIR)/sch_cake.ko
   AUTOLOAD:=$(call AutoLoad,75,sch_cake)
-  DEPENDS:=+kmod-ipt-conntrack
+  DEPENDS:=+kmod-ipt-conntrack @!LINUX_3_18
 endef
 
 include $(INCLUDE_DIR)/kernel-defaults.mk

+ 1 - 2
package/kernel/linux/Makefile

@@ -23,9 +23,8 @@ export SHELL:=/bin/sh
 
 include $(INCLUDE_DIR)/package.mk
 
-STAMP_BUILT:=$(STAMP_BUILT)_$(firstword $(shell $(SCRIPT_DIR)/kconfig.pl $(LINUX_DIR)/.config | md5sum))
-
 ifeq ($(DUMP),)
+  STAMP_BUILT:=$(STAMP_BUILT)_$(shell $(SCRIPT_DIR)/kconfig.pl $(LINUX_DIR)/.config | mkhash md5)
   -include $(LINUX_DIR)/.config
 endif
 

+ 0 - 19
package/kernel/linux/modules/block.mk

@@ -90,25 +90,6 @@ endef
 $(eval $(call KernelPackage,ata-artop))
 
 
-define KernelPackage/ata-imx
-  TITLE:=Freescale i.MX AHCI SATA support
-  DEPENDS:=@TARGET_imx6
-  KCONFIG:=\
-	CONFIG_AHCI_IMX \
-	CONFIG_SATA_AHCI_PLATFORM \
-	CONFIG_PATA_IMX=n
-  FILES:=$(LINUX_DIR)/drivers/ata/ahci_imx.ko
-  AUTOLOAD:=$(call AutoLoad,41,ahci_imx,1)
-  $(call AddDepends/ata)
-endef
-
-define KernelPackage/ata-imx/description
- SATA support for the Freescale i.MX6 SoC's onboard AHCI SATA
-endef
-
-$(eval $(call KernelPackage,ata-imx))
-
-
 define KernelPackage/ata-marvell-sata
   TITLE:=Marvell Serial ATA support
   KCONFIG:=CONFIG_SATA_MV

+ 22 - 90
package/kernel/linux/modules/crypto.mk

@@ -158,32 +158,6 @@ endef
 $(eval $(call KernelPackage,crypto-seqiv))
 
 
-define KernelPackage/crypto-hw-caam
-  TITLE:=Freescale CAAM driver (SEC4)
-  DEPENDS:=@TARGET_imx6||TARGET_mpc85xx +kmod-crypto-aead +kmod-crypto-authenc +kmod-crypto-hash +kmod-random-core
-  KCONFIG:= \
-	CONFIG_CRYPTO_HW=y \
-	CONFIG_CRYPTO_DEV_FSL_CAAM \
-	CONFIG_CRYPTO_DEV_FSL_CAAM_JR \
-	CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API \
-	CONFIG_CRYPTO_DEV_FSL_CAAM_AHASH_API \
-	CONFIG_CRYPTO_DEV_FSL_CAAM_RNG_API \
-	CONFIG_CRYPTO_DEV_FSL_CAAM_RINGSIZE=9 \
-	CONFIG_CRYPTO_DEV_FSL_CAAM_INTC=n \
-	CONFIG_CRYPTO_DEV_FSL_CAAM_DEBUG=n
-  FILES:= \
-	$(LINUX_DIR)/drivers/crypto/caam/caam.ko \
-	$(LINUX_DIR)/drivers/crypto/caam/caamalg.ko \
-	$(LINUX_DIR)/drivers/crypto/caam/caamhash.ko \
-	$(LINUX_DIR)/drivers/crypto/caam/caam_jr.ko \
-	$(LINUX_DIR)/drivers/crypto/caam/caamrng.ko
-  AUTOLOAD:=$(call AutoLoad,09,caam caamalg caamhash caam_jr caamrng)
-  $(call AddDepends/crypto)
-endef
-
-$(eval $(call KernelPackage,crypto-hw-caam))
-
-
 define KernelPackage/crypto-hw-talitos
   TITLE:=Freescale integrated security engine (SEC) driver
   DEPENDS:=+kmod-crypto-manager +kmod-crypto-hash +kmod-random-core +kmod-crypto-authenc
@@ -266,54 +240,6 @@ endef
 $(eval $(call KernelPackage,crypto-hw-hifn-795x))
 
 
-define KernelPackage/crypto-hw-ppc4xx
-  TITLE:=AMCC PPC4xx hardware crypto module
-  DEPENDS:=@TARGET_ppc40x||TARGET_ppc44x
-  KCONFIG:= \
-	CONFIG_CRYPTO_HW=y \
-	CONFIG_CRYPTO_DEV_PPC4XX
-  FILES:=$(LINUX_DIR)/drivers/crypto/amcc/crypto4xx.ko
-  AUTOLOAD:=$(call AutoLoad,90,crypto4xx)
-  $(call AddDepends/crypto,+kmod-crypto-manager +kmod-crypto-hash)
-endef
-
-define KernelPackage/crypto-hw-ppc4xx/description
-  Kernel support for the AMCC PPC4xx HW crypto engine.
-endef
-
-$(eval $(call KernelPackage,crypto-hw-ppc4xx))
-
-
-define KernelPackage/crypto-hw-omap
-  TITLE:=TI OMAP hardware crypto modules
-  DEPENDS:=@TARGET_omap
-  KCONFIG:= \
-	CONFIG_CRYPTO_HW=y \
-	CONFIG_CRYPTO_DEV_OMAP_AES \
-	CONFIG_CRYPTO_DEV_OMAP_DES \
-	CONFIG_CRYPTO_DEV_OMAP_SHAM
-ifneq ($(wildcard $(LINUX_DIR)/drivers/crypto/omap-des.ko),)
-  FILES:= \
-	$(LINUX_DIR)/drivers/crypto/omap-aes.ko \
-	$(LINUX_DIR)/drivers/crypto/omap-des.ko \
-	$(LINUX_DIR)/drivers/crypto/omap-sham.ko
-  AUTOLOAD:=$(call AutoLoad,90,omap-aes omap-des omap-sham)
-else
-  FILES:= \
-	$(LINUX_DIR)/drivers/crypto/omap-aes.ko \
-	$(LINUX_DIR)/drivers/crypto/omap-sham.ko
-  AUTOLOAD:=$(call AutoLoad,90,omap-aes omap-sham)
-endif
-  $(call AddDepends/crypto,+kmod-crypto-manager +kmod-crypto-hash)
-endef
-
-define KernelPackage/crypto-hw-omap/description
-  Kernel support for the TI OMAP HW crypto engine.
-endef
-
-$(eval $(call KernelPackage,crypto-hw-omap))
-
-
 define KernelPackage/crypto-authenc
   TITLE:=Combined mode wrapper for IPsec
   DEPENDS:=+kmod-crypto-manager +LINUX_4_4:kmod-crypto-null
@@ -394,7 +320,7 @@ $(eval $(call KernelPackage,crypto-des))
 
 define KernelPackage/crypto-deflate
   TITLE:=Deflate compression CryptoAPI module
-  DEPENDS:=+kmod-lib-zlib
+  DEPENDS:=+kmod-lib-zlib-inflate +kmod-lib-zlib-deflate
   KCONFIG:=CONFIG_CRYPTO_DEFLATE
   FILES:=$(LINUX_DIR)/crypto/deflate.ko
   AUTOLOAD:=$(call AutoLoad,09,deflate)
@@ -533,7 +459,8 @@ define KernelPackage/crypto-sha1
   DEPENDS:=+kmod-crypto-hash
   KCONFIG:= \
 	CONFIG_CRYPTO_SHA1 \
-	CONFIG_CRYPTO_SHA1_OCTEON
+	CONFIG_CRYPTO_SHA1_OCTEON \
+	CONFIG_CRYPTO_SHA1_SSSE3
   FILES:=$(LINUX_DIR)/crypto/sha1_generic.ko
   AUTOLOAD:=$(call AutoLoad,09,sha1_generic)
   $(call AddDepends/crypto)
@@ -544,6 +471,11 @@ define KernelPackage/crypto-sha1/octeon
   AUTOLOAD:=$(call AutoLoad,09,octeon-sha1)
 endef
 
+define KernelPackage/crypto-sha1/x86/64
+  FILES+=$(LINUX_DIR)/arch/x86/crypto/sha1-ssse3.ko
+  AUTOLOAD:=$(call AutoLoad,09,sha1-ssse3)
+endef
+
 $(eval $(call KernelPackage,crypto-sha1))
 
 
@@ -552,7 +484,8 @@ define KernelPackage/crypto-sha256
   DEPENDS:=+kmod-crypto-hash
   KCONFIG:= \
 	CONFIG_CRYPTO_SHA256 \
-	CONFIG_CRYPTO_SHA256_OCTEON
+	CONFIG_CRYPTO_SHA256_OCTEON \
+	CONFIG_CRYPTO_SHA256_SSSE3
   FILES:=$(LINUX_DIR)/crypto/sha256_generic.ko
   AUTOLOAD:=$(call AutoLoad,09,sha256_generic)
   $(call AddDepends/crypto)
@@ -563,6 +496,11 @@ define KernelPackage/crypto-sha256/octeon
   AUTOLOAD:=$(call AutoLoad,09,octeon-sha256)
 endef
 
+define KernelPackage/crypto-sha256/x86/64
+  FILES+=$(LINUX_DIR)/arch/x86/crypto/sha256-ssse3.ko
+  AUTOLOAD:=$(call AutoLoad,09,sha256-ssse3)
+endef
+
 $(eval $(call KernelPackage,crypto-sha256))
 
 
@@ -571,7 +509,8 @@ define KernelPackage/crypto-sha512
   DEPENDS:=+kmod-crypto-hash
   KCONFIG:= \
 	CONFIG_CRYPTO_SHA512 \
-	CONFIG_CRYPTO_SHA512_OCTEON
+	CONFIG_CRYPTO_SHA512_OCTEON \
+	CONFIG_CRYPTO_SHA512_SSSE3
   FILES:=$(LINUX_DIR)/crypto/sha512_generic.ko
   AUTOLOAD:=$(call AutoLoad,09,sha512_generic)
   $(call AddDepends/crypto)
@@ -582,6 +521,11 @@ define KernelPackage/crypto-sha512/octeon
   AUTOLOAD:=$(call AutoLoad,09,octeon-sha512)
 endef
 
+define KernelPackage/crypto-sha512/x86/64
+  FILES+=$(LINUX_DIR)/arch/x86/crypto/sha512-ssse3.ko
+  AUTOLOAD:=$(call AutoLoad,09,sha512-ssse3)
+endef
+
 $(eval $(call KernelPackage,crypto-sha512))
 
 
@@ -661,15 +605,3 @@ define KernelPackage/crypto-xts
 endef
 
 $(eval $(call KernelPackage,crypto-xts))
-
-
-define KernelPackage/crypto-mv-cesa
-  TITLE:=Marvell crypto engine
-  DEPENDS:=+kmod-crypto-manager @TARGET_kirkwood||TARGET_orion
-  KCONFIG:=CONFIG_CRYPTO_DEV_MV_CESA
-  FILES:=$(LINUX_DIR)/drivers/crypto/mv_cesa.ko
-  AUTOLOAD:=$(call AutoLoad,09,mv_cesa)
-  $(call AddDepends/crypto)
-endef
-
-$(eval $(call KernelPackage,crypto-mv-cesa))

+ 3 - 3
package/kernel/linux/modules/fs.mk

@@ -82,7 +82,7 @@ $(eval $(call KernelPackage,fs-autofs4))
 define KernelPackage/fs-btrfs
   SUBMENU:=$(FS_MENU)
   TITLE:=BTRFS filesystem support
-  DEPENDS:=+kmod-lib-crc32c +kmod-lib-lzo +kmod-lib-zlib +kmod-lib-raid6 +kmod-lib-xor
+  DEPENDS:=+kmod-lib-crc32c +kmod-lib-lzo +kmod-lib-zlib-inflate +kmod-lib-zlib-deflate +kmod-lib-raid6 +kmod-lib-xor
   KCONFIG:=\
 	CONFIG_BTRFS_FS \
 	CONFIG_BTRFS_FS_POSIX_ACL=n \
@@ -144,7 +144,7 @@ $(eval $(call KernelPackage,fs-configfs))
 define KernelPackage/fs-cramfs
   SUBMENU:=$(FS_MENU)
   TITLE:=Compressed RAM/ROM filesystem support
-  DEPENDS:=+kmod-lib-zlib
+  DEPENDS:=+kmod-lib-zlib-inflate
   KCONFIG:= \
 	CONFIG_CRAMFS
   FILES:=$(LINUX_DIR)/fs/cramfs/cramfs.ko
@@ -268,7 +268,7 @@ $(eval $(call KernelPackage,fs-hfsplus))
 define KernelPackage/fs-isofs
   SUBMENU:=$(FS_MENU)
   TITLE:=ISO9660 filesystem support
-  DEPENDS:=+kmod-lib-zlib
+  DEPENDS:=+kmod-lib-zlib-inflate
   KCONFIG:=CONFIG_ISO9660_FS CONFIG_JOLIET=y CONFIG_ZISOFS=n
   FILES:=$(LINUX_DIR)/fs/isofs/isofs.ko
   AUTOLOAD:=$(call AutoLoad,30,isofs)

+ 24 - 9
package/kernel/linux/modules/hwmon.mk

@@ -313,19 +313,34 @@ endef
 $(eval $(call KernelPackage,hwmon-w83793))
 
 
-define KernelPackage/hwmon-gsc
-  TITLE:=Gateworks GSC monitoring support
-  KCONFIG:=CONFIG_SENSORS_GSC
-  FILES:=$(LINUX_DIR)/drivers/hwmon/gsc.ko
-  AUTOLOAD:=$(call AutoLoad,60,gsc)
-  $(call AddDepends/hwmon,+kmod-i2c-core)
+define KernelPackage/hwmon-tmp102
+  TITLE:=Texas Instruments TMP102 monitoring support
+  KCONFIG:=CONFIG_SENSORS_TMP102
+  FILES:=$(LINUX_DIR)/drivers/hwmon/tmp102.ko
+  AUTOLOAD:=$(call AutoProbe,tmp102)
+  $(call AddDepends/hwmon,+kmod-i2c-core +PACKAGE_kmod-thermal:kmod-thermal)
+endef
+
+define KernelPackage/hwmon-tmp102/description
+ Kernel module for Texas Instruments TMP102 temperature sensors chip
+endef
+
+$(eval $(call KernelPackage,hwmon-tmp102))
+
+
+define KernelPackage/hwmon-tmp103
+  TITLE:=Texas Instruments TMP103 monitoring support
+  KCONFIG:=CONFIG_SENSORS_TMP103
+  FILES:=$(LINUX_DIR)/drivers/hwmon/tmp103.ko
+  AUTOLOAD:=$(call AutoProbe,tmp103)
+  $(call AddDepends/hwmon,+kmod-i2c-core +kmod-regmap)
 endef
 
-define KernelPackage/hwmon-gsc/description
-  Kernel module for the Gateworks System Controller chips.
+define KernelPackage/hwmon-tmp103/description
+ Kernel module for Texas Instruments TMP103 temperature sensors chip
 endef
 
-$(eval $(call KernelPackage,hwmon-gsc))
+$(eval $(call KernelPackage,hwmon-tmp103))
 
 
 define KernelPackage/hwmon-tmp421

+ 0 - 47
package/kernel/linux/modules/i2c.mk

@@ -104,53 +104,6 @@ endef
 
 $(eval $(call KernelPackage,i2c-gpio))
 
-I2C_MPC_MODULES:=\
-  CONFIG_I2C_MPC:drivers/i2c/busses/i2c-mpc
-
-define KernelPackage/i2c-mpc
-  $(call i2c_defaults,$(I2C_MPC_MODULES),59)
-  TITLE:=MPC I2C accessors
-  DEPENDS:=@TARGET_mpc52xx||TARGET_mpc83xx||TARGET_mpc85xx +kmod-i2c-core
-endef
-
-define KernelPackage/i2c-mpc/description
- Kernel module for Freescale MPC52xx MPC83xx MPC85xx I2C accessors
-endef
-
-$(eval $(call KernelPackage,i2c-mpc))
-
-I2C_IBM_IIC_MODULES:=\
-  CONFIG_I2C_IBM_IIC:drivers/i2c/busses/i2c-ibm_iic
-
-define KernelPackage/i2c-ibm-iic
-  $(call i2c_defaults,$(OF_I2C_MODULES),59)
-  TITLE:=IBM PPC 4xx on-chip I2C interface support
-  DEPENDS:=@TARGET_ppc40x||TARGET_ppc4xx +kmod-i2c-core
-endef
-
-define KernelPackage/i2c-ibm-iic/description
- Kernel module for IIC peripheral found on embedded IBM PPC4xx based systems
-endef
-
-$(eval $(call KernelPackage,i2c-ibm-iic))
-
-I2C_MV64XXX_MODULES:=\
-  CONFIG_I2C_MV64XXX:drivers/i2c/busses/i2c-mv64xxx
-
-define KernelPackage/i2c-mv64xxx
-  $(call i2c_defaults,$(I2C_MV64XXX_MODULES),59)
-  TITLE:=Orion Platform I2C interface support
-  DEPENDS:=@TARGET_kirkwood||TARGET_orion +kmod-i2c-core
-endef
-
-define KernelPackage/i2c-mv64xxx/description
- Kernel module for I2C interface on the Kirkwood, Orion and Armada XP/370
- family processors
-endef
-
-$(eval $(call KernelPackage,i2c-mv64xxx))
-
-
 I2C_TINY_USB_MODULES:= \
   CONFIG_I2C_TINY_USB:drivers/i2c/busses/i2c-tiny-usb
 

+ 17 - 9
package/kernel/linux/modules/lib.mk

@@ -195,20 +195,28 @@ endef
 $(eval $(call KernelPackage,lib-textsearch))
 
 
-define KernelPackage/lib-zlib
+define KernelPackage/lib-zlib-inflate
   SUBMENU:=$(LIB_MENU)
   TITLE:=Zlib support
   HIDDEN:=1
-  KCONFIG:= \
-    CONFIG_ZLIB_DEFLATE \
-    CONFIG_ZLIB_INFLATE
-  FILES:= \
-    $(LINUX_DIR)/lib/zlib_deflate/zlib_deflate.ko \
-    $(LINUX_DIR)/lib/zlib_inflate/zlib_inflate.ko
-  AUTOLOAD:=$(call AutoProbe,zlib_deflate zlib_inflate)
+  KCONFIG:=CONFIG_ZLIB_INFLATE
+  FILES:=$(LINUX_DIR)/lib/zlib_inflate/zlib_inflate.ko
+  AUTOLOAD:=$(call AutoProbe,zlib_inflate)
+endef
+
+$(eval $(call KernelPackage,lib-zlib-inflate))
+
+
+define KernelPackage/lib-zlib-deflate
+  SUBMENU:=$(LIB_MENU)
+  TITLE:=Zlib support
+  HIDDEN:=1
+  KCONFIG:=CONFIG_ZLIB_DEFLATE
+  FILES:=$(LINUX_DIR)/lib/zlib_deflate/zlib_deflate.ko
+  AUTOLOAD:=$(call AutoProbe,zlib_deflate)
 endef
 
-$(eval $(call KernelPackage,lib-zlib))
+$(eval $(call KernelPackage,lib-zlib-deflate))
 
 
 define KernelPackage/lib-cordic

+ 33 - 51
package/kernel/linux/modules/netdevices.mk

@@ -130,24 +130,6 @@ endef
 $(eval $(call KernelPackage,et131x))
 
 
-define KernelPackage/gw16083
-  SUBMENU:=$(NETWORK_DEVICES_MENU)
-  TITLE:=Gateworks Ventana Ethernet Expansion Mezzanine driver
-  URL:=http://www.gateworks.com
-  FILES:=$(LINUX_DIR)/drivers/net/phy/gw16083.ko
-  KCONFIG:=CONFIG_GATEWORKS_GW16083
-  DEPENDS:=@TARGET_imx6 @PCI_SUPPORT +kmod-libphy +kmod-igb
-  AUTOLOAD:=$(call AutoLoad,36,gw16083)
-endef
-
-define KernelPackage/gw16083/description
- This package contains the gw16083 kernel module for supporting the Gateworks
- Ventana Ethernet Expansion Mezzanine.
-endef
-
-$(eval $(call KernelPackage,gw16083))
-
-
 define KernelPackage/phylib-broadcom
    SUBMENU:=$(NETWORK_DEVICES_MENU)
    TITLE:=Broadcom Ethernet PHY library
@@ -380,7 +362,7 @@ $(eval $(call KernelPackage,via-rhine))
 define KernelPackage/via-velocity
   SUBMENU:=$(NETWORK_DEVICES_MENU)
   TITLE:=VIA Velocity Gigabit Ethernet Adapter kernel support
-  DEPENDS:=@TARGET_ixp4xx||TARGET_mpc83xx||PCI_SUPPORT +kmod-lib-crc-ccitt
+  DEPENDS:=@PCI_SUPPORT +kmod-lib-crc-ccitt
   KCONFIG:=CONFIG_VIA_VELOCITY
   FILES:=$(LINUX_DIR)/drivers/net/ethernet/via/via-velocity.ko
   AUTOLOAD:=$(call AutoProbe,via-velocity)
@@ -800,38 +782,6 @@ endef
 $(eval $(call KernelPackage,of-mdio))
 
 
-define KernelPackage/fsl-pq-mdio
-  SUBMENU:=$(NETWORK_DEVICES_MENU)
-  TITLE:=Freescale PQ MDIO bus support
-  DEPENDS:=@TARGET_mpc85xx +kmod-of-mdio
-  KCONFIG:=CONFIG_FSL_PQ_MDIO
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/freescale/fsl_pq_mdio.ko
-  AUTOLOAD:=$(call AutoLoad,42,fsl_pq_mdio)
-endef
-
-define KernelPackage/fsl-pq-mdio/description
- Kernel driver for the Freescale PQ MDIO bus
-endef
-
-$(eval $(call KernelPackage,fsl-pq-mdio))
-
-
-define KernelPackage/gianfar
-  SUBMENU:=$(NETWORK_DEVICES_MENU)
-  TITLE:=Gianfar Ethernet support
-  DEPENDS:=@TARGET_mpc85xx +kmod-fsl-pq-mdio
-  KCONFIG:=CONFIG_GIANFAR
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/freescale/gianfar_driver.ko
-  AUTOLOAD:=$(call AutoProbe,gianfar_driver)
-endef
-
-define KernelPackage/gianfar/description
- Kernel driver for Freescale Gianfar Ethernet support
-endef
-
-$(eval $(call KernelPackage,gianfar))
-
-
 define KernelPackage/vmxnet3
   SUBMENU:=$(NETWORK_DEVICES_MENU)
   TITLE:=VMware VMXNET3 ethernet driver 
@@ -863,3 +813,35 @@ define KernelPackage/spi-ks8995/description
 endef
 
 $(eval $(call KernelPackage,spi-ks8995))
+
+
+define KernelPackage/ethoc
+  SUBMENU:=$(NETWORK_DEVICES_MENU)
+  TITLE:=Opencore.org ethoc driver
+  DEPENDS:=+kmod-libphy
+  FILES:=$(LINUX_DIR)/drivers/net/ethernet/ethoc.ko
+  KCONFIG:=CONFIG_ETHOC
+  AUTOLOAD:=$(call AutoProbe,ethoc)
+endef
+
+define KernelPackage/ethoc/description
+  Kernel module for the Opencores.org ethernet adapter
+endef
+
+$(eval $(call KernelPackage,ethoc))
+
+
+define KernelPackage/bnx2
+  SUBMENU:=$(NETWORK_DEVICES_MENU)
+  TITLE:=BCM5706/5708/5709/5716 ethernet adapter driver
+  DEPENDS:=@PCI_SUPPORT +bnx2-firmware
+  FILES:=$(LINUX_DIR)/drivers/net/ethernet/broadcom/bnx2.ko
+  KCONFIG:=CONFIG_BNX2
+  AUTOLOAD:=$(call AutoProbe,bnx2)
+endef
+
+define KernelPackage/bnx2/description
+  Kernel module for the BCM5706/5708/5709/5716 ethernet adapter
+endef
+
+$(eval $(call KernelPackage,bnx2))

+ 22 - 0
package/kernel/linux/modules/netfilter.mk

@@ -289,6 +289,28 @@ endef
 $(eval $(call KernelPackage,ipt-nat))
 
 
+define KernelPackage/ipt-raw
+  TITLE:=Netfilter IPv4 raw table support
+  KCONFIG:=CONFIG_IP_NF_RAW
+  FILES:=$(LINUX_DIR)/net/ipv4/netfilter/iptable_raw.ko
+  AUTOLOAD:=$(call AutoProbe,iptable_raw)
+  $(call AddDepends/ipt)
+endef
+
+$(eval $(call KernelPackage,ipt-raw))
+
+
+define KernelPackage/ipt-raw6
+  TITLE:=Netfilter IPv6 raw table support
+  KCONFIG:=CONFIG_IP6_NF_RAW
+  FILES:=$(LINUX_DIR)/net/ipv6/netfilter/ip6table_raw.ko
+  AUTOLOAD:=$(call AutoProbe,ip6table_raw)
+  $(call AddDepends/ipt,+kmod-ip6tables)
+endef
+
+$(eval $(call KernelPackage,ipt-raw6))
+
+
 define KernelPackage/ipt-nat6
   TITLE:=IPv6 NAT targets
   KCONFIG:=$(KCONFIG_IPT_NAT6)

+ 4 - 137
package/kernel/linux/modules/other.mk

@@ -114,23 +114,8 @@ endef
 $(eval $(call KernelPackage,bluetooth_6lowpan))
 
 
-define KernelPackage/bluetooth-hci-h4p
-  SUBMENU:=$(OTHER_MENU)
-  TITLE:=HCI driver with H4 Nokia extensions
-  DEPENDS:=@TARGET_omap24xx +kmod-bluetooth
-  KCONFIG:=CONFIG_BT_HCIH4P
-  FILES:=$(LINUX_DIR)/drivers/bluetooth/hci_h4p/hci_h4p.ko
-  AUTOLOAD:=$(call AutoProbe,hci_h4p)
-endef
-
-define KernelPackage/bluetooth-hci-h4p/description
- HCI driver with H4 Nokia extensions
-endef
-
-$(eval $(call KernelPackage,bluetooth-hci-h4p))
-
-
 define KernelPackage/dma-buf
+  SUBMENU:=$(OTHER_MENU)
   TITLE:=DMA shared buffer support
   HIDDEN:=1
   KCONFIG:=CONFIG_DMA_SHARED_BUFFER
@@ -383,7 +368,7 @@ define KernelPackage/sdhci
 	$(LINUX_DIR)/drivers/mmc/host/sdhci.ko \
 	$(LINUX_DIR)/drivers/mmc/host/sdhci-pltfm.ko
 
-  AUTOLOAD:=$(call AutoProbe,sdhci sdhci-pltfm,1)
+  AUTOLOAD:=$(call AutoProbe,sdhci-pltfm,1)
 endef
 
 define KernelPackage/sdhci/description
@@ -481,38 +466,6 @@ endef
 $(eval $(call KernelPackage,bcma))
 
 
-define KernelPackage/wdt-omap
-  SUBMENU:=$(OTHER_MENU)
-  TITLE:=OMAP Watchdog timer
-  DEPENDS:=@(TARGET_omap24xx||TARGET_omap35xx)
-  KCONFIG:=CONFIG_OMAP_WATCHDOG
-  FILES:=$(LINUX_DIR)/drivers/$(WATCHDOG_DIR)/omap_wdt.ko
-  AUTOLOAD:=$(call AutoLoad,50,omap_wdt,1)
-endef
-
-define KernelPackage/wdt-omap/description
- Kernel module for TI omap watchdog timer
-endef
-
-$(eval $(call KernelPackage,wdt-omap))
-
-
-define KernelPackage/wdt-orion
-  SUBMENU:=$(OTHER_MENU)
-  TITLE:=Marvell Orion Watchdog timer
-  DEPENDS:=@TARGET_orion||TARGET_kirkwood
-  KCONFIG:=CONFIG_ORION_WATCHDOG
-  FILES:=$(LINUX_DIR)/drivers/$(WATCHDOG_DIR)/orion_wdt.ko
-  AUTOLOAD:=$(call AutoLoad,50,orion_wdt,1)
-endef
-
-define KernelPackage/wdt-orion/description
- Kernel module for Marvell Orion, Kirkwood and Armada XP/370 watchdog timer
-endef
-
-$(eval $(call KernelPackage,wdt-orion))
-
-
 define KernelPackage/rtc-ds1307
   SUBMENU:=$(OTHER_MENU)
   TITLE:=Dallas/Maxim DS1307 (and compatible) RTC support
@@ -583,23 +536,6 @@ endef
 $(eval $(call KernelPackage,rtc-isl1208))
 
 
-define KernelPackage/rtc-marvell
-  SUBMENU:=$(OTHER_MENU)
-  TITLE:=Marvell SoC built-in RTC support
-  DEPENDS:=@RTC_SUPPORT @TARGET_kirkwood||TARGET_orion
-  KCONFIG:=CONFIG_RTC_DRV_MV \
-	CONFIG_RTC_CLASS=y
-  FILES:=$(LINUX_DIR)/drivers/rtc/rtc-mv.ko
-  AUTOLOAD:=$(call AutoProbe,rtc-mv)
-endef
-
-define KernelPackage/rtc-marvell/description
- Kernel module for Marvell SoC built-in RTC.
-endef
-
-$(eval $(call KernelPackage,rtc-marvell))
-
-
 define KernelPackage/rtc-pcf8563
   SUBMENU:=$(OTHER_MENU)
   TITLE:=Philips PCF8563/Epson RTC8564 RTC support
@@ -650,22 +586,6 @@ endef
 
 $(eval $(call KernelPackage,rtc-pt7c4338))
 
-define KernelPackage/rtc-snvs
-  SUBMENU:=$(OTHER_MENU)
-  TITLE:=Freescale SNVS RTC support
-  DEPENDS:=@TARGET_imx6 @RTC_SUPPORT
-  KCONFIG:=CONFIG_RTC_DRV_SNVS \
-	CONFIG_RTC_CLASS=y
-  FILES:=$(LINUX_DIR)/drivers/rtc/rtc-snvs.ko
-  AUTOLOAD:=$(call AutoLoad,50,rtc-snvs,1)
-endef
-
-define KernelPackage/rtc-snvs/description
- Kernel module for Freescale SNVS RTC on chip module
-endef
-
-$(eval $(call KernelPackage,rtc-snvs))
-
 define KernelPackage/rtc-rs5c372a
   SUBMENU:=$(OTHER_MENU)
   TITLE:=Ricoh R2025S/D, RS5C372A/B, RV5C386, RV5C387A
@@ -791,22 +711,6 @@ endef
 $(eval $(call KernelPackage,zram))
 
 
-define KernelPackage/mvsdio
-  SUBMENU:=$(OTHER_MENU)
-  TITLE:=Marvell SDIO support
-  DEPENDS:=@TARGET_orion||TARGET_kirkwood +kmod-mmc
-  KCONFIG:=CONFIG_MMC_MVSDIO
-  FILES:=$(LINUX_DIR)/drivers/mmc/host/mvsdio.ko
-  AUTOLOAD:=$(call AutoProbe,mvsdio)
-endef
-
-define KernelPackage/mvsdio/description
- Kernel support for the Marvell SDIO controller
-endef
-
-$(eval $(call KernelPackage,mvsdio))
-
-
 define KernelPackage/pps
   SUBMENU:=$(OTHER_MENU)
   TITLE:=PPS support
@@ -881,7 +785,7 @@ $(eval $(call KernelPackage,ptp))
 define KernelPackage/ptp-gianfar
   SUBMENU:=$(OTHER_MENU)
   TITLE:=Freescale Gianfar PTP support
-  DEPENDS:=@TARGET_mpc85xx +kmod-gianfar +kmod-ptp
+  DEPENDS:=@TARGET_mpc85xx +kmod-ptp
   KCONFIG:=CONFIG_PTP_1588_CLOCK_GIANFAR
   FILES:=$(LINUX_DIR)/drivers/net/ethernet/freescale/gianfar_ptp.ko
   AUTOLOAD:=$(call AutoProbe,gianfar_ptp)
@@ -913,7 +817,7 @@ define KernelPackage/random-omap
   TITLE:=Hardware Random Number Generator OMAP support
   KCONFIG:=CONFIG_HW_RANDOM_OMAP
   FILES:=$(LINUX_DIR)/drivers/char/hw_random/omap-rng.ko
-  DEPENDS:=@(TARGET_omap24xx||TARGET_omap) +kmod-random-core
+  DEPENDS:=@TARGET_omap24xx +kmod-random-core
   AUTOLOAD:=$(call AutoProbe,random-omap)
 endef
 
@@ -954,43 +858,6 @@ endef
 $(eval $(call KernelPackage,thermal))
 
 
-define KernelPackage/thermal-imx
-  SUBMENU:=$(OTHER_MENU)
-  TITLE:=Temperature sensor driver for Freescale i.MX SoCs
-  DEPENDS:=@TARGET_imx6 +kmod-thermal
-  KCONFIG:= \
-	CONFIG_IMX_THERMAL
-  FILES:=$(LINUX_DIR)/drivers/thermal/imx_thermal.ko
-  AUTOLOAD:=$(call AutoProbe,imx_thermal)
-endef
-
-define KernelPackage/thermal-imx/description
- Support for Temperature Monitor (TEMPMON) found on Freescale i.MX SoCs.
- It supports one critical trip point and one passive trip point. The
- cpufreq is used as the cooling device to throttle CPUs when the
- passive trip is crossed.
-endef
-
-$(eval $(call KernelPackage,thermal-imx))
-
-
-define KernelPackage/thermal-kirkwood
-  SUBMENU:=$(OTHER_MENU)
-  TITLE:=Temperature sensor on Marvell Kirkwood SoCs
-  DEPENDS:=@TARGET_kirkwood +kmod-thermal
-  KCONFIG:=CONFIG_KIRKWOOD_THERMAL
-  FILES:=$(LINUX_DIR)/drivers/thermal/kirkwood_thermal.ko
-  AUTOLOAD:=$(call AutoProbe,kirkwood_thermal)
-endef
-
-define KernelPackage/thermal-kirkwood/description
- Support for the Kirkwood thermal sensor driver into the Linux thermal
- framework. Only kirkwood 88F6282 and 88F6283 have this sensor.
-endef
-
-$(eval $(call KernelPackage,thermal-kirkwood))
-
-
 define KernelPackage/gpio-beeper
   SUBMENU:=$(OTHER_MENU)
   TITLE:=GPIO beeper support

+ 47 - 8
package/kernel/linux/modules/pcmcia.mk

@@ -13,6 +13,7 @@ define KernelPackage/pcmcia-core
   DEPENDS:=@PCMCIA_SUPPORT
   KCONFIG:= \
 	CONFIG_PCMCIA \
+	CONFIG_PCMCIA_LOAD_CIS=y \
 	CONFIG_CARDBUS \
 	CONFIG_PCCARD \
 	PCMCIA_DEBUG=n
@@ -28,13 +29,19 @@ endef
 
 $(eval $(call KernelPackage,pcmcia-core))
 
-define KernelPackage/pcmcia-rsrc
+
+define AddDepends/pcmcia
   SUBMENU:=$(PCMCIA_MENU)
+  DEPENDS+=kmod-pcmcia-core $(1)
+endef
+
+
+define KernelPackage/pcmcia-rsrc
   TITLE:=PCMCIA resource support
-  DEPENDS:=kmod-pcmcia-core
   KCONFIG:=CONFIG_PCCARD_NONSTATIC=y
   FILES:=$(LINUX_DIR)/drivers/pcmcia/pcmcia_rsrc.ko
   AUTOLOAD:=$(call AutoLoad,26,pcmcia_rsrc)
+  $(call AddDepends/pcmcia)
 endef
 
 define KernelPackage/pcmcia-rsrc/description
@@ -45,26 +52,26 @@ $(eval $(call KernelPackage,pcmcia-rsrc))
 
 
 define KernelPackage/pcmcia-yenta
-  SUBMENU:=$(PCMCIA_MENU)
   TITLE:=yenta socket driver
-  DEPENDS:=kmod-pcmcia-rsrc
   KCONFIG:=CONFIG_YENTA
   FILES:=$(LINUX_DIR)/drivers/pcmcia/yenta_socket.ko
-  AUTOLOAD:=$(call AutoLoad,41,pcmcia_rsrc yenta_socket)
+  AUTOLOAD:=$(call AutoLoad,41,yenta_socket)
+  DEPENDS:=+kmod-pcmcia-rsrc
+  $(call AddDepends/pcmcia)
 endef
 
 $(eval $(call KernelPackage,pcmcia-yenta))
 
 
 define KernelPackage/pcmcia-serial
-  SUBMENU:=$(PCMCIA_MENU)
   TITLE:=Serial devices support
-  DEPENDS:=kmod-pcmcia-core +kmod-serial-8250
   KCONFIG:= \
 	CONFIG_PCMCIA_SERIAL_CS \
 	CONFIG_SERIAL_8250_CS
-    FILES:=$(LINUX_DIR)/drivers/tty/serial/8250/serial_cs.ko
+  FILES:=$(LINUX_DIR)/drivers/tty/serial/8250/serial_cs.ko
   AUTOLOAD:=$(call AutoLoad,45,serial_cs)
+  DEPENDS:=+kmod-serial-8250
+  $(call AddDepends/pcmcia)
 endef
 
 define KernelPackage/pcmcia-serial/description
@@ -72,3 +79,35 @@ define KernelPackage/pcmcia-serial/description
 endef
 
 $(eval $(call KernelPackage,pcmcia-serial))
+
+
+define KernelPackage/pcmcia-pd6729
+  TITLE:=Cirrus PD6729 compatible bridge support
+  KCONFIG:=CONFIG_PD6729
+  FILES:=$(LINUX_DIR)/drivers/pcmcia/pd6729.ko
+  AUTOLOAD:=$(call AutoLoad,41,pd6729)
+  DEPENDS:=+kmod-pcmcia-rsrc
+  $(call AddDepends/pcmcia)
+endef
+
+define KernelPackage/pcmcia-pd6729/description
+ Kernel support for the Cirrus PD6729 PCI-to-PCMCIA bridge
+endef
+
+$(eval $(call KernelPackage,pcmcia-pd6729))
+
+
+define KernelPackage/pcmcia-nozomi
+  TITLE:=Option Fusion+ card
+  KCONFIG:=CONFIG_NOZOMI
+  FILES:=$(LINUX_DIR)/drivers/tty/nozomi.ko
+  AUTOLOAD:=$(call AutoLoad,60,nozomi)
+  DEPENDS:=+kmod-pcmcia-rsrc
+  $(call AddDepends/pcmcia)
+endef
+
+define KernelPackage/pcmcia-nozomi/description
+ Kernel support for Option Fusion+ card
+endef
+
+$(eval $(call KernelPackage,pcmcia-nozomi))

+ 0 - 17
package/kernel/linux/modules/spi.mk

@@ -89,20 +89,3 @@ define KernelPackage/spi-dev/description
 endef
 
 $(eval $(call KernelPackage,spi-dev))
-
-define KernelPackage/spi-omap-24xx
-  SUBMENU:=$(SPI_MENU)
-  TITLE:=SPI omap 24xx
-  DEPENDS:=@(TARGET_omap24xx||TARGET_omap)
-  KCONFIG:=CONFIG_SPI_OMAP24XX \
-          CONFIG_SPI=y \
-          CONFIG_SPI_MASTER=y
-  FILES:=$(LINUX_DIR)/drivers/spi/spi-omap2-mcspi.ko
-  AUTOLOAD:=$(call AutoProbe,spi-omap2-mcspi)
-endef
-
-define KernelPackage/spi-dev/description
- This package contains the user mode SPI device driver
-endef
-
-$(eval $(call KernelPackage,spi-omap-24xx))

+ 4 - 234
package/kernel/linux/modules/usb.mk

@@ -55,69 +55,6 @@ endef
 $(eval $(call KernelPackage,usb-ledtrig-usbport))
 
 
-define KernelPackage/usb-musb-hdrc
-  TITLE:=Support for Mentor Graphics silicon dual role USB
-  KCONFIG:= \
-	CONFIG_USB_MUSB_HDRC \
-	CONFIG_USB_INVENTRA_DMA=n \
-	CONFIG_USB_TI_CPPI41_DMA=n \
-	CONFIG_MUSB_PIO_ONLY=y \
-	CONFIG_USB_MUSB_DUAL_ROLE=y \
-	CONFIG_USB_MUSB_GADGET=n \
-	CONFIG_USB_MUSB_HOST=n \
-	CONFIG_USB_MUSB_DEBUG=y
-  DEPENDS:= \
-	@(TARGET_omap||TARGET_omap24xx) +kmod-usb-gadget \
-	+TARGET_omap24xx:kmod-usb-musb-tusb6010
-  FILES:=$(LINUX_DIR)/drivers/usb/musb/musb_hdrc.ko
-  AUTOLOAD:=$(call AutoLoad,46,musb_hdrc)
-  $(call AddDepends/usb)
-endef
-
-define KernelPackage/usb-musb-hdrc/description
-  Kernel support for Mentor Graphics silicon dual role USB device.
-endef
-
-$(eval $(call KernelPackage,usb-musb-hdrc))
-
-
-define KernelPackage/usb-musb-platformglue
-  TITLE:=MUSB platform glue layer
-  KCONFIG:= \
-	CONFIG_USB_MUSB_TUSB6010=n \
-	CONFIG_USB_MUSB_OMAP2PLUS=n \
-	CONFIG_USB_MUSB_AM35X=n \
-	CONFIG_USB_MUSB_DSPS \
-	CONFIG_USB_MUSB_UX500=n
-  DEPENDS:=@TARGET_omap +kmod-usb-phy-nop +kmod-usb-musb-hdrc +kmod-usb-phy-am335x
-  FILES:= \
-	$(LINUX_DIR)/drivers/usb/musb/musb_dsps.ko \
-	$(LINUX_DIR)/drivers/usb/musb/musb_am335x.ko
-  AUTOLOAD:=$(call AutoLoad,45,phy-omap-control musb_dsps musb_am335x)
-  $(call AddDepends/usb)
-endef
-
-define KernelPackage/usb-musb-platformglue/description
-  MUSB platform glue modules
-endef
-
-$(eval $(call KernelPackage,usb-musb-platformglue))
-
-
-define KernelPackage/usb-musb-tusb6010
-  TITLE:=Support for TUSB 6010
-  KCONFIG:=CONFIG_USB_MUSB_TUSB6010
-  DEPENDS:=@TARGET_omap24xx
-  $(call AddDepends/usb)
-endef
-
-define KernelPackage/usb-musb-tusb6010/description
-  TUSB6010 support
-endef
-
-$(eval $(call KernelPackage,usb-musb-tusb6010))
-
-
 define KernelPackage/usb-phy-nop
   TITLE:=Support for USB NOP transceiver
   KCONFIG:=CONFIG_NOP_USB_XCEIV
@@ -134,94 +71,6 @@ endef
 $(eval $(call KernelPackage,usb-phy-nop))
 
 
-define KernelPackage/usb-phy-am335x
-  TITLE:=Support for AM335x USB PHY
-  KCONFIG:= \
-	CONFIG_AM335X_PHY_USB \
-	CONFIG_AM335X_CONTROL_USB
-  DEPENDS:=@TARGET_omap +kmod-usb-phy-nop
-  FILES:= \
-	$(LINUX_DIR)/drivers/usb/phy/phy-am335x.ko \
-	$(LINUX_DIR)/drivers/usb/phy/phy-am335x-control.ko
-  AUTOLOAD:=$(call AutoLoad,44,phy-am335x)
-  $(call AddDepends/usb)
-endef
-
-define KernelPackage/usb-phy-am335x/description
-  Support for AM335x USB PHY
-endef
-
-$(eval $(call KernelPackage,usb-phy-am335x))
-
-
-define KernelPackage/usb-phy-omap-usb2
-  TITLE:=Support for OMAP2 USB PHY
-  KCONFIG:= \
-	CONFIG_OMAP_USB2 \
-	CONFIG_OMAP_CONTROL_PHY
-  DEPENDS:=@TARGET_omap
-  FILES:= \
-	$(LINUX_DIR)/drivers/phy/phy-omap-usb2.ko \
-	$(LINUX_DIR)/drivers/phy/phy-omap-control.ko
-  AUTOLOAD:=$(call AutoLoad,45,phy-omap-control phy-omap-usb2)
-  $(call AddDepends/usb)
-endef
-
-define KernelPackage/usb-phy-omap-usb2/description
-  Support for AM335x USB PHY
-endef
-
-$(eval $(call KernelPackage,usb-phy-omap-usb2))
-
-
-define KernelPackage/usb-phy-omap-usb3
-  TITLE:=Support for OMAP USB3 PHY
-  KCONFIG:=CONFIG_OMAP_USB3
-  DEPENDS:=@TARGET_omap +kmod-usb-phy-omap-usb2
-  FILES:=$(LINUX_DIR)/drivers/usb/phy/phy-omap-usb3.ko
-  AUTOLOAD:=$(call AutoLoad,45,phy-omap-usb3)
-  $(call AddDepends/usb)
-endef
-
-define KernelPackage/usb-phy-omap-usb3/description
-  Support for OMAP USB3 PHY
-endef
-
-$(eval $(call KernelPackage,usb-phy-omap-usb3))
-
-
-define KernelPackage/usb-phy-twl4030
-  TITLE:=Support for TWL4030 OTG PHY
-  KCONFIG:=CONFIG_TWL4030_USB
-  DEPENDS:=@TARGET_omap +kmod-usb-phy-omap-usb2 +kmod-usb-musb-hdrc
-  FILES:=$(LINUX_DIR)/drivers/phy/phy-twl4030-usb.ko
-  AUTOLOAD:=$(call AutoLoad,45,phy-twl4030-usb)
-  $(call AddDepends/usb)
-endef
-
-define KernelPackage/usb-phy-twl4030/description
-  Support for TWL4030/TWL5030/TPS659x0 OTG PHY
-endef
-
-$(eval $(call KernelPackage,usb-phy-twl4030))
-
-
-define KernelPackage/usb-phy-twl6030
-  TITLE:=Support for TWL6030 OTG PHY
-  KCONFIG:=CONFIG_TWL6030_USB
-  DEPENDS:=@TARGET_omap +kmod-usb-phy-omap-usb2 +kmod-usb-musb-hdrc
-  FILES:=$(LINUX_DIR)/drivers/usb/phy/phy-twl6030-usb.ko
-  AUTOLOAD:=$(call AutoLoad,45,phy-twl6030-usb)
-  $(call AddDepends/usb)
-endef
-
-define KernelPackage/usb-phy-twl6030/description
-  Support for TWL6030 OTG PHY
-endef
-
-$(eval $(call KernelPackage,usb-phy-twl6030))
-
-
 define KernelPackage/usb-gadget
   TITLE:=USB Gadget support
   KCONFIG:=CONFIG_USB_GADGET
@@ -400,40 +249,6 @@ endef
 $(eval $(call KernelPackage,usb-ohci-pci))
 
 
-define KernelPackage/usb2-fsl
-  TITLE:=Support for Freescale USB2 controllers
-  DEPENDS:=@TARGET_mpc85xx
-  HIDDEN:=1
-  KCONFIG:=CONFIG_USB_FSL_MPH_DR_OF
-  FILES:=$(LINUX_DIR)/drivers/usb/host/fsl-mph-dr-of.ko
-  AUTOLOAD:=$(call AutoLoad,39,fsl-mph-dr-of,1)
-  $(call AddDepends/usb)
-endef
-
-define KernelPackage/usb2-fsl/description
- Kernel support for Freescale USB2 (EHCI) controllers
-endef
-
-$(eval $(call KernelPackage,usb2-fsl))
-
-
-define KernelPackage/usb2-omap
-  TITLE:=Support for USB2 for OMAP
-  DEPENDS:=@TARGET_omap +kmod-usb-phy-nop +kmod-usb-phy-am335x +kmod-usb2
-  KCONFIG:=\
-	CONFIG_MFD_OMAP_USB_HOST=y \
-	CONFIG_USB_EHCI_HCD_OMAP
-  FILES:=$(LINUX_DIR)/drivers/usb/host/ehci-omap.ko
-  AUTOLOAD:=$(call AutoLoad,39,ehci-omap)
-  $(call AddDepends/usb)
-endef
-
-define KernelPackage/usb2-omap/description
- Kernel support for OMAP USB2 (EHCI) controllers
-endef
-
-$(eval $(call KernelPackage,usb2-omap))
-
 define KernelPackage/usb-bcma
   TITLE:=Support for BCMA USB controllers
   DEPENDS:=@USB_SUPPORT @TARGET_brcm47xx||TARGET_bcm53xx
@@ -464,8 +279,7 @@ define KernelPackage/usb2
 	+TARGET_brcm47xx:kmod-usb-bcma \
 	+TARGET_brcm47xx:kmod-usb-ssb \
 	+TARGET_bcm53xx:kmod-usb-bcma \
-	+TARGET_bcm53xx:kmod-phy-bcm-ns-usb2 \
-	+TARGET_mpc85xx:kmod-usb2-fsl
+	+TARGET_bcm53xx:kmod-phy-bcm-ns-usb2
   KCONFIG:=\
 	CONFIG_USB_EHCI_HCD \
 	CONFIG_USB_EHCI_ATH79=y \
@@ -486,10 +300,7 @@ define KernelPackage/usb2
   ifneq ($(wildcard $(LINUX_DIR)/drivers/usb/host/ehci-atmel.ko),)
     FILES+=$(LINUX_DIR)/drivers/usb/host/ehci-atmel.ko
   endif
-  ifneq ($(wildcard $(LINUX_DIR)/drivers/usb/host/ehci-fsl.ko),)
-    FILES+=$(LINUX_DIR)/drivers/usb/host/ehci-fsl.ko
-  endif
-  AUTOLOAD:=$(call AutoLoad,40,ehci-hcd ehci-platform ehci-orion ehci-atmel ehci-fsl,1)
+  AUTOLOAD:=$(call AutoLoad,40,ehci-hcd ehci-platform ehci-orion ehci-atmel,1)
   $(call AddDepends/usb)
 endef
 
@@ -518,7 +329,7 @@ $(eval $(call KernelPackage,usb2-pci))
 
 define KernelPackage/usb-dwc2
   TITLE:=DWC2 USB controller driver
-  DEPENDS:=+(TARGET_brcm2708||TARGET_at91||TARGET_brcm63xx||TARGET_mxs||TARGET_imx6||TARGET_omap):kmod-usb-gadget
+  DEPENDS:=+USB_GADGET_SUPPORT:kmod-usb-gadget
   KCONFIG:= \
 	CONFIG_USB_DWC2 \
 	CONFIG_USB_DWC2_PCI \
@@ -1564,46 +1375,6 @@ endef
 $(eval $(call KernelPackage,usbip-server))
 
 
-define KernelPackage/usb-chipidea-imx
-  TITLE:=Support for ChipIdea controllers
-  DEPENDS:=@TARGET_imx6||TARGET_mxs +kmod-usb2 +USB_GADGET_SUPPORT:kmod-usb-gadget
-  KCONFIG:=\
-	CONFIG_USB_CHIPIDEA \
-	CONFIG_USB_CHIPIDEA_HOST=y \
-	CONFIG_USB_CHIPIDEA_UDC=y \
-	CONFIG_USB_CHIPIDEA_DEBUG=y
-  FILES:=\
-	$(LINUX_DIR)/drivers/usb/chipidea/ci_hdrc.ko \
-	$(if $(CONFIG_OF),$(LINUX_DIR)/drivers/usb/chipidea/ci_hdrc_imx.ko) \
-	$(if $(CONFIG_OF),$(LINUX_DIR)/drivers/usb/chipidea/usbmisc_imx.ko)
-  AUTOLOAD:=$(call AutoLoad,51,ci_hdrc $(if $(CONFIG_OF),ci_hdrc_imx usbmisc_imx),1)
-  $(call AddDepends/usb)
-endef
-
-define KernelPackage/usb-chipidea-imx/description
- Kernel support for USB ChipIdea controllers
-endef
-
-$(eval $(call KernelPackage,usb-chipidea-imx,1))
-
-
-define KernelPackage/usb-mxs-phy
-  TITLE:=Support for Freescale MXS USB PHY
-  DEPENDS:=@TARGET_imx6||TARGET_mxs +TARGET_mxs:kmod-usb-chipidea-imx
-  KCONFIG:=CONFIG_USB_MXS_PHY
-  FILES:=\
-	$(LINUX_DIR)/drivers/usb/phy/phy-mxs-usb.ko
-  AUTOLOAD:=$(call AutoLoad,52,phy-mxs-usb,1)
-  $(call AddDepends/usb)
-endef
-
-define KernelPackage/usb-mxs-phy/description
- Kernel support for Freescale MXS USB PHY
-endef
-
-$(eval $(call KernelPackage,usb-mxs-phy,1))
-
-
 define KernelPackage/usbmon
   TITLE:=USB traffic monitor
   KCONFIG:=CONFIG_USB_MON
@@ -1629,8 +1400,7 @@ define KernelPackage/usb3
   TITLE:=Support for USB3 controllers
   DEPENDS:= \
 	+TARGET_bcm53xx:kmod-usb-bcma \
-	+TARGET_bcm53xx:kmod-phy-bcm-ns-usb3 \
-	+TARGET_omap:kmod-usb-phy-omap-usb3
+	+TARGET_bcm53xx:kmod-phy-bcm-ns-usb3
   KCONFIG:= \
 	CONFIG_USB_XHCI_HCD \
 	CONFIG_USB_XHCI_PCI \

+ 1 - 1
package/kernel/linux/modules/w1.mk

@@ -82,7 +82,7 @@ $(eval $(call KernelPackage,w1-master-ds2490))
 
 define KernelPackage/w1-master-mxc
   TITLE:=Freescale MXC 1-wire busmaster
-  DEPENDS:=@(TARGET_mxs||TARGET_imx6)
+  DEPENDS:=@TARGET_imx6
   KCONFIG:=CONFIG_W1_MASTER_MXC
   FILES:=$(W1_MASTERS_DIR)/mxc_w1.ko
   AUTOLOAD:=$(call AutoProbe,mxc_w1)

+ 94 - 11
package/kernel/mac80211/Makefile

@@ -14,7 +14,7 @@ PKG_VERSION:=2016-10-08
 PKG_RELEASE:=1
 PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
 PKG_BACKPORT_VERSION:=
-PKG_MD5SUM:=4f6350e3b75815060bfdf47ef266ad613c7bfea5b7b1dc4552dee69e1bebe4fb
+PKG_HASH:=4f6350e3b75815060bfdf47ef266ad613c7bfea5b7b1dc4552dee69e1bebe4fb
 
 PKG_SOURCE:=compat-wireless-$(PKG_VERSION)$(PKG_BACKPORT_VERSION).tar.bz2
 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION)
@@ -24,9 +24,10 @@ PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
 
 PKG_DRIVERS = \
 	ath ath5k ath9k ath9k-common ath9k-htc \
+	carl9170 \
 	lib80211 \
 	mac80211-hwsim \
-
+	rt2800-lib rt2800-mmio rt2800-soc \
 
 PKG_CONFIG_DEPENDS:= \
 	CONFIG_PACKAGE_kmod-mac80211 \
@@ -36,8 +37,6 @@ PKG_CONFIG_DEPENDS:= \
 	CONFIG_PACKAGE_MAC80211_TRACING \
 	CONFIG_PACKAGE_ATH_DEBUG \
 	CONFIG_PACKAGE_ATH_DFS \
-	CONFIG_ATH9K_SUPPORT_PCOEM \
-	CONFIG_ATH9K_TX99 \
 	CONFIG_ATH_USER_REGD \
 
 include $(INCLUDE_DIR)/package.mk
@@ -104,6 +103,26 @@ define KernelPackage/mac80211/description
 Generic IEEE 802.11 Networking Stack (mac80211)
 endef
 
+define KernelPackage/adm8211
+  $(call KernelPackage/mac80211/Default)
+  TITLE:=ADMTek 8211 support
+  DEPENDS+=@PCI_SUPPORT +kmod-mac80211 +kmod-eeprom-93cx6
+  FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/admtek/adm8211.ko
+  AUTOLOAD:=$(call AutoProbe,adm8211)
+endef
+
+define KernelPackage/airo
+  $(call KernelPackage/mac80211/Default)
+  TITLE:=Cisco Aironet driver
+  DEPENDS+=@PCI_SUPPORT +@DRIVER_WEXT_SUPPORT +kmod-cfg80211 @TARGET_x86
+  FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/cisco/airo.ko
+  AUTOLOAD:=$(call AutoProbe,airo)
+endef
+
+define KernelPackage/airo/description
+ Kernel support for Cisco Aironet cards
+endef
+
 define KernelPackage/ath/config
   if PACKAGE_kmod-ath
 	config ATH_USER_REGD
@@ -122,7 +141,7 @@ define KernelPackage/ath/config
 		bool "Atheros wireless debugging"
 		help
 		  Say Y, if you want to debug atheros wireless drivers.
-		  Only ath9k & ath10k make use of this.
+		  Only ath9k makes use of this.
 
 	config PACKAGE_ATH_DFS
 		bool "Enable DFS support"
@@ -152,7 +171,7 @@ define KernelPackage/ath5k
   $(call KernelPackage/mac80211/Default)
   TITLE:=Atheros 5xxx wireless cards support
   URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath5k
-  DEPENDS+= @PCI_SUPPORT||@TARGET_ath25 +kmod-ath
+  DEPENDS+= @PCI_SUPPORT||@TARGET_ath25 +kmod-ath +@DRIVER_11W_SUPPORT
   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath5k/ath5k.ko
   AUTOLOAD:=$(call AutoProbe,ath5k)
 endef
@@ -198,6 +217,11 @@ define KernelPackage/ath9k/config
                bool "Enable TX99 support"
                depends on PACKAGE_kmod-ath9k
 
+	config ATH9K_UBNTHSR
+		bool "Support for Ubiquiti UniFi Outdoor+ access point"
+		depends on PACKAGE_kmod-ath9k && TARGET_ar71xx_generic
+		default y
+
 endef
 
 define KernelPackage/ath9k-htc
@@ -215,6 +239,15 @@ This module adds support for wireless adapters based on
 Atheros USB AR9271 and AR7010 family of chipsets.
 endef
 
+define KernelPackage/carl9170
+  $(call KernelPackage/mac80211/Default)
+  TITLE:=Driver for Atheros AR9170 USB sticks
+  DEPENDS:=@USB_SUPPORT +kmod-mac80211 +kmod-ath +kmod-usb-core +kmod-input-core +@DRIVER_11N_SUPPORT +carl9170-firmware
+  FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/carl9170/carl9170.ko
+  AUTOLOAD:=$(call AutoProbe,carl9170)
+endef
+
+
 define KernelPackage/lib80211
   $(call KernelPackage/mac80211/Default)
   TITLE:=802.11 Networking stack
@@ -241,7 +274,6 @@ define KernelPackage/lib80211/description
  - lib80211_crytp_ccmp
 endef
 
-
 define KernelPackage/mac80211-hwsim
   $(call KernelPackage/mac80211/Default)
   TITLE:=mac80211 HW simulation device
@@ -250,6 +282,31 @@ define KernelPackage/mac80211-hwsim
   AUTOLOAD:=$(call AutoProbe,mac80211_hwsim)
 endef
 
+define KernelPackage/rt2800-lib
+$(call KernelPackage/rt2x00/Default)
+  DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT||TARGET_ramips) +kmod-rt2x00-lib +kmod-lib-crc-ccitt +@DRIVER_11N_SUPPORT
+  HIDDEN:=1
+  TITLE+= (rt2800 LIB)
+  FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2800lib.ko
+endef
+
+define KernelPackage/rt2800-mmio
+$(call KernelPackage/rt2x00/Default)
+  TITLE += (RT28xx/RT3xxx MMIO)
+  DEPENDS += +kmod-rt2800-lib +kmod-rt2x00-mmio
+  HIDDEN:=1
+  FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2800mmio.ko
+endef
+
+define KernelPackage/rt2800-soc
+$(call KernelPackage/rt2x00/Default)
+  DEPENDS += @(TARGET_ramips_rt288x||TARGET_ramips_rt305x||TARGET_ramips_rt3883||TARGET_ramips_mt7620) +kmod-rt2800-mmio +kmod-rt2800-lib
+  TITLE += (RT28xx/RT3xxx SoC)
+  FILES := \
+	$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2x00soc.ko \
+	$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2800soc.ko
+  AUTOLOAD:=$(call AutoProbe,rt2800soc)
+endef
 
 config_package=$(if $(CONFIG_PACKAGE_kmod-$(1)),m)
 
@@ -263,7 +320,19 @@ config-y:= \
 	MAC80211_RC_MINSTREL_HT \
 	MAC80211_RC_MINSTREL_VHT \
 	MAC80211_RC_DEFAULT_MINSTREL \
+	WLAN_VENDOR_ADMTEK \
 	WLAN_VENDOR_ATH \
+	WLAN_VENDOR_ATMEL \
+	WLAN_VENDOR_INTEL \
+	WLAN_VENDOR_INTERSIL \
+	WLAN_VENDOR_MARVELL \
+	WLAN_VENDOR_MEDIATEK \
+	WLAN_VENDOR_RALINK \
+	WLAN_VENDOR_REALTEK \
+	WLAN_VENDOR_RSI \
+	WLAN_VENDOR_ST \
+	WLAN_VENDOR_TI \
+	WLAN_VENDOR_ZYDAS \
 
 config-$(call config_package,cfg80211) += CFG80211
 
@@ -281,7 +350,6 @@ endif
 
 ifdef CONFIG_PACKAGE_MAC80211_TRACING
   config-y += \
-	ATH10K_TRACING \
 	ATH6KL_TRACING \
 	ATH_TRACEPOINTS \
 	WIL6210_TRACING \
@@ -291,9 +359,11 @@ endif
 
 config-$(call config_package,lib80211) += LIB80211 LIB80211_CRYPT_WEP LIB80211_CRYPT_CCMP LIB80211_CRYPT_TKIP
 
+config-$(call config_package,airo) += AIRO
+
 config-$(call config_package,ath) += ATH_CARDS ATH_COMMON
-config-$(CONFIG_PACKAGE_ATH_DEBUG) += ATH_DEBUG ATH10K_DEBUG ATH9K_STATION_STATISTICS
-config-$(CONFIG_PACKAGE_ATH_DFS) += ATH9K_DFS_CERTIFIED ATH10K_DFS_CERTIFIED
+config-$(CONFIG_PACKAGE_ATH_DEBUG) += ATH_DEBUG ATH9K_STATION_STATISTICS
+config-$(CONFIG_PACKAGE_ATH_DFS) += ATH9K_DFS_CERTIFIED
 
 config-$(call config_package,ath9k) += ATH9K
 config-$(call config_package,ath9k-common) += ATH9K_COMMON
@@ -302,9 +372,9 @@ config-$(CONFIG_PCI) += ATH9K_PCI
 config-$(CONFIG_ATH_USER_REGD) += ATH_USER_REGD
 config-$(CONFIG_ATH9K_SUPPORT_PCOEM) += ATH9K_PCOEM
 config-$(CONFIG_ATH9K_TX99) += ATH9K_TX99
+config-$(CONFIG_ATH9K_UBNTHSR) += ATH9K_UBNTHSR
 
 config-$(call config_package,ath9k-htc) += ATH9K_HTC
-config-$(call config_package,ath10k) += ATH10K ATH10K_PCI
 
 config-$(call config_package,ath5k) += ATH5K
 ifdef CONFIG_TARGET_ath25
@@ -317,6 +387,10 @@ config-$(call config_package,carl9170) += CARL9170
 
 config-$(call config_package,mac80211-hwsim) += MAC80211_HWSIM
 
+config-$(call config_package,rt2800-lib) += RT2800_LIB
+
+config-$(call config_package,rt2800-soc) += RT2800SOC
+
 config-$(CONFIG_LEDS_TRIGGERS) += MAC80211_LEDS
 
 MAKE_OPTS:= -C "$(PKG_BUILD_DIR)" \
@@ -397,17 +471,26 @@ define Build/InstallDev
 	rm -f $(1)/usr/include/mac80211-backport/linux/module.h
 endef
 
+
 define KernelPackage/cfg80211/install
 	$(INSTALL_DIR) $(1)/lib/wifi $(1)/lib/netifd/wireless
 	$(INSTALL_DATA) ./files/lib/wifi/mac80211.sh $(1)/lib/wifi
 	$(INSTALL_BIN) ./files/lib/netifd/wireless/mac80211.sh $(1)/lib/netifd/wireless
+	$(INSTALL_DIR) $(1)/etc/hotplug.d/ieee80211
+	$(INSTALL_DATA) ./files/mac80211.hotplug $(1)/etc/hotplug.d/ieee80211/00-wifi-detect
 endef
 
+
 $(eval $(call KernelPackage,ath))
 $(eval $(call KernelPackage,ath5k))
 $(eval $(call KernelPackage,ath9k))
 $(eval $(call KernelPackage,ath9k-common))
+$(eval $(call KernelPackage,ath9k-htc))
+$(eval $(call KernelPackage,carl9170))
 $(eval $(call KernelPackage,cfg80211))
 $(eval $(call KernelPackage,lib80211))
 $(eval $(call KernelPackage,mac80211))
 $(eval $(call KernelPackage,mac80211-hwsim))
+$(eval $(call KernelPackage,rt2800-lib))
+$(eval $(call KernelPackage,rt2800-mmio))
+$(eval $(call KernelPackage,rt2800-soc))

+ 36 - 1
package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh

@@ -611,7 +611,42 @@ mac80211_setup_vif() {
 				mcval=
 				[ -n "$mcast_rate" ] && wpa_supplicant_add_rate mcval "$mcast_rate"
 
-				iw dev "$ifname" mesh join "$mesh_id" ${mcval:+mcast-rate $mcval}
+				case "$htmode" in
+					VHT20|HT20) mesh_htmode=HT20;;
+					HT40*|VHT40)
+						case "$hwmode" in
+							a)
+								case "$(( ($channel / 4) % 2 ))" in
+									1) mesh_htmode="HT40+" ;;
+									0) mesh_htmode="HT40-";;
+								esac
+							;;
+							*)
+								case "$htmode" in
+									HT40+) mesh_htmode="HT40+";;
+									HT40-) mesh_htmode="HT40-";;
+									*)
+										if [ "$channel" -lt 7 ]; then
+											mesh_htmode="HT40+"
+										else
+											mesh_htmode="HT40-"
+										fi
+									;;
+								esac
+							;;
+						esac
+					;;
+					VHT80)
+						mesh_htmode="80Mhz"
+					;;
+					VHT160)
+						mesh_htmode="160Mhz"
+					;;
+					*) mesh_htmode="NOHT" ;;
+				esac
+
+				freq="$(get_freq "$phy" "$channel")"
+				iw dev "$ifname" mesh join "$mesh_id" freq $freq $mesh_htmode ${mcval:+mcast-rate $mcval}
 			fi
 
 			for var in $MP_CONFIG_INT $MP_CONFIG_BOOL $MP_CONFIG_STRING; do

+ 1 - 1
package/kernel/mac80211/patches/004-fix_duplicate_skcipher_backport.patch

@@ -1,6 +1,6 @@
 --- a/compat/Makefile
 +++ b/compat/Makefile
-@@ -36,8 +36,6 @@ compat-$(CPTCFG_KERNEL_4_7) += backport-
+@@ -35,8 +35,6 @@ compat-$(CPTCFG_KERNEL_4_6) += backport-
  
  compat-$(CPTCFG_BPAUTO_BUILD_CRYPTO_CCM) += crypto-ccm.o
  compat-$(CPTCFG_BPAUTO_CRYPTO_SKCIPHER) += crypto-skcipher.o

+ 3 - 2
package/kernel/mac80211/patches/315-ath9k_hw-issue-external-reset-for-QCA955x.patch

@@ -91,7 +91,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  	return true;
  }
  
-@@ -1356,24 +1373,23 @@ static bool ath9k_hw_set_reset(struct at
+@@ -1356,24 +1373,24 @@ static bool ath9k_hw_set_reset(struct at
  			rst_flags |= AR_RTC_RC_MAC_COLD;
  	}
  
@@ -115,7 +115,8 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 -		REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  	}
  
-+	ath9k_hw_external_reset(ah, type);
++	if (!AR_SREV_9100(ah))
++		ath9k_hw_external_reset(ah, type);
 +
 +	if (AR_SREV_9300(ah) || AR_SREV_9580(ah))
 +		REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);

+ 1 - 1
package/kernel/mac80211/patches/325-ath9k-fix-ath9k_hw_gpio_get-to-return-0-or-1-on-succ.patch

@@ -18,7 +18,7 @@ Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
 
 --- a/drivers/net/wireless/ath/ath9k/hw.c
 +++ b/drivers/net/wireless/ath/ath9k/hw.c
-@@ -2812,7 +2812,7 @@ u32 ath9k_hw_gpio_get(struct ath_hw *ah,
+@@ -2813,7 +2813,7 @@ u32 ath9k_hw_gpio_get(struct ath_hw *ah,
  		WARN_ON(1);
  	}
  

+ 65 - 0
package/kernel/mac80211/patches/329-ath9k-unlock-rcu-read-when-returning-early.patch

@@ -0,0 +1,65 @@
+From: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
+Date: Mon, 12 Dec 2016 19:50:01 +0100
+Subject: [PATCH] ath9k: unlock rcu read when returning early
+
+Starting with ath9k: use ieee80211_tx_status_noskb where possible
+[d94a461d7a7df68991fb9663531173f60ef89c68] the driver uses rcu_read_lock() &&
+rcu_read_unlock() yet on returning early in ath_tx_edma_tasklet() the unlock is
+missing leading to stalls and suspicious RCU usage:
+
+ ===============================
+ [ INFO: suspicious RCU usage. ]
+ 4.9.0-rc8 #11 Not tainted
+ -------------------------------
+ kernel/rcu/tree.c:705 Illegal idle entry in RCU read-side critical section.!
+
+ other info that might help us debug this:
+
+ RCU used illegally from idle CPU!
+ rcu_scheduler_active = 1, debug_locks = 0
+ RCU used illegally from extended quiescent state!
+ 1 lock held by swapper/7/0:
+ #0:
+  (
+ rcu_read_lock
+ ){......}
+ , at:
+ [<ffffffffa06ed110>] ath_tx_edma_tasklet+0x0/0x450 [ath9k]
+
+ stack backtrace:
+ CPU: 7 PID: 0 Comm: swapper/7 Not tainted 4.9.0-rc8 #11
+ Hardware name: Acer Aspire V3-571G/VA50_HC_CR, BIOS V2.21 12/16/2013
+  ffff88025efc3f38 ffffffff8132b1e5 ffff88017ede4540 0000000000000001
+  ffff88025efc3f68 ffffffff810a25f7 ffff88025efcee60 ffff88017edebdd8
+  ffff88025eeb5400 0000000000000091 ffff88025efc3f88 ffffffff810c3cd4
+ Call Trace:
+  <IRQ>
+  [<ffffffff8132b1e5>] dump_stack+0x68/0x93
+  [<ffffffff810a25f7>] lockdep_rcu_suspicious+0xd7/0x110
+  [<ffffffff810c3cd4>] rcu_eqs_enter_common.constprop.85+0x154/0x200
+  [<ffffffff810c5a54>] rcu_irq_exit+0x44/0xa0
+  [<ffffffff81058631>] irq_exit+0x61/0xd0
+  [<ffffffff81018d25>] do_IRQ+0x65/0x110
+  [<ffffffff81672189>] common_interrupt+0x89/0x89
+  <EOI>
+  [<ffffffff814ffe11>] ? cpuidle_enter_state+0x151/0x200
+  [<ffffffff814ffee2>] cpuidle_enter+0x12/0x20
+  [<ffffffff8109a6ae>] call_cpuidle+0x1e/0x40
+  [<ffffffff8109a8f6>] cpu_startup_entry+0x146/0x220
+  [<ffffffff810336f8>] start_secondary+0x148/0x170
+
+Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/xmit.c
++++ b/drivers/net/wireless/ath/ath9k/xmit.c
+@@ -2757,7 +2757,7 @@ void ath_tx_edma_tasklet(struct ath_soft
+ 		fifo_list = &txq->txq_fifo[txq->txq_tailidx];
+ 		if (list_empty(fifo_list)) {
+ 			ath_txq_unlock(sc, txq);
+-			return;
++			break;
+ 		}
+ 
+ 		bf = list_first_entry(fifo_list, struct ath_buf, list);

+ 196 - 0
package/kernel/mac80211/patches/334-mac80211-minstrel_ht-move-supported-bitrate-mask-out.patch

@@ -0,0 +1,196 @@
+From: Felix Fietkau <nbd@nbd.name>
+Date: Wed, 14 Dec 2016 19:33:23 +0100
+Subject: [PATCH] mac80211: minstrel_ht: move supported bitrate mask out of
+ group data
+
+Improves dcache footprint by ensuring that fewer cache lines need to be
+touched.
+
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+---
+
+--- a/net/mac80211/rc80211_minstrel_ht.c
++++ b/net/mac80211/rc80211_minstrel_ht.c
+@@ -301,7 +301,7 @@ minstrel_ht_get_stats(struct minstrel_pr
+ 				break;
+ 
+ 		/* short preamble */
+-		if (!(mi->groups[group].supported & BIT(idx)))
++		if (!(mi->supported[group] & BIT(idx)))
+ 			idx += 4;
+ 	}
+ 	return &mi->groups[group].rates[idx];
+@@ -486,7 +486,7 @@ minstrel_ht_prob_rate_reduce_streams(str
+ 			  MCS_GROUP_RATES].streams;
+ 	for (group = 0; group < ARRAY_SIZE(minstrel_mcs_groups); group++) {
+ 		mg = &mi->groups[group];
+-		if (!mg->supported || group == MINSTREL_CCK_GROUP)
++		if (!mi->supported[group] || group == MINSTREL_CCK_GROUP)
+ 			continue;
+ 
+ 		tmp_idx = mg->max_group_prob_rate % MCS_GROUP_RATES;
+@@ -540,7 +540,7 @@ minstrel_ht_update_stats(struct minstrel
+ 	for (group = 0; group < ARRAY_SIZE(minstrel_mcs_groups); group++) {
+ 
+ 		mg = &mi->groups[group];
+-		if (!mg->supported)
++		if (!mi->supported[group])
+ 			continue;
+ 
+ 		mi->sample_count++;
+@@ -550,7 +550,7 @@ minstrel_ht_update_stats(struct minstrel
+ 			tmp_group_tp_rate[j] = group;
+ 
+ 		for (i = 0; i < MCS_GROUP_RATES; i++) {
+-			if (!(mg->supported & BIT(i)))
++			if (!(mi->supported[group] & BIT(i)))
+ 				continue;
+ 
+ 			index = MCS_GROUP_RATES * group + i;
+@@ -636,7 +636,7 @@ minstrel_set_next_sample_idx(struct mins
+ 		mi->sample_group %= ARRAY_SIZE(minstrel_mcs_groups);
+ 		mg = &mi->groups[mi->sample_group];
+ 
+-		if (!mg->supported)
++		if (!mi->supported[mi->sample_group])
+ 			continue;
+ 
+ 		if (++mg->index >= MCS_GROUP_RATES) {
+@@ -657,7 +657,7 @@ minstrel_downgrade_rate(struct minstrel_
+ 	while (group > 0) {
+ 		group--;
+ 
+-		if (!mi->groups[group].supported)
++		if (!mi->supported[group])
+ 			continue;
+ 
+ 		if (minstrel_mcs_groups[group].streams >
+@@ -994,7 +994,7 @@ minstrel_get_sample_rate(struct minstrel
+ 	sample_idx = sample_table[mg->column][mg->index];
+ 	minstrel_set_next_sample_idx(mi);
+ 
+-	if (!(mg->supported & BIT(sample_idx)))
++	if (!(mi->supported[sample_group] & BIT(sample_idx)))
+ 		return -1;
+ 
+ 	mrs = &mg->rates[sample_idx];
+@@ -1052,7 +1052,7 @@ static void
+ minstrel_ht_check_cck_shortpreamble(struct minstrel_priv *mp,
+ 				    struct minstrel_ht_sta *mi, bool val)
+ {
+-	u8 supported = mi->groups[MINSTREL_CCK_GROUP].supported;
++	u8 supported = mi->supported[MINSTREL_CCK_GROUP];
+ 
+ 	if (!supported || !mi->cck_supported_short)
+ 		return;
+@@ -1061,7 +1061,7 @@ minstrel_ht_check_cck_shortpreamble(stru
+ 		return;
+ 
+ 	supported ^= mi->cck_supported_short | (mi->cck_supported_short << 4);
+-	mi->groups[MINSTREL_CCK_GROUP].supported = supported;
++	mi->supported[MINSTREL_CCK_GROUP] = supported;
+ }
+ 
+ static void
+@@ -1154,7 +1154,7 @@ minstrel_ht_update_cck(struct minstrel_p
+ 			mi->cck_supported_short |= BIT(i);
+ 	}
+ 
+-	mi->groups[MINSTREL_CCK_GROUP].supported = mi->cck_supported;
++	mi->supported[MINSTREL_CCK_GROUP] = mi->cck_supported;
+ }
+ 
+ static void
+@@ -1233,7 +1233,7 @@ minstrel_ht_update_caps(void *priv, stru
+ 		u32 gflags = minstrel_mcs_groups[i].flags;
+ 		int bw, nss;
+ 
+-		mi->groups[i].supported = 0;
++		mi->supported[i] = 0;
+ 		if (i == MINSTREL_CCK_GROUP) {
+ 			minstrel_ht_update_cck(mp, mi, sband, sta);
+ 			continue;
+@@ -1265,8 +1265,8 @@ minstrel_ht_update_caps(void *priv, stru
+ 			if (use_vht && minstrel_vht_only)
+ 				continue;
+ #endif
+-			mi->groups[i].supported = mcs->rx_mask[nss - 1];
+-			if (mi->groups[i].supported)
++			mi->supported[i] = mcs->rx_mask[nss - 1];
++			if (mi->supported[i])
+ 				n_supported++;
+ 			continue;
+ 		}
+@@ -1292,10 +1292,10 @@ minstrel_ht_update_caps(void *priv, stru
+ 		else
+ 			bw = BW_20;
+ 
+-		mi->groups[i].supported = minstrel_get_valid_vht_rates(bw, nss,
++		mi->supported[i] = minstrel_get_valid_vht_rates(bw, nss,
+ 				vht_cap->vht_mcs.tx_mcs_map);
+ 
+-		if (mi->groups[i].supported)
++		if (mi->supported[i])
+ 			n_supported++;
+ 	}
+ 
+--- a/net/mac80211/rc80211_minstrel_ht.h
++++ b/net/mac80211/rc80211_minstrel_ht.h
+@@ -52,9 +52,6 @@ struct minstrel_mcs_group_data {
+ 	u8 index;
+ 	u8 column;
+ 
+-	/* bitfield of supported MCS rates of this group */
+-	u16 supported;
+-
+ 	/* sorted rate set within a MCS group*/
+ 	u16 max_group_tp_rate[MAX_THR_RATES];
+ 	u16 max_group_prob_rate;
+@@ -101,6 +98,9 @@ struct minstrel_ht_sta {
+ 	u8 cck_supported;
+ 	u8 cck_supported_short;
+ 
++	/* Bitfield of supported MCS rates of all groups */
++	u16 supported[MINSTREL_GROUPS_NB];
++
+ 	/* MCS rate group info and statistics */
+ 	struct minstrel_mcs_group_data groups[MINSTREL_GROUPS_NB];
+ };
+--- a/net/mac80211/rc80211_minstrel_ht_debugfs.c
++++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c
+@@ -24,7 +24,7 @@ minstrel_ht_stats_dump(struct minstrel_h
+ 	char gimode = 'L';
+ 	u32 gflags;
+ 
+-	if (!mi->groups[i].supported)
++	if (!mi->supported[i])
+ 		return p;
+ 
+ 	mg = &minstrel_mcs_groups[i];
+@@ -42,7 +42,7 @@ minstrel_ht_stats_dump(struct minstrel_h
+ 		static const int bitrates[4] = { 10, 20, 55, 110 };
+ 		int idx = i * MCS_GROUP_RATES + j;
+ 
+-		if (!(mi->groups[i].supported & BIT(j)))
++		if (!(mi->supported[i] & BIT(j)))
+ 			continue;
+ 
+ 		if (gflags & IEEE80211_TX_RC_MCS) {
+@@ -170,7 +170,7 @@ minstrel_ht_stats_csv_dump(struct minstr
+ 	char gimode = 'L';
+ 	u32 gflags;
+ 
+-	if (!mi->groups[i].supported)
++	if (!mi->supported[i])
+ 		return p;
+ 
+ 	mg = &minstrel_mcs_groups[i];
+@@ -188,7 +188,7 @@ minstrel_ht_stats_csv_dump(struct minstr
+ 		static const int bitrates[4] = { 10, 20, 55, 110 };
+ 		int idx = i * MCS_GROUP_RATES + j;
+ 
+-		if (!(mi->groups[i].supported & BIT(j)))
++		if (!(mi->supported[i] & BIT(j)))
+ 			continue;
+ 
+ 		if (gflags & IEEE80211_TX_RC_MCS) {

+ 70 - 0
package/kernel/mac80211/patches/335-mac80211-minstrel_ht-move-short-preamble-check-out-o.patch

@@ -0,0 +1,70 @@
+From: Felix Fietkau <nbd@nbd.name>
+Date: Wed, 14 Dec 2016 20:06:08 +0100
+Subject: [PATCH] mac80211: minstrel_ht: move short preamble check out of
+ get_rate
+
+Test short preamble support in minstrel_ht_update_caps instead of
+looking at the per-packet flag. Makes the code more efficient.
+
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+---
+
+--- a/net/mac80211/rc80211_minstrel_ht.c
++++ b/net/mac80211/rc80211_minstrel_ht.c
+@@ -14,6 +14,7 @@
+ #include <linux/ieee80211.h>
+ #include <net/mac80211.h>
+ #include "rate.h"
++#include "sta_info.h"
+ #include "rc80211_minstrel.h"
+ #include "rc80211_minstrel_ht.h"
+ 
+@@ -1049,22 +1050,6 @@ minstrel_get_sample_rate(struct minstrel
+ }
+ 
+ static void
+-minstrel_ht_check_cck_shortpreamble(struct minstrel_priv *mp,
+-				    struct minstrel_ht_sta *mi, bool val)
+-{
+-	u8 supported = mi->supported[MINSTREL_CCK_GROUP];
+-
+-	if (!supported || !mi->cck_supported_short)
+-		return;
+-
+-	if (supported & (mi->cck_supported_short << (val * 4)))
+-		return;
+-
+-	supported ^= mi->cck_supported_short | (mi->cck_supported_short << 4);
+-	mi->supported[MINSTREL_CCK_GROUP] = supported;
+-}
+-
+-static void
+ minstrel_ht_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta,
+                      struct ieee80211_tx_rate_control *txrc)
+ {
+@@ -1087,7 +1072,6 @@ minstrel_ht_get_rate(void *priv, struct
+ 		minstrel_aggr_check(sta, txrc->skb);
+ 
+ 	info->flags |= mi->tx_flags;
+-	minstrel_ht_check_cck_shortpreamble(mp, mi, txrc->short_preamble);
+ 
+ #ifdef CPTCFG_MAC80211_DEBUGFS
+ 	if (mp->fixed_rate_idx != -1)
+@@ -1168,6 +1152,7 @@ minstrel_ht_update_caps(void *priv, stru
+ 	struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs;
+ 	u16 ht_cap = sta->ht_cap.cap;
+ 	struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap;
++	struct sta_info *sinfo = container_of(sta, struct sta_info, sta);
+ 	int use_vht;
+ 	int n_supported = 0;
+ 	int ack_dur;
+@@ -1302,6 +1287,9 @@ minstrel_ht_update_caps(void *priv, stru
+ 	if (!n_supported)
+ 		goto use_legacy;
+ 
++	if (test_sta_flag(sinfo, WLAN_STA_SHORT_PREAMBLE))
++		mi->cck_supported_short |= mi->cck_supported_short << 4;
++
+ 	/* create an initial rate table with the lowest supported rates */
+ 	minstrel_ht_update_stats(mp, mi);
+ 	minstrel_ht_update_rates(mp, mi);

+ 22 - 0
package/kernel/mac80211/patches/336-mac80211-minstrel_ht-make-att_hist-and-succ_hist-u32.patch

@@ -0,0 +1,22 @@
+From: Felix Fietkau <nbd@nbd.name>
+Date: Wed, 14 Dec 2016 20:09:14 +0100
+Subject: [PATCH] mac80211: minstrel_ht: make att_hist and succ_hist u32
+ instead of u64
+
+They are only used for debugging purposes and take a very long time to
+overflow. Visibly reduces the size of the per-sta rate control data.
+
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+---
+
+--- a/net/mac80211/rc80211_minstrel.h
++++ b/net/mac80211/rc80211_minstrel.h
+@@ -59,7 +59,7 @@ struct minstrel_rate_stats {
+ 	u16 success, last_success;
+ 
+ 	/* total attempts/success counters */
+-	u64 att_hist, succ_hist;
++	u32 att_hist, succ_hist;
+ 
+ 	/* statistis of packet delivery probability
+ 	 *  cur_prob  - current prob within last update intervall

+ 34 - 0
package/kernel/mac80211/patches/337-mac80211-check-for-MCS-in-ieee80211_duration-before-.patch

@@ -0,0 +1,34 @@
+From: Felix Fietkau <nbd@nbd.name>
+Date: Wed, 14 Dec 2016 20:12:25 +0100
+Subject: [PATCH] mac80211: check for MCS in ieee80211_duration before fetching
+ chanctx
+
+Makes the code a bit more efficient
+
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+---
+
+--- a/net/mac80211/tx.c
++++ b/net/mac80211/tx.c
+@@ -63,6 +63,10 @@ static __le16 ieee80211_duration(struct
+ 	struct ieee80211_chanctx_conf *chanctx_conf;
+ 	u32 rate_flags = 0;
+ 
++	/* assume HW handles this */
++	if (tx->rate.flags & (IEEE80211_TX_RC_MCS | IEEE80211_TX_RC_VHT_MCS))
++		return 0;
++
+ 	rcu_read_lock();
+ 	chanctx_conf = rcu_dereference(tx->sdata->vif.chanctx_conf);
+ 	if (chanctx_conf) {
+@@ -71,10 +75,6 @@ static __le16 ieee80211_duration(struct
+ 	}
+ 	rcu_read_unlock();
+ 
+-	/* assume HW handles this */
+-	if (tx->rate.flags & (IEEE80211_TX_RC_MCS | IEEE80211_TX_RC_VHT_MCS))
+-		return 0;
+-
+ 	/* uh huh? */
+ 	if (WARN_ON_ONCE(tx->rate.idx < 0))
+ 		return 0;

+ 192 - 0
package/kernel/mac80211/patches/338-mac80211-minstrel-remove-cur_prob-from-debugfs.patch

@@ -0,0 +1,192 @@
+From: Felix Fietkau <nbd@nbd.name>
+Date: Wed, 14 Dec 2016 20:13:58 +0100
+Subject: [PATCH] mac80211: minstrel: remove cur_prob from debugfs
+
+This field is redundant, because it is simply last success divided by
+last attempt count. Removing it from the rate stats struct saves about
+1.2 KiB per HT station.
+
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+---
+
+--- a/net/mac80211/rc80211_minstrel.c
++++ b/net/mac80211/rc80211_minstrel.c
+@@ -159,21 +159,23 @@ minstrel_update_rates(struct minstrel_pr
+ void
+ minstrel_calc_rate_stats(struct minstrel_rate_stats *mrs)
+ {
++	unsigned int cur_prob;
++
+ 	if (unlikely(mrs->attempts > 0)) {
+ 		mrs->sample_skipped = 0;
+-		mrs->cur_prob = MINSTREL_FRAC(mrs->success, mrs->attempts);
++		cur_prob = MINSTREL_FRAC(mrs->success, mrs->attempts);
+ 		if (unlikely(!mrs->att_hist)) {
+-			mrs->prob_ewma = mrs->cur_prob;
++			mrs->prob_ewma = cur_prob;
+ 		} else {
+ 			/* update exponential weighted moving variance */
+ 			mrs->prob_ewmsd = minstrel_ewmsd(mrs->prob_ewmsd,
+-							 mrs->cur_prob,
++							 cur_prob,
+ 							 mrs->prob_ewma,
+ 							 EWMA_LEVEL);
+ 
+ 			/*update exponential weighted moving avarage */
+ 			mrs->prob_ewma = minstrel_ewma(mrs->prob_ewma,
+-						       mrs->cur_prob,
++						       cur_prob,
+ 						       EWMA_LEVEL);
+ 		}
+ 		mrs->att_hist += mrs->attempts;
+--- a/net/mac80211/rc80211_minstrel.h
++++ b/net/mac80211/rc80211_minstrel.h
+@@ -62,10 +62,8 @@ struct minstrel_rate_stats {
+ 	u32 att_hist, succ_hist;
+ 
+ 	/* statistis of packet delivery probability
+-	 *  cur_prob  - current prob within last update intervall
+ 	 *  prob_ewma - exponential weighted moving average of prob
+ 	 *  prob_ewmsd - exp. weighted moving standard deviation of prob */
+-	unsigned int cur_prob;
+ 	unsigned int prob_ewma;
+ 	u16 prob_ewmsd;
+ 
+--- a/net/mac80211/rc80211_minstrel_debugfs.c
++++ b/net/mac80211/rc80211_minstrel_debugfs.c
+@@ -75,7 +75,7 @@ minstrel_stats_open(struct inode *inode,
+ {
+ 	struct minstrel_sta_info *mi = inode->i_private;
+ 	struct minstrel_debugfs_info *ms;
+-	unsigned int i, tp_max, tp_avg, prob, eprob;
++	unsigned int i, tp_max, tp_avg, eprob;
+ 	char *p;
+ 
+ 	ms = kmalloc(2048, GFP_KERNEL);
+@@ -86,9 +86,9 @@ minstrel_stats_open(struct inode *inode,
+ 	p = ms->buf;
+ 	p += sprintf(p, "\n");
+ 	p += sprintf(p,
+-		     "best   __________rate_________    ________statistics________    ________last_______    ______sum-of________\n");
++		     "best   __________rate_________    ________statistics________    ____last_____    ______sum-of________\n");
+ 	p += sprintf(p,
+-		     "rate  [name idx airtime max_tp]  [avg(tp) avg(prob) sd(prob)]  [prob.|retry|suc|att]  [#success | #attempts]\n");
++		     "rate  [name idx airtime max_tp]  [avg(tp) avg(prob) sd(prob)]  [retry|suc|att]  [#success | #attempts]\n");
+ 
+ 	for (i = 0; i < mi->n_rates; i++) {
+ 		struct minstrel_rate *mr = &mi->r[i];
+@@ -107,17 +107,15 @@ minstrel_stats_open(struct inode *inode,
+ 
+ 		tp_max = minstrel_get_tp_avg(mr, MINSTREL_FRAC(100,100));
+ 		tp_avg = minstrel_get_tp_avg(mr, mrs->prob_ewma);
+-		prob = MINSTREL_TRUNC(mrs->cur_prob * 1000);
+ 		eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000);
+ 
+ 		p += sprintf(p, "%4u.%1u    %4u.%1u     %3u.%1u    %3u.%1u"
+-				"     %3u.%1u %3u   %3u %-3u   "
++				"     %3u   %3u %-3u   "
+ 				"%9llu   %-9llu\n",
+ 				tp_max / 10, tp_max % 10,
+ 				tp_avg / 10, tp_avg % 10,
+ 				eprob / 10, eprob % 10,
+ 				mrs->prob_ewmsd / 10, mrs->prob_ewmsd % 10,
+-				prob / 10, prob % 10,
+ 				mrs->retry_count,
+ 				mrs->last_success,
+ 				mrs->last_attempts,
+@@ -148,7 +146,7 @@ minstrel_stats_csv_open(struct inode *in
+ {
+ 	struct minstrel_sta_info *mi = inode->i_private;
+ 	struct minstrel_debugfs_info *ms;
+-	unsigned int i, tp_max, tp_avg, prob, eprob;
++	unsigned int i, tp_max, tp_avg, eprob;
+ 	char *p;
+ 
+ 	ms = kmalloc(2048, GFP_KERNEL);
+@@ -175,16 +173,14 @@ minstrel_stats_csv_open(struct inode *in
+ 
+ 		tp_max = minstrel_get_tp_avg(mr, MINSTREL_FRAC(100,100));
+ 		tp_avg = minstrel_get_tp_avg(mr, mrs->prob_ewma);
+-		prob = MINSTREL_TRUNC(mrs->cur_prob * 1000);
+ 		eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000);
+ 
+-		p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u.%u,%u.%u,%u,%u,%u,"
++		p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u.%u,%u,%u,%u,"
+ 				"%llu,%llu,%d,%d\n",
+ 				tp_max / 10, tp_max % 10,
+ 				tp_avg / 10, tp_avg % 10,
+ 				eprob / 10, eprob % 10,
+ 				mrs->prob_ewmsd / 10, mrs->prob_ewmsd % 10,
+-				prob / 10, prob % 10,
+ 				mrs->retry_count,
+ 				mrs->last_success,
+ 				mrs->last_attempts,
+--- a/net/mac80211/rc80211_minstrel_ht_debugfs.c
++++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c
+@@ -19,7 +19,7 @@ static char *
+ minstrel_ht_stats_dump(struct minstrel_ht_sta *mi, int i, char *p)
+ {
+ 	const struct mcs_group *mg;
+-	unsigned int j, tp_max, tp_avg, prob, eprob, tx_time;
++	unsigned int j, tp_max, tp_avg, eprob, tx_time;
+ 	char htmode = '2';
+ 	char gimode = 'L';
+ 	u32 gflags;
+@@ -83,17 +83,15 @@ minstrel_ht_stats_dump(struct minstrel_h
+ 
+ 		tp_max = minstrel_ht_get_tp_avg(mi, i, j, MINSTREL_FRAC(100, 100));
+ 		tp_avg = minstrel_ht_get_tp_avg(mi, i, j, mrs->prob_ewma);
+-		prob = MINSTREL_TRUNC(mrs->cur_prob * 1000);
+ 		eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000);
+ 
+ 		p += sprintf(p, "%4u.%1u    %4u.%1u     %3u.%1u    %3u.%1u"
+-				"     %3u.%1u %3u   %3u %-3u   "
++				"     %3u   %3u %-3u   "
+ 				"%9llu   %-9llu\n",
+ 				tp_max / 10, tp_max % 10,
+ 				tp_avg / 10, tp_avg % 10,
+ 				eprob / 10, eprob % 10,
+ 				mrs->prob_ewmsd / 10, mrs->prob_ewmsd % 10,
+-				prob / 10, prob % 10,
+ 				mrs->retry_count,
+ 				mrs->last_success,
+ 				mrs->last_attempts,
+@@ -130,9 +128,9 @@ minstrel_ht_stats_open(struct inode *ino
+ 
+ 	p += sprintf(p, "\n");
+ 	p += sprintf(p,
+-		     "              best   ____________rate__________    ________statistics________    ________last_______    ______sum-of________\n");
++		     "              best   ____________rate__________    ________statistics________    _____last____    ______sum-of________\n");
+ 	p += sprintf(p,
+-		     "mode guard #  rate  [name   idx airtime  max_tp]  [avg(tp) avg(prob) sd(prob)]  [prob.|retry|suc|att]  [#success | #attempts]\n");
++		     "mode guard #  rate  [name   idx airtime  max_tp]  [avg(tp) avg(prob) sd(prob)]  [retry|suc|att]  [#success | #attempts]\n");
+ 
+ 	p = minstrel_ht_stats_dump(mi, MINSTREL_CCK_GROUP, p);
+ 	for (i = 0; i < MINSTREL_CCK_GROUP; i++)
+@@ -165,7 +163,7 @@ static char *
+ minstrel_ht_stats_csv_dump(struct minstrel_ht_sta *mi, int i, char *p)
+ {
+ 	const struct mcs_group *mg;
+-	unsigned int j, tp_max, tp_avg, prob, eprob, tx_time;
++	unsigned int j, tp_max, tp_avg, eprob, tx_time;
+ 	char htmode = '2';
+ 	char gimode = 'L';
+ 	u32 gflags;
+@@ -226,16 +224,14 @@ minstrel_ht_stats_csv_dump(struct minstr
+ 
+ 		tp_max = minstrel_ht_get_tp_avg(mi, i, j, MINSTREL_FRAC(100, 100));
+ 		tp_avg = minstrel_ht_get_tp_avg(mi, i, j, mrs->prob_ewma);
+-		prob = MINSTREL_TRUNC(mrs->cur_prob * 1000);
+ 		eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000);
+ 
+-		p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u.%u,%u.%u,%u,%u,"
++		p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u.%u,%u,%u,"
+ 				"%u,%llu,%llu,",
+ 				tp_max / 10, tp_max % 10,
+ 				tp_avg / 10, tp_avg % 10,
+ 				eprob / 10, eprob % 10,
+ 				mrs->prob_ewmsd / 10, mrs->prob_ewmsd % 10,
+-				prob / 10, prob % 10,
+ 				mrs->retry_count,
+ 				mrs->last_success,
+ 				mrs->last_attempts,

+ 22 - 0
package/kernel/mac80211/patches/339-mac80211-minstrel-reduce-MINSTREL_SCALE.patch

@@ -0,0 +1,22 @@
+From: Felix Fietkau <nbd@nbd.name>
+Date: Wed, 14 Dec 2016 20:15:33 +0100
+Subject: [PATCH] mac80211: minstrel: reduce MINSTREL_SCALE
+
+The loss of a bit of extra precision does not hurt the calculation, 12
+bits is still enough to calculate probabilities well. Reducing the scale
+makes it easier to avoid overflows
+
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+---
+
+--- a/net/mac80211/rc80211_minstrel.h
++++ b/net/mac80211/rc80211_minstrel.h
+@@ -14,7 +14,7 @@
+ #define SAMPLE_COLUMNS	10	/* number of columns in sample table */
+ 
+ /* scaled fraction values */
+-#define MINSTREL_SCALE  16
++#define MINSTREL_SCALE  12
+ #define MINSTREL_FRAC(val, div) (((val) << MINSTREL_SCALE) / div)
+ #define MINSTREL_TRUNC(val) ((val) >> MINSTREL_SCALE)
+ 

+ 186 - 0
package/kernel/mac80211/patches/340-mac80211-minstrel-store-probability-variance-instead.patch

@@ -0,0 +1,186 @@
+From: Felix Fietkau <nbd@nbd.name>
+Date: Wed, 14 Dec 2016 20:17:06 +0100
+Subject: [PATCH] mac80211: minstrel: store probability variance instead of
+ standard deviation
+
+This avoids the costly int_sqrt calls in the statistics update and moves
+it to the debugfs code instead.
+This also fixes an overflow in the previous standard deviation
+calculation.
+
+Signed-off-by: Thomas Huehn <thomas.huehn@evernet-eg.de>
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+---
+
+--- a/net/mac80211/rc80211_minstrel.c
++++ b/net/mac80211/rc80211_minstrel.c
+@@ -168,10 +168,10 @@ minstrel_calc_rate_stats(struct minstrel
+ 			mrs->prob_ewma = cur_prob;
+ 		} else {
+ 			/* update exponential weighted moving variance */
+-			mrs->prob_ewmsd = minstrel_ewmsd(mrs->prob_ewmsd,
+-							 cur_prob,
+-							 mrs->prob_ewma,
+-							 EWMA_LEVEL);
++			mrs->prob_ewmv = minstrel_ewmv(mrs->prob_ewmv,
++							cur_prob,
++							mrs->prob_ewma,
++							EWMA_LEVEL);
+ 
+ 			/*update exponential weighted moving avarage */
+ 			mrs->prob_ewma = minstrel_ewma(mrs->prob_ewma,
+--- a/net/mac80211/rc80211_minstrel.h
++++ b/net/mac80211/rc80211_minstrel.h
+@@ -36,21 +36,16 @@ minstrel_ewma(int old, int new, int weig
+ }
+ 
+ /*
+- * Perform EWMSD (Exponentially Weighted Moving Standard Deviation) calculation
++ * Perform EWMV (Exponentially Weighted Moving Variance) calculation
+  */
+ static inline int
+-minstrel_ewmsd(int old_ewmsd, int cur_prob, int prob_ewma, int weight)
++minstrel_ewmv(int old_ewmv, int cur_prob, int prob_ewma, int weight)
+ {
+-	int diff, incr, tmp_var;
++	int diff, incr;
+ 
+-	/* calculate exponential weighted moving variance */
+-	diff = MINSTREL_TRUNC((cur_prob - prob_ewma) * 1000000);
++	diff = cur_prob - prob_ewma;
+ 	incr = (EWMA_DIV - weight) * diff / EWMA_DIV;
+-	tmp_var = old_ewmsd * old_ewmsd;
+-	tmp_var = weight * (tmp_var + diff * incr / 1000000) / EWMA_DIV;
+-
+-	/* return standard deviation */
+-	return (u16) int_sqrt(tmp_var);
++	return weight * (old_ewmv + MINSTREL_TRUNC(diff * incr)) / EWMA_DIV;
+ }
+ 
+ struct minstrel_rate_stats {
+@@ -65,7 +60,7 @@ struct minstrel_rate_stats {
+ 	 *  prob_ewma - exponential weighted moving average of prob
+ 	 *  prob_ewmsd - exp. weighted moving standard deviation of prob */
+ 	unsigned int prob_ewma;
+-	u16 prob_ewmsd;
++	u16 prob_ewmv;
+ 
+ 	/* maximum retry counts */
+ 	u8 retry_count;
+@@ -151,6 +146,14 @@ struct minstrel_debugfs_info {
+ 	char buf[];
+ };
+ 
++/* Get EWMSD (Exponentially Weighted Moving Standard Deviation) * 10 */
++static inline int
++minstrel_get_ewmsd10(struct minstrel_rate_stats *mrs)
++{
++	unsigned int ewmv = mrs->prob_ewmv;
++	return int_sqrt(MINSTREL_TRUNC(ewmv * 1000 * 1000));
++}
++
+ extern const struct rate_control_ops mac80211_minstrel;
+ void minstrel_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir);
+ void minstrel_remove_sta_debugfs(void *priv, void *priv_sta);
+--- a/net/mac80211/rc80211_minstrel_debugfs.c
++++ b/net/mac80211/rc80211_minstrel_debugfs.c
+@@ -93,6 +93,7 @@ minstrel_stats_open(struct inode *inode,
+ 	for (i = 0; i < mi->n_rates; i++) {
+ 		struct minstrel_rate *mr = &mi->r[i];
+ 		struct minstrel_rate_stats *mrs = &mi->r[i].stats;
++		unsigned int prob_ewmsd;
+ 
+ 		*(p++) = (i == mi->max_tp_rate[0]) ? 'A' : ' ';
+ 		*(p++) = (i == mi->max_tp_rate[1]) ? 'B' : ' ';
+@@ -108,6 +109,7 @@ minstrel_stats_open(struct inode *inode,
+ 		tp_max = minstrel_get_tp_avg(mr, MINSTREL_FRAC(100,100));
+ 		tp_avg = minstrel_get_tp_avg(mr, mrs->prob_ewma);
+ 		eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000);
++		prob_ewmsd = minstrel_get_ewmsd10(mrs);
+ 
+ 		p += sprintf(p, "%4u.%1u    %4u.%1u     %3u.%1u    %3u.%1u"
+ 				"     %3u   %3u %-3u   "
+@@ -115,7 +117,7 @@ minstrel_stats_open(struct inode *inode,
+ 				tp_max / 10, tp_max % 10,
+ 				tp_avg / 10, tp_avg % 10,
+ 				eprob / 10, eprob % 10,
+-				mrs->prob_ewmsd / 10, mrs->prob_ewmsd % 10,
++				prob_ewmsd / 10, prob_ewmsd % 10,
+ 				mrs->retry_count,
+ 				mrs->last_success,
+ 				mrs->last_attempts,
+@@ -159,6 +161,7 @@ minstrel_stats_csv_open(struct inode *in
+ 	for (i = 0; i < mi->n_rates; i++) {
+ 		struct minstrel_rate *mr = &mi->r[i];
+ 		struct minstrel_rate_stats *mrs = &mi->r[i].stats;
++		unsigned int prob_ewmsd;
+ 
+ 		p += sprintf(p, "%s" ,((i == mi->max_tp_rate[0]) ? "A" : ""));
+ 		p += sprintf(p, "%s" ,((i == mi->max_tp_rate[1]) ? "B" : ""));
+@@ -174,13 +177,14 @@ minstrel_stats_csv_open(struct inode *in
+ 		tp_max = minstrel_get_tp_avg(mr, MINSTREL_FRAC(100,100));
+ 		tp_avg = minstrel_get_tp_avg(mr, mrs->prob_ewma);
+ 		eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000);
++		prob_ewmsd = minstrel_get_ewmsd10(mrs);
+ 
+ 		p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u.%u,%u,%u,%u,"
+ 				"%llu,%llu,%d,%d\n",
+ 				tp_max / 10, tp_max % 10,
+ 				tp_avg / 10, tp_avg % 10,
+ 				eprob / 10, eprob % 10,
+-				mrs->prob_ewmsd / 10, mrs->prob_ewmsd % 10,
++				prob_ewmsd / 10, prob_ewmsd % 10,
+ 				mrs->retry_count,
+ 				mrs->last_success,
+ 				mrs->last_attempts,
+--- a/net/mac80211/rc80211_minstrel_ht_debugfs.c
++++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c
+@@ -41,6 +41,7 @@ minstrel_ht_stats_dump(struct minstrel_h
+ 		struct minstrel_rate_stats *mrs = &mi->groups[i].rates[j];
+ 		static const int bitrates[4] = { 10, 20, 55, 110 };
+ 		int idx = i * MCS_GROUP_RATES + j;
++		unsigned int prob_ewmsd;
+ 
+ 		if (!(mi->supported[i] & BIT(j)))
+ 			continue;
+@@ -84,6 +85,7 @@ minstrel_ht_stats_dump(struct minstrel_h
+ 		tp_max = minstrel_ht_get_tp_avg(mi, i, j, MINSTREL_FRAC(100, 100));
+ 		tp_avg = minstrel_ht_get_tp_avg(mi, i, j, mrs->prob_ewma);
+ 		eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000);
++		prob_ewmsd = minstrel_get_ewmsd10(mrs);
+ 
+ 		p += sprintf(p, "%4u.%1u    %4u.%1u     %3u.%1u    %3u.%1u"
+ 				"     %3u   %3u %-3u   "
+@@ -91,7 +93,7 @@ minstrel_ht_stats_dump(struct minstrel_h
+ 				tp_max / 10, tp_max % 10,
+ 				tp_avg / 10, tp_avg % 10,
+ 				eprob / 10, eprob % 10,
+-				mrs->prob_ewmsd / 10, mrs->prob_ewmsd % 10,
++				prob_ewmsd / 10, prob_ewmsd % 10,
+ 				mrs->retry_count,
+ 				mrs->last_success,
+ 				mrs->last_attempts,
+@@ -185,6 +187,7 @@ minstrel_ht_stats_csv_dump(struct minstr
+ 		struct minstrel_rate_stats *mrs = &mi->groups[i].rates[j];
+ 		static const int bitrates[4] = { 10, 20, 55, 110 };
+ 		int idx = i * MCS_GROUP_RATES + j;
++		unsigned int prob_ewmsd;
+ 
+ 		if (!(mi->supported[i] & BIT(j)))
+ 			continue;
+@@ -225,13 +228,14 @@ minstrel_ht_stats_csv_dump(struct minstr
+ 		tp_max = minstrel_ht_get_tp_avg(mi, i, j, MINSTREL_FRAC(100, 100));
+ 		tp_avg = minstrel_ht_get_tp_avg(mi, i, j, mrs->prob_ewma);
+ 		eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000);
++		prob_ewmsd = minstrel_get_ewmsd10(mrs);
+ 
+ 		p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u.%u,%u,%u,"
+ 				"%u,%llu,%llu,",
+ 				tp_max / 10, tp_max % 10,
+ 				tp_avg / 10, tp_avg % 10,
+ 				eprob / 10, eprob % 10,
+-				mrs->prob_ewmsd / 10, mrs->prob_ewmsd % 10,
++				prob_ewmsd / 10, prob_ewmsd % 10,
+ 				mrs->retry_count,
+ 				mrs->last_success,
+ 				mrs->last_attempts,

+ 20 - 0
package/kernel/mac80211/patches/341-mac80211-minstrel-make-prob_ewma-u16-instead-of-u32.patch

@@ -0,0 +1,20 @@
+From: Felix Fietkau <nbd@nbd.name>
+Date: Wed, 14 Dec 2016 20:19:56 +0100
+Subject: [PATCH] mac80211: minstrel: make prob_ewma u16 instead of u32
+
+Saves about 1.2 KiB memory per station
+
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+---
+
+--- a/net/mac80211/rc80211_minstrel.h
++++ b/net/mac80211/rc80211_minstrel.h
+@@ -59,7 +59,7 @@ struct minstrel_rate_stats {
+ 	/* statistis of packet delivery probability
+ 	 *  prob_ewma - exponential weighted moving average of prob
+ 	 *  prob_ewmsd - exp. weighted moving standard deviation of prob */
+-	unsigned int prob_ewma;
++	u16 prob_ewma;
+ 	u16 prob_ewmv;
+ 
+ 	/* maximum retry counts */

+ 80 - 0
package/kernel/mac80211/patches/342-mac80211-minstrel_ht-remove-obsolete-if-for-3-stream.patch

@@ -0,0 +1,80 @@
+From: Felix Fietkau <nbd@nbd.name>
+Date: Wed, 14 Dec 2016 20:23:29 +0100
+Subject: [PATCH] mac80211: minstrel_ht: remove obsolete #if for >= 3 streams
+
+This was added during early development when 3x3 hardware was not very
+common yet. This is completely unnecessary now.
+
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+---
+
+--- a/net/mac80211/rc80211_minstrel_ht.c
++++ b/net/mac80211/rc80211_minstrel_ht.c
+@@ -155,67 +155,47 @@ MODULE_PARM_DESC(minstrel_vht_only,
+ const struct mcs_group minstrel_mcs_groups[] = {
+ 	MCS_GROUP(1, 0, BW_20),
+ 	MCS_GROUP(2, 0, BW_20),
+-#if MINSTREL_MAX_STREAMS >= 3
+ 	MCS_GROUP(3, 0, BW_20),
+-#endif
+ 
+ 	MCS_GROUP(1, 1, BW_20),
+ 	MCS_GROUP(2, 1, BW_20),
+-#if MINSTREL_MAX_STREAMS >= 3
+ 	MCS_GROUP(3, 1, BW_20),
+-#endif
+ 
+ 	MCS_GROUP(1, 0, BW_40),
+ 	MCS_GROUP(2, 0, BW_40),
+-#if MINSTREL_MAX_STREAMS >= 3
+ 	MCS_GROUP(3, 0, BW_40),
+-#endif
+ 
+ 	MCS_GROUP(1, 1, BW_40),
+ 	MCS_GROUP(2, 1, BW_40),
+-#if MINSTREL_MAX_STREAMS >= 3
+ 	MCS_GROUP(3, 1, BW_40),
+-#endif
+ 
+ 	CCK_GROUP,
+ 
+ #ifdef CPTCFG_MAC80211_RC_MINSTREL_VHT
+ 	VHT_GROUP(1, 0, BW_20),
+ 	VHT_GROUP(2, 0, BW_20),
+-#if MINSTREL_MAX_STREAMS >= 3
+ 	VHT_GROUP(3, 0, BW_20),
+-#endif
+ 
+ 	VHT_GROUP(1, 1, BW_20),
+ 	VHT_GROUP(2, 1, BW_20),
+-#if MINSTREL_MAX_STREAMS >= 3
+ 	VHT_GROUP(3, 1, BW_20),
+-#endif
+ 
+ 	VHT_GROUP(1, 0, BW_40),
+ 	VHT_GROUP(2, 0, BW_40),
+-#if MINSTREL_MAX_STREAMS >= 3
+ 	VHT_GROUP(3, 0, BW_40),
+-#endif
+ 
+ 	VHT_GROUP(1, 1, BW_40),
+ 	VHT_GROUP(2, 1, BW_40),
+-#if MINSTREL_MAX_STREAMS >= 3
+ 	VHT_GROUP(3, 1, BW_40),
+-#endif
+ 
+ 	VHT_GROUP(1, 0, BW_80),
+ 	VHT_GROUP(2, 0, BW_80),
+-#if MINSTREL_MAX_STREAMS >= 3
+ 	VHT_GROUP(3, 0, BW_80),
+-#endif
+ 
+ 	VHT_GROUP(1, 1, BW_80),
+ 	VHT_GROUP(2, 1, BW_80),
+-#if MINSTREL_MAX_STREAMS >= 3
+ 	VHT_GROUP(3, 1, BW_80),
+ #endif
+-#endif
+ };
+ 
+ static u8 sample_table[SAMPLE_COLUMNS][MCS_GROUP_RATES] __read_mostly;

+ 150 - 0
package/kernel/mac80211/patches/343-cfg80211-limit-scan-results-cache-size.patch

@@ -0,0 +1,150 @@
+From: Johannes Berg <johannes.berg@intel.com>
+Date: Tue, 15 Nov 2016 12:05:11 +0100
+Subject: [PATCH] cfg80211: limit scan results cache size
+
+It's possible to make scanning consume almost arbitrary amounts
+of memory, e.g. by sending beacon frames with random BSSIDs at
+high rates while somebody is scanning.
+
+Limit the number of BSS table entries we're willing to cache to
+1000, limiting maximum memory usage to maybe 4-5MB, but lower
+in practice - that would be the case for having both full-sized
+beacon and probe response frames for each entry; this seems not
+possible in practice, so a limit of 1000 entries will likely be
+closer to 0.5 MB.
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+---
+
+--- a/net/wireless/core.h
++++ b/net/wireless/core.h
+@@ -71,6 +71,7 @@ struct cfg80211_registered_device {
+ 	struct list_head bss_list;
+ 	struct rb_root bss_tree;
+ 	u32 bss_generation;
++	u32 bss_entries;
+ 	struct cfg80211_scan_request *scan_req; /* protected by RTNL */
+ 	struct sk_buff *scan_msg;
+ 	struct cfg80211_sched_scan_request __rcu *sched_scan_req;
+--- a/net/wireless/scan.c
++++ b/net/wireless/scan.c
+@@ -57,6 +57,19 @@
+  * also linked into the probe response struct.
+  */
+ 
++/*
++ * Limit the number of BSS entries stored in mac80211. Each one is
++ * a bit over 4k at most, so this limits to roughly 4-5M of memory.
++ * If somebody wants to really attack this though, they'd likely
++ * use small beacons, and only one type of frame, limiting each of
++ * the entries to a much smaller size (in order to generate more
++ * entries in total, so overhead is bigger.)
++ */
++static int bss_entries_limit = 1000;
++module_param(bss_entries_limit, int, 0644);
++MODULE_PARM_DESC(bss_entries_limit,
++                 "limit to number of scan BSS entries (per wiphy, default 1000)");
++
+ #define IEEE80211_SCAN_RESULT_EXPIRE	(30 * HZ)
+ 
+ static void bss_free(struct cfg80211_internal_bss *bss)
+@@ -137,6 +150,10 @@ static bool __cfg80211_unlink_bss(struct
+ 
+ 	list_del_init(&bss->list);
+ 	rb_erase(&bss->rbn, &rdev->bss_tree);
++	rdev->bss_entries--;
++	WARN_ONCE((rdev->bss_entries == 0) ^ list_empty(&rdev->bss_list),
++		  "rdev bss entries[%d]/list[empty:%d] corruption\n",
++		  rdev->bss_entries, list_empty(&rdev->bss_list));
+ 	bss_ref_put(rdev, bss);
+ 	return true;
+ }
+@@ -163,6 +180,40 @@ static void __cfg80211_bss_expire(struct
+ 		rdev->bss_generation++;
+ }
+ 
++static bool cfg80211_bss_expire_oldest(struct cfg80211_registered_device *rdev)
++{
++	struct cfg80211_internal_bss *bss, *oldest = NULL;
++	bool ret;
++
++	lockdep_assert_held(&rdev->bss_lock);
++
++	list_for_each_entry(bss, &rdev->bss_list, list) {
++		if (atomic_read(&bss->hold))
++			continue;
++
++		if (!list_empty(&bss->hidden_list) &&
++		    !bss->pub.hidden_beacon_bss)
++			continue;
++
++		if (oldest && time_before(oldest->ts, bss->ts))
++			continue;
++		oldest = bss;
++	}
++
++	if (WARN_ON(!oldest))
++		return false;
++
++	/*
++	 * The callers make sure to increase rdev->bss_generation if anything
++	 * gets removed (and a new entry added), so there's no need to also do
++	 * it here.
++	 */
++
++	ret = __cfg80211_unlink_bss(rdev, oldest);
++	WARN_ON(!ret);
++	return ret;
++}
++
+ void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev,
+ 			   bool send_message)
+ {
+@@ -689,6 +740,7 @@ static bool cfg80211_combine_bsses(struc
+ 	const u8 *ie;
+ 	int i, ssidlen;
+ 	u8 fold = 0;
++	u32 n_entries = 0;
+ 
+ 	ies = rcu_access_pointer(new->pub.beacon_ies);
+ 	if (WARN_ON(!ies))
+@@ -712,6 +764,12 @@ static bool cfg80211_combine_bsses(struc
+ 	/* This is the bad part ... */
+ 
+ 	list_for_each_entry(bss, &rdev->bss_list, list) {
++		/*
++		 * we're iterating all the entries anyway, so take the
++		 * opportunity to validate the list length accounting
++		 */
++		n_entries++;
++
+ 		if (!ether_addr_equal(bss->pub.bssid, new->pub.bssid))
+ 			continue;
+ 		if (bss->pub.channel != new->pub.channel)
+@@ -740,6 +798,10 @@ static bool cfg80211_combine_bsses(struc
+ 				   new->pub.beacon_ies);
+ 	}
+ 
++	WARN_ONCE(n_entries != rdev->bss_entries,
++		  "rdev bss entries[%d]/list[len:%d] corruption\n",
++		  rdev->bss_entries, n_entries);
++
+ 	return true;
+ }
+ 
+@@ -894,7 +956,14 @@ cfg80211_bss_update(struct cfg80211_regi
+ 			}
+ 		}
+ 
++		if (rdev->bss_entries >= bss_entries_limit &&
++		    !cfg80211_bss_expire_oldest(rdev)) {
++			kfree(new);
++			goto drop;
++		}
++
+ 		list_add_tail(&new->list, &rdev->bss_list);
++		rdev->bss_entries++;
+ 		rb_insert_bss(rdev, new);
+ 		found = new;
+ 	}

+ 23 - 0
package/kernel/mac80211/patches/346-ath5k-drop-bogus-warning-on-drv_set_key-with-unsuppo.patch

@@ -0,0 +1,23 @@
+From: Felix Fietkau <nbd@nbd.name>
+Date: Tue, 27 Dec 2016 12:15:14 +0100
+Subject: [PATCH] ath5k: drop bogus warning on drv_set_key with unsupported
+ cipher
+
+Simply return -EOPNOTSUPP instead.
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+---
+
+--- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c
++++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c
+@@ -502,8 +502,7 @@ ath5k_set_key(struct ieee80211_hw *hw, e
+ 			break;
+ 		return -EOPNOTSUPP;
+ 	default:
+-		WARN_ON(1);
+-		return -EINVAL;
++		return -EOPNOTSUPP;
+ 	}
+ 
+ 	mutex_lock(&ah->lock);

+ 101 - 0
package/kernel/mac80211/patches/347-0001-cfg80211-move-function-checking-range-fit-to-util.c.patch

@@ -0,0 +1,101 @@
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Wed, 4 Jan 2017 18:58:30 +0100
+Subject: [PATCH] cfg80211: move function checking range fit to util.c
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+It is needed for another cfg80211 helper that will be out of reg.c so
+move it to common util.c file and make it non-static.
+
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+---
+
+--- a/net/wireless/core.h
++++ b/net/wireless/core.h
+@@ -429,6 +429,9 @@ int cfg80211_change_iface(struct cfg8021
+ void cfg80211_process_rdev_events(struct cfg80211_registered_device *rdev);
+ void cfg80211_process_wdev_events(struct wireless_dev *wdev);
+ 
++bool cfg80211_does_bw_fit_range(const struct ieee80211_freq_range *freq_range,
++				u32 center_freq_khz, u32 bw_khz);
++
+ /**
+  * cfg80211_chandef_dfs_usable - checks if chandef is DFS usable
+  * @wiphy: the wiphy to validate against
+--- a/net/wireless/reg.c
++++ b/net/wireless/reg.c
+@@ -748,21 +748,6 @@ static bool is_valid_rd(const struct iee
+ 	return true;
+ }
+ 
+-static bool reg_does_bw_fit(const struct ieee80211_freq_range *freq_range,
+-			    u32 center_freq_khz, u32 bw_khz)
+-{
+-	u32 start_freq_khz, end_freq_khz;
+-
+-	start_freq_khz = center_freq_khz - (bw_khz/2);
+-	end_freq_khz = center_freq_khz + (bw_khz/2);
+-
+-	if (start_freq_khz >= freq_range->start_freq_khz &&
+-	    end_freq_khz <= freq_range->end_freq_khz)
+-		return true;
+-
+-	return false;
+-}
+-
+ /**
+  * freq_in_rule_band - tells us if a frequency is in a frequency band
+  * @freq_range: frequency rule we want to query
+@@ -1070,7 +1055,7 @@ freq_reg_info_regd(u32 center_freq,
+ 		if (!band_rule_found)
+ 			band_rule_found = freq_in_rule_band(fr, center_freq);
+ 
+-		bw_fits = reg_does_bw_fit(fr, center_freq, bw);
++		bw_fits = cfg80211_does_bw_fit_range(fr, center_freq, bw);
+ 
+ 		if (band_rule_found && bw_fits)
+ 			return rr;
+@@ -1138,11 +1123,13 @@ static uint32_t reg_rule_to_chan_bw_flag
+ 		max_bandwidth_khz = reg_get_max_bandwidth(regd, reg_rule);
+ 
+ 	/* If we get a reg_rule we can assume that at least 5Mhz fit */
+-	if (!reg_does_bw_fit(freq_range, MHZ_TO_KHZ(chan->center_freq),
+-			     MHZ_TO_KHZ(10)))
++	if (!cfg80211_does_bw_fit_range(freq_range,
++					MHZ_TO_KHZ(chan->center_freq),
++					MHZ_TO_KHZ(10)))
+ 		bw_flags |= IEEE80211_CHAN_NO_10MHZ;
+-	if (!reg_does_bw_fit(freq_range, MHZ_TO_KHZ(chan->center_freq),
+-			     MHZ_TO_KHZ(20)))
++	if (!cfg80211_does_bw_fit_range(freq_range,
++					MHZ_TO_KHZ(chan->center_freq),
++					MHZ_TO_KHZ(20)))
+ 		bw_flags |= IEEE80211_CHAN_NO_20MHZ;
+ 
+ 	if (max_bandwidth_khz < MHZ_TO_KHZ(10))
+--- a/net/wireless/util.c
++++ b/net/wireless/util.c
+@@ -1788,6 +1788,21 @@ void cfg80211_free_nan_func(struct cfg80
+ }
+ EXPORT_SYMBOL(cfg80211_free_nan_func);
+ 
++bool cfg80211_does_bw_fit_range(const struct ieee80211_freq_range *freq_range,
++				u32 center_freq_khz, u32 bw_khz)
++{
++	u32 start_freq_khz, end_freq_khz;
++
++	start_freq_khz = center_freq_khz - (bw_khz / 2);
++	end_freq_khz = center_freq_khz + (bw_khz / 2);
++
++	if (start_freq_khz >= freq_range->start_freq_khz &&
++	    end_freq_khz <= freq_range->end_freq_khz)
++		return true;
++
++	return false;
++}
++
+ /* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */
+ /* Ethernet-II snap header (RFC1042 for most EtherTypes) */
+ const unsigned char rfc1042_header[] __aligned(2) =

+ 211 - 0
package/kernel/mac80211/patches/347-0002-cfg80211-support-ieee80211-freq-limit-DT-property.patch

@@ -0,0 +1,211 @@
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Wed, 4 Jan 2017 18:58:31 +0100
+Subject: [PATCH] cfg80211: support ieee80211-freq-limit DT property
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This patch adds a helper for reading that new property and applying
+limitations of supported channels specified this way.
+It is used with devices that normally support a wide wireless band but
+in a given config are limited to some part of it (usually due to board
+design). For example a dual-band chipset may be able to support one band
+only because of used antennas.
+It's also common that tri-band routers have separated radios for lower
+and higher part of 5 GHz band and it may be impossible to say which is
+which without a DT info.
+
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+[add new function to documentation, fix link]
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+---
+ create mode 100644 net/wireless/of.c
+
+--- a/include/net/cfg80211.h
++++ b/include/net/cfg80211.h
+@@ -311,6 +311,34 @@ struct ieee80211_supported_band {
+ 	struct ieee80211_sta_vht_cap vht_cap;
+ };
+ 
++/**
++ * wiphy_read_of_freq_limits - read frequency limits from device tree
++ *
++ * @wiphy: the wireless device to get extra limits for
++ *
++ * Some devices may have extra limitations specified in DT. This may be useful
++ * for chipsets that normally support more bands but are limited due to board
++ * design (e.g. by antennas or external power amplifier).
++ *
++ * This function reads info from DT and uses it to *modify* channels (disable
++ * unavailable ones). It's usually a *bad* idea to use it in drivers with
++ * shared channel data as DT limitations are device specific. You should make
++ * sure to call it only if channels in wiphy are copied and can be modified
++ * without affecting other devices.
++ *
++ * As this function access device node it has to be called after set_wiphy_dev.
++ * It also modifies channels so they have to be set first.
++ * If using this helper, call it before wiphy_register().
++ */
++#ifdef CONFIG_OF
++void wiphy_read_of_freq_limits(struct wiphy *wiphy);
++#else /* CONFIG_OF */
++static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy)
++{
++}
++#endif /* !CONFIG_OF */
++
++
+ /*
+  * Wireless hardware/device configuration structures and methods
+  */
+--- a/net/wireless/Makefile
++++ b/net/wireless/Makefile
+@@ -11,6 +11,7 @@ obj-$(CONFIG_WEXT_PRIV) += wext-priv.o
+ 
+ cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o nl80211.o
+ cfg80211-y += mlme.o ibss.o sme.o chan.o ethtool.o mesh.o ap.o trace.o ocb.o
++cfg80211-$(CONFIG_OF) += of.o
+ cfg80211-$(CPTCFG_CFG80211_DEBUGFS) += debugfs.o
+ cfg80211-$(CPTCFG_CFG80211_WEXT) += wext-compat.o wext-sme.o
+ cfg80211-$(CPTCFG_CFG80211_INTERNAL_REGDB) += regdb.o
+--- /dev/null
++++ b/net/wireless/of.c
+@@ -0,0 +1,138 @@
++/*
++ * Copyright (C) 2017 Rafał Miłecki <rafal@milecki.pl>
++ *
++ * Permission to use, copy, modify, and/or distribute this software for any
++ * purpose with or without fee is hereby granted, provided that the above
++ * copyright notice and this permission notice appear in all copies.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
++ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ */
++
++#include <linux/of.h>
++#include <net/cfg80211.h>
++#include "core.h"
++
++static bool wiphy_freq_limits_valid_chan(struct wiphy *wiphy,
++					 struct ieee80211_freq_range *freq_limits,
++					 unsigned int n_freq_limits,
++					 struct ieee80211_channel *chan)
++{
++	u32 bw = MHZ_TO_KHZ(20);
++	int i;
++
++	for (i = 0; i < n_freq_limits; i++) {
++		struct ieee80211_freq_range *limit = &freq_limits[i];
++
++		if (cfg80211_does_bw_fit_range(limit,
++					       MHZ_TO_KHZ(chan->center_freq),
++					       bw))
++			return true;
++	}
++
++	return false;
++}
++
++static void wiphy_freq_limits_apply(struct wiphy *wiphy,
++				    struct ieee80211_freq_range *freq_limits,
++				    unsigned int n_freq_limits)
++{
++	enum nl80211_band band;
++	int i;
++
++	if (WARN_ON(!n_freq_limits))
++		return;
++
++	for (band = 0; band < NUM_NL80211_BANDS; band++) {
++		struct ieee80211_supported_band *sband = wiphy->bands[band];
++
++		if (!sband)
++			continue;
++
++		for (i = 0; i < sband->n_channels; i++) {
++			struct ieee80211_channel *chan = &sband->channels[i];
++
++			if (chan->flags & IEEE80211_CHAN_DISABLED)
++				continue;
++
++			if (!wiphy_freq_limits_valid_chan(wiphy, freq_limits,
++							  n_freq_limits,
++							  chan)) {
++				pr_debug("Disabling freq %d MHz as it's out of OF limits\n",
++					 chan->center_freq);
++				chan->flags |= IEEE80211_CHAN_DISABLED;
++			}
++		}
++	}
++}
++
++void wiphy_read_of_freq_limits(struct wiphy *wiphy)
++{
++	struct device *dev = wiphy_dev(wiphy);
++	struct device_node *np;
++	struct property *prop;
++	struct ieee80211_freq_range *freq_limits;
++	unsigned int n_freq_limits;
++	const __be32 *p;
++	int len, i;
++	int err = 0;
++
++	if (!dev)
++		return;
++	np = dev_of_node(dev);
++	if (!np)
++		return;
++
++	prop = of_find_property(np, "ieee80211-freq-limit", &len);
++	if (!prop)
++		return;
++
++	if (!len || len % sizeof(u32) || len / sizeof(u32) % 2) {
++		dev_err(dev, "ieee80211-freq-limit wrong format");
++		return;
++	}
++	n_freq_limits = len / sizeof(u32) / 2;
++
++	freq_limits = kcalloc(n_freq_limits, sizeof(*freq_limits), GFP_KERNEL);
++	if (!freq_limits) {
++		err = -ENOMEM;
++		goto out_kfree;
++	}
++
++	p = NULL;
++	for (i = 0; i < n_freq_limits; i++) {
++		struct ieee80211_freq_range *limit = &freq_limits[i];
++
++		p = of_prop_next_u32(prop, p, &limit->start_freq_khz);
++		if (!p) {
++			err = -EINVAL;
++			goto out_kfree;
++		}
++
++		p = of_prop_next_u32(prop, p, &limit->end_freq_khz);
++		if (!p) {
++			err = -EINVAL;
++			goto out_kfree;
++		}
++
++		if (!limit->start_freq_khz ||
++		    !limit->end_freq_khz ||
++		    limit->start_freq_khz >= limit->end_freq_khz) {
++			err = -EINVAL;
++			goto out_kfree;
++		}
++	}
++
++	wiphy_freq_limits_apply(wiphy, freq_limits, n_freq_limits);
++
++out_kfree:
++	kfree(freq_limits);
++	if (err)
++		dev_err(dev, "Failed to get limits: %d\n", err);
++}
++EXPORT_SYMBOL(wiphy_read_of_freq_limits);

+ 26 - 0
package/kernel/mac80211/patches/347-ath9k-don-t-run-periodic-and-nf-calibation-at-the-sa.patch

@@ -0,0 +1,26 @@
+From: Felix Fietkau <nbd@nbd.name>
+Date: Tue, 27 Dec 2016 23:16:23 +0100
+Subject: [PATCH] ath9k: don't run periodic and nf calibation at the same time
+
+The checks already prevents periodic cal from being started while noise
+floor calibration runs. It is missing checks for the other way around.
+
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+---
+
+--- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
++++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
+@@ -676,10 +676,10 @@ static int ar9002_hw_calibrate(struct at
+ 			return 0;
+ 
+ 		ah->cal_list_curr = currCal = currCal->calNext;
+-		if (currCal->calState == CAL_WAITING) {
++		if (currCal->calState == CAL_WAITING)
+ 			ath9k_hw_reset_calibration(ah, currCal);
+-			return 0;
+-		}
++
++		return 0;
+ 	}
+ 
+ 	/* Do NF cal only at longer intervals */

+ 3 - 2
package/kernel/mac80211/patches/400-ath_move_debug_code.patch

@@ -14,7 +14,7 @@
  ccflags-y += -D__CHECK_ENDIAN__
 --- a/drivers/net/wireless/ath/ath.h
 +++ b/drivers/net/wireless/ath/ath.h
-@@ -318,13 +318,6 @@ void _ath_dbg(struct ath_common *common,
+@@ -318,14 +318,7 @@ void _ath_dbg(struct ath_common *common,
  #endif /* CPTCFG_ATH_DEBUG */
  
  /** Returns string describing opmode, or NULL if unknown mode. */
@@ -27,4 +27,5 @@
 -}
 -#endif
  
- #endif /* ATH_H */
+ extern const char *ath_bus_type_strings[];
+ static inline const char *ath_bus_type_to_string(enum ath_bus_type bustype)

+ 1 - 1
package/kernel/mac80211/patches/401-ath9k_blink_default.patch

@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ath/ath9k/init.c
 +++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -45,7 +45,7 @@ int ath9k_modparam_nohwcrypt;
+@@ -47,7 +47,7 @@ int ath9k_modparam_nohwcrypt;
  module_param_named(nohwcrypt, ath9k_modparam_nohwcrypt, int, 0444);
  MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption");
  

+ 1 - 1
package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch

@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ath/ath9k/init.c
 +++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -731,6 +731,7 @@ static const struct ieee80211_iface_limi
+@@ -773,6 +773,7 @@ static const struct ieee80211_iface_limi
  				 BIT(NL80211_IFTYPE_AP) },
  	{ .max = 1,	.types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  				 BIT(NL80211_IFTYPE_P2P_GO) },

+ 1 - 1
package/kernel/mac80211/patches/501-ath9k_ahb_init.patch

@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ath/ath9k/init.c
 +++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -1034,23 +1034,23 @@ static int __init ath9k_init(void)
+@@ -1076,23 +1076,23 @@ static int __init ath9k_init(void)
  {
  	int error;
  

+ 1 - 1
package/kernel/mac80211/patches/530-ath9k_extra_leds.patch

@@ -181,7 +181,7 @@
  
 --- a/drivers/net/wireless/ath/ath9k/init.c
 +++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -946,7 +946,7 @@ int ath9k_init_device(u16 devid, struct
+@@ -988,7 +988,7 @@ int ath9k_init_device(u16 devid, struct
  
  #ifdef CPTCFG_MAC80211_LEDS
  	/* must be initialized before ieee80211_register_hw */

+ 0 - 28
package/kernel/mac80211/patches/541-ath9k_rx_dma_stop_check.patch

@@ -1,28 +0,0 @@
---- a/drivers/net/wireless/ath/ath9k/mac.c
-+++ b/drivers/net/wireless/ath/ath9k/mac.c
-@@ -698,7 +698,7 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
- {
- #define AH_RX_STOP_DMA_TIMEOUT 10000   /* usec */
- 	struct ath_common *common = ath9k_hw_common(ah);
--	u32 mac_status, last_mac_status = 0;
-+	u32 mac_status = 0, last_mac_status = 0;
- 	int i;
- 
- 	/* Enable access to the DMA observation bus */
-@@ -728,6 +728,16 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
- 	}
- 
- 	if (i == 0) {
-+		if (!AR_SREV_9300_20_OR_LATER(ah) &&
-+		    (mac_status & 0x700) == 0) {
-+			/*
-+			 * DMA is idle but the MAC is still stuck
-+			 * processing events
-+			 */
-+			*reset = true;
-+			return true;
-+		}
-+
- 		ath_err(common,
- 			"DMA failed to stop in %d ms AR_CR=0x%08x AR_DIAG_SW=0x%08x DMADBG_7=0x%08x\n",
- 			AH_RX_STOP_DMA_TIMEOUT / 1000,

+ 2 - 2
package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch

@@ -94,7 +94,7 @@
  struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah,
 --- a/drivers/net/wireless/ath/ath9k/hw.c
 +++ b/drivers/net/wireless/ath/ath9k/hw.c
-@@ -1837,6 +1837,20 @@ u32 ath9k_hw_get_tsf_offset(struct times
+@@ -1838,6 +1838,20 @@ u32 ath9k_hw_get_tsf_offset(struct times
  }
  EXPORT_SYMBOL(ath9k_hw_get_tsf_offset);
  
@@ -115,7 +115,7 @@
  int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
  		   struct ath9k_hw_cal_data *caldata, bool fastcc)
  {
-@@ -2045,6 +2059,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
+@@ -2046,6 +2060,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  		ar9003_hw_disable_phy_restart(ah);
  
  	ath9k_hw_apply_gpio_override(ah);

+ 3 - 3
package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch

@@ -55,7 +55,7 @@
  	ops->spectral_scan_config = ar9003_hw_spectral_scan_config;
 --- a/drivers/net/wireless/ath/ath9k/init.c
 +++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -719,7 +719,8 @@ static void ath9k_init_txpower_limits(st
+@@ -761,7 +761,8 @@ static void ath9k_init_txpower_limits(st
  	if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
  		ath9k_init_band_txpower(sc, NL80211_BAND_5GHZ);
  
@@ -65,7 +65,7 @@
  }
  
  static const struct ieee80211_iface_limit if_limits[] = {
-@@ -906,6 +907,18 @@ static void ath9k_set_hw_capab(struct at
+@@ -948,6 +949,18 @@ static void ath9k_set_hw_capab(struct at
  	SET_IEEE80211_PERM_ADDR(hw, common->macaddr);
  }
  
@@ -84,7 +84,7 @@
  int ath9k_init_device(u16 devid, struct ath_softc *sc,
  		    const struct ath_bus_ops *bus_ops)
  {
-@@ -951,6 +964,8 @@ int ath9k_init_device(u16 devid, struct
+@@ -993,6 +1006,8 @@ int ath9k_init_device(u16 devid, struct
  		ARRAY_SIZE(ath9k_tpt_blink));
  #endif
  

+ 4 - 4
package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch

@@ -20,7 +20,7 @@
  /******************/
  /* Chip Revisions */
  /******************/
-@@ -1413,6 +1426,9 @@ static bool ath9k_hw_set_reset(struct at
+@@ -1414,6 +1427,9 @@ static bool ath9k_hw_set_reset(struct at
  		udelay(50);
  	}
  
@@ -30,7 +30,7 @@
  	return true;
  }
  
-@@ -1512,6 +1528,9 @@ static bool ath9k_hw_chip_reset(struct a
+@@ -1513,6 +1529,9 @@ static bool ath9k_hw_chip_reset(struct a
  		ar9003_hw_internal_regulator_apply(ah);
  	ath9k_hw_init_pll(ah, chan);
  
@@ -40,7 +40,7 @@
  	return true;
  }
  
-@@ -1815,8 +1834,14 @@ static int ath9k_hw_do_fastcc(struct ath
+@@ -1816,8 +1835,14 @@ static int ath9k_hw_do_fastcc(struct ath
  	if (AR_SREV_9271(ah))
  		ar9002_hw_load_ani_reg(ah, chan);
  
@@ -55,7 +55,7 @@
  	return -EINVAL;
  }
  
-@@ -2070,6 +2095,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
+@@ -2071,6 +2096,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  		ath9k_hw_set_radar_params(ah);
  	}
  

+ 23 - 27
package/kernel/mac80211/patches/556-ath9k-define-all-EEPROM-fields-in-Little-Endian-form.patch

@@ -349,16 +349,6 @@ Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
 -
 -		integer = swab32(eep->modalHeader.antCtrlCommon);
 -		eep->modalHeader.antCtrlCommon = integer;
--
--		for (i = 0; i < AR5416_EEP4K_MAX_CHAINS; i++) {
--			integer = swab32(eep->modalHeader.antCtrlChain[i]);
--			eep->modalHeader.antCtrlChain[i] = integer;
--		}
--
--		for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
--			word = swab16(eep->modalHeader.spurChans[i].spurChan);
--			eep->modalHeader.spurChans[i].spurChan = word;
--		}
 +		EEPROM_FIELD_SWAB16(eep->baseEepHeader.length);
 +		EEPROM_FIELD_SWAB16(eep->baseEepHeader.checksum);
 +		EEPROM_FIELD_SWAB16(eep->baseEepHeader.version);
@@ -368,10 +358,18 @@ Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
 +		EEPROM_FIELD_SWAB16(eep->baseEepHeader.blueToothOptions);
 +		EEPROM_FIELD_SWAB16(eep->baseEepHeader.deviceCap);
 +		EEPROM_FIELD_SWAB32(eep->modalHeader.antCtrlCommon);
-+
+ 
+-		for (i = 0; i < AR5416_EEP4K_MAX_CHAINS; i++) {
+-			integer = swab32(eep->modalHeader.antCtrlChain[i]);
+-			eep->modalHeader.antCtrlChain[i] = integer;
+-		}
 +		for (i = 0; i < AR5416_EEP4K_MAX_CHAINS; i++)
 +			EEPROM_FIELD_SWAB32(eep->modalHeader.antCtrlChain[i]);
-+
+ 
+-		for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
+-			word = swab16(eep->modalHeader.spurChans[i].spurChan);
+-			eep->modalHeader.spurChans[i].spurChan = word;
+-		}
 +		for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++)
 +			EEPROM_FIELD_SWAB16(
 +				eep->modalHeader.spurChans[i].spurChan);
@@ -542,16 +540,6 @@ Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
 -
 -		integer = swab32(eep->modalHeader.antCtrlCommon);
 -		eep->modalHeader.antCtrlCommon = integer;
--
--		for (i = 0; i < AR9287_MAX_CHAINS; i++) {
--			integer = swab32(eep->modalHeader.antCtrlChain[i]);
--			eep->modalHeader.antCtrlChain[i] = integer;
--		}
--
--		for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
--			word = swab16(eep->modalHeader.spurChans[i].spurChan);
--			eep->modalHeader.spurChans[i].spurChan = word;
--		}
 +		EEPROM_FIELD_SWAB16(eep->baseEepHeader.length);
 +		EEPROM_FIELD_SWAB16(eep->baseEepHeader.checksum);
 +		EEPROM_FIELD_SWAB16(eep->baseEepHeader.version);
@@ -561,10 +549,18 @@ Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
 +		EEPROM_FIELD_SWAB16(eep->baseEepHeader.blueToothOptions);
 +		EEPROM_FIELD_SWAB16(eep->baseEepHeader.deviceCap);
 +		EEPROM_FIELD_SWAB32(eep->modalHeader.antCtrlCommon);
-+
+ 
+-		for (i = 0; i < AR9287_MAX_CHAINS; i++) {
+-			integer = swab32(eep->modalHeader.antCtrlChain[i]);
+-			eep->modalHeader.antCtrlChain[i] = integer;
+-		}
 +		for (i = 0; i < AR9287_MAX_CHAINS; i++)
 +			EEPROM_FIELD_SWAB32(eep->modalHeader.antCtrlChain[i]);
-+
+ 
+-		for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
+-			word = swab16(eep->modalHeader.spurChans[i].spurChan);
+-			eep->modalHeader.spurChans[i].spurChan = word;
+-		}
 +		for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++)
 +			EEPROM_FIELD_SWAB16(
 +				eep->modalHeader.spurChans[i].spurChan);
@@ -716,8 +712,7 @@ Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
  	if (need_swap) {
 -		u32 integer, j;
 -		u16 word;
-+		u32 j;
- 
+-
 -		word = swab16(eep->baseEepHeader.length);
 -		eep->baseEepHeader.length = word;
 -
@@ -738,7 +733,8 @@ Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
 -
 -		word = swab16(eep->baseEepHeader.blueToothOptions);
 -		eep->baseEepHeader.blueToothOptions = word;
--
++		u32 j;
+ 
 -		word = swab16(eep->baseEepHeader.deviceCap);
 -		eep->baseEepHeader.deviceCap = word;
 +		EEPROM_FIELD_SWAB16(eep->baseEepHeader.length);

+ 0 - 77
package/kernel/mmc_over_gpio/Makefile

@@ -1,77 +0,0 @@
-#
-# Copyright (C) 2008 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/kernel.mk
-
-PKG_NAME:=mmc-over-gpio
-PKG_RELEASE:=4
-
-include $(INCLUDE_DIR)/package.mk
-
-
-define KernelPackage/mmc-over-gpio
-  SUBMENU:=Other modules
-  DEPENDS:=@GPIO_SUPPORT +kmod-mmc-spi +kmod-spi-gpio-old +kmod-fs-configfs @!LINUX_4_4
-  KCONFIG:=CONFIG_GPIOMMC
-  TITLE:=MMC/SD card over GPIO support
-  FILES:=$(LINUX_DIR)/drivers/mmc/host/gpiommc.ko
-  AUTOLOAD:=$(call AutoProbe,gpiommc)
-  MENU:=1
-endef
-
-define Package/kmod-mmc-over-gpio/config
-	menu "Configuration"
-		depends on PACKAGE_kmod-mmc-over-gpio
-
-	config KMOD_MMC_OVER_GPIO_DI_PIN
-		int "GPIO DI (Data-In) pin"
-		default 1
-
-	config KMOD_MMC_OVER_GPIO_DO_PIN
-		int "GPIO DO (Data-Out) pin"
-		default 3
-
-	config KMOD_MMC_OVER_GPIO_CLK_PIN
-		int "GPIO CLK (Clock) pin"
-		default 4
-
-	config KMOD_MMC_OVER_GPIO_CS_PIN
-		int "GPIO CS (Chip-Select) pin"
-		default 7
-
-	endmenu
-endef
-
-define KernelPackage/mmc-over-gpio/description
- Support for driving an MMC/SD card over GPIO pins via SPI.
-endef
-
-define KernelPackage/mmc-over-gpio/conffiles
-/etc/config/mmc_over_gpio
-endef
-
-define Build/Prepare
-	mkdir -p $(PKG_BUILD_DIR)
-endef
-
-define Build/Compile
-endef
-
-define KernelPackage/mmc-over-gpio/install
-	$(INSTALL_DIR) $(1)/etc/config
-	$(INSTALL_DATA) ./files/mmc_over_gpio.config $(1)/etc/config/mmc_over_gpio
-	$(INSTALL_DIR) $(1)/etc/init.d
-	$(INSTALL_BIN) ./files/mmc_over_gpio.init $(1)/etc/init.d/mmc_over_gpio
-
-	$(SED) 's,@GPIO_DI_PIN@,$(CONFIG_KMOD_MMC_OVER_GPIO_DI_PIN),g' \
-		-e 's,@GPIO_DO_PIN@,$(CONFIG_KMOD_MMC_OVER_GPIO_DO_PIN),g' \
-		-e 's,@GPIO_CLK_PIN@,$(CONFIG_KMOD_MMC_OVER_GPIO_CLK_PIN),g' \
-		-e 's,@GPIO_CS_PIN@,$(CONFIG_KMOD_MMC_OVER_GPIO_CS_PIN),g' \
-		$(1)/etc/config/mmc_over_gpio
-endef
-
-$(eval $(call KernelPackage,mmc-over-gpio))

+ 0 - 8
package/kernel/mmc_over_gpio/files/mmc_over_gpio.config

@@ -1,8 +0,0 @@
-config 'mmc_over_gpio'
-	option 'name' 'default'
-	option 'enabled' '0'
-	option 'DI_pin' '@GPIO_DI_PIN@'
-	option 'DO_pin' '@GPIO_DO_PIN@'
-	option 'CLK_pin' '@GPIO_CLK_PIN@'
-	option 'CS_pin' '@GPIO_CS_PIN@'
-	option 'mode' '0'

+ 0 - 83
package/kernel/mmc_over_gpio/files/mmc_over_gpio.init

@@ -1,83 +0,0 @@
-#!/bin/sh /etc/rc.common
-# Copyright (C) 2008 OpenWrt.org
-START=90
-
-CONFIGFS_DIR="/config/gpiommc"
-
-# add_device(name, DI_pin, DO_pin, CLK_pin, CS_pin, mode)
-add_device() {
-	local dir="$CONFIGFS_DIR/$1"
-
-	mkdir -p $dir
-	[ $? -eq 0 ] || return 1
-	echo $2 > $dir/gpio_data_in
-	[ $? -eq 0 ] || return 1
-	echo $3 > $dir/gpio_data_out
-	[ $? -eq 0 ] || return 1
-	echo $4 > $dir/gpio_clock
-	[ $? -eq 0 ] || return 1
-	echo $5 > $dir/gpio_chipselect
-	[ $? -eq 0 ] || return 1
-	echo $6 > $dir/spi_mode
-	[ $? -eq 0 ] || return 1
-	# XXX We have more config options available. Use defaults for now.
-
-	echo 1 > $dir/register
-	[ $? -eq 0 ] || return 1
-
-	return 0
-}
-
-# remove_device(name)
-remove_device() {
-	local dir="$CONFIGFS_DIR/$1"
-
-	rmdir $dir
-}
-
-mount_configfs() {
-	# FIXME: This should probably be done somewhere else.
-	mount | grep configfs
-	if [ $? -eq 0 ]; then
-		# already mounted
-		return 0
-	fi
-	mkdir -p /config
-	[ $? -eq 0 ] || return 1
-	mount configfs -t configfs /config
-	[ $? -eq 0 ] || return 1
-
-	return 0
-}
-
-start_service() {
-	local section="$1"
-	config_get "name" "$section" "name"
-	config_get "DI_pin" "$section" "DI_pin"
-	config_get "DO_pin" "$section" "DO_pin"
-	config_get "CLK_pin" "$section" "CLK_pin"
-	config_get "CS_pin" "$section" "CS_pin"
-	config_get "mode" "$section" "mode"
-	config_get_bool "enabled" "$section" "enabled" '1'
-	[ "$enabled" -gt 0 ] && add_device "$name" $DI_pin $DO_pin $CLK_pin $CS_pin $mode &
-}
-
-stop_service() {
-	local section="$1"
-	config_get "name" "$section" "name"
-	remove_device "$name"
-}
-
-start() {
-	# Make sure configfs is mounted
-	mount_configfs
-	[ $? -eq 0 ] || return 1
-
-	config_load "mmc_over_gpio"
-	config_foreach start_service "mmc_over_gpio"
-}
-
-stop() {
-	config_load "mmc_over_gpio"
-	config_foreach stop_service "mmc_over_gpio"
-}

+ 33 - 0
package/kernel/rtc-rv5c386a/Makefile

@@ -0,0 +1,33 @@
+#
+# Copyright (C) 2006-2009 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=rtc-rv5c386a
+PKG_RELEASE:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define KernelPackage/rtc-rv5c386a
+  SUBMENU:=Other modules
+  DEPENDS:=@TARGET_brcm47xx @!IN_SDK
+  TITLE:=Driver for RTC RV5C386A (used in WL-700gE and WL-HDD)
+  AUTOLOAD:=$(call AutoLoad,70,rtc)
+  FILES:=$(PKG_BUILD_DIR)/rtc.ko
+endef
+
+define Build/Compile
+	$(MAKE) -C "$(LINUX_DIR)" \
+		CROSS_COMPILE="$(TARGET_CROSS)" \
+		ARCH="$(LINUX_KARCH)" \
+		SUBDIRS="$(PKG_BUILD_DIR)" \
+		EXTRA_CFLAGS="$(BUILDFLAGS)" \
+		modules
+endef
+
+$(eval $(call KernelPackage,rtc-rv5c386a))

+ 18 - 0
package/kernel/rtc-rv5c386a/src/Makefile

@@ -0,0 +1,18 @@
+# $Id$
+#
+# Makefile for Real Time Clock driver for WL-HDD
+#
+# Copyright (C) 2007 Andreas Engel
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version
+# 2 of the License, or (at your option) any later version.
+#
+
+obj-m := rtc.o
+
+ifeq ($(MAKING_MODULES),1)
+
+-include $(TOPDIR)/Rules.make
+endif

+ 613 - 0
package/kernel/rtc-rv5c386a/src/rtc.c

@@ -0,0 +1,613 @@
+/*
+ * Real Time Clock driver for WL-HDD
+ *
+ * Copyright (C) 2007 Andreas Engel
+ *
+ * Hacked together mostly by copying the relevant code parts from:
+ *   drivers/i2c/i2c-bcm5365.c
+ *   drivers/i2c/i2c-algo-bit.c
+ *   drivers/char/rtc.c
+ *
+ * Note 1:
+ * This module uses the standard char device (10,135), while the Asus module
+ * rtcdrv.o uses (12,0). So, both can coexist which might be handy during
+ * development (but see the comment in rtc_open()).
+ *
+ * Note 2:
+ * You might need to set the clock once after loading the driver the first
+ * time because the driver switches the chip into 24h mode if it is running
+ * in 12h mode.
+ *
+ * Usage:
+ * For compatibility reasons with the original asus driver, the time can be
+ * read and set via the /dev/rtc device entry. The only accepted data format
+ * is "YYYY:MM:DD:W:HH:MM:SS\n". See OpenWrt wiki for a script which handles
+ * this format.
+ *
+ * In addition, this driver supports the standard ioctl() calls for setting
+ * and reading the hardware clock, so the ordinary hwclock utility can also
+ * be used.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ * TODO:
+ * - add a /proc/driver/rtc interface?
+ * - make the battery failure bit available through the /proc interface?
+ *
+ * $Id: rtc.c 7 2007-05-25 19:37:01Z ae $
+ */
+
+#include <linux/module.h>
+#include <linux/kmod.h>
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/miscdevice.h>
+#include <linux/ioport.h>
+#include <linux/fcntl.h>
+#include <linux/mc146818rtc.h>
+#include <linux/init.h>
+#include <linux/spinlock.h>
+#include <linux/rtc.h>
+#include <linux/delay.h>
+#include <linux/version.h>
+#include <linux/gpio.h>
+#include <linux/uaccess.h>
+
+#include <asm/current.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
+#include <asm/system.h>
+#endif
+
+#include <bcm47xx.h>
+#include <linux/bcm47xx_nvram.h>
+
+#define RTC_IS_OPEN		0x01	/* Means /dev/rtc is in use.  */
+
+/* Can be changed via a module parameter.  */
+static int rtc_debug = 0;
+
+static unsigned long rtc_status = 0;	/* Bitmapped status byte.	*/
+
+/* These settings are platform dependents.  */
+unsigned int sda_index = 0;
+unsigned int scl_index = 0;
+
+#define I2C_READ_MASK  1
+#define I2C_WRITE_MASK 0
+
+#define I2C_ACK 1
+#define I2C_NAK 0
+
+#define RTC_EPOCH		1900
+#define RTC_I2C_ADDRESS		(0x32 << 1)
+#define RTC_24HOUR_MODE_MASK	0x20
+#define RTC_PM_MASK		0x20
+#define RTC_VDET_MASK		0x40
+#define RTC_Y2K_MASK		0x80
+
+/*
+ * Delay in microseconds for generating the pulses on the I2C bus. We use
+ * a rather conservative setting here.  See datasheet of the RTC chip.
+ */
+#define ADAP_DELAY 50
+
+/* Avoid spurious compiler warnings.  */
+#define UNUSED __attribute__((unused))
+
+MODULE_AUTHOR("Andreas Engel");
+MODULE_LICENSE("GPL");
+
+/* Test stolen from switch-adm.c.  */
+module_param(rtc_debug, int, 0);
+
+static inline void sdalo(void)
+{
+	gpio_direction_output(sda_index, 1);
+	udelay(ADAP_DELAY);
+}
+
+static inline void sdahi(void)
+{
+	gpio_direction_input(sda_index);
+	udelay(ADAP_DELAY);
+}
+
+static inline void scllo(void)
+{
+   gpio_direction_output(scl_index, 1);
+	udelay(ADAP_DELAY);
+}
+
+static inline int getscl(void)
+{
+	return (gpio_get_value(scl_index));
+}
+
+static inline int getsda(void)
+{
+	return (gpio_get_value(sda_index));
+}
+
+/*
+ * We shouldn't simply set the SCL pin to high. Like SDA, the SCL line is
+ * bidirectional too. According to the I2C spec, the slave is allowed to
+ * pull down the SCL line to slow down the clock, so we need to check this.
+ * Generally, we'd need a timeout here, but in our case, we just check the
+ * line, assuming the RTC chip behaves well.
+ */
+static int sclhi(void)
+{
+	gpio_direction_input(scl_index);
+	udelay(ADAP_DELAY);
+	if (!getscl()) {
+		printk(KERN_ERR "SCL pin should be low\n");
+		return -ETIMEDOUT;
+	}
+	return 0;
+}
+
+static void i2c_start(void)
+{
+	sdalo();
+	scllo();
+}
+
+static void i2c_stop(void)
+{
+	sdalo();
+	sclhi();
+	sdahi();
+}
+
+static int i2c_outb(int c)
+{
+	int i;
+	int ack;
+
+	/* assert: scl is low */
+	for (i = 7; i >= 0; i--) {
+		if (c & ( 1 << i )) {
+			sdahi();
+		} else {
+			sdalo();
+		}
+		if (sclhi() < 0) { /* timed out */
+			sdahi(); /* we don't want to block the net */
+			return -ETIMEDOUT;
+		};
+		scllo();
+	}
+	sdahi();
+	if (sclhi() < 0) {
+		return -ETIMEDOUT;
+	};
+	/* read ack: SDA should be pulled down by slave */
+	ack = getsda() == 0;	/* ack: sda is pulled low ->success.	 */
+	scllo();
+
+	if (rtc_debug)
+		printk(KERN_DEBUG "i2c_outb(0x%02x) -> %s\n",
+		       c, ack ? "ACK": "NAK");
+
+	return ack;		/* return 1 if device acked	 */
+	/* assert: scl is low (sda undef) */
+}
+
+static int i2c_inb(int ack)
+{
+	int i;
+	unsigned int indata = 0;
+
+	/* assert: scl is low */
+
+	sdahi();
+	for (i = 0; i < 8; i++) {
+		if (sclhi() < 0) {
+			return -ETIMEDOUT;
+		};
+		indata *= 2;
+		if (getsda())
+			indata |= 0x01;
+		scllo();
+	}
+	if (ack) {
+		sdalo();
+	} else {
+		sdahi();
+	}
+
+	if (sclhi() < 0) {
+		sdahi();
+		return -ETIMEDOUT;
+	}
+	scllo();
+	sdahi();
+
+	if (rtc_debug)
+		printk(KERN_DEBUG "i2c_inb() -> 0x%02x\n", indata);
+
+	/* assert: scl is low */
+	return indata & 0xff;
+}
+
+static void i2c_init(void)
+{
+    /* no gpio_control for EXTIF */
+	// ssb_gpio_control(&ssb, sda_mask | scl_mask, 0);
+
+   gpio_set_value(sda_index, 0);
+   gpio_set_value(scl_index, 0);
+	sdahi();
+	sclhi();
+}
+
+static int rtc_open(UNUSED struct inode *inode, UNUSED struct file *filp)
+{
+	spin_lock_irq(&rtc_lock);
+
+	if (rtc_status & RTC_IS_OPEN) {
+		spin_unlock_irq(&rtc_lock);
+		return -EBUSY;
+	}
+
+	rtc_status |= RTC_IS_OPEN;
+
+	/*
+	 * The following call is only necessary if we use both this driver and
+	 * the proprietary one from asus at the same time (which, b.t.w. only
+	 * makes sense during development). Otherwise, each access via the asus
+	 * driver will make access via this driver impossible.
+	 */
+	i2c_init();
+
+	spin_unlock_irq(&rtc_lock);
+
+	return 0;
+}
+
+static int rtc_release(UNUSED struct inode *inode, UNUSED struct file *filp)
+{
+	/* No need for locking here. */
+	rtc_status &= ~RTC_IS_OPEN;
+	return 0;
+}
+
+static int from_bcd(int bcdnum)
+{
+	int fac, num = 0;
+
+	for (fac = 1; bcdnum; fac *= 10) {
+		num += (bcdnum % 16) * fac;
+		bcdnum /= 16;
+	}
+
+	return num;
+}
+
+static int to_bcd(int decnum)
+{
+	int fac, num = 0;
+
+	for (fac = 1; decnum; fac *= 16) {
+		num += (decnum % 10) * fac;
+		decnum /= 10;
+	}
+
+	return num;
+}
+
+static void get_rtc_time(struct rtc_time *rtc_tm)
+{
+	int cr2;
+
+	/*
+	 * Read date and time from the RTC. We use read method (3).
+	 */
+
+	spin_lock_irq(&rtc_lock);
+	i2c_start();
+	i2c_outb(RTC_I2C_ADDRESS | I2C_READ_MASK);
+	cr2             = i2c_inb(I2C_ACK);
+	rtc_tm->tm_sec  = i2c_inb(I2C_ACK);
+	rtc_tm->tm_min  = i2c_inb(I2C_ACK);
+	rtc_tm->tm_hour = i2c_inb(I2C_ACK);
+	rtc_tm->tm_wday = i2c_inb(I2C_ACK);
+	rtc_tm->tm_mday = i2c_inb(I2C_ACK);
+	rtc_tm->tm_mon  = i2c_inb(I2C_ACK);
+	rtc_tm->tm_year = i2c_inb(I2C_NAK);
+	i2c_stop();
+	spin_unlock_irq(&rtc_lock);
+
+	if (cr2 & RTC_VDET_MASK) {
+		printk(KERN_WARNING "***RTC BATTERY FAILURE***\n");
+	}
+
+	/* Handle century bit */
+	if (rtc_tm->tm_mon & RTC_Y2K_MASK) {
+		rtc_tm->tm_mon &= ~RTC_Y2K_MASK;
+		rtc_tm->tm_year += 0x100;
+	}
+
+	rtc_tm->tm_sec  = from_bcd(rtc_tm->tm_sec);
+	rtc_tm->tm_min  = from_bcd(rtc_tm->tm_min);
+	rtc_tm->tm_hour = from_bcd(rtc_tm->tm_hour);
+	rtc_tm->tm_mday = from_bcd(rtc_tm->tm_mday);
+	rtc_tm->tm_mon  = from_bcd(rtc_tm->tm_mon) - 1;
+	rtc_tm->tm_year = from_bcd(rtc_tm->tm_year);
+
+	rtc_tm->tm_isdst = -1; /* DST not known */
+}
+
+static void set_rtc_time(struct rtc_time *rtc_tm)
+{
+	rtc_tm->tm_sec  = to_bcd(rtc_tm->tm_sec);
+	rtc_tm->tm_min  = to_bcd(rtc_tm->tm_min);
+	rtc_tm->tm_hour = to_bcd(rtc_tm->tm_hour);
+	rtc_tm->tm_mday = to_bcd(rtc_tm->tm_mday);
+	rtc_tm->tm_mon  = to_bcd(rtc_tm->tm_mon + 1);
+	rtc_tm->tm_year = to_bcd(rtc_tm->tm_year);
+
+	if (rtc_tm->tm_year >= 0x100) {
+		rtc_tm->tm_year -= 0x100;
+		rtc_tm->tm_mon |= RTC_Y2K_MASK;
+	}
+
+	spin_lock_irq(&rtc_lock);
+	i2c_start();
+	i2c_outb(RTC_I2C_ADDRESS | I2C_WRITE_MASK);
+	i2c_outb(0x00);	/* set starting register to 0 (=seconds) */
+	i2c_outb(rtc_tm->tm_sec);
+	i2c_outb(rtc_tm->tm_min);
+	i2c_outb(rtc_tm->tm_hour);
+	i2c_outb(rtc_tm->tm_wday);
+	i2c_outb(rtc_tm->tm_mday);
+	i2c_outb(rtc_tm->tm_mon);
+	i2c_outb(rtc_tm->tm_year);
+	i2c_stop();
+	spin_unlock_irq(&rtc_lock);
+}
+
+static ssize_t rtc_write(UNUSED struct file *filp, const char *buf,
+                         size_t count, loff_t *ppos)
+{
+	struct rtc_time rtc_tm;
+	char buffer[23];
+	char *p;
+
+	if (!capable(CAP_SYS_TIME))
+		return -EACCES;
+
+	if (ppos != &filp->f_pos)
+		return -ESPIPE;
+
+	/*
+	 * For simplicity, the only acceptable format is:
+	 * YYYY:MM:DD:W:HH:MM:SS\n
+	 */
+
+	if (count != 22)
+		goto err_out;
+
+	if (copy_from_user(buffer, buf, count))
+		return -EFAULT;
+
+	buffer[sizeof(buffer)-1] = '\0';
+
+	p = &buffer[0];
+
+	rtc_tm.tm_year  = simple_strtoul(p, &p, 10);
+	if (*p++ != ':') goto err_out;
+
+	rtc_tm.tm_mon = simple_strtoul(p, &p, 10) - 1;
+	if (*p++ != ':') goto err_out;
+
+	rtc_tm.tm_mday = simple_strtoul(p, &p, 10);
+	if (*p++ != ':') goto err_out;
+
+	rtc_tm.tm_wday = simple_strtoul(p, &p, 10);
+	if (*p++ != ':') goto err_out;
+
+	rtc_tm.tm_hour = simple_strtoul(p, &p, 10);
+	if (*p++ != ':') goto err_out;
+
+	rtc_tm.tm_min = simple_strtoul(p, &p, 10);
+	if (*p++ != ':') goto err_out;
+
+	rtc_tm.tm_sec = simple_strtoul(p, &p, 10);
+	if (*p != '\n') goto err_out;
+
+	rtc_tm.tm_year -= RTC_EPOCH;
+
+	set_rtc_time(&rtc_tm);
+
+	*ppos += count;
+
+	return count;
+
+ err_out:
+	printk(KERN_ERR "invalid format: use YYYY:MM:DD:W:HH:MM:SS\\n\n");
+	return -EINVAL;
+}
+
+
+static ssize_t rtc_read(UNUSED struct file *filp, char *buf, size_t count,
+                        loff_t *ppos)
+{
+	char wbuf[23];
+	struct rtc_time tm;
+	ssize_t len;
+
+	if (count == 0 || *ppos != 0)
+		return 0;
+
+	get_rtc_time(&tm);
+
+	len = sprintf(wbuf, "%04d:%02d:%02d:%d:%02d:%02d:%02d\n",
+		      tm.tm_year + RTC_EPOCH,
+		      tm.tm_mon + 1,
+		      tm.tm_mday,
+		      tm.tm_wday,
+		      tm.tm_hour,
+		      tm.tm_min,
+		      tm.tm_sec);
+
+	if (len > (ssize_t)count)
+		len = count;
+
+	if (copy_to_user(buf, wbuf, len))
+		return -EFAULT;
+
+	*ppos += len;
+
+	return len;
+}
+
+static int rtc_do_ioctl(unsigned int cmd, unsigned long arg)
+{
+	struct rtc_time rtc_tm;
+
+	switch (cmd) {
+		case RTC_RD_TIME:
+			memset(&rtc_tm, 0, sizeof(struct rtc_time));
+			get_rtc_time(&rtc_tm);
+			if (copy_to_user((void *)arg, &rtc_tm, sizeof(rtc_tm)))
+				return -EFAULT;
+			break;
+
+		case RTC_SET_TIME:
+			if (!capable(CAP_SYS_TIME))
+				return -EACCES;
+
+			if (copy_from_user(&rtc_tm, (struct rtc_time *)arg,
+					   sizeof(struct rtc_time)))
+				return -EFAULT;
+
+			set_rtc_time(&rtc_tm);
+			break;
+
+		default:
+			return -ENOTTY;
+	}
+
+	return 0;
+}
+
+static long rtc_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+{
+	long ret;
+	ret = rtc_do_ioctl(cmd, arg);
+	return ret;
+}
+
+static const struct file_operations rtc_fops = {
+	.owner		= THIS_MODULE,
+	.llseek		= no_llseek,
+	.read		= rtc_read,
+	.write		= rtc_write,
+	.unlocked_ioctl	= rtc_ioctl,
+	.open		= rtc_open,
+	.release	= rtc_release,
+};
+
+static struct miscdevice rtc_dev = {
+	.minor = RTC_MINOR,
+	.name  = "rtc",
+	.fops  = &rtc_fops,
+};
+
+/* Savagely ripped from diag.c.  */
+static inline int startswith (char *source, char *cmp)
+{
+	return !strncmp(source, cmp, strlen(cmp));
+}
+
+static void platform_detect(void)
+{
+	char buf[20];
+	int et0phyaddr, et1phyaddr;
+
+	/* Based on "model_no".  */
+	if (bcm47xx_nvram_getenv("model_no", buf, sizeof(buf)) >= 0) {
+		if (startswith(buf, "WL700")) { /* WL700* */
+			sda_index = 2;
+			scl_index = 5;
+			return;
+		}
+	}
+
+	if (bcm47xx_nvram_getenv("et0phyaddr", buf, sizeof(buf)) >= 0 )
+		et0phyaddr = simple_strtoul(buf, NULL, 0);
+	if (bcm47xx_nvram_getenv("et1phyaddr", buf, sizeof(buf)) >= 0 )
+		et1phyaddr = simple_strtoul(buf, NULL, 0);
+
+	if (bcm47xx_nvram_getenv("hardware_version", buf, sizeof(buf)) >= 0) {
+		/* Either WL-300g or WL-HDD, do more extensive checks */
+		if (startswith(buf, "WL300-") && et0phyaddr == 0 && et1phyaddr == 1) {
+			sda_index = 4;
+			scl_index = 5;
+			return;
+		}
+	}
+	/* not found */
+}
+
+static int __init rtc_init(void)
+{
+	int cr1;
+
+	platform_detect();
+
+	if (sda_index == scl_index) {
+		printk(KERN_ERR "RTC-RV5C386A: unrecognized platform!\n");
+		return -ENODEV;
+	}
+
+	i2c_init();
+
+	/*
+	 * Switch RTC to 24h mode
+	 */
+	spin_lock_irq(&rtc_lock);
+	i2c_start();
+	i2c_outb(RTC_I2C_ADDRESS | I2C_WRITE_MASK);
+	i2c_outb(0xE4); /* start at address 0xE, transmission mode 4 */
+	cr1 = i2c_inb(I2C_NAK);
+	i2c_stop();
+	spin_unlock_irq(&rtc_lock);
+	if ((cr1 & RTC_24HOUR_MODE_MASK) == 0) {
+		/* RTC is running in 12h mode */
+		printk(KERN_INFO "rtc.o: switching to 24h mode\n");
+		spin_lock_irq(&rtc_lock);
+		i2c_start();
+		i2c_outb(RTC_I2C_ADDRESS | I2C_WRITE_MASK);
+		i2c_outb(0xE0);
+		i2c_outb(cr1 | RTC_24HOUR_MODE_MASK);
+		i2c_stop();
+		spin_unlock_irq(&rtc_lock);
+	}
+
+	misc_register(&rtc_dev);
+
+	printk(KERN_INFO "RV5C386A Real Time Clock Driver loaded\n");
+
+	return 0;
+}
+
+static void __exit rtc_exit (void)
+{
+	misc_deregister(&rtc_dev);
+	printk(KERN_INFO "Successfully removed RTC RV5C386A driver\n");
+}
+
+module_init(rtc_init);
+module_exit(rtc_exit);
+
+/*
+ * Local Variables:
+ * indent-tabs-mode:t
+ * c-basic-offset:8
+ * End:
+ */

+ 1 - 1
package/libs/argp-standalone/Makefile

@@ -13,7 +13,7 @@ PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://www.lysator.liu.se/~nisse/misc/
-PKG_MD5SUM:=720704bac078d067111b32444e24ba69
+PKG_HASH:=dec79694da1319acd2238ce95df57f3680fea2482096e483323fddf3d818d8be
 PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>
 
 PKG_LICENSE:=LGPL-2.1

+ 4 - 3
package/libs/cyassl/Makefile

@@ -8,15 +8,16 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=wolfssl
-PKG_VERSION:=3.9.10
+PKG_VERSION:=3.10.0
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).zip
 PKG_SOURCE_URL:=https://www.wolfssl.com/
-PKG_MD5SUM:=793921c0db96248be4a369cbfdf0cb7b37ee2be715b8b775b6cd32efe66f494e
+PKG_HASH:=66f7f2a8b8ee37d6b4beab3cb0dcb6a6980fd4674373bfd3bf1214b9d0d2c02e
 
 PKG_FIXUP:=libtool
 PKG_INSTALL:=1
+PKG_USE_MIPS16:=0
 PKG_BUILD_PARALLEL:=1
 PKG_LICENSE:=GPL-2.0+
 
@@ -42,8 +43,8 @@ endef
 
 TARGET_CFLAGS += $(FPIC)
 
+# --enable-stunnel needed for OpenSSL API compatibility bits
 CONFIGURE_ARGS += \
-	--enable-singlethreaded \
 	--enable-opensslextra \
 	--enable-sni \
 	--enable-stunnel \

+ 5 - 3
package/libs/elfutils/Makefile

@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=elfutils
-PKG_VERSION:=0.167
+PKG_VERSION:=0.168
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
-PKG_SOURCE_URL:=http://fedorahosted.org/releases/e/l/$(PKG_NAME)/$(PKG_VERSION)
-PKG_MD5SUM:=efc6c2067dfad5646777e93e85222e8f
+PKG_SOURCE_URL:=https://sourceware.org/$(PKG_NAME)/ftp/$(PKG_VERSION)
+PKG_HASH:=b88d07893ba1373c7dd69a7855974706d05377766568a7d9002706d5de72c276
 PKG_MAINTAINER:=Luiz Angelo Daros de Luca <luizluca@gmail.com>
 PKG_LICENSE:=GPL-3.0+
 PKG_LICENSE_FILES:=COPYING COPYING-GPLV2 COPYING-LGPLV3
@@ -68,6 +68,8 @@ endif
 CONFIGURE_ARGS += \
 	--without-lzma
 
+TARGET_CFLAGS += -D_GNU_SOURCE
+
 define Build/InstallDev
 	$(INSTALL_DIR) $(1)/usr/include
 	$(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/

+ 0 - 14
package/libs/elfutils/patches/004-memcpy_def.patch

@@ -1,14 +0,0 @@
---- a/libelf/libelf.h
-+++ b/libelf/libelf.h
-@@ -108,6 +108,11 @@ typedef struct
-   size_t d_align;		/* Alignment in section.  */
- } Elf_Data;
- 
-+#ifndef _LIBC
-+#ifndef __mempcpy
-+#define __mempcpy mempcpy
-+#endif
-+#endif
- 
- /* Commands for `...'.  */
- typedef enum

+ 1 - 1
package/libs/elfutils/patches/006-libdw_LIBS.patch

@@ -1,6 +1,6 @@
 --- a/libdw/Makefile.in
 +++ b/libdw/Makefile.in
-@@ -1002,7 +1002,7 @@ libdw.so$(EXEEXT): $(srcdir)/libdw.map l
+@@ -1005,7 +1005,7 @@ libdw.so$(EXEEXT): $(srcdir)/libdw.map l
  		-Wl,--enable-new-dtags,-rpath,$(pkglibdir) \
  		-Wl,--version-script,$<,--no-undefined \
  		-Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\

+ 92 - 0
package/libs/elfutils/patches/007-fix_TEMP_FAILURE_RETRY.patch

@@ -0,0 +1,92 @@
+From b853c091231a56cc36135323d2668775a3d3c435 Mon Sep 17 00:00:00 2001
+From: Luiz Angelo Daros de Luca <luizluca@gmail.com>
+Date: Thu, 29 Dec 2016 20:51:41 -0200
+Subject: [PATCH] Fix TEMP_FAILURE_RETRY definition when not defined
+
+https://sourceware.org/bugzilla/show_bug.cgi?id=21001
+
+Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
+---
+ ChangeLog                        | 4 ++++
+ lib/crc32_file.c                 | 1 +
+ lib/system.h                     | 2 +-
+ libdwfl/dwfl_build_id_find_elf.c | 1 +
+ libdwfl/dwfl_module_getdwarf.c   | 1 +
+ libdwfl/libdwfl_crc32_file.c     | 1 -
+ 6 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index bb2ec10..77a7db8 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,7 @@
++2016-12-29  Luiz Angelo Daros de Luca  <luizluca@gmail.com>
++
++	* Fix TEMP_FAILURE_RETRY definition when not defined
++
+ 2016-12-27  Mark Wielaard  <mark@klomp.org>
+ 
+ 	* configure.ac: Set version to 0.168.
+diff --git a/lib/crc32_file.c b/lib/crc32_file.c
+index a8434d4..57e4298 100644
+--- a/lib/crc32_file.c
++++ b/lib/crc32_file.c
+@@ -35,6 +35,7 @@
+ #include <unistd.h>
+ #include <sys/stat.h>
+ #include <sys/mman.h>
++#include "system.h"
+ 
+ int
+ crc32_file (int fd, uint32_t *resp)
+diff --git a/lib/system.h b/lib/system.h
+index ccd99d6..dde7c4a 100644
+--- a/lib/system.h
++++ b/lib/system.h
+@@ -81,7 +81,7 @@
+      do \
+        __res = expression; \
+      while (__res == -1 && errno == EINTR); \
+-     __res; });
++     __res; })
+ #endif
+ 
+ static inline ssize_t __attribute__ ((unused))
+diff --git a/libdwfl/dwfl_build_id_find_elf.c b/libdwfl/dwfl_build_id_find_elf.c
+index 903e193..d4737c9 100644
+--- a/libdwfl/dwfl_build_id_find_elf.c
++++ b/libdwfl/dwfl_build_id_find_elf.c
+@@ -30,6 +30,7 @@
+ #include <inttypes.h>
+ #include <fcntl.h>
+ #include <unistd.h>
++#include "system.h"
+ 
+ 
+ int
+diff --git a/libdwfl/dwfl_module_getdwarf.c b/libdwfl/dwfl_module_getdwarf.c
+index 0e8810b..46caece 100644
+--- a/libdwfl/dwfl_module_getdwarf.c
++++ b/libdwfl/dwfl_module_getdwarf.c
+@@ -33,6 +33,7 @@
+ #include <unistd.h>
+ #include "../libdw/libdwP.h"	/* DWARF_E_* values are here.  */
+ #include "../libelf/libelfP.h"
++#include "system.h"
+ 
+ static inline Dwfl_Error
+ open_elf_file (Elf **elf, int *fd, char **name)
+diff --git a/libdwfl/libdwfl_crc32_file.c b/libdwfl/libdwfl_crc32_file.c
+index 6b6b7d3..f849128 100644
+--- a/libdwfl/libdwfl_crc32_file.c
++++ b/libdwfl/libdwfl_crc32_file.c
+@@ -31,6 +31,5 @@
+ 
+ #define crc32_file attribute_hidden __libdwfl_crc32_file
+ #define crc32 __libdwfl_crc32
+-#define LIB_SYSTEM_H	1
+ #include <libdwflP.h>
+ #include "../lib/crc32_file.c"
+-- 
+2.9.3
+

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