<div dir="ltr"><div dir="ltr"><div>Hi Alex,</div><div><br></div><div>Adding Marek Vasut, original author of kernel-fitimage.bbclass.<br></div><div><br></div><div>&gt; I guess the reason that the deployment happens in kernel.bbclass is so<br>
&gt; you only have all the symlinking logic in one place</div><div><br></div><div>The deployment happens in both kernel.bbclass and kernel-fitimage.bbclass. That was exactly one of the bugs I wanted to solve. I am not sure what the intention was, though.<br></div><div><br></div><div>Marek: can you comment of the exact purpose of the deploy task in kernel-fitimage.bbclass? <br></div><div>Which class should deploy the FIT images themselves?<br></div><div><br></div><div>Whilst cleaning things up, my understanding was that kernel_do_deploy_append() in kernel-fitimage.bbclass deploys the fitImages, along with the .its file etc.</div><div>Maybe I was mistaken.</div></div><div dir="ltr"><br></div><div>I have several other fixed piled up; for example initramfs&#39;s supposed to get bundled inside the kernel get also packed into the FIT; this takes double the amount of space in the FIT image...</div><div><br></div><div>Regards,</div><div><br></div><div>Leon.<br></div><div dir="ltr"><br><div><br></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Sep 18, 2018 at 8:10 AM Alex Kiernan &lt;<a href="mailto:alex.kiernan@gmail.com" target="_blank">alex.kiernan@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">Thanks Leon<br>
<br>
I guess the reason that the deployment happens in kernel.bbclass is so<br>
you only have all the symlinking logic in one place.<br>
<br>
Are in agreement that this change should be reverted and the<br>
&quot;fitImage&quot; deployed here:<br>
<br>
<a href="http://git.openembedded.org/openembedded-core/tree/meta/classes/kernel-fitimage.bbclass#n495" rel="noreferrer" target="_blank">http://git.openembedded.org/openembedded-core/tree/meta/classes/kernel-fitimage.bbclass#n495</a><br>
<br>
is the one which we should remove?<br>
On Mon, Sep 17, 2018 at 7:05 PM Leon Woestenberg &lt;<a href="mailto:leon@sidebranch.com" target="_blank">leon@sidebranch.com</a>&gt; wrote:<br>
&gt;<br>
&gt; Hi Alex,<br>
&gt;<br>
&gt; I expected it to be kernel-fitimage.bbclass’s responsibility to deploy the fitImage.<br>
&gt;<br>
&gt; Regards, Leon<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On 16 Sep 2018, at 16:22, Alex Kiernan &lt;<a href="mailto:alex.kiernan@gmail.com" target="_blank">alex.kiernan@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; On Sun, Sep 16, 2018 at 11:41 AM Alex Kiernan &lt;<a href="mailto:alex.kiernan@gmail.com" target="_blank">alex.kiernan@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt;<br>
&gt; Hi Leon<br>
&gt;<br>
&gt;<br>
&gt; On Sun, Sep 16, 2018 at 10:18 AM Leon Woestenberg &lt;<a href="mailto:leon@sidebranch.com" target="_blank">leon@sidebranch.com</a>&gt; wrote:<br>
&gt;<br>
&gt;<br>
&gt; Hi Alex,<br>
&gt;<br>
&gt;<br>
&gt; On 15 Sep 2018, at 19:45, Alex Kiernan &lt;<a href="mailto:alex.kiernan@gmail.com" target="_blank">alex.kiernan@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt;<br>
&gt; On Mon, Sep 10, 2018 at 10:57 PM Leon Woestenberg &lt;<a href="mailto:leon@sidebranch.com" target="_blank">leon@sidebranch.com</a>&gt; wrote:<br>
&gt;<br>
&gt;<br>
&gt; kernel-fitimage.bbclass replaces an occurance of &quot;fitImage&quot; in<br>
&gt;<br>
&gt; KERNEL_IMAGETYPE_FOR_MAKE by an image type that is buildable for the<br>
&gt;<br>
&gt; architecture (such as zImage). The kernel-fitimage.bbclass packs that<br>
&gt;<br>
&gt; image as sub-image in a flattened image tree image (fitImage) and<br>
&gt;<br>
&gt; deploys this fitImage along with the image tree source file (.its).<br>
&gt;<br>
&gt;<br>
&gt; kernel-fitimage.bbclass does not alter KERNEL_IMAGETYPES, which thus<br>
&gt;<br>
&gt; also contains &quot;fitImage&quot;, which kernel.bbclass will also deploy<br>
&gt;<br>
&gt; redundantly with different naming.<br>
&gt;<br>
&gt;<br>
&gt; The result is a dual deployment with slightly different naming,<br>
&gt;<br>
&gt; each with a set of symlinks.<br>
&gt;<br>
&gt;<br>
&gt; The solution chosen is to have fitImage deployment be handled by<br>
&gt;<br>
&gt; kernel-fitimage.bbclass, and have kernel.bbclass ignore fitImage<br>
&gt;<br>
&gt; types during deployment.<br>
&gt;<br>
&gt;<br>
&gt; Signed-off-by: Leon Woestenberg &lt;<a href="mailto:leon@sidebranch.com" target="_blank">leon@sidebranch.com</a>&gt;<br>
&gt;<br>
&gt;<br>
&gt; This looks completely plausible, but the two &quot;FIT&quot; images that are<br>
&gt;<br>
&gt; installed aren&#39;t identical... after this I end up with no FIT image<br>
&gt;<br>
&gt; and only a bare image in the deploy dir.<br>
&gt;<br>
&gt;<br>
&gt; What was in your KERNEL_IMAGETYPES? Did it at least contain “fitImage”??<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Yes, in fact only fitImage (and no initramfs).<br>
&gt;<br>
&gt;<br>
&gt; Digging into it, the logic between the two classes is a bit odd... in<br>
&gt;<br>
&gt; the case of a non initramfs build, the fitImage is actually installed<br>
&gt;<br>
&gt; here.<br>
&gt;<br>
&gt;<br>
&gt; If ‘here’ means kernel-fitimage, then I’ld say ALL versions of a FIT image containing AT LEAST a Linux kernel are installed by kernel-fitimage.<br>
&gt;<br>
&gt;<br>
&gt; The one that&#39;s installed in kernel-fitimage is the bare<br>
&gt;<br>
&gt; linux.bin, but named fitImage-...<br>
&gt;<br>
&gt;<br>
&gt; which is totally broken. If you want the bare kernel binary (which naming depends on architecture, so it should NOT be hard-coded to linux.bin anyway), you would need to specify that type *also* in KERNEL_IMAGETYPES, next to “fitImage”.<br>
&gt;<br>
&gt;<br>
&gt; Totally agree...<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; I&#39;ll send a patch reverting this and removing the other one as I&#39;d<br>
&gt;<br>
&gt; agree that it appears to have no purpose (and if you did want it, I<br>
&gt;<br>
&gt; guess you could list it in KERNEL_IMAGETYPES).<br>
&gt;<br>
&gt;<br>
&gt; I’m sorry I cannot follow what this and the other one is, and it. Let’s first understand all cases correctly.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Sorry I&#39;ve not described it well... the code in<br>
&gt;<br>
&gt; kernel-fitimage.bbclass that inserts the kernel into the its happens<br>
&gt;<br>
&gt; here <a href="http://git.openembedded.org/openembedded-core/tree/meta/classes/kernel-fitimage.bbclass#n371" rel="noreferrer" target="_blank">http://git.openembedded.org/openembedded-core/tree/meta/classes/kernel-fitimage.bbclass#n371</a><br>
&gt;<br>
&gt;<br>
&gt; fitimage_emit_section_kernel ${1} &quot;${kernelcount}&quot; linux.bin &quot;${linux_comp}&quot;<br>
&gt;<br>
&gt;<br>
&gt; inside fitimage_emit_section_kernel we create a kernel section which<br>
&gt;<br>
&gt; has `data = /incbin/(&quot;${3}&quot;);` so linux.bin is our bare image.<br>
&gt;<br>
&gt;<br>
&gt; Then we have the installation of fitImage-linux-bin that happens here<br>
&gt;<br>
&gt; <a href="http://git.openembedded.org/openembedded-core/tree/meta/classes/kernel-fitimage.bbclass#n495" rel="noreferrer" target="_blank">http://git.openembedded.org/openembedded-core/tree/meta/classes/kernel-fitimage.bbclass#n495</a><br>
&gt;<br>
&gt;<br>
&gt; echo &quot;Copying linux.bin file...&quot;<br>
&gt;<br>
&gt; install -m 0644 ${B}/linux.bin<br>
&gt;<br>
&gt; ${DEPLOYDIR}/fitImage-linux.bin-${KERNEL_FIT_NAME}.bin<br>
&gt;<br>
&gt; ln -snf fitImage-linux.bin-${KERNEL_FIT_NAME}.bin<br>
&gt;<br>
&gt; ${DEPLOYDIR}/fitImage-linux.bin-${KERNEL_FIT_LINK_NAME}<br>
&gt;<br>
&gt;<br>
&gt; i.e. the bare linux.bin file which we used to pack into the FIT image,<br>
&gt;<br>
&gt; not a fitImage.<br>
&gt;<br>
&gt;<br>
&gt; The output FIT image from kernel-fitimage.bbclass is created here<br>
&gt;<br>
&gt; <a href="http://git.openembedded.org/openembedded-core/tree/meta/classes/kernel-fitimage.bbclass#n450" rel="noreferrer" target="_blank">http://git.openembedded.org/openembedded-core/tree/meta/classes/kernel-fitimage.bbclass#n450</a><br>
&gt;<br>
&gt;<br>
&gt; uboot-mkimage \<br>
&gt;<br>
&gt; ${@&#39;-D &quot;${UBOOT_MKIMAGE_DTCOPTS}&quot;&#39; if len(&#39;${UBOOT_MKIMAGE_DTCOPTS}&#39;) else &#39;&#39;} \<br>
&gt;<br>
&gt;  -f ${1} \<br>
&gt;<br>
&gt;  arch/${ARCH}/boot/${2}<br>
&gt;<br>
&gt;<br>
&gt; i.e. in arch/${ARCH}/boot/${2}<br>
&gt;<br>
&gt;<br>
&gt; It&#39;s that image which is then picked up by kernel.bbclass to install<br>
&gt;<br>
&gt; into deploydir (because KERNEL_OUTPUT_DIR ?= &quot;arch/${ARCH}/boot&quot;):<br>
&gt;<br>
&gt;<br>
&gt; for imageType in ${KERNEL_IMAGETYPES} ; do<br>
&gt;<br>
&gt;  # kernel-fitimage class deploys fitImages, skip here<br>
&gt;<br>
&gt;  if [ &quot;$imageType&quot; != &quot;fitImage&quot; ]; then<br>
&gt;<br>
&gt;    base_name=${imageType}-${KERNEL_IMAGE_NAME}<br>
&gt;<br>
&gt;    install -m 0644 ${KERNEL_OUTPUT_DIR}/${imageType}<br>
&gt;<br>
&gt; $deployDir/${base_name}.bin<br>
&gt;<br>
&gt;  fi<br>
&gt;<br>
&gt; done<br>
&gt;<br>
&gt;<br>
&gt; Only it&#39;s doesn&#39;t because of the filter against fitImage.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; To check I&#39;m not seeing some strange artefact of our BSP or<br>
&gt; linux-ti-staging (or any other layer we&#39;re using):<br>
&gt;<br>
&gt; $ git clone git://<a href="http://git.yoctoproject.org/poky" rel="noreferrer" target="_blank">git.yoctoproject.org/poky</a><br>
&gt; $ cd poky<br>
&gt; $ . oe-init-build-env<br>
&gt; $ cat &lt;&lt; EOF &gt;&gt; conf/local.conf<br>
&gt; MACHINE = &quot;beaglebone-yocto&quot;<br>
&gt; KERNEL_CLASSES += &quot; kernel-fitimage&quot;<br>
&gt; KERNEL_IMAGETYPES = &quot;fitImage&quot;<br>
&gt; EOF<br>
&gt; $ bitbake linux-yocto<br>
&gt;<br>
&gt; The FIT images we then have:<br>
&gt;<br>
&gt; $ find tmp/deploy/images/beaglebone-yocto -name &#39;fit*.bin&#39; -type f<br>
&gt; tmp/deploy/images/beaglebone-yocto/fitImage-linux.bin--4.18.3+git0+7341720391_eba03655e8-r0-beaglebone-yocto-20180916134100.bin<br>
&gt;<br>
&gt; And what is:<br>
&gt;<br>
&gt; $ bitbake u-boot-mkimage-native -caddto_recipe_sysroot<br>
&gt; $ oe-run-native u-boot-mkimage-native mkimage -l<br>
&gt; tmp/deploy/images/beaglebone-yocto/fitImage-linux.bin--4.18.3+git0+7341720391_eba03655e8-r0-beaglebone-yocto-20180916134100.bin<br>
&gt; Running bitbake -e u-boot-mkimage-native<br>
&gt; GP Header: Size a0e1 LoadAddr a0e1<br>
&gt;<br>
&gt; Revert c2d00e2f83cdf3d2923660448756ed29296a06a6 and try again:<br>
&gt;<br>
&gt; $ git revert c2d00e2f83cdf3d2923660448756ed29296a06a6<br>
&gt; $ bitbake linux-yocto<br>
&gt;<br>
&gt; This time there&#39;s two images:<br>
&gt;<br>
&gt; $ find tmp/deploy/images/beaglebone-yocto -name &#39;fit*.bin&#39; -type f<br>
&gt; tmp/deploy/images/beaglebone-yocto/fitImage--4.18.3+git0+7341720391_eba03655e8-r0-beaglebone-yocto-20180916141923.bin<br>
&gt; tmp/deploy/images/beaglebone-yocto/fitImage-linux.bin--4.18.3+git0+7341720391_eba03655e8-r0-beaglebone-yocto-20180916141923.bin<br>
&gt;<br>
&gt; And what they are:<br>
&gt;<br>
&gt; $ oe-run-native u-boot-mkimage-native mkimage -l<br>
&gt; tmp/deploy/images/beaglebone-yocto/fitImage--4.18.3+git0+7341720391_eba03655e8-r0-beaglebone-yocto-20180916141923.bin<br>
&gt; Running bitbake -e u-boot-mkimage-native<br>
&gt; FIT description: U-Boot fitImage for Poky (Yocto Project Reference<br>
&gt; Distro)/4.18.3+gitAUTOINC+7341720391_eba03655e8/beaglebone-yocto<br>
&gt; Created:         Sun Sep 16 14:14:47 2018<br>
&gt; Image 0 (kernel@1)<br>
&gt;  Description:  Linux kernel<br>
&gt;  Created:      Sun Sep 16 14:14:47 2018<br>
&gt;  Type:         Kernel Image<br>
&gt;  Compression:  uncompressed<br>
&gt;  Data Size:    6381368 Bytes = 6231.80 KiB = 6.09 MiB<br>
&gt;  Architecture: ARM<br>
&gt;  OS:           Linux<br>
&gt;  Load Address: 0x80008000<br>
&gt;  Entry Point:  0x80008000<br>
&gt;  Hash algo:    sha1<br>
&gt;  Hash value:   909137524ffd28b5b0ac51ea39c648b09902dc18<br>
&gt; Image 1 (fdt@am335x-bone.dtb)<br>
&gt;  Description:  Flattened Device Tree blob<br>
&gt;  Created:      Sun Sep 16 14:14:47 2018<br>
&gt;  Type:         Flat Device Tree<br>
&gt;  Compression:  uncompressed<br>
&gt;  Data Size:    33030 Bytes = 32.26 KiB = 0.03 MiB<br>
&gt;  Architecture: ARM<br>
&gt;  Hash algo:    sha1<br>
&gt;  Hash value:   0fece12f15fc5ac6c452d9308cd374c2c0cfea47<br>
&gt; Image 2 (fdt@am335x-boneblack.dtb)<br>
&gt;  Description:  Flattened Device Tree blob<br>
&gt;  Created:      Sun Sep 16 14:14:47 2018<br>
&gt;  Type:         Flat Device Tree<br>
&gt;  Compression:  uncompressed<br>
&gt;  Data Size:    34782 Bytes = 33.97 KiB = 0.03 MiB<br>
&gt;  Architecture: ARM<br>
&gt;  Hash algo:    sha1<br>
&gt;  Hash value:   337f6843020cb8fbaf119b43fd748222d32e72df<br>
&gt; Image 3 (fdt@am335x-bonegreen.dtb)<br>
&gt;  Description:  Flattened Device Tree blob<br>
&gt;  Created:      Sun Sep 16 14:14:47 2018<br>
&gt;  Type:         Flat Device Tree<br>
&gt;  Compression:  uncompressed<br>
&gt;  Data Size:    33286 Bytes = 32.51 KiB = 0.03 MiB<br>
&gt;  Architecture: ARM<br>
&gt;  Hash algo:    sha1<br>
&gt;  Hash value:   4974e8b1656cd7f52829ac3c01f6747bece87cbc<br>
&gt; Default Configuration: &#39;conf@am335x-bone.dtb&#39;<br>
&gt; Configuration 0 (conf@am335x-bone.dtb)<br>
&gt;  Description:  1 Linux kernel, FDT blob<br>
&gt;  Kernel:       kernel@1<br>
&gt;  FDT:          fdt@am335x-bone.dtb<br>
&gt;  Hash algo:    sha1<br>
&gt;  Hash value:   unavailable<br>
&gt; Configuration 1 (conf@am335x-boneblack.dtb)<br>
&gt;  Description:  0 Linux kernel, FDT blob<br>
&gt;  Kernel:       kernel@1<br>
&gt;  FDT:          fdt@am335x-boneblack.dtb<br>
&gt;  Hash algo:    sha1<br>
&gt;  Hash value:   unavailable<br>
&gt; Configuration 2 (conf@am335x-bonegreen.dtb)<br>
&gt;  Description:  0 Linux kernel, FDT blob<br>
&gt;  Kernel:       kernel@1<br>
&gt;  FDT:          fdt@am335x-bonegreen.dtb<br>
&gt;  Hash algo:    sha1<br>
&gt;  Hash value:   unavailable<br>
&gt; $ oe-run-native u-boot-mkimage-native mkimage -l<br>
&gt; tmp/deploy/images/beaglebone-yocto/fitImage-linux.bin--4.18.3+git0+7341720391_eba03655e8-r0-beaglebone-yocto-20180916141923.bin<br>
&gt; Running bitbake -e u-boot-mkimage-native<br>
&gt; GP Header: Size a0e1 LoadAddr a0e1<br>
&gt;<br>
&gt; --<br>
&gt; Alex Kiernan<br>
<br>
<br>
<br>
-- <br>
Alex Kiernan<br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="m_8067782294451267538gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div style="color:rgb(0,0,0);font-family:Helvetica">Leon Woestenberg</div><div style="color:rgb(0,0,0);font-family:Helvetica"><a href="mailto:leon@sidebranch.com" style="color:rgb(17,85,204)" target="_blank">leon@sidebranch.com</a></div><div style="color:rgb(0,0,0);font-family:Helvetica"><div>T: +31 40 711 42 76</div><div>M: +31 6 472 30 372</div></div><div style="color:rgb(0,0,0);font-family:Helvetica"><br></div><div style="color:rgb(0,0,0);font-family:Helvetica">Sidebranch</div><div style="color:rgb(0,0,0);font-family:Helvetica">Embedded Systems</div><div style="color:rgb(0,0,0);font-family:Helvetica">Eindhoven, The Netherlands</div><a href="http://www.sidebranch.com/" style="color:rgb(17,85,204);font-family:Helvetica" target="_blank">http://www.sidebranch.com</a><div><br></div><div><img src="http://www.sidebranch.nl/sites/default/files/images/unnamed.png" style="color:rgb(0,0,0);font-family:Helvetica"><br></div><div><br><div><br></div></div></div></div>