All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-arago][master/kirkstone][PATCH v3 1/2] tisdk-tiny-initramfs: Create a smaller dedicated initramfs for tiny
@ 2023-08-06  4:39 Ryan Eatmon
  2023-08-06  4:39 ` [meta-arago][master/kirkstone][PATCH v3 2/2] tisdk-tiny-image: Add dependency on tisdk-tiny-initramfs Ryan Eatmon
  2023-08-14 17:59 ` [meta-arago][master/kirkstone][PATCH v3 1/2] tisdk-tiny-initramfs: Create a smaller dedicated initramfs for tiny Denys Dmytriyenko
  0 siblings, 2 replies; 4+ messages in thread
From: Ryan Eatmon @ 2023-08-06  4:39 UTC (permalink / raw)
  To: Praneeth Bajjuri, Denys Dmytriyenko, meta-arago

The initramfs does not need grub-efi or the /boot directory since it
does not have to boot the system itself.  So create a version of the
tiny-image that strips those out and follow the oe-core methodology for
initramfs.

Signed-off-by: Ryan Eatmon <reatmon@ti.com>
---
 .../classes/remove-boot-dir.bbclass           |  8 ++++++
 .../images/tisdk-tiny-initramfs.bb            | 26 +++++++++++++++++++
 .../packagegroup-arago-initramfs.bb           |  4 +++
 3 files changed, 38 insertions(+)
 create mode 100644 meta-arago-distro/classes/remove-boot-dir.bbclass
 create mode 100644 meta-arago-distro/recipes-core/images/tisdk-tiny-initramfs.bb
 create mode 100644 meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-initramfs.bb

diff --git a/meta-arago-distro/classes/remove-boot-dir.bbclass b/meta-arago-distro/classes/remove-boot-dir.bbclass
new file mode 100644
index 00000000..bd0c09fc
--- /dev/null
+++ b/meta-arago-distro/classes/remove-boot-dir.bbclass
@@ -0,0 +1,8 @@
+# Add a ROOTFS_POSTPROCESS_COMMAND that will remove some files from the
+# rootfs for initramfs images.
+
+ROOTFS_POSTPROCESS_COMMAND += "remove_boot_dir;"
+
+remove_boot_dir () {
+    rm -rf ${IMAGE_ROOTFS}/boot
+}
diff --git a/meta-arago-distro/recipes-core/images/tisdk-tiny-initramfs.bb b/meta-arago-distro/recipes-core/images/tisdk-tiny-initramfs.bb
new file mode 100644
index 00000000..0bea8276
--- /dev/null
+++ b/meta-arago-distro/recipes-core/images/tisdk-tiny-initramfs.bb
@@ -0,0 +1,26 @@
+SUMMARY = "Arago TI SDK super minimal base image for initramfs"
+
+DESCRIPTION = "Image meant for basic boot of linux kernel. Intended as\
+ bare system, this image does not package the kernel in the\
+ standard /boot folder in rootfs. Instead, it provides a base\
+ rootfs allowing kernel to be deployed elsewhere\
+ (tftp/separate boot partition/jtag log etc..) and boot\
+ the image.\
+"
+
+LICENSE = "MIT"
+
+inherit core-image
+inherit remove-boot-dir
+
+IMAGE_FEATURES:remove = "package-management"
+
+INITRAMFS_FSTYPES = "cpio cpio.xz"
+INITRAMFS_MAXSIZE = "65536"
+IMAGE_OVERHEAD_FACTOR = "1"
+
+IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"
+
+PACKAGE_INSTALL = "packagegroup-arago-initramfs"
+
+export IMAGE_BASENAME = "tisdk-tiny-initramfs"
diff --git a/meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-initramfs.bb b/meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-initramfs.bb
new file mode 100644
index 00000000..380cc0e3
--- /dev/null
+++ b/meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-initramfs.bb
@@ -0,0 +1,4 @@
+
+require recipes-core/packagegroups/packagegroup-core-boot.bb
+
+RDEPENDS:${PN}:remove = "grub-efi kernel"
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [meta-arago][master/kirkstone][PATCH v3 2/2] tisdk-tiny-image: Add dependency on tisdk-tiny-initramfs
  2023-08-06  4:39 [meta-arago][master/kirkstone][PATCH v3 1/2] tisdk-tiny-initramfs: Create a smaller dedicated initramfs for tiny Ryan Eatmon
