getting_started.rst 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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. *v2014.3*. 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. *v2015.1*.
  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. The built images can be found in the directory `output/images`. Of these, the factory
  67. images are to be used when flashing from the original firmware a device came with,
  68. and sysupgrade is to upgrade from other versions of Gluon or any other OpenWrt-based
  69. system.
  70. You should reserve about 10GB of disk space for each `GLUON_TARGET`.
  71. There are two levels of `make clean`::
  72. make clean GLUON_TARGET=ar71xx-generic
  73. will ensure all packages are rebuilt for a single target; this is what you normally want to do after an update.
  74. ::
  75. make dirclean
  76. will clean the entire tree, so the toolchain will be rebuilt as well, which is
  77. not necessary in most cases, and will take a while.
  78. opkg repositories
  79. -----------------
  80. Gluon is mostly compatible with OpenWrt, so the normal OpenWrt package repositories
  81. can be used for Gluon as well. It is advisable to setup a mirror or reverse proxy
  82. reachable over IPv6 and add it to ``site.conf`` as http://downloads.openwrt.org/ does
  83. not support IPv6.
  84. This is not true for kernel modules; the Gluon kernel is incompatible with the
  85. kernel of the default OpenWrt images. Therefore, Gluon will not only generate images,
  86. but also an opkg repositoy containing all kernel modules provided by OpenWrt/Gluon
  87. for the kernel of the generated images.
  88. Signing keys
  89. ............
  90. Gluon does not support HTTPS for downloading packages; fortunately, opkg deploys
  91. public-key cryptography to ensure package integrity.
  92. The Gluon images will contain two public keys: the official OpenWrt signing key
  93. (to allow installing userspace packages) and a Gluon-specific key (which is used
  94. to sign the generated module repository).
  95. By default, Gluon will handle the generation and handling of the keys itself.
  96. When making firmware releases based on Gluon, it might make sense to store
  97. the keypair, so updating the module repository later is possible.
  98. The location the keys are stored at and read from can be changed
  99. (see :ref:`getting-started-environment-variables`). To only generate the keypair
  100. at the configured location without doing a full build, use ``make create-key``.
  101. .. _getting-started-environment-variables:
  102. Environment variables
  103. ---------------------
  104. Gluon's build process can be controlled by various environment variables.
  105. GLUON_SITEDIR
  106. Path to the site configuration. Defaults to ``site``.
  107. GLUON_BUILDDIR
  108. Working directory during build. Defaults to ``build``.
  109. GLUON_OPKG_KEY
  110. Path key file used to sign the module opkg repository. Defaults to ``$(GLUON_BULDDIR)/gluon-opkg-key``.
  111. The private key will be stored as ``$(GLUON_OPKG_KEY)``, the public key as ``$(GLUON_OPKG_KEY).pub``.
  112. GLUON_OUTPUTDIR
  113. Path where output files will be stored. Defaults to ``output``.
  114. GLUON_IMAGEDIR
  115. Path where images will be stored. Defaults to ``$(GLUON_OUTPUTDIR)/images``.
  116. GLUON_MODULEDIR
  117. Path where the kernel module opkg repository will be stored. Defaults to ``$(GLUON_OUTPUTDIR)/modules``.
  118. So all in all, to update and rebuild a Gluon build tree, the following commands should be used (repeat the
  119. ``make clean`` and ``make`` for all targets you want to build):
  120. ::
  121. git pull
  122. (cd site && git pull)
  123. make update
  124. make clean GLUON_TARGET=ar71xx-generic
  125. make GLUON_TARGET=ar71xx-generic