initramfs: Add dt_to_config script to initramfs
PATCH 1/1 initramfs: Add dt_to_config script to initramfs
Install the dt_to_config script to initramfs image from the linux kernel tree.
--- .../recipes-ti/initramfs/ti-core-initramfs.bb | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb +17 -1
@@ -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 +}
Signature · 1 line
2.34.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 <[email protected]>
- 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 <[email protected]>
- 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
why is this needed?
Quoted 37 lines · Moteen Shah
Install the
dt_to_configscript to initramfs image from the linux kernel tree.Signed-off-by Moteen Shah <[email protected]>--- .../recipes-ti/initramfs/ti-core-initramfs.bb | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb +17
-1@@ -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 +}
Signature · 3 lines
Ryan Eatmon [email protected] ----------------------------------------- Texas Instruments, Inc. - LCPD - MGTS
Quoted 34 lines · Ryan Eatmon
why is this needed?
Quoted 29 lines · Moteen Shah
Install the
dt_to_configscript to initramfs image from the linux kernel tree.Signed-off-by Moteen Shah <[email protected]>--- .../recipes-ti/initramfs/ti-core-initramfs.bb | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb +9
-1@@ -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
Quoted 9 lines
meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb IMAGE_OVERHEAD_FACTOR = "1.1" · line 51
Quoted 8 lines
meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb +8
-0+ 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.
Signature · 4 lines
Regards, Nishanth Menon Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3 1A34 DDB5 849D 1736 249D https://ti.com/opensource
Quoted 46 lines · Nishanth Menon
Quoted 34 lines · Ryan Eatmon
why is this needed?
Quoted 29 lines · Moteen Shah
Install the
dt_to_configscript to initramfs image from the linux kernel tree.Signed-off-by Moteen Shah <[email protected]>--- .../recipes-ti/initramfs/ti-core-initramfs.bb | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb +9
-1@@ -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/dtcQuoted 9 lines
meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb IMAGE_OVERHEAD_FACTOR = "1.1" · line 51
Quoted 8 lines
meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb +8
-0+ 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 +}
Quoted 7 lines
Not in this form. we need a smarter version of
dt_to_configthat can help pick the right kernel modules needed for initramfs.dt_to_configis 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?
Signature · 3 lines
Ryan Eatmon [email protected] ----------------------------------------- Texas Instruments, Inc. - LCPD - MGTS
Quoted 57 lines · Ryan Eatmon
Quoted 46 lines · Nishanth Menon
Quoted 34 lines · Ryan Eatmon
why is this needed?
Quoted 29 lines · Moteen Shah
Install the
dt_to_configscript to initramfs image from the linux kernel tree.Signed-off-by Moteen Shah <[email protected]>--- .../recipes-ti/initramfs/ti-core-initramfs.bb | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb +9
-1@@ -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/dtcQuoted 9 lines
meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb IMAGE_OVERHEAD_FACTOR = "1.1" · line 51
Quoted 8 lines
meta-ti-bsp/recipes-ti/initramfs/ti-core-initramfs.bb +8
-0+ 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 +}Quoted 7 lines
Not in this form. we need a smarter version of
dt_to_configthat can help pick the right kernel modules needed for initramfs.dt_to_configis 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.
Quoted 5 lines
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..
Signature · 4 lines
Regards, Nishanth Menon Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3 1A34 DDB5 849D 1736 249D https://ti.com/opensource