@ 2023-08-06  4:39 ` Ryan Eatmon
  2023-08-14 17:59 ` [meta-arago][master/kirkstone][PATCH v3 1/2] tisdk-tiny-initramfs: Create a smaller dedicated initramfs for tiny Denys Dmytriyenko
  1 sibling, 0 replies; 4+ messages in thread
From: Ryan Eatmon @ 2023-08-06  4:39 UTC (permalink / raw)
  To: Praneeth Bajjuri, Denys Dmytriyenko, meta-arago

Even if we do not tell the build that the initramfs should be bundled
into the kernel, we want to build the initramfs with every build so that
it can be manually specified through alternative testing schemes.

Also, we no longer want to build the cpio from the tiny-image, that is
the purpose of the dedicated tisdk-tiny-initramfs.

Signed-off-by: Ryan Eatmon <reatmon@ti.com>
---
v2: Add this missing patch to the series.
v3: Remove the cpio from the IMAGE_FSTYPES.

 meta-arago-distro/recipes-core/images/tisdk-tiny-image.bb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta-arago-distro/recipes-core/images/tisdk-tiny-image.bb b/meta-arago-distro/recipes-core/images/tisdk-tiny-image.bb
index 8117ebc5..c8a584bd 100644
--- a/meta-arago-distro/recipes-core/images/tisdk-tiny-image.bb
+++ b/meta-arago-distro/recipes-core/images/tisdk-tiny-image.bb
@@ -14,10 +14,10 @@ require arago-tiny-image.inc
 
 IMAGE_FEATURES:remove = "package-management"
 
-IMAGE_FSTYPES += "cpio cpio.xz"
-
 IMAGE_INSTALL += " \
 	${ARAGO_TINY_IMAGE_EXTRA_INSTALL} \
 "
 
