From d0a4ffcb5d5072d3b5e4838cb868292f6b85ad9d Mon Sep 17 00:00:00 2001 From: Daniel Rossier Date: Thu, 16 Jul 2026 10:49:48 +0200 Subject: [PATCH] bsp: auto-initialise storage on deploy, clearer error otherwise do_deploy went straight to mounting the SD-card image, so a deploy on a fresh tree failed with a bare "sdcard.img. does not exist" when the storage had never been initialised. Make deploy depend on an initialised storage: __do_deploy_boot() now calls __do_fs_check() before mounting, which in "soft" mode creates the image on the fly (same work as scripts/init_storage.sh). deploy.sh has already opened a sudo session, so the losetup/mkfs run fine. A single 'deploy.sh -a bsp-so3' now works end-to-end on a fresh checkout. As a safety net (and for "hard" mode), the ENOENT path in __do_fs_mount() now names the platform and points at ./scripts/init_storage.sh instead of the terse "does not exist". Also demote the misleading "WARNING: Now mounting" to a plain note. --- build/meta-bsp/classes/bsp.bbclass | 8 +++++++- build/meta-filesystem/classes/fs_arm_common.bbclass | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/build/meta-bsp/classes/bsp.bbclass b/build/meta-bsp/classes/bsp.bbclass index 678aa173f..83787bf9d 100644 --- a/build/meta-bsp/classes/bsp.bbclass +++ b/build/meta-bsp/classes/bsp.bbclass @@ -176,7 +176,13 @@ addtask do_deploy_boot_chain before do_deploy def __do_deploy_boot(d): if d.getVar('IB_STORAGE_MODE') not in ("remote", "http"): - bb.warn("Now mounting") + # Make deploy depend on an initialised storage. In "soft" mode this + # creates sdcard.img. on the fly when it is missing (the + # same work as scripts/init_storage.sh), so a fresh tree can deploy + # without a separate manual init step. deploy.sh already opened a + # sudo session, so the losetup/mkfs done here via `sudo -n` succeeds. + __do_fs_check(d) + bb.plain("Mounting storage") __do_fs_mount(d) __do_platform_deploy(d) diff --git a/build/meta-filesystem/classes/fs_arm_common.bbclass b/build/meta-filesystem/classes/fs_arm_common.bbclass index b82717add..03018982b 100644 --- a/build/meta-filesystem/classes/fs_arm_common.bbclass +++ b/build/meta-filesystem/classes/fs_arm_common.bbclass @@ -169,7 +169,13 @@ def __do_fs_mount(d): os.stat(img_path) except OSError as e: if e.errno == errno.ENOENT: - bb.fatal(f"{img_path} does not exist") + bb.fatal( + f"Storage image '{img_path}' does not exist: the filesystem " + f"for platform '{IB_PLATFORM}' has not been initialised yet.\n" + f"Deploy normally creates it automatically; if you reach this, " + f"initialise the storage explicitly by running:\n" + f" ./scripts/init_storage.sh\n" + f"then run the deploy again.") p1 = os.path.join(WORKDIR, "p1") p2 = os.path.join(WORKDIR, "p2")