Skip to contentSkip to conversation

copy combined kernel+initramfs into main image

DISCUSSION André Draszik 1 participant 3 messages Nov 9, 2016 – Nov 11, 2016

lore
Share & tools
lore
#0 lore raw

Hi,

I have a need to copy my bundled initramfs+kernel image into the main filesystem image. So far I have failed miserably...

I have tried to achieve this by:
1) adding a new kernel PACKAGE and adding the bundled image file to it
2) moving the 'bundle_initramfs' task in kernel.bbclass before do_package (rather than before do_deploy)

1) on its own is not helpful, because do_bundle_initramfs hasn't run yet, i.e. the resulting package will be empty.
2) causes a recursive dependency, basically kernel:do_bundle_initramfs -> initramfs:do_image_complete -> initramfs:do_rootfs -> kernel:do_packagedata
I think because of do_rootfs[recrdeptask] += "do_packagedata" in image.bbclass:

Now I can't figure out why the kernel's do_packagedata ends up in my chain, I am not adding any kernel modules to the initramfs image.

Is there a way to break this loop? Or explicitly remove the kernel:do_packagedata from my initramfs recrdeptasks? So that I can end up with a non-empty a kernel-image-bundled-initramfs PACKAGE?

More generally, is there a way to achieve what I want? Maybe in a different way?

Thanks.
Andre'

PS: I could probably do a two-staged approach, build the bundled initramfs first, and then manually copy it from DEPLOYDIR during rootfs creation time of the main image. But that seems cumbersome and I was hoping for a neater solution :-)

#1 lore raw
Quoted 19 lines · André Draszik

Hi,

I have a need to copy my bundled initramfs+kernel image into the main filesystem image. So far I have failed miserably...

I have tried to achieve this by:
1) adding a new kernel PACKAGE and adding the bundled image file to it
2) moving the 'bundle_initramfs' task in kernel.bbclass before do_package (rather than before do_deploy)

1) on its own is not helpful, because do_bundle_initramfs hasn't run yet, i.e. the resulting package will be empty.
2) causes a recursive dependency, basically kernel:do_bundle_initramfs -> initramfs:do_image_complete -> initramfs:do_rootfs -> kernel:do_packagedata
I think because of do_rootfs[recrdeptask] += "do_packagedata" in image.bbclass:

Quoted 3 lines

Now I can't figure out why the kernel's do_packagedata ends up in my chain,
I am not adding any kernel modules to the initramfs image.

Just one more - I did see KERNELDEPMODDEPEND in image.bbclass and am clearing it in my initramfs recipe, but that alone doesn't seem to be enough.

Quoted 21 lines

Is there a way to break this loop? Or explicitly remove the kernel:do_packagedata from my initramfs recrdeptasks? So that I can end up with a non-empty a kernel-image-bundled-initramfs PACKAGE?

More generally, is there a way to achieve what I want? Maybe in a different
way?

Thanks.
Andre'

PS: I could probably do a two-staged approach, build the bundled initramfs first, and then manually copy it from DEPLOYDIR during rootfs creation time
of the main image. But that seems cumbersome and I was hoping for a neater solution :-)

#2 lore raw
In reply to André Draszik
Quoted 19 lines · André Draszik

Hi,

I have a need to copy my bundled initramfs+kernel image into the main filesystem image. So far I have failed miserably...

I have tried to achieve this by:
1) adding a new kernel PACKAGE and adding the bundled image file to it
2) moving the 'bundle_initramfs' task in kernel.bbclass before do_package (rather than before do_deploy)

1) on its own is not helpful, because do_bundle_initramfs hasn't run yet, i.e. the resulting package will be empty.
2) causes a recursive dependency, basically kernel:do_bundle_initramfs -> initramfs:do_image_complete -> initramfs:do_rootfs -> kernel:do_packagedata
I think because of do_rootfs[recrdeptask] += "do_packagedata" in image.bbclass:

Quoted 3 lines

Now I can't figure out why the kernel's do_packagedata ends up in my chain,
I am not adding any kernel modules to the initramfs image.

If anybody is interested - I basically have a dependency on do_install[depends] += "virtual/kernel:do_shared_workdir"

in one of the recipes that end up in my initramfs. Just this alone seems to cause the dependency on kernel:do_packagedata mentioned above...

Quoted 4 lines

[...]
More generally, is there a way to achieve what I want? Maybe in a different
way?

The solution I came up with instead so is for my image recipe to:

do_rootfs[depends] += "virtual/kernel:do_deploy" ROOTFS_POSTPROCESS_COMMAND += "copy_kernelinitramfs; " copy_kernelinitramfs() {
  cp ${DEPLOY_DIR_IMAGE}/bundled-initramfs ${IMAGE_ROOTFS}/boot/ }

Cheers,
Andre'