getting_started.rst 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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. *v2016.1.6*. 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. Building the images
  32. -------------------
  33. To build Gluon, first check out the repository. Replace *RELEASE* with the
  34. version you'd like to checkout, e.g. *v2016.1.6*.
  35. ::
  36. git clone https://github.com/freifunk-gluon/gluon.git gluon -b RELEASE
  37. This command will create a directory named *gluon/*.
  38. It might also tell a scary message about being in a *detached state*.
  39. **Don't panic!** Everything's fine.
  40. Now, enter the freshly created directory::
  41. cd gluon
  42. It's time to add (or create) your site configuration. If you already
  43. have a site repository, just clone it::
  44. git clone https://github.com/freifunk-duckburg/site-ffdb.git site
  45. If you want to build a new site, create a new git repository *site/*::
  46. mkdir site
  47. cd site
  48. git init
  49. Copy *site.conf*, *site.mk* and *i18n* from *docs/site-example*::
  50. cp ../docs/site-example/site.conf .
  51. cp ../docs/site-example/site.mk .
  52. cp -r ../docs/site-example/i18n .
  53. Edit these files as you see fit and commit them into the site repository.
  54. Extensive documentation about the site configuration can be found at:
  55. :doc:`site`. The
  56. site directory should always be a git repository by itself; committing site-specific files
  57. to the Gluon main repository should be avoided, as it will make updates more complicated.
  58. Next go back to the top-level Gluon directory and build Gluon::
  59. cd ..
  60. make update # Get other repositories used by Gluon
  61. make GLUON_TARGET=ar71xx-generic # Build Gluon
  62. When calling make, the OpenWrt build environment is prepared/updated.
  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-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 is what you normally want to do after an update.
  80. ::
  81. make dirclean
  82. will clean the entire tree, so the toolchain will be rebuilt as well, which is
  83. not necessary in most cases, and will take a while.
  84. opkg repositories
  85. -----------------
  86. Gluon is mostly compatible with OpenWrt, so the normal OpenWrt package repositories
  87. can be used for Gluon as well. It is advisable to setup a mirror or reverse proxy
  88. reachable over IPv6 and add it to ``site.conf`` as http://downloads.openwrt.org/ does
  89. not support IPv6.
  90. This is not true for kernel modules; the Gluon kernel is incompatible with the
  91. kernel of the default OpenWrt images. Therefore, Gluon will not only generate images,
  92. but also an opkg repository containing all kernel modules provided by OpenWrt/Gluon
  93. for the kernel of the generated images.
  94. Signing keys
  95. ............
  96. Gluon does not support HTTPS for downloading packages; fortunately, opkg deploys
  97. public-key cryptography to ensure package integrity.
  98. The Gluon images will contain two public keys: the official OpenWrt signing key
  99. (to allow installing userspace packages) and a Gluon-specific key (which is used
  100. to sign the generated module repository).
  101. By default, Gluon will handle the generation and handling of the keys itself.
  102. When making firmware releases based on Gluon, it might make sense to store
  103. the keypair, so updating the module repository later is possible.
  104. The location the keys are stored at and read from can be changed
  105. (see :ref:`getting-started-environment-variables`). To only generate the keypair
  106. at the configured location without doing a full build, use ``make create-key``.
  107. .. _getting-started-environment-variables:
  108. Environment variables
  109. ---------------------
  110. Gluon's build process can be controlled by various environment variables. These variables can
  111. usually be set on the command line or in ``site.mk``.
  112. GLUON_SITEDIR
  113. Path to the site configuration. Defaults to ``site``.
  114. GLUON_BUILDDIR
  115. Working directory during build. Defaults to ``build``.
  116. GLUON_OPKG_KEY
  117. Path key file used to sign the module opkg repository. Defaults to ``$(GLUON_BULDDIR)/gluon-opkg-key``.
  118. The private key will be stored as ``$(GLUON_OPKG_KEY)``, the public key as ``$(GLUON_OPKG_KEY).pub``.
  119. GLUON_OUTPUTDIR
  120. Path where output files will be stored. Defaults to ``output``.
  121. GLUON_IMAGEDIR
  122. Path where images will be stored. Defaults to ``$(GLUON_OUTPUTDIR)/images``.
  123. GLUON_MODULEDIR
  124. Path where the kernel module opkg repository will be stored. Defaults to ``$(GLUON_OUTPUTDIR)/modules``.
  125. GLUON_ATH10K_MESH
  126. While Gluon does support some hardware with ath10k-based 5GHz WLAN, these WLAN adapters don't work
  127. well for meshing at the moment, so building images for these models is disabled by default. In addition,
  128. ath10k can't support IBSS and 11s meshing in the same image due to WLAN firmware restrictions.
  129. Setting GLUON_ATH10K_MESH to ``11s`` or ``ibss`` will enable generation of images for ath10k devices
  130. and install the firmware for the corresponding WLAN mode.
  131. So all in all, to update and rebuild a Gluon build tree, the following commands should be used (repeat the
  132. ``make clean`` and ``make`` for all targets you want to build):
  133. ::
  134. git pull
  135. (cd site && git pull)
  136. make update
  137. make clean GLUON_TARGET=ar71xx-generic
  138. make GLUON_TARGET=ar71xx-generic