0

To update a ubifs volume by replacing it with entirely new content, ubiupdatevol from mtd-utils can be used:

ubiupdatevol /dev/ubiX_Y /path/to/ubifs.img

Is there a way to apply patch on ubifs volume instead of relacing the complete content? For instance, apply only the binary diff b/w ubifs_base.img and ubifs_dest.img on /dev/ubiX_Y.

0

Not using the volume update API, no. According to the docs, userland must stream the entire volume size before the update is committed:

To update a volume, you first have to call the UBI_IOCVOLUP ioctl of the corresponding UBI volume character device and pass it a pointer to a 64-bit value containing the length of the new volume contents in bytes. Then this amount of bytes has to be written to the volume character device. Once the last byte has been send to the character device, the update operation is finished. Schematically, the sequence is:

fd = open("/dev/my_volume");
ioctl(fd, UBI_IOCVOLUP, &image_size);
write(fd, buf, image_size);
close(fd);

See include/mtd/ubi-user.h for more details. Bear in mind, the old contents of the volume is not preserved in case of an interrupted update. Also, you do not have to write all new data at one go.

So you could definitely do a delta update, but you'd need to create a utility that streams the unchanged parts from another source, because once you start the volume update operation, you have to write the whole thing. Or, if you don't feel like using the API, you could create the new image in temporary storage, and ubiupdatevol with that.

In practice, by the way, it's possible that UBI could elide the writes to the unchanged parts. But you still have to send them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.