getting_started.rst 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. Getting Started
  2. ===============
  3. Selecting the right version
  4. ---------------------------
  5. Gluon's releases are managed using `Git tags`_. If you're a community 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*.
  9. Please keep in mind that a matching site configuration for your community
  10. is required. Due to new features being added (or sometimes being removed)
  11. the format of the site configuration changes slightly between releases.
  12. Recent releases (starting with *v2014.3.1*) will come with an example
  13. configuration located in *docs/site-example/*.
  14. .. _Git tags: http://git-scm.com/book/en/Git-Basics-Tagging
  15. .. _list of gluon releases: https://github.com/freifunk-gluon/gluon/releases
  16. Dependencies
  17. ------------
  18. To build Gluon, several packages need to be installed on the system. On a
  19. freshly installed Debian Wheezy system the following packages are required:
  20. * `git` (to get Gluon and other dependencies)
  21. * `subversion`
  22. * `python` (Python 3 doesn't work)
  23. * `build-essential`
  24. * `gawk`
  25. * `unzip`
  26. * `libncurses-dev` (actually `libncurses5-dev`)
  27. * `libz-dev` (actually `zlib1g-dev`)
  28. * `libssl-dev`
  29. Building the images
  30. -------------------
  31. To build Gluon, first check out the repository. Replace *RELEASE* with the
  32. version you'd like to checkout, e.g. *v2015.1*.
  33. ::
  34. git clone https://github.com/freifunk-gluon/gluon.git gluon -b RELEASE
  35. This command will create a directory named *gluon/*.
  36. It might also tell a scary message about being in a *detached state*.
  37. **Don't panic!** Everything's fine.
  38. Now, enter the freshly created directory:
  39. ::
  40. cd gluon
  41. It's time to add (or create) your site configuration.
  42. So let's create the directory *site/*:
  43. ::
  44. mkdir site
  45. cd site
  46. Copy *site.conf*, *site.mk* and *i18n* from *docs/site-example*:
  47. ::
  48. cp ../docs/site-example/site.conf .
  49. cp ../docs/site-example/site.mk .
  50. cp -r ../docs/site-example/i18n .
  51. Edit these files to match your community, then go back to the top-level Gluon
  52. directory and build Gluon:
  53. ::
  54. cd ..
  55. make update # Get other repositories used by Gluon
  56. make GLUON_TARGET=ar71xx-generic # Build Gluon
  57. When calling make, the OpenWrt build environment is prepared/updated.
  58. In case of errors read the messages carefully and try to fix the stated issues (e.g. install tools not available yet).
  59. ``ar71xx-generic`` is the most common target and will generated images for most of the supported hardware.
  60. To see a complete list of supported targets, call ``make`` without setting ``GLUON_TARGET``.
  61. The built images can be found in the directory `output/images`. Of these, the factory
  62. images are to be used when flashing from the original firmware a device came with,
  63. and sysupgrade is to upgrade from other versions of Gluon or any other OpenWRT-based
  64. system.
  65. You should reserve about 10GB of disk space for each `GLUON_TARGET`.
  66. There are two levels of `make clean`:
  67. ::
  68. make clean GLUON_TARGET=ar71xx-generic
  69. will ensure all packages are rebuilt for a single target; this is what you normally want to do after an update.
  70. ::
  71. make dirclean
  72. will clean the entire tree, so the toolchain will be rebuilt as well, which is
  73. not necessary in most cases, and will take a while.
  74. opkg repositories
  75. -----------------
  76. Gluon is mostly compatible with OpenWrt, so the normal OpenWrt package repositories
  77. can be used for Gluon as well. It is advisable to setup a mirror or reverse proxy
  78. reachable over IPv6 and add it to ``site.conf`` as http://downloads.openwrt.org/ does
  79. not support IPv6.
  80. This is not true for kernel modules; the Gluon kernel is incompatible with the
  81. kernel of the default OpenWrt images. Therefore, Gluon will not only generate images,
  82. but also an opkg repositoy containing all kernel modules provided by OpenWrt/Gluon
  83. for the kernel of the generated images.
  84. Signing keys
  85. ............
  86. Gluon does not support HTTPS for downloading packages; fortunately, opkg deploys
  87. public-key cryptography to ensure package integrity.
  88. The Gluon images will contain two public keys: the official OpenWrt signing key
  89. (to allow installing userspace packages) and a Gluon-specific key (which is used
  90. to sign the generated module repository).
  91. By default, Gluon will handle the generation and handling of the keys itself.
  92. When making firmware releases based on Gluon, it might make sense to store
  93. the keypair, so updating the module repository later is possible.
  94. The location the keys are stored at and read from can be changed
  95. (see :ref:`getting-started-environment-variables`). To only generate the keypair
  96. at the configured location without doing a full build, use ``make create-key``.
  97. .. _getting-started-environment-variables:
  98. Environment variables
  99. ---------------------
  100. Gluon's build process can be controlled by various environment variables.
  101. GLUON_SITEDIR
  102. Path to the site configuration. Defaults to ``site``.
  103. GLUON_BUILDDIR
  104. Working directory during build. Defaults to ``build``.
  105. GLUON_OPKG_KEY
  106. Path key file used to sign the module opkg repository. Defaults to ``$(GLUON_BULDDIR)/gluon-opkg-key``.
  107. The private key will be stored as ``$(GLUON_OPKG_KEY)``, the public key as ``$(GLUON_OPKG_KEY).pub``.
  108. GLUON_OUTPUTDIR
  109. Path where output files will be stored. Defaults to ``output``.
  110. GLUON_IMAGEDIR
  111. Path where images will be stored. Defaults to ``$(GLUON_OUTPUTDIR)/images``.
  112. GLUON_MODULEDIR
  113. Path where the kernel module opkg repository will be stored. Defaults to ``$(GLUON_OUTPUTDIR)/modules``.
  114. So all in all, to update and rebuild a Gluon build tree, the following commands should be used (repeat the
  115. ``make clean`` and ``make`` for all targets you want to build):
  116. ::
  117. git pull
  118. (cd site && git pull)
  119. make update
  120. make clean GLUON_TARGET=ar71xx-generic
  121. make GLUON_TARGET=ar71xx-generic