getting_started.rst 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. Getting Started
  2. ===============
  3. Selecting the right version
  4. ---------------------------
  5. Gluon's releases are managed using `Git tags`_. If you are just getting
  6. started with Gluon we recommend to use the latest stable release of Gluon.
  7. Take a look at the `list of gluon releases`_ and notice the latest release,
  8. e.g. *v2017.1.5*. Always get Gluon using git and don't try to download it
  9. as a Zip archive as the archive will be missing version information.
  10. Please keep in mind that there is no "default Gluon" build; a site configuration
  11. is required to adjust Gluon to your needs. Due to new features being added (or
  12. sometimes being removed) the format of the site configuration changes slightly
  13. between releases. Please refer to our release notes for instructions to update
  14. an old site configuration to a newer release of Gluon.
  15. An example configuration can be found in the Gluon repository at *docs/site-example/*.
  16. .. _Git tags: http://git-scm.com/book/en/Git-Basics-Tagging
  17. .. _list of gluon releases: https://github.com/freifunk-gluon/gluon/releases
  18. Dependencies
  19. ------------
  20. To build Gluon, several packages need to be installed on the system. On a
  21. freshly installed Debian Wheezy system the following packages are required:
  22. * `git` (to get Gluon and other dependencies)
  23. * `subversion`
  24. * `python` (Python 3 doesn't work)
  25. * `build-essential`
  26. * `gawk`
  27. * `unzip`
  28. * `libncurses-dev` (actually `libncurses5-dev`)
  29. * `libz-dev` (actually `zlib1g-dev`)
  30. * `libssl-dev`
  31. * `wget`
  32. Building the images
  33. -------------------
  34. To build Gluon, first check out the repository. Replace *RELEASE* with the
  35. version you'd like to checkout, e.g. *v2017.1.5*.
  36. ::
  37. git clone https://github.com/freifunk-gluon/gluon.git gluon -b RELEASE
  38. This command will create a directory named *gluon/*.
  39. It might also tell a scary message about being in a *detached state*.
  40. **Don't panic!** Everything's fine.
  41. Now, enter the freshly created directory::
  42. cd gluon
  43. It's time to add (or create) your site configuration. If you already
  44. have a site repository, just clone it::
  45. git clone https://github.com/freifunk-alpha-centauri/site-ffac.git site
  46. If you want to build a new site, create a new git repository *site/*::
  47. mkdir site
  48. cd site
  49. git init
  50. Copy *site.conf*, *site.mk* and *i18n* from *docs/site-example*::
  51. cp ../docs/site-example/site.conf .
  52. cp ../docs/site-example/site.mk .
  53. cp -r ../docs/site-example/i18n .
  54. Edit these files as you see fit and commit them into the site repository.
  55. Extensive documentation about the site configuration can be found at:
  56. :doc:`site`. The
  57. site directory should always be a git repository by itself; committing site-specific files
  58. to the Gluon main repository should be avoided, as it will make updates more complicated.
  59. Next go back to the top-level Gluon directory and build Gluon::
  60. cd ..
  61. make update # Get other repositories used by Gluon
  62. make GLUON_TARGET=ar71xx-generic # Build Gluon
  63. In case of errors read the messages carefully and try to fix the stated issues (e.g. install tools not available yet).
  64. ``ar71xx-generic`` is the most common target and will generate images for most of the supported hardware.
  65. To see a complete list of supported targets, call ``make`` without setting ``GLUON_TARGET``.
  66. You should reserve about 10GB of disk space for each `GLUON_TARGET`.
  67. The built images can be found in the directory `output/images`. Of these, the `factory`
  68. images are to be used when flashing from the original firmware a device came with,
  69. and `sysupgrade` is to upgrade from other versions of Gluon or any other OpenWrt/LEDE-based
  70. system.
  71. **Note:** The images for some models are identical; to save disk space, symlinks are generated instead
  72. of multiple copies of the same image. If your webserver's configuration prohibits following
  73. symlinks, you can use the following command to resolve these links while copying the images::
  74. cp -rL output/images /var/www
  75. Cleaning the build tree
  76. .......................
  77. There are two levels of `make clean`::
  78. make clean GLUON_TARGET=ar71xx-generic
  79. will ensure all packages are rebuilt for a single target. This normally not
  80. necessary, but may fix certain kinds of build failures.
  81. ::
  82. make dirclean
  83. will clean the entire tree, so the toolchain will be rebuilt as well, which will take a while.
  84. opkg repositories
  85. -----------------
  86. Gluon is mostly compatible with LEDE, so the normal LEDE package repositories
  87. can be used for Gluon as well.
  88. This is not true for kernel modules; the Gluon kernel is incompatible with the
  89. kernel of the default LEDE images. Therefore, Gluon will not only generate images,
  90. but also an opkg repository containing all core packages provided by LEDE,
  91. including modules for the kernel of the generated images.
  92. Signing keys
  93. ............
  94. Gluon does not support HTTPS for downloading packages; fortunately, opkg deploys
  95. public-key cryptography to ensure package integrity.
  96. The Gluon images will contain public keys from two sources: the official LEDE keyring
  97. (to allow installing userspace packages) and a Gluon-specific key (which is used
  98. to sign the generated package repository).
  99. LEDE will handle the generation and handling of the keys itself.
  100. When making firmware releases based on Gluon, it might make sense to store
  101. the keypair, so updating the module repository later is possible.
  102. .. _getting-started-make-variables:
  103. Make variables
  104. --------------
  105. Gluon's build process can be controlled by various variables. They can
  106. usually be set on the command line or in ``site.mk``.
  107. Common variables
  108. ................
  109. GLUON_BRANCH
  110. Sets the default branch of the autoupdater. If unset, the autoupdater is disabled
  111. by default. For the ``make manifest`` command, GLUON_BRANCH defines the branch to
  112. generate a manifest for.
  113. GLUON_LANGS
  114. Space-separated list of languages to include for the config mode/advanced settings. Defaults to ``en``.
  115. ``en`` should always be included, other supported languages are ``de`` and ``fr``.
  116. GLUON_PRIORITY
  117. Defines the priority of an automatic update in ``make manifest``. See :doc:`../features/autoupdater` for
  118. a detailed description of this value.
  119. GLUON_REGION
  120. Some devices (at the moment the TP-Link Archer C7) contain a region code that restricts
  121. firmware installations. Set GLUON_REGION to ``eu`` or ``us`` to make the resulting
  122. images installable from the respective stock firmwares.
  123. GLUON_RELEASE
  124. Firmware release number: This string is displayed in the config mode, announced
  125. via respondd/alfred and used by the autoupdater to decide if a newer version
  126. is available. The same GLUON_RELEASE has to be passed to ``make`` and ``make manifest``
  127. to generate a correct manifest.
  128. GLUON_TARGET
  129. Target architecture to build.
  130. Special variables
  131. .................
  132. GLUON_BUILDDIR
  133. Working directory during build. Defaults to ``build``.
  134. GLUON_IMAGEDIR
  135. Path where images will be stored. Defaults to ``$(GLUON_OUTPUTDIR)/images``.
  136. GLUON_PACKAGEDIR
  137. Path where the opkg package repository will be stored. Defaults to ``$(GLUON_OUTPUTDIR)/packages``.
  138. GLUON_OUTPUTDIR
  139. Path where output files will be stored. Defaults to ``output``.
  140. GLUON_SITEDIR
  141. Path to the site configuration. Defaults to ``site``.