summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile4
-rw-r--r--tools/buildman/README5
-rw-r--r--tools/buildman/builder.py60
-rw-r--r--tools/buildman/builderthread.py16
-rw-r--r--tools/buildman/cmdline.py3
-rw-r--r--tools/buildman/control.py2
-rw-r--r--tools/buildman/test.py12
-rw-r--r--tools/imx8mimage.c8
-rw-r--r--tools/patman/series.py2
9 files changed, 76 insertions, 36 deletions
diff --git a/tools/Makefile b/tools/Makefile
index 2d550432ba..62de7e6fe0 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -150,12 +150,12 @@ ifdef CONFIG_SYS_U_BOOT_OFFS
HOSTCFLAGS_kwbimage.o += -DCONFIG_SYS_U_BOOT_OFFS=$(CONFIG_SYS_U_BOOT_OFFS)
endif
-ifneq ($(CONFIG_ARMADA_38X)$(CONFIG_ARMADA_39X),)
+ifneq ($(CONFIG_ARMADA_38X),)
HOSTCFLAGS_kwbimage.o += -DCONFIG_KWB_SECURE
endif
# MXSImage needs LibSSL
-ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_ARMADA_38X)$(CONFIG_ARMADA_39X)$(CONFIG_FIT_SIGNATURE)$(CONFIG_FIT_CIPHER),)
+ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_ARMADA_38X)$(CONFIG_FIT_SIGNATURE)$(CONFIG_FIT_CIPHER),)
HOSTCFLAGS_kwbimage.o += \
$(shell pkg-config --cflags libssl libcrypto 2> /dev/null || echo "")
HOSTLDLIBS_mkimage += \
diff --git a/tools/buildman/README b/tools/buildman/README
index b7442a95e5..600794790a 100644
--- a/tools/buildman/README
+++ b/tools/buildman/README
@@ -1128,6 +1128,11 @@ If there are both warnings and errors, errors win, so buildman returns 100.
The -y option is provided (for use with -s) to ignore the bountiful device-tree
warnings. Similarly, -Y tells buildman to ignore the migration warnings.
+Sometimes you might get an error in a thread that is not handled by buildman,
+perhaps due to a failure of a tool that it calls. You might see the output, but
+then buildman hangs. Failing to handle any eventuality is a bug in buildman and
+should be reported. But you can use -T0 to disable threading and hopefully
+figure out the root cause of the build failure.
Build summary
=============
diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 6f6d759329..be8a8fa13a 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -197,6 +197,8 @@ class Builder:
last _timestamp_count builds. Each is a datetime object.
_timestamp_count: Number of timestamps to keep in our list.
_working_dir: Base working directory containing all threads
+ _single_builder: BuilderThread object for the singer builder, if
+ threading is not being used
"""
class Outcome:
"""Records a build outcome for a single make invocation
@@ -309,19 +311,24 @@ class Builder:
self._re_migration_warning = re.compile(r'^={21} WARNING ={22}\n.*\n=+\n',
re.MULTILINE | re.DOTALL)
- self.queue = queue.Queue()
- self.out_queue = queue.Queue()
- for i in range(self.num_threads):
- t = builderthread.BuilderThread(self, i, mrproper,
- per_board_out_dir)
+ if self.num_threads:
+ self._single_builder = None
+ self.queue = queue.Queue()
+ self.out_queue = queue.Queue()
+ for i in range(self.num_threads):
+ t = builderthread.BuilderThread(self, i, mrproper,
+ per_board_out_dir)
+ t.setDaemon(True)
+ t.start()
+ self.threads.append(t)
+
+ t = builderthread.ResultThread(self)
t.setDaemon(True)
t.start()
self.threads.append(t)
-
- t = builderthread.ResultThread(self)
- t.setDaemon(True)
- t.start()
- self.threads.append(t)
+ else:
+ self._single_builder = builderthread.BuilderThread(
+ self, -1, mrproper, per_board_out_dir)
ignore_lines = ['(make.*Waiting for unfinished)', '(Segmentation fault)']
self.re_make_err = re.compile('|'.join(ignore_lines))
@@ -1531,11 +1538,12 @@ class Builder:
"""Get the directory path to the working dir for a thread.
Args:
- thread_num: Number of thread to check.
+ thread_num: Number of thread to check (-1 for main process, which
+ is treated as 0)
"""
if self.work_in_output:
return self._working_dir
- return os.path.join(self._working_dir, '%02d' % thread_num)
+ return os.path.join(self._working_dir, '%02d' % max(thread_num, 0))
def _PrepareThread(self, thread_num, setup_git):
"""Prepare the working directory for a thread.
@@ -1594,7 +1602,9 @@ class Builder:
if git-worktree is available, or clones the repo if it isn't.
Args:
- max_threads: Maximum number of threads we expect to need.
+ max_threads: Maximum number of threads we expect to need. If 0 then
+ 1 is set up, since the main process still needs somewhere to
+ work
setup_git: True to set up a git worktree or a git clone
"""
builderthread.Mkdir(self._working_dir)
@@ -1608,7 +1618,9 @@ class Builder:
gitutil.PruneWorktrees(src_dir)
else:
setup_git = 'clone'
- for thread in range(max_threads):
+
+ # Always do at least one thread
+ for thread in range(max(max_threads, 1)):
self._PrepareThread(thread, setup_git)
def _GetOutputSpaceRemovals(self):
@@ -1686,16 +1698,20 @@ class Builder:
job.keep_outputs = keep_outputs
job.work_in_output = self.work_in_output
job.step = self._step
- self.queue.put(job)
+ if self.num_threads:
+ self.queue.put(job)
+ else:
+ results = self._single_builder.RunJob(job)
- term = threading.Thread(target=self.queue.join)
- term.setDaemon(True)
- term.start()
- while term.is_alive():
- term.join(100)
+ if self.num_threads:
+ term = threading.Thread(target=self.queue.join)
+ term.setDaemon(True)
+ term.start()
+ while term.is_alive():
+ term.join(100)
- # Wait until we have processed all output
- self.out_queue.join()
+ # Wait until we have processed all output
+ self.out_queue.join()
Print()
msg = 'Completed: %d total built' % self.count
diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
index d664868582..6c6dbd7872 100644
--- a/tools/buildman/builderthread.py
+++ b/tools/buildman/builderthread.py
@@ -89,7 +89,8 @@ class BuilderThread(threading.Thread):
Members:
builder: The builder which contains information we might need
thread_num: Our thread number (0-n-1), used to decide on a
- temporary directory
+ temporary directory. If this is -1 then there are no threads
+ and we are the (only) main process
"""
def __init__(self, builder, thread_num, mrproper, per_board_out_dir):
"""Set up a new builder thread"""
@@ -445,6 +446,9 @@ class BuilderThread(threading.Thread):
Args:
job: Job to build
+
+ Returns:
+ List of Result objects
"""
brd = job.board
work_dir = self.builder.GetThreadDir(self.thread_num)
@@ -508,7 +512,10 @@ class BuilderThread(threading.Thread):
# We have the build results, so output the result
self._WriteResult(result, job.keep_outputs, job.work_in_output)
- self.builder.out_queue.put(result)
+ if self.thread_num != -1:
+ self.builder.out_queue.put(result)
+ else:
+ self.builder.ProcessResult(result)
else:
# Just build the currently checked-out build
result, request_config = self.RunCommit(None, brd, work_dir, True,
@@ -517,7 +524,10 @@ class BuilderThread(threading.Thread):
work_in_output=job.work_in_output)
result.commit_upto = 0
self._WriteResult(result, job.keep_outputs, job.work_in_output)
- self.builder.out_queue.put(result)
+ if self.thread_num != -1:
+ self.builder.out_queue.put(result)
+ else:
+ self.builder.ProcessResult(result)
def run(self):
"""Our thread's run function
diff --git a/tools/buildman/cmdline.py b/tools/buildman/cmdline.py
index 680c072d66..274b5ac3f4 100644
--- a/tools/buildman/cmdline.py
+++ b/tools/buildman/cmdline.py
@@ -97,7 +97,8 @@ def ParseArgs():
parser.add_option('-t', '--test', action='store_true', dest='test',
default=False, help='run tests')
parser.add_option('-T', '--threads', type='int',
- default=None, help='Number of builder threads to use')
+ default=None,
+ help='Number of builder threads to use (0=single-thread)')
parser.add_option('-u', '--show_unknown', action='store_true',
default=False, help='Show boards with unknown build result')
parser.add_option('-U', '--show-environment', action='store_true',
diff --git a/tools/buildman/control.py b/tools/buildman/control.py
index fe874b8165..a767570146 100644
--- a/tools/buildman/control.py
+++ b/tools/buildman/control.py
@@ -294,7 +294,7 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
# By default we have one thread per CPU. But if there are not enough jobs
# we can have fewer threads and use a high '-j' value for make.
- if not options.threads:
+ if options.threads is None:
options.threads = min(multiprocessing.cpu_count(), len(selected))
if not options.jobs:
options.jobs = max(1, (multiprocessing.cpu_count() +
diff --git a/tools/buildman/test.py b/tools/buildman/test.py
index 1a259d54ab..b9c65c0d32 100644
--- a/tools/buildman/test.py
+++ b/tools/buildman/test.py
@@ -187,7 +187,7 @@ class TestBuild(unittest.TestCase):
expect += col.Color(expected_colour, ' %s' % board)
self.assertEqual(text, expect)
- def _SetupTest(self, echo_lines=False, **kwdisplay_args):
+ def _SetupTest(self, echo_lines=False, threads=1, **kwdisplay_args):
"""Set up the test by running a build and summary
Args:
@@ -199,8 +199,8 @@ class TestBuild(unittest.TestCase):
Returns:
Iterator containing the output lines, each a PrintLine() object
"""
- build = builder.Builder(self.toolchains, self.base_dir, None, 1, 2,
- checkout=False, show_unknown=False)
+ build = builder.Builder(self.toolchains, self.base_dir, None, threads,
+ 2, checkout=False, show_unknown=False)
build.do_make = self.Make
board_selected = self.boards.GetSelectedDict()
@@ -438,6 +438,12 @@ class TestBuild(unittest.TestCase):
filter_migration_warnings=True)
self._CheckOutput(lines, filter_migration_warnings=True)
+ def testSingleThread(self):
+ """Test operation without threading"""
+ lines = self._SetupTest(show_errors=True, threads=0)
+ self._CheckOutput(lines, list_error_boards=False,
+ filter_dtb_warnings=False)
+
def _testGit(self):
"""Test basic builder operation by building a branch"""
options = Options()
diff --git a/tools/imx8mimage.c b/tools/imx8mimage.c
index bc4ee793cb..9985b95a98 100644
--- a/tools/imx8mimage.c
+++ b/tools/imx8mimage.c
@@ -32,6 +32,8 @@ static uint32_t rom_version = ROM_V1;
#define HDMI_FW_SIZE 0x17000 /* Use Last 0x1000 for IVT and CSF */
#define ALIGN_SIZE 0x1000
+#define ALIGN_IMX(x, a) __ALIGN_MASK_IMX((x), (__typeof__(x))(a) - 1, a)
+#define __ALIGN_MASK_IMX(x, mask, mask2) (((x) + (mask)) / (mask2) * (mask2))
static uint32_t get_cfg_value(char *token, char *name, int linenr)
{
@@ -342,7 +344,7 @@ static int generate_ivt_for_fit(int fd, int fit_offset, uint32_t ep,
fit_size = fdt_totalsize(&image_header);
- fit_size = ALIGN(fit_size, ALIGN_SIZE);
+ fit_size = ALIGN_IMX(fit_size, ALIGN_SIZE);
ret = lseek(fd, fit_offset + fit_size, SEEK_SET);
if (ret < 0) {
@@ -446,7 +448,7 @@ void build_image(int ofd)
* Aligned to 104KB = 92KB FW image + 0x8000
* (IVT and alignment) + 0x4000 (second IVT + CSF)
*/
- file_off += ALIGN(sbuf.st_size,
+ file_off += ALIGN_IMX(sbuf.st_size,
HDMI_FW_SIZE + 0x2000 + 0x1000);
}
@@ -479,7 +481,7 @@ void build_image(int ofd)
imx_header[IMAGE_IVT_ID].boot_data.start =
imx_header[IMAGE_IVT_ID].fhdr.self - ivt_offset;
imx_header[IMAGE_IVT_ID].boot_data.size =
- ALIGN(sbuf.st_size + sizeof(imx_header_v3_t) + ivt_offset,
+ ALIGN_IMX(sbuf.st_size + sizeof(imx_header_v3_t) + ivt_offset,
sector_size);
image_off = header_image_off + sizeof(imx_header_v3_t);
diff --git a/tools/patman/series.py b/tools/patman/series.py
index a6746e87c4..41a11732fc 100644
--- a/tools/patman/series.py
+++ b/tools/patman/series.py
@@ -271,7 +271,7 @@ class Series(dict):
cc += get_maintainer.GetMaintainer(dir_list, commit.patch)
for x in set(cc) & set(settings.bounces):
print(col.Color(col.YELLOW, 'Skipping "%s"' % x))
- cc = set(cc) - set(settings.bounces)
+ cc = list(set(cc) - set(settings.bounces))
if limit is not None:
cc = cc[:limit]
all_ccs += cc