summaryrefslogtreecommitdiff
path: root/arch/arm/mach-rockchip/make_fit_atf.py
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-rockchip/make_fit_atf.py')
-rwxr-xr-xarch/arm/mach-rockchip/make_fit_atf.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/arch/arm/mach-rockchip/make_fit_atf.py b/arch/arm/mach-rockchip/make_fit_atf.py
index 212bd0a854..45ec105887 100755
--- a/arch/arm/mach-rockchip/make_fit_atf.py
+++ b/arch/arm/mach-rockchip/make_fit_atf.py
@@ -12,6 +12,7 @@
import os
import sys
import getopt
+import logging
# pip install pyelftools
from elftools.elf.elffile import ELFFile
@@ -89,13 +90,17 @@ def append_conf_section(file, cnt, dtname, segments):
file.write('\t\tconfig_%d {\n' % cnt)
file.write('\t\t\tdescription = "%s";\n' % dtname)
file.write('\t\t\tfirmware = "atf_1";\n')
- file.write('\t\t\tloadables = "uboot",')
+ file.write('\t\t\tloadables = "uboot"')
+ if segments != 0:
+ file.write(',')
for i in range(1, segments):
file.write('"atf_%d"' % (i))
if i != (segments - 1):
file.write(',')
else:
file.write(';\n')
+ if segments == 0:
+ file.write(';\n')
file.write('\t\t\tfdt = "fdt_1";\n')
file.write('\t\t};\n')
file.write('\n')
@@ -171,8 +176,18 @@ def generate_atf_binary(bl31_file_name):
def main():
uboot_elf = "./u-boot"
- bl31_elf = "./bl31.elf"
fit_its = sys.stdout
+ if "BL31" in os.environ:
+ bl31_elf=os.getenv("BL31");
+ elif os.path.isfile("./bl31.elf"):
+ bl31_elf = "./bl31.elf"
+ else:
+ os.system("echo 'int main(){}' > bl31.c")
+ os.system("${CROSS_COMPILE}gcc -c bl31.c -o bl31.elf")
+ bl31_elf = "./bl31.elf"
+ logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG)
+ logging.warning(' BL31 file bl31.elf NOT found, resulting binary is non-functional')
+ logging.warning(' Please read Building section in doc/README.rockchip')
opts, args = getopt.getopt(sys.argv[1:], "o:u:b:h")
for opt, val in opts: