diff mbox series

RE: [PATCH] Call scan_mtd_devices() devices after preinstall scripts are executed

Message ID 163ef0af1e2142b58c6ae14644c8f658@Kemp-ExMb1.woodward.com
State Rejected
Headers show
Series RE: [PATCH] Call scan_mtd_devices() devices after preinstall scripts are executed | expand

Commit Message

'Darko Komljenovic' via swupdate July 18, 2019, 6:20 p.m. UTC
On  Thursday, July 18, 2019 8:10 PM Lukasz Zemla wrote:
> 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>
> 
> 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) {
> 
>                 /*
> 
> 

Corrected indentation below:

    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.
***

Comments

Stefano Babic July 19, 2019, 11:01 a.m. UTC | #1
On 18/07/19 20:20, 'Lukasz Zemla' via swupdate wrote:
> On  Thursday, July 18, 2019 8:10 PM Lukasz Zemla wrote:
>> 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>
>>
>> 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) {
>>
>>                 /*
>>
>>
> 
> Corrected indentation below:
> 
>     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>
> 
> 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..5c31d18 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) {
> 
>                 /*
> 
> ***

It is not the way to submit patches, but patchworks can work it and put
it into its database. That's fine.

However, we have already discussed about the topic. SWUpdate has already
support for UBI and volumes, and a missing feature should be better
integrate into current workflow as demanded to an external script.

What you need is just to force that a MTD must be UBI, that means a UBI
attach should not fail. If fail, a reformat should take place. I will
suggest to rework the meaning of "whitelist" for the UBI device to reach
the goal - if a device is in the whitelist and ubiattach fails(), the
MTD is formatted.


> 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.

Please drop these lines when you are submitting patches - thanks !

I know that are automatically added, but if a patch contains these
lines, I do not know anymore if I legally allowed to apply a patch or
not, and it is against the rules for submitting patches.

Best regards,
Stefano Babic
diff mbox series

Patch

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..5c31d18 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) {

                /*