2014-02-20 16:22:06 +00:00
Getting Started
===============
2014-10-12 10:17:02 +00:00
Selecting the right version
---------------------------
2015-11-05 21:42:34 +00:00
Gluon's releases are managed using `Git tags`_ . If you are just getting
2015-02-26 11:29:53 +00:00
started with Gluon we recommend to use the latest stable release of Gluon.
2014-10-12 10:17:02 +00:00
2014-10-13 10:23:41 +00:00
Take a look at the `list of gluon releases`_ and notice the latest release,
2022-09-05 15:22:04 +00:00
e.g. *v2022.1* . Always get Gluon using git and don't try to download it
2015-11-05 21:42:34 +00:00
as a Zip archive as the archive will be missing version information.
2014-10-13 10:23:41 +00:00
2015-11-05 21:42:34 +00:00
Please keep in mind that there is no "default Gluon" build; a site configuration
is required to adjust Gluon to your needs. Due to new features being added (or
sometimes being removed) the format of the site configuration changes slightly
between releases. Please refer to our release notes for instructions to update
an old site configuration to a newer release of Gluon.
2014-10-12 10:17:02 +00:00
2015-11-05 21:42:34 +00:00
An example configuration can be found in the Gluon repository at *docs/site-example/* .
2014-10-12 10:17:02 +00:00
2018-11-30 19:11:25 +00:00
.. _Git tags: https://git-scm.com/book/en/v2/Git-Basics-Tagging
2014-10-13 10:23:41 +00:00
.. _list of gluon releases: https://github.com/freifunk-gluon/gluon/releases
2014-10-12 10:17:02 +00:00
2015-03-25 18:14:18 +00:00
Dependencies
------------
To build Gluon, several packages need to be installed on the system. On a
2023-04-01 16:17:59 +00:00
freshly installed Debian Bullseye system the following packages are required:
2015-03-25 18:14:18 +00:00
* `git` (to get Gluon and other dependencies)
2021-08-11 23:27:50 +00:00
* `python3`
2015-03-25 18:14:18 +00:00
* `build-essential`
2023-04-01 16:17:59 +00:00
* `ecdsautils` (to sign firmware, see `contrib/sign.sh` )
2015-03-25 18:14:18 +00:00
* `gawk`
* `unzip`
* `libncurses-dev` (actually `libncurses5-dev` )
* `libz-dev` (actually `zlib1g-dev` )
2015-09-10 21:54:27 +00:00
* `libssl-dev`
2023-04-01 16:17:59 +00:00
* `libelf-dev` (to build x86-64)
2016-10-19 17:06:02 +00:00
* `wget`
2023-04-01 16:17:59 +00:00
* `rsync`
2018-08-07 11:47:19 +00:00
* `time` (built-in `time` doesn't work)
2021-01-12 14:24:20 +00:00
* `qemu-utils`
2015-03-25 18:14:18 +00:00
2021-12-21 20:40:27 +00:00
We also provide a container environment that already tracks all these dependencies. It quickly gets you up and running, if you already have either Docker or Podman installed locally.
::
2021-12-24 13:16:04 +00:00
./scripts/container.sh
2021-12-21 20:40:27 +00:00
2015-03-25 18:14:18 +00:00
Building the images
-------------------
2014-10-12 10:17:02 +00:00
2014-10-13 10:29:24 +00:00
To build Gluon, first check out the repository. Replace *RELEASE* with the
2022-09-05 15:22:04 +00:00
version you'd like to checkout, e.g. *v2022.1* .
2014-10-08 21:38:58 +00:00
::
2021-12-24 13:16:04 +00:00
git clone https://github.com/freifunk-gluon/gluon.git gluon -b RELEASE
2014-10-08 21:38:58 +00:00
2014-10-13 10:23:41 +00:00
This command will create a directory named *gluon/* .
It might also tell a scary message about being in a *detached state* .
**Don't panic!** Everything's fine.
2015-11-05 21:42:34 +00:00
Now, enter the freshly created directory::
2014-10-08 21:38:58 +00:00
2021-12-24 13:16:04 +00:00
cd gluon
2014-10-13 10:23:41 +00:00
2015-11-05 21:42:34 +00:00
It's time to add (or create) your site configuration. If you already
have a site repository, just clone it::
2014-10-13 10:23:41 +00:00
2021-12-24 13:16:04 +00:00
git clone https://github.com/freifunk-alpha-centauri/site-ffac.git site
2015-11-05 21:42:34 +00:00
If you want to build a new site, create a new git repository *site/* ::
2014-10-13 10:23:41 +00:00
2021-12-24 13:16:04 +00:00
mkdir site
cd site
git init
2014-10-13 10:23:41 +00:00
2015-11-05 21:42:34 +00:00
Copy *site.conf* , *site.mk* and *i18n* from *docs/site-example* ::
2014-10-13 10:23:41 +00:00
2021-12-24 13:16:04 +00:00
cp ../docs/site-example/site.conf .
cp ../docs/site-example/site.mk .
cp -r ../docs/site-example/i18n .
2014-10-13 10:23:41 +00:00
2015-11-05 21:42:34 +00:00
Edit these files as you see fit and commit them into the site repository.
Extensive documentation about the site configuration can be found at:
:doc: `site` . The
site directory should always be a git repository by itself; committing site-specific files
to the Gluon main repository should be avoided, as it will make updates more complicated.
2014-07-09 10:43:10 +00:00
2021-12-31 01:48:20 +00:00
Next go back to the top-level Gluon directory and build Gluon\ [#make_update]_ ::
2014-07-09 10:43:10 +00:00
2021-12-24 13:16:04 +00:00
cd ..
2021-12-31 01:48:20 +00:00
make update # Get other repositories used by Gluon
2021-12-24 13:16:04 +00:00
make GLUON_TARGET=ath79-generic # Build Gluon
2014-07-09 10:43:10 +00:00
2019-06-15 09:44:37 +00:00
In case of errors read the messages carefully and try to fix the stated issues
2019-06-24 09:19:21 +00:00
(e.g. install missing tools not available or look for Troubleshooting_ in the wiki.
.. _Troubleshooting: https://github.com/freifunk-gluon/gluon/wiki/Troubleshooting
2014-07-09 10:43:10 +00:00
2021-06-26 00:20:04 +00:00
`` ath79-generic `` is the most common target and will generate images for most of the supported hardware.
2015-03-14 18:20:11 +00:00
To see a complete list of supported targets, call `` make `` without setting `` GLUON_TARGET `` .
2014-07-09 10:43:10 +00:00
2019-06-20 22:42:29 +00:00
To build all targets use a loop like this::
2019-06-15 21:03:17 +00:00
2021-12-24 13:16:04 +00:00
for TARGET in $(make list-targets); do
make GLUON_TARGET=$TARGET
done
2019-06-15 21:03:17 +00:00
2018-07-02 22:06:06 +00:00
You should generally reserve 5GB of disk space and additionally about 10GB for each `GLUON_TARGET` .
2016-02-05 18:02:49 +00:00
The built images can be found in the directory `output/images` . Of these, the `factory`
2014-07-09 10:43:10 +00:00
images are to be used when flashing from the original firmware a device came with,
2018-07-10 20:57:40 +00:00
and `sysupgrade` is to upgrade from other versions of Gluon or any other OpenWrt-based
2014-07-09 10:43:10 +00:00
system.
2016-02-05 18:02:49 +00:00
**Note:** The images for some models are identical; to save disk space, symlinks are generated instead
of multiple copies of the same image. If your webserver's configuration prohibits following
symlinks, you can use the following command to resolve these links while copying the images::
2021-12-24 13:16:04 +00:00
cp -rL output/images /var/www
2016-02-05 18:02:49 +00:00
2020-06-04 20:35:58 +00:00
The directory `output/debug` contains a compressed kernel image for each
architecture.
These can be used for debugging and should be stored along with the images to
allow debugging of kernel problems on devices in the field.
See :ref: `Debugging <dev-debugging-kernel-oops>` for more information.
2021-12-31 01:48:20 +00:00
.. rubric :: Footnotes
.. [#make_update] `` make update `` only needs to be called again after updating the
Gluon repository (using `` git pull `` or similar) or after changing branches,
not for each build. Running it more often than necessary is undesirable, as
the update will take some time, and may undo manual modifications of the
external repositories while developing on Gluon.
See :ref: `working-with-repositories` for more information.
2016-02-05 18:02:49 +00:00
Cleaning the build tree
.......................
2014-07-09 10:43:10 +00:00
2015-11-05 21:42:34 +00:00
There are two levels of `make clean` ::
2014-02-20 16:22:06 +00:00
2021-12-24 13:16:04 +00:00
make clean GLUON_TARGET=ath79-generic
2014-07-09 10:43:10 +00:00
2020-02-20 01:03:37 +00:00
will ensure all packages are rebuilt for a single target. This is usually not
2017-01-18 16:21:43 +00:00
necessary, but may fix certain kinds of build failures.
2014-07-09 10:43:10 +00:00
::
2021-12-24 13:16:04 +00:00
make dirclean
2014-07-09 10:43:10 +00:00
2017-01-18 16:21:43 +00:00
will clean the entire tree, so the toolchain will be rebuilt as well, which will take a while.
2014-08-30 17:55:17 +00:00
2015-10-14 18:12:52 +00:00
opkg repositories
-----------------
2018-07-10 20:57:40 +00:00
Gluon is mostly compatible with OpenWrt, so the normal OpenWrt package repositories
2017-01-18 16:21:43 +00:00
can be used for Gluon as well.
2015-10-14 18:12:52 +00:00
This is not true for kernel modules; the Gluon kernel is incompatible with the
2018-07-10 20:57:40 +00:00
kernel of the default OpenWrt images. Therefore, Gluon will not only generate images,
but also an opkg repository containing all core packages provided by OpenWrt,
2017-01-18 16:21:43 +00:00
including modules for the kernel of the generated images.
2015-10-14 18:12:52 +00:00
Signing keys
............
Gluon does not support HTTPS for downloading packages; fortunately, opkg deploys
public-key cryptography to ensure package integrity.
2018-07-10 20:57:40 +00:00
The Gluon images will contain public keys from two sources: the official OpenWrt keyring
2015-10-14 18:12:52 +00:00
(to allow installing userspace packages) and a Gluon-specific key (which is used
2017-01-18 16:21:43 +00:00
to sign the generated package repository).
2015-10-14 18:12:52 +00:00
2018-07-10 20:57:40 +00:00
OpenWrt will handle the generation and handling of the keys itself.
2015-10-30 15:44:14 +00:00
When making firmware releases based on Gluon, it might make sense to store
2015-10-14 18:12:52 +00:00
the keypair, so updating the module repository later is possible.
2020-11-24 19:54:06 +00:00
In fact you should take care to reuse the same opkg keypair, so you don't pollute the key
store (see `` /etc/opkg/keys `` ) on the node.
The signing-key is stored at `` openwrt/key-build.pub `` , `` openwrt/key-build `` ,
`` key-build.ucert `` and `` key-build.ucert.revoke `` .
The `` openwrt `` directory is the Git checkout, that gets created after calling `` make update `` .
After making a fresh clone copy the key files to the aforementioned locations.
2015-10-14 18:12:52 +00:00
2016-09-11 16:05:28 +00:00
.. _getting-started-make-variables:
2015-10-14 18:12:52 +00:00
2016-09-11 16:05:28 +00:00
Make variables
--------------
2014-08-30 17:55:17 +00:00
2016-09-11 16:05:28 +00:00
Gluon's build process can be controlled by various variables. They can
2016-09-09 00:06:31 +00:00
usually be set on the command line or in `` site.mk `` .
2014-08-30 17:55:17 +00:00
2016-09-11 16:05:28 +00:00
Common variables
................
2014-08-30 17:55:17 +00:00
2020-07-04 10:38:01 +00:00
GLUON_AUTOUPDATER_BRANCH
Overrides the default branch of the autoupdater set in `` site.conf `` . For the `` make manifest `` command,
`` GLUON_AUTOUPDATER_BRANCH `` defines the branch to generate a manifest for.
GLUON_AUTOUPDATER_ENABLED
Set to `` 1 `` to enable the autoupdater by default for newly installed nodes.
2014-08-30 17:55:17 +00:00
2019-06-15 12:34:45 +00:00
GLUON_DEPRECATED
Controls whether images for deprecated devices should be built. The following
values are supported:
- `` 0 `` : Do not build any images for deprecated devices.
- `` upgrade `` : Only build sysupgrade images for deprecated devices.
- `` full `` : Build both sysupgrade and factory images for deprecated devices.
Usually, devices are deprecated because their flash size is insufficient to
support future Gluon versions. The recommended setting is `` 0 `` for new sites,
and `` upgrade `` for existing configurations (where upgrades for existing
2021-12-31 13:44:47 +00:00
deployments of low-flash devices are required). Defaults to `` 0 `` .
2019-06-15 12:34:45 +00:00
2016-09-11 16:05:28 +00:00
GLUON_LANGS
Space-separated list of languages to include for the config mode/advanced settings. Defaults to `` en `` .
`` en `` should always be included, other supported languages are `` de `` and `` fr `` .
GLUON_PRIORITY
Defines the priority of an automatic update in `` make manifest `` . See :doc: `../features/autoupdater` for
a detailed description of this value.
GLUON_REGION
Some devices (at the moment the TP-Link Archer C7) contain a region code that restricts
firmware installations. Set GLUON_REGION to `` eu `` or `` us `` to make the resulting
2019-03-10 19:15:25 +00:00
images installable from the respective stock firmware.
2016-09-11 16:05:28 +00:00
GLUON_RELEASE
Firmware release number: This string is displayed in the config mode, announced
via respondd/alfred and used by the autoupdater to decide if a newer version
2017-08-17 16:09:59 +00:00
is available. The same GLUON_RELEASE has to be passed to `` make `` and `` make manifest ``
to generate a correct manifest.
2016-09-11 16:05:28 +00:00
GLUON_TARGET
Target architecture to build.
Special variables
.................
2020-05-11 21:08:02 +00:00
GLUON_AUTOREMOVE
Setting `` GLUON_AUTOREMOVE=1 `` enables the `` CONFIG_AUTOREMOVE `` OpenWrt setting, which will delete package build
directories after a package build has finished to save space. This is mostly useful for CI builds from scratch. Do
not set this flag during development (or generally, when you want you reuse your build tree for subsequent builds),
as it significantly increases incremental build times.
2019-04-19 21:04:59 +00:00
GLUON_DEBUG
Setting `` GLUON_DEBUG=1 `` will provide firmware images including debugging symbols usable with GDB or
similar tools. Requires a device or target with at least 16 MB of flash space, e.g. `x86-64` . Unset by default.
2020-05-12 22:45:06 +00:00
GLUON_MINIFY
2020-07-04 10:38:01 +00:00
Setting `` GLUON_MINIFY=0 `` will omit the minification of scripts during the build process. By
2020-05-12 22:45:06 +00:00
default the flag is set to `` 1 `` . Disabling the flag is handy if human readable scripts on the
devices are desired for development purposes. Be aware that this will increase the size of the
resulting images and is therefore not suitable for devices with small flash chips.
2019-04-11 23:05:04 +00:00
GLUON_DEVICES
List of devices to build. The list contains the Gluon profile name of a device, the profile
name is the first parameter of the `` device `` command in a target file.
e.g. `` GLUON_DEVICES="avm-fritz-box-4020 tp-link-tl-wdr4300-v1" `` .
Empty by default to build all devices of a target.
2015-10-12 23:18:03 +00:00
GLUON_IMAGEDIR
2015-10-14 18:12:52 +00:00
Path where images will be stored. Defaults to `` $(GLUON_OUTPUTDIR)/images `` .
2015-10-12 23:18:03 +00:00
2017-01-18 16:21:43 +00:00
GLUON_PACKAGEDIR
Path where the opkg package repository will be stored. Defaults to `` $(GLUON_OUTPUTDIR)/packages `` .
2014-07-09 10:43:10 +00:00
2016-09-11 16:05:28 +00:00
GLUON_OUTPUTDIR
Path where output files will be stored. Defaults to `` output `` .
2014-07-09 10:43:10 +00:00
2016-09-11 16:05:28 +00:00
GLUON_SITEDIR
Path to the site configuration. Defaults to `` site `` .