Browse Source

Use LEDE as base for Gluon

Matthias Schiffer 3 years ago
parent
commit
78b2775eec
100 changed files with 560 additions and 31391 deletions
  1. 2 3
      .gitignore
  2. 5 5
      LICENSE
  3. 102 452
      Makefile
  4. 90 34
      docs/dev/hardware.rst
  5. 2 3
      docs/site-example/site.mk
  6. 14 38
      docs/user/getting_started.rst
  7. 10 6
      docs/user/site.rst
  8. 0 22
      include/config
  9. 0 85
      include/gluon.mk
  10. 0 62
      include/toplevel.mk
  11. 0 67
      include/verbose.mk
  12. 4 6
      modules
  13. 2 0
      overlay/opkg.mk
  14. 14 5
      package/gluon-autoupdater/Makefile
  15. 5 9
      package/gluon-core/Makefile
  16. 1 1
      package/gluon-core/check_site.lua
  17. 32 23
      package/gluon-core/luasrc/lib/gluon/upgrade/500-opkg
  18. 0 1
      package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/K50dropbear
  19. 1 1
      package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S13haveged
  20. 0 1
      package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S50dropbear
  21. 21 0
      package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S50dropbear
  22. 0 12
      package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S50telnet
  23. 21 4
      package/gluon-site/Makefile
  24. 11 8
      package/gluon.mk
  25. 111 0
      patches/lede/0001-build-move-STAGING_DIR_HOSTPKG-and-BUILD_DIR_HOST-back-to-a-common-directory-for-all-targets.patch
  26. 0 0
      patches/lede/0002-procd-add-support-for-alternative-rc.d-directories.patch
  27. 43 0
      patches/lede/0003-base-files-disable-reset-button-handling.patch
  28. 0 0
      patches/lede/0004-hostapd-prevent-channel-switch-for-5GHz.patch
  29. 0 0
      patches/lede/0005-libjson-c-Add-support-for-custom-format-strings-for-doubles.patch
  30. 69 0
      patches/lede/0006-dropbear-add-a-failsafe-mode-that-will-always-allow-password-less-root-login.patch
  31. 0 36
      patches/openwrt/0001-tools-Makefile-fix-host-tools-build-dependencies.patch
  32. 0 118
      patches/openwrt/0003-odhcp6c-backport-from-LEDE-0d49f9f4b4da9d1960f82e68ae797290e4b9c434.patch
  33. 0 26
      patches/openwrt/0004-busybox-enable-telnet-only-when-root-password-is-really-empty-not-when-it-is-locked.patch
  34. 0 32
      patches/openwrt/0005-base-files-disable-reset-button-handling.patch
  35. 0 85
      patches/openwrt/0006-ar71xx-define-wmac-reset-function-for-QCA955x.patch
  36. 0 17348
      patches/openwrt/0007-mac80211-hostapd-iw-.-update.patch
  37. 0 24
      patches/openwrt/0008-iwinfo-update-NanoStation-Loco-txpower-offsets.patch
  38. 0 57
      patches/openwrt/0010-ipv6-fix-crash-on-ICMPv6-redirects-with-prohibited-blackholed-source.patch
  39. 0 16
      patches/openwrt/0011-lua-fix-installation-of-headers-for-host-build.patch
  40. 0 63
      patches/openwrt/0012-kernel-fs-seq_file-fallback-to-vmalloc-instead-of-oom-kill-processes.patch
  41. 0 74
      patches/openwrt/0013-fix-UBNT-XM-model-detection.patch
  42. 0 133
      patches/openwrt/0014-base-files-implemented-basic-GPIO-control.patch
  43. 0 32
      patches/openwrt/0015-ar71xx-assign-proper-GPIO-pin-for-Ubiquiti-Nanostation-models.patch
  44. 0 101
      patches/openwrt/0016-netifd-update-to-latest-version.patch
  45. 0 25
      patches/openwrt/0017-x86-fix-platform_export_bootpart-for-Xen-virtual-disks.patch
  46. 0 27
      patches/openwrt/0018-Support-LibreSSL-as-provider-of-openssl.patch
  47. 0 48
      patches/openwrt/0019-ar71xx-check-both-HWID-and-HWREV-on-upgrades-of-TP-LINK-devices.patch
  48. 0 45
      patches/openwrt/0020-ar71xx-avoid-AR71XX_MODEL-ending-with-a-space-on-some-TP-LINK-like-devices.patch
  49. 0 39
      patches/openwrt/0021-ar71xx-fix-the-revision-of-a-few-TP-LINK-devices-in-AR71XX_MODEL-to-match-labels-image-names.patch
  50. 0 41
      patches/openwrt/0022-ar71xx-build-image-for-TL-WR710N-v2.1.patch
  51. 0 2026
      patches/openwrt/0023-xtables-addons-build-fix-configure-compatiblity-with-POSIX-shells.patch
  52. 0 81
      patches/openwrt/0024-tools-add-tar-host-build-required-for-sort-name-which-was-only-added-in-the-latest-version.patch
  53. 0 31
      patches/openwrt/0025-tools-compile-flock-before-everything-else.patch
  54. 0 32
      patches/openwrt/0026-rules.mk-make-the-locked-template-available-even-if-flock-has-not-been-built-yet-fall-back-to-unlocked-shell-command.patch
  55. 0 20
      patches/openwrt/0027-build-add-locking-for-downloads-fixes-race-conditions-with-multiple-variants.patch
  56. 0 26
      patches/openwrt/0028-download.mk-fix-packed-checkout-mirroring-support.patch
  57. 0 2096
      patches/openwrt/0029-kernel-backport-spi-nor-driver-from-4.4.9.patch
  58. 0 115
      patches/openwrt/0030-kernel-mtd-spi-nor-wait-until-status-register-writes-are-ready.patch
  59. 0 56
      patches/openwrt/0031-kernel-mtd-spi-nor-unlock-Winbond-flashs.patch
  60. 0 46
      patches/openwrt/0032-ath79-dev-eth-fix-QCA9561-set-phy-interface-mode-and-mask.patch
  61. 0 33
      patches/openwrt/0033-ar71xx-use-correct-PLL-configuration-register-bitmask-for-QCA956x-SoC.patch
  62. 0 415
      patches/openwrt/0034-ar71xx-update-QCA956x-support.patch
  63. 0 176
      patches/openwrt/0035-ar71xx-fold-patch-622-MIPS-ath79-add-support-for-QCA956x-ethernet.patch-into-files.patch
  64. 0 22
      patches/openwrt/0036-ar71xx-fix-MDIO-bus-probe-on-QCA956x.patch
  65. 0 64
      patches/openwrt/0037-ar71xx-fix-qca956x-ethernet-initialization.patch
  66. 0 562
      patches/openwrt/0038-ar71xx-Support-for-Ubiquiti-UniFi-AP-AC-LITE.patch
  67. 0 21
      patches/openwrt/0039-ar71xx-Fix-eth0-support-for-Ubiquiti-UniFi-AP-AC.patch
  68. 0 193
      patches/openwrt/0040-ar71xx-Rename-unifiac-to-unifiac-lite.patch
  69. 0 274
      patches/openwrt/0041-ar71xx-Add-support-for-Ubiquiti-UniFi-AP-AC-PRO.patch
  70. 0 395
      patches/openwrt/0043-ath9k-add-HSR-tuner-support-for-UniFi-Outdoor-Plus.patch
  71. 0 41
      patches/openwrt/0044-ar71xx-Send-power-to-USB-port-on-WNR2200.patch
  72. 0 86
      patches/openwrt/0045-ar71xx-WNR2200-fix-for-random-WLAN-MAC.patch
  73. 0 251
      patches/openwrt/0046-ar71xx-WNR2200-enable-control-of-all-LEDs-and-buttons.patch
  74. 0 326
      patches/openwrt/0047-ar71xx-add-GL-AR150-support.patch
  75. 0 48
      patches/openwrt/0048-build-don-t-add-j-for-parallel-builds-with-Make-4.2.patch
  76. 0 30
      patches/openwrt/0049-tools-cmake-fix-parallel-build-with-Make-4.2.patch
  77. 0 143
      patches/openwrt/0050-linux-make-IPv6-builtin-if-selected-saves-30KB.patch
  78. 0 21
      patches/openwrt/0051-package-ipkg.mk-fix-Provides-for-packages-with-multiple-PROVIDES-entries.patch
  79. 0 154
      patches/openwrt/0052-kernel-remove-packaging-of-kmod-crypto-core-and-kmod-crypto-arc4.patch
  80. 0 24
      patches/openwrt/0053-x86-stop-relying-on-hexdump-for-image-build-signature.patch
  81. 0 34
      patches/openwrt/0054-mt76-fix-build-with-kernel-3.18.patch
  82. 0 41
      patches/openwrt/0055-ramips-Support-LEDs-on-D-Link-DIR-860L-B1.patch
  83. 0 56
      patches/openwrt/0056-ramips-add-button-support-and-make-LEDs-known-to-userspace-for-DIR-860L-B1.patch
  84. 0 22
      patches/openwrt/0057-ramips-set-correct-LAN-WAN-MAC-addresses-on-DIR-860L-B1.patch
  85. 0 323
      patches/openwrt/0058-ar71xx-add-support-for-TP-LINK-TL-WR842N-ND-v3.patch
  86. 0 18
      patches/openwrt/0059-x86-generic-enable-CONFIG_SATA_VIA.patch
  87. 0 45
      patches/openwrt/0060-libpcap-fix-dependency-of-install-shared-so-make-target.patch
  88. 0 38
      patches/openwrt/0061-ar71xx-add-revision-detection-for-D-Link-DIR-505-A1-A2.patch
  89. 0 28
      patches/openwrt/0062-ar71xx-don-t-use-D-Link-DIR-505-status-LED-as-ethernet-indicator.patch
  90. 0 35
      patches/openwrt/0063-ar71xx-cpe510-enable-LNA-for-CPE210-220-510-520.patch
  91. 0 169
      patches/openwrt/0064-ar71xx-cpe510-split-profile-into-2-profiles-cpe210-and-cpe510.patch
  92. 0 555
      patches/openwrt/0065-firmware-utils-backport-tplink-safeloader-from-LEDE-05abcf518d5e2b7d6526fd7a87a88a268030694a.patch
  93. 0 26
      patches/openwrt/0066-ar71xx-split-CPE210-from-CPE510-profile.patch
  94. 0 437
      patches/openwrt/0067-dropbear-update-to-LEDE-277f85c21ae0ede4e15e66cbd801b9fb502531df.patch
  95. 0 567
      patches/openwrt/0068-ar71xx-Added-support-for-TL-WA801NDv3.patch
  96. 0 856
      patches/openwrt/0069-firmware-utils-mktplinkfw-backport-from-LEDE-a4fc62bc0ea4010ddbfbd738453c9db70988a57c.patch
  97. 0 38
      patches/openwrt/0070-ar71xx-backport-support-for-new-TP-Link-region-codes.patch
  98. 0 68
      patches/openwrt/0071-ath10k-firmware-add-ath10k-firmware-qca988x-11s.patch
  99. 0 124
      patches/openwrt/0072-ath9k-revert-temperature-compensation-support-patch-FS-111.patch
  100. 0 885
      patches/openwrt/0073-ath9k-remove-intermediate-queueing-patch-until-it-is-fixed-properly.patch

