Skip to contentSkip to conversation

rockchip: make_fit_atf: Use BL31 environ variable for file location

PATCH In review Emmanuel Vadot 7 participants 12 messages Feb 5, 2019 – Apr 28, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rockchip: make_fit_atf: Use BL31 environ variable for file location

Other make_fit script (like imx or sunxi) use the BL31 environment variable to indicate the location of the file.
Also do that for rockchip so we don't need to copy the file in the source directory.

---
 arch/arm/mach-rockchip/make_fit_atf.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rockchip/make_fit_atf.py +1 -1
index d1faff1957..7bf58e3dd1 100755
@@ -194,7 +194,7 @@ def get_bl31_segments_info(bl31_file_name):
 
 def main():
     uboot_elf="./u-boot"
-    bl31_elf="./bl31.elf"
+    bl31_elf=os.getenv("BL31", "./bl31.elf")
     FIT_ITS=sys.stdout
 
     opts, args = getopt.getopt(sys.argv[1:], "o:u:b:h")
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 rockchip: make_fit_atf: Use BL31 environ variable for file location

Quoted 22 lines · Emmanuel Vadot

Other make_fit script (like imx or sunxi) use the BL31 environment variable to indicate the location of the file.
Also do that for rockchip so we don't need to copy the file in the source directory.

---
arch/arm/mach-rockchip/make_fit_atf.py | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rockchip/make_fit_atf.py +0 -0
index d1faff1957..7bf58e3dd1 100755
@@ -194,7 +194,7 @@ def get_bl31_segments_info(bl31_file_name):
 

def main():

    uboot_elf="./u-boot"

arch/arm/mach-rockchip/make_fit_atf.py

