summaryrefslogtreecommitdiffstats
path: root/docs/manual/adding-packages-virtual.txt
diff options
context:
space:
mode:
authoreric.le.bihan.dev@free.fr <eric.le.bihan.dev@free.fr>2014-04-05 17:21:44 +0200
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2014-04-05 19:20:58 +0200
commit7862abad78934ed2a75cea6305163b4ae092b966 (patch)
tree16b1e95a4f413a0bfda5f326cef1f4b9d11e8cbf /docs/manual/adding-packages-virtual.txt
parentc97aeb7e84d5d34e2833f6f143b061b856acf7e1 (diff)
downloadbuildroot-7862abad78934ed2a75cea6305163b4ae092b966.tar.gz
buildroot-7862abad78934ed2a75cea6305163b4ae092b966.zip
manual: add virtual package tutorial
The manual now features a new section with instructions about how to add a virtual package. Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr> [yann.morin.1998@free.fr: move down statement about provider's .mk] Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Reviewed-by: Samuel Martin <s.martin49@gmail.com> Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'docs/manual/adding-packages-virtual.txt')
-rw-r--r--docs/manual/adding-packages-virtual.txt99
1 files changed, 99 insertions, 0 deletions
diff --git a/docs/manual/adding-packages-virtual.txt b/docs/manual/adding-packages-virtual.txt
new file mode 100644
index 0000000000..76f57949df
--- /dev/null
+++ b/docs/manual/adding-packages-virtual.txt
@@ -0,0 +1,99 @@
+// -*- mode:doc; -*-
+// vim: set syntax=asciidoc:
+
+[[virtual-package-tutorial]]
+
+Virtual package tutorial
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+In Buildroot, a virtual package is a package whose functionalities are
+provided by one or more packages, referred to as 'providers'. The virtual
+package management is an extensible mechanism allowing the user to choose
+the provider used in the rootfs.
+
+For example, 'OpenGL ES' is an API for 2D and 3D graphics on embedded systems.
+The implementation of this API is different for the 'Allwinner Tech Sunxi' and
+the 'Texas Instruments OMAP35xx' plaftorms. So +libgles+ will be a virtual
+package and +sunxi-mali+ and +ti-gfx+ will be the providers.
+
+In the following example, we will explain how to add a new virtual package
+('something-virtual') and a provider for it ('some-provider').
+
+First, let's create the virtual package.
+
+Virtual package's +Config.in+ file
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The +Config.in+ file of virtual package 'something-virtual' should contain:
+
+---------------------------
+01: config BR2_PACKAGE_HAS_SOMETHING_VIRTUAL
+02: bool
+03:
+04: config BR2_PACKAGE_PROVIDES_SOMETHING_VIRTUAL
+05: depends on BR2_PACKAGE_HAS_SOMETHING_VIRTUAL
+06: string
+---------------------------
+
+In this file, we declare two options, +BR2_PACKAGE_HAS_SOMETHING_VIRTUAL+ and
++BR2_PACKAGE_PROVIDES_SOMETHING_VIRTUAL+, whose values will be used by the
+providers.
+
+Virtual package's +*.mk+ file
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The Makefile +package/something-virtual/something-virtual.mk+ should contain:
+
+---------------------------
+01: ################################################################################
+02: #
+03: # something-virtual
+04: #
+05: ################################################################################
+06:
+07: SOMETHING_VIRTUAL_SOURCE =
+08: SOMETHING_VIRTUAL_DEPENDENCIES = $(call qstrip,$(BR2_PACKAGE_PROVIDES_SOMETHING_VIRTUAL))
+09:
+10: ifeq ($(BR2_PACKAGE_HAS_SOMETHING_VIRTUAL),y)
+11: ifeq ($(SOMETHING_VIRTUAL_DEPENDENCIES),)
+12: $(error No something-virtual implementation selected. Configuration error.)
+13: endif
+14: endif
+15:
+16: $(eval $(generic-package))
+---------------------------
+
+The Makefile is quite small as it will only check if a provider for the
+virtual package has been selected.
+
+Provider's +Config.in+ file
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+When adding a package as a provider, only the +Config.in+ file requires some
+modifications. The +*.mk+ file should follow the Buildroot infrastructure with
+no change at all.
+
+The +Config.in+ file of the package 'some-provider', which provides the
+functionalities of 'something-virtual', should contain:
+
+---------------------------
+01: config BR2_PACKAGE_SOME_PROVIDER
+02: bool "some-provider"
+03: select BR2_PACKAGE_HAS_SOMETHING_VIRTUAL
+04: help
+05: This is a comment that explains what some-provider is.
+06:
+07: http://foosoftware.org/some-provider/
+08:
+09: if BR2_PACKAGE_SOME_PROVIDER
+10: config BR2_PACKAGE_PROVIDES_SOMETHING_VIRTUAL
+11: default "some-provider"
+12: endif
+---------------------------
+
+On line 3, we select +BR2_PACKAGE_HAS_SOMETHING_VIRTUAL+, and on line 11, we
+set the value of +BR2_PACKAGE_PROVIDES_SOMETHING_VIRTUAL+ to the name of the
+provider, but only if it is selected.
+
+Of course, do not forget to add the proper build and runtime dependencies for
+this package!
OpenPOWER on IntegriCloud