<div dir="ltr">The refactoring is already in the 3 previous patches from these 4. This is just the final fix, what do you want to separate from this?</div><br><div class="gmail_quote"><div dir="ltr">On Wed, Jul 4, 2018 at 10:54 AM Paulo Neves &lt;<a href="mailto:ptsneves@gmail.com">ptsneves@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Great work!<br>
<br>
The only issue I have with your changes is that this is basically a<br>
rewrite and you mix fixes with refactoring. Would it be possible to<br>
split the patch into smaller patches? This would make it much easier<br>
analyze.<br>
<br>
<br>
<br>
On Wed, Jul 4, 2018 at 9:59 AM, Martin Jansa &lt;<a href="mailto:martin.jansa@gmail.com" target="_blank">martin.jansa@gmail.com</a>&gt; wrote:<br>
&gt; * add 2 new variables:<br>
&gt;   KERNEL_DTB_BASE_NAME<br>
&gt;   KERNEL_DTB_SYMLINK_NAME<br>
&gt;   instead of reusing KERNEL_IMAGE_SYMLINK_NAME and than expecting that<br>
&gt;   default value ${MACHINE} was being used in e.g.:<br>
&gt;   DTB_SYMLINK_NAME=`echo ${symlink_name} | sed &quot;s/${MACHINE}/${DTB_BASE_NAME}/g&quot;`<br>
&gt;<br>
&gt; * install normal DTB files only once even if there is multiple entries<br>
&gt;   in KERNEL_IMAGETYPE_FOR_MAKE and don&#39;t prefix them with the type of<br>
&gt;   the kernel image, use the KERNEL_IMAGETYPE_FOR_MAKE as a prefix only<br>
&gt;   when installing them bundled with kernel or initramfs image.<br>
&gt;<br>
&gt; * deploy the files from ${D}/${KERNEL_IMAGEDEST}/ instead of kernel<br>
&gt;   build directory, so that we don&#39;t need to call<br>
&gt;   DTB_PATH=`get_real_dtb_path_in_kernel &quot;${DTB}&quot;`<br>
&gt;   again in do_deploy<br>
&gt;<br>
&gt; * create all links in do_deploy task, because default KERNEL_DTB_BASE_NAME<br>
&gt;   like KERNEL_IMAGE_BASE_NAME contains PKGR and PKGR is different in<br>
&gt;   do_install and do_deploy, because kernel.bbclass calls<br>
&gt;   meta/classes/kernel.bbclass:do_install[prefuncs] += &quot;package_get_auto_pr&quot;<br>
&gt;   meta/classes/kernel.bbclass:do_deploy[prefuncs] += &quot;package_get_auto_pr&quot;<br>
&gt;<br>
&gt; * the filenames are a bit different, but with separate variable it<br>
&gt;   should be easier for other bbclasses which use these DTB files to<br>
&gt;   find them correctly, just use either the cannonical name<br>
&gt;   $dtb_base_name.$dtb_ext or $dtb_base_name-${KERNEL_DTB_SYMLINK_NAME}.$dtb_ext<br>
&gt;   because PKGR (and other PKG* variables) might be different in your<br>
&gt;   task and kernel.do_deploy task.<br>
&gt;<br>
&gt; * fix DTB files being deployed with incorrect filenames when<br>
&gt;   KERNEL_IMAGE_SYMLINK_NAME isn&#39;t set to ${MACHINE}, e.g. instead of<br>
&gt;   the default:<br>
&gt; -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<br>
&gt; lrwxrwxrwx 2 bitbake bitbake   64 Nov 20 07:41 deploy/images/raspberrypi3-64/Image-lirc-rpi.dtbo -&gt; Image-1-4.9.59+git0+e7976b2aff-r0.2-lirc-rpi-20171120043031.dtbo<br>
&gt; lrwxrwxrwx 2 bitbake bitbake   64 Nov 20 07:41 deploy/images/raspberrypi3-64/lirc-rpi.dtbo -&gt; Image-1-4.9.59+git0+e7976b2aff-r0.2-lirc-rpi-20171120043031.dtbo<br>
&gt;   I was getting:<br>
&gt; -rw-r--r-- 2 bitbake bitbake 1348 Nov 20 10:28 deploy/images/raspberrypi3-64/Image-linux-raspberrypi-lirc-rpi.dtbo<br>
&gt; lrwxrwxrwx 2 bitbake bitbake   37 Nov 20 10:28 deploy/images/raspberrypi3-64/Image-linux-raspberrypi-lirc-rpi-master-20171120102653.dtbo -&gt; Image-linux-raspberrypi-lirc-rpi.dtbo<br>
&gt; lrwxrwxrwx 2 bitbake bitbake   37 Nov 20 10:28 deploy/images/raspberrypi3-64/lirc-rpi.dtbo -&gt; Image-linux-raspberrypi-lirc-rpi.dtbo<br>
&gt;   and e.g. sdcard_image-rpi.bbclass from meta-raspberrypi:<br>
&gt;   <a href="https://github.com/agherzan/meta-raspberrypi/blob/37e4e18f4a745ce8dc11f7e40a29da0859ff13c6/classes/sdcard_image-rpi.bbclass" rel="noreferrer" target="_blank">https://github.com/agherzan/meta-raspberrypi/blob/37e4e18f4a745ce8dc11f7e40a29da0859ff13c6/classes/sdcard_image-rpi.bbclass</a><br>
&gt;   was failing in:<br>
&gt;   mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTB_BASE_NAME}.dtb ::${DTB_BASE_NAME}.dtb<br>
&gt;   because ${KERNEL_IMAGETYPE}-${DTB_BASE_NAME}.dtb doesn&#39;t exist in my<br>
&gt;   build, due to<br>
&gt;   DTB_SYMLINK_NAME=`echo ${symlink_name} | sed &quot;s/${MACHINE}/${DTB_BASE_NAME}/g&quot;`<br>
&gt;   not replacing whole &quot;${KERNEL_IMAGE_SYMLINK_NAME}&quot; (read ${MACHINE})<br>
&gt;   with just ${DTB_BASE_NAME}<br>
&gt;<br>
&gt; * with this change applied the deploy dir looks like this:<br>
&gt; -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<br>
&gt; lrwxrwxrwx 2 bitbake bitbake   74 Nov 20 15:49 deploy/images/raspberrypi3-64/lirc-rpi.dtbo -&gt; lirc-rpi-1-4.9.59+git0+e7976b2aff-r0.8-raspberrypi3-64-20171120154716.dtbo<br>
&gt; lrwxrwxrwx 2 bitbake bitbake   74 Nov 20 15:49 deploy/images/raspberrypi3-64/lirc-rpi-raspberrypi3-64.dtbo -&gt; lirc-rpi-1-4.9.59+git0+e7976b2aff-r0.8-raspberrypi3-64-20171120154716.dtbo<br>
&gt;   and works correctly even with DISTRO using different naming scheme<br>
&gt;<br>
&gt; * the sdcard_image-rpi.bbclass still needs to be modified, I&#39;ve provided<br>
&gt;   updated version here:<br>
&gt;   <a href="https://github.com/agherzan/meta-raspberrypi/pull/159" rel="noreferrer" target="_blank">https://github.com/agherzan/meta-raspberrypi/pull/159</a><br>
&gt;<br>
&gt; Signed-off-by: Martin Jansa &lt;<a href="mailto:Martin.Jansa@gmail.com" target="_blank">Martin.Jansa@gmail.com</a>&gt;<br>
&gt; ---<br>
&gt;  meta/classes/kernel-devicetree.bbclass | 47 ++++++++------------------<br>
&gt;  meta/classes/kernel.bbclass            |  3 ++<br>
&gt;  2 files changed, 18 insertions(+), 32 deletions(-)<br>
&gt;<br>
&gt; diff --git a/meta/classes/kernel-devicetree.bbclass b/meta/classes/kernel-devicetree.bbclass<br>
&gt; index 5d38d3760d..7faa869493 100644<br>
&gt; --- a/meta/classes/kernel-devicetree.bbclass<br>
&gt; +++ b/meta/classes/kernel-devicetree.bbclass<br>
&gt; @@ -60,20 +60,9 @@ do_install_append() {<br>
&gt;         for dtbf in ${KERNEL_DEVICETREE}; do<br>
&gt;                 dtb=`normalize_dtb &quot;$dtbf&quot;`<br>
&gt;                 dtb_ext=${dtb##*.}<br>
&gt; +               dtb_base_name=`basename $dtb .$dtb_ext`<br>
&gt;                 dtb_path=`get_real_dtb_path_in_kernel &quot;$dtb&quot;`<br>
&gt; -               dtb_base_name=`basename $dtb .&quot;$dtb_ext&quot;`<br>
&gt;                 install -m 0644 $dtb_path ${D}/${KERNEL_IMAGEDEST}/$dtb_base_name.$dtb_ext<br>
&gt; -               for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do<br>
&gt; -                       symlink_name=${type}&quot;-&quot;${KERNEL_IMAGE_SYMLINK_NAME}<br>
&gt; -                       dtb_symlink_name=`echo ${symlink_name} | sed &quot;s/${MACHINE}/$dtb_base_name/g&quot;`<br>
&gt; -                       ln -sf $dtb_base_name.$dtb_ext ${D}/${KERNEL_IMAGEDEST}/devicetree-$dtb_symlink_name.$dtb_ext<br>
&gt; -<br>
&gt; -                       if [ &quot;$type&quot; = &quot;zImage&quot; ] &amp;&amp; [ &quot;${KERNEL_DEVICETREE_BUNDLE}&quot; = &quot;1&quot; ]; then<br>
&gt; -                               cat ${D}/${KERNEL_IMAGEDEST}/$type \<br>
&gt; -                                       ${D}/${KERNEL_IMAGEDEST}/$dtb_base_name.$dtb_ext \<br>
&gt; -                                       &gt; ${D}/${KERNEL_IMAGEDEST}/$type-$dtb_base_name.$dtb_ext.bin<br>
&gt; -                       fi<br>
&gt; -               done<br>
&gt;         done<br>
&gt;  }<br>
&gt;<br>
&gt; @@ -81,30 +70,24 @@ do_deploy_append() {<br>
&gt;         for dtbf in ${KERNEL_DEVICETREE}; do<br>
&gt;                 dtb=`normalize_dtb &quot;$dtbf&quot;`<br>
&gt;                 dtb_ext=${dtb##*.}<br>
&gt; -               dtb_base_name=`basename $dtb .&quot;$dtb_ext&quot;`<br>
&gt; +               dtb_base_name=`basename $dtb .$dtb_ext`<br>
&gt; +               install -d ${DEPLOYDIR}<br>
&gt; +               install -m 0644 ${D}/${KERNEL_IMAGEDEST}/$dtb_base_name.$dtb_ext ${DEPLOYDIR}/$dtb_base_name-${KERNEL_DTB_BASE_NAME}.$dtb_ext<br>
&gt; +               ln -sf $dtb_base_name-${KERNEL_DTB_BASE_NAME}.$dtb_ext ${DEPLOYDIR}/$dtb_base_name.$dtb_ext<br>
&gt; +               ln -sf $dtb_base_name-${KERNEL_DTB_BASE_NAME}.$dtb_ext ${DEPLOYDIR}/$dtb_base_name-${KERNEL_DTB_SYMLINK_NAME}.$dtb_ext<br>
&gt;                 for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do<br>
&gt; -                       base_name=${type}&quot;-&quot;${KERNEL_IMAGE_BASE_NAME}<br>
&gt; -                       symlink_name=${type}&quot;-&quot;${KERNEL_IMAGE_SYMLINK_NAME}<br>
&gt; -                       dtb_name=`echo ${base_name} | sed &quot;s/${MACHINE}/$dtb_base_name/g&quot;`<br>
&gt; -                       dtb_symlink_name=`echo ${symlink_name} | sed &quot;s/${MACHINE}/$dtb_base_name/g&quot;`<br>
&gt; -                       dtb_path=`get_real_dtb_path_in_kernel &quot;$dtb&quot;`<br>
&gt; -                       install -d ${DEPLOYDIR}<br>
&gt; -                       install -m 0644 $dtb_path ${DEPLOYDIR}/$dtb_name.$dtb_ext<br>
&gt; -                       ln -sf $dtb_name.$dtb_ext ${DEPLOYDIR}/$dtb_symlink_name.$dtb_ext<br>
&gt; -                       ln -sf $dtb_name.$dtb_ext ${DEPLOYDIR}/$dtb_base_name.$dtb_ext<br>
&gt; -<br>
&gt;                         if [ &quot;$type&quot; = &quot;zImage&quot; ] &amp;&amp; [ &quot;${KERNEL_DEVICETREE_BUNDLE}&quot; = &quot;1&quot; ]; then<br>
&gt; -                               cat ${DEPLOYDIR}/$type \<br>
&gt; -                                       ${DEPLOYDIR}/$dtb_name.$dtb_ext \<br>
&gt; -                                       &gt; ${DEPLOYDIR}/$dtb_name.$dtb_ext.bin<br>
&gt; -                               ln -sf $dtb_name.$dtb_ext.bin ${DEPLOYDIR}/$type-$dtb_base_name.$dtb_ext.bin<br>
&gt; -<br>
&gt; +                               cat ${D}/${KERNEL_IMAGEDEST}/$type \<br>
&gt; +                                       ${DEPLOYDIR}/$dtb_base_name-${KERNEL_DTB_BASE_NAME}.$dtb_ext \<br>
&gt; +                                       &gt; ${DEPLOYDIR}/$type-$dtb_base_name-${KERNEL_DTB_BASE_NAME}.$dtb_ext.bin<br>
&gt; +                               ln -sf $type-$dtb_base_name-${KERNEL_DTB_BASE_NAME}.$dtb_ext.bin \<br>
&gt; +                                       ${DEPLOYDIR}/$type-$dtb_base_name-${KERNEL_DTB_SYMLINK_NAME}.$dtb_ext.bin<br>
&gt;                                 if [ -e &quot;${KERNEL_OUTPUT_DIR}/${type}.initramfs&quot; ]; then<br>
&gt;                                         cat ${KERNEL_OUTPUT_DIR}/${type}.initramfs \<br>
&gt; -                                               ${DEPLOYDIR}/$dtb_name.$dtb_ext \<br>
&gt; -                                               &gt; ${DEPLOYDIR}/${type}-${INITRAMFS_BASE_NAME}-$dtb_base_name.$dtb_ext.bin<br>
&gt; -                                       ln -sf ${type}-${INITRAMFS_BASE_NAME}-$dtb_base_name.$dtb_ext.bin \<br>
&gt; -                                              ${DEPLOYDIR}/${type}-initramfs-$dtb_base_name.$dtb_ext-${MACHINE}.bin<br>
&gt; +                                               ${DEPLOYDIR}/$dtb_base_name-${KERNEL_DTB_BASE_NAME}.$dtb_ext<br>
&gt; +                                               &gt;  ${DEPLOYDIR}/${type}-${INITRAMFS_BASE_NAME}-$dtb_base_name-${KERNEL_DTB_BASE_NAME}.$dtb_ext.bin<br>
&gt; +                                       ln -sf ${type}-${INITRAMFS_BASE_NAME}-$dtb_base_name-${KERNEL_DTB_BASE_NAME}.$dtb_ext.bin \<br>
&gt; +                                               ${DEPLOYDIR}/${type}-${INITRAMFS_BASE_NAME}-$dtb_base_name-${KERNEL_DTB_SYMLINK_NAME}.$dtb_ext.bin<br>
&gt;                                 fi<br>
&gt;                         fi<br>
&gt;                 done<br>
&gt; diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass<br>
&gt; index 3213b932bf..7ce64fd19f 100644<br>
&gt; --- a/meta/classes/kernel.bbclass<br>
&gt; +++ b/meta/classes/kernel.bbclass<br>
&gt; @@ -663,6 +663,9 @@ KERNEL_IMAGE_BASE_NAME ?= &quot;${PKGE}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}&quot;<br>
&gt;  # Don&#39;t include the DATETIME variable in the sstate package signatures<br>
&gt;  KERNEL_IMAGE_BASE_NAME[vardepsexclude] = &quot;DATETIME&quot;<br>
&gt;  KERNEL_IMAGE_SYMLINK_NAME ?= &quot;${MACHINE}&quot;<br>
&gt; +KERNEL_DTB_BASE_NAME ?= &quot;${PKGE}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}&quot;<br>
&gt; +KERNEL_DTB_BASE_NAME[vardepsexclude] = &quot;DATETIME&quot;<br>
&gt; +KERNEL_DTB_SYMLINK_NAME ?= &quot;${MACHINE}&quot;<br>
&gt;  MODULE_IMAGE_BASE_NAME ?= &quot;modules-${PKGE}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}&quot;<br>
&gt;  MODULE_IMAGE_BASE_NAME[vardepsexclude] = &quot;DATETIME&quot;<br>
&gt;  MODULE_TARBALL_BASE_NAME ?= &quot;${MODULE_IMAGE_BASE_NAME}.tgz&quot;<br>
&gt; --<br>
&gt; 2.17.1<br>
&gt;<br>
&gt; --<br>
&gt; _______________________________________________<br>
&gt; Openembedded-core mailing list<br>
&gt; <a href="mailto:Openembedded-core@lists.openembedded.org" target="_blank">Openembedded-core@lists.openembedded.org</a><br>
&gt; <a href="http://lists.openembedded.org/mailman/listinfo/openembedded-core" rel="noreferrer" target="_blank">http://lists.openembedded.org/mailman/listinfo/openembedded-core</a><br>
</blockquote></div>