summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2017-09-12 17:36:06 -0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-09-13 22:07:42 +0100
commit53067c4a97561747ea760d3b72cb3abc2b7409db (patch)
tree08159fb0738ca817b0e8297268ef9ebbfcfdc4ca /meta/recipes-kernel
parent03aa1ef733032e1acae4d291580968301679117f (diff)
downloadpoky-53067c4a97561747ea760d3b72cb3abc2b7409db.tar.gz
kernel: Move Device Tree support to kernel.bbclass
The Device Tree is commonly used but it is still kept as a .inc file instead of a proper class. Instead now we move the Device Tree code to a kernel-devicetree class and automatically enable it when the KERNEL_DEVICETREE variable is set. To avoid breakage in existing layers, we kept a linux-dtb.inc file which raises a warning telling the user about the change so in next release this can be removed. (From OE-Core rev: 03a00be7f2062aefef0e51ef20a4c9737f6685e7) Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-kernel')
-rw-r--r--meta/recipes-kernel/linux/linux-dtb.inc66
-rw-r--r--meta/recipes-kernel/linux/linux-yocto.inc1
2 files changed, 2 insertions, 65 deletions
diff --git a/meta/recipes-kernel/linux/linux-dtb.inc b/meta/recipes-kernel/linux/linux-dtb.inc
index ca92822d25..f1912775ca 100644
--- a/meta/recipes-kernel/linux/linux-dtb.inc
+++ b/meta/recipes-kernel/linux/linux-dtb.inc
@@ -1,65 +1,3 @@
1# Support for device tree generation 1python() {
2FILES_kernel-devicetree = "/${KERNEL_IMAGEDEST}/*.dtb /${KERNEL_IMAGEDEST}/*.dtbo" 2 bb.warn("You are using the linux-dtb.inc which is deprecated. You can safely remove it as the Device Tree support is automatically enabled when KERNEL_DEVICETREE is set.")
3
4python __anonymous () {
5 d.appendVar("PACKAGES", " kernel-devicetree")
6}
7
8normalize_dtb () {
9 DTB="$1"
10 if echo ${DTB} | grep -q '/dts/'; then
11 bbwarn "${DTB} contains the full path to the the dts file, but only the dtb name should be used."
12 DTB=`basename ${DTB} | sed 's,\.dts$,.dtb,g'`
13 fi
14 echo "${DTB}"
15}
16
17get_real_dtb_path_in_kernel () {
18 DTB="$1"
19 DTB_PATH="${B}/arch/${ARCH}/boot/dts/${DTB}"
20 if [ ! -e "${DTB_PATH}" ]; then
21 DTB_PATH="${B}/arch/${ARCH}/boot/${DTB}"
22 fi
23 echo "${DTB_PATH}"
24}
25
26do_compile_append() {
27 for DTB in ${KERNEL_DEVICETREE}; do
28 DTB=`normalize_dtb "${DTB}"`
29 oe_runmake ${DTB}
30 done
31}
32
33do_install_append() {
34 for DTB in ${KERNEL_DEVICETREE}; do
35 DTB=`normalize_dtb "${DTB}"`
36 DTB_EXT=${DTB##*.}
37 DTB_PATH=`get_real_dtb_path_in_kernel "${DTB}"`
38 DTB_BASE_NAME=`basename ${DTB} ."${DTB_EXT}"`
39 install -m 0644 ${DTB_PATH} ${D}/${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.${DTB_EXT}
40 for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
41 symlink_name=${type}"-"${KERNEL_IMAGE_SYMLINK_NAME}
42 DTB_SYMLINK_NAME=`echo ${symlink_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
43 ln -sf ${DTB_BASE_NAME}.${DTB_EXT} ${D}/${KERNEL_IMAGEDEST}/devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT}
44 done
45 done
46}
47
48do_deploy_append() {
49 for DTB in ${KERNEL_DEVICETREE}; do
50 DTB=`normalize_dtb "${DTB}"`
51 DTB_EXT=${DTB##*.}
52 DTB_BASE_NAME=`basename ${DTB} ."${DTB_EXT}"`
53 for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
54 base_name=${type}"-"${KERNEL_IMAGE_BASE_NAME}
55 symlink_name=${type}"-"${KERNEL_IMAGE_SYMLINK_NAME}
56 DTB_NAME=`echo ${base_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
57 DTB_SYMLINK_NAME=`echo ${symlink_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
58 DTB_PATH=`get_real_dtb_path_in_kernel "${DTB}"`
59 install -d ${DEPLOYDIR}
60 install -m 0644 ${DTB_PATH} ${DEPLOYDIR}/${DTB_NAME}.${DTB_EXT}
61 ln -sf ${DTB_NAME}.${DTB_EXT} ${DEPLOYDIR}/${DTB_SYMLINK_NAME}.${DTB_EXT}
62 ln -sf ${DTB_NAME}.${DTB_EXT} ${DEPLOYDIR}/${DTB_BASE_NAME}.${DTB_EXT}
63 done
64 done
65} 3}
diff --git a/meta/recipes-kernel/linux/linux-yocto.inc b/meta/recipes-kernel/linux/linux-yocto.inc
index 1b8ffd0c17..9c1f61be75 100644
--- a/meta/recipes-kernel/linux/linux-yocto.inc
+++ b/meta/recipes-kernel/linux/linux-yocto.inc
@@ -54,7 +54,6 @@ LINUX_VERSION_EXTENSION ??= "-yocto-${LINUX_KERNEL_TYPE}"
54# Pick up shared functions 54# Pick up shared functions
55inherit kernel 55inherit kernel
56inherit kernel-yocto 56inherit kernel-yocto
57require linux-dtb.inc
58 57
59B = "${WORKDIR}/linux-${PACKAGE_ARCH}-${LINUX_KERNEL_TYPE}-build" 58B = "${WORKDIR}/linux-${PACKAGE_ARCH}-${LINUX_KERNEL_TYPE}-build"
60 59