summaryrefslogtreecommitdiffstats
path: root/meta/classes/kernel-devicetree.bbclass
diff options
context:
space:
mode:
authorMartin Jansa <martin.jansa@gmail.com>2018-07-09 15:04:58 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-07-10 17:32:59 +0100
commitc5b70d7155a76b727400db225c446d1b2f7072a6 (patch)
tree7ec881c657c5437c85080fca3bb9050f397bc246 /meta/classes/kernel-devicetree.bbclass
parent85d1f532f3fd739d78e27808fff669e5244b2221 (diff)
downloadpoky-c5b70d7155a76b727400db225c446d1b2f7072a6.tar.gz
kernel-devicetree.bbclass: Fix and simplify instalation of DTB files
* add 2 new variables: KERNEL_DTB_BASE_NAME KERNEL_DTB_SYMLINK_NAME instead of reusing KERNEL_IMAGE_SYMLINK_NAME and than expecting that default value ${MACHINE} was being used in e.g.: DTB_SYMLINK_NAME=`echo ${symlink_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"` * install normal DTB files only once even if there is multiple entries in KERNEL_IMAGETYPE_FOR_MAKE and don't prefix them with the type of the kernel image, use the KERNEL_IMAGETYPE_FOR_MAKE as a prefix only when installing them bundled with kernel or initramfs image. * deploy the files from ${D}/${KERNEL_IMAGEDEST}/ instead of kernel build directory, so that we don't need to call DTB_PATH=`get_real_dtb_path_in_kernel "${DTB}"` again in do_deploy * create all links in do_deploy task, because default KERNEL_DTB_BASE_NAME like KERNEL_IMAGE_BASE_NAME contains PKGR and PKGR is different in do_install and do_deploy, because kernel.bbclass calls meta/classes/kernel.bbclass:do_install[prefuncs] += "package_get_auto_pr" meta/classes/kernel.bbclass:do_deploy[prefuncs] += "package_get_auto_pr" * the filenames are a bit different, but with separate variable it should be easier for other bbclasses which use these DTB files to find them correctly, just use either the cannonical name $dtb_base_name.$dtb_ext or $dtb_base_name-${KERNEL_DTB_SYMLINK_NAME}.$dtb_ext because PKGR (and other PKG* variables) might be different in your task and kernel.do_deploy task. * fix DTB files being deployed with incorrect filenames when KERNEL_IMAGE_SYMLINK_NAME isn't set to ${MACHINE}, e.g. instead of the default: -rw-r--r-- 2 bitbake bitbake 1.4K Nov 20 07:41 deploy/images/raspberrypi3-64/Image-1-4.9.59+git0+e7976b2aff-r0.2-lirc-rpi-20171120043031.dtbo lrwxrwxrwx 2 bitbake bitbake 64 Nov 20 07:41 deploy/images/raspberrypi3-64/Image-lirc-rpi.dtbo -> Image-1-4.9.59+git0+e7976b2aff-r0.2-lirc-rpi-20171120043031.dtbo lrwxrwxrwx 2 bitbake bitbake 64 Nov 20 07:41 deploy/images/raspberrypi3-64/lirc-rpi.dtbo -> Image-1-4.9.59+git0+e7976b2aff-r0.2-lirc-rpi-20171120043031.dtbo I was getting: -rw-r--r-- 2 bitbake bitbake 1348 Nov 20 10:28 deploy/images/raspberrypi3-64/Image-linux-raspberrypi-lirc-rpi.dtbo lrwxrwxrwx 2 bitbake bitbake 37 Nov 20 10:28 deploy/images/raspberrypi3-64/Image-linux-raspberrypi-lirc-rpi-master-20171120102653.dtbo -> Image-linux-raspberrypi-lirc-rpi.dtbo lrwxrwxrwx 2 bitbake bitbake 37 Nov 20 10:28 deploy/images/raspberrypi3-64/lirc-rpi.dtbo -> Image-linux-raspberrypi-lirc-rpi.dtbo and e.g. sdcard_image-rpi.bbclass from meta-raspberrypi: https://github.com/agherzan/meta-raspberrypi/blob/37e4e18f4a745ce8dc11f7e40a29da0859ff13c6/classes/sdcard_image-rpi.bbclass was failing in: mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTB_BASE_NAME}.dtb ::${DTB_BASE_NAME}.dtb because ${KERNEL_IMAGETYPE}-${DTB_BASE_NAME}.dtb doesn't exist in my build, due to DTB_SYMLINK_NAME=`echo ${symlink_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"` not replacing whole "${KERNEL_IMAGE_SYMLINK_NAME}" (read ${MACHINE}) with just ${DTB_BASE_NAME} * with this change applied the deploy dir looks like this: -rw-r--r-- 2 bitbake bitbake 1.4K Nov 20 15:49 deploy/images/raspberrypi3-64/lirc-rpi-1-4.9.59+git0+e7976b2aff-r0.8-raspberrypi3-64-20171120154716.dtbo lrwxrwxrwx 2 bitbake bitbake 74 Nov 20 15:49 deploy/images/raspberrypi3-64/lirc-rpi.dtbo -> lirc-rpi-1-4.9.59+git0+e7976b2aff-r0.8-raspberrypi3-64-20171120154716.dtbo lrwxrwxrwx 2 bitbake bitbake 74 Nov 20 15:49 deploy/images/raspberrypi3-64/lirc-rpi-raspberrypi3-64.dtbo -> lirc-rpi-1-4.9.59+git0+e7976b2aff-r0.8-raspberrypi3-64-20171120154716.dtbo and works correctly even with DISTRO using different naming scheme * the sdcard_image-rpi.bbclass still needs to be modified, I've provided updated version here: https://github.com/agherzan/meta-raspberrypi/pull/159 * mpc8315e-rdb.conf MACHINE in meta-yocto-bsp also needs small fix: https://lists.yoctoproject.org/pipermail/poky/2018-July/011436.html (From OE-Core rev: 1860d9d3c62e2e94cd68a809385873ffd8270b6d) Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/kernel-devicetree.bbclass')
-rw-r--r--meta/classes/kernel-devicetree.bbclass47
1 files changed, 15 insertions, 32 deletions
diff --git a/meta/classes/kernel-devicetree.bbclass b/meta/classes/kernel-devicetree.bbclass
index 10441475e8..9c5e125981 100644
--- a/meta/classes/kernel-devicetree.bbclass
+++ b/meta/classes/kernel-devicetree.bbclass
@@ -60,20 +60,9 @@ do_install_append() {
60 for dtbf in ${KERNEL_DEVICETREE}; do 60 for dtbf in ${KERNEL_DEVICETREE}; do
61 dtb=`normalize_dtb "$dtbf"` 61 dtb=`normalize_dtb "$dtbf"`
62 dtb_ext=${dtb##*.} 62 dtb_ext=${dtb##*.}
63 dtb_base_name=`basename $dtb .$dtb_ext`
63 dtb_path=`get_real_dtb_path_in_kernel "$dtb"` 64 dtb_path=`get_real_dtb_path_in_kernel "$dtb"`
64 dtb_base_name=`basename $dtb ."$dtb_ext"`
65 install -m 0644 $dtb_path ${D}/${KERNEL_IMAGEDEST}/$dtb_base_name.$dtb_ext 65 install -m 0644 $dtb_path ${D}/${KERNEL_IMAGEDEST}/$dtb_base_name.$dtb_ext
66 for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
67 symlink_name=${type}"-"${KERNEL_IMAGE_SYMLINK_NAME}
68 dtb_symlink_name=`echo ${symlink_name} | sed "s/${MACHINE}/$dtb_base_name/g"`
69 ln -sf $dtb_base_name.$dtb_ext ${D}/${KERNEL_IMAGEDEST}/devicetree-$dtb_symlink_name.$dtb_ext
70
71 if [ "$type" = "zImage" ] && [ "${KERNEL_DEVICETREE_BUNDLE}" = "1" ]; then
72 cat ${D}/${KERNEL_IMAGEDEST}/$type \
73 ${D}/${KERNEL_IMAGEDEST}/$dtb_base_name.$dtb_ext \
74 > ${D}/${KERNEL_IMAGEDEST}/$type-$dtb_base_name.$dtb_ext.bin
75 fi
76 done
77 done 66 done
78} 67}
79 68
@@ -81,30 +70,24 @@ do_deploy_append() {
81 for dtbf in ${KERNEL_DEVICETREE}; do 70 for dtbf in ${KERNEL_DEVICETREE}; do
82 dtb=`normalize_dtb "$dtbf"` 71 dtb=`normalize_dtb "$dtbf"`
83 dtb_ext=${dtb##*.} 72 dtb_ext=${dtb##*.}
84 dtb_base_name=`basename $dtb ."$dtb_ext"` 73 dtb_base_name=`basename $dtb .$dtb_ext`
74 install -d ${DEPLOYDIR}
75 install -m 0644 ${D}/${KERNEL_IMAGEDEST}/$dtb_base_name.$dtb_ext ${DEPLOYDIR}/$dtb_base_name-${KERNEL_DTB_BASE_NAME}.$dtb_ext
76 ln -sf $dtb_base_name-${KERNEL_DTB_BASE_NAME}.$dtb_ext ${DEPLOYDIR}/$dtb_base_name.$dtb_ext
77 ln -sf $dtb_base_name-${KERNEL_DTB_BASE_NAME}.$dtb_ext ${DEPLOYDIR}/$dtb_base_name-${KERNEL_DTB_SYMLINK_NAME}.$dtb_ext
85 for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do 78 for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
86 base_name=${type}"-"${KERNEL_IMAGE_BASE_NAME}
87 symlink_name=${type}"-"${KERNEL_IMAGE_SYMLINK_NAME}
88 dtb_name=`echo ${base_name} | sed "s/${MACHINE}/$dtb_base_name/g"`
89 dtb_symlink_name=`echo ${symlink_name} | sed "s/${MACHINE}/$dtb_base_name/g"`
90 dtb_path=`get_real_dtb_path_in_kernel "$dtb"`
91 install -d ${DEPLOYDIR}
92 install -m 0644 $dtb_path ${DEPLOYDIR}/$dtb_name.$dtb_ext
93 ln -sf $dtb_name.$dtb_ext ${DEPLOYDIR}/$dtb_symlink_name.$dtb_ext
94 ln -sf $dtb_name.$dtb_ext ${DEPLOYDIR}/$dtb_base_name.$dtb_ext
95
96 if [ "$type" = "zImage" ] && [ "${KERNEL_DEVICETREE_BUNDLE}" = "1" ]; then 79 if [ "$type" = "zImage" ] && [ "${KERNEL_DEVICETREE_BUNDLE}" = "1" ]; then
97 cat ${DEPLOYDIR}/$type \ 80 cat ${D}/${KERNEL_IMAGEDEST}/$type \
98 ${DEPLOYDIR}/$dtb_name.$dtb_ext \ 81 ${DEPLOYDIR}/$dtb_base_name-${KERNEL_DTB_BASE_NAME}.$dtb_ext \
99 > ${DEPLOYDIR}/$dtb_name.$dtb_ext.bin 82 > ${DEPLOYDIR}/$type-$dtb_base_name-${KERNEL_DTB_BASE_NAME}.$dtb_ext.bin
100 ln -sf $dtb_name.$dtb_ext.bin ${DEPLOYDIR}/$type-$dtb_base_name.$dtb_ext.bin 83 ln -sf $type-$dtb_base_name-${KERNEL_DTB_BASE_NAME}.$dtb_ext.bin \
101 84 ${DEPLOYDIR}/$type-$dtb_base_name-${KERNEL_DTB_SYMLINK_NAME}.$dtb_ext.bin
102 if [ -e "${KERNEL_OUTPUT_DIR}/${type}.initramfs" ]; then 85 if [ -e "${KERNEL_OUTPUT_DIR}/${type}.initramfs" ]; then
103 cat ${KERNEL_OUTPUT_DIR}/${type}.initramfs \ 86 cat ${KERNEL_OUTPUT_DIR}/${type}.initramfs \
104 ${DEPLOYDIR}/$dtb_name.$dtb_ext \ 87 ${DEPLOYDIR}/$dtb_base_name-${KERNEL_DTB_BASE_NAME}.$dtb_ext
105 > ${DEPLOYDIR}/${type}-${INITRAMFS_BASE_NAME}-$dtb_base_name.$dtb_ext.bin 88 > ${DEPLOYDIR}/${type}-${INITRAMFS_BASE_NAME}-$dtb_base_name-${KERNEL_DTB_BASE_NAME}.$dtb_ext.bin
106 ln -sf ${type}-${INITRAMFS_BASE_NAME}-$dtb_base_name.$dtb_ext.bin \ 89 ln -sf ${type}-${INITRAMFS_BASE_NAME}-$dtb_base_name-${KERNEL_DTB_BASE_NAME}.$dtb_ext.bin \
107 ${DEPLOYDIR}/${type}-initramfs-$dtb_base_name.$dtb_ext-${MACHINE}.bin 90 ${DEPLOYDIR}/${type}-${INITRAMFS_BASE_NAME}-$dtb_base_name-${KERNEL_DTB_SYMLINK_NAME}.$dtb_ext.bin
108 fi 91 fi
109 fi 92 fi
110 done 93 done