mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-29 13:46:49 +00:00
Merge pull request #3760 from MilhouseVH/le10_uboot_validation
buildsystem: validate UBOOT_SYSTEM at start of build
This commit is contained in:
commit
0294986e19
@ -10,6 +10,15 @@ unset _CACHE_PACKAGE_LOCAL _CACHE_PACKAGE_GLOBAL _DEBUG_DEPENDS_LIST _DEBUG_PACK
|
|||||||
. config/multithread
|
. config/multithread
|
||||||
. config/show_config
|
. config/show_config
|
||||||
|
|
||||||
|
# Validate UBOOT_SYSTEM if it is specified
|
||||||
|
if [ "${BOOTLOADER}" = "u-boot" -a -n "${DEVICE}" ]; then
|
||||||
|
if [ -z "${UBOOT_SYSTEM}" ]; then
|
||||||
|
${SCRIPTS}/uboot_helper ${PROJECT} ${DEVICE} >/dev/null
|
||||||
|
elif [ "${UBOOT_VERSION}" != "vendor" ]; then
|
||||||
|
${SCRIPTS}/uboot_helper ${PROJECT} ${DEVICE} ${UBOOT_SYSTEM} dtb >/dev/null
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
show_config
|
show_config
|
||||||
save_build_config
|
save_build_config
|
||||||
|
|
||||||
@ -310,10 +319,14 @@ if [ "${1}" = "release" -o "${1}" = "mkimage" -o "${1}" = "noobs" ]; then
|
|||||||
UUID_SYSTEM="$(date '+%d%m')-$(date '+%M%S')"
|
UUID_SYSTEM="$(date '+%d%m')-$(date '+%M%S')"
|
||||||
UUID_STORAGE="$(uuidgen)"
|
UUID_STORAGE="$(uuidgen)"
|
||||||
|
|
||||||
DEVICE_BOARDS=$(${SCRIPTS}/uboot_helper "${PROJECT}" "${DEVICE}")
|
DEVICE_BOARDS=
|
||||||
|
if [ "${BOOTLOADER}" = "u-boot" -a -z "${UBOOT_SYSTEM}" -a -n "${DEVICE}" ]; then
|
||||||
|
DEVICE_BOARDS=$(${SCRIPTS}/uboot_helper "${PROJECT}" "${DEVICE}")
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "${BOOTLOADER}" = "u-boot" -a -z "${UBOOT_SYSTEM}" -a -n "${DEVICE}" -a -n "${DEVICE_BOARDS}" ]; then
|
if [ -n "${DEVICE_BOARDS}" ]; then
|
||||||
for UBOOT_SYSTEM in ${DEVICE_BOARDS}; do
|
for UBOOT_SYSTEM in ${DEVICE_BOARDS}; do
|
||||||
|
echo "Installing u-boot for board ${UBOOT_SYSTEM}..."
|
||||||
|
|
||||||
# Re-install u-boot package
|
# Re-install u-boot package
|
||||||
rm ${STAMPS_INSTALL}/u-boot/install_target
|
rm ${STAMPS_INSTALL}/u-boot/install_target
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
|
# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv)
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
# When adding new devices to the list please keep them in alphabetical order
|
# When adding new devices to the list please keep them in alphabetical order
|
||||||
@ -223,60 +227,76 @@ devices = \
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
def usage():
|
def usage(PROJECT=None, SOC=None, FILE=sys.stdout):
|
||||||
print(' '.join(['Usage:', sys.argv[0], '<project>', '<soc>', '<board-name>', 'dtb|config']))
|
print('Usage: %s <project> <soc> <board-name> dtb|config' % sys.argv[0], file=FILE)
|
||||||
print(' '.join([' ', sys.argv[0], '<project>', '<soc>']))
|
print(' %s <project> <soc>' % sys.argv[0], file=FILE)
|
||||||
print(' '.join([' ', sys.argv[0], '<project>']) + '\n')
|
print(' %s <project>' % sys.argv[0], file=FILE)
|
||||||
print('Projects:' + '\n')
|
print('', file=FILE)
|
||||||
for project in devices:
|
|
||||||
print(' ' + project + ':')
|
if PROJECT and PROJECT not in devices:
|
||||||
for soc in devices[project]:
|
PROJECT = SOC = None
|
||||||
print(' ' + soc + ':')
|
if PROJECT and SOC and SOC not in devices[PROJECT]:
|
||||||
for board in devices[project][soc]:
|
SOC = None
|
||||||
print(' ' + board)
|
|
||||||
print('')
|
print('Projects:', file=FILE)
|
||||||
print('')
|
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 or config', PROJECT=sys.argv[1], SOC=sys.argv[2])
|
||||||
|
elif len(sys.argv) > 4 and sys.argv[4] not in ['dtb', '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 or u-boot config for a given project, soc, and board
|
# Get dtb or u-boot config for a given project, soc, and board
|
||||||
# ./scripts/uboot_helper project device board_name dtb
|
# ./scripts/uboot_helper project device board-name dtb|config
|
||||||
if len(sys.argv) == 5:
|
if len(sys.argv) == 5:
|
||||||
if sys.argv[1] in devices:
|
print(devices[sys.argv[1]][sys.argv[2]][sys.argv[3]][sys.argv[4]])
|
||||||
if sys.argv[2] in devices[sys.argv[1]]:
|
|
||||||
if sys.argv[3] in devices[sys.argv[1]][sys.argv[2]]:
|
|
||||||
if sys.argv[4] in ['dtb', 'config']:
|
|
||||||
print(devices[sys.argv[1]][sys.argv[2]][sys.argv[3]][sys.argv[4]])
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
# List boards supported by a given project and soc
|
# List boards supported by a given project and soc
|
||||||
# ./scripts/uboot_helper project device
|
# ./scripts/uboot_helper project device
|
||||||
elif len(sys.argv) == 3:
|
elif len(sys.argv) == 3:
|
||||||
if sys.argv[1] in devices:
|
print(' '.join([board for board in sorted(devices[sys.argv[1]][sys.argv[2]])]))
|
||||||
if sys.argv[2] in devices[sys.argv[1]]:
|
|
||||||
boards = []
|
|
||||||
for board in sorted(devices[sys.argv[1]][sys.argv[2]]):
|
|
||||||
boards.append(board)
|
|
||||||
print(' '.join(boards))
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
# List socs supported by a given project
|
# List socs supported by a given project
|
||||||
# ./scripts/uboot_helper project
|
# ./scripts/uboot_helper project
|
||||||
elif len(sys.argv) == 2:
|
elif len(sys.argv) == 2:
|
||||||
if sys.argv[1] in ['help', 'usage']:
|
print(' '.join([soc for soc in sorted(devices[sys.argv[1]])]))
|
||||||
usage()
|
|
||||||
elif sys.argv[1] in devices:
|
|
||||||
socs = []
|
|
||||||
for soc in sorted(devices[sys.argv[1]]):
|
|
||||||
socs.append(soc)
|
|
||||||
print(' '.join(socs))
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
# List projects
|
# List projects
|
||||||
# ./scripts/uboot_helper
|
# ./scripts/uboot_helper
|
||||||
elif len(sys.argv) == 1:
|
elif len(sys.argv) == 1:
|
||||||
projects = []
|
print(' '.join([project for project in sorted(devices)]))
|
||||||
for project in sorted(devices):
|
|
||||||
projects.append(project)
|
|
||||||
print(' '.join(projects))
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
usage()
|
sys.exit(0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user