summaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--conf/layer.conf3
-rw-r--r--conf/machine/kc705-trd-microblazeel.conf6
-rw-r--r--conf/machine/qemumicroblaze.conf4
-rw-r--r--conf/machine/qemuzynq.conf2
-rw-r--r--conf/machine/zc702-zynq7.conf4
-rw-r--r--conf/machine/zedboard-zynq7.conf6
-rw-r--r--recipes-bsp/u-boot/u-boot-extra.inc15
-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
10 files changed, 86 insertions, 47 deletions
diff --git a/conf/layer.conf b/conf/layer.conf
index ba976bad..d6f07d3d 100644
--- a/conf/layer.conf
+++ b/conf/layer.conf
@@ -8,6 +8,3 @@ BBFILES += " ${LAYERDIR}/recipes-*/*/*.bbappend"
8BBFILE_COLLECTIONS += "xilinx" 8BBFILE_COLLECTIONS += "xilinx"
9BBFILE_PATTERN_xilinx := "^${LAYERDIR}/" 9BBFILE_PATTERN_xilinx := "^${LAYERDIR}/"
10BBFILE_PRIORITY_xilinx = "8" 10BBFILE_PRIORITY_xilinx = "8"
11
12XILINX_LAYERDIR := "${LAYERDIR}"
13XILINX_BOARDDIR := "${XILINX_LAYERDIR}/conf/machine/boards"
diff --git a/conf/machine/kc705-trd-microblazeel.conf b/conf/machine/kc705-trd-microblazeel.conf
index 4552824e..86315ba6 100644
--- a/conf/machine/kc705-trd-microblazeel.conf
+++ b/conf/machine/kc705-trd-microblazeel.conf
@@ -19,6 +19,6 @@ TUNE_FEATURES_tune-microblaze += "v8.50 little-endian barrel-shift pattern-compa
19 19
20SERIAL_CONSOLE = "115200 ttyS0" 20SERIAL_CONSOLE = "115200 ttyS0"
21 21
22MACHINE_DEVICETREE := "${XILINX_BOARDDIR}/kc705/kc705-trd-microblazeel.dts" 22MACHINE_DEVICETREE := "kc705/kc705-trd-microblazeel.dts"
23MACHINE_KCONFIG := "${XILINX_BOARDDIR}/kc705/kc705-trd-microblazeel.kconfig.cfg" 23MACHINE_KCONFIG := "kc705/kc705-trd-microblazeel.kconfig.cfg"
24MACHINE_XPARAMETERS := "${XILINX_BOARDDIR}/kc705/kc705-trd-microblazeel.xparameters.h" 24MACHINE_XPARAMETERS := "kc705/kc705-trd-microblazeel.xparameters.h"
diff --git a/conf/machine/qemumicroblaze.conf b/conf/machine/qemumicroblaze.conf
index 67a22f3e..824dbf47 100644
--- a/conf/machine/qemumicroblaze.conf
+++ b/conf/machine/qemumicroblaze.conf
@@ -9,5 +9,5 @@ TUNE_FEATURES_tune-microblaze += "v8.50 little-endian barrel-shift reorder patte
9 9
10SERIAL_CONSOLE = "115200 ttyS0" 10SERIAL_CONSOLE = "115200 ttyS0"
11 11
12MACHINE_DEVICETREE := "${XILINX_BOARDDIR}/qemu/qemumicroblaze.dts" 12MACHINE_DEVICETREE := "qemu/qemumicroblaze.dts"
13MACHINE_KCONFIG := "${XILINX_BOARDDIR}/qemu/qemumicroblaze.cfg" 13MACHINE_KCONFIG := "qemu/qemumicroblaze.cfg"
diff --git a/conf/machine/qemuzynq.conf b/conf/machine/qemuzynq.conf
index 7db1b0bb..a260dd32 100644
--- a/conf/machine/qemuzynq.conf
+++ b/conf/machine/qemuzynq.conf
@@ -8,4 +8,4 @@ require conf/machine/include/tune-zynq.inc
8 8
9SERIAL_CONSOLE = "115200 ttyPS0" 9SERIAL_CONSOLE = "115200 ttyPS0"
10 10
11MACHINE_DEVICETREE := "${XILINX_BOARDDIR}/qemu/qemuzynq.dts" 11MACHINE_DEVICETREE := "qemu/qemuzynq.dts"
diff --git a/conf/machine/zc702-zynq7.conf b/conf/machine/zc702-zynq7.conf
index 2db72377..bb7fb8d7 100644
--- a/conf/machine/zc702-zynq7.conf
+++ b/conf/machine/zc702-zynq7.conf
@@ -19,5 +19,5 @@ UBOOT_MACHINE = "zynq_zc70x_config"
19 19
20SERIAL_CONSOLE = "115200 ttyPS0" 20SERIAL_CONSOLE = "115200 ttyPS0"
21 21
22MACHINE_DEVICETREE := "${XILINX_BOARDDIR}/zc702/zc702-zynq7.dts" 22MACHINE_DEVICETREE := "zc702/zc702-zynq7.dts"
23MACHINE_KCONFIG := "${XILINX_BOARDDIR}/common/rtc.cfg" 23MACHINE_KCONFIG := "common/rtc.cfg"
diff --git a/conf/machine/zedboard-zynq7.conf b/conf/machine/zedboard-zynq7.conf
index 18223796..6dbb8f75 100644
--- a/conf/machine/zedboard-zynq7.conf
+++ b/conf/machine/zedboard-zynq7.conf
@@ -20,7 +20,7 @@ UBOOT_MACHINE = "zynq_zed_config"
20SERIAL_CONSOLE = "115200 ttyPS0" 20SERIAL_CONSOLE = "115200 ttyPS0"
21 21
22MACHINE_DEVICETREE := " \ 22MACHINE_DEVICETREE := " \
23 ${XILINX_BOARDDIR}/zedboard/zedboard-zynq7.dtsi \ 23 zedboard/zedboard-zynq7.dtsi \
24 ${XILINX_BOARDDIR}/zedboard/zedboard-zynq7-mmcblk0p2.dts \ 24 zedboard/zedboard-zynq7-mmcblk0p2.dts \
25 ${XILINX_BOARDDIR}/zedboard/zedboard-zynq7-ram.dts \ 25 zedboard/zedboard-zynq7-ram.dts \
26 " 26 "
diff --git a/recipes-bsp/u-boot/u-boot-extra.inc b/recipes-bsp/u-boot/u-boot-extra.inc
index 79808a37..e1c89d05 100644
--- a/recipes-bsp/u-boot/u-boot-extra.inc
+++ b/recipes-bsp/u-boot/u-boot-extra.inc
@@ -20,9 +20,16 @@ do_deploy_append() {
20# and generate a u-boot specific config.mk 20# and generate a u-boot specific config.mk
21do_configure_prepend () { 21do_configure_prepend () {
22 if [ "${SOC_FAMILY}" = "microblaze" -a ! -z "${MACHINE_XPARAMETERS}" ]; then 22 if [ "${SOC_FAMILY}" = "microblaze" -a ! -z "${MACHINE_XPARAMETERS}" ]; then
23 if [ ! -z "${MACHINE_XPARAMETERS}" -a -e "${MACHINE_XPARAMETERS}" ]; then 23 # Find the file based on the avaliable layers (using $BBPATH)
24 MACHINE_XPARAMETERS_ABSOLUTE=
25 for i in ${BBPATH}; do
26 if [ -e $i/conf/machine/boards/${MACHINE_XPARAMETERS} ]; then
27 MACHINE_XPARAMETERS_ABSOLUTE = $i/conf/machine/boards/${MACHINE_XPARAMETERS}
28 fi
29 done
30 if [ -e "${MACHINE_XPARAMETERS_ABSOLUTE}" ]; then
24 CONFIG_MK=${S}/board/xilinx/microblaze-generic/config.mk 31 CONFIG_MK=${S}/board/xilinx/microblaze-generic/config.mk
25 cp ${MACHINE_XPARAMETERS} ${S}/board/xilinx/microblaze-generic/xparameters.h 32 cp ${MACHINE_XPARAMETERS_ABSOLUTE} ${S}/board/xilinx/microblaze-generic/xparameters.h
26 33
27 # Generate the config.mk from CFLAGS and XPARAMETERS file 34 # Generate the config.mk from CFLAGS and XPARAMETERS file
28 echo "# This file is generated by the meta-xilinx layer." > ${CONFIG_MK} 35 echo "# This file is generated by the meta-xilinx layer." > ${CONFIG_MK}
@@ -36,8 +43,8 @@ do_configure_prepend () {
36 echo "" >> ${CONFIG_MK} 43 echo "" >> ${CONFIG_MK}
37 44
38 # Calculate the TEXT_BASE address at RAM_END - 4MB 45 # Calculate the TEXT_BASE address at RAM_END - 4MB
39 RAM_START=$(grep "XILINX_RAM_START" ${MACHINE_XPARAMETERS} | grep -o "0x.*$") 46 RAM_START=$(grep "XILINX_RAM_START" ${MACHINE_XPARAMETERS_ABSOLUTE} | grep -o "0x.*$")
40 RAM_SIZE=$(grep "XILINX_RAM_SIZE" ${MACHINE_XPARAMETERS} | grep -o "0x.*$") 47 RAM_SIZE=$(grep "XILINX_RAM_SIZE" ${MACHINE_XPARAMETERS_ABSOLUTE} | grep -o "0x.*$")
41 BASE_OFFSET=$(printf "0x%08x" "$[$RAM_START + $RAM_SIZE - 0x400000]") 48 BASE_OFFSET=$(printf "0x%08x" "$[$RAM_START + $RAM_SIZE - 0x400000]")
42 49
43 echo "TEXT_BASE = $BASE_OFFSET" >> ${CONFIG_MK} 50 echo "TEXT_BASE = $BASE_OFFSET" >> ${CONFIG_MK}
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"