This commit is contained in:
Christian Obersteiner 2016-05-28 20:06:26 +02:00
commit fb09a27a66
153 changed files with 10733 additions and 439 deletions

View File

@ -6,8 +6,8 @@ different communities with different expectations and requirements, it is both
essential and difficult to have contributions from the communities. While they
are sometimes necessary to adapt Gluon to the needs of the communities, they
also have to be adaptable enough to fit as many needs as possible. On the other
hands, very special needs are better addressed in packages in [community
repositories], because the Gluon maintainers would not use or test them and
hands, very special needs are better addressed in [packages] in community
repositories, because the Gluon maintainers would not use or test them and
thus couldn't do their "job" of maintaining them.
To ease the work for the maintainers and to reduce the frustration of
@ -25,10 +25,9 @@ after merging the changes, too.
The preferred way to discuss in the IRC channel ([#gluon] on irc.hackint.org)
or on the [mailing list], however, you can also open a new issue on Github to
discuss there. We maintain a [list of rejected
features](https://github.com/freifunk-gluon/gluon/issues?q=label%3Arejected)
and we'd like to kindly ask you to review it first. In general, looking for
duplicates may save you some time.
discuss there. We maintain a [list of rejected features] and we'd like to
kindly ask you to review it first. In general, looking for duplicates may save
you some time.
Develop on top of master
------------------------
@ -53,7 +52,7 @@ Most changes are trivial enough to fit in one single commit in order to not
clutter the history. While developing a new feature, you are free to use
multiple commits, but if your feature is to be merged, reduce the number of
commits to a minimum. Even huge feature introductions like the 802.11s mesh
(commit 2a93c58) fit into a single commit.
(commit [2a93c58]) fit into a single commit.
If you developed your change in multiple smaller commits, you can easily
[squash] those before opening the pull request. While discussing, it is okay to
@ -62,7 +61,9 @@ the pull request. This way, your change always consists of only one commit and
can be merged in the instant everybody is content with the whole thing.
[community repositories]: http://gluon.readthedocs.org/en/latest/user/site.html#packages
[#gluon]: irc://irc.hackint.org/gluon
[packages]: http://gluon.readthedocs.org/en/latest/user/site.html#packages
[#gluon]: https://webirc.hackint.org/#gluon
[mailing list]: mailto:gluon@luebeck.freifunk.net
[list of rejected features]: https://github.com/freifunk-gluon/gluon/issues?q=label%3Arejected
[2a93c58]: https://github.com/freifunk-gluon/gluon/commit/2a93c580428d10724116b0d2d1238e2745715a14
[squash]: https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Squashing-Commits

View File

@ -4,11 +4,16 @@ LC_ALL:=C
LANG:=C
export LC_ALL LANG
export SHELL:=/usr/bin/env bash
GLUONPATH ?= $(PATH)
export GLUONPATH := $(GLUONPATH)
empty:=
space:= $(empty) $(empty)
GLUONMAKE_EARLY = $(SUBMAKE) -C $(GLUON_ORIGOPENWRTDIR) -f $(GLUONDIR)/Makefile GLUON_TOOLS=0 QUILT=
GLUONMAKE = $(SUBMAKE) -C $(GLUON_OPENWRTDIR) -f $(GLUONDIR)/Makefile
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
ifneq ($(OPENWRT_BUILD),1)
@ -24,12 +29,6 @@ update: FORCE
$(GLUONDIR)/scripts/update.sh
$(GLUONDIR)/scripts/patch.sh
patch: FORCE
$(GLUONDIR)/scripts/patch.sh
unpatch: FORCE
$(GLUONDIR)/scripts/unpatch.sh
update-patches: FORCE
$(GLUONDIR)/scripts/update.sh
$(GLUONDIR)/scripts/update-patches.sh
@ -299,7 +298,8 @@ prepare-target: $(GLUON_OPKG_KEY).pub
$(target_prepared_stamp):
+$(GLUONMAKE_EARLY) prepare-target
maybe-prepare-target: $(GLUON_OPKG_KEY).pub $(target_prepared_stamp)
maybe-prepare-target: $(target_prepared_stamp)
+$(GLUONMAKE_EARLY) $(GLUON_OPKG_KEY).pub
$(BUILD_DIR)/.prepared: Makefile
@mkdir -p $$(dirname $@)

View File

@ -12,11 +12,14 @@ Before opening an issue, make sure to check whether any existing issues
(open or closed) match. If you're suggesting a new feature, drop by on IRC or
our mailinglist to discuss it first.
We maintain a [Roadmap](https://github.com/freifunk-gluon/gluon/wiki/Roadmap) for
the future development of Gluon.
## Use a release!
Please refrain from using the `master` branch for anything else but development purposes!
Use the most recent release instead. You can list all relaseses by running `git branch -a`
and switch to one by running `git checkout v2016.1.2 && make update`.
and switch to one by running `git checkout v2016.1.5 && make update`.
If you're using the autoupdater, do not autoupdate nodes with anything but releases.
If you upgrade using random master commits the nodes *will break* eventually.

View File

@ -47,7 +47,7 @@ master_doc = 'index'
# General information about the project.
project = 'Gluon'
copyright = '2015, Project Gluon'
copyright = '2015-2016, Project Gluon'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the

View File

@ -51,7 +51,7 @@ may be defined arbitrarily.
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/core/initial/001-sysconfig``
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).

View File

@ -70,5 +70,11 @@ These commands can be used on a node:
# Force update check, even when the updater is disabled
autoupdater -f
::
# If fallback is true the updater will perform an update only if
# the timespan given by the priority and another 24h have passed
autoupdater --fallback

View File

@ -51,6 +51,7 @@ Packages
:maxdepth: 1
package/gluon-client-bridge
package/gluon-config-mode-geo-location
package/gluon-ebtables-filter-multicast
package/gluon-ebtables-filter-ra-dhcp
@ -60,6 +61,9 @@ Releases
.. toctree::
:maxdepth: 1
releases/v2016.1.5
releases/v2016.1.4
releases/v2016.1.3
releases/v2016.1.2
releases/v2016.1.1
releases/v2016.1
@ -77,6 +81,16 @@ Supported Devices & Architectures
ar71xx-generic
^^^^^^^^^^^^^^
* 8devices
- Carambola 2
* ALFA Network
- AP121
- AP121U
- Hornet-UB
* Allnet
- ALL0315N
@ -87,6 +101,11 @@ ar71xx-generic
- WZR-HP-G300NH
- WZR-HP-G450H
* Cisco Meraki
- MR12 / MR62
- MR16 / MR66
* D-Link
- DIR-505 (A1)
@ -112,6 +131,18 @@ ar71xx-generic
- Omega
* OpenMesh
- MR1750
- MR600 (v1, v2)
- MR900 (v1, v2)
- OM2P (v1, v2)
- OM2P-HS (v1, v2)
- OM2P-LC
- OM5P
- OM5P-AC (v1, v2)
- OM5P-AN
* TP-Link
- CPE210 (v1.0, v1.1)
@ -140,7 +171,7 @@ ar71xx-generic
- TL-WR741N/ND (v1, v2, v4, v5)
- TL-WR743N/ND (v1, v2)
- TL-WR801N/ND (v1, v2)
- TL-WR841N/ND (v3, v5, v7, v8, v9, v10)
- TL-WR841N/ND (v3, v5, v7, v8, v9, v10, v11)
- TL-WR842N/ND (v1, v2)
- TL-WR843N/ND (v1)
- TL-WR940N (v1, v2, v3)
@ -153,11 +184,13 @@ ar71xx-generic
- Air Gateway
- Air Router
- Bullet M
- Loco M
- Loco M XW
- Nanostation M
- Nanostation M XW
- Loco M XW
- Picostation M
- Rocket M
- Rocket M XW
- UniFi AP
- UniFi AP Pro
- UniFi AP Outdoor

View File

@ -0,0 +1,14 @@
gluon-config-mode-geo-location
==============================
This package enables the user to set latitude, longitude and altitude of their
node within config mode. As the usage of the altitude is not well defined the
corresponding field can be disabled.
site.conf
---------
config_mode.geo_location.show_altitude : optional
- ``true`` enables the altitude field
- ``false`` disables the altitude field if altitude has not yet been set
- defaults to ``true``

View File

@ -0,0 +1,43 @@
Gluon 2016.1.3
==============
Added hardware support
~~~~~~~~~~~~~~~~~~~~~~
ar71xx-generic
^^^^^^^^^^^^^^
* ALFA Hornet UB / AP121 / AP121U
* TP-Link TL-WA7510N
Bugfixes
~~~~~~~~
* The nondeterministic boot hang (`#669 <https://github.com/freifunk-gluon/gluon/issues/669>`_) that was thought to
be fixed in Gluon v2016.1.2 has resurfaced on other hardware. We believe it is now fixed properly.
* Sysupgrades on the Xen DomU have been fixed.
* Gluon can now be built on systems that use LibreSSL instead of OpenSSL.
Known Issues
~~~~~~~~~~~~
* Default TX power on many Ubiquiti devices is too high, correct offsets are unknown (`#94 <https://github.com/freifunk-gluon/gluon/issues/94>`_)
Reducing the TX power in the Expert Mode is recommended.
* The MAC address of the WAN interface is modified even when Mesh-on-WAN is disabled (`#496 <https://github.com/freifunk-gluon/gluon/issues/496>`_)
This may lead to issues in environments where a fixed MAC address is expected (like VMware when promicious mode is disallowed).
* Inconsistent respondd API (`#522 <https://github.com/freifunk-gluon/gluon/issues/522>`_)
The current API is inconsistent and will be replaced eventually. The old API will still be supported for a while.
* Unwritable flash on some Ubiquiti PicoStations (`#687 <https://github.com/freifunk-gluon/gluon/issues/687>`_)
Gluon v2016.1.1 added support for Ubiquiti AirMAX devices with AirOS 5.6.x without downgrading AirOS first before
flashing Gluon. It was discovered that on Ubiquiti PicoStations, this downgrade is still necessary, as the
flash is not correctly unlocked, leaving the device unable to leave Config Mode and making regular sysupgrades
impossible.
TFTP recovery can be used in this state to flash a new firmware.

View File

@ -0,0 +1,46 @@
Gluon 2016.1.4
==============
Added hardware support
~~~~~~~~~~~~~~~~~~~~~~
ar71xx-generic
^^^^^^^^^^^^^^
* 8devices Carambola 2
* Meraki MR12/MR62/MR16/MR66
Bugfixes
~~~~~~~~
* Major update of all WLAN drivers
We've taken the unusual step of updating the WLAN drivers ("wireless-backports") to a much newer version, as
it was reported that the new version fixes unstable WLAN seen in many setups
* Build fix: a race condition causing parallel builds to fail has been fixed
* Build fix: the Gluon tree could get into a state in which all commands fail with "Too many levels of symbolic links"
* Build fix: allow building Gluon on systems with certain versions of *dash* as */bin/sh*
Known Issues
~~~~~~~~~~~~
* Default TX power on many Ubiquiti devices is too high, correct offsets are unknown (`#94 <https://github.com/freifunk-gluon/gluon/issues/94>`_)
Reducing the TX power in the Expert Mode is recommended.
* The MAC address of the WAN interface is modified even when Mesh-on-WAN is disabled (`#496 <https://github.com/freifunk-gluon/gluon/issues/496>`_)
This may lead to issues in environments where a fixed MAC address is expected (like VMware when promicious mode is disallowed).
* Inconsistent respondd API (`#522 <https://github.com/freifunk-gluon/gluon/issues/522>`_)
The current API is inconsistent and will be replaced eventually. The old API will still be supported for a while.
* Unwritable flash on some Ubiquiti PicoStations (`#687 <https://github.com/freifunk-gluon/gluon/issues/687>`_)
Gluon v2016.1.1 added support for Ubiquiti AirMAX devices with AirOS 5.6.x without downgrading AirOS first before
flashing Gluon. It was discovered that on Ubiquiti PicoStations, this downgrade is still necessary, as the
flash is not correctly unlocked, leaving the device unable to leave Config Mode and making regular sysupgrades
impossible.
TFTP recovery can be used in this state to flash a new firmware.

View File

@ -0,0 +1,66 @@
Gluon 2016.1.5
==============
Added hardware support
~~~~~~~~~~~~~~~~~~~~~~
ar71xx-generic
^^^^^^^^^^^^^^
* OpenMesh
- MR600 (v1, v2)
- MR900 (v1, v2)
- OM2P (v1, v2)
- OM2P-HS (v1, v2)
- OM2P-LC
- OM5P
- OM5P-AN
* Ubiquiti
- Rocket M XW
* TP-LINK
- TL-WR841N/ND v11
Bugfixes
~~~~~~~~
* build: fix race condition caused by using certain make targets (like *clean*, *images* or *package/\**)
with parallel build options without doing a full build before
* build: fix package dependency issue causing "recursive dependency" warning
This dependency issue could lead to broken configurations and reportedly caused failed builds in some cases
when additional (site-specific) packages were used.
* build: Gluon will now build correctly with GCC 6 as host compiler
* Fix configuration of batman-adv when VLANs are used on top of IBSS interfaces (regression due to netifd update in :doc:`v2016.1.4`)
* Add back missing ath10k firmware (regression due to mac80211 update in :doc:`v2016.1.4`)
* Gluon can now be used on all supported Ubiquiti AirMAX devices without downgrading to AirOS 5.5.x before
:doc:`v2016.1.1` added support for most Ubiquiti AirMAX devices with AirOS 5.6.x without downgrading AirOS,
but left some devices (at least some PicoStations and Bullets) with unwritable flash. This issue has been
resolved (`#687 <https://github.com/freifunk-gluon/gluon/issues/687>`_).
* Add upgrade script to automatically remove whitespace from configured geolocation
The new respondd implementation included in :doc:`v2016.1` is stricter about the number format than the
old one and doesn't accept trailing whitespace (so one or both coordinates are missing from the output).
The Config Mode has been fixed to strip whitespace from numeric fields in new configurations since :doc:`v2016.1.1`.
This still left old configurations, which are now fixed by this script.
Known Issues
~~~~~~~~~~~~
* Default TX power on many Ubiquiti devices is too high, correct offsets are unknown (`#94 <https://github.com/freifunk-gluon/gluon/issues/94>`_)
Reducing the TX power in the Expert Mode is recommended.
* The MAC address of the WAN interface is modified even when Mesh-on-WAN is disabled (`#496 <https://github.com/freifunk-gluon/gluon/issues/496>`_)
This may lead to issues in environments where a fixed MAC address is expected (like VMware when promicious mode is disallowed).
* Inconsistent respondd API (`#522 <https://github.com/freifunk-gluon/gluon/issues/522>`_)
The current API is inconsistent and will be replaced eventually. The old API will still be supported for a while.

View File

@ -183,4 +183,11 @@
-- setup_mode = {
-- skip = true,
-- },
-- Show/hide the altitude field
-- config_mode = {
-- geo_location = {
-- show_altitude = false,
-- },
-- },
}

View File

@ -1,3 +1,17 @@
Frequently Asked Questions
==========================
.. _faq-dns:
DNS does not work on the nodes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Gluon nodes will ignore the DNS server on the WAN port for everything except
the mesh VPN, which can lead to confusion.
All normal services on the nodes exclusively use the DNS server on the mesh
interface. This DNS server must be announced in router advertisements (using
*radvd* or a similar software) from one or more central servers in meshes based
on *batman-adv*. If your mesh does not have global IPv6 connectivity, you can setup
your *radvd* not to announce a default route by setting the *default lifetime* to 0;
in this case, the *radvd* is only used to announce the DNS server.

View File

@ -8,7 +8,7 @@ Gluon's releases are managed using `Git tags`_. If you are just getting
started with Gluon we recommend to use the latest stable release of Gluon.
Take a look at the `list of gluon releases`_ and notice the latest release,
e.g. *v2016.1.2*. Always get Gluon using git and don't try to download it
e.g. *v2016.1.5*. Always get Gluon using git and don't try to download it
as a Zip archive as the archive will be missing version information.
Please keep in mind that there is no "default Gluon" build; a site configuration
@ -42,7 +42,7 @@ Building the images
-------------------
To build Gluon, first check out the repository. Replace *RELEASE* with the
version you'd like to checkout, e.g. *v2016.1.2*.
version you'd like to checkout, e.g. *v2016.1.5*.
::
@ -130,7 +130,7 @@ not support IPv6.
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 repositoy containing all kernel modules provided by OpenWrt/Gluon
but also an opkg repository containing all kernel modules provided by OpenWrt/Gluon
for the kernel of the generated images.
Signing keys

View File

@ -44,9 +44,12 @@ ntp_server
List of NTP servers available in your community or used by your community, e.g.:
::
ntp_servers = {'1.ntp.services.ffeh','2.tnp.services.ffeh'}
ntp_servers = {'1.ntp.services.ffeh','2.ntp.services.ffeh'}
opkg : optional
This NTP servers must be reachable via IPv6 from the nodes. If you don't want to set an IPv6 address
explicitly, but use a hostname (which is recommended), see also the :ref:`FAQ <faq-dns>`.
opkg \: optional
``opkg`` package manager configuration.
There are two optional fields in the ``opkg`` section:
@ -72,7 +75,7 @@ opkg : optional
- ``%GV`` is replaced by the Gluon version
- ``%GR`` is replaced by the Gluon release (as specified in ``site.mk``)
regdom : optional
regdom \: optional
The wireless regulatory domain responsible for your area, e.g.:
::
@ -80,7 +83,7 @@ regdom : optional
Setting ``regdom`` in mandatory if ``wifi24`` or ``wifi5`` is defined.
wifi24 : optional
wifi24 \: optional
WLAN configuration for 2.4 GHz devices.
``channel`` must be set to a valid wireless channel for your radio.
@ -123,10 +126,10 @@ wifi24 : optional
},
},
wifi5 : optional
wifi5 \: optional
Same as `wifi24` but for the 5Ghz radio.
next_node : package
next_node \: package
Configuration of the local node feature of Gluon
::
@ -136,7 +139,7 @@ next_node : package
mac = 'ca:ff:ee:ba:be:00'
}
mesh : optional
mesh \: optional
Options specific to routing protocols.
At the moment, only the ``batman_adv`` routing protocol has such options:
@ -220,13 +223,13 @@ fastd_mesh_vpn
},
}
mesh_on_wan : optional
mesh_on_wan \: optional
Enables the mesh on the WAN port (``true`` or ``false``).
mesh_on_lan : optional
mesh_on_lan \: optional
Enables the mesh on the LAN port (``true`` or ``false``).
autoupdater : package
autoupdater \: package
Configuration for the autoupdater feature of Gluon.
::
@ -249,7 +252,10 @@ autoupdater : package
}
}
roles : optional
All configured mirrors must be reachable from the nodes via IPv6. If you don't want to set an IPv6 address
explicitly, but use a hostname (which is recommended), see also the :ref:`FAQ <faq-dns>`.
roles \: optional
Optional role definitions. Nodes will announce their role inside the mesh.
This will allow in the backend to distinguish between normal, backbone and
service nodes or even gateways (if they advertise that role). It is up to
@ -273,7 +279,7 @@ roles : optional
},
},
setup_mode : package
setup_mode \: package
Allows skipping setup mode (config mode) at first boot when attribute
``skip`` is set to ``true``. This is optional and may be left out.
::
@ -282,7 +288,7 @@ setup_mode : package
skip = true,
},
legacy : package
legacy \: package
Configuration for the legacy upgrade path.
This is only required in communities upgrading from Lübeck's LFF-0.3.x.
::
@ -393,15 +399,16 @@ This is a non-exhaustive list of site-repos from various communities:
* `site-ffda <https://github.com/freifunk-darmstadt/site-ffda>`_ (Darmstadt)
* `site-ffgoe <https://github.com/freifunk-goettingen/site-ffgoe>`_ (Göttingen)
* `site-ffhh <https://github.com/freifunkhamburg/site-ffhh>`_ (Hamburg)
* `site-ffho <https://git.c3pb.de/freifunk-pb/site-ffho>`_ (Hochstift)
* `site-ffhgw <https://github.com/lorenzo-greifswald/site-ffhgw>`_ (Greifswald)
* `site-ffl <https://github.com/freifunk-leipzig/freifunk-gluon-leipzig>`_ (Leipzig)
* `site-ffhl <https://github.com/freifunk-luebeck/site-ffhl>`_ (Lübeck)
* `site-ffmd <https://github.com/FreifunkMD/site-ffmd>`_ (Magdeburg)
* `site-ffmwu <https://github.com/freifunk-mwu/site-ffmwu>`_ (Mainz, Wiesbaden & Umgebung)
* `site-ffmyk <https://github.com/FreifunkMYK/site-ffmyk>`_ (Mayen-Koblenz)
* `site-ffm <https://github.com/freifunkMUC/site-ffm>`_ (München)
* `site-ffms <https://github.com/FreiFunkMuenster/site-ffms>`_ (Münsterland)
* `site-ffnw <https://git.nordwest.freifunk.net/ffnw/siteconf/tree/master>`_ (Nordwest)
* `site-ffpb <https://git.c3pb.de/freifunk-pb/site-ffpb>`_ (Paderborn)
* `site-ffnw <https://git.nordwest.freifunk.net/ffnw-firmware/siteconf/tree/master>`_ (Nordwest)
* `site-ffka <https://github.com/ffka/site-ffka>`_ (Karlsruhe)
* `site-ffrl <https://github.com/ffrl/sites-ffrl>`_ (Rheinland)
* `site-ffrg <https://github.com/ffruhr/site-ffruhr>`_ (Ruhrgebiet)