Quoted 2 lines
arch/arm/mach-rockchip/make_fit_atf.py +1 -1
-    bl31_elf="./bl31.elf"
+    bl31_elf=os.getenv("BL31", "./bl31.elf”)

Could we have something more specific than BL31 (e.g. UBOOT_BL31_PATH)? Or is this the same variable name that’s used for imx and sunxi?

Quoted 6 lines
    FIT_ITS=sys.stdout

    opts, args = getopt.getopt(sys.argv[1:], "o:u:b:h")
Signature · 1 line
2.20.1
#2 lore raw

PATCH 1/1 rockchip: make_fit_atf: Use BL31 environ variable for file location

Quoted 20 lines · On Tue, 5 Feb 2019 12:05:57 +0100 Philipp Tomsich…
Quoted 20 lines · Emmanuel Vadot

Other make_fit script (like imx or sunxi) use the BL31 environment variable to indicate the location of the file.
Also do that for rockchip so we don't need to copy the file in the source directory.

---
arch/arm/mach-rockchip/make_fit_atf.py | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rockchip/make_fit_atf.py +0 -0
index d1faff1957..7bf58e3dd1 100755
@@ -194,7 +194,7 @@ def get_bl31_segments_info(bl31_file_name):
 
Quoted 7 lines

arch/arm/mach-rockchip/make_fit_atf.py

Quoted 4 lines

def main():

    uboot_elf="./u-boot"
arch/arm/mach-rockchip/make_fit_atf.py +1 -1
-    bl31_elf="./bl31.elf"
+    bl31_elf=os.getenv("BL31", "./bl31.elf?)

Could we have something more specific than BL31 (e.g. UBOOT_BL31_PATH)? Or is this the same variable name that?s used for imx and sunxi?

The same variable name is used for imx and sunxi.

Quoted 6 lines
Quoted 6 lines
    FIT_ITS=sys.stdout

    opts, args = getopt.getopt(sys.argv[1:], "o:u:b:h")
Signature · 1 line
2.20.1
Signature · 1 line
Emmanuel Vadot <[email protected]> <[email protected]>
#3 lore raw

PATCH 1/1 rockchip: make_fit_atf: Use BL31 environ variable for file location

Quoted 9 lines · Emmanuel Vadot
Quoted 2 lines · On Tue, 5 Feb 2019 12:05:57 +0100 Philipp Tomsich…
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines · Emmanuel Vadot

Other make_fit script (like imx or sunxi) use the BL31 environment variable to indicate the location of the file.
Also do that for rockchip so we don't need to copy the file in the source directory.

#4 lore raw

PATCH 1/1 rockchip: make_fit_atf: Use BL31 environ variable for file location

In reply to Emmanuel Vadot
Quoted 34 lines

Date: Tue, 5 Feb 2019 12:14:25 +0100
From: Emmanuel Vadot <[email protected]>

Quoted 20 lines · On Tue, 5 Feb 2019 12:05:57 +0100 Philipp Tomsich…
Quoted 20 lines · Emmanuel Vadot

Other make_fit script (like imx or sunxi) use the BL31 environment variable to indicate the location of the file.
Also do that for rockchip so we don't need to copy the file in the source directory.

---
arch/arm/mach-rockchip/make_fit_atf.py | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rockchip/make_fit_atf.py +0 -0
index d1faff1957..7bf58e3dd1 100755
@@ -194,7 +194,7 @@ def get_bl31_segments_info(bl31_file_name):
 
Quoted 7 lines

arch/arm/mach-rockchip/make_fit_atf.py

Quoted 4 lines

def main():

    uboot_elf="./u-boot"
arch/arm/mach-rockchip/make_fit_atf.py +1 -1
-    bl31_elf="./bl31.elf"
+    bl31_elf=os.getenv("BL31", "./bl31.elf?)

Could we have something more specific than BL31 (e.g. UBOOT_BL31_PATH)? Or is this the same variable name that?s used for imx and sunxi?

Quoted 1 line

The same variable name is used for imx and sunxi.

Right. This would make building RK3399 firmware in the OpenBSD ports tree much easier/cleaner.

Reviewed-by on v1 1/1
#5 lore raw
In reply to Emmanuel Vadot
Quoted 11 lines

Other make_fit script (like imx or sunxi) use the BL31 environment variable to indicate the location of the file.
Also do that for rockchip so we don't need to copy the file in the source directory.

---
 arch/arm/mach-rockchip/make_fit_atf.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#6 lore raw

PATCH 1/1 rockchip: make_fit_atf: Use BL31 environ variable for file location

In reply to Emmanuel Vadot
Quoted 16 lines · Emmanuel Vadot

Other make_fit script (like imx or sunxi) use the BL31 environment variable to indicate the location of the file.
Also do that for rockchip so we don't need to copy the file in the source directory.

---
 arch/arm/mach-rockchip/make_fit_atf.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rockchip/make_fit_atf.py +0 -0
index d1faff1957..7bf58e3dd1 100755

arch/arm/mach-rockchip/make_fit_atf.py def get_bl31_segments_info(bl31_file_name): · line 197

Quoted 5 lines
arch/arm/mach-rockchip/make_fit_atf.py +1 -1
@@ -194,7 +194,7 @@ def get_bl31_segments_info(bl31_file_name):
 
 def main():
     uboot_elf="./u-boot"
-    bl31_elf="./bl31.elf"
+    bl31_elf=os.getenv("BL31", "./bl31.elf")

Have similar change on my repo.

Better through warning for non BL31 like

if "BL31ELF" in os.environ:

       bl31_elf=os.getenv("BL31ELF");

else:
sys.exit("ERROR: Please export BL31ELF file, check
board/rockchip/evb_rk3399/README)

And BL31ELF would be proper env than BL31 since rockchip build would require elf and other one has bin, IMHO.

#7 lore raw

PATCH 1/1 rockchip: make_fit_atf: Use BL31 environ variable for file location

Hi Philipp, Emmanuel,

Quoted 28 lines · Jagan Teki
Quoted 16 lines · Emmanuel Vadot

Other make_fit script (like imx or sunxi) use the BL31 environment variable to indicate the location of the file.
Also do that for rockchip so we don't need to copy the file in the source directory.

---
 arch/arm/mach-rockchip/make_fit_atf.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rockchip/make_fit_atf.py +0 -0
index d1faff1957..7bf58e3dd1 100755

arch/arm/mach-rockchip/make_fit_atf.py def get_bl31_segments_info(bl31_file_name): · line 197

Quoted 5 lines
arch/arm/mach-rockchip/make_fit_atf.py +1 -1
@@ -194,7 +194,7 @@ def get_bl31_segments_info(bl31_file_name):
 
 def main():
     uboot_elf="./u-boot"
-    bl31_elf="./bl31.elf"
+    bl31_elf=os.getenv("BL31", "./bl31.elf")

Have similar change on my repo.

Better through warning for non BL31 like

Quoted 8 lines

if "BL31ELF" in os.environ:

       bl31_elf=os.getenv("BL31ELF");

else:
sys.exit("ERROR: Please export BL31ELF file, check
board/rockchip/evb_rk3399/README)

And BL31ELF would be proper env than BL31 since rockchip build would require elf and other one has bin, IMHO.

I think solution suggested by Jagan's is more generic and more useful. It doesn't hard code the path of bl31.elf file, instead it uses global BL31 environment variable.
If the path is hard coded then buildroot build fails for atleast rk3399 soc based boards because
in buildroot it is [2] BL31=$(BINARIES_DIR)/bl31.elf, so it looks for bl31.elf file in binary directory
instead of uboot directory.

We encountered this build failure in recently while adding [1] RK3399 NanoPi M4 support in buildroot.

Could we consider solution suggested by Jagan while we can retain the variable name BL31 as is.

[1] Buildroot thread
http://lists.busybox.net/pipermail/buildroot/2019-April/248219.html
[2] BL31 buildroot variable
https://git.buildroot.net/buildroot/tree/boot/uboot/uboot.mk#n140

Thanks a lot,
Shyam

#8 lore raw

PATCH 1/1 rockchip: make_fit_atf: Use BL31 environ variable for file location

Quoted 38 lines · Shyam Saini

Hi Philipp, Emmanuel,

Quoted 34 lines · Jagan Teki
Quoted 16 lines · Emmanuel Vadot

Other make_fit script (like imx or sunxi) use the BL31 environment variable to indicate the location of the file.
Also do that for rockchip so we don't need to copy the file in the source directory.

---
 arch/arm/mach-rockchip/make_fit_atf.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rockchip/make_fit_atf.py +0 -0
index d1faff1957..7bf58e3dd1 100755

arch/arm/mach-rockchip/make_fit_atf.py def get_bl31_segments_info(bl31_file_name): · line 197

Quoted 5 lines
arch/arm/mach-rockchip/make_fit_atf.py +1 -1
@@ -194,7 +194,7 @@ def get_bl31_segments_info(bl31_file_name):
 
 def main():
     uboot_elf="./u-boot"
-    bl31_elf="./bl31.elf"
+    bl31_elf=os.getenv("BL31", "./bl31.elf")

Have similar change on my repo.

Better through warning for non BL31 like

if "BL31ELF" in os.environ:

       bl31_elf=os.getenv("BL31ELF");

else:
sys.exit("ERROR: Please export BL31ELF file, check
board/rockchip/evb_rk3399/README)

Quoted 6 lines
Quoted 2 lines

And BL31ELF would be proper env than BL31 since rockchip build would require elf and other one has bin, IMHO.

I think solution suggested by Jagan's is more generic and more useful. It doesn't hard code the path of bl31.elf file, instead it uses global BL31 environment variable.

In the AllWinner and current rk3399 devices where we use bl31 it looks either in the root source of the root of the build output if that's specified as part of the build process. That to me would be a minimum as distros often build for numerous devices at once.

Quoted 25 lines

If the path is hard coded then buildroot build fails for atleast rk3399 soc based boards because
in buildroot it is [2] BL31=$(BINARIES_DIR)/bl31.elf, so it looks for bl31.elf file in binary directory
instead of uboot directory.

We encountered this build failure in recently while adding [1] RK3399 NanoPi M4 support in buildroot.

Could we consider solution suggested by Jagan while we can retain the variable name BL31 as is.

[1] Buildroot thread
http://lists.busybox.net/pipermail/buildroot/2019-April/248219.html
[2] BL31 buildroot variable
https://git.buildroot.net/buildroot/tree/boot/uboot/uboot.mk#n140

Thanks a lot,
Shyam
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#9 lore raw

PATCH 1/1 rockchip: make_fit_atf: Use BL31 environ variable for file location

In reply to Jagan Teki

Hi Jagan,

Quoted 25 lines · On Sun, 21 Apr 2019 22:42:45 +0530 Jagan Teki <[email protected]>…
Quoted 16 lines · Emmanuel Vadot

Other make_fit script (like imx or sunxi) use the BL31 environment variable to indicate the location of the file.
Also do that for rockchip so we don't need to copy the file in the source directory.

---
 arch/arm/mach-rockchip/make_fit_atf.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rockchip/make_fit_atf.py +0 -0
index d1faff1957..7bf58e3dd1 100755

arch/arm/mach-rockchip/make_fit_atf.py def get_bl31_segments_info(bl31_file_name): · line 197

Quoted 5 lines
arch/arm/mach-rockchip/make_fit_atf.py +1 -1
@@ -194,7 +194,7 @@ def get_bl31_segments_info(bl31_file_name):
 
 def main():
     uboot_elf="./u-boot"
-    bl31_elf="./bl31.elf"
+    bl31_elf=os.getenv("BL31", "./bl31.elf")

Have similar change on my repo.

Quoted 7 lines

Better through warning for non BL31 like

if "BL31ELF" in os.environ:

       bl31_elf=os.getenv("BL31ELF");

else:
sys.exit("ERROR: Please export BL31ELF file, check
board/rockchip/evb_rk3399/README)

I didn't error for the same reason we don't on Allwinner, CI don't
copy this file as part of the test. Yes this does result in a non-working u-boot but the goal of thoses test is just to compile.
mksunxi_fit_atf.sh prints a warning, maybe I should just do the same ? Phillipp, what's your view on this ?

Quoted 2 lines

And BL31ELF would be proper env than BL31 since rockchip build would require elf and other one has bin, IMHO.

This change is fine with me.

Signature · 1 line
Emmanuel Vadot <[email protected]> <[email protected]>
#10 lore raw

PATCH 1/1 rockchip: make_fit_atf: Use BL31 environ variable for file location

Quoted 40 lines · Emmanuel Vadot

Hi Jagan,

Quoted 25 lines · On Sun, 21 Apr 2019 22:42:45 +0530 Jagan Teki <[email protected]>…
Quoted 16 lines · Emmanuel Vadot

Other make_fit script (like imx or sunxi) use the BL31 environment variable to indicate the location of the file.
Also do that for rockchip so we don't need to copy the file in the source directory.

---
 arch/arm/mach-rockchip/make_fit_atf.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rockchip/make_fit_atf.py +0 -0
index d1faff1957..7bf58e3dd1 100755

arch/arm/mach-rockchip/make_fit_atf.py def get_bl31_segments_info(bl31_file_name): · line 197

Quoted 5 lines
arch/arm/mach-rockchip/make_fit_atf.py +1 -1
@@ -194,7 +194,7 @@ def get_bl31_segments_info(bl31_file_name):
 
 def main():
     uboot_elf="./u-boot"
-    bl31_elf="./bl31.elf"
+    bl31_elf=os.getenv("BL31", "./bl31.elf")

Have similar change on my repo.

Quoted 7 lines

Better through warning for non BL31 like

if "BL31ELF" in os.environ:

       bl31_elf=os.getenv("BL31ELF");

else:
sys.exit("ERROR: Please export BL31ELF file, check
board/rockchip/evb_rk3399/README)

Quoted 5 lines

I didn't error for the same reason we don't on Allwinner, CI don't
copy this file as part of the test. Yes this does result in a non-working u-boot but the goal of thoses test is just to compile.
mksunxi_fit_atf.sh prints a warning, maybe I should just do the same ? Phillipp, what's your view on this ?

Yes, ie what I thought of. I have handle this in BINMAN series, please have look and comment.

Quoted 5 lines
Quoted 3 lines

And BL31ELF would be proper env than BL31 since rockchip build would require elf and other one has bin, IMHO.

This change is fine with me.

I think we can go with BL31 itself since we need to compatible with existing platforms.

Jagan.

#11 lore raw

PATCH 1/1 rockchip: make_fit_atf: Use BL31 environ variable for file location

Quoted 54 lines

From: Jagan Teki <[email protected]>
Date: Sun, 28 Apr 2019 14:38:06 +0530

Quoted 40 lines · Emmanuel Vadot

Hi Jagan,

Quoted 25 lines · On Sun, 21 Apr 2019 22:42:45 +0530 Jagan Teki <[email protected]>…
Quoted 16 lines · Emmanuel Vadot

Other make_fit script (like imx or sunxi) use the BL31 environment variable to indicate the location of the file.
Also do that for rockchip so we don't need to copy the file in the source directory.

---
 arch/arm/mach-rockchip/make_fit_atf.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rockchip/make_fit_atf.py +0 -0
index d1faff1957..7bf58e3dd1 100755

arch/arm/mach-rockchip/make_fit_atf.py def get_bl31_segments_info(bl31_file_name): · line 197

Quoted 5 lines
arch/arm/mach-rockchip/make_fit_atf.py +1 -1
@@ -194,7 +194,7 @@ def get_bl31_segments_info(bl31_file_name):
 
 def main():
     uboot_elf="./u-boot"
-    bl31_elf="./bl31.elf"
+    bl31_elf=os.getenv("BL31", "./bl31.elf")

Have similar change on my repo.

Quoted 7 lines

Better through warning for non BL31 like

if "BL31ELF" in os.environ:

       bl31_elf=os.getenv("BL31ELF");

else:
sys.exit("ERROR: Please export BL31ELF file, check
board/rockchip/evb_rk3399/README)

Quoted 5 lines

I didn't error for the same reason we don't on Allwinner, CI don't
copy this file as part of the test. Yes this does result in a non-working u-boot but the goal of thoses test is just to compile.
mksunxi_fit_atf.sh prints a warning, maybe I should just do the same ? Phillipp, what's your view on this ?

Yes, ie what I thought of. I have handle this in BINMAN series, please have look and comment.

Quoted 1 line
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

And BL31ELF would be proper env than BL31 since rockchip build would require elf and other one has bin, IMHO.

This change is fine with me.

I think we can go with BL31 itself since we need to compatible with existing platforms.

Right. Consistency is good.