summaryrefslogtreecommitdiff
path: root/tools/binman/bintool.py
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2025-04-07 16:40:02 -0600
committerTom Rini <trini@konsulko.com>2025-04-08 11:43:23 -0600
commitff61d6bfd1c9534d3fc2397846a5899639f2e55d (patch)
treedcfe4bc52848a5637c975a3352b57885e5b8a06d /tools/binman/bintool.py
parent34820924edbc4ec7803eb89d9852f4b870fa760a (diff)
parentf892a7f397a66d8d09f418d1e0e06dfb48bac27d (diff)
Merge branch 'next'
Note that this undoes the changes of commit cf6d4535cc4c ("x86: emulation: Disable bloblist for now") as that was intended only for the release due to time.
Diffstat (limited to 'tools/binman/bintool.py')
-rw-r--r--tools/binman/bintool.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/tools/binman/bintool.py b/tools/binman/bintool.py
index 3c4ad1adbb9..81872db377f 100644
--- a/tools/binman/bintool.py
+++ b/tools/binman/bintool.py
@@ -328,7 +328,8 @@ class Bintool:
return result.stdout
@classmethod
- def build_from_git(cls, git_repo, make_targets, bintool_path, flags=None):
+ def build_from_git(cls, git_repo, make_targets, bintool_path,
+ flags=None, git_branch=None, make_path=None):
"""Build a bintool from a git repo
This clones the repo in a temporary directory, builds it with 'make',
@@ -341,6 +342,9 @@ class Bintool:
bintool_path (str): Relative path of the tool in the repo, after
build is complete
flags (list of str): Flags or variables to pass to make, or None
+ git_branch (str): Branch of git repo, or None to use the default
+ make_path (str): Relative path inside git repo containing the
+ Makefile, or None
Returns:
tuple:
@@ -350,10 +354,17 @@ class Bintool:
"""
tmpdir = tempfile.mkdtemp(prefix='binmanf.')
print(f"- clone git repo '{git_repo}' to '{tmpdir}'")
- tools.run('git', 'clone', '--depth', '1', git_repo, tmpdir)
+ if git_branch:
+ tools.run('git', 'clone', '--depth', '1', '--branch', git_branch,
+ git_repo, tmpdir)
+ else:
+ tools.run('git', 'clone', '--depth', '1', git_repo, tmpdir)
for target in make_targets:
print(f"- build target '{target}'")
- cmd = ['make', '-C', tmpdir, '-j', f'{multiprocessing.cpu_count()}',
+ makedir = tmpdir
+ if make_path:
+ makedir = os.path.join(tmpdir, make_path)
+ cmd = ['make', '-C', makedir, '-j', f'{multiprocessing.cpu_count()}',
target]
if flags:
cmd += flags