diff mbox series

[v1] bsp: fitimage-legacyhs: add default dtb support

Message ID 20250411154418.2951391-1-anshuld@ti.com
State Superseded
Delegated to: Ryan Eatmon
Headers show
Series [v1] bsp: fitimage-legacyhs: add default dtb support | expand

Commit Message

Anshul Dalal April 11, 2025, 3:44 p.m. UTC
FIT_CONF_DEFAULT_DTB config specifies the default dtb file for the
FITimage when multiple ones are provided[1].

Legacyhs fitimage does not currently support this feature which is
required for repurposing the same class for falcon boot.

This patch adds support for FIT_CONF_DEFAULT_DTB without affecting
existing platforms that rely on legacyhs fitImage.

[1]:
https://docs.yoctoproject.org/ref-manual/variables.html#term-FIT_CONF_DEFAULT_DTB

Signed-off-by: Anshul Dalal <anshuld@ti.com>
---
 .../classes/kernel-fitimage-legacyhs.bbclass  | 23 +++++++++++++------
 1 file changed, 16 insertions(+), 7 deletions(-)

Comments

Ryan Eatmon April 11, 2025, 7:23 p.m. UTC | #1
You need to specify which branch this patch is intended to apply to:

[meta-ti][master/scarthgap][PATCH v1] bsp: fitimage-legacyhs: add 
default dtb support
          ^^^^^^^^^^^^^^^^^^


