Skip to content
Snippets Groups Projects
Unverified Commit 78b2775e authored by Matthias Schiffer's avatar Matthias Schiffer
Browse files

Use LEDE as base for Gluon

parent 04818c17
No related branches found
No related tags found
No related merge requests found
Showing
with 305 additions and 824 deletions
*~ *~
/build /lede
/output /output
/site /site
/openwrt /tmp
/packages /packages
/modules.local
The code of Project Gluon may be distributed under the following terms, unless The code of Project Gluon may be distributed under the following terms, unless
noted otherwise in individual files or subtrees. noted otherwise in individual files or subtrees.
Copyright (c) 2013, Project Gluon Copyright (c) 2013-2017, Project Gluon
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
...@@ -25,10 +25,10 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ...@@ -25,10 +25,10 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
OpenWrt is licensed under the terms of the GNU General Public License Version 2, LEDE and OpenWrt are licensed under the terms of the GNU General Public License
which can be found under openwrt/LICENSE after the openwrt submodule has been Version 2, which can be found at lede/LICENSE after the lede repository has been
obtained. This applies to the following submodules: obtained. This applies to the following repositories:
* openwrt * lede
* packages/openwrt * packages/openwrt
* packages/routing * packages/routing
* packages/luci * packages/luci
This diff is collapsed.
...@@ -11,57 +11,114 @@ is a requirement. At the moment, Gluon's scripts can't handle devices ...@@ -11,57 +11,114 @@ is a requirement. At the moment, Gluon's scripts can't handle devices
without WLAN adapters (although such environments may also be interesting, without WLAN adapters (although such environments may also be interesting,
e.g. for automated testing in virtual machines). e.g. for automated testing in virtual machines).
.. _hardware-adding-profiles: .. _hardware-adding-profiles:
Adding profiles Adding profiles
--------------- ---------------
The vast majority of devices with ath9k WLAN uses the ar71xx target of OpenWrt. The vast majority of devices with ath9k WLAN uses the ar71xx target of LEDE.
If the hardware you want to add support for is also ar71xx, adding a new profile If the hardware you want to add support for is also ar71xx, adding a new profile
is enough. is enough.
Profiles are defined in ``targets/<target>-<subtarget>/profiles.mk``. There are two macros Profiles are defined in ``targets/*`` in a shell-based DSL (so common shell
used to define which images are generated: ``GluonProfile`` and ``GluonModel``. The following examples commands syntax like ``if`` can be used.
are taken from ``profiles.mk`` of the ``ar71xx-generic`` target::
$(eval $(call GluonProfile,TLWR1043)) The ``device`` command is used to define an image build for a device. It takes
$(eval $(call GluonModel,TLWR1043,tl-wr1043nd-v1-squashfs,tp-link-tl-wr1043n-nd-v1)) two or three parameters.
$(eval $(call GluonModel,TLWR1043,tl-wr1043nd-v2-squashfs,tp-link-tl-wr1043n-nd-v2))
The ``GluonProfile`` macro takes at least one parameter, the profile name as it is The first parameter defines the Gluon profile name, which is used to refer to the
defined in the Makefiles of OpenWrt (``openwrt/target/linux/<target>/<subtarget>/profiles/*`` device and is part of the generated image name. The profile name must be same as
and ``openwrt/target/linux/<target>/image/Makefile``). If the target you are on doesn't define the output of the following command (on the target device), so the autoupdater
profiles (e.g. on x86), just add a single profile called ``Generic`` or similar. can work::
It may optionally take a second parameter which defines additional packages to include for the profile lua -e 'print(require("platform_info").get_image_name())'
(e.g. ath10k). The additional packages defined in ``openwrt/target/linux/<target>/<subtarget>/profiles/*``
aren't used.
The ``GluonModel`` macro takes three parameters: The profile name, the suffix of the image file The second parameter defines the name of the image files generated by LEDE. Usually,
generated by OpenWrt (without the file extension), and the final image name of the Gluon image. it is also the LEDE profile name; for devices that still use the old image build
The final image name must be the same that is returned by the following command. code, a third parameter with the LEDE profile name can be passed. The profile names
can be found in the image Makefiles in ``lede/target/linux/<target>/image/Makefile``.
:: Examples::
lua -e 'print(require("platform_info").get_image_name())' device tp-link-tl-wr1043n-nd-v1 tl-wr1043nd-v1
device alfa-network-hornet-ub hornet-ub HORNETUB
Suffixes and extensions
'''''''''''''''''''''''
By default, image files are expected to have the extension ``.bin``. In addition,
the images generated by LEDE have a suffix before the extension that defaults to
``-squashfs-factory`` and ``-squashfs-sysupgrade``.
This can be changed using the ``factory`` and ``sysupgrade`` commands, either at
the top of the file to set the defaults for all images, or for a single image. There
are three forms with 0 to 2 arguments (all work with ``sysupgrade`` as well)::
factory SUFFIX .EXT
factory .EXT
factory
When only an extension is given, the default suffix is retained. When no arguments
are given, this signals that no factory (or sysupgrade) image exists.
Aliases
'''''''
Sometimes multiple models use the same LEDE images. In this case, the ``alias``
command can be used to create symlinks and additional entries in the autoupdater
manifest for the alternative models.
Standalone images
'''''''''''''''''
On targets without *per-device rootfs* support in LEDE, the commands described above
can't be used. Instead, ``factory_image`` and ``sysupgrade_image`` are used::
factory_image PROFILE IMAGE .EXT
sysupgrade_image PROFILE IMAGE .EXT
This is just so the autoupdater can work. The command has to be executed _on_ the target (eg. the hardware router with a flashed image). So you'll first have to build an image with a guessed name, and afterwards build a new, correctly named image. On targets which aren't supported by the autoupdater, Again, the profile name must match the value printed by the aforementioned Lua
``require("platform_info").get_image_name()`` will just return ``nil`` and the final image name command. The image name must match the part between the target name and the extension
may be defined arbitrarily. as generated by LEDE and is to be omitted when no such part exists.
Packages
''''''''
The ``packages`` command takes an arbitrary number of arguments. Each argument
defines an additional package to include in the images in addition to the default
package sets defined by LEDE. When a package name is prefixed by a minus sign, the
packages are excluded instead.
The ``packages`` command may be used at the top of a target definition to modify
the default package list for all images, or just for a single device (when the
target supports *per-default rootfs*).
Configuration
'''''''''''''
The ``config`` command allows to add arbitary target-specific LEDE configuration
to be emitted to ``.config``.
Notes
'''''
On devices with multiple WLAN adapters, care must also be taken that the primary MAC address is On devices with multiple WLAN adapters, care must also be taken that the primary MAC address is
configured correctly. ``/lib/gluon/core/sysconfig/primary_mac`` should contain the MAC address which configured correctly. ``/lib/gluon/core/sysconfig/primary_mac`` should contain the MAC address which
can be found on a label on most hardware; if it does not, ``/lib/gluon/upgrade/010-primary-mac`` can be found on a label on most hardware; if it does not, ``/lib/gluon/upgrade/010-primary-mac``
in ``gluon-core`` might need a fix. (There have also been cases in which the address was incorrect in ``gluon-core`` might need a fix. (There have also been cases in which the address was incorrect
even on devices with only one WLAN adapter, in these cases an OpenWrt bug was the cause). even on devices with only one WLAN adapter, in these cases a LEDE bug was the cause).
Adding support for new hardware targets Adding support for new hardware targets
--------------------------------------- ---------------------------------------
Adding a new target is much more complex than adding a new profile. There are two basic steps Adding a new target is much more complex than adding a new profile. There are two basic steps
required for adding a new target: required for adding a new target:
Adjust packages Package adjustments
''''''''''''''' '''''''''''''''''''
One package that definitely needs adjustments for every new target added is ``libplatforminfo`` (to be found in One package that definitely needs adjustments for every new target added is ``libplatforminfo`` (to be found in
`packages/gluon/libs/libplatforminfo <https://github.com/freifunk-gluon/packages/tree/master/libs/libplatforminfo>`_). `packages/gluon/libs/libplatforminfo <https://github.com/freifunk-gluon/packages/tree/master/libs/libplatforminfo>`_).
Start with a copy of an existing platform info source file and adjust it for the new target (or just add a symlink if Start with a copy of an existing platform info source file and adjust it for the new target (or just add a symlink if
...@@ -71,15 +128,14 @@ On many targets, Gluon's network setup scripts (mainly in the packages ``gluon-c ...@@ -71,15 +128,14 @@ On many targets, Gluon's network setup scripts (mainly in the packages ``gluon-c
won't run correctly without some adjustments, so better double check that everything is fine there (and the files won't run correctly without some adjustments, so better double check that everything is fine there (and the files
``primary_mac``, ``lan_ifname`` and ``wan_ifname`` in ``/lib/gluon/core/sysconfig/`` contain sensible values). ``primary_mac``, ``lan_ifname`` and ``wan_ifname`` in ``/lib/gluon/core/sysconfig/`` contain sensible values).
Add support to the build system Build system support
''''''''''''''''''''''''''''''' ''''''''''''''''''''
A directory for the new target must be created under ``targets``, and it must be added
to ``targets/targets.mk``. In the new target directory, the following files must be created:
* profiles.mk
* config (optional)
For ``profiles.mk``, see :ref:`hardware-adding-profiles`. A definition for the new target must be created under ``targets``, and it must be added
The file ``config`` can be used to add additional, target-specific options to the OpenWrt config. to ``targets/targets.mk``. The ``GluonTarget`` macro takes one to three arguments:
the target name, the Gluon subtarget name (if the target has subtargets), and the
LEDE subtarget name (if it differs from the Gluon subtarget). The third argument
can be used to define multiple Gluon targets with different configuration for the
same LEDE target, like it is done for the ``ar71xx-tiny`` target.
After this, is should be sufficient to call ``make GLUON_TARGET=<target>`` to build the images for the new target. After this, is should be sufficient to call ``make GLUON_TARGET=<target>`` to build the images for the new target.
## gluon site.mk makefile example ## gluon site.mk makefile example
## GLUON_SITE_PACKAGES ## GLUON_SITE_PACKAGES
# specify gluon/openwrt packages to include here # specify Gluon/LEDE packages to include here
# The gluon-mesh-batman-adv-* package must come first because of the dependency resolution
GLUON_SITE_PACKAGES := \ GLUON_SITE_PACKAGES := \
gluon-mesh-batman-adv-15 \
gluon-alfred \ gluon-alfred \
gluon-respondd \ gluon-respondd \
gluon-autoupdater \ gluon-autoupdater \
...@@ -21,6 +19,7 @@ GLUON_SITE_PACKAGES := \ ...@@ -21,6 +19,7 @@ GLUON_SITE_PACKAGES := \
gluon-luci-autoupdater \ gluon-luci-autoupdater \
gluon-luci-portconfig \ gluon-luci-portconfig \
gluon-luci-wifi-config \ gluon-luci-wifi-config \
gluon-mesh-batman-adv-15 \
gluon-mesh-vpn-fastd \ gluon-mesh-vpn-fastd \
gluon-radvd \ gluon-radvd \
gluon-setup-mode \ gluon-setup-mode \
......
...@@ -85,7 +85,6 @@ Next go back to the top-level Gluon directory and build Gluon:: ...@@ -85,7 +85,6 @@ Next go back to the top-level Gluon directory and build Gluon::
make update # Get other repositories used by Gluon make update # Get other repositories used by Gluon
make GLUON_TARGET=ar71xx-generic # Build Gluon make GLUON_TARGET=ar71xx-generic # Build Gluon
When calling make, the OpenWrt build environment is prepared/updated.
In case of errors read the messages carefully and try to fix the stated issues (e.g. install tools not available yet). In case of errors read the messages carefully and try to fix the stated issues (e.g. install tools not available yet).
``ar71xx-generic`` is the most common target and will generate images for most of the supported hardware. ``ar71xx-generic`` is the most common target and will generate images for most of the supported hardware.
...@@ -95,7 +94,7 @@ You should reserve about 10GB of disk space for each `GLUON_TARGET`. ...@@ -95,7 +94,7 @@ You should reserve about 10GB of disk space for each `GLUON_TARGET`.
The built images can be found in the directory `output/images`. Of these, the `factory` The built images can be found in the directory `output/images`. Of these, the `factory`
images are to be used when flashing from the original firmware a device came with, images are to be used when flashing from the original firmware a device came with,
and `sysupgrade` is to upgrade from other versions of Gluon or any other OpenWrt-based and `sysupgrade` is to upgrade from other versions of Gluon or any other OpenWrt/LEDE-based
system. system.
**Note:** The images for some models are identical; to save disk space, symlinks are generated instead **Note:** The images for some models are identical; to save disk space, symlinks are generated instead
...@@ -111,39 +110,25 @@ There are two levels of `make clean`:: ...@@ -111,39 +110,25 @@ There are two levels of `make clean`::
make clean GLUON_TARGET=ar71xx-generic make clean GLUON_TARGET=ar71xx-generic
will ensure all packages are rebuilt for a single target; this is what you normally want to do after an update. will ensure all packages are rebuilt for a single target. This normally not
necessary, but may fix certain kinds of build failures.
:: ::
make dirclean make dirclean
will clean the entire tree, so the toolchain will be rebuilt as well, which is will clean the entire tree, so the toolchain will be rebuilt as well, which will take a while.
not necessary in most cases, and will take a while.
So in summary, to update and rebuild a Gluon build tree, the following commands should be used (repeat the
``make clean`` and ``make`` for all targets you want to build):
::
git pull
(cd site && git pull)
make update
make clean GLUON_TARGET=ar71xx-generic
make GLUON_TARGET=ar71xx-generic
opkg repositories opkg repositories
----------------- -----------------
Gluon is mostly compatible with OpenWrt, so the normal OpenWrt package repositories Gluon is mostly compatible with LEDE, so the normal LEDE package repositories
can be used for Gluon as well. It is advisable to setup a mirror or reverse proxy can be used for Gluon as well.
reachable over IPv6 and add it to ``site.conf`` as http://downloads.openwrt.org/ does
not support IPv6.
This is not true for kernel modules; the Gluon kernel is incompatible with the This is not true for kernel modules; the Gluon kernel is incompatible with the
kernel of the default OpenWrt images. Therefore, Gluon will not only generate images, kernel of the default LEDE images. Therefore, Gluon will not only generate images,
but also an opkg repository containing all kernel modules provided by OpenWrt/Gluon but also an opkg repository containing all core packages provided by LEDE,
for the kernel of the generated images. including modules for the kernel of the generated images.
Signing keys Signing keys
............ ............
...@@ -151,18 +136,14 @@ Signing keys ...@@ -151,18 +136,14 @@ Signing keys
Gluon does not support HTTPS for downloading packages; fortunately, opkg deploys Gluon does not support HTTPS for downloading packages; fortunately, opkg deploys
public-key cryptography to ensure package integrity. public-key cryptography to ensure package integrity.
The Gluon images will contain two public keys: the official OpenWrt signing key The Gluon images will contain public keys from two sources: the official LEDE keyring
(to allow installing userspace packages) and a Gluon-specific key (which is used (to allow installing userspace packages) and a Gluon-specific key (which is used
to sign the generated module repository). to sign the generated package repository).
By default, Gluon will handle the generation and handling of the keys itself. LEDE will handle the generation and handling of the keys itself.
When making firmware releases based on Gluon, it might make sense to store When making firmware releases based on Gluon, it might make sense to store
the keypair, so updating the module repository later is possible. the keypair, so updating the module repository later is possible.
The location the keys are stored at and read from can be changed
(see :ref:`getting-started-make-variables`). To only generate the keypair
at the configured location without doing a full build, use ``make create-key``.
.. _getting-started-make-variables: .. _getting-started-make-variables:
Make variables Make variables
...@@ -217,13 +198,8 @@ GLUON_BUILDDIR ...@@ -217,13 +198,8 @@ GLUON_BUILDDIR
GLUON_IMAGEDIR GLUON_IMAGEDIR
Path where images will be stored. Defaults to ``$(GLUON_OUTPUTDIR)/images``. Path where images will be stored. Defaults to ``$(GLUON_OUTPUTDIR)/images``.
GLUON_MODULEDIR GLUON_PACKAGEDIR
Path where the kernel module opkg repository will be stored. Defaults to ``$(GLUON_OUTPUTDIR)/modules``. Path where the opkg package repository will be stored. Defaults to ``$(GLUON_OUTPUTDIR)/packages``.
GLUON_OPKG_KEY
Path key file used to sign the module opkg repository. Defaults to ``$(GLUON_BULDDIR)/gluon-opkg-key``.
The private key will be stored as ``$(GLUON_OPKG_KEY)``, the public key as ``$(GLUON_OPKG_KEY).pub``.
GLUON_OUTPUTDIR GLUON_OUTPUTDIR
Path where output files will be stored. Defaults to ``output``. Path where output files will be stored. Defaults to ``output``.
......
...@@ -56,23 +56,27 @@ opkg \: optional ...@@ -56,23 +56,27 @@ opkg \: optional
There are two optional fields in the ``opkg`` section: There are two optional fields in the ``opkg`` section:
- ``openwrt`` overrides the default OpenWrt repository URL - ``lede`` overrides the default LEDE repository URL. The default URL would
correspond to ``http://downloads.lede-project.org/snapshots/packages/%A``
and usually doesn't need to be changed when nodes are expected to have IPv6
internet connectivity.
- ``extra`` specifies a table of additional repositories (with arbitrary keys) - ``extra`` specifies a table of additional repositories (with arbitrary keys)
:: ::
opkg = { opkg = {
openwrt = 'http://opkg.services.ffac/openwrt/%n/%v/%S/packages', lede = 'http://opkg.services.ffac/lede/snapshots/packages/%A',
extra = { extra = {
modules = 'http://opkg.services.ffac/modules/gluon-%GS-%GR/%S', gluon = 'http://opkg.services.ffac/modules/gluon-%GS-%GR/%S',
}, },
} }
There are various patterns which can be used in the URLs: There are various patterns which can be used in the URLs:
- ``%n`` is replaced by the OpenWrt version codename (e.g. "chaos_calmer") - ``%n`` is replaced by the LEDE version codename
- ``%v`` is replaced by the OpenWrt version number (e.g. "15.05") - ``%v`` is replaced by the LEDE version number (e.g. "17.01")
- ``%S`` is replaced by the target architecture (e.g. "ar71xx/generic") - ``%S`` is replaced by the target board (e.g. "ar71xx/generic")
- ``%A`` is replaced by the target architecture (e.g. "mips_24kc")
- ``%GS`` is replaced by the Gluon site code (as specified in ``site.conf``) - ``%GS`` is replaced by the Gluon site code (as specified in ``site.conf``)
- ``%GV`` is replaced by the Gluon version - ``%GV`` is replaced by the Gluon version
- ``%GR`` is replaced by the Gluon release (as specified in ``site.mk``) - ``%GR`` is replaced by the Gluon release (as specified in ``site.mk``)
......
CONFIG_IMAGEOPT=y
# CONFIG_PER_FEED_REPO is not set
# CONFIG_TARGET_ROOTFS_INITRAMFS is not set
CONFIG_DEVEL=y
CONFIG_ALL_KMODS=y
CONFIG_BUSYBOX_CUSTOM=y
CONFIG_BUSYBOX_CONFIG_SHA512SUM=y
# CONFIG_BUSYBOX_CONFIG_FEATURE_PREFER_IPV4_ADDRESS is not set
CONFIG_BUSYBOX_CONFIG_IP=y
CONFIG_BUSYBOX_CONFIG_FEATURE_IP_ADDRESS=y
CONFIG_BUSYBOX_CONFIG_FEATURE_IP_LINK=y
CONFIG_BUSYBOX_CONFIG_FEATURE_IP_ROUTE=y
CONFIG_BUSYBOX_CONFIG_FEATURE_IP_TUNNEL=y
CONFIG_BUSYBOX_CONFIG_FEATURE_IP_RULE=y
CONFIG_BUSYBOX_CONFIG_FEATURE_IP_SHORT_FORMS=y
CONFIG_BUSYBOX_CONFIG_FEATURE_WGET_TIMEOUT=y
CONFIG_ATH_USER_REGD=y
CONFIG_PACKAGE_ATH_DEBUG=y
CONFIG_LUCI_SRCDIET=y
ifneq ($(__gluon_inc),1)
__gluon_inc=1
GLUON_SITEDIR ?= $(GLUONDIR)/site
GLUON_BUILDDIR ?= $(GLUONDIR)/build
GLUON_ORIGOPENWRTDIR := $(GLUONDIR)/openwrt
GLUON_SITE_CONFIG := $(GLUON_SITEDIR)/site.conf
GLUON_OUTPUTDIR ?= $(GLUONDIR)/output
GLUON_IMAGEDIR ?= $(GLUON_OUTPUTDIR)/images
GLUON_MODULEDIR ?= $(GLUON_OUTPUTDIR)/modules
GLUON_OPKG_KEY ?= $(GLUON_BUILDDIR)/gluon-opkg-key
export GLUONDIR GLUON_SITEDIR GLUON_BUILDDIR GLUON_SITE_CONFIG GLUON_OUTPUTDIR GLUON_IMAGEDIR GLUON_MODULEDIR
BOARD_BUILDDIR = $(GLUON_BUILDDIR)/$(GLUON_TARGET)
BOARD_KDIR = $(BOARD_BUILDDIR)/kernel
export BOARD_BUILDDIR
LINUX_RELEASE := 2
export LINUX_RELEASE
GLUON_OPENWRTDIR = $(BOARD_BUILDDIR)/openwrt
$(GLUON_SITEDIR)/site.mk:
$(error There was no site configuration found. Please check out a site configuration to $(GLUON_SITEDIR))
-include $(GLUON_SITEDIR)/site.mk
GLUON_VERSION := $(shell cd $(GLUONDIR) && git describe --always --dirty=+ 2>/dev/null || echo unknown)
export GLUON_VERSION
GLUON_SITE_VERSION := $(shell cd $(GLUON_SITEDIR) && git --git-dir=.git describe --always --dirty=+ 2>/dev/null || echo unknown)
export GLUON_SITE_VERSION
GLUON_LANGS ?= en
export GLUON_LANGS
ifeq ($(OPENWRT_BUILD),1)
ifeq ($(GLUON_TOOLS),1)
GLUON_OPENWRT_FEEDS := base packages luci routing telephony management
export GLUON_OPENWRT_FEEDS
GLUON_SITE_CODE := $(shell $(GLUONDIR)/scripts/site.sh site_code)
export GLUON_SITE_CODE
ifeq ($(GLUON_RELEASE),)
$(error GLUON_RELEASE not set. GLUON_RELEASE can be set in site.mk or on the command line.)
endif
export GLUON_RELEASE
endif
endif
define merge-lists
$(1) :=
$(foreach var,$(2),$(1) := $$(filter-out -% $$(patsubst -%,%,$$(filter -%,$$($(var)))),$$($(1)) $$($(var)))
)
endef
GLUON_TARGETS :=
define GluonTarget
gluon_target := $(1)$$(if $(2),-$(2))
GLUON_TARGETS += $$(gluon_target)
GLUON_TARGET_$$(gluon_target)_BOARD := $(1)
GLUON_TARGET_$$(gluon_target)_SUBTARGET := $(2)
endef
GLUON_DEFAULT_PACKAGES := gluon-core firewall ip6tables -uboot-envtools -wpad-mini hostapd-mini
override DEFAULT_PACKAGES.router :=
endif #__gluon_inc
# Makefile for OpenWrt
#
# Copyright (C) 2007-2012 OpenWrt.org
# Copyright (C) 2013-2014 Project Gluon
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
RELEASE:=Chaos Calmer
PREP_MK= OPENWRT_BUILD= QUIET=0
export IS_TTY=$(shell tty -s && echo 1 || echo 0)
include $(GLUONDIR)/include/verbose.mk
REVISION:=$(shell [ -d $(TOPDIR) ] && cd $(TOPDIR) && ./scripts/getver.sh 2>/dev/null)
HOSTCC ?= gcc
OPENWRTVERSION:=$(RELEASE)$(if $(REVISION), ($(REVISION)))
export RELEASE
export REVISION
export OPENWRTVERSION
export IS_TTY=$(shell tty -s && echo 1 || echo 0)
export LD_LIBRARY_PATH:=$(subst ::,:,$(if $(LD_LIBRARY_PATH),$(LD_LIBRARY_PATH):)$(STAGING_DIR_HOST)/lib)
export DYLD_LIBRARY_PATH:=$(subst ::,:,$(if $(DYLD_LIBRARY_PATH),$(DYLD_LIBRARY_PATH):)$(STAGING_DIR_HOST)/lib)
export GIT_CONFIG_PARAMETERS='core.autocrlf=false'
export MAKE_JOBSERVER=$(filter --jobserver%,$(MAKEFLAGS))
# prevent perforce from messing with the patch utility
unexport P4PORT P4USER P4CONFIG P4CLIENT
# prevent user defaults for quilt from interfering
unexport QUILT_PATCHES QUILT_PATCH_OPTS
unexport C_INCLUDE_PATH CROSS_COMPILE ARCH
# prevent distro default LPATH from interfering
unexport LPATH
# make sure that a predefined CFLAGS variable does not disturb packages
export CFLAGS=
ifneq ($(shell $(HOSTCC) 2>&1 | grep clang),)
export HOSTCC_REAL?=$(HOSTCC)
export HOSTCC_WRAPPER:=$(TOPDIR)/scripts/clang-gcc-wrapper
else
export HOSTCC_WRAPPER:=$(HOSTCC)
endif
SCAN_COOKIE?=$(shell echo $$$$)
export SCAN_COOKIE
SUBMAKE:=umask 022; $(SUBMAKE)
ULIMIT_FIX=_limit=`ulimit -n`; [ "$$_limit" = "unlimited" -o "$$_limit" -ge 1024 ] || ulimit -n 1024;
FORCE: ;
.PHONY: FORCE
.NOTPARALLEL:
#
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
ifndef OPENWRT_VERBOSE
OPENWRT_VERBOSE:=
endif
ifeq ("$(origin V)", "command line")
OPENWRT_VERBOSE:=$(V)
endif
ifeq ($(OPENWRT_VERBOSE),1)
OPENWRT_VERBOSE:=w
endif
ifeq ($(OPENWRT_VERBOSE),99)
OPENWRT_VERBOSE:=s
endif
ifeq ($(NO_TRACE_MAKE),)
NO_TRACE_MAKE := $(MAKE) V=s$(OPENWRT_VERBOSE)
export NO_TRACE_MAKE
endif
ifeq ($(IS_TTY),1)
ifneq ($(strip $(NO_COLOR)),1)
_Y:=\\033[33m
_R:=\\033[31m
_N:=\\033[m
endif
endif
ifeq ($(findstring s,$(OPENWRT_VERBOSE)),)
define MESSAGE
printf "$(_Y)%s$(_N)\n" "$(1)" >&8
endef
define ERROR_MESSAGE
printf "$(_R)%s$(_N)\n" "$(1)" >&8
endef
ifeq ($(QUIET),1)
ifneq ($(CURDIR),$(TOPDIR))
_DIR:=$(patsubst $(TOPDIR)/%,%,${CURDIR})
else
_DIR:=
endif
_NULL:=$(if $(MAKECMDGOALS),$(shell \
$(call MESSAGE, make[$(MAKELEVEL)]$(if $(_DIR), -C $(_DIR)) $(MAKECMDGOALS)); \
))
SUBMAKE=$(MAKE)
else
SILENT:=>/dev/null $(if $(findstring w,$(OPENWRT_VERBOSE)),,2>&1)
export QUIET:=1
SUBMAKE=cmd() { $(SILENT) $(MAKE) -s $$* < /dev/null || { echo "make $$*: build failed. Please re-run make with V=s to see what's going on"; false; } } 8>&1 9>&2; cmd
endif
.SILENT: $(MAKECMDGOALS)
else
SUBMAKE=$(MAKE) -w
define MESSAGE
printf "%s\n" "$(1)"
endef
ERROR_MESSAGE=$(MESSAGE)
endif
GLUON_FEEDS='openwrt gluon routing luci' GLUON_FEEDS='openwrt gluon routing luci'
OPENWRT_REPO=git://github.com/openwrt/openwrt.git LEDE_REPO=git://git.lede-project.org/source.git
OPENWRT_COMMIT=0f757bd2606971252f901ef3faf4dbd0086315f7 LEDE_COMMIT=b9a408c2b49ccfa0e906bda00ef77f4002e401fd
OPENWRT_BRANCH=chaos_calmer
PACKAGES_OPENWRT_REPO=git://github.com/openwrt/packages.git PACKAGES_OPENWRT_REPO=git://github.com/openwrt/packages.git
PACKAGES_OPENWRT_COMMIT=73776792f7d58e982be9e5819450d4875b273159 PACKAGES_OPENWRT_COMMIT=ee211f94ec292f7ec3d563fcbc147359b6cf8290
PACKAGES_OPENWRT_BRANCH=for-15.05
PACKAGES_GLUON_REPO=git://github.com/freifunk-gluon/packages.git PACKAGES_GLUON_REPO=git://github.com/freifunk-gluon/packages.git
PACKAGES_GLUON_COMMIT=5c25ed888f9f2e05652a994fc0212e34304d58fa PACKAGES_GLUON_COMMIT=ef405e224082c26807fe24c02da9b02135fa46d0
PACKAGES_ROUTING_REPO=git://github.com/openwrt-routing/packages.git PACKAGES_ROUTING_REPO=git://github.com/openwrt-routing/packages.git
PACKAGES_ROUTING_COMMIT=d848d49d2443448b147c564c2dd8f64433b5fb9c PACKAGES_ROUTING_COMMIT=d848d49d2443448b147c564c2dd8f64433b5fb9c
......
FEEDS_ENABLED := $(FEEDS_DISABLED)
FEEDS_DISABLED :=
...@@ -2,11 +2,13 @@ include $(TOPDIR)/rules.mk ...@@ -2,11 +2,13 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-autoupdater PKG_NAME:=gluon-autoupdater
PKG_VERSION:=4 PKG_VERSION:=4
PKG_RELEASE:=$(GLUON_BRANCH)
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
PKG_CONFIG_DEPENDS := CONFIG_GLUON_BRANCH
PKG_BUILD_DEPENDS := respondd PKG_BUILD_DEPENDS := respondd
include ../gluon.mk include ../gluon.mk
...@@ -17,6 +19,13 @@ define Package/gluon-autoupdater ...@@ -17,6 +19,13 @@ define Package/gluon-autoupdater
TITLE:=Automatically update firmware TITLE:=Automatically update firmware
endef endef
define Package/gluon-autoupdater/config
config GLUON_BRANCH
string "Gluon autoupdater branch"
depends on PACKAGE_gluon-autoupdater
default ""
endef
define Build/Prepare define Build/Prepare
mkdir -p $(PKG_BUILD_DIR) mkdir -p $(PKG_BUILD_DIR)
$(CP) ./src/* $(PKG_BUILD_DIR)/ $(CP) ./src/* $(PKG_BUILD_DIR)/
...@@ -34,10 +43,10 @@ define Package/gluon-autoupdater/install ...@@ -34,10 +43,10 @@ define Package/gluon-autoupdater/install
$(INSTALL_DIR) $(1)/lib/gluon/respondd $(INSTALL_DIR) $(1)/lib/gluon/respondd
$(CP) $(PKG_BUILD_DIR)/respondd.so $(1)/lib/gluon/respondd/autoupdater.so $(CP) $(PKG_BUILD_DIR)/respondd.so $(1)/lib/gluon/respondd/autoupdater.so
if [ '$(GLUON_BRANCH)' ]; then \ ifneq ($(CONFIG_GLUON_BRANCH),"")
$(INSTALL_DIR) $(1)/lib/gluon/autoupdater; \ $(INSTALL_DIR) $(1)/lib/gluon/autoupdater
echo '$(GLUON_BRANCH)' > $(1)/lib/gluon/autoupdater/default_branch; \ echo '$(call qstrip,$(CONFIG_GLUON_BRANCH))' > $(1)/lib/gluon/autoupdater/default_branch
fi endif
endef endef
define Package/gluon-autoupdater/postinst define Package/gluon-autoupdater/postinst
......
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-core PKG_NAME:=gluon-core
PKG_VERSION:=3
PKG_RELEASE:=$(GLUON_VERSION) GLUON_VERSION = $(shell git describe --always --dirty=+ 2>/dev/null || echo unknown)
PKG_VERSION:=$(if $(DUMP),x,$(GLUON_VERSION))
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
...@@ -20,10 +22,6 @@ define Package/gluon-core/description ...@@ -20,10 +22,6 @@ define Package/gluon-core/description
Gluon community wifi mesh firmware framework: core Gluon community wifi mesh firmware framework: core
endef endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure define Build/Configure
endef endef
...@@ -34,11 +32,9 @@ endef ...@@ -34,11 +32,9 @@ endef
define Package/gluon-core/install define Package/gluon-core/install
$(CP) ./files/* $(1)/ $(CP) ./files/* $(1)/
$(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/ $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/
$(SED) 's/__GLUON_OPENWRT_FEEDS__/{$(GLUON_OPENWRT_FEEDS:%="%",)}/' $(1)/lib/gluon/upgrade/500-opkg
$(INSTALL_DIR) $(1)/lib/gluon $(INSTALL_DIR) $(1)/lib/gluon
echo "$(GLUON_VERSION)" > $(1)/lib/gluon/gluon-version echo '$(GLUON_VERSION)' > $(1)/lib/gluon/gluon-version
echo "$(GLUON_SITE_VERSION)" > $(1)/lib/gluon/site-version
endef endef
define Package/gluon-core/postinst define Package/gluon-core/postinst
......
...@@ -2,7 +2,7 @@ need_string 'site_code' ...@@ -2,7 +2,7 @@ need_string 'site_code'
need_string 'site_name' need_string 'site_name'
if need_table('opkg', nil, false) then if need_table('opkg', nil, false) then
need_string('opkg.openwrt', false) need_string('opkg.lede', false)
function check_repo(k, _) function check_repo(k, _)
-- this is not actually a uci name, but using the same naming rules here is fine -- this is not actually a uci name, but using the same naming rules here is fine
......
...@@ -8,7 +8,7 @@ local util = require 'luci.util' ...@@ -8,7 +8,7 @@ local util = require 'luci.util'
local subst = {} local subst = {}
subst['%%v'] = util.trim(fs.readfile('/etc/openwrt_version')) subst['%%v'] = util.trim(fs.readfile('/etc/openwrt_version'))
subst['%%n'], subst['%%S'] = util.exec('. /etc/openwrt_release; echo $DISTRIB_CODENAME; echo $DISTRIB_TARGET'):match('([^\n]*)\n([^\n]*)') subst['%%n'], subst['%%S'], subst['%%A'] = util.exec('. /etc/openwrt_release; echo "$DISTRIB_CODENAME"; echo "$DISTRIB_TARGET"; echo "$DISTRIB_ARCH"'):match('([^\n]*)\n([^\n]*)\n([^\n]*)')
subst['%%GS'] = site.site_code subst['%%GS'] = site.site_code
subst['%%GV'] = util.trim(fs.readfile('/lib/gluon/gluon-version')) subst['%%GV'] = util.trim(fs.readfile('/lib/gluon/gluon-version'))
subst['%%GR'] = util.trim(fs.readfile('/lib/gluon/release')) subst['%%GR'] = util.trim(fs.readfile('/lib/gluon/release'))
...@@ -22,19 +22,29 @@ function replace_patterns(url) ...@@ -22,19 +22,29 @@ function replace_patterns(url)
end end
if site.opkg then local prefix = subst['%%n'] .. '_'
if site.opkg.openwrt then
local url = replace_patterns(site.opkg.openwrt) local distfeeds = {}
for line in io.lines('/etc/opkg/distfeeds.conf') do
table.insert(distfeeds, line)
end
local f = io.open('/etc/opkg/distfeeds.conf', 'w') local f = io.open('/etc/opkg/distfeeds.conf', 'w')
for _, v in ipairs(__GLUON_OPENWRT_FEEDS__) do for _, line in ipairs(distfeeds) do
f:write(replace_patterns(string.format('src/gz %%n_%s %s/%s\n', v, site.opkg.openwrt, v))) local name = line:match('^src/gz%s' .. prefix .. '(%S+)%s')
if name == 'core' then
f:write('# ' .. line .. '\n')
elseif name and site.opkg and site.opkg.lede then
f:write(string.format('src/gz %s %s/%s\n', prefix .. name, replace_patterns(site.opkg.lede), name))
else
f:write(line .. '\n')
end
end end
f:close() f:close()
end
if site.opkg.extra and next(site.opkg.extra) then if site.opkg and site.opkg.extra and next(site.opkg.extra) then
local f = io.open('/etc/opkg/gluon.conf', 'w') local f = io.open('/etc/opkg/gluon.conf', 'w')
for k, v in pairs(site.opkg.extra) do for k, v in pairs(site.opkg.extra) do
...@@ -46,4 +56,3 @@ if site.opkg then ...@@ -46,4 +56,3 @@ if site.opkg then
else else
os.remove('/etc/opkg/gluon.conf') os.remove('/etc/opkg/gluon.conf')
end end
end
/etc/init.d/dropbear
\ No newline at end of file
#!/bin/sh /etc/rc.common #!/bin/sh /etc/rc.common
if /etc/init.d/haveged enabled; then if [ -x /etc/init.d/haveged ] && /etc/init.d/haveged enabled; then
. /etc/init.d/haveged . /etc/init.d/haveged
fi fi
/etc/init.d/dropbear
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment