diff mbox series

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

Message ID 20250908105315.19583-2-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. 8, 2025, 10:53 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      | 56 +++++++++++++++++++
 2 files changed, 61 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. 12, 2025, 4:12 p.m. UTC | #1
After some discussion in a call with Denys today, I think we have some 
feedback on what is needed to better leverage this patch idea.

1) We need the way to get this image built as part of the build process. 
  The best way to accomplish that will likely be to follow the firmware 
approach and include it in the MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS 
variable for each platform that requires it.

2) We need a better way to specify the list of MODULES rather than 
hardcoding the list in the recipe.  The list of required modules will 
likely be different for different platforms.

To that end we recommend creating a new variable that should be defined 
in the ti-soc.inc:

   TI_INITRAMFS_KERNEL_MODULES ?= ""

Then in each platform specific .inc file we can set that list to the 
needed modules based on the ti-bsp need.  Our vendor kernels do not need 
it, so it could remain blank, but the mainline/next bsps could set it 
since those actually create the kernel module packages.

   TI_INITRAMFS_KERNEL_MODULES:append:bsp-mainline = " mod1 mod2"
   TI_INITRAMFS_KERNEL_MODULES:append:bsp-next = " mod1 mod2"

Then in the ti-initrd-image.bb you would drop the MODULES="" setting and 
just change to the variable TI_INITRAMFS_KERNEL_MODULES.

This way, if there are other layers that want to create their own 
initramfs we have a variable in place for them to use to include the 
required modules based on the kernel version that is being built.


So, I would probably break all of this up into multiple patches.  The 
first patch would the work in #2 above to establish the needed variable 
for all platforms.  The next patches are your patches but moving to 
TI_INITRAMFS_KERNEL_MODULES.  And the final patch would be adding your 
new ti-initrd-image into MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS list for 
all platforms.

Did I miss anything, Denys?


On 9/8/2025 5:53 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      | 56 +++++++++++++++++++
>   2 files changed, 61 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
> @@ -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..f6b99073
> --- /dev/null
> +++ b/meta-ti-bsp/recipes-ti/initrd/ti-initrd-image.bb
> @@ -0,0 +1,56 @@
> +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 \
> +"
> +
> +MODULES = "\
> +    kernel-module-cdns-pltfrm \
> +    kernel-module-ti-j721e-ufs \
> +    kernel-module-tps6594-i2c \
> +"
> +
> +UTILS = "\
> +    cifs-utils \
> +    nfs-utils \
> +    nfs-utils-client \
> +"
> +
> +PACKAGE_INSTALL = "\
> +    ${INITRAMFS_SCRIPTS} \
> +    ${UTILS} \
> +    ${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/*
> +}
Moteen Shah Sept. 15, 2025, 6:12 a.m. UTC | #2
Hey Ryan,
Thanks for the detailed review.

On 12/09/25 21:42, Ryan Eatmon wrote:
>
> After some discussion in a call with Denys today, I think we have some 
> feedback on what is needed to better leverage this patch idea.
>
> 1) We need the way to get this image built as part of the build 
> process.  The best way to accomplish that will likely be to follow the 
> firmware approach and include it in the 
> MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS variable for each platform that 
> requires it.

I was planning to do something like:

do_rootfs[depends] += "ti-initrd-image:do_image_complete"
ROOTFS_POSTPROCESS_COMMAND += "install_initrd_to_boot; "
install_initrd_to_boot() {
     install -m 0644 ${DEPLOY_DIR_IMAGE}/initrd.cpio 
${IMAGE_ROOTFS}/boot/initrd.cpio
}

in core-image-%.bbappend file to make this image as a part of core image 
build.

I will look out for how I can achieve the same with 
MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS.

Is the above solution optimal though? Since all of the K3 platforms will 
be shifting to the initrd flow.

>
> 2) We need a better way to specify the list of MODULES rather than 
> hardcoding the list in the recipe.  The list of required modules will 
> likely be different for different platforms.
>
> To that end we recommend creating a new variable that should be 
> defined in the ti-soc.inc:
>
>   TI_INITRAMFS_KERNEL_MODULES ?= ""
>
> Then in each platform specific .inc file we can set that list to the 
> needed modules based on the ti-bsp need.  Our vendor kernels do not 
> need it, so it could remain blank, but the mainline/next bsps could 
> set it since those actually create the kernel module packages.
>
>   TI_INITRAMFS_KERNEL_MODULES:append:bsp-mainline = " mod1 mod2"
>   TI_INITRAMFS_KERNEL_MODULES:append:bsp-next = " mod1 mod2"
>
> Then in the ti-initrd-image.bb you would drop the MODULES="" setting 
> and just change to the variable TI_INITRAMFS_KERNEL_MODULES.
>
> This way, if there are other layers that want to create their own 
> initramfs we have a variable in place for them to use to include the 
> required modules based on the kernel version that is being built.

Seems like a better solution for including the modules, I'll fix it in v2.