+ 2 - 3
.gitignore

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

+ 5 - 5
LICENSE

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

+ 102 - 452
Makefile

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

+ 90 - 34
docs/dev/hardware.rst

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

+ 2 - 3
docs/site-example/site.mk

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

+ 14 - 38
docs/user/getting_started.rst

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

+ 10 - 6
docs/user/site.rst

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

+ 0 - 22
include/config

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

+ 0 - 85
include/gluon.mk

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

+ 0 - 62
include/toplevel.mk

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

+ 0 - 67
include/verbose.mk

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

+ 4 - 6
modules

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

+ 2 - 0
overlay/opkg.mk

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

+ 14 - 5
package/gluon-autoupdater/Makefile

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

+ 5 - 9
package/gluon-core/Makefile

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

+ 1 - 1
package/gluon-core/check_site.lua

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

+ 32 - 23
package/gluon-core/luasrc/lib/gluon/upgrade/500-opkg

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

+ 0 - 1
package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/K50dropbear

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

+ 1 - 1
package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S13haveged

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

+ 0 - 1
package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S50dropbear

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

+ 21 - 0
package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S50dropbear

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

+ 0 - 12
package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S50telnet

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

+ 21 - 4
package/gluon-site/Makefile

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

+ 11 - 8
package/gluon.mk

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

