summaryrefslogtreecommitdiffstats
path: root/recipes-kernel
diff options
context:
space:
mode:
authorNathan Rossi <nathan.rossi@xilinx.com>2013-08-01 17:45:02 +1000
committerNathan Rossi <nathan.rossi@xilinx.com>2013-08-01 17:45:02 +1000
commit505a3f93504e12085ad7b78d12c4eb21f67cda1f (patch)
tree4e99daa5ca0ad6d5081eda10711cda4cd7395de0 /recipes-kernel
parentefc3f819107d88cf630ed521a217e337d042e998 (diff)
downloadmeta-xilinx-505a3f93504e12085ad7b78d12c4eb21f67cda1f.tar.gz
Refactored MACHINE_* usage
* Added 'conf/machine/boards' as a default FILESEXTRAPATH (for each available layer). * Change MACHINE_* to rely only on the path being relative to 'conf/machine/boards'. * Fixed up linux-xlnx.inc and linux-machine-common.inc to use 'MACHINE_*' for default files. * Fixed KERNEL_DEVICETREE setting such that the variable is valid before the base __anonymous function of linux-dtb.inc is executed. Signed-off-by: Nathan Rossi <nathan.rossi@xilinx.com>
Diffstat (limited to 'recipes-kernel')
-rw-r--r--recipes-kernel/linux/linux-machine-common.inc4
-rw-r--r--recipes-kernel/linux/linux-machine-config.inc85
-rw-r--r--recipes-kernel/linux/linux-xlnx.inc4
3 files changed, 64 insertions, 29 deletions
diff --git a/recipes-kernel/linux/linux-machine-common.inc b/recipes-kernel/linux/linux-machine-common.inc
index 6d8cd8c5..2ef76ff9 100644
--- a/recipes-kernel/linux/linux-machine-common.inc
+++ b/recipes-kernel/linux/linux-machine-common.inc
@@ -5,6 +5,4 @@ require linux-machine-config.inc
5DEPENDS_append_microblaze += "u-boot-mkimage-native" 5DEPENDS_append_microblaze += "u-boot-mkimage-native"
6 6
7# Common Device Tree Includes 7# Common Device Tree Includes
8# (put them in ${WORKDIR} to avoid using dtc with include paths) 8MACHINE_DEVICETREE_append_zynq += "common/zynq-7-base.dtsi"
9FILESEXTRAPATHS_append := "${XILINX_LAYERDIR}/conf/machine/boards/common:"
10SRC_URI_append += "file://zynq-7-base.dtsi"
diff --git a/recipes-kernel/linux/linux-machine-config.inc b/recipes-kernel/linux/linux-machine-config.inc
index 184011f4..6568e4b5 100644
--- a/recipes-kernel/linux/linux-machine-config.inc
+++ b/recipes-kernel/linux/linux-machine-config.inc
@@ -1,34 +1,71 @@
1#
2# This include file implements the MACHINE_DEVICETREE and MACHINE_KCONFIG
3# variable handling for the Kernel.
4#
5# e.g. (set in the associated <machine>.conf)
6# MACHINE_DEVICETREE := "zc702/zc702-zynq7.dts"
7# MACHINE_KCONFIG := "common/rtc.cfg"
8#
9# This will expand out to:
10# SRC_URI_append += "file://zc702/zc702-zynq7.dts file://common/rtc.cfg"
11# KERNEL_DEVICETREE ?= "${WORKDIR}/devicetree/zc702-zynq7.dts"
12#
13# This include also adds all the 'conf/machine/boards' for all layers (that are
14# available) to the FILESEXTRAPATHS.
15#
1 16
2# Scan all files in MACHINE_DEVICETREE and MACHINE_KCONFIG and populate SRC_URI, 17# Returns a space seperated list of all '.dts' files which
3# FILESEXTRAPATHS and KERNEL_DEVICETREE. 18def get_all_devicetrees(d):
4python __anonymous () {
5 workdir = d.getVar("WORKDIR", True) 19 workdir = d.getVar("WORKDIR", True)
6 machine_devicetree = d.getVar("MACHINE_DEVICETREE", True) or '' 20 machine_devicetree = d.getVar("MACHINE_DEVICETREE", True) or ''
7 machine_kconfigs = d.getVar("MACHINE_KCONFIG", True) or ''
8 extrapaths = set()
9 sources = set()
10 if machine_devicetree: 21 if machine_devicetree:
11 # linux-dtb.inc gets processed before this '__anonymous'
12 depends = d.getVar("DEPENDS", True)
13 d.setVar("DEPENDS", "%s dtc-native" % depends)
14 packages = d.getVar("PACKAGES", True)
15 d.setVar("PACKAGES", "%s kernel-devicetree" % packages)
16
17 files=set() 22 files=set()
18 for path in machine_devicetree.split(): 23 for path in machine_devicetree.split():
19 sources.add("file://" + os.path.basename(path)) 24 if os.path.splitext(path)[1] == '.dts':
20 extrapaths.add(os.path.dirname(path)) 25 files.add(os.path.join(workdir, "devicetree", os.path.basename(path)))
21 if os.path.splitext(os.path.basename(path))[1] == '.dts': 26 if len(files) != 0:
22 files.add(os.path.join(workdir, os.path.basename(path))) 27 return ' '.join(files)
23 d.setVar("KERNEL_DEVICETREE", ' '.join(files)) 28 return ''
24 if machine_kconfigs: 29
25 for path in machine_kconfigs.split(): 30# Retuns a ':' seperated list of expanded '${BBPATH}/$path'
26 files.add(os.path.join(workdir, os.path.basename(path))) 31def get_additional_bbpath_filespath(path, d):
27 sources.add("file://" + os.path.basename(path)) 32 board_extrapaths = []
28 extrapaths.add(os.path.dirname(path)) 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
40# If KERNEL_DEVICETREE is not set, default to the device tree's provided by
41# MACHINE_DEVICETREE
42KERNEL_DEVICETREE ?= "${@get_all_devicetrees(d)}"
43
44# Appends the '<layer>/conf/machine/boards' path to FILESEXTRAPATHS for all
45# layers (using the ${BBPATH})
46FILESEXTRAPATHS_append := "${@get_additional_bbpath_filespath('conf/machine/boards', d)}"
29 47
30 if len(extrapaths) != 0: 48# Using the MACHINE_DEVICETREE and MACHINE_KCONFIG vars, append them to SRC_URI
31 d.setVar("FILESEXTRAPATHS_append", ":".join(extrapaths) + ":") 49python () {
50 machine_devicetree = d.getVar("MACHINE_DEVICETREE", True) or ''
51 machine_kconfigs = d.getVar("MACHINE_KCONFIG", True) or ''
52 sources = set()
53 for path in (machine_devicetree.split() + machine_kconfigs.split()):
54 sources.add("file://" + path)
32 if len(sources) != 0: 55 if len(sources) != 0:
33 d.setVar("SRC_URI_append", " %s " % " ".join(sources)) 56 d.setVar("SRC_URI_append", " %s " % " ".join(sources))
34} 57}
58
59# 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
61# Yocto does not provide include path support.
62do_install_prepend() {
63 if test -n "${MACHINE_DEVICETREE}"; then
64 mkdir -p ${WORKDIR}/devicetree
65 for i in ${MACHINE_DEVICETREE}; do
66 if test -e ${WORKDIR}/$i; then
67 cp ${WORKDIR}/$i ${WORKDIR}/devicetree
68 fi
69 done
70 fi
71}
diff --git a/recipes-kernel/linux/linux-xlnx.inc b/recipes-kernel/linux/linux-xlnx.inc
index b31d61bd..0065466d 100644
--- a/recipes-kernel/linux/linux-xlnx.inc
+++ b/recipes-kernel/linux/linux-xlnx.inc
@@ -18,8 +18,8 @@ COMPATIBLE_MACHINE = "qemumicroblaze|qemuzynq|microblaze|zynq"
18 18
19# Common kernel configuration parts 19# Common kernel configuration parts
20# Arch specific kernel configuration parts 20# Arch specific kernel configuration parts
21SRC_URI_append_zynq += "file://zynq_defconfig_${LINUX_VERSION}.cfg" 21MACHINE_KCONFIG_append_zynq += "common/zynq_defconfig_${LINUX_VERSION}.cfg"
22SRC_URI_append_microblaze += "file://microblaze_defconfig_${LINUX_VERSION}.cfg" 22MACHINE_KCONFIG_append_microblaze += "common/microblaze_defconfig_${LINUX_VERSION}.cfg"
23 23
24# Add the modules directory to the 'kernel-base' files list 24# Add the modules directory to the 'kernel-base' files list
25FILES_kernel-base_append = " /lib/modules/${KERNEL_VERSION}/kernel" 25FILES_kernel-base_append = " /lib/modules/${KERNEL_VERSION}/kernel"