>
>
>
> So, I would probably break all of this up into multiple patches. The 
> first patch would the work in #2 above to establish the needed 
> variable for all platforms.  The next patches are your patches but 
> moving to TI_INITRAMFS_KERNEL_MODULES.  And the final patch would be 
> adding your new ti-initrd-image into 
> MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS list for all platforms.

Noted.

Regards,
Moteen

>
> Did I miss anything, Denys?
>
>
> On 9/8/2025 5:53 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      | 56 +++++++++++++++++++
>>   2 files changed, 61 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
>> @@ -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..f6b99073
>> --- /dev/null
>> +++ b/meta-ti-bsp/recipes-ti/initrd/ti-initrd-image.bb
>> @@ -0,0 +1,56 @@
>> +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 \
>> +"
>> +
>> +MODULES = "\
>> +    kernel-module-cdns-pltfrm \
>> +    kernel-module-ti-j721e-ufs \
>> +    kernel-module-tps6594-i2c \
>> +"
>> +
>> +UTILS = "\
>> +    cifs-utils \
>> +    nfs-utils \
>> +    nfs-utils-client \
>> +"
>> +
>> +PACKAGE_INSTALL = "\
>> +    ${INITRAMFS_SCRIPTS} \
>> +    ${UTILS} \
>> +    ${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/*
>> +}
>
Ryan Eatmon Sept. 15, 2025, 11:44 a.m. UTC | #3
On 9/15/2025 1:12 AM, Moteen Shah wrote:
> Hey Ryan,
> Thanks for the detailed review.
> 
> On 12/09/25 21:42, Ryan Eatmon wrote:
>>
>> After some discussion in a call with Denys today, I think we have some 
>> feedback on what is needed to better leverage this patch idea.
>>
>> 1) We need the way to get this image built as part of the build 
>> process.  The best way to accomplish that will likely be to follow the 
>> firmware approach and include it in the 
>> MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS variable for each platform that 
>> requires it.
> 
> I was planning to do something like:
> 
> do_rootfs[depends] += "ti-initrd-image:do_image_complete"
> ROOTFS_POSTPROCESS_COMMAND += "install_initrd_to_boot; "
> install_initrd_to_boot() {
>      install -m 0644 ${DEPLOY_DIR_IMAGE}/initrd.cpio 
> ${IMAGE_ROOTFS}/boot/initrd.cpio
> }
> 
> in core-image-%.bbappend file to make this image as a part of core image 
> build.
> 
> I will look out for how I can achieve the same with 
> MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS.
> 
> Is the above solution optimal though? Since all of the K3 platforms will 
> be shifting to the initrd flow.

There are more distributions than just poky and arago.  The solution I 
suggested will work for all of them and not require anything specific 
like your solution.


>>
>> 2) We need a better way to specify the list of MODULES rather than 
>> hardcoding the list in the recipe.  The list of required modules will 
>> likely be different for different platforms.
>>
>> To that end we recommend creating a new variable that should be 
>> defined in the ti-soc.inc:
>>
>>   TI_INITRAMFS_KERNEL_MODULES ?= ""
>>
>> Then in each platform specific .inc file we can set that list to the 
>> needed modules based on the ti-bsp need.  Our vendor kernels do not 
>> need it, so it could remain blank, but the mainline/next bsps could 
>> set it since those actually create the kernel module packages.
>>
>>   TI_INITRAMFS_KERNEL_MODULES:append:bsp-mainline = " mod1 mod2"
>>   TI_INITRAMFS_KERNEL_MODULES:append:bsp-next = " mod1 mod2"
>>
>> Then in the ti-initrd-image.bb you would drop the MODULES="" setting 
>> and just change to the variable TI_INITRAMFS_KERNEL_MODULES.
>>
>> This way, if there are other layers that want to create their own 
>> initramfs we have a variable in place for them to use to include the 
>> required modules based on the kernel version that is being built.
> 
> Seems like a better solution for including the modules, I'll fix it in v2.
> 
>>
>>
>>
>> So, I would probably break all of this up into multiple patches. The 
>> first patch would the work in #2 above to establish the needed 
>> variable for all platforms.  The next patches are your patches but 
>> moving to TI_INITRAMFS_KERNEL_MODULES.  And the final patch would be 
>> adding your new ti-initrd-image into 
>> MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS list for all platforms.
> 
> Noted.
> 
> Regards,
> Moteen
> 
>>
>> Did I miss anything, Denys?
>>
>>
>> On 9/8/2025 5:53 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      | 56 +++++++++++++++++++
>>>   2 files changed, 61 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
>>> @@ -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..f6b99073
>>> --- /dev/null
>>> +++ b/meta-ti-bsp/recipes-ti/initrd/ti-initrd-image.bb
>>> @@ -0,0 +1,56 @@
>>> +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 \
>>> +"
>>> +
>>> +MODULES = "\
>>> +    kernel-module-cdns-pltfrm \
>>> +    kernel-module-ti-j721e-ufs \
>>> +    kernel-module-tps6594-i2c \
>>> +"
>>> +
>>> +UTILS = "\
>>> +    cifs-utils \
>>> +    nfs-utils \
>>> +    nfs-utils-client \
>>> +"
>>> +
>>> +PACKAGE_INSTALL = "\
>>> +    ${INITRAMFS_SCRIPTS} \
>>> +    ${UTILS} \
>>> +    ${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/*
>>> +}
>>
Moteen Shah Sept. 17, 2025, 7:58 a.m. UTC | #4
Hey Ryan,