+ 111 - 0
patches/lede/0001-build-move-STAGING_DIR_HOSTPKG-and-BUILD_DIR_HOST-back-to-a-common-directory-for-all-targets.patch

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

+ 0 - 0
patches/openwrt/0002-procd-add-support-for-alternative-rc.d-directories.patch → patches/lede/0002-procd-add-support-for-alternative-rc.d-directories.patch


+ 43 - 0
patches/lede/0003-base-files-disable-reset-button-handling.patch

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

+ 0 - 0
patches/openwrt/0009-hostapd-prevent-channel-switch-for-5GHz.patch → patches/lede/0004-hostapd-prevent-channel-switch-for-5GHz.patch


+ 0 - 0
patches/openwrt/0042-libjson-c-Add-support-for-custom-format-strings-for-doubles.patch → patches/lede/0005-libjson-c-Add-support-for-custom-format-strings-for-doubles.patch


+ 69 - 0
patches/lede/0006-dropbear-add-a-failsafe-mode-that-will-always-allow-password-less-root-login.patch

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

+ 0 - 36
patches/openwrt/0001-tools-Makefile-fix-host-tools-build-dependencies.patch

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

+ 0 - 118
patches/openwrt/0003-odhcp6c-backport-from-LEDE-0d49f9f4b4da9d1960f82e68ae797290e4b9c434.patch

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

