Skip to contentSkip to conversation

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

PATCH Superseded Usama Arif 2 participants 6 messages Jul 17, 2020 – Jul 29, 2020

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Usama Arif

author
#0 lore raw

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

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

---
 meta/classes/kernel-fitimage.bbclass | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
meta/classes/kernel-fitimage.bbclass +12 -2
index 72b05ff8d1..6f4530fc3b 100644
@@ -257,6 +257,7 @@ fitimage_emit_section_config() {
 	# Test if we have any DTBs at all
 	sep=""
 	conf_desc=""
+	conf_node="conf@"
 	kernel_line=""
 	fdt_line=""
 	ramdisk_line=""
@@ -287,12 +288,18 @@ fitimage_emit_section_config() {
 	fi
 
 	if [ "${6}" = "1" ]; then
-		default_line="default = \"conf@${3}\";"
+		if [ -n "${3}" ]; then
+			default_line="default = \"conf@${3}\";"
+			conf_node=$conf_node${3}
+		else
+			default_line="default = \"conf@${2}\";"
+			conf_node=$conf_node${2}
+		fi
 	fi
 
 	cat << EOF >> ${1}
                 ${default_line}
-                conf@${3} {
+                $conf_node {
 			description = "${6} ${conf_desc}";
 			${kernel_line}
 			${fdt_line}
@@ -445,6 +452,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
Signature · 1 line
2.17.1
#1 lore raw
Quoted 9 lines · Usama Arif

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

---
 meta/classes/kernel-fitimage.bbclass | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

I keep asking someone to start providing tests for kernel-fitimage but nobody does. Its near impossible to tell whether this is a good change or one that could cause someone else problems as we have little documented behaviour and no tests.

Could someone please start looking at adding some (and documentation)?

Cheers,

Richard

Quoted 46 lines
meta/classes/kernel-fitimage.bbclass +12 -2
index 72b05ff8d1..6f4530fc3b 100644
@@ -257,6 +257,7 @@ fitimage_emit_section_config() {
 	# Test if we have any DTBs at all
 	sep=""
 	conf_desc=""
+	conf_node="conf@"
 	kernel_line=""
 	fdt_line=""
 	ramdisk_line=""
@@ -287,12 +288,18 @@ fitimage_emit_section_config() {
 	fi
 
 	if [ "${6}" = "1" ]; then
-		default_line="default = \"conf@${3}\";"
+		if [ -n "${3}" ]; then
+			default_line="default = \"conf@${3}\";"
+			conf_node=$conf_node${3}
+		else
+			default_line="default = \"conf@${2}\";"
+			conf_node=$conf_node${2}
+		fi
 	fi
 
 	cat << EOF >> ${1}
                 ${default_line}
-                conf@${3} {
+                $conf_node {
 			description = "${6} ${conf_desc}";
 			${kernel_line}
 			${fdt_line}
@@ -445,6 +452,9 @@ fitimage_assemble() {
 			fi
 			i=`expr ${i} + 1`
 		done
+	else
+		defaultconfigcount=1
+		fitimage_emit_section_config ${1} "${kernelcount}" ""

"${ramdiskcount}" "${setupcount}" "${defaultconfigcount}"

meta/classes/kernel-fitimage.bbclass +0 -0
 	fi
 
 	fitimage_emit_section_maint ${1} sectend
author
#2 lore raw
Quoted 16 lines · Richard Purdie via lists.openembedded.org
Quoted 9 lines · Usama Arif

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

---
  meta/classes/kernel-fitimage.bbclass | 14 ++++++++++++--
  1 file changed, 12 insertions(+), 2 deletions(-)

I keep asking someone to start providing tests for kernel-fitimage but nobody does. Its near impossible to tell whether this is a good change or one that could cause someone else problems as we have little documented behaviour and no tests.

Quoted 5 lines

Could someone please start looking at adding some (and documentation)?

Cheers,

Richard >

Hi,

Thanks for the reply.

There are different components that can be added to a FIT image. This include kernel, ramdisk, dtb, etc. However, it is not necessary for any individual component to be part of the FIT image. In reality, you can have 0-N (0 to N) kernels and/or 0-N ramdisks and/or 0-N dtbs.

However, kernel-fitimage.bbclass currently only supports limited usescases: adding 1 (no more or less) kernel with 1-N dtbs and 0-1 ramdisks.

Before support was added for multiple dtbs, the configuration of FIT image without any dtbs was supported.

This patchset adds back the original support to kernel-fitimage.bbclass for building a FIT image when no dtbs are present. i.e. adds support for 1 kernel with 0-N dtbs. It doesnot affect the existing usecases, but adds back support for a usecase (0 dtb) that originally existed and was removed as a mistake.

I have submitted a v2 of this patch which better documents the code I have submitted so that hopefully its not blocked on the testing and documentation of the entire kernel-fitimage. It also always creates a configuration for FIT image.

I guess i have spent some time debugging kernel-fitimage so am happy to help with the documentation. I guess you would like a high level description of kernel-fitimage at the top of this file as a seperate patch?

I havent worked with the test framework for oe-core so not sure how helpful i could be on that. I tried to look for example test cases that would test any of the existing meta/classes/kernel*.bbclass but couldnt find any.

Hopefully the extra documentation in v2 and the explanation would be useful in understanding and progressing this patch.

Thanks,
Usama

Quoted 50 lines
Quoted 46 lines
meta/classes/kernel-fitimage.bbclass +12 -2
index 72b05ff8d1..6f4530fc3b 100644
@@ -257,6 +257,7 @@ fitimage_emit_section_config() {
  	# Test if we have any DTBs at all
  	sep=""
  	conf_desc=""
+	conf_node="conf@"
  	kernel_line=""
  	fdt_line=""
  	ramdisk_line=""
@@ -287,12 +288,18 @@ fitimage_emit_section_config() {
  	fi
 
  	if [ "${6}" = "1" ]; then
-		default_line="default = \"conf@${3}\";"
+		if [ -n "${3}" ]; then
+			default_line="default = \"conf@${3}\";"
+			conf_node=$conf_node${3}
+		else
+			default_line="default = \"conf@${2}\";"
+			conf_node=$conf_node${2}
+		fi
  	fi
 
  	cat << EOF >> ${1}
                  ${default_line}
-                conf@${3} {
+                $conf_node {
  			description = "${6} ${conf_desc}";
  			${kernel_line}
  			${fdt_line}
@@ -445,6 +452,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
#3 lore raw
Quoted 59 lines · Usama Arif
Quoted 11 lines · Richard Purdie via lists.openembedded.org
Quoted 9 lines · Usama Arif

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

---
  meta/classes/kernel-fitimage.bbclass | 14 ++++++++++++--
  1 file changed, 12 insertions(+), 2 deletions(-)
Quoted 7 lines

I keep asking someone to start providing tests for kernel-fitimage but nobody does. Its near impossible to tell whether this is a good change or one that could cause someone else problems as we have little documented behaviour and no tests.

Could someone please start looking at adding some (and documentation)?

There are different components that can be added to a FIT image. This include kernel, ramdisk, dtb, etc. However, it is not necessary for any individual component to be part of the FIT image. In reality, you can have 0-N (0 to N) kernels and/or 0-N ramdisks and/or 0-N dtbs.

However, kernel-fitimage.bbclass currently only supports limited
usescases: adding 1 (no more or less) kernel with 1-N dtbs and 0-1 ramdisks.

Before support was added for multiple dtbs, the configuration of FIT image without any dtbs was supported.

This patchset adds back the original support to kernel- fitimage.bbclass
for building a FIT image when no dtbs are present. i.e. adds support for
1 kernel with 0-N dtbs. It doesnot affect the existing usecases, but adds back support for a usecase (0 dtb) that originally existed and was
removed as a mistake.

I have submitted a v2 of this patch which better documents the code I have submitted so that hopefully its not blocked on the testing and documentation of the entire kernel-fitimage. It also always creates a configuration for FIT image.

I guess i have spent some time debugging kernel-fitimage so am happy to help with the documentation. I guess you would like a high level description of kernel-fitimage at the top of this file as a seperate patch?

I havent worked with the test framework for oe-core so not sure how helpful i could be on that. I tried to look for example test cases that
would test any of the existing meta/classes/kernel*.bbclass but couldnt
find any.

Quoted 2 lines

Hopefully the extra documentation in v2 and the explanation would be useful in understanding and progressing this patch.

Sorry for the delayed reply. Thanks for adding the extra info, it does help.

By documentation, I mean that kernel-fitimage.bbclass has no information in the reference manual:

https://www.yoctoproject.org/docs/latest/ref-manual/ref-manual.html#ref-classes-kernel-fitimage

generated from:
http://git.yoctoproject.org/cgit.cgi/yocto-docs/tree/documentation/ref-manual/ref-classes.xml

and also there is also no header at the start of the class saying what it does or how to use it.

Could we add something to these locations to give more information about the class?

For testing, have a look at meta/lib/oeqa/selftest/cases/imagefeatures.py. Its testing target image rootfs settings but I believe the concept is similar to how you'd test something like the kernel-fitimage class.

You can run these tests individually with "oe-selftest -r imagefeatures" to run that file or "oe-selftest -r imagefeatures.ImageFeatures.test_bmap" as an example of a specific test.

Cheers,

Richard

author
#4 lore raw
Quoted 85 lines · Richard Purdie
Quoted 59 lines · Usama Arif
Quoted 11 lines · Richard Purdie via lists.openembedded.org
Quoted 9 lines · Usama Arif

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

---
   meta/classes/kernel-fitimage.bbclass | 14 ++++++++++++--
   1 file changed, 12 insertions(+), 2 deletions(-)
Quoted 7 lines

I keep asking someone to start providing tests for kernel-fitimage but nobody does. Its near impossible to tell whether this is a good change or one that could cause someone else problems as we have little documented behaviour and no tests.

Could someone please start looking at adding some (and documentation)?

There are different components that can be added to a FIT image. This include kernel, ramdisk, dtb, etc. However, it is not necessary for any individual component to be part of the FIT image. In reality, you can have 0-N (0 to N) kernels and/or 0-N ramdisks and/or 0-N dtbs.

However, kernel-fitimage.bbclass currently only supports limited
usescases: adding 1 (no more or less) kernel with 1-N dtbs and 0-1 ramdisks.

Before support was added for multiple dtbs, the configuration of FIT image without any dtbs was supported.

This patchset adds back the original support to kernel- fitimage.bbclass
for building a FIT image when no dtbs are present. i.e. adds support for
1 kernel with 0-N dtbs. It doesnot affect the existing usecases, but adds back support for a usecase (0 dtb) that originally existed and was
removed as a mistake.

I have submitted a v2 of this patch which better documents the code I have submitted so that hopefully its not blocked on the testing and documentation of the entire kernel-fitimage. It also always creates a configuration for FIT image.

I guess i have spent some time debugging kernel-fitimage so am happy to help with the documentation. I guess you would like a high level description of kernel-fitimage at the top of this file as a seperate patch?

I havent worked with the test framework for oe-core so not sure how helpful i could be on that. I tried to look for example test cases that
would test any of the existing meta/classes/kernel*.bbclass but couldnt
find any.

Quoted 2 lines

Hopefully the extra documentation in v2 and the explanation would be useful in understanding and progressing this patch.

Sorry for the delayed reply. Thanks for adding the extra info, it does help.

By documentation, I mean that kernel-fitimage.bbclass has no information in the reference manual:

https://www.yoctoproject.org/docs/latest/ref-manual/ref-manual.html#ref-classes-kernel-fitimage

generated from:
http://git.yoctoproject.org/cgit.cgi/yocto-docs/tree/documentation/ref-manual/ref-classes.xml

and also there is also no header at the start of the class saying what it does or how to use it.

Could we add something to these locations to give more information about the class?

For testing, have a look at meta/lib/oeqa/selftest/cases/imagefeatures.py. Its testing target image rootfs settings but I believe the concept is similar to how you'd test something like the kernel-fitimage class.

Quoted 9 lines

You can run these tests individually with "oe-selftest -r imagefeatures" to run that file or "oe-selftest -r imagefeatures.ImageFeatures.test_bmap" as an example of a specific test.

Cheers,

Richard

Hi,

Thanks for the reply. I will submit the documentation and the tests in the next couple of days.

Regards,
Usama

author
#5 lore raw
Quoted 100 lines · Usama Arif
Quoted 87 lines · Richard Purdie
Quoted 59 lines · Usama Arif
Quoted 11 lines · Richard Purdie via lists.openembedded.org
Quoted 9 lines · Usama Arif

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

---
   meta/classes/kernel-fitimage.bbclass | 14 ++++++++++++--

   1 file changed, 12 insertions(+), 2 deletions(-)
Quoted 7 lines

I keep asking someone to start providing tests for kernel-fitimage but nobody does. Its near impossible to tell whether this is a good change or one that could cause someone else problems as we have little documented behaviour and no tests.

Could someone please start looking at adding some (and documentation)?

There are different components that can be added to a FIT image. This include kernel, ramdisk, dtb, etc. However, it is not necessary for any individual component to be part of the FIT image. In reality, you can have 0-N (0 to N) kernels and/or 0-N ramdisks and/or 0-N dtbs.

However, kernel-fitimage.bbclass currently only supports limited
usescases: adding 1 (no more or less) kernel with 1-N dtbs and 0-1 ramdisks.

Before support was added for multiple dtbs, the configuration of FIT image without any dtbs was supported.

This patchset adds back the original support to kernel- fitimage.bbclass
for building a FIT image when no dtbs are present. i.e. adds support for
1 kernel with 0-N dtbs. It doesnot affect the existing usecases, but adds back support for a usecase (0 dtb) that originally existed and was
removed as a mistake.

I have submitted a v2 of this patch which better documents the code I have submitted so that hopefully its not blocked on the testing and documentation of the entire kernel-fitimage. It also always creates a configuration for FIT image.

I guess i have spent some time debugging kernel-fitimage so am happy to help with the documentation. I guess you would like a high level description of kernel-fitimage at the top of this file as a seperate patch?

I havent worked with the test framework for oe-core so not sure how helpful i could be on that. I tried to look for example test cases that
would test any of the existing meta/classes/kernel*.bbclass but couldnt
find any.

Quoted 2 lines

Hopefully the extra documentation in v2 and the explanation would be useful in understanding and progressing this patch.

Sorry for the delayed reply. Thanks for adding the extra info, it does help.

By documentation, I mean that kernel-fitimage.bbclass has no information in the reference manual:

https://www.yoctoproject.org/docs/latest/ref-manual/ref-manual.html#ref-classes-kernel-fitimage

generated from:
http://git.yoctoproject.org/cgit.cgi/yocto-docs/tree/documentation/ref-manual/ref-classes.xml

and also there is also no header at the start of the class saying what it does or how to use it.

Could we add something to these locations to give more information about the class?

For testing, have a look at meta/lib/oeqa/selftest/cases/imagefeatures.py. Its testing target image rootfs settings but I believe the concept is similar to how you'd test something like the kernel-fitimage class.

Quoted 9 lines

You can run these tests individually with "oe-selftest -r imagefeatures" to run that file or "oe-selftest -r imagefeatures.ImageFeatures.test_bmap" as an example of a specific test.

Cheers,

Richard

Quoted 6 lines

Hi,

Thanks for the reply. I will submit the documentation and the tests in the next couple of days.

Regards,
Usama

Hi,

Thanks for the pointers on the documentation and testcase. I have submitted patches for documentation (https://lists.yoctoproject.org/g/docs/message/319) and testcase (https://lists.openembedded.org/g/openembedded-core/message/141097). These assume that the 1 kernel, 1 RAM disk and no dtb case that the v2 version of this patch solves will be supported and the testcase will only pass when the usecase is supported. I hope that the v2 of this patch can now progress.

Thanks,
Usama