On 15/09/25 17:14, Ryan Eatmon wrote:
>
>
> On 9/15/2025 1:12 AM, Moteen Shah wrote:
>> Hey Ryan,
>> Thanks for the detailed review.
>>
>> On 12/09/25 21:42, Ryan Eatmon wrote:
>>>
>>> After some discussion in a call with Denys today, I think we have 
>>> some feedback on what is needed to better leverage this patch idea.
>>>
>>> 1) We need the way to get this image built as part of the build 
>>> process.  The best way to accomplish that will likely be to follow 
>>> the firmware approach and include it in the 
>>> MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS variable for each platform that 
>>> requires it.
>>
>> I was planning to do something like:
>>
>> do_rootfs[depends] += "ti-initrd-image:do_image_complete"
>> ROOTFS_POSTPROCESS_COMMAND += "install_initrd_to_boot; "
>> install_initrd_to_boot() {
>>      install -m 0644 ${DEPLOY_DIR_IMAGE}/initrd.cpio 
>> ${IMAGE_ROOTFS}/boot/initrd.cpio
>> }
>>
>> in core-image-%.bbappend file to make this image as a part of core 
>> image build.
>>
>> I will look out for how I can achieve the same with 
>> MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS.
>>
>> Is the above solution optimal though? Since all of the K3 platforms 
>> will be shifting to the initrd flow.
>
> There are more distributions than just poky and arago.  The solution I 
> suggested will work for all of them and not require anything specific 
> like your solution.
>

Understood, I will use MACHINE_ESSENTIAL_EXTRA_RRECOMMEND inside k3.inc, 
but how should I include the initrd image in the boot directory of the 
root partition, since initrd itself is an image I cannot use 
${IMAGE_ROOTFS} inside ti-initrd-image.bb. I did found a way around it 
https://lists.yoctoproject.org/g/yocto/message/47500, not really sure if 
its the correct way.

Regards,
Moteen

>
>>>
>>> 2) We need a better way to specify the list of MODULES rather than 
>>> hardcoding the list in the recipe.  The list of required modules 
>>> will likely be different for different platforms.
>>>
>>> To that end we recommend creating a new variable that should be 
>>> defined in the ti-soc.inc:
>>>
>>>   TI_INITRAMFS_KERNEL_MODULES ?= ""
>>>
>>> Then in each platform specific .inc file we can set that list to the 
>>> needed modules based on the ti-bsp need.  Our vendor kernels do not 
>>> need it, so it could remain blank, but the mainline/next bsps could 
>>> set it since those actually create the kernel module packages.
>>>
>>>   TI_INITRAMFS_KERNEL_MODULES:append:bsp-mainline = " mod1 mod2"
>>>   TI_INITRAMFS_KERNEL_MODULES:append:bsp-next = " mod1 mod2"
>>>
>>> Then in the ti-initrd-image.bb you would drop the MODULES="" setting 
>>> and just change to the variable TI_INITRAMFS_KERNEL_MODULES.
>>>
>>> This way, if there are other layers that want to create their own 
>>> initramfs we have a variable in place for them to use to include the 
>>> required modules based on the kernel version that is being built.
>>
>> Seems like a better solution for including the modules, I'll fix it 
>> in v2.
>>
>>>
>>>
>>>
>>> So, I would probably break all of this up into multiple patches. The 
>>> first patch would the work in #2 above to establish the needed 
>>> variable for all platforms.  The next patches are your patches but 
>>> moving to TI_INITRAMFS_KERNEL_MODULES.  And the final patch would be 
>>> adding your new ti-initrd-image into 
>>> MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS list for all platforms.
>>
>> Noted.
>>
>> Regards,
>> Moteen
>>
>>>
>>> Did I miss anything, Denys?
>>>
>>>
>>> On 9/8/2025 5:53 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      | 56 
>>>> +++++++++++++++++++
>>>>   2 files changed, 61 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
>>>> @@ -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..f6b99073
>>>> --- /dev/null
>>>> +++ b/meta-ti-bsp/recipes-ti/initrd/ti-initrd-image.bb
>>>> @@ -0,0 +1,56 @@
>>>> +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 \
>>>> +"
>>>> +
>>>> +MODULES = "\
>>>> +    kernel-module-cdns-pltfrm \
>>>> +    kernel-module-ti-j721e-ufs \
>>>> +    kernel-module-tps6594-i2c \
>>>> +"
>>>> +
>>>> +UTILS = "\
>>>> +    cifs-utils \
>>>> +    nfs-utils \
>>>> +    nfs-utils-client \
>>>> +"
>>>> +
>>>> +PACKAGE_INSTALL = "\
>>>> +    ${INITRAMFS_SCRIPTS} \
>>>> +    ${UTILS} \
>>>> +    ${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/*
>>>> +}
>>>
>
Moteen Shah Sept. 17, 2025, 10:12 a.m. UTC | #5
Hey Ryan,

