diff options
| author | Daniel Dragomir <daniel.dragomir@windriver.com> | 2026-02-11 15:11:20 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2026-02-27 17:45:07 +0000 |
| commit | ac842282aaedd9cf61359f423139e250834a0e97 (patch) | |
| tree | 4e63527a5d1f6ae2f10d5361293fa1ab4fb132a7 | |
| parent | 6eea44a7fe2a37235887eac1c9a551deec394c41 (diff) | |
| download | poky-ac842282aaedd9cf61359f423139e250834a0e97.tar.gz | |
wic/engine: error on old host debugfs for standalone directory copy
When wic is used in standalone mode, it relies on host tools such as
debugfs. For directory host->image copies into ext* partitions, wic
uses scripted debugfs "-f" input with multiple mkdir/write commands.
Older host debugfs versions (< 1.46.5) may behave unreliably in this
mode and can silently miss files. This does not affect builds using
debugfs from OE where the version is known to be sufficiently new.
Add a debugfs version check and emit an error when an older host
debugfs is detected. The error is shown once per run and halts execution.
(From OE-Core rev: 977d68d2702f7092fa05d04f94da5fee8e0b2195)
Signed-off-by: Daniel Dragomir <daniel.dragomir@windriver.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit cb536737bee95d5a5072b501bda9554705e8cd13)
[YC: removed patch changelog]
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Paul Barker <paul@pbarker.dev>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | scripts/lib/wic/engine.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py index 565a0db38a..8ca8ed0dbd 100644 --- a/scripts/lib/wic/engine.py +++ b/scripts/lib/wic/engine.py | |||
| @@ -220,6 +220,34 @@ def wic_list(args, scripts_path): | |||
| 220 | 220 | ||
| 221 | return False | 221 | return False |
| 222 | 222 | ||
| 223 | _DEBUGFS_VERSION = None | ||
| 224 | |||
| 225 | def debugfs_version_check(debugfs_path, min_ver=(1, 46, 5)): | ||
| 226 | global _DEBUGFS_VERSION | ||
| 227 | |||
| 228 | if _DEBUGFS_VERSION is None: | ||
| 229 | out = "" | ||
| 230 | for flag in ("-V", "-v"): | ||
| 231 | try: | ||
| 232 | out = exec_cmd(f"{debugfs_path} {flag}") | ||
| 233 | break | ||
| 234 | except Exception: | ||
| 235 | continue | ||
| 236 | |||
| 237 | import re | ||
| 238 | m = re.search(r"(\d+)\.(\d+)\.(\d+)", out or "") | ||
| 239 | _DEBUGFS_VERSION = tuple(map(int, m.groups())) if m else None | ||
| 240 | |||
| 241 | ver = _DEBUGFS_VERSION | ||
| 242 | |||
| 243 | if ver is not None and ver < min_ver: | ||
| 244 | raise WicError( | ||
| 245 | "Sorry, debugfs 1.46.5 or later is required for this script. " | ||
| 246 | "Older versions of debugfs can make directory copies into ext* partitions " | ||
| 247 | "via scripted debugfs (-f) unreliable or broken. Detected version: %s" | ||
| 248 | % (".".join(map(str, ver)) if ver else "unknown") | ||
| 249 | ) | ||
| 250 | |||
| 223 | 251 | ||
| 224 | class Disk: | 252 | class Disk: |
| 225 | def __init__(self, imagepath, native_sysroot, fstypes=('fat', 'ext')): | 253 | def __init__(self, imagepath, native_sysroot, fstypes=('fat', 'ext')): |
| @@ -334,6 +362,7 @@ class Disk: | |||
| 334 | if self.partitions[pnum].fstype.startswith('ext'): | 362 | if self.partitions[pnum].fstype.startswith('ext'): |
| 335 | if isinstance(src, str): # host to image case | 363 | if isinstance(src, str): # host to image case |
| 336 | if os.path.isdir(src): | 364 | if os.path.isdir(src): |
| 365 | debugfs_version_check(self.debugfs) | ||
| 337 | base = os.path.abspath(src) | 366 | base = os.path.abspath(src) |
| 338 | base_parent = os.path.dirname(base) | 367 | base_parent = os.path.dirname(base) |
| 339 | cmds = [] | 368 | cmds = [] |