View File

@ -1,14 +1,14 @@
GLUON_FEEDS='openwrt gluon routing luci'
OPENWRT_REPO=git://git.openwrt.org/15.05/openwrt.git
OPENWRT_COMMIT=efc26cc8e0513b3ec703ba540a554fde2c717cf6
OPENWRT_COMMIT=eadf19c0b43d2f75f196ea8d875a08c7c348530c
PACKAGES_OPENWRT_REPO=git://github.com/openwrt/packages.git
PACKAGES_OPENWRT_COMMIT=9622fe984bba3a4547f48bc507ebaba7637eb2b0
PACKAGES_OPENWRT_BRANCH=for-15.05
PACKAGES_GLUON_REPO=git://github.com/freifunk-gluon/packages.git
PACKAGES_GLUON_COMMIT=fea8f67d5d5cccac39b5020a69106f8665d41e58
PACKAGES_GLUON_COMMIT=63376e23c81e53c21d3c5250c3fb7444a90dc019
PACKAGES_ROUTING_REPO=git://github.com/openwrt-routing/packages.git
PACKAGES_ROUTING_COMMIT=2a8338559de5c4b077cde7a83f43f4700a17d5cc

View File

@ -16,4 +16,3 @@ c:section('alfred', 'alfred', 'alfred',
)
c:save('alfred')
c:commit('alfred')

View File

@ -40,7 +40,6 @@ end
c:set('autoupdater', 'settings', 'version_file', '/lib/gluon/release')
c:save('autoupdater')
c:commit('autoupdater')
local autoupdater_util = require 'autoupdater.util'

View File

@ -24,4 +24,3 @@ end
uci:set('network', 'client', 'macaddr', sysconfig.primary_mac)
uci:save('network')
uci:commit('network')

View File

@ -21,14 +21,16 @@ local function configure_client(config, radio, index, suffix)
uci:delete('wireless', name)
if config then
macaddr = util.generate_mac(3*(index-1))
if config and macaddr then
uci:section('wireless', 'wifi-iface', name,
{
device = radio,
network = 'client',
mode = 'ap',
ssid = config.ssid,
macaddr = util.generate_mac(2, index),
macaddr = macaddr,
ifname = suffix and 'client' .. suffix,
disabled = disabled,
}
@ -45,4 +47,3 @@ end
util.iterate_radios(configure_radio)
uci:save('wireless')
uci:commit('wireless')

View File

@ -48,43 +48,42 @@ function action_reboot()
uci:save("gluon-setup-mode")
uci:commit("gluon-setup-mode")
if nixio.fork() ~= 0 then
local fs = require "nixio.fs"
local util = require "nixio.util"
local fs = require "nixio.fs"
local util = require "nixio.util"
local parts_dir = "/lib/gluon/config-mode/reboot/"
local files = util.consume(fs.dir(parts_dir))
local parts_dir = "/lib/gluon/config-mode/reboot/"
local files = util.consume(fs.dir(parts_dir))
table.sort(files)
table.sort(files)
local parts = {}
local parts = {}
for _, entry in ipairs(files) do
if entry:sub(1, 1) ~= '.' then
local f = dofile(parts_dir .. '/' .. entry)
if f ~= nil then
table.insert(parts, f)
end
for _, entry in ipairs(files) do
if entry:sub(1, 1) ~= '.' then
local f = dofile(parts_dir .. '/' .. entry)
if f ~= nil then
table.insert(parts, f)
end
end
end
local hostname = uci:get_first("system", "system", "hostname")
local hostname = uci:get_first("system", "system", "hostname")
luci.template.render("gluon/config-mode/reboot", { parts=parts
, hostname=hostname
})
else
debug.setfenv(io.stdout, debug.getfenv(io.open '/dev/null'))
io.stdout:close()
luci.template.render("gluon/config-mode/reboot",
{
parts = parts,
hostname = hostname,
}
)
if nixio.fork() == 0 then
-- Replace stdout with /dev/null
nixio.dup(nixio.open('/dev/null', 'w'), nixio.stdout)
-- Sleep a little so the browser can fetch everything required to
-- display the reboot page, then reboot the device.
nixio.nanosleep(2)
nixio.nanosleep(1)
-- Run reboot with popen so it gets its own std filehandles.
io.popen("reboot")
-- Prevent any further execution in this child.
os.exit()
nixio.execp("reboot")
end
end

View File

@ -33,4 +33,9 @@ define Package/gluon-config-mode-geo-location/install
$(call GluonInstallI18N,gluon-config-mode-geo-location,$(1))
endef
define Package/gluon-config-mode-geo-location/postinst
#!/bin/sh
$(call GluonCheckSite,check_site.lua)
endef
$(eval $(call BuildPackage,gluon-config-mode-geo-location))

View File

@ -0,0 +1,3 @@
if need_table('config_mode', nil, false) and need_table('config_mode.geo_location', nil, false) then
need_boolean('config_mode.geo_location.show_altitude', false)
end

View File

@ -1,14 +1,28 @@
local cbi = require "luci.cbi"
local i18n = require "luci.i18n"
local uci = luci.model.uci.cursor()
local site = require 'gluon.site_config'
local M = {}
local function show_altitude()
if ((site.config_mode or {}).geo_location or {}).show_altitude ~= false then
return true
end
if uci:get_first("gluon-node-info", "location", "altitude") then
return true
end
return false
end
function M.section(form)
local s = form:section(cbi.SimpleSection, nil, i18n.translate(
'If you want the location of your node to be displayed on the map, '
.. 'you can enter its coordinates here. Specifying the altitude '
.. 'is optional and should only be done if a proper value is known.'))
local text = i18n.translate('If you want the location of your node to '
.. 'be displayed on the map, you can enter its coordinates here.')
if show_altitude() then
text = text .. ' ' .. i18n.translate('Specifying the altitude is '
.. 'optional and should only be done if a proper value is known.')
end
local s = form:section(cbi.SimpleSection, nil, text)
local o
@ -31,12 +45,14 @@ function M.section(form)
o.datatype = "float"
o.description = i18n.translatef("e.g. %s", "10.689901")
o = s:option(cbi.Value, "_altitude", i18n.translate("Altitude"))
o.default = uci:get_first("gluon-node-info", "location", "altitude")
o:depends("_location", "1")
o.rmempty = true
o.datatype = "float"
o.description = i18n.translatef("e.g. %s", "11.51")
if show_altitude() then
o = s:option(cbi.Value, "_altitude", i18n.translate("Altitude"))
o.default = uci:get_first("gluon-node-info", "location", "altitude")
o:depends("_location", "1")
o.rmempty = true
o.datatype = "float"
o.description = i18n.translatef("e.g. %s", "11.51")
end
end

View File

@ -12,13 +12,17 @@ msgstr ""
msgid ""
"If you want the location of your node to be displayed on the map, you can "
"enter its coordinates here. Specifying the altitude is optional and should "
"only be done if a proper value is known."
"enter its coordinates here."
msgstr ""
"Um deinen Knoten auf der Karte anzeigen zu können, benötigen wir seine "
"Koordinaten. Hier hast du die Möglichkeit, diese zu hinterlegen. Die "
"Höhenangabe ist optional und sollte nur gesetzt werden, wenn ein exakter "
"Wert bekannt ist."
"Koordinaten. Hier hast du die Möglichkeit, diese zu hinterlegen."
msgid ""
"Specifying the altitude is optional and should only be done if a proper "
"value is known."
msgstr ""
"Die Höhenangabe ist optional und sollte nur gesetzt werden, wenn ein "
"exakter Wert bekannt ist."
msgid "Latitude"
msgstr "Breitengrad"

View File

@ -12,12 +12,17 @@ msgstr ""
msgid ""
"If you want the location of your node to be displayed on the map, you can "
"enter its coordinates here. Specifying the altitude is optional and should "
"only be done if a proper value is known."
"enter its coordinates here."
msgstr ""
"Pour Afficher votre nœud sur la Carte nous avons besoin de ses coordonnées. "
"Ici vous pouvez entrer sa position. La altitude est optionelle "
"et ne devrait que être ajoutée si la valeur exacte est connue. "
"Ici vous pouvez entrer sa position."
msgid ""
"Specifying the altitude is optional and should only be done if a proper "
"value is known."
msgstr ""
"La altitude est optionelle et ne devrait que être ajoutée si la valeur "
"exacte est connue."
msgid "Latitude"
msgstr "Latitude"

View File

@ -3,8 +3,12 @@ msgstr "Content-Type: text/plain; charset=UTF-8"
msgid ""
"If you want the location of your node to be displayed on the map, you can "
"enter its coordinates here. Specifying the altitude is optional and should "
"only be done if a proper value is known."
"enter its coordinates here."
msgstr ""
msgid ""
"Specifying the altitude is optional and should only be done if a proper "
"value is known."
msgstr ""
msgid "Latitude"

View File

@ -11,6 +11,7 @@ else
local pubkey = util.trim(util.exec("/etc/init.d/fastd show_key " .. "mesh_vpn"))
local hostname = uci:get_first("system", "system", "hostname")
local contact = uci:get_first("gluon-node-info", "owner", "contact")
local msg = i18n.translate('gluon-config-mode:pubkey')
@ -19,6 +20,7 @@ else
, hostname=hostname
, site=site
, sysconfig=sysconfig
, contact=contact
})
end
end