On 17/09/25 13:28, Moteen Shah via lists.yoctoproject.org wrote:
> Hey Ryan,
>
> On 15/09/25 17:14, Ryan Eatmon wrote:
>>
>>
>> On 9/15/2025 1:12 AM, Moteen Shah wrote:
>>> Hey Ryan,
>>> Thanks for the detailed review.
>>>
>>> On 12/09/25 21:42, Ryan Eatmon wrote:
>>>>
>>>> After some discussion in a call with Denys today, I think we have 
>>>> some feedback on what is needed to better leverage this patch idea.
>>>>
>>>> 1) We need the way to get this image built as part of the build 
>>>> process.  The best way to accomplish that will likely be to follow 
>>>> the firmware approach and include it in the 
>>>> MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS variable for each platform that 
>>>> requires it.
>>>
>>> I was planning to do something like:
>>>
>>> do_rootfs[depends] += "ti-initrd-image:do_image_complete"
>>> ROOTFS_POSTPROCESS_COMMAND += "install_initrd_to_boot; "
>>> install_initrd_to_boot() {
>>>      install -m 0644 ${DEPLOY_DIR_IMAGE}/initrd.cpio 
>>> ${IMAGE_ROOTFS}/boot/initrd.cpio
>>> }
>>>
>>> in core-image-%.bbappend file to make this image as a part of core 
>>> image build.
>>>
>>> I will look out for how I can achieve the same with 
>>> MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS.
>>>
>>> Is the above solution optimal though? Since all of the K3 platforms 
>>> will be shifting to the initrd flow.
>>
>> There are more distributions than just poky and arago.  The solution 
>> I suggested will work for all of them and not require anything 
>> specific like your solution.
>>
>
> Understood, I will use MACHINE_ESSENTIAL_EXTRA_RRECOMMEND inside 
> k3.inc, but how should I include the initrd image in the boot 
> directory of the root partition, since initrd itself is an image I 
> cannot use ${IMAGE_ROOTFS} inside ti-initrd-image.bb. I did found a 
> way around it https://lists.yoctoproject.org/g/yocto/message/47500, 
> not really sure if its the correct way.
>
> Regards,
> Moteen
>

Adding on the thread, using MACHINE_ESSENTIAL_EXTRA_RRECOMMEND does not 
builds the initrd.cpio. I suspect that the tag is used to include 
packages and since ti-initrd-image is recipe for image itself and not a 
package it does not work. As a workaround to the issue, I am using:

do_image_complete[depends] += "ti-initrd-image:do_image_complete"


in the platform specific .inc files.

Regards,
Moteen


