[v2,3/3] Add custom isar-initramfs example

Message ID 20200923162046.206888-3-hws@denx.de
State Superseded, archived
Headers show
Series [RFC] classes: Add initramfs class | expand

Commit Message

Harald Seiler Sept. 23, 2020, 8:20 a.m. UTC
isar-initramfs is a custom initramfs which additionally has the
initramfs-example module installed.

Signed-off-by: Harald Seiler <hws@denx.de>
---

Notes:
    Maybe this initramfs should be tested in CI somewhere?  I'm unsure what
    makes sense, and how to "force" this custom initramfs into a CI target.

 .../recipes-initramfs/images/isar-initramfs.bb | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 meta-isar/recipes-initramfs/images/isar-initramfs.bb

Comments

Jan Kiszka Sept. 25, 2020, 1:13 a.m. UTC | #1
On 23.09.20 18:20, Harald Seiler wrote:
> isar-initramfs is a custom initramfs which additionally has the
> initramfs-example module installed.
> 
> Signed-off-by: Harald Seiler <hws@denx.de>
> ---
> 
> Notes:
>      Maybe this initramfs should be tested in CI somewhere?  I'm unsure what
>      makes sense, and how to "force" this custom initramfs into a CI target.
> 
>   .../recipes-initramfs/images/isar-initramfs.bb | 18 ++++++++++++++++++
>   1 file changed, 18 insertions(+)
>   create mode 100644 meta-isar/recipes-initramfs/images/isar-initramfs.bb
> 
> diff --git a/meta-isar/recipes-initramfs/images/isar-initramfs.bb b/meta-isar/recipes-initramfs/images/isar-initramfs.bb
> new file mode 100644
> index 000000000000..aaa0350aab20
> --- /dev/null
> +++ b/meta-isar/recipes-initramfs/images/isar-initramfs.bb
> @@ -0,0 +1,18 @@
> +# Example of a custom initramfs image recipe.  The image will be deployed to
> +#
> +#   build/tmp/deploy/images/${MACHINE}/isar-initramfs-${DISTRO}-${MACHINE}.initrd.img
> +#
> +# This software is a part of ISAR.
> +
> +inherit initramfs
> +
> +# Debian packages that should be installed into the system for building the
> +# initramfs.  E.g. the cryptsetup package which contains initramfs scripts for
> +# decrypting a root filesystem.
> +INITRAMFS_PREINSTALL += " \
> +    "
> +
> +# Recipes that should be installed into the initramfs build rootfs.
> +INITRAMFS_INSTALL += " \
> +    initramfs-example \
> +    "
> 

If this recipe is not pulled somewhere, it's dead. Some test-only 
dependencies we had to local.conf in scripts/ci_build.sh. Or you add it 
to meta-isar/conf/local.conf.sample.

If added, will it simply replace the default initramfs? Or is more needed?

Jan
Harald Seiler Sept. 25, 2020, 3:28 a.m. UTC | #2
On Fri, 2020-09-25 at 11:13 +0200, Jan Kiszka wrote:
> On 23.09.20 18:20, Harald Seiler wrote:
> > isar-initramfs is a custom initramfs which additionally has the
> > initramfs-example module installed.
> > 
> > Signed-off-by: Harald Seiler <hws@denx.de>
> > ---
> > 
> > Notes:
> >      Maybe this initramfs should be tested in CI somewhere?  I'm unsure what
> >      makes sense, and how to "force" this custom initramfs into a CI target.
> > 
> >   .../recipes-initramfs/images/isar-initramfs.bb | 18 ++++++++++++++++++
> >   1 file changed, 18 insertions(+)
> >   create mode 100644 meta-isar/recipes-initramfs/images/isar-initramfs.bb
> > 
> > diff --git a/meta-isar/recipes-initramfs/images/isar-initramfs.bb b/meta-isar/recipes-initramfs/images/isar-initramfs.bb
> > new file mode 100644
> > index 000000000000..aaa0350aab20
> > --- /dev/null
> > +++ b/meta-isar/recipes-initramfs/images/isar-initramfs.bb
> > @@ -0,0 +1,18 @@
> > +# Example of a custom initramfs image recipe.  The image will be deployed to
> > +#
> > +#   build/tmp/deploy/images/${MACHINE}/isar-initramfs-${DISTRO}-${MACHINE}.initrd.img
> > +#
> > +# This software is a part of ISAR.
> > +
> > +inherit initramfs
> > +
> > +# Debian packages that should be installed into the system for building the
> > +# initramfs.  E.g. the cryptsetup package which contains initramfs scripts for
> > +# decrypting a root filesystem.
> > +INITRAMFS_PREINSTALL += " \
> > +    "
> > +
> > +# Recipes that should be installed into the initramfs build rootfs.
> > +INITRAMFS_INSTALL += " \
> > +    initramfs-example \
> > +    "
> > 
> 
> If this recipe is not pulled somewhere, it's dead.

