From 1273e4c027888497fa14037a25cf20d16f75bfb4 Mon Sep 17 00:00:00 2001 From: NickeZ Agent Date: Thu, 12 Nov 2026 14:59:21 +0100 Subject: [PATCH] build: copy image binaries to build/bin Built images live in product-specific directories, and firmware filenames do not identify the product or edition. Provide one location for collecting binaries from the top-level Make commands. Copy BitBox02 and Nova images into build/bin after successful builds. Name firmware -.bin and factory setup factory-setup-.bin, retaining variant names for bootloaders and upgrade firmware. Debug and non-debug builds update the same output paths. CMake outputs, targets, and build directories remain unchanged. --- BUILD.md | 6 ++++++ scripts/build_product.py | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/BUILD.md b/BUILD.md index 80ee0a3ef1..1202b44a47 100644 --- a/BUILD.md +++ b/BUILD.md @@ -234,6 +234,12 @@ software or SWD speed does not affect compilation. Configuration never cleans. ` build trees but preserves `config.mk`. Host tests and simulators still use `build-build` and `build-build-noasan`. +BitBox02/Nova Make builds also copy the binary to `build/bin`. Firmware is named +`-.bin`, for example `bitbox02-multi.bin` or `bitbox02nova-btconly.bin`. +Factorysetup is named `factory-setup-.bin`; bootloaders and upgrade firmware retain their +existing variant names. Both debug and non-debug builds update the same destination with the latest +binary. CMake output names and directories remain unchanged. + Use `bootloader-stage0` and `bootloader-stage1` with `LOCKED=yes DEVELOPMENT=no` for production bootloaders, or `LOCKED=yes DEVELOPMENT=yes` for locked development devices. These targets build only the configured product and edition. Development artifact names use `-development`, with diff --git a/scripts/build_product.py b/scripts/build_product.py index 5142c41764..019d4c648e 100644 --- a/scripts/build_product.py +++ b/scripts/build_product.py @@ -53,11 +53,23 @@ def cmake(config: Config, profile: str, targets: list[str]) -> None: run(["make", "-C", str(directory), *targets]) +def copy_binary(source: Path, name: str) -> None: + directory = ROOT / "build" / "bin" + run(["mkdir", "-p", str(directory)]) + run(["cp", str(source), str(directory / f"{name}.bin")]) + + def build_image(config: Config, image: str) -> None: profile = config.profile info = image_info(config, image) if config.product != "bitbox03": cmake(config, profile, [f"{info.name}.elf"]) + name = info.name + if image == "firmware": + name = f"{config.product}-{config.edition.replace('-', '')}" + elif image == "factorysetup": + name = f"factory-setup-{config.product}" + copy_binary(info.elf.with_suffix(".bin"), name) return config.describe() run([str(ROOT / "scripts/bootstrap-cargo-config")]) @@ -85,6 +97,7 @@ def dispatch(config: Config, target: str) -> None: elif target.startswith("firmware-blupgrade-"): product = target.split("-")[2] cmake(defaults(product), "relwithdebinfo", [target + ".elf"]) + copy_binary(build_dir(defaults(product)) / "bin" / f"{target}.bin", target) elif target in ("bootloader-upgrade-assets", "bootloader-upgrade-assets-development"): suffix = "-development" if target.endswith("-development") else "" for product in ("bitbox02", "bitbox02nova"):