+DEPENDS += " tisdk-tiny-initramfs"
+
 export IMAGE_BASENAME = "tisdk-tiny-image"
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [meta-arago][master/kirkstone][PATCH v3 1/2] tisdk-tiny-initramfs: Create a smaller dedicated initramfs for tiny
  2023-08-06  4:39 [meta-arago][master/kirkstone][PATCH v3 1/2] tisdk-tiny-initramfs: Create a smaller dedicated initramfs for tiny Ryan Eatmon
  2023-08-06  4:39 ` [meta-arago][master/kirkstone][PATCH v3 2/2] tisdk-tiny-image: Add dependency on tisdk-tiny-initramfs Ryan Eatmon
@ 2023-08-14 17:59 ` Denys Dmytriyenko
  2023-08-14 18:02   ` Ryan Eatmon
  1 sibling, 1 reply; 4+ messages in thread
From: Denys Dmytriyenko @ 2023-08-14 17:59 UTC (permalink / raw)
  To: reatmon; +Cc: Praneeth Bajjuri, Denys Dmytriyenko, meta-arago

On Sat, Aug 05, 2023 at 11:39:47PM -0500, Ryan Eatmon via lists.yoctoproject.org wrote:
> The initramfs does not need grub-efi or the /boot directory since it
> does not have to boot the system itself.  So create a version of the
> tiny-image that strips those out and follow the oe-core methodology for
> initramfs.

So, kernel.bbclass has a default weak dependency from kernel-base to 
kernel-image, which is meant to be broken/cleared if you don't need to 
pull kernel images into a rootfs.

To simplify, it looked like this some time ago:
RDEPENDS:kernel-base ?= "kernel-image"

Well, these days it's ${KERNEL_PACKAGE_NAME}-base and 
${KERNEL_PACKAGE_NAME}-image

So one can prevent pulling kernel images into rootfs:
https://git.openembedded.org/openembedded-core/tree/meta/conf/machine/include/qemu.inc#n19

But, this is a kernel variable that controls how kernel packages get 
generated with their dependencies. You can modify it either in the kernel 
recipe itself, ot globally in either <machine>.conf or <distro>.conf.

We also use the same mechanism to pull in kernel-devicetree package with 
DTBs and other required FW images.

Unfortunately, that also means it cannot be adjusted on a per-image basis.

Hence, in the past we used to do exactly the same by removing /boot directory 
for a initramfs image (you don't need to create a separate class though):
https://git.yoctoproject.org/meta-arago/tree/meta-arago-distro/recipes-bsp/netboot-initrd/netboot-initrd_0.0.1.bb?id=f9cf73fd8821af096fed7ad4d485af72c8ecc3ce


Oh, and RDEPENDS was recently replaced with RRECOMMENDS:
https://git.openembedded.org/openembedded-core/tree/meta/classes-recipe/kernel.bbclass#n708

Supposedly, this should make the dependency even weaker and allow 
breaking it inside image recipe with BAD_RECOMMENDATIONS, but my 
quick testing didn't work for some reason...


> Signed-off-by: Ryan Eatmon <reatmon@ti.com>
> ---
>  .../classes/remove-boot-dir.bbclass           |  8 ++++++
>  .../images/tisdk-tiny-initramfs.bb            | 26 +++++++++++++++++++
>  .../packagegroup-arago-initramfs.bb           |  4 +++
>  3 files changed, 38 insertions(+)
>  create mode 100644 meta-arago-distro/classes/remove-boot-dir.bbclass
>  create mode 100644 meta-arago-distro/recipes-core/images/tisdk-tiny-initramfs.bb
>  create mode 100644 meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-initramfs.bb
> 
> diff --git a/meta-arago-distro/classes/remove-boot-dir.bbclass b/meta-arago-distro/classes/remove-boot-dir.bbclass
> new file mode 100644
> index 00000000..bd0c09fc
> --- /dev/null
> +++ b/meta-arago-distro/classes/remove-boot-dir.bbclass
> @@ -0,0 +1,8 @@
> +# Add a ROOTFS_POSTPROCESS_COMMAND that will remove some files from the
> +# rootfs for initramfs images.
> +
> +ROOTFS_POSTPROCESS_COMMAND += "remove_boot_dir;"
> +
> +remove_boot_dir () {
> +    rm -rf ${IMAGE_ROOTFS}/boot
> +}
> diff --git a/meta-arago-distro/recipes-core/images/tisdk-tiny-initramfs.bb b/meta-arago-distro/recipes-core/images/tisdk-tiny-initramfs.bb
> new file mode 100644
> index 00000000..0bea8276
> --- /dev/null
> +++ b/meta-arago-distro/recipes-core/images/tisdk-tiny-initramfs.bb
> @@ -0,0 +1,26 @@
> +SUMMARY = "Arago TI SDK super minimal base image for initramfs"
> +
> +DESCRIPTION = "Image meant for basic boot of linux kernel. Intended as\
> + bare system, this image does not package the kernel in the\
> + standard /boot folder in rootfs. Instead, it provides a base\
> + rootfs allowing kernel to be deployed elsewhere\
> + (tftp/separate boot partition/jtag log etc..) and boot\
> + the image.\
> +"
> +
> +LICENSE = "MIT"
> +
> +inherit core-image
> +inherit remove-boot-dir
> +
> +IMAGE_FEATURES:remove = "package-management"
> +
> +INITRAMFS_FSTYPES = "cpio cpio.xz"
> +INITRAMFS_MAXSIZE = "65536"
> +IMAGE_OVERHEAD_FACTOR = "1"
> +
> +IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"
> +
> +PACKAGE_INSTALL = "packagegroup-arago-initramfs"
> +
> +export IMAGE_BASENAME = "tisdk-tiny-initramfs"
> diff --git a/meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-initramfs.bb b/meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-initramfs.bb
> new file mode 100644
> index 00000000..380cc0e3
> --- /dev/null
> +++ b/meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-initramfs.bb
> @@ -0,0 +1,4 @@
> +
> +require recipes-core/packagegroups/packagegroup-core-boot.bb
> +
> +RDEPENDS:${PN}:remove = "grub-efi kernel"
> -- 
> 2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [meta-arago][master/kirkstone][PATCH v3 1/2] tisdk-tiny-initramfs: Create a smaller dedicated initramfs for tiny
  2023-08-14 17:59 ` [meta-arago][master/kirkstone][PATCH v3 1/2] tisdk-tiny-initramfs: Create a smaller dedicated initramfs for tiny Denys Dmytriyenko
