diff mbox series

initramfs: Add dt_to_config script to initramfs

Message ID 20260112093125.73038-1-m-shah@ti.com
State Changes Requested
Delegated to: Ryan Eatmon
Headers show
Series initramfs: Add dt_to_config script to initramfs | expand

Commit Message

Moteen Shah Jan. 12, 2026, 9:31 a.m. UTC
Install the dt_to_config script to initramfs image from
the linux kernel tree.

Signed-off-by: Moteen Shah <m-shah@ti.com>
---
 .../recipes-ti/initramfs/ti-core-initramfs.bb  | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

Comments

PRC Automation Jan. 12, 2026, 9:43 a.m. UTC | #1
meta-ti / na / 20260112093125.73038-1-m-shah

PRC Results: PASS

=========================================================
  check-yocto-patches: PASS
=========================================================
Patches
----------------------------------------
WARN - [PATCH] initramfs: Add dt_to_config script to initramfs
    WARN: Missing branches specifier [master/scarthgap/XXXXX]. (META-2)
        patch:68
            Subject: [PATCH] initramfs: Add dt_to_config script to initramfs
    
    For details on the above errors/warnings visit: https://lists.yoctoproject.org/g/meta-ti/wiki/40887



=========================================================
  apply-yocto-patch: PASS
=========================================================
master
=====================
Summary:
- Patch Series: [PATCH] initramfs: Add dt_to_config script to initramfs
- Submitter: From: Moteen Shah <m-shah@ti.com>
- Date: Date: Mon, 12 Jan 2026 15:01:25 +0530
- Num Patches: 1
- Mailing List (public inbox) Commit SHA: 8aa7ae7d5f9b64cfd687e896178cb8de86a4869a

Applied to:
- Repository: lcpd-prc-meta-ti
- Base Branch: master-next
- Commit Author: LCPD Automation Script <lcpdbld@list.ti.com>
- Commit Subject: CI/CD Auto-Merger: cicd.master.202601091234
- Commit SHA: 6f50a74c52ddf4365d0001441c2738a48b38f0a2

Patches
----------------------------------------
All patches applied



=========================================================
  check-yocto-repo: PASS
=========================================================
master
=====================
PASS



=========================================================
  yocto-check-layers: PASS
=========================================================
master - PASS
=====================
All checks passed
Ryan Eatmon Jan. 12, 2026, 2:43 p.m. UTC | #2
why is this needed?