>>
>>>>
>>>> 2) We need a better way to specify the list of MODULES rather than 
>>>> hardcoding the list in the recipe.  The list of required modules 
>>>> will likely be different for different platforms.
>>>>
>>>> To that end we recommend creating a new variable that should be 
>>>> defined in the ti-soc.inc:
>>>>
>>>>   TI_INITRAMFS_KERNEL_MODULES ?= ""
>>>>
>>>> Then in each platform specific .inc file we can set that list to 
>>>> the needed modules based on the ti-bsp need.  Our vendor kernels do 
>>>> not need it, so it could remain blank, but the mainline/next bsps 
>>>> could set it since those actually create the kernel module packages.
>>>>
>>>>   TI_INITRAMFS_KERNEL_MODULES:append:bsp-mainline = " mod1 mod2"
>>>>   TI_INITRAMFS_KERNEL_MODULES:append:bsp-next = " mod1 mod2"
>>>>
>>>> Then in the ti-initrd-image.bb you would drop the MODULES="" 
>>>> setting and just change to the variable TI_INITRAMFS_KERNEL_MODULES.
>>>>
>>>> This way, if there are other layers that want to create their own 
>>>> initramfs we have a variable in place for them to use to include 
>>>> the required modules based on the kernel version that is being built.
>>>
>>> Seems like a better solution for including the modules, I'll fix it 
>>> in v2.
>>>
>>>>
>>>>
>>>>
>>>> So, I would probably break all of this up into multiple patches. 
>>>> The first patch would the work in #2 above to establish the needed 
>>>> variable for all platforms.  The next patches are your patches but 
>>>> moving to TI_INITRAMFS_KERNEL_MODULES.  And the final patch would 
>>>> be adding your new ti-initrd-image into 
>>>> MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS list for all platforms.
>>>
>>> Noted.
>>>
>>> Regards,
>>> Moteen
>>>
>>>>
>>>> Did I miss anything, Denys?
>>>>
>>>>
>>>> On 9/8/2025 5:53 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      | 56 
>>>>> +++++++++++++++++++
>>>>>   2 files changed, 61 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
>>>>> @@ -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..f6b99073
>>>>> --- /dev/null
>>>>> +++ b/meta-ti-bsp/recipes-ti/initrd/ti-initrd-image.bb
>>>>> @@ -0,0 +1,56 @@
>>>>> +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 \
>>>>> +"
>>>>> +
>>>>> +MODULES = "\
>>>>> +    kernel-module-cdns-pltfrm \
>>>>> +    kernel-module-ti-j721e-ufs \
>>>>> +    kernel-module-tps6594-i2c \
>>>>> +"
>>>>> +
>>>>> +UTILS = "\
>>>>> +    cifs-utils \
>>>>> +    nfs-utils \
>>>>> +    nfs-utils-client \
>>>>> +"
>>>>> +
>>>>> +PACKAGE_INSTALL = "\
>>>>> +    ${INITRAMFS_SCRIPTS} \
>>>>> +    ${UTILS} \
>>>>> +    ${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/*
>>>>> +}
>>>>
>>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#19015): https://lists.yoctoproject.org/g/meta-ti/message/19015
> Mute This Topic: https://lists.yoctoproject.org/mt/115128108/9997635
> Group Owner: meta-ti+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/meta-ti/unsub [m-shah@ti.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Ryan Eatmon Sept. 17, 2025, 2:44 p.m. UTC | #6
On 9/17/2025 2:58 AM, Moteen Shah wrote:
> Hey Ryan,
> 
> On 15/09/25 17:14, Ryan Eatmon wrote:
>>
>>
>> On 9/15/2025 1:12 AM, Moteen Shah wrote:
>>> Hey Ryan,
>>> Thanks for the detailed review.
>>>
>>> On 12/09/25 21:42, Ryan Eatmon wrote:
>>>>
>>>> After some discussion in a call with Denys today, I think we have 
>>>> some feedback on what is needed to better leverage this patch idea.
>>>>
>>>> 1) We need the way to get this image built as part of the build 
>>>> process.  The best way to accomplish that will likely be to follow 
>>>> the firmware approach and include it in the 
>>>> MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS variable for each platform that 
>>>> requires it.
>>>
>>> I was planning to do something like:
>>>
>>> do_rootfs[depends] += "ti-initrd-image:do_image_complete"
>>> ROOTFS_POSTPROCESS_COMMAND += "install_initrd_to_boot; "
>>> install_initrd_to_boot() {
>>>      install -m 0644 ${DEPLOY_DIR_IMAGE}/initrd.cpio 
>>> ${IMAGE_ROOTFS}/boot/initrd.cpio
>>> }
>>>
>>> in core-image-%.bbappend file to make this image as a part of core 
>>> image build.
>>>
>>> I will look out for how I can achieve the same with 
>>> MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS.
>>>
>>> Is the above solution optimal though? Since all of the K3 platforms 
>>> will be shifting to the initrd flow.
>>
>> There are more distributions than just poky and arago.  The solution I 
>> suggested will work for all of them and not require anything specific 
>> like your solution.
>>
> 
> Understood, I will use MACHINE_ESSENTIAL_EXTRA_RRECOMMEND inside k3.inc, 
> but how should I include the initrd image in the boot directory of the 
> root partition, since initrd itself is an image I cannot use 
> ${IMAGE_ROOTFS} inside ti-initrd-image.bb. I did found a way around it 
> https://lists.yoctoproject.org/g/yocto/message/47500, not really sure if 
> its the correct way.

Why does the initrd need to be in the rootfs?  The whole point of this 
initrd is to get the kernel to boot to get to the point of loading the 
rootfs, at which point the initrd has served it's purpose.


