diff mbox series

[master,2/4,v2] recipes-ti: initrd: Make minimal initrd image

Message ID 20250919093831.20609-3-m-shah@ti.com
State Superseded
Delegated to: Ryan Eatmon
Headers show
Series Add recipes to build initramfs image | expand

Commit Message

Moteen Shah Sept. 19, 2025, 9:38 a.m. UTC
Introduce a new minimal initramfs image which will be used
for all K3 devices in the boot flow. The image will package
boot essential and other modules which will be modprobed by
initramfs-udev once the inbuilt drivers gets probed.

Signed-off-by: Moteen Shah <m-shah@ti.com>
---
 .../initrd/packagegroup-ti-initrd.bb          |  5 ++
 .../recipes-ti/initrd/ti-initrd-image.bb      | 50 +++++++++++++++++++
 2 files changed, 55 insertions(+)
 create mode 100644 meta-ti-bsp/recipes-ti/initrd/packagegroup-ti-initrd.bb
 create mode 100644 meta-ti-bsp/recipes-ti/initrd/ti-initrd-image.bb

Comments

Ryan Eatmon Sept. 23, 2025, 9:14 p.m. UTC | #1
On 9/19/2025 4:38 AM, Moteen Shah wrote:
> Introduce a new minimal initramfs image which will be used
> for all K3 devices in the boot flow. The image will package
> boot essential and other modules which will be modprobed by
> initramfs-udev once the inbuilt drivers gets probed.
> 
> Signed-off-by: Moteen Shah <m-shah@ti.com>
> ---
>   .../initrd/packagegroup-ti-initrd.bb          |  5 ++
>   .../recipes-ti/initrd/ti-initrd-image.bb      | 50 +++++++++++++++++++
>   2 files changed, 55 insertions(+)
>   create mode 100644 meta-ti-bsp/recipes-ti/initrd/packagegroup-ti-initrd.bb
>   create mode 100644 meta-ti-bsp/recipes-ti/initrd/ti-initrd-image.bb
> 
> diff --git a/meta-ti-bsp/recipes-ti/initrd/packagegroup-ti-initrd.bb b/meta-ti-bsp/recipes-ti/initrd/packagegroup-ti-initrd.bb
> new file mode 100644
> index 00000000..8847cb2e
> --- /dev/null
> +++ b/meta-ti-bsp/recipes-ti/initrd/packagegroup-ti-initrd.bb

We are using initrd and initramfs in different places.  Yocto seems to 
use initramfs everywhere.  Let's unify to initramfs instead of initrd.

Change the recipe name to packagegroup-ti-core-initramfs.bb

> @@ -0,0 +1,5 @@
> +SUMMARY = "Minimal initrd for boot requirements"
> +
> +require recipes-core/packagegroups/packagegroup-core-boot.bb
> +
> +RDEPENDS:${PN}:remove = "grub-efi kernel"
> diff --git a/meta-ti-bsp/recipes-ti/initrd/ti-initrd-image.bb b/meta-ti-bsp/recipes-ti/initrd/ti-initrd-image.bb
> new file mode 100644
> index 00000000..f47307e5
> --- /dev/null
> +++ b/meta-ti-bsp/recipes-ti/initrd/ti-initrd-image.bb

Change the recipe name to ti-core-initramfs.bb


> @@ -0,0 +1,50 @@
> +SUMMARY = "TI SDK minimal initrd image"

s/initrd/initramfs/

> +
> +DESCRIPTION = "Image meant to probe boot essential modules\
> + and other modules to reach the userspace, which cannot be\
> + built inside the upstream linux kernel image.\
> +"
> +
> +LICENSE = "MIT"
> +
> +inherit core-image
> +
> +IMAGE_NAME = "initrd"

Change the image name to ti-core-initramfs.  There is no good reason to 
not use more characters and be more descriptive.

> +IMAGE_NAME_SUFFIX = ""
> +
> +IMAGE_FEATURES:remove = "package-management"
> +
> +INITRAMFS_FSTYPES = "cpio cpio.xz"
> +
> +IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"
> +
> +INITRAMFS_SCRIPTS ?= "\
> +    initramfs-framework-base \
> +    initramfs-module-udev \
> +    initramfs-module-nfsrootfs \
> +"
> +
> +UTILS = "\
> +    cifs-utils \
> +    nfs-utils \
> +    nfs-utils-client \
> +"

I think the two variables above all need to move into the packagegroup 
and not directly in the image recipe.  Otherwise what is the point of 
the packagegroup at all?

