diff mbox series

[scarthgap] kernel-fitImage: allow overwrite the configuration dtb label

Message ID DB4PR08MB8102778287B8B1408AF455BB9E9CA@DB4PR08MB8102.eurprd08.prod.outlook.com
State Changes Requested
Delegated to: Steve Sakoman
Headers show
Series [scarthgap] kernel-fitImage: allow overwrite the configuration dtb label | expand

Commit Message

Oliver ROHE May 19, 2025, 11:14 a.m. UTC
This allows to provide a custom label for each dtb
without having to overwrite the whole function.

Signed-off-by: Oliver Rohe <oliver.rohe@wago.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
---
 meta/classes-recipe/kernel-fitimage.bbclass | 25 ++++++++++++++-------
 1 file changed, 17 insertions(+), 8 deletions(-)

--
2.43.0



Internal

Comments

Steve Sakoman May 19, 2025, 3:48 p.m. UTC | #1
Does the master branch allow this?  I can't see a similar commit
there, so it would need to be submitted there first.

Since this is a new feature, there would need to be some discussion as
to whether this would be appropriate for stable branches.

Steve

On Mon, May 19, 2025 at 4:14 AM Oliver ROHE via lists.openembedded.org
<Oliver.Rohe=wago.com@lists.openembedded.org> wrote:
>
> This allows to provide a custom label for each dtb
> without having to overwrite the whole function.
>
> Signed-off-by: Oliver Rohe <oliver.rohe@wago.com>
> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
> ---
>  meta/classes-recipe/kernel-fitimage.bbclass | 25 ++++++++++++++-------
>  1 file changed, 17 insertions(+), 8 deletions(-)
>
> diff --git a/meta/classes-recipe/kernel-fitimage.bbclass b/meta/classes-recipe/kernel-fitimage.bbclass
> index 4b74ddc201..53b5acb0fc 100644
> --- a/meta/classes-recipe/kernel-fitimage.bbclass
> +++ b/meta/classes-recipe/kernel-fitimage.bbclass
> @@ -382,6 +382,15 @@ symlink_points_below() {
>         echo "$realpath"
>  }
>
> +#
> +# Simple function to allow overwriting the configuration node label
> +#
> +# $1 ... DTB image name
> +fitimage_emit_section_config_dtb_label() {
> +       dtb_img="$1"
> +       echo "${FIT_CONF_PREFIX}${dtb_img}"
> +}
> +
>  #
>  # Emit the fitImage ITS configuration section
>  #
> @@ -442,7 +451,7 @@ fitimage_emit_section_config() {
>         # conf node name is selected based on dtb ID if it is present,
>         # otherwise its selected based on kernel ID
>         if [ -n "$dtb_image" ]; then
> -               conf_node=$conf_node$dtb_image
> +               conf_node=$(fitimage_emit_section_config_dtb_label $dtb_image)
>         else
>                 conf_node=$conf_node$kernel_id
>         fi
> @@ -480,13 +489,13 @@ fitimage_emit_section_config() {
>                 # default node is selected based on dtb ID if it is present,
>                 # otherwise its selected based on kernel ID
>                 if [ -n "$dtb_image" ]; then
> -                       # Select default node as user specified dtb when
> -                       # multiple dtb exists.
> -                       if [ -n "$default_dtb_image" ]; then
> -                               default_line="default = \"${FIT_CONF_PREFIX}$default_dtb_image\";"
> -                       else
> -                               default_line="default = \"${FIT_CONF_PREFIX}$dtb_image\";"
> -                       fi
> +                       # Select default node as user specified dtb when
> +                       # multiple dtb exists.
> +                               img=$default_dtb_image
> +                       else
> +                               img=$dtb_img
> +                       fi
> +                       default_line="default = \"$(fitimage_emit_section_config_dtb_label $img)\";"
>                 else
>                         default_line="default = \"${FIT_CONF_PREFIX}$kernel_id\";"
>                 fi
> --
> 2.43.0
>
>
>
> Internal
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#216854): https://lists.openembedded.org/g/openembedded-core/message/216854
> Mute This Topic: https://lists.openembedded.org/mt/113189715/3620601
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [steve@sakoman.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta/classes-recipe/kernel-fitimage.bbclass b/meta/classes-recipe/kernel-fitimage.bbclass
index 4b74ddc201..53b5acb0fc 100644
--- a/meta/classes-recipe/kernel-fitimage.bbclass
+++ b/meta/classes-recipe/kernel-fitimage.bbclass
@@ -382,6 +382,15 @@  symlink_points_below() {
        echo "$realpath"
 }

+#
+# Simple function to allow overwriting the configuration node label
+#
+# $1 ... DTB image name
+fitimage_emit_section_config_dtb_label() {
+       dtb_img="$1"
+       echo "${FIT_CONF_PREFIX}${dtb_img}"
+}
+
 #
 # Emit the fitImage ITS configuration section
 #
@@ -442,7 +451,7 @@  fitimage_emit_section_config() {
        # conf node name is selected based on dtb ID if it is present,
        # otherwise its selected based on kernel ID
        if [ -n "$dtb_image" ]; then
-               conf_node=$conf_node$dtb_image
+               conf_node=$(fitimage_emit_section_config_dtb_label $dtb_image)
        else
                conf_node=$conf_node$kernel_id
        fi
@@ -480,13 +489,13 @@  fitimage_emit_section_config() {
                # default node is selected based on dtb ID if it is present,
                # otherwise its selected based on kernel ID
                if [ -n "$dtb_image" ]; then
-                       # Select default node as user specified dtb when
-                       # multiple dtb exists.
-                       if [ -n "$default_dtb_image" ]; then
-                               default_line="default = \"${FIT_CONF_PREFIX}$default_dtb_image\";"
-                       else
-                               default_line="default = \"${FIT_CONF_PREFIX}$dtb_image\";"
-                       fi
+                       # Select default node as user specified dtb when
+                       # multiple dtb exists.
+                               img=$default_dtb_image
+                       else
+                               img=$dtb_img
+                       fi
+                       default_line="default = \"$(fitimage_emit_section_config_dtb_label $img)\";"
                else
                        default_line="default = \"${FIT_CONF_PREFIX}$kernel_id\";"
                fi