> Regards,
> Moteen
> 
>>
>>>>
>>>> 2) We need a better way to specify the list of MODULES rather than 
>>>> hardcoding the list in the recipe.  The list of required modules 
>>>> will likely be different for different platforms.
>>>>
>>>> To that end we recommend creating a new variable that should be 
>>>> defined in the ti-soc.inc:
>>>>
>>>>   TI_INITRAMFS_KERNEL_MODULES ?= ""
>>>>
>>>> Then in each platform specific .inc file we can set that list to the 
>>>> needed modules based on the ti-bsp need.  Our vendor kernels do not 
>>>> need it, so it could remain blank, but the mainline/next bsps could 
>>>> set it since those actually create the kernel module packages.
>>>>
>>>>   TI_INITRAMFS_KERNEL_MODULES:append:bsp-mainline = " mod1 mod2"
>>>>   TI_INITRAMFS_KERNEL_MODULES:append:bsp-next = " mod1 mod2"
>>>>
>>>> Then in the ti-initrd-image.bb you would drop the MODULES="" setting 
>>>> and just change to the variable TI_INITRAMFS_KERNEL_MODULES.
>>>>
>>>> This way, if there are other layers that want to create their own 
>>>> initramfs we have a variable in place for them to use to include the 
>>>> required modules based on the kernel version that is being built.
>>>
>>> Seems like a better solution for including the modules, I'll fix it 
>>> in v2.
>>>
>>>>
>>>>
>>>>
>>>> So, I would probably break all of this up into multiple patches. The 
>>>> first patch would the work in #2 above to establish the needed 
>>>> variable for all platforms.  The next patches are your patches but 
>>>> moving to TI_INITRAMFS_KERNEL_MODULES.  And the final patch would be 
>>>> adding your new ti-initrd-image into 
>>>> MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS list for all platforms.
>>>
>>> Noted.
>>>
>>> Regards,
>>> Moteen
>>>
>>>>
>>>> Did I miss anything, Denys?
>>>>
>>>>
>>>> On 9/8/2025 5:53 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      | 56 
>>>>> +++++++++++++++++++
>>>>>   2 files changed, 61 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
>>>>> @@ -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..f6b99073
>>>>> --- /dev/null
>>>>> +++ b/meta-ti-bsp/recipes-ti/initrd/ti-initrd-image.bb
>>>>> @@ -0,0 +1,56 @@
>>>>> +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 \
>>>>> +"
>>>>> +
>>>>> +MODULES = "\
>>>>> +    kernel-module-cdns-pltfrm \
>>>>> +    kernel-module-ti-j721e-ufs \
>>>>> +    kernel-module-tps6594-i2c \
>>>>> +"
>>>>> +
>>>>> +UTILS = "\
>>>>> +    cifs-utils \
>>>>> +    nfs-utils \
>>>>> +    nfs-utils-client \
>>>>> +"
>>>>> +
>>>>> +PACKAGE_INSTALL = "\
>>>>> +    ${INITRAMFS_SCRIPTS} \
>>>>> +    ${UTILS} \
>>>>> +    ${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/*
>>>>> +}
>>>>
>>
Moteen Shah Sept. 18, 2025, 5:54 a.m. UTC | #7
On 17/09/25 20:14, Ryan Eatmon via lists.yoctoproject.org wrote:
>
>
> On 9/17/2025 2:58 AM, Moteen Shah wrote:
>> Hey Ryan,
>>
>> On 15/09/25 17:14, Ryan Eatmon wrote:
>>>
>>>
>>> On 9/15/2025 1:12 AM, Moteen Shah wrote:
>>>> Hey Ryan,
>>>> Thanks for the detailed review.
>>>>
>>>> On 12/09/25 21:42, Ryan Eatmon wrote:
>>>>>
>>>>> After some discussion in a call with Denys today, I think we have 
>>>>> some feedback on what is needed to better leverage this patch idea.
>>>>>
>>>>> 1) We need the way to get this image built as part of the build 
>>>>> process.  The best way to accomplish that will likely be to follow 
>>>>> the firmware approach and include it in the 
>>>>> MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS variable for each platform 
>>>>> that requires it.
>>>>
>>>> I was planning to do something like:
>>>>
>>>> do_rootfs[depends] += "ti-initrd-image:do_image_complete"
>>>> ROOTFS_POSTPROCESS_COMMAND += "install_initrd_to_boot; "
>>>> install_initrd_to_boot() {
>>>>      install -m 0644 ${DEPLOY_DIR_IMAGE}/initrd.cpio 
>>>> ${IMAGE_ROOTFS}/boot/initrd.cpio
>>>> }
>>>>
>>>> in core-image-%.bbappend file to make this image as a part of core 
>>>> image build.
>>>>
>>>> I will look out for how I can achieve the same with 
>>>> MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS.
>>>>
>>>> Is the above solution optimal though? Since all of the K3 platforms 
>>>> will be shifting to the initrd flow.
>>>
>>> There are more distributions than just poky and arago.  The solution 
>>> I suggested will work for all of them and not require anything 
>>> specific like your solution.
>>>
>>
>> Understood, I will use MACHINE_ESSENTIAL_EXTRA_RRECOMMEND inside 
>> k3.inc, but how should I include the initrd image in the boot 
>> directory of the root partition, since initrd itself is an image I 
>> cannot use ${IMAGE_ROOTFS} inside ti-initrd-image.bb. I did found a 
>> way around it https://lists.yoctoproject.org/g/yocto/message/47500, 
>> not really sure if its the correct way.
>
> Why does the initrd need to be in the rootfs?  The whole point of this 
> initrd is to get the kernel to boot to get to the point of loading the 
> rootfs, at which point the initrd has served it's purpose.

I was keeping it inside the rootfs to avoid increasing size of the boot 
partition, grub was able to read/load it from any of the required 
partitions given in the SD Card. I will put it in the boot partition 
after increasing its size then in v2.

Regards,
Moteen

