mirror of
https://github.com/opentx/opentx.git
synced 2025-07-14 11:59:50 +03:00
Firmware compilation fixes
This commit is contained in:
parent
eb58e58f23
commit
ec1ebe4a0b
1 changed files with 12 additions and 21 deletions
|
@ -5,7 +5,6 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
import shutil
|
import shutil
|
||||||
import filelock
|
|
||||||
|
|
||||||
from fwoptions import *
|
from fwoptions import *
|
||||||
|
|
||||||
|
@ -56,7 +55,7 @@ def build_target(target, path, cmake_options):
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
if len(sys.argv) != 3:
|
if len(sys.argv) != 3:
|
||||||
exit(INVALID_FIRMWARE)
|
return INVALID_FIRMWARE
|
||||||
|
|
||||||
target = sys.argv[1]
|
target = sys.argv[1]
|
||||||
directory, filename = os.path.split(sys.argv[2])
|
directory, filename = os.path.split(sys.argv[2])
|
||||||
|
@ -64,7 +63,7 @@ def main():
|
||||||
options = root.split("-")
|
options = root.split("-")
|
||||||
|
|
||||||
if len(options) < 2 or options[0] != "opentx":
|
if len(options) < 2 or options[0] != "opentx":
|
||||||
exit(INVALID_FIRMWARE)
|
return INVALID_FIRMWARE
|
||||||
|
|
||||||
optcount = 1
|
optcount = 1
|
||||||
cmake_options = {}
|
cmake_options = {}
|
||||||
|
@ -155,7 +154,7 @@ def main():
|
||||||
firmware_options = options_jumper_t16
|
firmware_options = options_jumper_t16
|
||||||
maxsize = 2 * 1024 * 1024
|
maxsize = 2 * 1024 * 1024
|
||||||
else:
|
else:
|
||||||
exit(INVALID_BOARD)
|
return INVALID_BOARD
|
||||||
|
|
||||||
if target == "firmware":
|
if target == "firmware":
|
||||||
binary = "firmware.bin"
|
binary = "firmware.bin"
|
||||||
|
@ -166,7 +165,7 @@ def main():
|
||||||
ext = ".so"
|
ext = ".so"
|
||||||
filename = "libopentx"
|
filename = "libopentx"
|
||||||
else:
|
else:
|
||||||
exit(INVALID_BOARD)
|
return INVALID_BOARD
|
||||||
|
|
||||||
filename += "-" + board_name
|
filename += "-" + board_name
|
||||||
optcount += 1
|
optcount += 1
|
||||||
|
@ -198,7 +197,7 @@ def main():
|
||||||
if key == options[-1]:
|
if key == options[-1]:
|
||||||
language = key
|
language = key
|
||||||
if not language:
|
if not language:
|
||||||
exit(INVALID_LANGUAGE)
|
return INVALID_LANGUAGE
|
||||||
cmake_options["TRANSLATIONS"] = language.upper()
|
cmake_options["TRANSLATIONS"] = language.upper()
|
||||||
|
|
||||||
filename += "-" + language + ext
|
filename += "-" + language + ext
|
||||||
|
@ -207,24 +206,16 @@ def main():
|
||||||
|
|
||||||
if os.path.isfile(errpath):
|
if os.path.isfile(errpath):
|
||||||
print(filename)
|
print(filename)
|
||||||
exit(COMPILATION_ERROR)
|
return COMPILATION_ERROR
|
||||||
|
|
||||||
if os.path.isfile(path):
|
if os.path.isfile(path):
|
||||||
print(filename)
|
print(filename)
|
||||||
exit(0)
|
return 0
|
||||||
|
|
||||||
lockpath = path + ".lock"
|
result = build_target(target, path, cmake_options)
|
||||||
lock = filelock.FileLock(lockpath)
|
if result != 0:
|
||||||
try:
|
|
||||||
with lock.acquire(timeout=60 * 60):
|
|
||||||
if not os.path.isfile(path):
|
|
||||||
result = build_target(target, path, cmake_options)
|
|
||||||
if result != 0:
|
|
||||||
print(filename)
|
|
||||||
return result
|
|
||||||
except filelock.Timeout:
|
|
||||||
print(filename)
|
print(filename)
|
||||||
exit(COMPILATION_ERROR)
|
return result
|
||||||
|
|
||||||
if target == "firmware":
|
if target == "firmware":
|
||||||
# Check binary size
|
# Check binary size
|
||||||
|
@ -236,8 +227,8 @@ def main():
|
||||||
shutil.move(binary, path)
|
shutil.move(binary, path)
|
||||||
|
|
||||||
print(filename)
|
print(filename)
|
||||||
exit(0)
|
return 0
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
exit(main())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue