summaryrefslogtreecommitdiff
path: root/tools/binman/state.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/binman/state.py')
-rw-r--r--tools/binman/state.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/binman/state.py b/tools/binman/state.py
index dfb17604554..2f567587382 100644
--- a/tools/binman/state.py
+++ b/tools/binman/state.py
@@ -7,6 +7,7 @@
import hashlib
import re
+import threading
from dtoc import fdt
import os
@@ -55,6 +56,9 @@ allow_entry_expansion = True
# to the new ones, the compressed size increases, etc.
allow_entry_contraction = False
+# Number of threads to use for binman (None means machine-dependent)
+num_threads = None
+
def GetFdtForEtype(etype):
"""Get the Fdt object for a particular device-tree entry
@@ -420,3 +424,22 @@ def AllowEntryContraction():
raised
"""
return allow_entry_contraction
+
+def SetThreads(threads):
+ """Set the number of threads to use when building sections
+
+ Args:
+ threads: Number of threads to use (None for default, 0 for
+ single-threaded)
+ """
+ global num_threads
+
+ num_threads = threads
+
+def GetThreads():
+ """Get the number of threads to use when building sections
+
+ Returns:
+ Number of threads to use (None for default, 0 for single-threaded)
+ """
+ return num_threads