[OE-core] [PATCH v3] kernel.bbclass: do not deploy fitImage; kernel-fitimage.bbclass does that.

Alex Kiernan alex.kiernan at gmail.com
Sun Sep 16 10:41:50 UTC 2018


Hi Leon

On Sun, Sep 16, 2018 at 10:18 AM Leon Woestenberg <leon at sidebranch.com> wrote:
>
> Hi Alex,
>
> > On 15 Sep 2018, at 19:45, Alex Kiernan <alex.kiernan at gmail.com> wrote:
> >
> >> On Mon, Sep 10, 2018 at 10:57 PM Leon Woestenberg <leon at sidebranch.com> wrote:
> >>
> >> kernel-fitimage.bbclass replaces an occurance of "fitImage" in
> >> KERNEL_IMAGETYPE_FOR_MAKE by an image type that is buildable for the
> >> architecture (such as zImage). The kernel-fitimage.bbclass packs that
> >> image as sub-image in a flattened image tree image (fitImage) and
> >> deploys this fitImage along with the image tree source file (.its).
> >>
> >> kernel-fitimage.bbclass does not alter KERNEL_IMAGETYPES, which thus
> >> also contains "fitImage", which kernel.bbclass will also deploy
> >> redundantly with different naming.
> >>
> >> The result is a dual deployment with slightly different naming,
> >> each with a set of symlinks.
> >>
> >> The solution chosen is to have fitImage deployment be handled by
> >> kernel-fitimage.bbclass, and have kernel.bbclass ignore fitImage
> >> types during deployment.
> >>
> >> Signed-off-by: Leon Woestenberg <leon at sidebranch.com>
> >
> > This looks completely plausible, but the two "FIT" images that are
> > installed aren't identical... after this I end up with no FIT image
> > and only a bare image in the deploy dir.
>
> What was in your KERNEL_IMAGETYPES? Did it at least contain “fitImage”??
>

Yes, in fact only fitImage (and no initramfs).

> > Digging into it, the logic between the two classes is a bit odd... in
> > the case of a non initramfs build, the fitImage is actually installed
> > here.
>
> 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.
>
> > The one that's installed in kernel-fitimage is the bare
> > linux.bin, but named fitImage-...
>
> 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”.

Totally agree...

> >
> > I'll send a patch reverting this and removing the other one as I'd
> > agree that it appears to have no purpose (and if you did want it, I
> > guess you could list it in KERNEL_IMAGETYPES).
>
> I’m sorry I cannot follow what this and the other one is, and it. Let’s first understand all cases correctly.
>

Sorry I've not described it well... the code in
kernel-fitimage.bbclass that inserts the kernel into the its happens
here http://git.openembedded.org/openembedded-core/tree/meta/classes/kernel-fitimage.bbclass#n371

fitimage_emit_section_kernel ${1} "${kernelcount}" linux.bin "${linux_comp}"

inside fitimage_emit_section_kernel we create a kernel section which
has `data = /incbin/("${3}");` so linux.bin is our bare image.

Then we have the installation of fitImage-linux-bin that happens here
http://git.openembedded.org/openembedded-core/tree/meta/classes/kernel-fitimage.bbclass#n495

echo "Copying linux.bin file..."
install -m 0644 ${B}/linux.bin
${DEPLOYDIR}/fitImage-linux.bin-${KERNEL_FIT_NAME}.bin
ln -snf fitImage-linux.bin-${KERNEL_FIT_NAME}.bin
${DEPLOYDIR}/fitImage-linux.bin-${KERNEL_FIT_LINK_NAME}

i.e. the bare linux.bin file which we used to pack into the FIT image,
not a fitImage.

The output FIT image from kernel-fitimage.bbclass is created here
http://git.openembedded.org/openembedded-core/tree/meta/classes/kernel-fitimage.bbclass#n450

uboot-mkimage \
${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \
  -f ${1} \
  arch/${ARCH}/boot/${2}

i.e. in arch/${ARCH}/boot/${2}

It's that image which is then picked up by kernel.bbclass to install
into deploydir (because KERNEL_OUTPUT_DIR ?= "arch/${ARCH}/boot"):

for imageType in ${KERNEL_IMAGETYPES} ; do
  # kernel-fitimage class deploys fitImages, skip here
  if [ "$imageType" != "fitImage" ]; then
    base_name=${imageType}-${KERNEL_IMAGE_NAME}
    install -m 0644 ${KERNEL_OUTPUT_DIR}/${imageType}
$deployDir/${base_name}.bin
  fi
done

Only it's doesn't because of the filter against fitImage.

> Regards, Leon
> >
> >> ---
> >> meta/classes/kernel.bbclass | 18 ++++++++++++------
> >> 1 file changed, 12 insertions(+), 6 deletions(-)
> >>
> >> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
> >> index b57832c..1f69091 100644
> >> --- a/meta/classes/kernel.bbclass
> >> +++ b/meta/classes/kernel.bbclass
> >> @@ -669,8 +669,11 @@ kernel_do_deploy() {
> >>        fi
> >>
> >>        for imageType in ${KERNEL_IMAGETYPES} ; do
> >> -               base_name=${imageType}-${KERNEL_IMAGE_NAME}
> >> -               install -m 0644 ${KERNEL_OUTPUT_DIR}/${imageType} $deployDir/${base_name}.bin
> >> +               # kernel-fitimage class deploys fitImages, skip here
> >> +               if [ "$imageType" != "fitImage" ]; then
> >> +                       base_name=${imageType}-${KERNEL_IMAGE_NAME}
> >> +                       install -m 0644 ${KERNEL_OUTPUT_DIR}/${imageType} $deployDir/${base_name}.bin
> >> +               fi
> >>        done
> >>        if [ ${MODULE_TARBALL_DEPLOY} = "1" ] && (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
> >>                mkdir -p ${D}/lib
> >> @@ -687,10 +690,13 @@ kernel_do_deploy() {
> >>
> >>        if [ ! -z "${INITRAMFS_IMAGE}" -a x"${INITRAMFS_IMAGE_BUNDLE}" = x1 ]; then
> >>                for imageType in ${KERNEL_IMAGETYPES} ; do
> >> -                       initramfs_base_name=${imageType}-${INITRAMFS_NAME}
> >> -                       initramfs_symlink_name=${imageType}-${INITRAMFS_LINK_NAME}
> >> -                       install -m 0644 ${KERNEL_OUTPUT_DIR}/${imageType}.initramfs $deployDir/${initramfs_base_name}.bin
> >> -                       ln -sf ${initramfs_base_name}.bin $deployDir/${initramfs_symlink_name}.bin
> >> +                       # kernel-fitimage class deploys fitImages, skip here
> >> +                       if [ "$imageType" != "fitImage" ]; then
> >> +                               initramfs_base_name=${imageType}-${INITRAMFS_NAME}
> >> +                               initramfs_symlink_name=${imageType}-${INITRAMFS_LINK_NAME}
> >> +                               install -m 0644 ${KERNEL_OUTPUT_DIR}/${imageType}.initramfs $deployDir/${initramfs_base_name}.bin
> >> +                               ln -sf ${initramfs_base_name}.bin $deployDir/${initramfs_symlink_name}.bin
> >> +                       fi
> >>                done
> >>        fi
> >> }
> >> --
> >> 2.7.4
> >>
> >> --
> >> _______________________________________________
> >> Openembedded-core mailing list
> >> Openembedded-core at lists.openembedded.org
> >> http://lists.openembedded.org/mailman/listinfo/openembedded-core
> >
> >
> >
> > --
> > Alex Kiernan



-- 
Alex Kiernan



More information about the Openembedded-core mailing list