1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-25 17:25:13 +03:00

build-firmware updates

This commit is contained in:
Bertrand Songis 2019-08-21 17:56:45 +02:00
parent 036eb953f0
commit f7163806f6
No known key found for this signature in database
GPG key ID: F189F79290FEC50F
2 changed files with 168 additions and 174 deletions

View file

@ -23,3 +23,5 @@ ENV PATH $PATH:/opt/gcc-arm-none-eabi/bin:/opentx/code/radio/util
ARG OPENTX_VERSION_SUFFIX=
ENV OPENTX_VERSION_SUFFIX ${OPENTX_VERSION_SUFFIX}
WORKDIR /build

View file

@ -16,11 +16,6 @@ INVALID_FIRMWARE = 5
INVALID_BOARD = 6
INVALID_LANGUAGE = 7
# Board types
BOARD_SKY9X = 2
BOARD_TARANIS = 3
BOARD_HORUS = 4
def build_target(target, path, cmake_options):
srcdir = os.path.dirname(os.path.realpath(__file__)) + "/../.."
@ -56,15 +51,10 @@ def build_target(target, path, cmake_options):
open(errpath, "w").write(output.decode("utf-8") + error.decode("utf-8"))
return COMPILATION_ERROR
if target == "firmware":
# Check binary size
size = os.stat(target).st_size
if size > maxsize:
return FIRMWARE_SIZE_TOO_BIG
return 0
# Copy binary to the binaries directory
shutil.move(target, path)
def main():
if len(sys.argv) != 3:
exit(INVALID_FIRMWARE)
@ -78,108 +68,94 @@ if len(options) < 2 or options[0] != "opentx":
optcount = 1
cmake_options = {}
board_name = options[optcount]
if options[optcount] == "sky9x":
if board_name == "sky9x":
cmake_options["PCB"] = "SKY9X"
firmware_options = options_sky9x
maxsize = 65536 * 4
board = BOARD_SKY9X
elif options[optcount] == "9xrpro":
elif board_name == "9xrpro":
cmake_options["PCB"] = "9XRPRO"
cmake_options["SDCARD"] = "YES"
firmware_options = options_sky9x
maxsize = 65536 * 4
board = BOARD_SKY9X
elif options[optcount] == "ar9x":
elif board_name == "ar9x":
cmake_options["PCB"] = "AR9X"
cmake_options["SDCARD"] = "YES"
firmware_options = options_ar9x
maxsize = 65536 * 4
board = BOARD_SKY9X
elif options[optcount] == "x9lite":
elif board_name == "x9lite":
cmake_options["PCB"] = "X9LITE"
cmake_options["MULTI_SPORT"] = "ON"
firmware_options = options_taranis_x9lite
maxsize = 65536 * 8
board = BOARD_TARANIS
elif options[optcount] == "x7":
elif board_name == "x7":
cmake_options["PCB"] = "X7"
cmake_options["MULTI_SPORT"] = "ON"
firmware_options = options_taranis_x9dp
maxsize = 65536 * 8
board = BOARD_TARANIS
elif options[optcount] == "xlite":
elif board_name == "xlite":
cmake_options["PCB"] = "XLITE"
cmake_options["MULTI_SPORT"] = "ON"
firmware_options = options_taranis_xlite
maxsize = 65536 * 8
board = BOARD_TARANIS
elif options[optcount] == "xlites":
elif board_name == "xlites":
cmake_options["PCB"] = "XLITES"
cmake_options["MULTI_SPORT"] = "ON"
firmware_options = options_taranis_xlites
maxsize = 65536 * 8
board = BOARD_TARANIS
elif options[optcount] == "x9d":
elif board_name == "x9d":
cmake_options["PCB"] = "X9D"
cmake_options["MULTI_SPORT"] = "ON"
firmware_options = options_taranis_x9d
maxsize = 65536 * 8
board = BOARD_TARANIS
elif options[optcount] == "x9d+":
elif board_name == "x9d+":
cmake_options["PCB"] = "X9D+"
cmake_options["MULTI_SPORT"] = "ON"
firmware_options = options_taranis_x9dp
maxsize = 65536 * 8
board = BOARD_TARANIS
elif options[optcount] == "x9d+2019":
elif board_name == "x9d+2019":
cmake_options["PCB"] = "X9D+"
cmake_options["PCBREV"] = "2019"
cmake_options["MULTI_SPORT"] = "ON"
firmware_options = options_taranis_x9dp
maxsize = 65536 * 8
board = BOARD_TARANIS
elif options[optcount] == "x9e":
elif board_name == "x9e":
cmake_options["PCB"] = "X9E"
cmake_options["MULTI_SPORT"] = "ON"
firmware_options = options_taranis_x9e
maxsize = 65536 * 8
board = BOARD_TARANIS
elif options[optcount] == "x10":
elif board_name == "x10":
cmake_options["PCB"] = "X10"
cmake_options["MULTI_SPORT"] = "ON"
firmware_options = options_horus_x10
maxsize = 2 * 1024 * 1024
board = BOARD_HORUS
elif options[optcount] == "x12s":
elif board_name == "x12s":
cmake_options["PCB"] = "X12S"
cmake_options["MULTI_SPORT"] = "ON"
firmware_options = options_horus_x12s
maxsize = 2 * 1024 * 1024
board = BOARD_HORUS
elif options[optcount] == "t12":
elif board_name == "t12":
cmake_options["PCB"] = "X7"
cmake_options["PCBREV"] = "T12"
cmake_options["MULTI_SPORT"] = "ON"
firmware_options = options_taranis_x9dp
maxsize = 65536 * 8
board = BOARD_TARANIS
else:
exit(INVALID_BOARD)
if target == "firmware":
binary = "firmware.bin"
ext = ".bin"
target = "firmware" + ext
filename = "opentx"
elif target == "libsimulator":
binary = "libopentx-" + board_name + "-simulator.so"
ext = ".so"
target = "libopentx-" + options[optcount] + "-simulator.so"
filename = "libopentx"
else:
exit(INVALID_BOARD)
filename += "-" + options[optcount]
filename += "-" + board_name
optcount += 1
# The firmware options
@ -229,10 +205,26 @@ lock = filelock.FileLock(lockpath)
try:
with lock.acquire(timeout=60 * 60):
if not os.path.isfile(path):
build_target(target, path)
result = build_target(target, path, cmake_options)
if result != 0:
print(filename)
return result
except filelock.Timeout:
print(filename)
exit(COMPILATION_ERROR)
if target == "firmware":
# Check binary size
size = os.stat(binary).st_size
if size > maxsize:
return FIRMWARE_SIZE_TOO_BIG
# Copy binary to the binaries directory
shutil.move(binary, path)
print(filename)
exit(0)
if __name__ == "__main__":
main()