[PATCH] binman: Get futility by building it

A binary download is not great, since it depends on libraries being present in the system. Build futility from source instead.
Note that this requires two patches to the source repo which are in progress:
https://issuetracker.google.com/issues/245993083?pli=1
Signed-off-by: Simon Glass sjg@chromium.org ---
tools/binman/bintool.py | 10 +++++++--- tools/binman/btool/futility.py | 9 ++++++--- 2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/tools/binman/bintool.py b/tools/binman/bintool.py index 032179a99de..a582d9d3446 100644 --- a/tools/binman/bintool.py +++ b/tools/binman/bintool.py @@ -319,7 +319,7 @@ class Bintool: return result.stdout
@classmethod - def build_from_git(cls, git_repo, make_target, bintool_path): + def build_from_git(cls, git_repo, make_target, bintool_path, flags=None): """Build a bintool from a git repo
This clones the repo in a temporary directory, builds it with 'make', @@ -330,6 +330,7 @@ class Bintool: make_target (str): Target to pass to 'make' to build the tool 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
Returns: tuple: @@ -341,8 +342,11 @@ class Bintool: print(f"- clone git repo '{git_repo}' to '{tmpdir}'") tools.run('git', 'clone', '--depth', '1', git_repo, tmpdir) print(f"- build target '{make_target}'") - tools.run('make', '-C', tmpdir, '-j', f'{multiprocessing.cpu_count()}', - make_target) + cmd = ['make', '-C', tmpdir, '-j', f'{multiprocessing.cpu_count()}', + make_target] + if flags: + cmd += flags + tools.run(*cmd) fname = os.path.join(tmpdir, bintool_path) if not os.path.exists(fname): print(f"- File '{fname}' was not produced") diff --git a/tools/binman/btool/futility.py b/tools/binman/btool/futility.py index 75a05c2ac66..f88139a0ab5 100644 --- a/tools/binman/btool/futility.py +++ b/tools/binman/btool/futility.py @@ -160,8 +160,11 @@ class Bintoolfutility(bintool.Bintool): Raises: Valuerror: Fetching could not be completed """ - if method != bintool.FETCH_BIN: + if method != bintool.FETCH_BUILD: return None - fname, tmpdir = self.fetch_from_drive( - '1hdsInzsE4aJbmBeJ663kYgjOQyW1I-E0') + result = self.build_from_git( + 'https://chromium.googlesource.com/a/chromiumos/platform/vboot_reference', + 'all', + 'build/futility/futility', + ['USE_FLASHROM=0']) return fname, tmpdir

Hi Simon,
On 9/10/22 00:05, Simon Glass wrote:
A binary download is not great, since it depends on libraries being present in the system. Build futility from source instead.
Note that this requires two patches to the source repo which are in progress:
https://urldefense.proofpoint.com/v2/url?u=https-3A__issuetracker.google.com_issues_245993083-3Fpli-3D1&d=DwIDAg&c=_sEr5x9kUWhuk4_nFwjJtA&r=LYjLexDn7rXIzVmkNPvw5ymA1XTSqHGq8yBP6m6qZZ4njZguQhZhkI_-172IIy1t&m=A_mBPAQjfFAXjpZ6x2POOl9RCWLW2ALAs4IP-iUY-wA_vTYdtbYQ_HZKM3oAaZJl&s=8akpSehhQ-MLguodHI9O5Z6fqCenIvp1HSpsz4C6Fc0&e=
Signed-off-by: Simon Glass sjg@chromium.org
tools/binman/bintool.py | 10 +++++++--- tools/binman/btool/futility.py | 9 ++++++--- 2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/tools/binman/bintool.py b/tools/binman/bintool.py index 032179a99de..a582d9d3446 100644 --- a/tools/binman/bintool.py +++ b/tools/binman/bintool.py @@ -319,7 +319,7 @@ class Bintool: return result.stdout
@classmethod
- def build_from_git(cls, git_repo, make_target, bintool_path):
def build_from_git(cls, git_repo, make_target, bintool_path, flags=None): """Build a bintool from a git repo
This clones the repo in a temporary directory, builds it with 'make',
@@ -330,6 +330,7 @@ class Bintool: make_target (str): Target to pass to 'make' to build the tool 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 Returns: tuple:
@@ -341,8 +342,11 @@ class Bintool: print(f"- clone git repo '{git_repo}' to '{tmpdir}'") tools.run('git', 'clone', '--depth', '1', git_repo, tmpdir) print(f"- build target '{make_target}'")
tools.run('make', '-C', tmpdir, '-j', f'{multiprocessing.cpu_count()}',
make_target)
cmd = ['make', '-C', tmpdir, '-j', f'{multiprocessing.cpu_count()}',
make_target]
if flags:
cmd += flags
tools.run(*cmd) fname = os.path.join(tmpdir, bintool_path) if not os.path.exists(fname): print(f"- File '{fname}' was not produced")
diff --git a/tools/binman/btool/futility.py b/tools/binman/btool/futility.py index 75a05c2ac66..f88139a0ab5 100644 --- a/tools/binman/btool/futility.py +++ b/tools/binman/btool/futility.py @@ -160,8 +160,11 @@ class Bintoolfutility(bintool.Bintool): Raises: Valuerror: Fetching could not be completed """
if method != bintool.FETCH_BIN:
if method != bintool.FETCH_BUILD: return None
fname, tmpdir = self.fetch_from_drive(
'1hdsInzsE4aJbmBeJ663kYgjOQyW1I-E0')
result = self.build_from_git(
'https://urldefense.proofpoint.com/v2/url?u=https-3A__chromium.googlesource.com_a_chromiumos_platform_vboot-5Freference&d=DwIDAg&c=_sEr5x9kUWhuk4_nFwjJtA&r=LYjLexDn7rXIzVmkNPvw5ymA1XTSqHGq8yBP6m6qZZ4njZguQhZhkI_-172IIy1t&m=A_mBPAQjfFAXjpZ6x2POOl9RCWLW2ALAs4IP-iUY-wA_vTYdtbYQ_HZKM3oAaZJl&s=2Kwovwvh7xEhd6nLTLtkXQB1eCy4XTe1faJDfFeSmdo&e= ',
It seems I cannot access the source without an account.
Cheers, Quentin
participants (2)
-
Quentin Schulz
-
Simon Glass