Re: Block based OTA update needs mtdblock
From: Pintu Agarwal
Date: Thu Dec 05 2024 - 02:43:29 EST
Hi Richard,
On Wed, 4 Dec 2024 at 15:46, Richard Weinberger <richard@xxxxxx> wrote:
>
> ----- Ursprüngliche Mail -----
> > Von: "Pintu Agarwal" <pintu.ping@xxxxxxxxx>
> >> >> Did anybody used block based OTA update NAND A/B system without using
> >> >> mtd_block ?
> >> >
> >> > Not on my side, it is actually a good question. Richard, any ideas?
> >>
> >> What about using ubiupdatevol?
> >>
> > As I explained above, ubiupdatevol actually performs a full volume
> > update, right ?
> > I think the partial/incremental update is not possible with this. Once
> > the update is triggered it should finish fully.
> > But for OTA updates (Delta/Incremental), only the delta changes can
> > also be applied.
> > Please refer to this [1] about updates mechanism.
> > [1] https://medium.com/@yigitpirildak/android-ota-update-mechanism-ecc8f6f69f71
> > [2]
> > https://source.android.com/docs/core/ota/tools#:~:text=An%20incremental%20update%20is%20an,need%20to%20include%20unchanged%20files.
> >
> > On our NAND target we support OTA updates, including incremental ota updates.
> > But without mtdblock the incremental OTA update (on A/B system) will not work.
> > This is the main issue.
> > For full updates on ubi volumes we are already using the
> > "ubiupdatevol" mechanism.
>
> Well, for dynamic volumes you can use the UBI_IOCEBCH ioctl to replace LEBs.
> So, incremental updates are doable too.
>
Oh I see. This seems useful. I will try it and confirm if it works for us.
Thank you so much for this.
Even the header file (/usr/include/mtd/ubi-user.h) mentions these details.
{{{
* Atomic logical eraseblock change
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* Atomic logical eraseblock change operation is called using the %UBI_IOCEBCH
* ioctl command of the corresponding UBI volume character device. A pointer to
* a &struct ubi_leb_change_req object has to be passed to the ioctl. Then the
* user is expected to write the requested amount of bytes (similarly to what
* should be done in case of the "volume update" ioctl).
...
/* Atomic LEB change command */
#define UBI_IOCEBCH _IOW(UBI_VOL_IOC_MAGIC, 2, __s32)
* @lnum: logical eraseblock number to change
struct ubi_leb_change_req {
__s32 lnum;
__s32 bytes;
__s8 dtype; /* obsolete, do not use! */
__s8 padding[7];
} __attribute__((packed));
}}}
This requires the logical erase-block number to be known.
I am wondering how to get the LEB number from user space.
I need to explore further..
Thank you so much...
Regards,
Pintu