@ 2023-08-14 18:02   ` Ryan Eatmon
  0 siblings, 0 replies; 4+ messages in thread
From: Ryan Eatmon @ 2023-08-14 18:02 UTC (permalink / raw)
  To: Denys Dmytriyenko; +Cc: Praneeth Bajjuri, Denys Dmytriyenko, meta-arago



On 8/14/2023 12:59 PM, Denys Dmytriyenko wrote:
> On Sat, Aug 05, 2023 at 11:39:47PM -0500, Ryan Eatmon via lists.yoctoproject.org wrote:
>> The initramfs does not need grub-efi or the /boot directory since it
>> does not have to boot the system itself.  So create a version of the
>> tiny-image that strips those out and follow the oe-core methodology for
>> initramfs.
> 
> So, kernel.bbclass has a default weak dependency from kernel-base to
> kernel-image, which is meant to be broken/cleared if you don't need to
> pull kernel images into a rootfs.
> 
> To simplify, it looked like this some time ago:
> RDEPENDS:kernel-base ?= "kernel-image"
> 
> Well, these days it's ${KERNEL_PACKAGE_NAME}-base and
> ${KERNEL_PACKAGE_NAME}-image
> 
> So one can prevent pulling kernel images into rootfs:
> https://git.openembedded.org/openembedded-core/tree/meta/conf/machine/include/qemu.inc#n19
> 
> But, this is a kernel variable that controls how kernel packages get
> generated with their dependencies. You can modify it either in the kernel
> recipe itself, ot globally in either <machine>.conf or <distro>.conf.
> 
> We also use the same mechanism to pull in kernel-devicetree package with
> DTBs and other required FW images.
> 
> Unfortunately, that also means it cannot be adjusted on a per-image basis.
> 
> Hence, in the past we used to do exactly the same by removing /boot directory
> for a initramfs image (you don't need to create a separate class though):
> https://git.yoctoproject.org/meta-arago/tree/meta-arago-distro/recipes-bsp/netboot-initrd/netboot-initrd_0.0.1.bb?id=f9cf73fd8821af096fed7ad4d485af72c8ecc3ce

I thought I tried something like that... Maybe I had something else 
wrong that prevented it from working.  I'll try again.


> 
> Oh, and RDEPENDS was recently replaced with RRECOMMENDS:
> https://git.openembedded.org/openembedded-core/tree/meta/classes-recipe/kernel.bbclass#n708
> 
> Supposedly, this should make the dependency even weaker and allow
> breaking it inside image recipe with BAD_RECOMMENDATIONS, but my
> quick testing didn't work for some reason...
> 
> 
>> Signed-off-by: Ryan Eatmon <reatmon@ti.com>
>> ---
>>   .../classes/remove-boot-dir.bbclass           |  8 ++++++
>>   .../images/tisdk-tiny-initramfs.bb            | 26 +++++++++++++++++++
>>   .../packagegroup-arago-initramfs.bb           |  4 +++
>>   3 files changed, 38 insertions(+)
>>   create mode 100644 meta-arago-distro/classes/remove-boot-dir.bbclass
>>   create mode 100644 meta-arago-distro/recipes-core/images/tisdk-tiny-initramfs.bb
>>   create mode 100644 meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-initramfs.bb
>>
>> diff --git a/meta-arago-distro/classes/remove-boot-dir.bbclass b/meta-arago-distro/classes/remove-boot-dir.bbclass
>> new file mode 100644
>> index 00000000..bd0c09fc
>> --- /dev/null
>> +++ b/meta-arago-distro/classes/remove-boot-dir.bbclass
>> @@ -0,0 +1,8 @@
>> +# Add a ROOTFS_POSTPROCESS_COMMAND that will remove some files from the
>> +# rootfs for initramfs images.
>> +
>> +ROOTFS_POSTPROCESS_COMMAND += "remove_boot_dir;"
>> +
>> +remove_boot_dir () {
>> +    rm -rf ${IMAGE_ROOTFS}/boot
>> +}
>> diff --git a/meta-arago-distro/recipes-core/images/tisdk-tiny-initramfs.bb b/meta-arago-distro/recipes-core/images/tisdk-tiny-initramfs.bb
>> new file mode 100644
>> index 00000000..0bea8276
>> --- /dev/null
>> +++ b/meta-arago-distro/recipes-core/images/tisdk-tiny-initramfs.bb
>> @@ -0,0 +1,26 @@
>> +SUMMARY = "Arago TI SDK super minimal base image for initramfs"
>> +
>> +DESCRIPTION = "Image meant for basic boot of linux kernel. Intended as\
>> + bare system, this image does not package the kernel in the\
>> + standard /boot folder in rootfs. Instead, it provides a base\
>> + rootfs allowing kernel to be deployed elsewhere\
>> + (tftp/separate boot partition/jtag log etc..) and boot\
>> + the image.\
>> +"
>> +
>> +LICENSE = "MIT"
>> +
>> +inherit core-image
>> +inherit remove-boot-dir
>> +
>> +IMAGE_FEATURES:remove = "package-management"
>> +
>> +INITRAMFS_FSTYPES = "cpio cpio.xz"
>> +INITRAMFS_MAXSIZE = "65536"
>> +IMAGE_OVERHEAD_FACTOR = "1"
>> +
>> +IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"
>> +
>> +PACKAGE_INSTALL = "packagegroup-arago-initramfs"
>> +
>> +export IMAGE_BASENAME = "tisdk-tiny-initramfs"
>> diff --git a/meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-initramfs.bb b/meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-initramfs.bb
>> new file mode 100644
>> index 00000000..380cc0e3
>> --- /dev/null
>> +++ b/meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-initramfs.bb
>> @@ -0,0 +1,4 @@
>> +
>> +require recipes-core/packagegroups/packagegroup-core-boot.bb
>> +
>> +RDEPENDS:${PN}:remove = "grub-efi kernel"
>> -- 
>> 2.17.1

-- 
Ryan Eatmon                reatmon@ti.com
-----------------------------------------
Texas Instruments, Inc.  -  LCPD  -  MGTS


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-08-14 18:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-06  4:39 [meta-arago][master/kirkstone][PATCH v3 1/2] tisdk-tiny-initramfs: Create a smaller dedicated initramfs for tiny Ryan Eatmon
2023-08-06  4:39 ` [meta-arago][master/kirkstone][PATCH v3 2/2] tisdk-tiny-image: Add dependency on tisdk-tiny-initramfs Ryan Eatmon
2023-08-14 17:59 ` [meta-arago][master/kirkstone][PATCH v3 1/2] tisdk-tiny-initramfs: Create a smaller dedicated initramfs for tiny Denys Dmytriyenko
2023-08-14 18:02   ` Ryan Eatmon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.