mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-12 06:12:58 +00:00
83f348d024
Back in the day we relied a lot on Synopsys own build of the GNU tools for ARC processors, but since then we worked hard on getting all our changes upstream and for a couple of years now we have ARCompact (AKA ARCv1) and ARCv2 processors supported very well in upstream GCC, Binutils, GDB etc. And so there's no need to use Synopsys forks any longer, thus we remove all the references to that form and use upstream components as majority of other architectures in U-Boot. Thanks to Tom for pointing to that left-over! Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
109 lines
2.8 KiB
Python
109 lines
2.8 KiB
Python
# SPDX-License-Identifier: GPL-2.0+
|
|
# Copyright (c) 2012 The Chromium OS Authors.
|
|
|
|
import configparser
|
|
import os
|
|
import io
|
|
|
|
config_fname = None
|
|
|
|
def Setup(fname=''):
|
|
"""Set up the buildman settings module by reading config files
|
|
|
|
Args:
|
|
config_fname: Config filename to read ('' for default)
|
|
"""
|
|
global settings
|
|
global config_fname
|
|
|
|
settings = configparser.SafeConfigParser()
|
|
if fname is not None:
|
|
config_fname = fname
|
|
if config_fname == '':
|
|
config_fname = '%s/.buildman' % os.getenv('HOME')
|
|
if not os.path.exists(config_fname):
|
|
print('No config file found ~/.buildman\nCreating one...\n')
|
|
CreateBuildmanConfigFile(config_fname)
|
|
print('To install tool chains, please use the --fetch-arch option')
|
|
if config_fname:
|
|
settings.read(config_fname)
|
|
|
|
def AddFile(data):
|
|
settings.readfp(io.StringIO(data))
|
|
|
|
def GetItems(section):
|
|
"""Get the items from a section of the config.
|
|
|
|
Args:
|
|
section: name of section to retrieve
|
|
|
|
Returns:
|
|
List of (name, value) tuples for the section
|
|
"""
|
|
try:
|
|
return settings.items(section)
|
|
except configparser.NoSectionError as e:
|
|
return []
|
|
except:
|
|
raise
|
|
|
|
def GetGlobalItemValue(name):
|
|
"""Get an item from the 'global' section of the config.
|
|
|
|
Args:
|
|
name: name of item to retrieve
|
|
|
|
Returns:
|
|
str: Value of item, or None if not present
|
|
"""
|
|
return settings.get('global', name, fallback=None)
|
|
|
|
def SetItem(section, tag, value):
|
|
"""Set an item and write it back to the settings file"""
|
|
global settings
|
|
global config_fname
|
|
|
|
settings.set(section, tag, value)
|
|
if config_fname is not None:
|
|
with open(config_fname, 'w') as fd:
|
|
settings.write(fd)
|
|
|
|
def CreateBuildmanConfigFile(config_fname):
|
|
"""Creates a new config file with no tool chain information.
|
|
|
|
Args:
|
|
config_fname: Config filename to create
|
|
|
|
Returns:
|
|
None
|
|
"""
|
|
try:
|
|
f = open(config_fname, 'w')
|
|
except IOError:
|
|
print("Couldn't create buildman config file '%s'\n" % config_fname)
|
|
raise
|
|
|
|
print('''[toolchain]
|
|
# name = path
|
|
# e.g. x86 = /opt/gcc-4.6.3-nolibc/x86_64-linux
|
|
other = /
|
|
|
|
[toolchain-prefix]
|
|
# name = path to prefix
|
|
# e.g. x86 = /opt/gcc-4.6.3-nolibc/x86_64-linux/bin/x86_64-linux-
|
|
|
|
[toolchain-alias]
|
|
# arch = alias
|
|
# Indicates which toolchain should be used to build for that arch
|
|
riscv = riscv32
|
|
sh = sh4
|
|
x86 = i386
|
|
|
|
[make-flags]
|
|
# Special flags to pass to 'make' for certain boards, e.g. to pass a test
|
|
# flag and build tag to snapper boards:
|
|
# snapper-boards=ENABLE_AT91_TEST=1
|
|
# snapper9260=${snapper-boards} BUILD_TAG=442
|
|
# snapper9g45=${snapper-boards} BUILD_TAG=443
|
|
''', file=f)
|
|
f.close();
|