diff options
| author | Nathan Rossi <nathan.rossi@xilinx.com> | 2013-09-04 16:44:20 +1000 |
|---|---|---|
| committer | Nathan Rossi <nathan.rossi@xilinx.com> | 2013-09-04 18:38:58 +1000 |
| commit | 5527261cec9017c5bf77166241422a74625beab0 (patch) | |
| tree | 233e11fb46cd4ac77075c9a2a46c02f7d3bbfa63 /recipes-kernel | |
| parent | cc54f70d15afdb882341951d13c7da2d45ddb93b (diff) | |
| download | meta-xilinx-5527261cec9017c5bf77166241422a74625beab0.tar.gz | |
linux-machine-config.inc: Refactored useful python functions
* Refactored the useful python functions into more generic form and
placed them in the 'xilinx-utils.bbclass' which can be inherited for
the functions.
Signed-off-by: Nathan Rossi <nathan.rossi@xilinx.com>
Diffstat (limited to 'recipes-kernel')
| -rw-r--r-- | recipes-kernel/linux/linux-machine-config.inc | 38 |
1 files changed, 6 insertions, 32 deletions
diff --git a/recipes-kernel/linux/linux-machine-config.inc b/recipes-kernel/linux/linux-machine-config.inc index f9af2abe..f4e7fa54 100644 --- a/recipes-kernel/linux/linux-machine-config.inc +++ b/recipes-kernel/linux/linux-machine-config.inc | |||
| @@ -14,47 +14,21 @@ | |||
| 14 | # available) to the FILESEXTRAPATHS. | 14 | # available) to the FILESEXTRAPATHS. |
| 15 | # | 15 | # |
| 16 | 16 | ||
| 17 | # Returns a space seperated list of all '.dts' files which | 17 | inherit xilinx-utils |
| 18 | def get_all_devicetrees(d): | ||
| 19 | workdir = d.getVar("WORKDIR", True) | ||
| 20 | machine_devicetree = d.getVar("MACHINE_DEVICETREE", True) or '' | ||
| 21 | if machine_devicetree: | ||
| 22 | files=set() | ||
| 23 | for path in machine_devicetree.split(): | ||
| 24 | if os.path.splitext(path)[1] == '.dts': | ||
| 25 | files.add(os.path.join(workdir, "devicetree", os.path.basename(path))) | ||
| 26 | if len(files) != 0: | ||
| 27 | return ' '.join(files) | ||
| 28 | return '' | ||
| 29 | |||
| 30 | # Retuns a ':' seperated list of expanded '${BBPATH}/$path' | ||
| 31 | def get_additional_bbpath_filespath(path, d): | ||
| 32 | board_extrapaths = [] | ||
| 33 | bbpath = d.getVar("BBPATH", True) or "" | ||
| 34 | for i in bbpath.split(":"): | ||
| 35 | board_extrapaths.append(os.path.join(i, path)) | ||
| 36 | if len(board_extrapaths): | ||
| 37 | return ":".join(board_extrapaths) + ":" | ||
| 38 | return "" | ||
| 39 | 18 | ||
| 40 | # If OOT_KERNEL_DEVICETREE is not set, default to the device tree's provided by | 19 | # If OOT_KERNEL_DEVICETREE is not set, default to the device tree's provided by |
| 41 | # MACHINE_DEVICETREE | 20 | # MACHINE_DEVICETREE |
| 42 | OOT_KERNEL_DEVICETREE ?= "${@get_all_devicetrees(d)}" | 21 | OOT_KERNEL_DEVICETREE ?= "${@expand_dir_basepaths_by_extension("MACHINE_DEVICETREE", os.path.join(d.getVar("WORKDIR", True), 'devicetree'), '.dts', d)}" |
| 43 | 22 | ||
| 44 | # Appends the '<layer>/conf/machine/boards' path to FILESEXTRAPATHS for all | 23 | # Appends the '<layer>/conf/machine/boards' path to FILESEXTRAPATHS for all |
| 45 | # layers (using the ${BBPATH}) | 24 | # layers (using the ${BBPATH}) |
| 46 | FILESEXTRAPATHS_append := "${@get_additional_bbpath_filespath('conf/machine/boards', d)}" | 25 | FILESEXTRAPATHS_append := "${@get_additional_bbpath_filespath('conf/machine/boards', d)}" |
| 47 | 26 | ||
| 48 | # Using the MACHINE_DEVICETREE and MACHINE_KCONFIG vars, append them to SRC_URI | 27 | # Using the MACHINE_DEVICETREE and MACHINE_KCONFIG vars, append them to SRC_URI |
| 49 | python () { | 28 | SRC_URI_append += " \ |
| 50 | machine_devicetree = d.getVar("MACHINE_DEVICETREE", True) or '' | 29 | ${@paths_affix(d.getVar("MACHINE_DEVICETREE", True) or '', prefix = 'file://')} \ |
| 51 | machine_kconfigs = d.getVar("MACHINE_KCONFIG", True) or '' | 30 | ${@paths_affix(d.getVar("MACHINE_KCONFIG", True) or '', prefix = 'file://')} \ |
| 52 | sources = set() | 31 | " |
| 53 | for path in (machine_devicetree.split() + machine_kconfigs.split()): | ||
| 54 | sources.add("file://" + path) | ||
| 55 | if len(sources) != 0: | ||
| 56 | d.setVar("SRC_URI_append", " %s " % " ".join(sources)) | ||
| 57 | } | ||
| 58 | 32 | ||
| 59 | # Copy all device tree's into the same directory. This is due to compatibility | 33 | # Copy all device tree's into the same directory. This is due to compatibility |
| 60 | # with dtc and the use of DTSI (Device Tree Includes), the version of DTC in | 34 | # with dtc and the use of DTSI (Device Tree Includes), the version of DTC in |