>
>
>> Regards,
>> Moteen
>>
>>>
>>>>>
>>>>> 2) We need a better way to specify the list of MODULES rather than 
>>>>> hardcoding the list in the recipe.  The list of required modules 
>>>>> will likely be different for different platforms.
>>>>>
>>>>> To that end we recommend creating a new variable that should be 
>>>>> defined in the ti-soc.inc:
>>>>>
>>>>>   TI_INITRAMFS_KERNEL_MODULES ?= ""
>>>>>
>>>>> Then in each platform specific .inc file we can set that list to 
>>>>> the needed modules based on the ti-bsp need.  Our vendor kernels 
>>>>> do not need it, so it could remain blank, but the mainline/next 
>>>>> bsps could set it since those actually create the kernel module 
>>>>> packages.
>>>>>
>>>>>   TI_INITRAMFS_KERNEL_MODULES:append:bsp-mainline = " mod1 mod2"
>>>>>   TI_INITRAMFS_KERNEL_MODULES:append:bsp-next = " mod1 mod2"
>>>>>
>>>>> Then in the ti-initrd-image.bb you would drop the MODULES="" 
>>>>> setting and just change to the variable TI_INITRAMFS_KERNEL_MODULES.
>>>>>
>>>>> This way, if there are other layers that want to create their own 
>>>>> initramfs we have a variable in place for them to use to include 
>>>>> the required modules based on the kernel version that is being built.
>>>>
>>>> Seems like a better solution for including the modules, I'll fix it 
>>>> in v2.
>>>>
>>>>>
>>>>>
>>>>>
>>>>> So, I would probably break all of this up into multiple patches. 
>>>>> The first patch would the work in #2 above to establish the needed 
>>>>> variable for all platforms.  The next patches are your patches but 
>>>>> moving to TI_INITRAMFS_KERNEL_MODULES.  And the final patch would 
>>>>> be adding your new ti-initrd-image into 
>>>>> MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS list for all platforms.
>>>>
>>>> Noted.
>>>>
>>>> Regards,
>>>> Moteen
>>>>
>>>>>
>>>>> Did I miss anything, Denys?
>>>>>
>>>>>
>>>>> On 9/8/2025 5:53 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      | 56 
>>>>>> +++++++++++++++++++
>>>>>>   2 files changed, 61 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
>>>>>> @@ -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..f6b99073
>>>>>> --- /dev/null
>>>>>> +++ b/meta-ti-bsp/recipes-ti/initrd/ti-initrd-image.bb
>>>>>> @@ -0,0 +1,56 @@
>>>>>> +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 \
>>>>>> +"
>>>>>> +
>>>>>> +MODULES = "\
>>>>>> +    kernel-module-cdns-pltfrm \
>>>>>> +    kernel-module-ti-j721e-ufs \
>>>>>> +    kernel-module-tps6594-i2c \
>>>>>> +"
>>>>>> +
>>>>>> +UTILS = "\
>>>>>> +    cifs-utils \
>>>>>> +    nfs-utils \
>>>>>> +    nfs-utils-client \
>>>>>> +"
>>>>>> +
>>>>>> +PACKAGE_INSTALL = "\
>>>>>> +    ${INITRAMFS_SCRIPTS} \
>>>>>> +    ${UTILS} \
>>>>>> +    ${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/*
>>>>>> +}
>>>>>
>>>
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#19017): https://lists.yoctoproject.org/g/meta-ti/message/19017
> Mute This Topic: https://lists.yoctoproject.org/mt/115128108/9997635
> Group Owner: meta-ti+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/meta-ti/unsub [m-shah@ti.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Andrew Davis Sept. 18, 2025, 1:46 p.m. UTC | #8
On 9/18/25 12:54 AM, Moteen Shah via lists.yoctoproject.org wrote:
> 
> On 17/09/25 20:14, Ryan Eatmon via lists.yoctoproject.org wrote:
>>
>>
>> On 9/17/2025 2:58 AM, Moteen Shah wrote:
>>> Hey Ryan,
>>>
>>> On 15/09/25 17:14, Ryan Eatmon wrote:
>>>>
>>>>
>>>> On 9/15/2025 1:12 AM, Moteen Shah wrote:
>>>>> Hey Ryan,
>>>>> Thanks for the detailed review.
>>>>>
>>>>> On 12/09/25 21:42, Ryan Eatmon wrote:
>>>>>>
>>>>>> After some discussion in a call with Denys today, I think we have some feedback on what is needed to better leverage this patch idea.
>>>>>>
>>>>>> 1) We need the way to get this image built as part of the build process.  The best way to accomplish that will likely be to follow the firmware approach and include it in the MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS variable for each platform that requires it.
>>>>>
>>>>> I was planning to do something like:
>>>>>
>>>>> do_rootfs[depends] += "ti-initrd-image:do_image_complete"
>>>>> ROOTFS_POSTPROCESS_COMMAND += "install_initrd_to_boot; "
>>>>> install_initrd_to_boot() {
>>>>>      install -m 0644 ${DEPLOY_DIR_IMAGE}/initrd.cpio ${IMAGE_ROOTFS}/boot/initrd.cpio
>>>>> }
>>>>>
>>>>> in core-image-%.bbappend file to make this image as a part of core image build.
>>>>>
>>>>> I will look out for how I can achieve the same with MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS.
>>>>>
>>>>> Is the above solution optimal though? Since all of the K3 platforms will be shifting to the initrd flow.
>>>>
>>>> There are more distributions than just poky and arago.  The solution I suggested will work for all of them and not require anything specific like your solution.
>>>>
>>>
>>> Understood, I will use MACHINE_ESSENTIAL_EXTRA_RRECOMMEND inside k3.inc, but how should I include the initrd image in the boot directory of the root partition, since initrd itself is an image I cannot use ${IMAGE_ROOTFS} inside ti-initrd-image.bb. I did found a way around it https://lists.yoctoproject.org/g/yocto/message/47500, not really sure if its the correct way.
>>
>> Why does the initrd need to be in the rootfs?  The whole point of this initrd is to get the kernel to boot to get to the point of loading the rootfs, at which point the initrd has served it's purpose.
> 
> I was keeping it inside the rootfs to avoid increasing size of the boot partition, grub was able to read/load it from any of the required partitions given in the SD Card. I will put it in the boot partition after increasing its size then in v2.
> 