View File

@ -56,7 +56,7 @@ function M.handle(data)
uci:set("simple-tc", "mesh_vpn", "limit_egress", data._limit_egress:trim())
end
uci:commit("simple-tc")
uci:save("simple-tc")
uci:commit("simple-tc")
end
end

View File

@ -12,7 +12,7 @@ define Package/gluon-core
SECTION:=gluon
CATEGORY:=Gluon
TITLE:=Base files of Gluon
DEPENDS:=+gluon-site +libgluonutil +lua-platform-info +luci-base +luci-lib-jsonc +odhcp6c +firewall
DEPENDS:=+gluon-site +libgluonutil +lua-platform-info +lua-hash +luci-base +luci-lib-jsonc +odhcp6c +firewall
endef

View File

@ -24,7 +24,15 @@ end
if platform.match('ar71xx', 'generic', {'tl-wdr3600', 'tl-wdr4300'}) then
table.insert(try_files, 1, '/sys/class/ieee80211/phy1/macaddress')
elseif platform.match('ar71xx', 'generic', {'unifi-outdoor-plus'}) then
elseif platform.match('ar71xx', 'generic', {'unifi-outdoor-plus', 'carambola2',
'mr600', 'mr600v2',
'mr900', 'mr900v2',
'mr1750',
'om2p', 'om2pv2',
'om2p-hs', 'om2p-hsv2',
'om2p-lc',
'om5p', 'om5p-an',
'om5p-ac', 'om5p-acv2'}) then
table.insert(try_files, 1, '/sys/class/net/eth0/address')
elseif platform.match('ar71xx', 'generic', {'archer-c5', 'archer-c7'}) then
table.insert(try_files, 1, '/sys/class/net/eth1/address')

View File

@ -16,7 +16,7 @@ if not (sysconfig.lan_ifname or sysconfig.wan_ifname) then
local lan_ifname = uci:get('network', 'lan', 'ifname')
local wan_ifname = uci:get('network', 'wan', 'ifname')
if platform.match('ar71xx', 'generic', {'cpe510', 'nanostation-m', 'nanostation-m-xw', 'unifi-outdoor-plus'}) then
if platform.match('ar71xx', 'generic', {'cpe510', 'nanostation-m', 'nanostation-m-xw', 'unifi-outdoor-plus', 'uap-pro', 'unifiac-pro'}) then
lan_ifname, wan_ifname = wan_ifname, lan_ifname
end
@ -32,5 +32,4 @@ if not (sysconfig.lan_ifname or sysconfig.wan_ifname) then
uci:delete('network', 'wan')
uci:save('network')
uci:commit('network')
end

View File

@ -14,5 +14,4 @@ if not sysconfig.gluon_version then
uci:set('system', system, 'timezone', site.timezone)
uci:save('system')
uci:commit('system')
end

View File

@ -53,7 +53,31 @@ uci:section('network', 'route6', 'wan6_unreachable',
)
uci:save('network')
uci:commit('network')
uci:section('firewall', 'rule', 'wan_igmp',
{
name = 'Allow-IGMP',
src = 'wan',
proto = 'igmp',
family = 'ipv4',
target = 'ACCEPT',
}
)
uci:section('firewall', 'rule', 'wan_mld',
{
name = 'Allow-MLD',
src = 'wan',
proto = 'icmp',
src_ip = 'fe80::/10',
icmp_type = { '130/0', '131/0', '132/0', '143/0', },
family = 'ipv6',
target = 'ACCEPT',
}
)
uci:save('firewall')
sysctl.set('net.ipv6.conf.all.accept_ra', 0)

View File

@ -11,4 +11,3 @@ local c = uci.cursor()
c:delete('system', 'ntp', 'server')
c:set_list('system', 'ntp', 'server', site.ntp_servers)
c:save('system')
c:commit('system')

View File

@ -27,4 +27,3 @@ c:section('firewall', 'rule', 'wan_ssh',
)
c:save('firewall')
c:commit('firewall')

View File

@ -33,4 +33,3 @@ end
util.iterate_radios(configure_radio)
uci:save('wireless')
uci:commit('wireless')

View File

@ -0,0 +1,3 @@
#!/bin/sh
exec uci commit

View File

@ -7,7 +7,7 @@ local function get_site_config()
local file = assert(io.open(config))
local decoder = json.new()
ltn12.pump.all(ltn12.source.file(io.open(config)), decoder:sink())
ltn12.pump.all(ltn12.source.file(file), decoder:sink())
file:close()

View File

@ -30,6 +30,7 @@ local ipairs = ipairs
local table = table
local nixio = require 'nixio'
local hash = require 'hash'
local sysconfig = require 'gluon.sysconfig'
local site = require 'gluon.site_config'
local uci = require('luci.model.uci').cursor()
@ -71,22 +72,37 @@ function node_id()
end
-- Generates a (hopefully) unique MAC address
-- The first parameter defines the function and the second
-- parameter an ID to add to the MAC address
-- Functions and IDs defined so far:
-- (1, 0): WAN (for mesh-on-WAN)
-- (1, 1): LAN (for mesh-on-LAN)
-- (2, n): client interface for the n'th radio
-- (3, n): adhoc interface for n'th radio
-- (4, 0): mesh VPN
-- (5, n): mesh interface for n'th radio (802.11s)
function generate_mac(f, i)
local m1, m2, m3, m4, m5, m6 = string.match(sysconfig.primary_mac, '(%x%x):(%x%x):(%x%x):(%x%x):(%x%x):(%x%x)')
m1 = nixio.bit.bor(tonumber(m1, 16), 0x02)
m2 = (tonumber(m2, 16)+f) % 0x100
m3 = (tonumber(m3, 16)+i) % 0x100
-- The parameter defines the ID to add to the mac addr
--
-- IDs defined so far:
-- 0: client0; mesh-vpn
-- 1: mesh0
-- 2: ibss0
-- 3: client1; mesh-on-wan
-- 4: mesh1
-- 5: ibss1
-- 6: mesh-on-lan
-- 7: unused
function generate_mac(i)
if i > 7 or i < 0 then return nil end -- max allowed id (0b111)
return string.format('%02x:%02x:%02x:%s:%s:%s', m1, m2, m3, m4, m5, m6)
local hashed = string.sub(hash.md5(sysconfig.primary_mac), 0, 12)
local m1, m2, m3, m4, m5, m6 = string.match(hashed, '(%x%x)(%x%x)(%x%x)(%x%x)(%x%x)(%x%x)')
m1 = tonumber(m1, 16)
m6 = tonumber(m6, 16)
m1 = nixio.bit.bor(m1, 0x02) -- set locally administered bit
m1 = nixio.bit.band(m1, 0xFE) -- unset the multicast bit
-- It's necessary that the first 45 bits of the mac do
-- not vary on a single hardware interface, since some chips are using
-- a hardware mac filter. (e.g 'ramips-rt305x')
m6 = nixio.bit.band(m6, 0xF8) -- zero the last three bits (space needed for counting)
m6 = m6 + i -- add virtual interface id
return string.format('%02x:%s:%s:%s:%s:%02x', m1, m2, m3, m4, m5, m6)
end
-- Iterate over all radios defined in UCI calling

View File

@ -34,7 +34,6 @@ if sysconfig.gluon_version == 'legacy' then
uci:delete('network', 'wan')
uci:save('network')
uci:commit('network')
end

View File

@ -20,5 +20,4 @@ if sysconfig.gluon_version == 'legacy' then
uci:delete_all('wireless', 'wifi-iface', delete_legacy_iface)
uci:save('wireless')
uci:commit('wireless')
end

View File

@ -12,9 +12,7 @@ if sysconfig.gluon_version == 'legacy' then
if old == '1' then
local setup_mode = uci:get_first('gluon-setup-mode', 'setup_mode')
uci:set('gluon-setup-mode', setup_mode, 'configured', '1')
uci:save('gluon-setup-mode')
uci:commit('gluon-setup-mode')
break
end

View File

@ -21,7 +21,6 @@ if sysconfig.gluon_version == 'legacy' then
)
uci:save('simple-tc')
uci:commit('simple-tc')
break
end

View File

@ -33,5 +33,4 @@ if sysconfig.gluon_version == 'legacy' then
end
uci:save('fastd')
uci:commit('fastd')
end

View File

@ -101,9 +101,7 @@ end
function image_supported(tmpfile)
-- XXX: yay...
return ( 0 == os.execute(
". /lib/functions.sh; " ..
"include /lib/upgrade; " ..
"platform_check_image %q >/dev/null"
"/sbin/sysupgrade -T %q >/dev/null"
% tmpfile
) )
end

View File

@ -45,4 +45,3 @@ end
uci:save('network')
uci:commit('network')

View File

@ -45,4 +45,3 @@ end
uci:save('network')
uci:commit('network')

View File

@ -5,7 +5,6 @@ local uci = require('luci.model.uci').cursor()
-- fix up duplicate mac addresses (for mesh-on-WAN)
uci:set('network', 'wan', 'macaddr', util.generate_mac(1, 0))
uci:set('network', 'wan', 'macaddr', util.generate_mac(3))
uci:save('network')
uci:commit('network')

View File

@ -24,7 +24,6 @@ uci:section('batman-adv', 'mesh', 'bat0',
}
)
uci:save('batman-adv')
uci:commit('batman-adv')
if not uci:get('network', 'client', 'ifname') then
uci:add_to_set('network', 'client', 'ifname', 'bat0')
@ -39,6 +38,9 @@ end
uci:set('network', 'client', 'proto', 'dhcpv6')
uci:set('network', 'client', 'reqprefix', 'no')
uci:set('network', 'client', 'igmp_snooping', 0)
uci:set('network', 'client', 'robustness', 3)
uci:set('network', 'client', 'query_interval', 2000)
uci:set('network', 'client', 'query_response_interval', 500)
uci:set('network', 'client', 'peerdns', 1)
uci:set('network', 'client', 'sourcefilter', 0)
@ -48,11 +50,11 @@ uci:section('network', 'interface', 'bat0',
ifname = 'bat0',
proto = 'none',
macaddr = sysconfig.primary_mac,
multicast_router = 2,
}
)
uci:save('network')
uci:commit('network')
uci:delete('firewall', 'client')
@ -76,7 +78,6 @@ uci:section('firewall', 'rule', 'client_dns',
)
uci:save('firewall')
uci:commit('firewall')
local dnsmasq = uci:get_first('dhcp', 'dnsmasq')
@ -93,7 +94,6 @@ uci:section('dhcp', 'dhcp', 'client',
)
uci:save('dhcp')
uci:commit('dhcp')
sysctl.set('net.ipv6.conf.br-client.forwarding', 0)

View File

