mirror of
https://github.com/LibreELEC/LibreELEC.tv
synced 2025-09-24 19:46:01 +07:00
421 lines
12 KiB
Python
Executable File
421 lines
12 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv)
|
|
|
|
import sys
|
|
|
|
# When adding new devices to the list please keep them in alphabetical order
|
|
# board-name should contain 'dashes' (-) not 'underscores' (_) and shouldn't contain capitals
|
|
# you can check the formating using an online tool such as https://codebeautify.org/python-formatter-beautifier
|
|
|
|
# 'project' : {
|
|
# 'device' : {
|
|
# 'board-name' : {
|
|
# 'dtb' : 'board-name.dtb',
|
|
# 'config' : 'board_name_defconfig'
|
|
# },
|
|
# },
|
|
# },
|
|
|
|
devices = \
|
|
{
|
|
'Allwinner': {
|
|
'A64': {
|
|
'orangepi-win': {
|
|
'dtb': 'sun50i-a64-orangepi-win.dtb',
|
|
'config': 'orangepi_win_defconfig',
|
|
'crust_config': 'orangepi_win_defconfig',
|
|
},
|
|
'pine64': {
|
|
'dtb': 'sun50i-a64-pine64.dtb',
|
|
'config': 'pine64_plus_defconfig',
|
|
'crust_config': 'pine64_plus_defconfig'
|
|
},
|
|
'pine64-lts': {
|
|
'dtb': 'sun50i-a64-pine64-lts.dtb',
|
|
'config': 'pine64-lts_defconfig',
|
|
'crust_config': 'pine64_plus_defconfig'
|
|
},
|
|
'pine64-plus': {
|
|
'dtb': 'sun50i-a64-pine64-plus.dtb',
|
|
'config': 'pine64_plus_defconfig',
|
|
'crust_config': 'pine64_plus_defconfig',
|
|
},
|
|
},
|
|
'H2-plus': {
|
|
'bananapi-m2-zero': {
|
|
'dtb': 'sun8i-h2-plus-bananapi-m2-zero.dtb',
|
|
'config': 'bananapi_m2_zero_defconfig'
|
|
},
|
|
},
|
|
'H3': {
|
|
'bananapi-m2p': {
|
|
'dtb': 'sun8i-h3-bananapi-m2-plus.dtb',
|
|
'config': 'bananapi_m2_plus_h3_defconfig'
|
|
},
|
|
'beelink-x2': {
|
|
'dtb': 'sun8i-h3-beelink-x2.dtb',
|
|
'config': 'beelink_x2_defconfig'
|
|
},
|
|
'libretech-h3': {
|
|
'dtb': 'sun8i-h3-libretech-all-h3-cc.dtb',
|
|
'config': 'libretech_all_h3_cc_h3_defconfig'
|
|
},
|
|
'nanopi-m1': {
|
|
'dtb': 'sun8i-h3-nanopi-m1.dtb',
|
|
'config': 'nanopi_m1_defconfig'
|
|
},
|
|
'orangepi-2': {
|
|
'dtb': 'sun8i-h3-orangepi-2.dtb',
|
|
'config': 'orangepi_2_defconfig',
|
|
'crust_config': 'orangepi_2_defconfig',
|
|
},
|
|
'orangepi-pc': {
|
|
'dtb': 'sun8i-h3-orangepi-pc.dtb',
|
|
'config': 'orangepi_pc_defconfig',
|
|
'crust_config': 'orangepi_pc_defconfig',
|
|
},
|
|
'orangepi-pc-plus': {
|
|
'dtb': 'sun8i-h3-orangepi-pc-plus.dtb',
|
|
'config': 'orangepi_pc_plus_defconfig',
|
|
'crust_config': 'orangepi_pc_plus_defconfig',
|
|
},
|
|
'orangepi-plus2e': {
|
|
'dtb': 'sun8i-h3-orangepi-plus2e.dtb',
|
|
'config': 'orangepi_plus2e_defconfig',
|
|
'crust_config': 'orangepi_plus2e_defconfig',
|
|
},
|
|
'orangepi-plus': {
|
|
'dtb': 'sun8i-h3-orangepi-plus.dtb',
|
|
'config': 'orangepi_plus_defconfig',
|
|
'crust_config': 'orangepi_plus_defconfig',
|
|
},
|
|
},
|
|
'H5' : {
|
|
'orangepi-pc2': {
|
|
'dtb': 'sun50i-h5-orangepi-pc2.dtb',
|
|
'config': 'orangepi_pc2_defconfig',
|
|
'crust_config': 'orangepi_pc2_defconfig',
|
|
},
|
|
'tritium-h5': {
|
|
'dtb': 'sun50i-h5-libretech-all-h3-cc.dtb',
|
|
'config': 'libretech_all_h3_cc_h5_defconfig'
|
|
},
|
|
},
|
|
'H6': {
|
|
'beelink-gs1' : {
|
|
'dtb' : 'sun50i-h6-beelink-gs1.dtb',
|
|
'config' : 'beelink_gs1_defconfig'
|
|
},
|
|
'orangepi-3': {
|
|
'dtb': 'sun50i-h6-orangepi-3.dtb',
|
|
'config': 'orangepi_3_defconfig',
|
|
'crust_config': 'orangepi_3_defconfig'
|
|
},
|
|
'orangepi-lite2': {
|
|
'dtb': 'sun50i-h6-orangepi-lite2.dtb',
|
|
'config': 'orangepi_lite2_defconfig',
|
|
'crust_config': 'orangepi_3_defconfig'
|
|
},
|
|
'orangepi-one-plus': {
|
|
'dtb': 'sun50i-h6-orangepi-one-plus.dtb',
|
|
'config': 'orangepi_one_plus_defconfig',
|
|
'crust_config': 'orangepi_3_defconfig'
|
|
},
|
|
'pine-h64': {
|
|
'dtb': 'sun50i-h6-pine-h64.dtb',
|
|
'config': 'pine_h64_defconfig',
|
|
'crust_config': 'pine_h64_defconfig',
|
|
},
|
|
'pine-h64-model-b': {
|
|
'dtb': 'sun50i-h6-pine-h64-model-b.dtb',
|
|
'config': 'pine_h64_defconfig',
|
|
'crust_config': 'pine_h64_defconfig'
|
|
},
|
|
'tanix-tx6' : {
|
|
'dtb' : 'sun50i-h6-tanix-tx6.dtb',
|
|
'config' : 'tanix_tx6_defconfig',
|
|
'crust_config' : 'tanix_tx6_defconfig'
|
|
},
|
|
},
|
|
'R40' : {
|
|
'bananapi-m2u' : {
|
|
'dtb' : 'sun8i-r40-bananapi-m2-ultra.dtb',
|
|
'config' : 'Bananapi_M2_Ultra_defconfig'
|
|
},
|
|
},
|
|
},
|
|
'Amlogic': {
|
|
'AMLGX': {
|
|
'box': {
|
|
'dtb': '',
|
|
'config': 'p212_defconfig'
|
|
},
|
|
'khadas-vim': {
|
|
'dtb': 'meson-gxl-s905x-khadas-vim.dtb',
|
|
'config': 'khadas-vim_defconfig'
|
|
},
|
|
'khadas-vim2': {
|
|
'dtb': 'meson-gxm-khadas-vim2.dtb',
|
|
'config': 'khadas-vim2_defconfig'
|
|
},
|
|
'khadas-vim3': {
|
|
'dtb': 'meson-g12b-a311d-khadas-vim3.dtb',
|
|
'config': 'khadas-vim3_defconfig'
|
|
},
|
|
'khadas-vim3l': {
|
|
'dtb': 'meson-sm1-khadas-vim3l.dtb',
|
|
'config': 'khadas-vim3l_defconfig'
|
|
},
|
|
'lafrite': {
|
|
'dtb': 'meson-gxl-s805x-libretech-ac.dtb',
|
|
'config': 'libretech-ac_defconfig'
|
|
},
|
|
'lepotato': {
|
|
'dtb': 'meson-gxl-s905x-libretech-cc.dtb',
|
|
'config': 'libretech-cc_defconfig'
|
|
},
|
|
'nanopi-k2': {
|
|
'dtb': 'meson-gxbb-nanopi-k2.dtb',
|
|
'config': 'nanopi-k2_defconfig'
|
|
},
|
|
'odroid-c2': {
|
|
'dtb': 'meson-gxbb-odroidc2.dtb',
|
|
'config': 'odroid-c2_defconfig'
|
|
},
|
|
'odroid-c4': {
|
|
'dtb': 'meson-sm1-odroid-c4.dtb',
|
|
'config': 'odroid-c4_defconfig'
|
|
},
|
|
'odroid-n2': {
|
|
'dtb': 'meson-g12b-odroid-n2.dtb',
|
|
'config': 'odroid-n2_defconfig'
|
|
},
|
|
},
|
|
},
|
|
'NXP': {
|
|
'iMX6': {
|
|
'cubox-dl': {
|
|
'dtb': 'imx6dl-cubox-i.dtb',
|
|
'config': 'mx6cuboxi_defconfig'
|
|
},
|
|
'cubox-q': {
|
|
'dtb': 'imx6q-cubox-i.dtb',
|
|
'config': 'mx6cuboxi_defconfig'
|
|
},
|
|
'udoo-dl': {
|
|
'dtb': 'imx6dl-udoo.dtb',
|
|
'config': 'udoo_defconfig'
|
|
},
|
|
'udoo-q': {
|
|
'dtb': 'imx6q-udoo.dtb',
|
|
'config': 'udoo_defconfig'
|
|
},
|
|
'wandboard-dl': {
|
|
'dtb': 'imx6dl-wandboard.dtb',
|
|
'config': 'wandboard_defconfig'
|
|
},
|
|
'wandboard-q': {
|
|
'dtb': 'imx6q-wandboard.dtb',
|
|
'config': 'wandboard_defconfig'
|
|
},
|
|
},
|
|
},
|
|
'Qualcomm': {
|
|
'Dragonboard': {
|
|
'410c': {
|
|
'dtb': 'apq8016-sbc.dtb',
|
|
'config': 'dragonboard410c_defconfig'
|
|
},
|
|
},
|
|
},
|
|
'Rockchip': {
|
|
'RK3288': {
|
|
'miqi': {
|
|
'dtb': 'rk3288-miqi.dtb',
|
|
'config': 'miqi-rk3288_config'
|
|
},
|
|
'tinker': {
|
|
'dtb': 'rk3288-tinker-s.dtb',
|
|
'config': 'tinker-rk3288_config'
|
|
},
|
|
},
|
|
'RK3328': {
|
|
'a1': {
|
|
'dtb': 'rk3328-a1.dtb',
|
|
'config': 'evb-rk3328_defconfig'
|
|
},
|
|
'box': {
|
|
'dtb': 'rk3328-box.dtb',
|
|
'config': 'evb-rk3328_defconfig'
|
|
},
|
|
'box-trn9': {
|
|
'dtb': 'rk3328-box-trn9.dtb',
|
|
'config': 'evb-rk3328_defconfig'
|
|
},
|
|
'box-z28': {
|
|
'dtb': 'rk3328-box-z28.dtb',
|
|
'config': 'evb-rk3328_defconfig'
|
|
},
|
|
'roc-cc': {
|
|
'dtb': 'rk3328-roc-cc.dtb',
|
|
'config': 'evb-rk3328_defconfig'
|
|
},
|
|
'rock64': {
|
|
'dtb': 'rk3328-rock64.dtb',
|
|
'config': 'evb-rk3328_defconfig'
|
|
},
|
|
'rockbox': {
|
|
'dtb': 'rk3328-rockbox.dtb',
|
|
'config': 'evb-rk3328_defconfig'
|
|
},
|
|
},
|
|
'RK3399': {
|
|
'firefly': {
|
|
'dtb': 'rk3399-firefly.dtb',
|
|
'config': 'evb-rk3399_config'
|
|
},
|
|
'hugsun-x99': {
|
|
'dtb': 'rk3399-hugsun-x99.dtb',
|
|
'config': 'evb-rk3399_config'
|
|
},
|
|
'khadas-edge': {
|
|
'dtb': 'rk3399-khadas-edge.dtb',
|
|
'config': 'evb-rk3399_config'
|
|
},
|
|
'khadas-edge-v': {
|
|
'dtb': 'rk3399-khadas-edge-v.dtb',
|
|
'config': 'evb-rk3399_config'
|
|
},
|
|
'nanopc-t4': {
|
|
'dtb': 'rk3399-nanopc-t4.dtb',
|
|
'config': 'evb-rk3399_config'
|
|
},
|
|
'nanopi-m4': {
|
|
'dtb': 'rk3399-nanopi-m4.dtb',
|
|
'config': 'evb-rk3399_config'
|
|
},
|
|
'nanopi-neo4': {
|
|
'dtb': 'rk3399-nanopi-neo4.dtb',
|
|
'config': 'evb-rk3399_config'
|
|
},
|
|
'orangepi': {
|
|
'dtb': 'rk3399-orangepi.dtb',
|
|
'config': 'evb-rk3399_config'
|
|
},
|
|
'rock960': {
|
|
'dtb': 'rk3399-rock960.dtb',
|
|
'config': 'evb-rk3399_config'
|
|
},
|
|
'rock-pi-4a': {
|
|
'dtb': 'rk3399-rock-pi-4a.dtb',
|
|
'config': 'evb-rk3399_config'
|
|
},
|
|
'rock-pi-4b': {
|
|
'dtb': 'rk3399-rock-pi-4b.dtb',
|
|
'config': 'evb-rk3399_config'
|
|
},
|
|
'rock-pi-4c': {
|
|
'dtb': 'rk3399-rock-pi-4c.dtb',
|
|
'config': 'evb-rk3399_config'
|
|
},
|
|
'rockpro64': {
|
|
'dtb': 'rk3399-rockpro64.dtb',
|
|
'config': 'evb-rk3399_config'
|
|
},
|
|
'roc-pc': {
|
|
'dtb': 'rk3399-roc-pc.dtb',
|
|
'config': 'evb-rk3399_config'
|
|
},
|
|
'sapphire': {
|
|
'dtb': 'rk3399-sapphire.dtb',
|
|
'config': 'evb-rk3399_config'
|
|
},
|
|
},
|
|
},
|
|
'Samsung': {
|
|
'Exynos': {
|
|
'odroid-xu4': {
|
|
'dtb': 'exynos5422-odroidxu4.dtb',
|
|
'config': 'odroid-xu4_defconfig'
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|
|
def usage(PROJECT=None, SOC=None, FILE=sys.stdout):
|
|
print('Usage: %s <project> <soc> <board-name> dtb|config|crust_config' % sys.argv[0], file=FILE)
|
|
print(' %s <project> <soc>' % sys.argv[0], file=FILE)
|
|
print(' %s <project>' % sys.argv[0], file=FILE)
|
|
print('', file=FILE)
|
|
|
|
if PROJECT and PROJECT not in devices:
|
|
PROJECT = SOC = None
|
|
if PROJECT and SOC and SOC not in devices[PROJECT]:
|
|
SOC = None
|
|
|
|
print('Projects:', file=FILE)
|
|
print('', file=FILE)
|
|
for project in sorted(devices):
|
|
if PROJECT is None or PROJECT == project:
|
|
print(' %s:' % project, file=FILE)
|
|
for soc in sorted(devices[project]):
|
|
if SOC is None or SOC == soc:
|
|
print(' %s:' % soc, file=FILE)
|
|
for board in sorted(devices[project][soc]):
|
|
print(' %s' % board, file=FILE)
|
|
print('', file=FILE)
|
|
print('', file=FILE)
|
|
|
|
def exit_error(msg, PROJECT=None, SOC=None):
|
|
print(msg, file=sys.stderr)
|
|
print('', file=sys.stderr)
|
|
usage(PROJECT=PROJECT, SOC=SOC, FILE=sys.stderr)
|
|
sys.exit(1)
|
|
|
|
# Basic argument validation
|
|
if len(sys.argv) == 2 and sys.argv[1] in ['help', 'usage']:
|
|
usage()
|
|
sys.exit(0)
|
|
|
|
if len(sys.argv) > 1 and sys.argv[1] not in devices:
|
|
exit_error('Invalid project: %s' % sys.argv[1])
|
|
|
|
if len(sys.argv) > 2 and sys.argv[2] not in devices[sys.argv[1]]:
|
|
exit_error('Invalid soc: %s' % sys.argv[2], PROJECT=sys.argv[1])
|
|
|
|
if len(sys.argv) > 3 and sys.argv[3] not in devices[sys.argv[1]][sys.argv[2]]:
|
|
exit_error('Invalid board-name: %s' % sys.argv[3], PROJECT=sys.argv[1], SOC=sys.argv[2])
|
|
|
|
if len(sys.argv) == 4:
|
|
exit_error('Invalid option: must specify dtb, config or crust_config', PROJECT=sys.argv[1], SOC=sys.argv[2])
|
|
elif len(sys.argv) > 4 and sys.argv[4] not in ['dtb', 'config', 'crust_config']:
|
|
exit_error('Invalid option: %s' % sys.argv[4], PROJECT=sys.argv[1], SOC=sys.argv[2])
|
|
|
|
if len(sys.argv) > 5:
|
|
exit_error('Invalid number of arguments: %s' % ' '.join(sys.argv[1:]), PROJECT=sys.argv[1], SOC=sys.argv[2])
|
|
|
|
# Get dtb, u-boot or crust config for a given project, soc, and board
|
|
# ./scripts/uboot_helper project device board-name dtb|config|crust_config
|
|
if len(sys.argv) == 5:
|
|
if sys.argv[4] in devices[sys.argv[1]][sys.argv[2]][sys.argv[3]]:
|
|
print(devices[sys.argv[1]][sys.argv[2]][sys.argv[3]][sys.argv[4]])
|
|
|
|
# List boards supported by a given project and soc
|
|
# ./scripts/uboot_helper project device
|
|
elif len(sys.argv) == 3:
|
|
print(' '.join([board for board in sorted(devices[sys.argv[1]][sys.argv[2]])]))
|
|
|
|
# List socs supported by a given project
|
|
# ./scripts/uboot_helper project
|
|
elif len(sys.argv) == 2:
|
|
print(' '.join([soc for soc in sorted(devices[sys.argv[1]])]))
|
|
|
|
# List projects
|
|
# ./scripts/uboot_helper
|
|
elif len(sys.argv) == 1:
|
|
print(' '.join([project for project in sorted(devices)]))
|
|
|
|
sys.exit(0)
|