On 4/11/2025 10:44 AM, Anshul Dalal via lists.yoctoproject.org wrote:
> FIT_CONF_DEFAULT_DTB config specifies the default dtb file for the
> FITimage when multiple ones are provided[1].
> 
> Legacyhs fitimage does not currently support this feature which is
> required for repurposing the same class for falcon boot.
> 
> This patch adds support for FIT_CONF_DEFAULT_DTB without affecting
> existing platforms that rely on legacyhs fitImage.
> 
> [1]:
> https://docs.yoctoproject.org/ref-manual/variables.html#term-FIT_CONF_DEFAULT_DTB
> 
> Signed-off-by: Anshul Dalal <anshuld@ti.com>
> ---
>   .../classes/kernel-fitimage-legacyhs.bbclass  | 23 +++++++++++++------
>   1 file changed, 16 insertions(+), 7 deletions(-)
> 
> diff --git a/meta-ti-bsp/classes/kernel-fitimage-legacyhs.bbclass b/meta-ti-bsp/classes/kernel-fitimage-legacyhs.bbclass
> index 5e1fa56a..61813555 100644
> --- a/meta-ti-bsp/classes/kernel-fitimage-legacyhs.bbclass
> +++ b/meta-ti-bsp/classes/kernel-fitimage-legacyhs.bbclass
> @@ -316,6 +316,7 @@ EOF
>   # $4 ... ramdisk ID
>   # $5 ... config ID
>   # $6 ... tee ID/name
> +# $7 ... default DTB ID
>   fitimage_emit_section_config() {
>   
>   	conf_csum=${FITIMAGE_HASH_ALGO}
> @@ -370,6 +371,16 @@ fitimage_emit_section_config() {
>   		final_conf_desc="${conf_desc}"
>   	fi
>   
> +	default_dtb_count=${7}
> +	if [ "x${FITIMAGE_CONF_BY_NAME}" = "x1" ] ; then
> +		default_conf_name="${FIT_CONF_DEFAULT_DTB}"
> +	else
> +		default_conf_name="conf-${default_dtb_count}"
> +	fi
> +	cat << EOF >> ${1}
> +        default = "${default_conf_name}";
> +EOF
> +
>   	dtbcount=1
>   	for DTB in ${KERNEL_DEVICETREE}; do
>   		DTB=$(basename "${DTB}")
> @@ -386,12 +397,6 @@ fitimage_emit_section_config() {
>   			fdt_line="fdt = \"fdt-${dtbcount}\";"
>   		fi
>   
> -		if [ "x${dtbcount}" = "x1" ]; then
> -			cat << EOF >> ${1}
> -                default = "${conf_name}";
> -EOF
> -		fi
> -
>   # Generate a single configuration section
>   			cat << EOF >> ${1}
>                   ${conf_name} {
> @@ -524,6 +529,7 @@ fitimage_assemble() {
>   	ramdiskcount=${3}
>   	setupcount=""
>   	teecount=1
> +	default_dtb_count=1
>   	rm -f ${1} arch/${ARCH}/boot/${2}
>   
>   	fitimage_emit_fit_header ${1}
> @@ -544,6 +550,9 @@ fitimage_assemble() {
>   		dtbcount=1
>   		dtboaddress="${UBOOT_DTBO_LOADADDRESS}"
>   		for DTB in ${KERNEL_DEVICETREE}; do
> +			if [ "${DTB}" = "${FIT_CONF_DEFAULT_DTB}" ]; then
> +				default_dtb_count=${dtbcount}
> +			fi
>   			if echo ${DTB} | grep -q '/dts/'; then
>   				bbwarn "${DTB} contains the full path to the the dts file, but only the dtb name should be used."
>   				DTB=`basename ${DTB} | sed 's,\.dts$,.dtb,g'`
> @@ -660,7 +669,7 @@ fitimage_assemble() {
>   	else
>   		teeref="${teecount}"
>   	fi
> -	fitimage_emit_section_config ${1} "${kernelcount}" "${dtbref}" "${ramdiskcount}" "${setupcount}" "${teeref}"
> +	fitimage_emit_section_config ${1} "${kernelcount}" "${dtbref}" "${ramdiskcount}" "${setupcount}" "${teeref}" "${default_dtb_count}"
>   
>   	fitimage_emit_section_maint ${1} sectend
>   
> 
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#18461): https://lists.yoctoproject.org/g/meta-ti/message/18461
> Mute This Topic: https://lists.yoctoproject.org/mt/112212856/6551054
> Group Owner: meta-ti+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/meta-ti/unsub [reatmon@ti.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta-ti-bsp/classes/kernel-fitimage-legacyhs.bbclass b/meta-ti-bsp/classes/kernel-fitimage-legacyhs.bbclass
index 5e1fa56a..61813555 100644
--- a/meta-ti-bsp/classes/kernel-fitimage-legacyhs.bbclass
+++ b/meta-ti-bsp/classes/kernel-fitimage-legacyhs.bbclass
@@ -316,6 +316,7 @@  EOF
 # $4 ... ramdisk ID
 # $5 ... config ID
 # $6 ... tee ID/name
+# $7 ... default DTB ID
 fitimage_emit_section_config() {
 
 	conf_csum=${FITIMAGE_HASH_ALGO}
@@ -370,6 +371,16 @@  fitimage_emit_section_config() {
 		final_conf_desc="${conf_desc}"
 	fi
 
+	default_dtb_count=${7}
+	if [ "x${FITIMAGE_CONF_BY_NAME}" = "x1" ] ; then
+		default_conf_name="${FIT_CONF_DEFAULT_DTB}"
+	else
+		default_conf_name="conf-${default_dtb_count}"
+	fi
+	cat << EOF >> ${1}
+        default = "${default_conf_name}";
+EOF
+
 	dtbcount=1
 	for DTB in ${KERNEL_DEVICETREE}; do
 		DTB=$(basename "${DTB}")
@@ -386,12 +397,6 @@  fitimage_emit_section_config() {
 			fdt_line="fdt = \"fdt-${dtbcount}\";"
 		fi
 
-		if [ "x${dtbcount}" = "x1" ]; then
-			cat << EOF >> ${1}
-                default = "${conf_name}";
-EOF
-		fi
-
 # Generate a single configuration section
 			cat << EOF >> ${1}
                 ${conf_name} {
@@ -524,6 +529,7 @@  fitimage_assemble() {
 	ramdiskcount=${3}
 	setupcount=""
 	teecount=1
+	default_dtb_count=1
 	rm -f ${1} arch/${ARCH}/boot/${2}
 
 	fitimage_emit_fit_header ${1}
@@ -544,6 +550,9 @@  fitimage_assemble() {
 		dtbcount=1
 		dtboaddress="${UBOOT_DTBO_LOADADDRESS}"
 		for DTB in ${KERNEL_DEVICETREE}; do
+			if [ "${DTB}" = "${FIT_CONF_DEFAULT_DTB}" ]; then
+				default_dtb_count=${dtbcount}
+			fi
 			if echo ${DTB} | grep -q '/dts/'; then
 				bbwarn "${DTB} contains the full path to the the dts file, but only the dtb name should be used."
 				DTB=`basename ${DTB} | sed 's,\.dts$,.dtb,g'`
@@ -660,7 +669,7 @@  fitimage_assemble() {
 	else
 		teeref="${teecount}"
 	fi
-	fitimage_emit_section_config ${1} "${kernelcount}" "${dtbref}" "${ramdiskcount}" "${setupcount}" "${teeref}"
+	fitimage_emit_section_config ${1} "${kernelcount}" "${dtbref}" "${ramdiskcount}" "${setupcount}" "${teeref}" "${default_dtb_count}"
 
 	fitimage_emit_section_maint ${1} sectend