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