@ -29,7 +29,9 @@ local function configure_ibss(config, radio, index, suffix, disabled)
uci:delete('network', name .. '_vlan')
uci:delete('wireless', name)
if config then
macaddr = util.generate_mac(3*(index-1)+2)
if config and macaddr then
if config.vlan then
uci:section('network', 'interface', name,
{
@ -60,7 +62,7 @@ local function configure_ibss(config, radio, index, suffix, disabled)
mode = 'adhoc',
ssid = config.ssid,
bssid = config.bssid,
macaddr = util.generate_mac(3, index),
macaddr = macaddr,
mcast_rate = config.mcast_rate,
ifname = suffix and 'ibss' .. suffix,
disabled = disabled and 1 or 0,
@ -77,7 +79,9 @@ local function configure_mesh(config, radio, index, suffix, disabled)
uci:delete('network', name)
uci:delete('wireless', name)
if config then
macaddr = util.generate_mac(3*(index-1)+1)
if config and macaddr then
uci:section('network', 'interface', name,
{
proto = 'batadv',
@ -92,7 +96,7 @@ local function configure_mesh(config, radio, index, suffix, disabled)
mode = 'mesh',
mesh_id = config.id,
mesh_fwding = 0,
macaddr = util.generate_mac(5, index),
macaddr = macaddr,
mcast_rate = config.mcast_rate,
ifname = suffix and 'mesh' .. suffix,
disabled = disabled and 1 or 0,
@ -131,5 +135,3 @@ util.iterate_radios(configure_radio)
uci:save('wireless')
uci:save('network')
uci:commit('wireless')
uci:commit('network')

View File

@ -16,4 +16,3 @@ if not c:get('network', 'mesh_wan') then
end
c:save('network')
c:commit('network')

View File

@ -7,7 +7,21 @@ local sysconfig = require 'gluon.sysconfig'
local uci = require('luci.model.uci').cursor()
local lutil = require 'luci.util'
if sysconfig.lan_ifname and not uci:get('network', 'mesh_lan') then
if not sysconfig.lan_ifname then
os.exit(0)
end
uci:section('network', 'interface', 'mesh_lan', {
ifname = sysconfig.lan_ifname,
type = 'bridge',
igmp_snooping = 0,
proto = 'batadv',
mesh = 'bat0',
mesh_no_rebroadcast = '1',
macaddr = util.generate_mac(6),
})
if uci:get('network', 'mesh_lan', 'auto') == nil then
local enable = site.mesh_on_lan
if enable then
@ -15,23 +29,15 @@ if sysconfig.lan_ifname and not uci:get('network', 'mesh_lan') then
if interfaces then
for _, lanif in ipairs(lutil.split(sysconfig.lan_ifname, ' ')) do
if lutil.contains(interfaces, lanif) then
enable = false
break
if lutil.contains(interfaces, lanif) then
enable = false
break
end
end
end
end
uci:section('network', 'interface', 'mesh_lan',
{ ifname = sysconfig.lan_ifname
, proto = 'batadv'
, mesh = 'bat0'
, mesh_no_rebroadcast = '1'
, macaddr = util.generate_mac(1, 1)
, auto = enable and 1 or 0
})
uci:save('network')
uci:commit('network')
uci:set('network', 'mesh_lan', 'auto', enable and 1 or 0)
end
uci:save('network')

View File

@ -3,8 +3,11 @@
local uci = require('luci.model.uci').cursor()
if uci:get('system', 'rssid_wlan0') then
uci:set('system', 'rssid_wlan0', 'dev', 'mesh0')
if uci:get('wireless', 'mesh_radio0') then
uci:set('system', 'rssid_wlan0', 'dev', 'mesh0')
else
uci:set('system', 'rssid_wlan0', 'dev', 'ibss0')
end
uci:save('system')
uci:commit('system')
end

View File

@ -1,15 +0,0 @@
local nixio = require 'nixio'
module 'gluon.batman_adv'
function interfaces(bat_if)
local iter = nixio.fs.glob('/sys/class/net/' .. bat_if .. '/lower_*')
return function()
local path = iter()
if path == nil then
return nil
end
local ifname = path:match('/lower_([^/]+)$')
return ifname
end
end

View File

@ -501,7 +501,9 @@ static struct json_object * get_batadv(void) {
struct json_object *obj = json_object_new_object();
json_object_object_add(obj, "tq", json_object_new_int(tq));
json_object_object_add(obj, "lastseen", json_object_new_double(lastseen));
struct json_object *jso = json_object_new_double(lastseen);
json_object_set_serializer(jso, json_object_double_to_json_string, "%.3f", NULL);
json_object_object_add(obj, "lastseen", jso);
json_object_object_add(interface, mac1, obj);
}

View File

@ -12,7 +12,7 @@ define Package/gluon-mesh-vpn-fastd
SECTION:=gluon
CATEGORY:=Gluon
TITLE:=Support for connecting batman-adv meshes via fastd
DEPENDS:=+gluon-core +libgluonutil gluon-mesh-batman-adv +gluon-wan-dnsmasq +fastd +iptables-mod-extra +simple-tc
DEPENDS:=+gluon-core +libgluonutil gluon-mesh-batman-adv +gluon-wan-dnsmasq +fastd +iptables +iptables-mod-extra +simple-tc
endef
define Build/Prepare

View File

@ -119,7 +119,6 @@ add_groups('mesh_vpn', site.fastd_mesh_vpn.groups)
uci:save('fastd')
uci:commit('fastd')
uci:section('network', 'interface', 'mesh_vpn',
@ -128,12 +127,11 @@ uci:section('network', 'interface', 'mesh_vpn',
proto = 'batadv',
mesh = 'bat0',
mesh_no_rebroadcast = 1,
macaddr = util.generate_mac(4, 0),
macaddr = util.generate_mac(0),
}
)
uci:save('network')
uci:commit('network')
uci:section('firewall', 'include', 'mesh_vpn_dns',
@ -145,4 +143,3 @@ uci:section('firewall', 'include', 'mesh_vpn_dns',
)
uci:save('firewall')
uci:commit('firewall')

View File

@ -9,5 +9,4 @@ local secret = c:get("fastd", "mesh_vpn", "secret")
if not secret or not secret:match(("%x"):rep(64)) then
c:set("fastd", "mesh_vpn", "secret", "generate")
c:save("fastd")
c:commit("fastd")
end

View File

@ -28,5 +28,4 @@ if not uci:get('simple-tc', 'mesh_vpn') then
uci:section('simple-tc', 'interface', 'mesh_vpn', config)
uci:save('simple-tc')
uci:commit('simple-tc')
end

View File

@ -192,7 +192,9 @@ static bool get_peer_connection(struct json_object **ret, struct json_object *co
int64_t established_time = json_object_get_int64(established);
*ret = json_object_new_object();
json_object_object_add(*ret, "established", json_object_new_double(established_time/1000.0));
struct json_object *jso = json_object_new_double(established_time/1000.0);
json_object_set_serializer(jso, json_object_double_to_json_string, "%.3f", NULL);
json_object_object_add(*ret, "established", jso);
}
else {
*ret = NULL;

View File

@ -17,4 +17,3 @@ uci:section('firewall', 'rule', 'wan_respondd_reply',
)
uci:save('firewall')
uci:commit('firewall')

View File

@ -39,7 +39,6 @@ c:section('network', 'route6', 'local_node_route6',
)
c:save('network')
c:commit('network')
c:delete('firewall', 'local_node')
c:section('firewall', 'zone', 'local_node',
@ -52,4 +51,3 @@ c:section('firewall', 'zone', 'local_node',
}
)
c:save('firewall')
c:commit('firewall')

View File

@ -7,5 +7,4 @@ local config = 'gluon-node-info'
if not uci:get_first(config, 'system') then
uci:section(config, 'system')
uci:save(config)
uci:commit(config)
end

View File

@ -15,5 +15,4 @@ end
if not role then
uci:set(config, uci:get_first(config, 'system'), 'role', default_role)
uci:save(config)
uci:commit(config)
end

View File

@ -0,0 +1,14 @@
#!/usr/bin/lua
local uci = require('luci.model.uci').cursor()
local sname = uci:get_first('gluon-node-info', 'location')
if sname then
local options = {'longitude', 'latitude', 'altitude'}
for _, option in ipairs(options) do
local value = uci:get('gluon-node-info', sname, option)
if value then
uci:set('gluon-node-info', sname, option, value:trim())
end
end
uci:save('gluon-node-info')
end

View File

@ -64,7 +64,15 @@ static struct json_object * get_number(struct uci_context *ctx, struct uci_secti
if (*end)
return NULL;
return json_object_new_double(d);
struct json_object *jso = json_object_new_double(d);
json_object_set_serializer(jso, json_object_double_to_json_string, "%.8f", NULL);
return jso;
}
static void maybe_add_number(struct uci_context *ctx, struct uci_section *s, const char *name, struct json_object *parent) {
struct json_object *jso = get_number(ctx, s, name);
if (jso)
json_object_object_add(parent, name, jso);
}
static struct json_object * get_location(struct uci_context *ctx, struct uci_package *p) {
@ -78,17 +86,9 @@ static struct json_object * get_location(struct uci_context *ctx, struct uci_pac
struct json_object *ret = json_object_new_object();
struct json_object *latitude = get_number(ctx, s, "latitude");
if (latitude)
json_object_object_add(ret, "latitude", latitude);
struct json_object *longitude = get_number(ctx, s, "longitude");
if (longitude)
json_object_object_add(ret, "longitude", longitude);
struct json_object *altitude = get_number(ctx, s, "altitude");
if (altitude)
json_object_object_add(ret, "altitude", altitude);
maybe_add_number(ctx, s, "latitude", ret);
maybe_add_number(ctx, s, "longitude", ret);
maybe_add_number(ctx, s, "altitude", ret);
return ret;
}

View File

@ -29,4 +29,3 @@ uci:section('firewall', 'rule', 'client_respondd',
)
uci:save('firewall')
uci:commit('firewall')

View File

@ -107,13 +107,18 @@ static struct json_object * respondd_provider_nodeinfo(void) {
static void add_uptime(struct json_object *obj) {
FILE *f = fopen("/proc/uptime", "r");
struct json_object* jso;
if (!f)
return;
double uptime, idletime;
if (fscanf(f, "%lf %lf", &uptime, &idletime) == 2) {
json_object_object_add(obj, "uptime", json_object_new_double(uptime));
json_object_object_add(obj, "idletime", json_object_new_double(idletime));
jso = json_object_new_double(uptime);
json_object_set_serializer(jso, json_object_double_to_json_string, "%.2f", NULL);
json_object_object_add(obj, "uptime", jso);
jso = json_object_new_double(idletime);
json_object_set_serializer(jso, json_object_double_to_json_string, "%.2f", NULL);
json_object_object_add(obj, "idletime", jso);
}
fclose(f);
@ -127,7 +132,9 @@ static void add_loadavg(struct json_object *obj) {
double loadavg;
unsigned proc_running, proc_total;
if (fscanf(f, "%lf %*f %*f %u/%u", &loadavg, &proc_running, &proc_total) == 3) {
json_object_object_add(obj, "loadavg", json_object_new_double(loadavg));
struct json_object *jso = json_object_new_double(loadavg);
json_object_set_serializer(jso, json_object_double_to_json_string, "%.2f", NULL);
json_object_object_add(obj, "loadavg", jso);
struct json_object *processes = json_object_new_object();
json_object_object_add(processes, "running", json_object_new_int(proc_running));
@ -176,7 +183,9 @@ static struct json_object * get_rootfs_usage(void) {
if (statfs("/", &s))
return NULL;
return json_object_new_double(1 - (double)s.f_bfree / s.f_blocks);
struct json_object *jso = json_object_new_double(1 - (double)s.f_bfree / s.f_blocks);
json_object_set_serializer(jso, json_object_double_to_json_string, "%.4f", NULL);
return jso;
}
static struct json_object * respondd_provider_statistics(void) {

View File

@ -11,6 +11,5 @@ if site.setup_mode
local name = c:get_first("gluon-setup-mode", "setup_mode")
c:set("gluon-setup-mode", name, "configured", 1)
c:save('gluon-setup-mode')
c:commit('gluon-setup-mode')
end

View File

@ -12,7 +12,6 @@ if old == '1' then
c:set('gluon-setup-mode', setup_mode, 'configured', '1')
c:save('gluon-setup-mode')
c:commit('gluon-setup-mode')
end
os.remove('/etc/config/gluon-config-mode')

View File

@ -8,7 +8,7 @@ if sysconfig.setup_ifname then
os.exit(0)
end
if platform.match('ar71xx', 'generic', {'cpe510', 'nanostation-m', 'nanostation-m-xw', 'unifi-outdoor-plus'}) then
if platform.match('ar71xx', 'generic', {'cpe510', 'nanostation-m', 'nanostation-m-xw', 'unifi-outdoor-plus', 'uap-pro', 'unifiac-pro'}) then
sysconfig.setup_ifname = sysconfig.config_ifname or sysconfig.wan_ifname or sysconfig.lan_ifname
else
sysconfig.setup_ifname = sysconfig.config_ifname or sysconfig.lan_ifname or sysconfig.wan_ifname

View File

@ -10,6 +10,4 @@ uci batch <<-EOF
set uhttpd.main.home=/lib/gluon/status-page/www
set uhttpd.main.max_requests=32
commit uhttpd
EOF

View File

@ -1,160 +0,0 @@
#!/usr/bin/lua
local util = require("luci.util")
local fs = require("nixio.fs")
local ltn12 = require 'luci.ltn12'
local sys = require("luci.sys")
local json = require("luci.jsonc")
local nixio = require 'nixio'
local platform_info = require("platform_info")
local hostname = sys.hostname()
local model = platform_info.get_model()
local release = util.trim(fs.readfile("/lib/gluon/release") or "")
function escape_html(s)
return (s:gsub('&', '&amp;'):gsub('<', '&lt;'):gsub('>', '&gt;'):gsub('"', '&quot;'))
end
function neighbours(ifname)
local info = util.exec("gluon-neighbour-info -d ff02::2:1001 -p 1001 -r nodeinfo -t 3 -i " .. ifname)
local macs = {}
for _, line in ipairs(util.split(info)) do
local data = json.parse(line)
if data then
local function add_macs(list)
if list then
for _, mac in ipairs(list) do
macs[mac] = data
end
end
end
if data["network"] then
add_macs(data["network"]["mesh_interfaces"])
if data["network"]["mesh"] and data["network"]["mesh"]["bat0"] and
data["network"]["mesh"]["bat0"]["interfaces"] then
local interfaces = data["network"]["mesh"]["bat0"]["interfaces"]
add_macs(interfaces["other"])
add_macs(interfaces["wireless"])
add_macs(interfaces["tunnel"])
end
end
end
end
return macs
end
io.write("Content-type: text/html\n\n")
io.write("<!DOCTYPE html>\n")
io.write("<html>")
io.write("<head>")
io.write("<meta charset=\"utf-8\"/>")
io.write("<script src=\"/status.js\"></script>")
io.write("<title>" .. escape_html(hostname) .. "</title>")
io.write("</head>")
io.write("<body>")
io.write("<h1>" .. escape_html(hostname) .. "</h1>")
io.write("<pre>")
io.write("Model: " .. escape_html(model) .. "\n")
io.write("Firmware release: " .. escape_html(release) .. "\n\n")
io.write(escape_html(util.trim(sys.exec("uptime | sed 's/^ \+//'"))) .. "\n\n")
io.write(escape_html(sys.exec("ip address show dev br-client")) .. "\n")
io.write(escape_html(sys.exec("free -m")) .. "\n")
io.write(escape_html(sys.exec("df /rom /overlay")))
io.write("</pre>")
io.write("<h2>Neighbours</h2>")
local interfaces = util.split(util.trim(util.exec("iw dev | egrep 'type IBSS|type mesh' -B 5 | grep Interface | cut -d' ' -f2")))
for _, ifname in ipairs(interfaces) do
io.write("<h3>" .. escape_html(ifname) .. "</h3>")
io.write("<pre>")
for _, line in ipairs(util.split(util.exec("iw dev " .. ifname .. " station dump"))) do
local mac = line:match("^Station (.*) %(on ")
if mac then
io.write("Station <a id=\"" .. escape_html(ifname) .. "-" .. mac .. "\">" .. mac .. "</a> (on " .. escape_html(ifname) .. ")\n")
else
io.write(escape_html(line) .. "\n")
end
end
io.write("</pre>")
end
local stat, fastd_status = pcall(
function()
local fastd_sock = nixio.socket('unix', 'stream')
assert(fastd_sock:connect('/var/run/fastd.mesh_vpn.socket'))
decoder = json.new()
ltn12.pump.all(ltn12.source.file(fastd_sock), decoder:sink())
return decoder:get()
end
)
io.write("<h2>VPN status</h2>")
io.write("<pre>")
if stat then
io.write(string.format("fastd running for %.3f seconds\n", fastd_status.uptime/1000))
local peers = 0
local connections = 0
for key, peer in pairs(fastd_status.peers) do
peers = peers+1
if peer.connection then
connections = connections+1
end
end
io.write(string.format("There are %i peers configured, of which %i are connected:\n\n", peers, connections))
for key, peer in pairs(fastd_status.peers) do
io.write(string.format("%s: ", escape_html(peer.name)))
if peer.connection then
io.write(string.format("connected for %.3f seconds\n", peer.connection.established/1000))
else
io.write("not connected\n")
end
end
else
io.write("fastd not running")
end
io.write("</pre>")
io.write("<script>")
for _, ifname in ipairs(interfaces) do
local macs = neighbours(ifname)
for mac, node in pairs(macs) do
local hostname = node["hostname"]
local ip
if node["network"] and node["network"]["addresses"] then
for _, myip in ipairs(node["network"]["addresses"]) do
if ip == nil and myip:sub(1, 5) ~= "fe80:" then
ip = myip
end
end
end
if ip and hostname then
io.write("update_node(\"" .. escape_html(ifname) .. "-" .. mac .. "\", \"" .. escape_html(ip) .. "\", \"" .. escape_html(hostname) .. "\");")
end
end
end
io.write("</script>")
io.write("</body>")
io.write("</html>")

View File

@ -1,9 +0,0 @@
function update_node(id, ip, hostname) {
var el = document.getElementById(id);
if (!el)
return;
el.href = "http://[" + ip + "]/";
el.textContent += " (" + hostname + ")";
}

View File

@ -31,20 +31,13 @@ function (Helper, SignalGraph, Signal) {
}
function TableEntry(parent, nodeInfo, color, stream, mgmtBus, signal) {
var el = document.createElement("tr")
parent.appendChild(el)
var el = parent.insertRow()
var tdHostname = document.createElement("td")
var tdTQ = document.createElement("td")
var tdSignal = document.createElement("td")
var tdDistance = document.createElement("td")
var tdInactive = document.createElement("td")
el.appendChild(tdHostname)
el.appendChild(tdTQ)
el.appendChild(tdSignal)
el.appendChild(tdDistance)
el.appendChild(tdInactive)
var tdHostname = el.insertCell()
var tdTQ = el.insertCell()
var tdSignal = el.insertCell()
var tdDistance = el.insertCell()
var tdInactive = el.insertCell()
var marker = document.createElement("span")
marker.textContent = "⬤ "
@ -69,7 +62,7 @@ function (Helper, SignalGraph, Signal) {
el.destroy = function () {
unsubscribe()
parent.removeChild(el)
parent.tBodies[0].removeChild(el)
}
return el
@ -135,8 +128,7 @@ function (Helper, SignalGraph, Signal) {
el.appendChild(h)
var table = document.createElement("table")
var tr = document.createElement("tr")
table.appendChild(tr)
var tr = table.insertRow()
table.classList.add("datatable")
var th = document.createElement("th")

View File

@ -22,28 +22,38 @@ define(["lib/helper"], function (Helper) {
return el
}
function mkRow(table, label, stream) {
var tr = document.createElement("tr")
function mkRow(table, label, stream, sorted) {
var i = -1
if (sorted) {
for (i = 0; i < table.rows.length; i++) {
if (label < table.rows[i].firstChild.textContent)
break
}
}
var tr = table.insertRow(i)
var th = document.createElement("th")
var td = streamElement("td", stream)
th.textContent = label
tr.appendChild(th)
tr.appendChild(td)
table.appendChild(tr)
tr.destroy = function () {
td.destroy()
table.removeChild(tr)
table.tBodies[0].removeChild(tr)
}
return tr
}
function mkTrafficRow(table, children, label, stream, selector) {
var tr = document.createElement("tr")
var tr = table.insertRow()
var th = document.createElement("th")
var td = document.createElement("td")
th.textContent = label
tr.appendChild(th)
var td = tr.insertCell()
var traffic = stream.slidingWindow(2, 2)
var pkts = streamNode(traffic.map(deltaUptime(selector + ".packets")).map(prettyPackets))
@ -56,10 +66,6 @@ define(["lib/helper"], function (Helper) {
td.appendChild(document.createElement("br"))
td.appendChild(bytes)
tr.appendChild(th)
tr.appendChild(td)
table.appendChild(tr)
children.push(pkts)
children.push(bw)
children.push(bytes)
@ -127,7 +133,7 @@ define(["lib/helper"], function (Helper) {
stream.startWith(d)
.map(peer.path)
.filter(function (d) { return d !== undefined })
.map(prettyPeer))
.map(prettyPeer), true)
})
}
})

View File

@ -5,7 +5,7 @@ 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 d0abf42..f345fae 100755
index dab4d2c..e7b3cd2 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() {
@ -49,7 +49,7 @@ index d0abf42..f345fae 100755
cybertan_get_hw_magic() {
local part
@@ -472,12 +506,14 @@ ar71xx_board_detect() {
@@ -475,12 +509,14 @@ ar71xx_board_detect() {
;;
*"Bullet M")
name="bullet-m"
@ -64,7 +64,7 @@ index d0abf42..f345fae 100755
;;
*"Nanostation M XW")
name="nanostation-m-xw"
@@ -664,6 +700,7 @@ ar71xx_board_detect() {
@@ -667,6 +703,7 @@ ar71xx_board_detect() {
;;
*"Rocket M")
name="rocket-m"

View File

@ -3,7 +3,7 @@ Date: Wed, 9 Mar 2016 06:46:44 +0100
Subject: netifd: update to latest git master
diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile
index 619024b..f7563d5 100644
index 619024b..84a4592 100644
--- a/package/network/config/netifd/Makefile
+++ b/package/network/config/netifd/Makefile
@@ -1,13 +1,13 @@
@ -11,7 +11,7 @@ index 619024b..f7563d5 100644
PKG_NAME:=netifd
-PKG_VERSION:=2015-12-16
+PKG_VERSION:=2016-03-07
+PKG_VERSION:=2016-03-31
PKG_RELEASE=$(PKG_SOURCE_VERSION)
PKG_SOURCE_PROTO:=git
@ -19,7 +19,7 @@ index 619024b..f7563d5 100644
+PKG_SOURCE_URL=$(OPENWRT_GIT)/project/netifd.git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_VERSION:=245527193e90906451be35c2b8e972b8712ea6ab
+PKG_SOURCE_VERSION:=bd1ee3efb46ae013d81b1aec51668e7595274e69
+PKG_SOURCE_VERSION:=6fd6be6b7f3fc4883fdc464fcbcb2b5e8d8e8174
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
# PKG_MIRROR_MD5SUM:=
@ -53,3 +53,130 @@ index af3aaa8..5515b91 100755
for dev in $(echo "$radio_devs" | sort -u); do
/sbin/wifi up "$dev"
done
diff --git a/package/network/config/netifd/patches/0001-Revert-device-Don-t-process-link-events-anymore-in-d.patch b/package/network/config/netifd/patches/0001-Revert-device-Don-t-process-link-events-anymore-in-d.patch
new file mode 100644
index 0000000..312964f
--- /dev/null
+++ b/package/network/config/netifd/patches/0001-Revert-device-Don-t-process-link-events-anymore-in-d.patch
@@ -0,0 +1,121 @@
+From e0f19fdae88f3ef505e22533915f8328f4793980 Mon Sep 17 00:00:00 2001
+Message-Id: <e0f19fdae88f3ef505e22533915f8328f4793980.1462479663.git.mschiffer@universe-factory.net>
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Thu, 5 May 2016 21:49:33 +0200
+Subject: [PATCH] Revert "device: Don't process link events anymore in device
+ user specific callback handlers"
+
+This reverts commit 4902ba2999dec02e82066d70ab6096b852a33007.
+---
+ device.h | 2 ++
+ macvlan.c | 8 ++++++++
+ system-linux.c | 2 +-
+ vlan.c | 6 ++++++
+ vlandev.c | 8 ++++++++
+ 5 files changed, 25 insertions(+), 1 deletion(-)
+
+diff --git a/device.h b/device.h
+index ac77cfb..ef1c608 100644
+--- a/device.h
++++ b/device.h
+@@ -59,6 +59,8 @@ struct device_type {
+ struct list_head list;
+ const char *name;
+
++ bool keep_link_status;
++
+ const struct uci_blob_param_list *config_params;
+
+ struct device *(*create)(const char *name, struct blob_attr *attr);
+diff --git a/macvlan.c b/macvlan.c
+index a0f11ae..051fe05 100644
+--- a/macvlan.c
++++ b/macvlan.c
+@@ -72,6 +72,12 @@ macvlan_base_cb(struct device_user *dev, enum device_event ev)
+ case DEV_EVENT_REMOVE:
+ device_set_present(&mvdev->dev, false);
+ break;
++ case DEV_EVENT_LINK_UP:
++ device_set_link(&mvdev->dev, true);
++ break;
++ case DEV_EVENT_LINK_DOWN:
++ device_set_link(&mvdev->dev, false);
++ break;
+ default:
+ return;
+ }
+@@ -255,6 +261,8 @@ macvlan_create(const char *name, struct blob_attr *attr)
+ const struct device_type macvlan_device_type = {
+ .name = "MAC VLAN",
+ .config_params = &macvlan_attr_list,
++ .keep_link_status = true,
++
+ .create = macvlan_create,
+ .config_init = macvlan_config_init,
+ .reload = macvlan_reload,
+diff --git a/system-linux.c b/system-linux.c
+index 351a994..794c1dd 100644
+--- a/system-linux.c
++++ b/system-linux.c
+@@ -464,7 +464,7 @@ static int cb_rtnl_event(struct nl_msg *msg, void *arg)
+ goto out;
+
+ struct device *dev = device_get(nla_data(nla[IFLA_IFNAME]), false);
+- if (!dev)
++ if (!dev || dev->type->keep_link_status)
+ goto out;
+
+ if (!system_get_dev_sysctl("/sys/class/net/%s/carrier", dev->ifname, buf, sizeof(buf)))
+diff --git a/vlan.c b/vlan.c
+index ac434ce..8d93799 100644
+--- a/vlan.c
++++ b/vlan.c
+@@ -79,6 +79,11 @@ static void vlan_dev_cb(struct device_user *dep, enum device_event ev)
+ case DEV_EVENT_REMOVE:
+ device_set_present(&vldev->dev, new_state);
+ break;
++ case DEV_EVENT_LINK_UP:
++ new_state = true;
++ case DEV_EVENT_LINK_DOWN:
++ device_set_link(&vldev->dev, new_state);
++ break;
+ case DEV_EVENT_UPDATE_IFNAME:
+ vlan_dev_set_name(vldev, dep->dev);
+ device_broadcast_event(&vldev->dev, ev);
+@@ -97,6 +102,7 @@ static struct device *get_vlan_device(struct device *dev, int id, bool create)
+ static const struct device_type vlan_type = {
+ .name = "VLAN",
+ .config_params = &device_attr_list,
++ .keep_link_status = true,
+ .free = free_vlan_if,
+ };
+ struct vlan_device *vldev;
+diff --git a/vlandev.c b/vlandev.c
+index b93527c..884e6ef 100644
+--- a/vlandev.c
++++ b/vlandev.c
+@@ -63,6 +63,12 @@ vlandev_base_cb(struct device_user *dev, enum device_event ev)
+ case DEV_EVENT_REMOVE:
+ device_set_present(&mvdev->dev, false);
+ break;
++ case DEV_EVENT_LINK_UP:
++ device_set_link(&mvdev->dev, true);
++ break;
++ case DEV_EVENT_LINK_DOWN:
++ device_set_link(&mvdev->dev, false);
++ break;
+ default:
+ return;
+ }
+@@ -243,6 +249,8 @@ vlandev_create(const char *name, struct blob_attr *attr)
+ const struct device_type vlandev_device_type = {
+ .name = "VLANDEV",
+ .config_params = &vlandev_attr_list,
++ .keep_link_status = true,
++
+ .create = vlandev_create,
+ .config_init = vlandev_config_init,
+ .reload = vlandev_reload,
+--
+2.8.2
+

View File

@ -0,0 +1,25 @@
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 73ab5ef..adc119c 100644
--- a/target/linux/x86/base-files/lib/upgrade/platform.sh
+++ b/target/linux/x86/base-files/lib/upgrade/platform.sh
@@ -17,7 +17,7 @@ platform_export_bootpart() {
PARTUUID=[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]-02)
uuid="${disk#PARTUUID=}"
uuid="${uuid%-02}"
- for disk in /dev/[hsv]d[a-z]; do
+ for disk in /dev/[hsv]d[a-z] /dev/xvd[a-z]; do
set -- $(dd if=$disk bs=1 skip=440 count=4 2>/dev/null | hexdump -v -e '4/1 "%02x "')
if [ "$4$3$2$1" = "$uuid" ]; then
export BOOTPART="${disk}1"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,115 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sat, 7 May 2016 00:17:55 +0200
Subject: kernel: mtd: spi-nor: wait until status register writes are ready
diff --git a/target/linux/generic/patches-3.18/094-0001-mtd-spi-nor-wait-until-lock-unlock-operations-are-re.patch b/target/linux/generic/patches-3.18/094-0001-mtd-spi-nor-wait-until-lock-unlock-operations-are-re.patch
new file mode 100644
index 0000000..2c2e5f3
--- /dev/null
+++ b/target/linux/generic/patches-3.18/094-0001-mtd-spi-nor-wait-until-lock-unlock-operations-are-re.patch
@@ -0,0 +1,66 @@
+From 32321e950d8a237d7e8f3a9b76220007dfa87544 Mon Sep 17 00:00:00 2001
+Message-Id: <32321e950d8a237d7e8f3a9b76220007dfa87544.1462572686.git.mschiffer@universe-factory.net>
+From: =?UTF-8?q?Ezequiel=20Garc=C3=ADa?= <ezequiel@vanguardiasur.com.ar>
+Date: Mon, 28 Dec 2015 17:54:51 -0300
+Subject: [PATCH] mtd: spi-nor: wait until lock/unlock operations are ready
+
+On Micron and Numonyx devices, the status register write command
+(WRSR), raises a work-in-progress bit (WIP) on the status register.
+The datasheets for these devices specify that while the status
+register write is in progress, the status register WIP bit can still
+be read to check the end of the operation.
+
+This commit adds a wait_till_ready call on lock/unlock operations,
+which is required for Micron and Numonyx but should be harmless for
+others. This is needed to prevent applications from issuing erase or
+program operations before the unlock operation is completed.
+
+Reported-by: Stas Sergeev <stsp@list.ru>
+Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
+Signed-off-by: Brian Norris <computersforpeace@gmail.com>
+---
+ drivers/mtd/spi-nor/spi-nor.c | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+--- a/drivers/mtd/spi-nor/spi-nor.c
++++ b/drivers/mtd/spi-nor/spi-nor.c
+@@ -462,6 +462,7 @@ static int stm_lock(struct spi_nor *nor,
+ u8 status_old, status_new;
+ u8 mask = SR_BP2 | SR_BP1 | SR_BP0;
+ u8 shift = ffs(mask) - 1, pow, val;
++ int ret;
+
+ status_old = read_sr(nor);
+
+@@ -498,7 +499,10 @@ static int stm_lock(struct spi_nor *nor,
+ return -EINVAL;
+
+ write_enable(nor);
+- return write_sr(nor, status_new);
++ ret = write_sr(nor, status_new);
++ if (ret)
++ return ret;
++ return spi_nor_wait_till_ready(nor);
+ }
+
+ /*
+@@ -512,6 +516,7 @@ static int stm_unlock(struct spi_nor *no
+ uint8_t status_old, status_new;
+ u8 mask = SR_BP2 | SR_BP1 | SR_BP0;
+ u8 shift = ffs(mask) - 1, pow, val;
++ int ret;
+
+ status_old = read_sr(nor);
+
+@@ -546,7 +551,10 @@ static int stm_unlock(struct spi_nor *no
+ return -EINVAL;
+
+ write_enable(nor);
+- return write_sr(nor, status_new);
++ ret = write_sr(nor, status_new);
++ if (ret)
++ return ret;
++ return spi_nor_wait_till_ready(nor);
+ }
+
+ /*
diff --git a/target/linux/generic/patches-3.18/094-0002-mtd-spi-nor-wait-for-SR_WIP-to-clear-on-initial-unlo.patch b/target/linux/generic/patches-3.18/094-0002-mtd-spi-nor-wait-for-SR_WIP-to-clear-on-initial-unlo.patch
new file mode 100644
index 0000000..a0573d5
--- /dev/null
+++ b/target/linux/generic/patches-3.18/094-0002-mtd-spi-nor-wait-for-SR_WIP-to-clear-on-initial-unlo.patch
@@ -0,0 +1,33 @@
+From edf891ef9ab773363f8e58022a26d7d31604aed6 Mon Sep 17 00:00:00 2001
+Message-Id: <edf891ef9ab773363f8e58022a26d7d31604aed6.1462572703.git.mschiffer@universe-factory.net>
+From: Brian Norris <computersforpeace@gmail.com>
+Date: Fri, 29 Jan 2016 11:25:30 -0800
+Subject: [PATCH] mtd: spi-nor: wait for SR_WIP to clear on initial unlock
+
+Fixup a piece leftover by commit 32321e950d8a ("mtd: spi-nor: wait until
+lock/unlock operations are ready"). That commit made us wait for the WIP
+bit to settle after lock/unlock operations, but it missed the open-coded
+"unlock" that happens at probe() time.
+
+We should probably have this code utilize the unlock() routines in the
+future, to avoid duplication, but unfortunately, flash which need to be
+unlocked don't all have a proper ->flash_unlock() callback.
+
+Signed-off-by: Brian Norris <computersforpeace@gmail.com>
+Cc: Stas Sergeev <stsp@users.sourceforge.net>
+Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
+Tested-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
+---
+ drivers/mtd/spi-nor/spi-nor.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/mtd/spi-nor/spi-nor.c
++++ b/drivers/mtd/spi-nor/spi-nor.c
+@@ -1167,6 +1167,7 @@ int spi_nor_scan(struct spi_nor *nor, co
+ JEDEC_MFR(info) == SNOR_MFR_SST) {
+ write_enable(nor);
+ write_sr(nor, 0);
++ spi_nor_wait_till_ready(nor);
+ }
+
+ if (!mtd->name)

View File

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

View File

@ -0,0 +1,37 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sun, 8 May 2016 15:53:14 +0200
Subject: tools: pkg-config: fix build with GCC 6
Fixes the following error:
gdate.c: In function g_date_strftime:
gdate.c:2497:7: error: format not a string literal, format string not checked [-Werror=format-nonliteral]
tmplen = strftime (tmpbuf, tmpbufsize, locale_format, &tm);
^~~~~~
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/tools/pkg-config/patches/001-glib-gdate-suppress-string-format-literal-warning.patch b/tools/pkg-config/patches/001-glib-gdate-suppress-string-format-literal-warning.patch
new file mode 100644
index 0000000..6849299
--- /dev/null
+++ b/tools/pkg-config/patches/001-glib-gdate-suppress-string-format-literal-warning.patch
@@ -0,0 +1,18 @@
+--- a/glib/glib/gdate.c
++++ b/glib/glib/gdate.c
+@@ -2439,6 +2439,9 @@ win32_strftime_helper (const GDate *d,
+ *
+ * Returns: number of characters written to the buffer, or 0 the buffer was too small
+ */
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wformat-nonliteral"
++
+ gsize
+ g_date_strftime (gchar *s,
+ gsize slen,
+@@ -2549,3 +2552,5 @@ g_date_strftime (gchar *s,
+ return retval;
+ #endif
+ }
++
++#pragma GCC diagnostic pop

View File

@ -0,0 +1,815 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sun, 8 May 2016 22:06:51 +0200
Subject: tools: mkimage: sync include/linux/compiler*.h with u-boot master
Fixes build with GCC 6.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/tools/mkimage/patches/200-compiler-support.patch b/tools/mkimage/patches/200-compiler-support.patch
new file mode 100644
index 0000000..ca9c5b5
--- /dev/null
+++ b/tools/mkimage/patches/200-compiler-support.patch
@@ -0,0 +1,702 @@
+diff --git b/include/linux/compiler-gcc.h a/include/linux/compiler-gcc.h
+index e057bd2..22ab246 100644
+--- b/include/linux/compiler-gcc.h
++++ a/include/linux/compiler-gcc.h
+@@ -5,14 +5,28 @@
+ /*
+ * Common definitions for all gcc versions go here.
+ */
+-#define GCC_VERSION (__GNUC__ * 10000 \
+- + __GNUC_MINOR__ * 100 \
+- + __GNUC_PATCHLEVEL__)
+-
++#define GCC_VERSION (__GNUC__ * 10000 \
++ + __GNUC_MINOR__ * 100 \
++ + __GNUC_PATCHLEVEL__)
+
+ /* Optimization barrier */
++
+ /* The "volatile" is due to gcc bugs */
+ #define barrier() __asm__ __volatile__("": : :"memory")
++/*
++ * This version is i.e. to prevent dead stores elimination on @ptr
++ * where gcc and llvm may behave differently when otherwise using
++ * normal barrier(): while gcc behavior gets along with a normal
++ * barrier(), llvm needs an explicit input variable to be assumed
++ * clobbered. The issue is as follows: while the inline asm might
++ * access any memory it wants, the compiler could have fit all of
++ * @ptr into memory registers instead, and since @ptr never escaped
++ * from that, it proofed that the inline asm wasn't touching any of
++ * it. This version works well with both compilers, i.e. we're telling
++ * the compiler that the inline asm absolutely may see the contents
++ * of @ptr. See also: https://llvm.org/bugs/show_bug.cgi?id=15495
++ */
++#define barrier_data(ptr) __asm__ __volatile__("": :"r"(ptr) :"memory")
+
+ /*
+ * This macro obfuscates arithmetic on a variable address so that gcc
+@@ -32,58 +46,63 @@
+ * the inline assembly constraint from =g to =r, in this particular
+ * case either is valid.
+ */
+-#define RELOC_HIDE(ptr, off) \
+- ({ unsigned long __ptr; \
+- __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \
+- (typeof(ptr)) (__ptr + (off)); })
++#define RELOC_HIDE(ptr, off) \
++({ \
++ unsigned long __ptr; \
++ __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \
++ (typeof(ptr)) (__ptr + (off)); \
++})
+
+ /* Make the optimizer believe the variable can be manipulated arbitrarily. */
+-#define OPTIMIZER_HIDE_VAR(var) __asm__ ("" : "=r" (var) : "0" (var))
++#define OPTIMIZER_HIDE_VAR(var) \
++ __asm__ ("" : "=r" (var) : "0" (var))
+
+ #ifdef __CHECKER__
+-#define __must_be_array(arr) 0
++#define __must_be_array(a) 0
+ #else
+ /* &a[0] degrades to a pointer: a different type from an array */
+-#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
++#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
+ #endif
+
+ /*
+ * Force always-inline if the user requests it so via the .config,
+ * or if gcc is too old:
+ */
+-#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
++#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
+ !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
+-# define inline inline __attribute__((always_inline)) notrace
+-# define __inline__ __inline__ __attribute__((always_inline)) notrace
+-# define __inline __inline __attribute__((always_inline)) notrace
++#define inline inline __attribute__((always_inline)) notrace
++#define __inline__ __inline__ __attribute__((always_inline)) notrace
++#define __inline __inline __attribute__((always_inline)) notrace
+ #else
+ /* A lot of inline functions can cause havoc with function tracing */
+-# define inline inline notrace
+-# define __inline__ __inline__ notrace
+-# define __inline __inline notrace
++#define inline inline notrace
++#define __inline__ __inline__ notrace
++#define __inline __inline notrace
+ #endif
+
+-#define __deprecated __attribute__((deprecated))
+-#ifndef __packed
+-#define __packed __attribute__((packed))
+-#endif
+-#ifndef __weak
+-#define __weak __attribute__((weak))
+-#endif
++#define __always_inline inline __attribute__((always_inline))
++#define noinline __attribute__((noinline))
++
++#define __deprecated __attribute__((deprecated))
++#define __packed __attribute__((packed))
++#define __weak __attribute__((weak))
++#define __alias(symbol) __attribute__((alias(#symbol)))
+
+ /*
+- * it doesn't make sense on ARM (currently the only user of __naked) to trace
+- * naked functions because then mcount is called without stack and frame pointer
+- * being set up and there is no chance to restore the lr register to the value
+- * before mcount was called.
++ * it doesn't make sense on ARM (currently the only user of __naked)
++ * to trace naked functions because then mcount is called without
++ * stack and frame pointer being set up and there is no chance to
++ * restore the lr register to the value before mcount was called.
++ *
++ * The asm() bodies of naked functions often depend on standard calling
++ * conventions, therefore they must be noinline and noclone.
+ *
+- * The asm() bodies of naked functions often depend on standard calling conventions,
+- * therefore they must be noinline and noclone. GCC 4.[56] currently fail to enforce
+- * this, so we must do so ourselves. See GCC PR44290.
++ * GCC 4.[56] currently fail to enforce this, so we must do so ourselves.
++ * See GCC PR44290.
+ */
+-#define __naked __attribute__((naked)) noinline __noclone notrace
++#define __naked __attribute__((naked)) noinline __noclone notrace
+
+-#define __noreturn __attribute__((noreturn))
++#define __noreturn __attribute__((noreturn))
+
+ /*
+ * From the GCC manual:
+@@ -95,34 +114,170 @@
+ * would be.
+ * [...]
+ */
+-#ifndef __pure
+-#define __pure __attribute__((pure))
++#define __pure __attribute__((pure))
++#define __aligned(x) __attribute__((aligned(x)))
++#define __printf(a, b) __attribute__((format(printf, a, b)))
++#define __scanf(a, b) __attribute__((format(scanf, a, b)))
++#define __attribute_const__ __attribute__((__const__))
++#define __maybe_unused __attribute__((unused))
++#define __always_unused __attribute__((unused))
++
++/* gcc version specific checks */
++
++#if GCC_VERSION < 30200
++# error Sorry, your compiler is too old - please upgrade it.
++#endif
++
++#if GCC_VERSION < 30300
++# define __used __attribute__((__unused__))
++#else
++# define __used __attribute__((__used__))
++#endif
++
++#ifdef CONFIG_GCOV_KERNEL
++# if GCC_VERSION < 30400
++# error "GCOV profiling support for gcc versions below 3.4 not included"
++# endif /* __GNUC_MINOR__ */
++#endif /* CONFIG_GCOV_KERNEL */
++
++#if GCC_VERSION >= 30400
++#define __must_check __attribute__((warn_unused_result))
++#endif
++
++#if GCC_VERSION >= 40000
++
++/* GCC 4.1.[01] miscompiles __weak */
++#ifdef __KERNEL__
++# if GCC_VERSION >= 40100 && GCC_VERSION <= 40101
++# error Your version of gcc miscompiles the __weak directive
++# endif
++#endif
++
++#define __used __attribute__((__used__))
++#define __compiler_offsetof(a, b) \
++ __builtin_offsetof(a, b)
++
++#if GCC_VERSION >= 40100 && GCC_VERSION < 40600
++# define __compiletime_object_size(obj) __builtin_object_size(obj, 0)
++#endif
++
++#if GCC_VERSION >= 40300
++/* Mark functions as cold. gcc will assume any path leading to a call
++ * to them will be unlikely. This means a lot of manual unlikely()s
++ * are unnecessary now for any paths leading to the usual suspects
++ * like BUG(), printk(), panic() etc. [but let's keep them for now for
++ * older compilers]
++ *
++ * Early snapshots of gcc 4.3 don't support this and we can't detect this
++ * in the preprocessor, but we can live with this because they're unreleased.
++ * Maketime probing would be overkill here.
++ *
++ * gcc also has a __attribute__((__hot__)) to move hot functions into
++ * a special section, but I don't see any sense in this right now in
++ * the kernel context
++ */
++#define __cold __attribute__((__cold__))
++
++#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
++
++#ifndef __CHECKER__
++# define __compiletime_warning(message) __attribute__((warning(message)))
++# define __compiletime_error(message) __attribute__((error(message)))
++#endif /* __CHECKER__ */
++#endif /* GCC_VERSION >= 40300 */
++
++#if GCC_VERSION >= 40500
++/*
++ * Mark a position in code as unreachable. This can be used to
++ * suppress control flow warnings after asm blocks that transfer
++ * control elsewhere.
++ *
++ * Early snapshots of gcc 4.5 don't support this and we can't detect
++ * this in the preprocessor, but we can live with this because they're
++ * unreleased. Really, we need to have autoconf for the kernel.
++ */
++#define unreachable() __builtin_unreachable()
++
++/* Mark a function definition as prohibited from being cloned. */
++#define __noclone __attribute__((__noclone__))
++
++#endif /* GCC_VERSION >= 40500 */
++
++#if GCC_VERSION >= 40600
++/*
++ * When used with Link Time Optimization, gcc can optimize away C functions or
++ * variables which are referenced only from assembly code. __visible tells the
++ * optimizer that something else uses this function or variable, thus preventing
++ * this.
++ */
++#define __visible __attribute__((externally_visible))
+ #endif
+-#ifndef __aligned
+-#define __aligned(x) __attribute__((aligned(x)))
++
++
++#if GCC_VERSION >= 40900 && !defined(__CHECKER__)
++/*
++ * __assume_aligned(n, k): Tell the optimizer that the returned
++ * pointer can be assumed to be k modulo n. The second argument is
++ * optional (default 0), so we use a variadic macro to make the
++ * shorthand.
++ *
++ * Beware: Do not apply this to functions which may return
++ * ERR_PTRs. Also, it is probably unwise to apply it to functions
++ * returning extra information in the low bits (but in that case the
++ * compiler should see some alignment anyway, when the return value is
++ * massaged by 'flags = ptr & 3; ptr &= ~3;').
++ */
++#define __assume_aligned(a, ...) __attribute__((__assume_aligned__(a, ## __VA_ARGS__)))
+ #endif
+-#define __printf(a, b) __attribute__((format(printf, a, b)))
+-#define __scanf(a, b) __attribute__((format(scanf, a, b)))
+-#define noinline __attribute__((noinline))
+-#define __attribute_const__ __attribute__((__const__))
+-#define __maybe_unused __attribute__((unused))
+-#define __always_unused __attribute__((unused))
+
+-#define __gcc_header(x) #x
+-#define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h)
+-#define gcc_header(x) _gcc_header(x)
+-#include gcc_header(__GNUC__)
++/*
++ * GCC 'asm goto' miscompiles certain code sequences:
++ *
++ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
++ *
++ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
++ *
++ * (asm goto is automatically volatile - the naming reflects this.)
++ */
++#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
++
++#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
++#if GCC_VERSION >= 40400
++#define __HAVE_BUILTIN_BSWAP32__
++#define __HAVE_BUILTIN_BSWAP64__
++#endif
++#if GCC_VERSION >= 40800 || (defined(__powerpc__) && GCC_VERSION >= 40600)
++#define __HAVE_BUILTIN_BSWAP16__
++#endif
++#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
++
++#if GCC_VERSION >= 50000
++#define KASAN_ABI_VERSION 4
++#elif GCC_VERSION >= 40902
++#define KASAN_ABI_VERSION 3
++#endif
++
++#if GCC_VERSION >= 40902
++/*
++ * Tell the compiler that address safety instrumentation (KASAN)
++ * should not be applied to that function.
++ * Conflicts with inlining: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368
++ */
++#define __no_sanitize_address __attribute__((no_sanitize_address))
++#endif
++
++#endif /* gcc version >= 40000 specific checks */
+
+ #if !defined(__noclone)
+ #define __noclone /* not needed */
+ #endif
+
++#if !defined(__no_sanitize_address)
++#define __no_sanitize_address
++#endif
++
+ /*
+ * A trick to suppress uninitialized variable warning without generating any
+ * code
+ */
+ #define uninitialized_var(x) x = x
+-
+-#ifndef __always_inline
+-#define __always_inline inline __attribute__((always_inline))
+-#endif
+diff --git b/include/linux/compiler-gcc3.h a/include/linux/compiler-gcc3.h
+deleted file mode 100644
+index 7d89feb..0000000
+--- b/include/linux/compiler-gcc3.h
++++ /dev/null
+@@ -1,23 +0,0 @@
+-#ifndef __LINUX_COMPILER_H
+-#error "Please don't include <linux/compiler-gcc3.h> directly, include <linux/compiler.h> instead."
+-#endif
+-
+-#if GCC_VERSION < 30200
+-# error Sorry, your compiler is too old - please upgrade it.
+-#endif
+-
+-#if GCC_VERSION >= 30300
+-# define __used __attribute__((__used__))
+-#else
+-# define __used __attribute__((__unused__))
+-#endif
+-
+-#if GCC_VERSION >= 30400
+-#define __must_check __attribute__((warn_unused_result))
+-#endif
+-
+-#ifdef CONFIG_GCOV_KERNEL
+-# if GCC_VERSION < 30400
+-# error "GCOV profiling support for gcc versions below 3.4 not included"
+-# endif /* __GNUC_MINOR__ */
+-#endif /* CONFIG_GCOV_KERNEL */
+diff --git b/include/linux/compiler-gcc4.h a/include/linux/compiler-gcc4.h
+deleted file mode 100644
+index c982a09..0000000
+--- b/include/linux/compiler-gcc4.h
++++ /dev/null
+@@ -1,81 +0,0 @@
+-#ifndef __LINUX_COMPILER_H
+-#error "Please don't include <linux/compiler-gcc4.h> directly, include <linux/compiler.h> instead."
+-#endif
+-
+-#define __used __attribute__((__used__))
+-#define __must_check __attribute__((warn_unused_result))
+-#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
+-
+-#if GCC_VERSION >= 40100 && GCC_VERSION < 40600
+-# define __compiletime_object_size(obj) __builtin_object_size(obj, 0)
+-#endif
+-
+-#if GCC_VERSION >= 40300
+-/* Mark functions as cold. gcc will assume any path leading to a call
+- to them will be unlikely. This means a lot of manual unlikely()s
+- are unnecessary now for any paths leading to the usual suspects
+- like BUG(), printk(), panic() etc. [but let's keep them for now for
+- older compilers]
+-
+- Early snapshots of gcc 4.3 don't support this and we can't detect this
+- in the preprocessor, but we can live with this because they're unreleased.
+- Maketime probing would be overkill here.
+-
+- gcc also has a __attribute__((__hot__)) to move hot functions into
+- a special section, but I don't see any sense in this right now in
+- the kernel context */
+-#define __cold __attribute__((__cold__))
+-
+-#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
+-
+-#ifndef __CHECKER__
+-# define __compiletime_warning(message) __attribute__((warning(message)))
+-# define __compiletime_error(message) __attribute__((error(message)))
+-#endif /* __CHECKER__ */
+-#endif /* GCC_VERSION >= 40300 */
+-
+-#if GCC_VERSION >= 40500
+-/*
+- * Mark a position in code as unreachable. This can be used to
+- * suppress control flow warnings after asm blocks that transfer
+- * control elsewhere.
+- *
+- * Early snapshots of gcc 4.5 don't support this and we can't detect
+- * this in the preprocessor, but we can live with this because they're
+- * unreleased. Really, we need to have autoconf for the kernel.
+- */
+-#define unreachable() __builtin_unreachable()
+-
+-/* Mark a function definition as prohibited from being cloned. */
+-#define __noclone __attribute__((__noclone__))
+-
+-#endif /* GCC_VERSION >= 40500 */
+-
+-#if GCC_VERSION >= 40600
+-/*
+- * Tell the optimizer that something else uses this function or variable.
+- */
+-#define __visible __attribute__((externally_visible))
+-#endif
+-
+-/*
+- * GCC 'asm goto' miscompiles certain code sequences:
+- *
+- * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
+- *
+- * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
+- * Fixed in GCC 4.8.2 and later versions.
+- *
+- * (asm goto is automatically volatile - the naming reflects this.)
+- */
+-#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
+-
+-#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
+-#if GCC_VERSION >= 40400
+-#define __HAVE_BUILTIN_BSWAP32__
+-#define __HAVE_BUILTIN_BSWAP64__
+-#endif
+-#if GCC_VERSION >= 40800 || (defined(__powerpc__) && GCC_VERSION >= 40600)
+-#define __HAVE_BUILTIN_BSWAP16__
+-#endif
+-#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
+diff --git b/include/linux/compiler-intel.h a/include/linux/compiler-intel.h
+index ba147a1..d4c7113 100644
+--- b/include/linux/compiler-intel.h
++++ a/include/linux/compiler-intel.h
+@@ -13,9 +13,14 @@
+ /* Intel ECC compiler doesn't support gcc specific asm stmts.
+ * It uses intrinsics to do the equivalent things.
+ */
++#undef barrier
++#undef barrier_data
+ #undef RELOC_HIDE
+ #undef OPTIMIZER_HIDE_VAR
+
++#define barrier() __memory_barrier()
++#define barrier_data(ptr) barrier()
++
+ #define RELOC_HIDE(ptr, off) \
+ ({ unsigned long __ptr; \
+ __ptr = (unsigned long) (ptr); \
+diff --git b/include/linux/compiler.h a/include/linux/compiler.h
+index d5ad7b1..020ad16 100644
+--- b/include/linux/compiler.h
++++ a/include/linux/compiler.h
+@@ -17,6 +17,7 @@
+ # define __release(x) __context__(x,-1)
+ # define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0)
+ # define __percpu __attribute__((noderef, address_space(3)))
++# define __pmem __attribute__((noderef, address_space(5)))
+ #ifdef CONFIG_SPARSE_RCU_POINTER
+ # define __rcu __attribute__((noderef, address_space(4)))
+ #else
+@@ -42,6 +43,7 @@ extern void __chk_io_ptr(const volatile void __iomem *);
+ # define __cond_lock(x,c) (c)
+ # define __percpu
+ # define __rcu
++# define __pmem
+ #endif
+
+ /* Indirect macros required for expanded argument pasting, eg. __LINE__. */
+@@ -54,7 +56,11 @@ extern void __chk_io_ptr(const volatile void __iomem *);
+ #include <linux/compiler-gcc.h>
+ #endif
+
++#if defined(CC_USING_HOTPATCH) && !defined(__CHECKER__)
++#define notrace __attribute__((hotpatch(0,0)))
++#else
+ #define notrace __attribute__((no_instrument_function))
++#endif
+
+ /* Intel compiler defines __GNUC__. So we will overwrite implementations
+ * coming from above header files here
+@@ -138,7 +144,7 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
+ */
+ #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
+ #define __trace_if(cond) \
+- if (__builtin_constant_p((cond)) ? !!(cond) : \
++ if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
+ ({ \
+ int ______r; \
+ static struct ftrace_branch_data \
+@@ -165,6 +171,10 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
+ # define barrier() __memory_barrier()
+ #endif
+
++#ifndef barrier_data
++# define barrier_data(ptr) barrier()
++#endif
++
+ /* Unreachable code */
+ #ifndef unreachable
+ # define unreachable() do { } while (1)
+@@ -186,6 +196,126 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
+ # define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __LINE__)
+ #endif
+
++#include <linux/types.h>
++
++#define __READ_ONCE_SIZE \
++({ \
++ switch (size) { \
++ case 1: *(__u8 *)res = *(volatile __u8 *)p; break; \
++ case 2: *(__u16 *)res = *(volatile __u16 *)p; break; \
++ case 4: *(__u32 *)res = *(volatile __u32 *)p; break; \
++ case 8: *(__u64 *)res = *(volatile __u64 *)p; break; \
++ default: \
++ barrier(); \
++ __builtin_memcpy((void *)res, (const void *)p, size); \
++ barrier(); \
++ } \
++})
++
++static __always_inline
++void __read_once_size(const volatile void *p, void *res, int size)
++{
++ __READ_ONCE_SIZE;
++}
++
++#ifdef CONFIG_KASAN
++/*
++ * This function is not 'inline' because __no_sanitize_address confilcts
++ * with inlining. Attempt to inline it may cause a build failure.
++ * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368
++ * '__maybe_unused' allows us to avoid defined-but-not-used warnings.
++ */
++static __no_sanitize_address __maybe_unused
++void __read_once_size_nocheck(const volatile void *p, void *res, int size)
++{
++ __READ_ONCE_SIZE;
++}
++#else
++static __always_inline
++void __read_once_size_nocheck(const volatile void *p, void *res, int size)
++{
++ __READ_ONCE_SIZE;
++}
++#endif
++
++static __always_inline void __write_once_size(volatile void *p, void *res, int size)
++{
++ switch (size) {
++ case 1: *(volatile __u8 *)p = *(__u8 *)res; break;
++ case 2: *(volatile __u16 *)p = *(__u16 *)res; break;
++ case 4: *(volatile __u32 *)p = *(__u32 *)res; break;
++ case 8: *(volatile __u64 *)p = *(__u64 *)res; break;
++ default:
++ barrier();
++ __builtin_memcpy((void *)p, (const void *)res, size);
++ barrier();
++ }
++}
++
++/*
++ * Prevent the compiler from merging or refetching reads or writes. The
++ * compiler is also forbidden from reordering successive instances of
++ * READ_ONCE, WRITE_ONCE and ACCESS_ONCE (see below), but only when the
++ * compiler is aware of some particular ordering. One way to make the
++ * compiler aware of ordering is to put the two invocations of READ_ONCE,
++ * WRITE_ONCE or ACCESS_ONCE() in different C statements.
++ *
++ * In contrast to ACCESS_ONCE these two macros will also work on aggregate
++ * data types like structs or unions. If the size of the accessed data
++ * type exceeds the word size of the machine (e.g., 32 bits or 64 bits)
++ * READ_ONCE() and WRITE_ONCE() will fall back to memcpy and print a
++ * compile-time warning.
++ *
++ * Their two major use cases are: (1) Mediating communication between
++ * process-level code and irq/NMI handlers, all running on the same CPU,
++ * and (2) Ensuring that the compiler does not fold, spindle, or otherwise
++ * mutilate accesses that either do not require ordering or that interact
++ * with an explicit memory barrier or atomic instruction that provides the
++ * required ordering.
++ */
++
++#define __READ_ONCE(x, check) \
++({ \
++ union { typeof(x) __val; char __c[1]; } __u; \
++ if (check) \
++ __read_once_size(&(x), __u.__c, sizeof(x)); \
++ else \
++ __read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \
++ __u.__val; \
++})
++#define READ_ONCE(x) __READ_ONCE(x, 1)
++
++/*
++ * Use READ_ONCE_NOCHECK() instead of READ_ONCE() if you need
++ * to hide memory access from KASAN.
++ */
++#define READ_ONCE_NOCHECK(x) __READ_ONCE(x, 0)
++
++#define WRITE_ONCE(x, val) \
++({ \
++ union { typeof(x) __val; char __c[1]; } __u = \
++ { .__val = (__force typeof(x)) (val) }; \
++ __write_once_size(&(x), __u.__c, sizeof(x)); \
++ __u.__val; \
++})
++
++/**
++ * smp_cond_acquire() - Spin wait for cond with ACQUIRE ordering
++ * @cond: boolean expression to wait for
++ *
++ * Equivalent to using smp_load_acquire() on the condition variable but employs
++ * the control dependency of the wait to reduce the barrier on many platforms.
++ *
++ * The control dependency provides a LOAD->STORE order, the additional RMB
++ * provides LOAD->LOAD order, together they provide LOAD->{LOAD,STORE} order,
++ * aka. ACQUIRE.
++ */
++#define smp_cond_acquire(cond) do { \
++ while (!(cond)) \
++ cpu_relax(); \
++ smp_rmb(); /* ctrl + rmb := acquire */ \
++} while (0)
++
+ #endif /* __KERNEL__ */
+
+ #endif /* __ASSEMBLY__ */
+@@ -304,6 +434,14 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
+ #define __visible
+ #endif
+
++/*
++ * Assume alignment of return value.
++ */
++#ifndef __assume_aligned
++#define __assume_aligned(a, ...)
++#endif
++
++
+ /* Are two types/vars the same type (ignoring qualifiers)? */
+ #ifndef __same_type
+ # define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
+@@ -311,7 +449,7 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
+
+ /* Is this type a native word size -- useful for atomic operations */
+ #ifndef __native_word
+-# define __native_word(t) (sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
++# define __native_word(t) (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
+ #endif
+
+ /* Compile time object size, -1 for unknown */
+@@ -373,12 +511,38 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
+ * to make the compiler aware of ordering is to put the two invocations of
+ * ACCESS_ONCE() in different C statements.
+ *
+- * This macro does absolutely -nothing- to prevent the CPU from reordering,
+- * merging, or refetching absolutely anything at any time. Its main intended
+- * use is to mediate communication between process-level code and irq/NMI
+- * handlers, all running on the same CPU.
++ * ACCESS_ONCE will only work on scalar types. For union types, ACCESS_ONCE
++ * on a union member will work as long as the size of the member matches the
++ * size of the union and the size is smaller than word size.
++ *
++ * The major use cases of ACCESS_ONCE used to be (1) Mediating communication
++ * between process-level code and irq/NMI handlers, all running on the same CPU,
++ * and (2) Ensuring that the compiler does not fold, spindle, or otherwise
++ * mutilate accesses that either do not require ordering or that interact
++ * with an explicit memory barrier or atomic instruction that provides the
++ * required ordering.
++ *
++ * If possible use READ_ONCE()/WRITE_ONCE() instead.
++ */
++#define __ACCESS_ONCE(x) ({ \
++ __maybe_unused typeof(x) __var = (__force typeof(x)) 0; \
++ (volatile typeof(x) *)&(x); })
++#define ACCESS_ONCE(x) (*__ACCESS_ONCE(x))
++
++/**
++ * lockless_dereference() - safely load a pointer for later dereference
++ * @p: The pointer to load
++ *
++ * Similar to rcu_dereference(), but for situations where the pointed-to
++ * object's lifetime is managed by something other than RCU. That
++ * "something other" might be reference counting or simple immortality.
+ */
+-#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
++#define lockless_dereference(p) \
++({ \
++ typeof(p) _________p1 = READ_ONCE(p); \
++ smp_read_barrier_depends(); /* Dependency order vs. p above. */ \
++ (_________p1); \
++})
+
+ /* Ignore/forbid kprobes attach on very low level functions marked by this attribute: */
+ #ifdef CONFIG_KPROBES
diff --git a/tools/mkimage/patches/200-gcc5_compat.patch b/tools/mkimage/patches/200-gcc5_compat.patch
deleted file mode 100644
index 4d55f00..0000000
--- a/tools/mkimage/patches/200-gcc5_compat.patch
+++ /dev/null
@@ -1,93 +0,0 @@
-From 478b02f1a7043b673565075ea5016376f3293b23 Mon Sep 17 00:00:00 2001
-From: Hans de Goede <hdegoede@redhat.com>
-Date: Sat, 7 Feb 2015 22:52:40 +0100
-Subject: [PATCH] Add linux/compiler-gcc5.h to fix builds with gcc5
-
-Add linux/compiler-gcc5/h from the kernel sources at:
-
-commit 5631b8fba640a4ab2f8a954f63a603fa34eda96b
-Author: Steven Noonan <steven@uplinklabs.net>
-Date: Sat Oct 25 15:09:42 2014 -0700
-
- compiler/gcc4+: Remove inaccurate comment about 'asm goto' miscompiles
-
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
----
- include/linux/compiler-gcc5.h | 65 +++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 65 insertions(+)
- create mode 100644 include/linux/compiler-gcc5.h
-
-diff --git a/include/linux/compiler-gcc5.h b/include/linux/compiler-gcc5.h
-new file mode 100644
-index 0000000..c8c5659
---- /dev/null
-+++ b/include/linux/compiler-gcc5.h
-@@ -0,0 +1,65 @@
-+#ifndef __LINUX_COMPILER_H
-+#error "Please don't include <linux/compiler-gcc5.h> directly, include <linux/compiler.h> instead."
-+#endif
-+
-+#define __used __attribute__((__used__))
-+#define __must_check __attribute__((warn_unused_result))
-+#define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
-+
-+/* Mark functions as cold. gcc will assume any path leading to a call
-+ to them will be unlikely. This means a lot of manual unlikely()s
-+ are unnecessary now for any paths leading to the usual suspects
-+ like BUG(), printk(), panic() etc. [but let's keep them for now for
-+ older compilers]
-+
-+ Early snapshots of gcc 4.3 don't support this and we can't detect this
-+ in the preprocessor, but we can live with this because they're unreleased.
-+ Maketime probing would be overkill here.
-+
-+ gcc also has a __attribute__((__hot__)) to move hot functions into
-+ a special section, but I don't see any sense in this right now in
-+ the kernel context */
-+#define __cold __attribute__((__cold__))
-+
-+#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
-+
-+#ifndef __CHECKER__
-+# define __compiletime_warning(message) __attribute__((warning(message)))
-+# define __compiletime_error(message) __attribute__((error(message)))
-+#endif /* __CHECKER__ */
-+
-+/*
-+ * Mark a position in code as unreachable. This can be used to
-+ * suppress control flow warnings after asm blocks that transfer
-+ * control elsewhere.
-+ *
-+ * Early snapshots of gcc 4.5 don't support this and we can't detect
-+ * this in the preprocessor, but we can live with this because they're
-+ * unreleased. Really, we need to have autoconf for the kernel.
-+ */
-+#define unreachable() __builtin_unreachable()
-+
-+/* Mark a function definition as prohibited from being cloned. */
-+#define __noclone __attribute__((__noclone__))
-+
-+/*
-+ * Tell the optimizer that something else uses this function or variable.
-+ */
-+#define __visible __attribute__((externally_visible))
-+
-+/*
-+ * GCC 'asm goto' miscompiles certain code sequences:
-+ *
-+ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
-+ *
-+ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
-+ *
-+ * (asm goto is automatically volatile - the naming reflects this.)
-+ */
-+#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
-+
-+#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
-+#define __HAVE_BUILTIN_BSWAP32__
-+#define __HAVE_BUILTIN_BSWAP64__
-+#define __HAVE_BUILTIN_BSWAP16__
-+#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
---
-1.7.10.4
-

View File

@ -0,0 +1,144 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Mon, 9 May 2016 00:16:38 +0200
Subject: toolchain: gcc: fix build with GCC 6
At least for GCC 4.8, which is used by most targets.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/toolchain/gcc/patches/4.8-linaro/030-gcc-6-compile.patch b/toolchain/gcc/patches/4.8-linaro/030-gcc-6-compile.patch
new file mode 100644
index 0000000..c74f2aa
--- /dev/null
+++ b/toolchain/gcc/patches/4.8-linaro/030-gcc-6-compile.patch
@@ -0,0 +1,130 @@
+Upstream commit r233721
+
+diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
+index bd1c1d7..a0ea0d4 100644
+--- a/gcc/cp/Make-lang.in
++++ b/gcc/cp/Make-lang.in
+@@ -111,7 +111,7 @@ else
+ # deleting the $(srcdir)/cp/cfns.h file.
+ $(srcdir)/cp/cfns.h:
+ endif
+- gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L ANSI-C \
++ gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L C++ \
+ $(srcdir)/cp/cfns.gperf --output-file $(srcdir)/cp/cfns.h
+
+ #
+diff --git a/gcc/cp/cfns.gperf b/gcc/cp/cfns.gperf
+index 05ca753..d9b16b8 100644
+--- a/gcc/cp/cfns.gperf
++++ b/gcc/cp/cfns.gperf
+@@ -1,3 +1,5 @@
++%language=C++
++%define class-name libc_name
+ %{
+ /* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+
+@@ -16,14 +18,6 @@ for more details.
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+-#ifdef __GNUC__
+-__inline
+-#endif
+-static unsigned int hash (const char *, unsigned int);
+-#ifdef __GNUC__
+-__inline
+-#endif
+-const char * libc_name_p (const char *, unsigned int);
+ %}
+ %%
+ # The standard C library functions, for feeding to gperf; the result is used
+diff --git a/gcc/cp/cfns.h b/gcc/cp/cfns.h
+index c845ddf..65801d1 100644
+--- a/gcc/cp/cfns.h
++++ b/gcc/cp/cfns.h
+@@ -1,5 +1,5 @@
+-/* ANSI-C code produced by gperf version 3.0.3 */
+-/* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L ANSI-C cfns.gperf */
++/* C++ code produced by gperf version 3.0.4 */
++/* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L C++ --output-file cfns.h cfns.gperf */
+
+ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
+ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
+@@ -28,7 +28,7 @@
+ #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
+ #endif
+
+-#line 1 "cfns.gperf"
++#line 3 "cfns.gperf"
+
+ /* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+
+@@ -47,25 +47,18 @@ for more details.
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+-#ifdef __GNUC__
+-__inline
+-#endif
+-static unsigned int hash (const char *, unsigned int);
+-#ifdef __GNUC__
+-__inline
+-#endif
+-const char * libc_name_p (const char *, unsigned int);
+ /* maximum key range = 391, duplicates = 0 */
+
+-#ifdef __GNUC__
+-__inline
+-#else
+-#ifdef __cplusplus
+-inline
+-#endif
+-#endif
+-static unsigned int
+-hash (register const char *str, register unsigned int len)
++class libc_name
++{
++private:
++ static inline unsigned int hash (const char *str, unsigned int len);
++public:
++ static const char *libc_name_p (const char *str, unsigned int len);
++};
++
++inline unsigned int
++libc_name::hash (register const char *str, register unsigned int len)
+ {
+ static const unsigned short asso_values[] =
+ {
+@@ -122,14 +115,8 @@ hash (register const char *str, register unsigned int len)
+ return hval + asso_values[(unsigned char)str[len - 1]];
+ }
+
+-#ifdef __GNUC__
+-__inline
+-#ifdef __GNUC_STDC_INLINE__
+-__attribute__ ((__gnu_inline__))
+-#endif
+-#endif
+ const char *
+-libc_name_p (register const char *str, register unsigned int len)
++libc_name::libc_name_p (register const char *str, register unsigned int len)
+ {
+ enum
+ {
+diff --git a/gcc/cp/except.c b/gcc/cp/except.c
+index 221971a..32340f5 100644
+--- a/gcc/cp/except.c
++++ b/gcc/cp/except.c
+@@ -1030,7 +1030,8 @@ nothrow_libfn_p (const_tree fn)
+ unless the system headers are playing rename tricks, and if
+ they are, we don't want to be confused by them. */
+ id = DECL_NAME (fn);
+- return !!libc_name_p (IDENTIFIER_POINTER (id), IDENTIFIER_LENGTH (id));
++ return !!libc_name::libc_name_p (IDENTIFIER_POINTER (id),
++ IDENTIFIER_LENGTH (id));
+ }
+
+ /* Returns nonzero if an exception of type FROM will be caught by a
+--
+1.7.1
+

View File

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

View File

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

View File

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

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