Use RDEPENDS to make the packagegroup depend on the variables, and then 
remove them from the list below.  And move the 
TI_INITRAMFS_KERNEL_MODULES entry as well.

That way if someone else wants to create another initramfs to do 
something like secure boot (or whatever) they have a single point to 
include and pull in all of the files required for boot.

> +PACKAGE_INSTALL = "\
> +    ${INITRAMFS_SCRIPTS} \
> +    ${UTILS} \
> +    ${TI_INITRAMFS_KERNEL_MODULES} \
> +    packagegroup-ti-initrd \

s/packagegroup-ti-initrd/packagegroup-ti-core-initramfs/

> +"
> +
> +export IMAGE_BASENAME = "ti-initrd-image"

s/ti-initrd-image/ti-core-initramfs/

> +
> +# To further reduce the size of the rootfs, remove the /boot directory from
> +# the final image this is usually done by adding RDEPENDS_kernel-base = ""
> +# in the configuration file. In our case we can't use this method. Instead we
> +# just wipe out the content of "/boot" before creating the image.
> +ROOTFS_POSTPROCESS_COMMAND += "empty_boot_dir; "
> +empty_boot_dir () {
> +	rm -rf ${IMAGE_ROOTFS}/boot/*
> +}
Moteen Shah Sept. 29, 2025, 5:10 a.m. UTC | #2
On 24/09/25 02:44, Ryan Eatmon wrote:
>
>
> On 9/19/2025 4:38 AM, Moteen Shah wrote:
>> Introduce a new minimal initramfs image which will be used
>> for all K3 devices in the boot flow. The image will package
>> boot essential and other modules which will be modprobed by
>> initramfs-udev once the inbuilt drivers gets probed.
>>
>> Signed-off-by: Moteen Shah <m-shah@ti.com>
>> ---
>>   .../initrd/packagegroup-ti-initrd.bb          |  5 ++
>>   .../recipes-ti/initrd/ti-initrd-image.bb      | 50 +++++++++++++++++++
>>   2 files changed, 55 insertions(+)
>>   create mode 100644 
>> meta-ti-bsp/recipes-ti/initrd/packagegroup-ti-initrd.bb
>>   create mode 100644 meta-ti-bsp/recipes-ti/initrd/ti-initrd-image.bb
>>
>> diff --git a/meta-ti-bsp/recipes-ti/initrd/packagegroup-ti-initrd.bb 
>> b/meta-ti-bsp/recipes-ti/initrd/packagegroup-ti-initrd.bb
>> new file mode 100644
>> index 00000000..8847cb2e
>> --- /dev/null
>> +++ b/meta-ti-bsp/recipes-ti/initrd/packagegroup-ti-initrd.bb
>
> We are using initrd and initramfs in different places.  Yocto seems to 
> use initramfs everywhere.  Let's unify to initramfs instead of initrd.
>
> Change the recipe name to packagegroup-ti-core-initramfs.bb
>
>> @@ -0,0 +1,5 @@
>> +SUMMARY = "Minimal initrd for boot requirements"
>> +
>> +require recipes-core/packagegroups/packagegroup-core-boot.bb
>> +
>> +RDEPENDS:${PN}:remove = "grub-efi kernel"
>> diff --git a/meta-ti-bsp/recipes-ti/initrd/ti-initrd-image.bb 
>> b/meta-ti-bsp/recipes-ti/initrd/ti-initrd-image.bb
>> new file mode 100644
>> index 00000000..f47307e5
>> --- /dev/null
>> +++ b/meta-ti-bsp/recipes-ti/initrd/ti-initrd-image.bb
>
> Change the recipe name to ti-core-initramfs.bb
>
>
>> @@ -0,0 +1,50 @@
>> +SUMMARY = "TI SDK minimal initrd image"
>
> s/initrd/initramfs/

Noted.

>
>> +
>> +DESCRIPTION = "Image meant to probe boot essential modules\
>> + and other modules to reach the userspace, which cannot be\
>> + built inside the upstream linux kernel image.\
>> +"
>> +
>> +LICENSE = "MIT"
>> +
>> +inherit core-image
>> +
>> +IMAGE_NAME = "initrd"
>
> Change the image name to ti-core-initramfs.  There is no good reason 
> to not use more characters and be more descriptive.
>
>> +IMAGE_NAME_SUFFIX = ""
>> +
>> +IMAGE_FEATURES:remove = "package-management"
>> +
>> +INITRAMFS_FSTYPES = "cpio cpio.xz"
>> +
>> +IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"
>> +
>> +INITRAMFS_SCRIPTS ?= "\
>> +    initramfs-framework-base \
>> +    initramfs-module-udev \
>> +    initramfs-module-nfsrootfs \
>> +"
>> +
>> +UTILS = "\
>> +    cifs-utils \
>> +    nfs-utils \
>> +    nfs-utils-client \
>> +"
>
> I think the two variables above all need to move into the packagegroup 
> and not directly in the image recipe.  Otherwise what is the point of 
> the packagegroup at all?
>
> Use RDEPENDS to make the packagegroup depend on the variables, and 
> then remove them from the list below.  And move the 
> TI_INITRAMFS_KERNEL_MODULES entry as well.
>
> That way if someone else wants to create another initramfs to do 
> something like secure boot (or whatever) they have a single point to 
> include and pull in all of the files required for boot.

Makes sense, I will fix in v3.

>
>> +PACKAGE_INSTALL = "\
>> +    ${INITRAMFS_SCRIPTS} \
>> +    ${UTILS} \
>> +    ${TI_INITRAMFS_KERNEL_MODULES} \
>> +    packagegroup-ti-initrd \
>
> s/packagegroup-ti-initrd/packagegroup-ti-core-initramfs/
>
>> +"
>> +
>> +export IMAGE_BASENAME = "ti-initrd-image"
>
> s/ti-initrd-image/ti-core-initramfs/

Noted.

Regards,
Moteen

>
>> +
>> +# To further reduce the size of the rootfs, remove the /boot 
>> directory from
>> +# the final image this is usually done by adding 
>> RDEPENDS_kernel-base = ""
>> +# in the configuration file. In our case we can't use this method. 
>> Instead we
>> +# just wipe out the content of "/boot" before creating the image.
>> +ROOTFS_POSTPROCESS_COMMAND += "empty_boot_dir; "
>> +empty_boot_dir () {
>> +    rm -rf ${IMAGE_ROOTFS}/boot/*
>> +}
>
diff mbox series

Patch

diff --git a/meta-ti-bsp/recipes-ti/initrd/packagegroup-ti-initrd.bb b/meta-ti-bsp/recipes-ti/initrd/packagegroup-ti-initrd.bb
new file mode 100644
index 00000000..8847cb2e
--- /dev/null
+++ b/meta-ti-bsp/recipes-ti/initrd/packagegroup-ti-initrd.bb
@@ -0,0 +1,5 @@ 
+SUMMARY = "Minimal initrd for boot requirements"
+
+require recipes-core/packagegroups/packagegroup-core-boot.bb
+
+RDEPENDS:${PN}:remove = "grub-efi kernel"
diff --git a/meta-ti-bsp/recipes-ti/initrd/ti-initrd-image.bb b/meta-ti-bsp/recipes-ti/initrd/ti-initrd-image.bb
new file mode 100644
index 00000000..f47307e5
--- /dev/null
+++ b/meta-ti-bsp/recipes-ti/initrd/ti-initrd-image.bb
@@ -0,0 +1,50 @@ 
+SUMMARY = "TI SDK minimal initrd image"
+
+DESCRIPTION = "Image meant to probe boot essential modules\
+ and other modules to reach the userspace, which cannot be\
+ built inside the upstream linux kernel image.\
+"
+
+LICENSE = "MIT"
+
+inherit core-image
+
+IMAGE_NAME = "initrd"
+
+IMAGE_NAME_SUFFIX = ""
+
+IMAGE_FEATURES:remove = "package-management"
+
+INITRAMFS_FSTYPES = "cpio cpio.xz"
+
+IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"
+
+INITRAMFS_SCRIPTS ?= "\
+    initramfs-framework-base \
+    initramfs-module-udev \
+    initramfs-module-nfsrootfs \
+"
+
+UTILS = "\
+    cifs-utils \
+    nfs-utils \
+    nfs-utils-client \
+"
+
+PACKAGE_INSTALL = "\
+    ${INITRAMFS_SCRIPTS} \
+    ${UTILS} \
+    ${TI_INITRAMFS_KERNEL_MODULES} \
+    packagegroup-ti-initrd \
+"
+
+export IMAGE_BASENAME = "ti-initrd-image"
+
+# To further reduce the size of the rootfs, remove the /boot directory from
+# the final image this is usually done by adding RDEPENDS_kernel-base = ""
+# in the configuration file. In our case we can't use this method. Instead we
+# just wipe out the content of "/boot" before creating the image.
+ROOTFS_POSTPROCESS_COMMAND += "empty_boot_dir; "
+empty_boot_dir () {
+	rm -rf ${IMAGE_ROOTFS}/boot/*
+}