Right, that's why I was asking where to put it.

> Some test-only dependencies we had to local.conf in scripts/ci_build.sh.
> Or you add it to meta-isar/conf/local.conf.sample.
> 
> If added, will it simply replace the default initramfs? Or is more needed?

Well, there really isn't such a thing as the default initramfs right now.
`image.bbclass` deploys its own initramfs (the one debian installed to
/boot) to `${IMAGE_FULLNAME}-initrd.img` which further tasks could then
reference when building e.g. a fitImage or it could be added to
IMAGE_BOOT_FILES for WIC.

Similarly, the new `initramfs.bbclass` deploys the final artifact to
`${INITRAMFS_FULLNAME}.initrd.img`.  What happens after that is entirely
up to the integrator.  After all, this image-class is meant for cases
where customization beyond the abilities of the current in-rootfs
initramfs are needed.  As an example, a fitImage recipe could use this
like

    INITRAMFS_RECIPE = "isar-initramfs"

    INITRD_IMG = "${PP_DEPLOY}/${INITRAMFS_RECIPE}-${DISTRO}-${MACHINE}.initrd.img"
    do_fit_image[depends] += "${INITRAMFS_RECIPE}:do_build"

---

Now, for CI if we want to include this custom initramfs, we'd need to
either modify some image recipe to pull it in as shown above or build it
separately and then start qemu with

    -initrd build/tmp/deploy/images/qemuamd64/isar-initramfs-debian-buster-qemuamd64.initrd.img

somewhere.  But I'm not sure if that's easily integrated into the current
setup?

IMO the next best thing would be to just build test it.  Would adding

    mc:qemuamd64-buster:isar-initramfs