+ 0 - 26
patches/openwrt/0004-busybox-enable-telnet-only-when-root-password-is-really-empty-not-when-it-is-locked.patch

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

+ 0 - 32
patches/openwrt/0005-base-files-disable-reset-button-handling.patch

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

+ 0 - 85
patches/openwrt/0006-ar71xx-define-wmac-reset-function-for-QCA955x.patch

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

File diff suppressed because it is too large
+ 0 - 17348
patches/openwrt/0007-mac80211-hostapd-iw-.-update.patch


+ 0 - 24
patches/openwrt/0008-iwinfo-update-NanoStation-Loco-txpower-offsets.patch

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

+ 0 - 57
patches/openwrt/0010-ipv6-fix-crash-on-ICMPv6-redirects-with-prohibited-blackholed-source.patch

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

+ 0 - 16
patches/openwrt/0011-lua-fix-installation-of-headers-for-host-build.patch

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

+ 0 - 63
patches/openwrt/0012-kernel-fs-seq_file-fallback-to-vmalloc-instead-of-oom-kill-processes.patch

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

+ 0 - 74
patches/openwrt/0013-fix-UBNT-XM-model-detection.patch

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

+ 0 - 133
patches/openwrt/0014-base-files-implemented-basic-GPIO-control.patch

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

+ 0 - 32
patches/openwrt/0015-ar71xx-assign-proper-GPIO-pin-for-Ubiquiti-Nanostation-models.patch

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

+ 0 - 101
patches/openwrt/0016-netifd-update-to-latest-version.patch

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

+ 0 - 25
patches/openwrt/0017-x86-fix-platform_export_bootpart-for-Xen-virtual-disks.patch

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

+ 0 - 27
patches/openwrt/0018-Support-LibreSSL-as-provider-of-openssl.patch

@@ -1,27 +0,0 @@
-From: Matthias Schiffer <mschiffer@universe-factory.net>
-Date: Wed, 30 Mar 2016 02:59:19 +0200
-Subject: Support LibreSSL as provider of openssl
-
-The build scripts check for openssl by grepping the string "OpenSSL" in
-the output of openssl version command. LibreSSL fails this test as it
-outputs something like "LibreSSL 2.2.4". This patch fix the
-prereq-bulid.mk file so that it accepts LibreSSL as openssl provider as
-well.