Package licensing

Every recipe needs to contain a LICENSE variable. The LICENSE variable allows you to specify multiple, alternative, and per-package type licenses, as seen in the following examples:

  • For MIT or GPLv2 alternative licenses, we will use:
LICENSE = "GPL-2.0 | MIT" 
  • For both ISC and MIT licenses, we will use:
LICENSE = "ISC & MIT" 
  • For split packages, all of them GPLv2 except the documentation that is covered under the Creative Commons, we will use:
LICENSE_${PN} = "GPLv2" 
LICENSE_${PN}-dev = "GPLv2" 
LICENSE_${PN}-dbg = "GPLv2" 
LICENSE_${PN}-doc = "CC-BY-2.0" 

Open source packages usually have the license included with the source code in README, COPYING, or LICENSE files, and even the source code header files.

For open source licenses, we also need to specify LIC_FILES_CHECKSUM for all licenses so that the build system can notify us when the licenses change. To add it, we locate the file or file portion that contains the license and provide its relative path from the directory containing the source and a MD5 checksum for it. For example:

LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" 

This example uses a GPL-2.0 license text from Poky's common licenses folder (meta/files/common-licenses). This can be used as an alternative when no license is included within the package source.

LIC_FILES_CHKSUM = 
"file://COPYING;md5=f7bdc0c63080175d1667091b864cb12c"

This example points to a COPYING file included with the source.

LIC_FILES_CHKSUM = 
"file://usr/include/head.h;endline=7;md5=861ebad4adc7236f8d1905338
abd7eb2" LIC_FILES_CHKSUM =
"file://src/file.c;beginline=5;endline=13;md5=6c7486b21a8524b1879f
a159578da31e"

Both examples here point to extracts from source code files that contain the license.

Proprietary code should have the license set to CLOSED, and no LIC_FILES_CHECKSUM is needed for it.

You can use the recipetool command to create a recipe skeleton that can then be edited to completion with:

$ recipetool create -o helloworld.bb helloworld.c 

Where:

  • -o is the path to the file to create
  • -N is the optional package name
  • -V is the optional package version
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset