Skip to contentSkip to conversation

kernel-fitimage: build configuration for image tree when dtb is not present

PATCH Usama Arif 2 participants 3 messages Aug 6, 2020 – Aug 10, 2020 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Usama Arif

author
#1 lore raw

Hi,

I had submitted patches for both the documentation of kernel-fitimage in yocto mega manual as well as test for kernel-gitimage in oeqa. Just wanted to check if there were any review comments for this patch to progress?

Thanks,
Usama

Quoted 86 lines · Usama Arif via lists.openembedded.org

This patch adds support for adding configuration node even when dtb is not part of the FIT image. The conf and default node number are therefore changed to point to kernel ID rather than dtb ID when dtb does not exist.

Change-Id Ia5a2940d1d29ade1d9847c64327c2a582d51c123
---
  meta/classes/kernel-fitimage.bbclass | 29 ++++++++++++++++++++++++++--
  1 file changed, 27 insertions(+), 2 deletions(-)
meta/classes/kernel-fitimage.bbclass +27 -2
index 72b05ff8d1..fa4ea6feef 100644
@@ -257,12 +257,21 @@ fitimage_emit_section_config() {
  	# Test if we have any DTBs at all
  	sep=""
  	conf_desc=""
+	conf_node="conf@"
  	kernel_line=""
  	fdt_line=""
  	ramdisk_line=""
  	setup_line=""
  	default_line=""
 
+	# conf node name is selected based on dtb ID if it is present,
+	# otherwise its selected based on kernel ID
+	if [ -n "${3}" ]; then
+		conf_node=$conf_node${3}
+	else
+		conf_node=$conf_node${2}
+	fi
+
  	if [ -n "${2}" ]; then
  		conf_desc="Linux kernel"
  		sep=", "
@@ -287,12 +296,18 @@ fitimage_emit_section_config() {
  	fi
 
  	if [ "${6}" = "1" ]; then
-		default_line="default = \"conf@${3}\";"
+		# default node is selected based on dtb ID if it is present,
+		# otherwise its selected based on kernel ID
+		if [ -n "${3}" ]; then
+			default_line="default = \"conf@${3}\";"
+		else
+			default_line="default = \"conf@${2}\";"
+		fi
  	fi
 
  	cat << EOF >> ${1}
                  ${default_line}
-                conf@${3} {
+                $conf_node {
  			description = "${6} ${conf_desc}";
  			${kernel_line}
  			${fdt_line}
@@ -434,6 +449,13 @@ fitimage_assemble() {
  	#
  	fitimage_emit_section_maint ${1} confstart
 
+	# kernel-fitimage.bbclass currently only supports a single kernel (no less or
+	# more) to be added to the FIT image along with 0 or more device trees and
+	# 0 or 1 ramdisk.
+	# If a device tree is to be part of the FIT image, then select
+	# the default configuration to be used is based on the dtbcount. If there is
+	# no dtb present than select the default configuation to be based on
+	# the kernelcount.
  	if [ -n "${DTBS}" ]; then
  		i=1
  		for DTB in ${DTBS}; do
@@ -445,6 +467,9 @@ fitimage_assemble() {
  			fi
  			i=`expr ${i} + 1`
  		done
+	else
+		defaultconfigcount=1
+		fitimage_emit_section_config ${1} "${kernelcount}" "" "${ramdiskcount}" "${setupcount}" "${defaultconfigcount}"
  	fi
 
  	fitimage_emit_section_maint ${1} sectend
#2 lore raw
Quoted 6 lines · Usama Arif

Hi,

I had submitted patches for both the documentation of kernel-fitimage in yocto mega manual as well as test for kernel-gitimage in oeqa. Just wanted to check if there were any review comments for this patch to progress?

Sorry, I'm a bit backlogged after the infrastructure issues earlier in the week. At a quick glance the patch looks good, I'll queue for testing.

Thanks for doing this (and the docs update), its much appreciated and will ultimately ensure these use cases stay working!

Cheers,

Richard

author
#3 lore raw
Quoted 12 lines · Richard Purdie
Quoted 6 lines · Usama Arif

Hi,

I had submitted patches for both the documentation of kernel-fitimage in yocto mega manual as well as test for kernel-gitimage in oeqa. Just wanted to check if there were any review comments for this patch to progress?

Sorry, I'm a bit backlogged after the infrastructure issues earlier in the week. At a quick glance the patch looks good, I'll queue for testing.

Quoted 7 lines

Thanks for doing this (and the docs update), its much appreciated and will ultimately ensure these use cases stay working!

Cheers,

Richard

No problem, it was good to get familiar with the documentation and testing side of things.

Thanks for the review!

Regards,
Usama