diff mbox series

[07/14] kernel-fitimage: fix external dtb check

Message ID 20240704071013.2982700-8-adrian.freihofer@gmail.com
State New
Headers show
Series Use the kernel from sstate when building fitImages | expand

Commit Message

Adrian Freihofer July 4, 2024, 7:09 a.m. UTC
From: Adrian Freihofer <adrian.freihofer@siemens.com>

If EXTERNAL_KERNEL_DEVICETREE and dtb_image_sect are empty variables
dtb_path ends up as "/" which is available on most Unix systems but
probably not the dtb_path which is needed here. Checking for a file
makes more sense and also solves the issue with the "/".

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
---
 meta/classes-recipe/kernel-fitimage.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mark Hatle July 9, 2024, 7:48 p.m. UTC | #1
On 7/4/24 2:09 AM, Adrian Freihofer wrote:
> From: Adrian Freihofer <adrian.freihofer@siemens.com>
> 
> If EXTERNAL_KERNEL_DEVICETREE and dtb_image_sect are empty variables
> dtb_path ends up as "/" which is available on most Unix systems but
> probably not the dtb_path which is needed here. Checking for a file
> makes more sense and also solves the issue with the "/".
> 
> Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
> ---
>   meta/classes-recipe/kernel-fitimage.bbclass | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meta/classes-recipe/kernel-fitimage.bbclass b/meta/classes-recipe/kernel-fitimage.bbclass
> index 6e6898e5f6f..664ebc65d7c 100644
> --- a/meta/classes-recipe/kernel-fitimage.bbclass
> +++ b/meta/classes-recipe/kernel-fitimage.bbclass
> @@ -429,7 +429,7 @@ fitimage_emit_section_config() {
>   	fi
>   
>   	dtb_path="${EXTERNAL_KERNEL_DEVICETREE}/${dtb_image_sect}"
> -	if [ -e "$dtb_path" ]; then
> +	if [ -f "$dtb_path" ]; then
>   		compat=$(fdtget -t s "$dtb_path" / compatible | sed 's/ /", "/g')
>   		if [ -n "$compat" ]; then
>   			compatible_line="compatible = \"$compat\";"

I can understand avoiding directories with this, but I've definitely seen cases 
where the dtb_path is pointing to a symbolic link.

Would [ -f "$dtb_path" -o -L "$dtb_path" ]; (or similar) solve this?

--Mark

> 
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#201511): https://lists.openembedded.org/g/openembedded-core/message/201511
> Mute This Topic: https://lists.openembedded.org/mt/107033892/3616948
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [mark.hatle@kernel.crashing.org]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Adrian Freihofer July 10, 2024, 2:02 p.m. UTC | #2
On Tue, 2024-07-09 at 14:48 -0500, Mark Hatle wrote:
> 
> 
> On 7/4/24 2:09 AM, Adrian Freihofer wrote:
> > From: Adrian Freihofer <adrian.freihofer@siemens.com>
> > 
> > If EXTERNAL_KERNEL_DEVICETREE and dtb_image_sect are empty
> > variables
> > dtb_path ends up as "/" which is available on most Unix systems but
> > probably not the dtb_path which is needed here. Checking for a file
> > makes more sense and also solves the issue with the "/".
> > 
> > Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
> > ---
> >   meta/classes-recipe/kernel-fitimage.bbclass | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/meta/classes-recipe/kernel-fitimage.bbclass
> > b/meta/classes-recipe/kernel-fitimage.bbclass
> > index 6e6898e5f6f..664ebc65d7c 100644
> > --- a/meta/classes-recipe/kernel-fitimage.bbclass
> > +++ b/meta/classes-recipe/kernel-fitimage.bbclass
> > @@ -429,7 +429,7 @@ fitimage_emit_section_config() {
> >   	fi
> >   
> >   	dtb_path="${EXTERNAL_KERNEL_DEVICETREE}/${dtb_image_sect}"
> > -	if [ -e "$dtb_path" ]; then
> > +	if [ -f "$dtb_path" ]; then
> >   		compat=$(fdtget -t s "$dtb_path" / compatible |
> > sed 's/ /", "/g')
> >   		if [ -n "$compat" ]; then
> >   			compatible_line="compatible =
> > \"$compat\";"
> 
> I can understand avoiding directories with this, but I've definitely
> seen cases 
> where the dtb_path is pointing to a symbolic link.
> 
> Would [ -f "$dtb_path" -o -L "$dtb_path" ]; (or similar) solve this?

Thank you for the re-view. I will fix this with v2.
Adrian

> 
> --Mark
> 
> > 
> > 
> > 
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#201511):
> > https://lists.openembedded.org/g/openembedded-core/message/201511
> > Mute This Topic:
> > https://lists.openembedded.org/mt/107033892/3616948
> > Group Owner: openembedded-core+owner@lists.openembedded.org
> > Unsubscribe:
> > https://lists.openembedded.org/g/openembedded-core/unsub [
> > mark.hatle@kernel.crashing.org]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
diff mbox series

Patch

diff --git a/meta/classes-recipe/kernel-fitimage.bbclass b/meta/classes-recipe/kernel-fitimage.bbclass
index 6e6898e5f6f..664ebc65d7c 100644
--- a/meta/classes-recipe/kernel-fitimage.bbclass
+++ b/meta/classes-recipe/kernel-fitimage.bbclass
@@ -429,7 +429,7 @@  fitimage_emit_section_config() {
 	fi
 
 	dtb_path="${EXTERNAL_KERNEL_DEVICETREE}/${dtb_image_sect}"
-	if [ -e "$dtb_path" ]; then
+	if [ -f "$dtb_path" ]; then
 		compat=$(fdtget -t s "$dtb_path" / compatible | sed 's/ /", "/g')
 		if [ -n "$compat" ]; then
 			compatible_line="compatible = \"$compat\";"