Call scan_mtd_devices() devices after preinstall scripts are executed
diff mbox series

Message ID fd6e8309e8724ff689e5176564402325@Kemp-ExMb1.woodward.com
State Rejected
Headers show
Series
  • Call scan_mtd_devices() devices after preinstall scripts are executed
Related show

Commit Message

'Chmielewski Andreas' via swupdate July 18, 2019, 6:09 p.m. UTC
Hello,

Per https:// sbabic.github.io/swupdate/handlers.html#handler-for-ubi-volumes:
> If the storage is empty, it is required to setup the layout and create the volumes. 
> This can be easy done with a preinstall script. Building with meta-SWUpdate,
> the original mtd-utils are available and can be called by a Lua script. 

In current implementation it will not work because scan_mtd_devices() is called
before calling preinstall scripts.

Proposed patch below.

Best regards,
Lukasz Zemla

    Call scan_mtd_devices() devices after preinstall scripts are executed

    This will make possibility to create UBI volumes on blank
    flash by preinstall script - delayed scan_mtd_devices()
    will be able to notice them.

    Signed-off-by: Lukasz Zemla <Lukasz.Zemla@woodward.com>


***
The information in this email is confidential and intended solely for the individual or entity to whom it is addressed.  If you have received this email in error please notify the sender by return e-mail, delete this email, and refrain from any disclosure or action based on the information.
***

Patch
diff mbox series

diff --git a/core/swupdate.c b/core/swupdate.c
index 58218d0..10f6c44 100644
--- a/core/swupdate.c
+++ b/core/swupdate.c
@@ -362,10 +362,6 @@  static int install_from_file(char *fname, int check)
                exit(EXIT_SUCCESS);
        }

-#ifdef CONFIG_MTD
-               mtd_cleanup();
-               scan_mtd_devices();
-#endif
        /*
         * Set "recovery_status" as begin of the transaction"
         */
diff --git a/corelib/installer.c b/corelib/installer.c
index ff6cb18..78d7816 100644
--- a/corelib/installer.c
+++ b/corelib/installer.c
@@ -281,6 +281,11 @@  int install_images(struct swupdate_cfg *sw, int fdsw, int fromfile)
                }
        }

+#ifdef CONFIG_MTD
+               mtd_cleanup();
+               scan_mtd_devices();
+#endif
+
        LIST_FOREACH(img, &sw->images, next) {

                /*