Question about initramfs and fitImage


Khoi Dinh Trinh
 

Hi All,

I'm trying to build an image that uses the currently built image as the initramfs instead of having to specify it in "INITRAMFS_IMAGE". For example, when I run "bibake image-something", I'm hoping to use the recipe "image-something" as the initramfs with the end goal that it's used in creating a fit image. AFAIK, INITRAMFS_IMAGE has to be hardcoded instead of being dynamically set to the name of the currently built recipe(which I completely understand since the recipe being built might not necessarily be an image) and this makes it easy to boot the wrong thing since the recipe specified with bitbake isn't the thing being used for booting.

My workaround so far is to create my own image recipe and set it to depend on the image being built(specifically depend on the .cpio.gz one), however, a lot of it is duplicate of the current fit image code.

Our use case is that we use initramfs as our only rootfs storage to make checksum at boot easier(since the final rootfs is a .cpio.gz blob) and also to avoid any writes to rootfs to persist across reboot.

--
Best,
Khoi Trinh


Zoran
 

Hello Khoi,

This might be is your starting point:
https://www.yoctoproject.org/pipermail/yocto/2018-July/041680.html

Zee
_______

On Thu, Apr 28, 2022 at 11:13 PM Khoi Dinh Trinh
<khoidinhtrinh@...> wrote:

Hi All,

I'm trying to build an image that uses the currently built image as the initramfs instead of having to specify it in "INITRAMFS_IMAGE". For example, when I run "bibake image-something", I'm hoping to use the recipe "image-something" as the initramfs with the end goal that it's used in creating a fit image. AFAIK, INITRAMFS_IMAGE has to be hardcoded instead of being dynamically set to the name of the currently built recipe(which I completely understand since the recipe being built might not necessarily be an image) and this makes it easy to boot the wrong thing since the recipe specified with bitbake isn't the thing being used for booting.

My workaround so far is to create my own image recipe and set it to depend on the image being built(specifically depend on the .cpio.gz one), however, a lot of it is duplicate of the current fit image code.

Our use case is that we use initramfs as our only rootfs storage to make checksum at boot easier(since the final rootfs is a .cpio.gz blob) and also to avoid any writes to rootfs to persist across reboot.

--
Best,
Khoi Trinh