All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kernel-fitimage: build configuration for image tree when dtb is not present
@ 2020-07-17 14:19 Usama Arif
  2020-07-20  7:41 ` [OE-core] " Richard Purdie
  0 siblings, 1 reply; 6+ messages in thread
From: Usama Arif @ 2020-07-17 14:19 UTC (permalink / raw)
  To: openembedded-core; +Cc: nd, 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.

Signed-off-by: Usama Arif <usama.arif@arm.com>
---
 meta/classes/kernel-fitimage.bbclass | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/meta/classes/kernel-fitimage.bbclass b/meta/classes/kernel-fitimage.bbclass
index 72b05ff8d1..6f4530fc3b 100644
--- a/meta/classes/kernel-fitimage.bbclass
+++ b/meta/classes/kernel-fitimage.bbclass
@@ -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
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [OE-core] [PATCH] kernel-fitimage: build configuration for image tree when dtb is not present
  2020-07-17 14:19 [PATCH] kernel-fitimage: build configuration for image tree when dtb is not present Usama Arif
@ 2020-07-20  7:41 ` Richard Purdie
  2020-07-20 17:21   ` Usama Arif
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Purdie @ 2020-07-20  7:41 UTC (permalink / raw)
  To: Usama Arif, openembedded-core; +Cc: nd

On Fri, 2020-07-17 at 15:19 +0100, Usama Arif wrote:
> 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.
> 
> Signed-off-by: Usama Arif <usama.arif@arm.com>
> ---
>  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

> diff --git a/meta/classes/kernel-fitimage.bbclass
> b/meta/classes/kernel-fitimage.bbclass
> index 72b05ff8d1..6f4530fc3b 100644
> --- a/meta/classes/kernel-fitimage.bbclass
> +++ b/meta/classes/kernel-fitimage.bbclass
> @@ -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
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [OE-core] [PATCH] kernel-fitimage: build configuration for image tree when dtb is not present
  2020-07-20  7:41 ` [OE-core] " Richard Purdie
@ 2020-07-20 17:21   ` Usama Arif
  2020-07-27 10:56     ` Richard Purdie
  0 siblings, 1 reply; 6+ messages in thread
From: Usama Arif @ 2020-07-20 17:21 UTC (permalink / raw)
  To: richard.purdie, openembedded-core; +Cc: nd



On 20/07/2020 08:41, Richard Purdie via lists.openembedded.org wrote:
> On Fri, 2020-07-17 at 15:19 +0100, Usama Arif wrote:
>> 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.
>>
>> Signed-off-by: Usama Arif <usama.arif@arm.com>
>> ---
>>   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 >

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


>> diff --git a/meta/classes/kernel-fitimage.bbclass
>> b/meta/classes/kernel-fitimage.bbclass
>> index 72b05ff8d1..6f4530fc3b 100644
>> --- a/meta/classes/kernel-fitimage.bbclass
>> +++ b/meta/classes/kernel-fitimage.bbclass
>> @@ -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
>>
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [OE-core] [PATCH] kernel-fitimage: build configuration for image tree when dtb is not present
  2020-07-20 17:21   ` Usama Arif
@ 2020-07-27 10:56     ` Richard Purdie
  2020-07-28 10:19       ` Usama Arif
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Purdie @ 2020-07-27 10:56 UTC (permalink / raw)
  To: Usama Arif, openembedded-core; +Cc: nd

On Mon, 2020-07-20 at 18:21 +0100, Usama Arif wrote:
> On 20/07/2020 08:41, Richard Purdie via lists.openembedded.org wrote:
> > On Fri, 2020-07-17 at 15:19 +0100, Usama Arif wrote:
> > > 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.
> > > 
> > > Signed-off-by: Usama Arif <usama.arif@arm.com>
> > > ---
> > >   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)?
> 
> 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.

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [OE-core] [PATCH] kernel-fitimage: build configuration for image tree when dtb is not present
  2020-07-27 10:56     ` Richard Purdie
@ 2020-07-28 10:19       ` Usama Arif
  2020-07-29 14:57         ` Usama Arif
  0 siblings, 1 reply; 6+ messages in thread
From: Usama Arif @ 2020-07-28 10:19 UTC (permalink / raw)
  To: Richard Purdie, openembedded-core; +Cc: nd



On 27/07/2020 11:56, Richard Purdie wrote:
> On Mon, 2020-07-20 at 18:21 +0100, Usama Arif wrote:
>> On 20/07/2020 08:41, Richard Purdie via lists.openembedded.org wrote:
>>> On Fri, 2020-07-17 at 15:19 +0100, Usama Arif wrote:
>>>> 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.
>>>>
>>>> Signed-off-by: Usama Arif <usama.arif@arm.com>
>>>> ---
>>>>    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)?
>>
>> 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.
> 
> 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
> 

Hi,

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

Regards,
Usama

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [OE-core] [PATCH] kernel-fitimage: build configuration for image tree when dtb is not present
  2020-07-28 10:19       ` Usama Arif
@ 2020-07-29 14:57         ` Usama Arif
  0 siblings, 0 replies; 6+ messages in thread
From: Usama Arif @ 2020-07-29 14:57 UTC (permalink / raw)
  To: Richard Purdie, openembedded-core; +Cc: nd



On 28/07/2020 11:19, Usama Arif wrote:
> 
> 
> On 27/07/2020 11:56, Richard Purdie wrote:
>> On Mon, 2020-07-20 at 18:21 +0100, Usama Arif wrote:
>>> On 20/07/2020 08:41, Richard Purdie via lists.openembedded.org wrote:
>>>> On Fri, 2020-07-17 at 15:19 +0100, Usama Arif wrote:
>>>>> 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.
>>>>>
>>>>> Signed-off-by: Usama Arif <usama.arif@arm.com>
>>>>> ---
>>>>>    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)?
>>>
>>> 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.
>>
>> 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
>>
> 
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-07-29 14:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-17 14:19 [PATCH] kernel-fitimage: build configuration for image tree when dtb is not present Usama Arif
2020-07-20  7:41 ` [OE-core] " Richard Purdie
2020-07-20 17:21   ` Usama Arif
2020-07-27 10:56     ` Richard Purdie
2020-07-28 10:19       ` Usama Arif
2020-07-29 14:57         ` Usama Arif

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.