On 1/12/2026 3:31 AM, Moteen Shah wrote:
> Install the dt_to_config script to initramfs image from
> the linux kernel tree.
> 
> Signed-off-by: Moteen Shah <m-shah@ti.com>
> ---
>   .../recipes-ti/initramfs/ti-core-initramfs.bb  | 18 +++++++++++++++++-
>   1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb b/meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb
> index 1a102d82..44574377 100644
> --- a/meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb
> +++ b/meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb
> @@ -29,7 +29,23 @@ IMAGE_OVERHEAD_FACTOR = "1.1"
>   # 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; "
> +ROOTFS_POSTPROCESS_COMMAND += "empty_boot_dir; install_dt_to_config; "
> +
>   empty_boot_dir () {
>   	rm -rf ${IMAGE_ROOTFS}/boot/*
>   }
> +
> +install_dt_to_config () {
> +	# Install dt_to_config script from kernel source to kernel build tree location
> +	if [ -f ${STAGING_KERNEL_DIR}/scripts/dtc/dt_to_config ]; then
> +		KERNEL_VER=$(ls ${IMAGE_ROOTFS}/lib/modules/ 2>/dev/null | head -n1)
> +		if [ -n "$KERNEL_VER" ]; then
> +			install -d ${IMAGE_ROOTFS}/lib/modules/$KERNEL_VER/build/scripts/dtc
> +			install -m 0755 ${STAGING_KERNEL_DIR}/scripts/dtc/dt_to_config ${IMAGE_ROOTFS}/lib/modules/$KERNEL_VER/build/scripts/dtc/dt_to_config
> +		else
> +			bbwarn "No kernel modules directory found in initramfs, cannot install dt_to_config"
> +		fi
> +	else
> +		bbwarn "dt_to_config script not found in kernel source"
> +	fi
> +}
Nishanth Menon Jan. 13, 2026, 11:55 a.m. UTC | #3
On 08:43-20260112, Ryan Eatmon wrote:
> 
> why is this needed?
> 
> 
> On 1/12/2026 3:31 AM, Moteen Shah wrote:
> > Install the dt_to_config script to initramfs image from
> > the linux kernel tree.
> > 
> > Signed-off-by: Moteen Shah <m-shah@ti.com>
> > ---
> >   .../recipes-ti/initramfs/ti-core-initramfs.bb  | 18 +++++++++++++++++-
> >   1 file changed, 17 insertions(+), 1 deletion(-)
> > 
> > diff --git a/meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb b/meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb
> > index 1a102d82..44574377 100644
> > --- a/meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb
> > +++ b/meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb
> > @@ -29,7 +29,23 @@ IMAGE_OVERHEAD_FACTOR = "1.1"
> >   # 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; "
> > +ROOTFS_POSTPROCESS_COMMAND += "empty_boot_dir; install_dt_to_config; "
> > +
> >   empty_boot_dir () {
> >   	rm -rf ${IMAGE_ROOTFS}/boot/*
> >   }
> > +
> > +install_dt_to_config () {
> > +	# Install dt_to_config script from kernel source to kernel build tree location
> > +	if [ -f ${STAGING_KERNEL_DIR}/scripts/dtc/dt_to_config ]; then
> > +		KERNEL_VER=$(ls ${IMAGE_ROOTFS}/lib/modules/ 2>/dev/null | head -n1)
> > +		if [ -n "$KERNEL_VER" ]; then
> > +			install -d ${IMAGE_ROOTFS}/lib/modules/$KERNEL_VER/build/scripts/dtc
> > +			install -m 0755 ${STAGING_KERNEL_DIR}/scripts/dtc/dt_to_config ${IMAGE_ROOTFS}/lib/modules/$KERNEL_VER/build/scripts/dtc/dt_to_config
> > +		else
> > +			bbwarn "No kernel modules directory found in initramfs, cannot install dt_to_config"
> > +		fi
> > +	else
> > +		bbwarn "dt_to_config script not found in kernel source"
> > +	fi
> > +}
> 


Not in this form. we need a smarter version of dt_to_config that can
help pick the right kernel modules needed for initramfs. dt_to_config is
just one part of the puzzle. Context here is this: we would like to try
and transition default upstream defconfig to enable ramdisk by default
and then with the right modules in ramdisk switch over to the final
rootfs. if we install all the modules in ramdisk, ramdisk will be
unwieldy.. So need a smarter solution to the same.
Ryan Eatmon Jan. 13, 2026, 2:17 p.m. UTC | #4
On 1/13/2026 5:55 AM, Nishanth Menon wrote:
> On 08:43-20260112, Ryan Eatmon wrote:
>>
>> why is this needed?
>>
>>
>> On 1/12/2026 3:31 AM, Moteen Shah wrote:
>>> Install the dt_to_config script to initramfs image from
>>> the linux kernel tree.
>>>
>>> Signed-off-by: Moteen Shah <m-shah@ti.com>
>>> ---
>>>    .../recipes-ti/initramfs/ti-core-initramfs.bb  | 18 +++++++++++++++++-
>>>    1 file changed, 17 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb b/meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb
>>> index 1a102d82..44574377 100644
>>> --- a/meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb
>>> +++ b/meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb
>>> @@ -29,7 +29,23 @@ IMAGE_OVERHEAD_FACTOR = "1.1"
>>>    # 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; "
>>> +ROOTFS_POSTPROCESS_COMMAND += "empty_boot_dir; install_dt_to_config; "
>>> +
>>>    empty_boot_dir () {
>>>    	rm -rf ${IMAGE_ROOTFS}/boot/*
>>>    }
>>> +
>>> +install_dt_to_config () {
>>> +	# Install dt_to_config script from kernel source to kernel build tree location
>>> +	if [ -f ${STAGING_KERNEL_DIR}/scripts/dtc/dt_to_config ]; then
>>> +		KERNEL_VER=$(ls ${IMAGE_ROOTFS}/lib/modules/ 2>/dev/null | head -n1)
>>> +		if [ -n "$KERNEL_VER" ]; then
>>> +			install -d ${IMAGE_ROOTFS}/lib/modules/$KERNEL_VER/build/scripts/dtc
>>> +			install -m 0755 ${STAGING_KERNEL_DIR}/scripts/dtc/dt_to_config ${IMAGE_ROOTFS}/lib/modules/$KERNEL_VER/build/scripts/dtc/dt_to_config
>>> +		else
>>> +			bbwarn "No kernel modules directory found in initramfs, cannot install dt_to_config"
>>> +		fi
>>> +	else
>>> +		bbwarn "dt_to_config script not found in kernel source"
>>> +	fi
>>> +}
>>
> 
> 
> Not in this form. we need a smarter version of dt_to_config that can
> help pick the right kernel modules needed for initramfs. dt_to_config is
> just one part of the puzzle. Context here is this: we would like to try
> and transition default upstream defconfig to enable ramdisk by default
> and then with the right modules in ramdisk switch over to the final
> rootfs. if we install all the modules in ramdisk, ramdisk will be
> unwieldy.. So need a smarter solution to the same.

We currently have the list coded in the machine configs.  So we are only 
included those.  What does moving to this flow buy us?  And it sounds 
like this is more of a build time thing and not a boot time thing.  So 
this shouldn't be needed to be present in the initramfs, right?  Or am I 
still missing something?
Nishanth Menon Jan. 13, 2026, 4:38 p.m. UTC | #5
On 08:17-20260113, Ryan Eatmon wrote:
> 
> 
> On 1/13/2026 5:55 AM, Nishanth Menon wrote:
> > On 08:43-20260112, Ryan Eatmon wrote:
> > > 
> > > why is this needed?
> > > 
> > > 
> > > On 1/12/2026 3:31 AM, Moteen Shah wrote:
> > > > Install the dt_to_config script to initramfs image from
> > > > the linux kernel tree.
> > > > 
> > > > Signed-off-by: Moteen Shah <m-shah@ti.com>
> > > > ---
> > > >    .../recipes-ti/initramfs/ti-core-initramfs.bb  | 18 +++++++++++++++++-
> > > >    1 file changed, 17 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb b/meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb
> > > > index 1a102d82..44574377 100644
> > > > --- a/meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb
> > > > +++ b/meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb
> > > > @@ -29,7 +29,23 @@ IMAGE_OVERHEAD_FACTOR = "1.1"
> > > >    # 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; "
> > > > +ROOTFS_POSTPROCESS_COMMAND += "empty_boot_dir; install_dt_to_config; "
> > > > +
> > > >    empty_boot_dir () {
> > > >    	rm -rf ${IMAGE_ROOTFS}/boot/*
> > > >    }
> > > > +
> > > > +install_dt_to_config () {
> > > > +	# Install dt_to_config script from kernel source to kernel build tree location
> > > > +	if [ -f ${STAGING_KERNEL_DIR}/scripts/dtc/dt_to_config ]; then
> > > > +		KERNEL_VER=$(ls ${IMAGE_ROOTFS}/lib/modules/ 2>/dev/null | head -n1)
> > > > +		if [ -n "$KERNEL_VER" ]; then
> > > > +			install -d ${IMAGE_ROOTFS}/lib/modules/$KERNEL_VER/build/scripts/dtc
> > > > +			install -m 0755 ${STAGING_KERNEL_DIR}/scripts/dtc/dt_to_config ${IMAGE_ROOTFS}/lib/modules/$KERNEL_VER/build/scripts/dtc/dt_to_config
> > > > +		else
> > > > +			bbwarn "No kernel modules directory found in initramfs, cannot install dt_to_config"
> > > > +		fi
> > > > +	else
> > > > +		bbwarn "dt_to_config script not found in kernel source"
> > > > +	fi
> > > > +}
> > > 
> > 
> > 
> > Not in this form. we need a smarter version of dt_to_config that can
> > help pick the right kernel modules needed for initramfs. dt_to_config is
> > just one part of the puzzle. Context here is this: we would like to try
> > and transition default upstream defconfig to enable ramdisk by default
> > and then with the right modules in ramdisk switch over to the final
> > rootfs. if we install all the modules in ramdisk, ramdisk will be
> > unwieldy.. So need a smarter solution to the same.
> 
> We currently have the list coded in the machine configs.  So we are only
> included those.  What does moving to this flow buy us?  And it sounds like
> this is more of a build time thing and not a boot time thing.  So this
> shouldn't be needed to be present in the initramfs, right?  Or am I still
> missing something?

No, you are not missing anything - this could be utilized build
time to come up with the list dynamically - that would a smarter
version of dt_to_config option that will look not just at the symbol
for the compatible, but also look at dependencies needed for the
functionality. could be a combination of pre-defined fragments
(example: for mmc, filesystem dependencies) + compatible based
discovery (example: mmc node depends on regulator, gpio or whatever)
to create the module list that is then added to initrd. E.g. if 5 dtbs
are supported, then a combination of dependencies for all 5 dtbs. I am
not sure if such a solution exists though..
diff mbox series

Patch

diff --git a/meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb b/meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb
index 1a102d82..44574377 100644
--- a/meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb
+++ b/meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb
@@ -29,7 +29,23 @@  IMAGE_OVERHEAD_FACTOR = "1.1"
 # 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; "
+ROOTFS_POSTPROCESS_COMMAND += "empty_boot_dir; install_dt_to_config; "
+
 empty_boot_dir () {
 	rm -rf ${IMAGE_ROOTFS}/boot/*
 }
+
+install_dt_to_config () {
+	# Install dt_to_config script from kernel source to kernel build tree location
+	if [ -f ${STAGING_KERNEL_DIR}/scripts/dtc/dt_to_config ]; then
+		KERNEL_VER=$(ls ${IMAGE_ROOTFS}/lib/modules/ 2>/dev/null | head -n1)
+		if [ -n "$KERNEL_VER" ]; then
+			install -d ${IMAGE_ROOTFS}/lib/modules/$KERNEL_VER/build/scripts/dtc
+			install -m 0755 ${STAGING_KERNEL_DIR}/scripts/dtc/dt_to_config ${IMAGE_ROOTFS}/lib/modules/$KERNEL_VER/build/scripts/dtc/dt_to_config
+		else
+			bbwarn "No kernel modules directory found in initramfs, cannot install dt_to_config"
+		fi
+	else
+		bbwarn "dt_to_config script not found in kernel source"
+	fi
+}