Rootfs is the right spot, it should go in the same spot as the other
Linux boot components (kernel and DTB) which we should have in rootfs.

Andrew

> Regards,
> Moteen
> 
>>
>>
>>> Regards,
>>> Moteen
>>>
>>>>
>>>>>>
>>>>>> 2) We need a better way to specify the list of MODULES rather than hardcoding the list in the recipe.  The list of required modules will likely be different for different platforms.
>>>>>>
>>>>>> To that end we recommend creating a new variable that should be defined in the ti-soc.inc:
>>>>>>
>>>>>>   TI_INITRAMFS_KERNEL_MODULES ?= ""
>>>>>>
>>>>>> Then in each platform specific .inc file we can set that list to the needed modules based on the ti-bsp need.  Our vendor kernels do not need it, so it could remain blank, but the mainline/next bsps could set it since those actually create the kernel module packages.
>>>>>>
>>>>>>   TI_INITRAMFS_KERNEL_MODULES:append:bsp-mainline = " mod1 mod2"
>>>>>>   TI_INITRAMFS_KERNEL_MODULES:append:bsp-next = " mod1 mod2"
>>>>>>
>>>>>> Then in the ti-initrd-image.bb you would drop the MODULES="" setting and just change to the variable TI_INITRAMFS_KERNEL_MODULES.
>>>>>>
>>>>>> This way, if there are other layers that want to create their own initramfs we have a variable in place for them to use to include the required modules based on the kernel version that is being built.
>>>>>
>>>>> Seems like a better solution for including the modules, I'll fix it in v2.
>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> So, I would probably break all of this up into multiple patches. The first patch would the work in #2 above to establish the needed variable for all platforms.  The next patches are your patches but moving to TI_INITRAMFS_KERNEL_MODULES.  And the final patch would be adding your new ti-initrd-image into MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS list for all platforms.
>>>>>
>>>>> Noted.
>>>>>
>>>>> Regards,
>>>>> Moteen
>>>>>
>>>>>>
>>>>>> Did I miss anything, Denys?
>>>>>>
>>>>>>
>>>>>> On 9/8/2025 5:53 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      | 56 +++++++++++++++++++
>>>>>>>   2 files changed, 61 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
>>>>>>> @@ -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..f6b99073
>>>>>>> --- /dev/null
>>>>>>> +++ b/meta-ti-bsp/recipes-ti/initrd/ti-initrd-image.bb
>>>>>>> @@ -0,0 +1,56 @@
>>>>>>> +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 \
>>>>>>> +"
>>>>>>> +
>>>>>>> +MODULES = "\
>>>>>>> +    kernel-module-cdns-pltfrm \
>>>>>>> +    kernel-module-ti-j721e-ufs \
>>>>>>> +    kernel-module-tps6594-i2c \
>>>>>>> +"
>>>>>>> +
>>>>>>> +UTILS = "\
>>>>>>> +    cifs-utils \
>>>>>>> +    nfs-utils \
>>>>>>> +    nfs-utils-client \
>>>>>>> +"
>>>>>>> +
>>>>>>> +PACKAGE_INSTALL = "\
>>>>>>> +    ${INITRAMFS_SCRIPTS} \
>>>>>>> +    ${UTILS} \
>>>>>>> +    ${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/*
>>>>>>> +}
>>>>>>
>>>>
>>
>>
>>
>>
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#19030): https://lists.yoctoproject.org/g/meta-ti/message/19030
> Mute This Topic: https://lists.yoctoproject.org/mt/115128108/3619733
> Group Owner: meta-ti+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/meta-ti/unsub [afd@ti.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
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..f6b99073
--- /dev/null
+++ b/meta-ti-bsp/recipes-ti/initrd/ti-initrd-image.bb
@@ -0,0 +1,56 @@ 
+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 \
+"
+
+MODULES = "\
+    kernel-module-cdns-pltfrm \
+    kernel-module-ti-j721e-ufs \
+    kernel-module-tps6594-i2c \
+"
+
+UTILS = "\
+    cifs-utils \
+    nfs-utils \
+    nfs-utils-client \
+"
+
+PACKAGE_INSTALL = "\
+    ${INITRAMFS_SCRIPTS} \
+    ${UTILS} \
+    ${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/*
+}