diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/buildman/README | 12 | ||||
-rw-r--r-- | tools/buildman/builderthread.py | 8 | ||||
-rw-r--r-- | tools/buildman/cmdline.py | 2 | ||||
-rw-r--r-- | tools/buildman/control.py | 2 | ||||
-rw-r--r-- | tools/buildman/toolchain.py | 42 | ||||
-rw-r--r-- | tools/dtoc/dtb_platdata.py | 2 | ||||
-rw-r--r-- | tools/imx8image.c | 2 |
7 files changed, 58 insertions, 12 deletions
diff --git a/tools/buildman/README b/tools/buildman/README index 5a709c6ff9..56a99c70a2 100644 --- a/tools/buildman/README +++ b/tools/buildman/README @@ -1046,6 +1046,16 @@ value for 'altbootcmd', but lost one for ' altbootcmd'. The -U option uses the u-boot.env files which are produced by a build. + +Building with clang +=================== + +To build with clang (sandbox only), use the -O option to override the +toolchain. For example: + + buildman -O clang-7 --board sandbox + + Other options ============= @@ -1169,8 +1179,6 @@ access to log files. Also it would be nice if buildman could 'hunt' for problems, perhaps by building a few boards for each arch, or checking commits for changed files and building only boards which use those files. -A specific problem to fix is that Ctrl-C does not exit buildman cleanly when -multiple builder threads are active. Credits ======= diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py index c84ba6acf1..6b156f152d 100644 --- a/tools/buildman/builderthread.py +++ b/tools/buildman/builderthread.py @@ -156,7 +156,12 @@ class BuilderThread(threading.Thread): if result.already_done: # Get the return code from that build and use it with open(done_file, 'r') as fd: - result.return_code = int(fd.readline()) + try: + result.return_code = int(fd.readline()) + except ValueError: + # The file may be empty due to running out of disk space. + # Try a rebuild + result.return_code = RETURN_CODE_RETRY # Check the signal that the build needs to be retried if result.return_code == RETURN_CODE_RETRY: @@ -224,6 +229,7 @@ class BuilderThread(threading.Thread): config_args = ['%s_defconfig' % brd.target] config_out = '' args.extend(self.builder.toolchains.GetMakeArguments(brd)) + args.extend(self.toolchain.MakeArgs()) # If we need to reconfigure, do that now if do_config: diff --git a/tools/buildman/cmdline.py b/tools/buildman/cmdline.py index 93d09ca08d..832a5145d2 100644 --- a/tools/buildman/cmdline.py +++ b/tools/buildman/cmdline.py @@ -74,6 +74,8 @@ def ParseArgs(): parser.add_option('-o', '--output-dir', type='string', dest='output_dir', default='..', help='Directory where all builds happen and buildman has its workspace (default is ../)') + parser.add_option('-O', '--override-toolchain', type='string', + help="Override host toochain to use for sandbox (e.g. 'clang-7')") parser.add_option('-Q', '--quick', action='store_true', default=False, help='Do a rough build, with limited warning resolution') parser.add_option('-p', '--full-path', action='store_true', diff --git a/tools/buildman/control.py b/tools/buildman/control.py index c900211510..27916d3c35 100644 --- a/tools/buildman/control.py +++ b/tools/buildman/control.py @@ -141,7 +141,7 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None, no_toolchains = toolchains is None if no_toolchains: - toolchains = toolchain.Toolchains() + toolchains = toolchain.Toolchains(options.override_toolchain) if options.fetch_arch: if options.fetch_arch == 'list': diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py index c62ce136fa..a65737fdf8 100644 --- a/tools/buildman/toolchain.py +++ b/tools/buildman/toolchain.py @@ -54,9 +54,11 @@ class Toolchain: arch: Architecture of toolchain as determined from the first component of the filename. E.g. arm-linux-gcc becomes arm priority: Toolchain priority (0=highest, 20=lowest) + override_toolchain: Toolchain to use for sandbox, overriding the normal + one """ def __init__(self, fname, test, verbose=False, priority=PRIORITY_CALC, - arch=None): + arch=None, override_toolchain=None): """Create a new toolchain object. Args: @@ -68,6 +70,7 @@ class Toolchain: """ self.gcc = fname self.path = os.path.dirname(fname) + self.override_toolchain = override_toolchain # Find the CROSS_COMPILE prefix to use for U-Boot. For example, # 'arm-linux-gnueabihf-gcc' turns into 'arm-linux-gnueabihf-'. @@ -81,6 +84,8 @@ class Toolchain: self.arch = arch else: self.arch = self.cross[:pos] if pos != -1 else 'sandbox' + if self.arch == 'sandbox' and override_toolchain: + self.gcc = override_toolchain env = self.MakeEnvironment(False) @@ -130,8 +135,8 @@ class Toolchain: def GetWrapper(self, show_warning=True): """Get toolchain wrapper from the setting file. """ - value = '' - for name, value in bsettings.GetItems('toolchain-wrapper'): + value = '' + for name, value in bsettings.GetItems('toolchain-wrapper'): if not value: print "Warning: Wrapper not found" if value: @@ -150,11 +155,18 @@ class Toolchain: Args: full_path: Return the full path in CROSS_COMPILE and don't set PATH + Returns: + Dict containing the environemnt to use. This is based on the current + environment, with changes as needed to CROSS_COMPILE, PATH and + LC_ALL. """ env = dict(os.environ) wrapper = self.GetWrapper() - if full_path: + if self.override_toolchain: + # We'll use MakeArgs() to provide this + pass + elif full_path: env['CROSS_COMPILE'] = wrapper + os.path.join(self.path, self.cross) else: env['CROSS_COMPILE'] = wrapper + self.cross @@ -164,6 +176,22 @@ class Toolchain: return env + def MakeArgs(self): + """Create the 'make' arguments for a toolchain + + This is only used when the toolchain is being overridden. Since the + U-Boot Makefile sets CC and HOSTCC explicitly we cannot rely on the + environment (and MakeEnvironment()) to override these values. This + function returns the arguments to accomplish this. + + Returns: + List of arguments to pass to 'make' + """ + if self.override_toolchain: + return ['HOSTCC=%s' % self.override_toolchain, + 'CC=%s' % self.override_toolchain] + return [] + class Toolchains: """Manage a list of toolchains for building U-Boot @@ -180,10 +208,11 @@ class Toolchains: paths: List of paths to check for toolchains (may contain wildcards) """ - def __init__(self): + def __init__(self, override_toolchain=None): self.toolchains = {} self.prefixes = {} self.paths = [] + self.override_toolchain = override_toolchain self._make_flags = dict(bsettings.GetItems('make-flags')) def GetPathList(self, show_warning=True): @@ -234,7 +263,8 @@ class Toolchains: priority: Priority to use for this toolchain arch: Toolchain architecture, or None if not known """ - toolchain = Toolchain(fname, test, verbose, priority, arch) + toolchain = Toolchain(fname, test, verbose, priority, arch, + self.override_toolchain) add_it = toolchain.ok if toolchain.arch in self.toolchains: add_it = (toolchain.priority < diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index 6cb1259446..ca580b45d4 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -461,7 +461,7 @@ class DtbPlatdata(object): """ struct_name, _ = get_compat_name(node) var_name = conv_name_to_c(node.name) - self.buf('static struct %s%s %s%s = {\n' % + self.buf('static const struct %s%s %s%s = {\n' % (STRUCT_PREFIX, struct_name, VAL_PREFIX, var_name)) for pname, prop in node.props.items(): if pname in PROP_IGNORE_LIST or pname[0] == '#': diff --git a/tools/imx8image.c b/tools/imx8image.c index 0d856b9d94..435f308b99 100644 --- a/tools/imx8image.c +++ b/tools/imx8image.c @@ -674,7 +674,7 @@ static int get_container_image_start_pos(image_t *image_stack, uint32_t align) fclose(fd); if (header.tag != IVT_HEADER_TAG_B0) { - fprintf(stderr, "header tag missmatched \n"); + fprintf(stderr, "header tag mismatched \n"); exit(EXIT_FAILURE); } else { file_off += |