to TARGETS_SET in ci_build.sh work?
Jan Kiszka Oct. 13, 2020, 6:11 a.m. UTC | #3
On 25.09.20 13:28, Harald Seiler wrote:
> On Fri, 2020-09-25 at 11:13 +0200, Jan Kiszka wrote:
>> On 23.09.20 18:20, Harald Seiler wrote:
>>> isar-initramfs is a custom initramfs which additionally has the
>>> initramfs-example module installed.
>>>
>>> Signed-off-by: Harald Seiler <hws@denx.de>
>>> ---
>>>
>>> Notes:
>>>      Maybe this initramfs should be tested in CI somewhere?  I'm unsure what
>>>      makes sense, and how to "force" this custom initramfs into a CI target.
>>>
>>>   .../recipes-initramfs/images/isar-initramfs.bb | 18 ++++++++++++++++++
>>>   1 file changed, 18 insertions(+)
>>>   create mode 100644 meta-isar/recipes-initramfs/images/isar-initramfs.bb
>>>
>>> diff --git a/meta-isar/recipes-initramfs/images/isar-initramfs.bb b/meta-isar/recipes-initramfs/images/isar-initramfs.bb
>>> new file mode 100644
>>> index 000000000000..aaa0350aab20
>>> --- /dev/null
>>> +++ b/meta-isar/recipes-initramfs/images/isar-initramfs.bb
>>> @@ -0,0 +1,18 @@
>>> +# Example of a custom initramfs image recipe.  The image will be deployed to
>>> +#
>>> +#   build/tmp/deploy/images/${MACHINE}/isar-initramfs-${DISTRO}-${MACHINE}.initrd.img
>>> +#
>>> +# This software is a part of ISAR.
>>> +
>>> +inherit initramfs
>>> +
>>> +# Debian packages that should be installed into the system for building the
>>> +# initramfs.  E.g. the cryptsetup package which contains initramfs scripts for
>>> +# decrypting a root filesystem.
>>> +INITRAMFS_PREINSTALL += " \
>>> +    "
>>> +
>>> +# Recipes that should be installed into the initramfs build rootfs.
>>> +INITRAMFS_INSTALL += " \
>>> +    initramfs-example \
>>> +    "
>>>
>>
>> If this recipe is not pulled somewhere, it's dead.
> 
> Right, that's why I was asking where to put it.
> 
>> Some test-only dependencies we had to local.conf in scripts/ci_build.sh.
>> Or you add it to meta-isar/conf/local.conf.sample.
>>
>> If added, will it simply replace the default initramfs? Or is more needed?
> 
> Well, there really isn't such a thing as the default initramfs right now.
> `image.bbclass` deploys its own initramfs (the one debian installed to
> /boot) to `${IMAGE_FULLNAME}-initrd.img` which further tasks could then
> reference when building e.g. a fitImage or it could be added to
> IMAGE_BOOT_FILES for WIC.
> 
> Similarly, the new `initramfs.bbclass` deploys the final artifact to
> `${INITRAMFS_FULLNAME}.initrd.img`.  What happens after that is entirely
> up to the integrator.  After all, this image-class is meant for cases
> where customization beyond the abilities of the current in-rootfs
> initramfs are needed.  As an example, a fitImage recipe could use this
> like
> 
>     INITRAMFS_RECIPE = "isar-initramfs"
> 
>     INITRD_IMG = "${PP_DEPLOY}/${INITRAMFS_RECIPE}-${DISTRO}-${MACHINE}.initrd.img"
>     do_fit_image[depends] += "${INITRAMFS_RECIPE}:do_build"
> 
> ---
> 
> Now, for CI if we want to include this custom initramfs, we'd need to
> either modify some image recipe to pull it in as shown above or build it
> separately and then start qemu with
> 
>     -initrd build/tmp/deploy/images/qemuamd64/isar-initramfs-debian-buster-qemuamd64.initrd.img
> 
> somewhere.  But I'm not sure if that's easily integrated into the current
> setup?
> 
> IMO the next best thing would be to just build test it.  Would adding
> 
>     mc:qemuamd64-buster:isar-initramfs
> 
> to TARGETS_SET in ci_build.sh work?
> 

We already have fit/ubi example. Could that be expanded better to stress
this? Otherwise, I'm find with your suggestion above.

Jan

Patch

diff --git a/meta-isar/recipes-initramfs/images/isar-initramfs.bb b/meta-isar/recipes-initramfs/images/isar-initramfs.bb
new file mode 100644
index 000000000000..aaa0350aab20
--- /dev/null
+++ b/meta-isar/recipes-initramfs/images/isar-initramfs.bb
@@ -0,0 +1,18 @@ 
+# Example of a custom initramfs image recipe.  The image will be deployed to
+#
+#   build/tmp/deploy/images/${MACHINE}/isar-initramfs-${DISTRO}-${MACHINE}.initrd.img
+#
+# This software is a part of ISAR.
+
+inherit initramfs
+
+# Debian packages that should be installed into the system for building the
+# initramfs.  E.g. the cryptsetup package which contains initramfs scripts for
+# decrypting a root filesystem.
+INITRAMFS_PREINSTALL += " \
+    "
+
+# Recipes that should be installed into the initramfs build rootfs.
+INITRAMFS_INSTALL += " \
+    initramfs-example \
+    "