* [PATCH 1/4] commands: ubimkvol: Add option for static volumes
@ 2016-06-22 9:02 Teresa Remmet
2016-06-22 9:02 ` [PATCH 2/4] mtd: UBI: Add support for updating " Teresa Remmet
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Teresa Remmet @ 2016-06-22 9:02 UTC (permalink / raw)
To: barebox
Creating static volumes in barebox already works,
only the option was missing.
Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
---
commands/ubi.c | 32 +++++++++++++++++++++++++-------
1 file changed, 25 insertions(+), 7 deletions(-)
diff --git a/commands/ubi.c b/commands/ubi.c
index 844d75d..f4ff5e7 100644
--- a/commands/ubi.c
+++ b/commands/ubi.c
@@ -13,24 +13,41 @@
static int do_ubimkvol(int argc, char *argv[])
{
+ int opt;
struct ubi_mkvol_req req;
int fd, ret;
uint64_t size;
- if (argc != 4)
+ req.vol_type = UBI_DYNAMIC_VOLUME;
+
+ while ((opt = getopt(argc, argv, "t:")) > 0) {
+ switch (opt) {
+ case 't':
+ if (!strcmp(optarg, "dynamic"))
+ req.vol_type = UBI_DYNAMIC_VOLUME;
+ else if (!strcmp(optarg, "static"))
+ req.vol_type = UBI_STATIC_VOLUME;
+ else
+ return COMMAND_ERROR_USAGE;
+ break;
+ default:
+ return COMMAND_ERROR_USAGE;
+ }
+ }
+
+ if (argc - optind < 3)
return COMMAND_ERROR_USAGE;
- size = strtoull_suffix(argv[3], NULL, 0);
- req.name_len = min_t(int, strlen(argv[2]), UBI_VOL_NAME_MAX);
- strncpy(req.name, argv[2], req.name_len);
+ size = strtoull_suffix(argv[optind+2], NULL, 0);
+ req.name_len = min_t(int, strlen(argv[optind+1]), UBI_VOL_NAME_MAX);
+ strncpy(req.name, argv[optind+1], req.name_len);
req.name[req.name_len] = 0;
- req.vol_type = UBI_DYNAMIC_VOLUME;
req.bytes = size;
req.vol_id = UBI_VOL_NUM_AUTO;
req.alignment = 1;
- fd = open(argv[1], O_WRONLY);
+ fd = open(argv[optind], O_WRONLY);
if (fd < 0) {
perror("open");
return 1;
@@ -48,12 +65,13 @@ static int do_ubimkvol(int argc, char *argv[])
BAREBOX_CMD_HELP_START(ubimkvol)
BAREBOX_CMD_HELP_TEXT("Create an UBI volume on UBIDEV with NAME and SIZE.")
BAREBOX_CMD_HELP_TEXT("If SIZE is 0 all available space is used for the volume.")
+BAREBOX_CMD_HELP_OPT("-t <static|dynamic>", "volume type, default is dynamic")
BAREBOX_CMD_HELP_END
BAREBOX_CMD_START(ubimkvol)
.cmd = do_ubimkvol,
BAREBOX_CMD_DESC("create an UBI volume")
- BAREBOX_CMD_OPTS("UBIDEV NAME SIZE")
+ BAREBOX_CMD_OPTS("[-t] UBIDEV NAME SIZE")
BAREBOX_CMD_GROUP(CMD_GRP_PART)
BAREBOX_CMD_HELP(cmd_ubimkvol_help)
BAREBOX_CMD_END
--
1.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/4] mtd: UBI: Add support for updating static volumes
2016-06-22 9:02 [PATCH 1/4] commands: ubimkvol: Add option for static volumes Teresa Remmet
@ 2016-06-22 9:02 ` Teresa Remmet
2016-06-23 6:36 ` Sascha Hauer
2016-06-22 9:02 ` [PATCH 3/4] commands: ubi: Add ubiupdatevol command Teresa Remmet
2016-06-22 9:02 ` [PATCH 4/4] ARM: am335x_defconfig: Enable ubi fastmap and ubifs Teresa Remmet
2 siblings, 1 reply; 8+ messages in thread
From: Teresa Remmet @ 2016-06-22 9:02 UTC (permalink / raw)
To: barebox
Added support to update UBI static volumes in barebox.
This is mainly realized with adding the ioctl UBI_IOCVOLUP.
Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
---
drivers/mtd/ubi/barebox.c | 56 +++++++++++++++++++++++++++++++++++++++++++++--
drivers/mtd/ubi/upd.c | 12 ----------
2 files changed, 54 insertions(+), 14 deletions(-)
diff --git a/drivers/mtd/ubi/barebox.c b/drivers/mtd/ubi/barebox.c
index 085e4a7..fc60aae 100644
--- a/drivers/mtd/ubi/barebox.c
+++ b/drivers/mtd/ubi/barebox.c
@@ -65,7 +65,10 @@ static ssize_t ubi_volume_cdev_write(struct cdev* cdev, const void *buf,
struct ubi_device *ubi = priv->ubi;
int err;
- if (!priv->written) {
+ if (!priv->written && !vol->updating) {
+ if (vol->vol_type == UBI_STATIC_VOLUME)
+ return -EROFS;
+
err = ubi_start_update(ubi, vol, vol->used_bytes);
if (err < 0) {
ubi_err(ubi, "Cannot start volume update");
@@ -104,7 +107,7 @@ static int ubi_volume_cdev_close(struct cdev *cdev)
int remaining = vol->usable_leb_size -
(priv->written % vol->usable_leb_size);
- if (remaining) {
+ if (remaining && vol->vol_type == UBI_DYNAMIC_VOLUME) {
void *buf = kmalloc(remaining, GFP_KERNEL);
if (!buf)
@@ -122,6 +125,9 @@ static int ubi_volume_cdev_close(struct cdev *cdev)
}
}
+ if (vol->vol_type == UBI_STATIC_VOLUME)
+ cdev->size = priv->written;
+
err = ubi_finish_update(ubi, vol);
if (err)
return err;
@@ -156,12 +162,54 @@ static loff_t ubi_volume_cdev_lseek(struct cdev *cdev, loff_t ofs)
return ofs;
}
+static int ubi_volume_cdev_ioctl(struct cdev *cdev, int cmd, void *buf)
+{
+ struct ubi_volume_cdev_priv *priv = cdev->priv;
+ struct ubi_device *ubi = priv->ubi;
+ struct ubi_volume *vol = priv->vol;
+ int err = 0;
+
+ switch (cmd) {
+ /* Volume update command */
+ case UBI_IOCVOLUP:
+ {
+ int64_t bytes, rsvd_bytes;
+
+ err = copy_from_user(&bytes, buf, sizeof(int64_t));
+ if (err) {
+ err = -EFAULT;
+ break;
+ }
+
+ rsvd_bytes = (long long)vol->reserved_pebs *
+ ubi->leb_size - vol->data_pad;
+
+ if (bytes < 0 || bytes > rsvd_bytes) {
+ err = -EINVAL;
+ break;
+ }
+
+ err = ubi_start_update(ubi, vol, bytes);
+ if (bytes == 0)
+ ubi_volume_notify(ubi, vol, UBI_VOLUME_UPDATED);
+
+ break;
+ }
+
+ default:
+ err = -ENOTTY;
+ break;
+ }
+ return err;
+}
+
static struct file_operations ubi_volume_fops = {
.open = ubi_volume_cdev_open,
.close = ubi_volume_cdev_close,
.read = ubi_volume_cdev_read,
.write = ubi_volume_cdev_write,
.lseek = ubi_volume_cdev_lseek,
+ .ioctl = ubi_volume_cdev_ioctl,
};
int ubi_volume_cdev_add(struct ubi_device *ubi, struct ubi_volume *vol)
@@ -179,6 +227,10 @@ int ubi_volume_cdev_add(struct ubi_device *ubi, struct ubi_volume *vol)
cdev->name = basprintf("%s.%s", ubi->cdev.name, vol->name);
cdev->priv = priv;
cdev->size = vol->used_bytes;
+
+ if (vol->vol_type == UBI_STATIC_VOLUME)
+ cdev->flags = DEVFS_IS_CHARACTER_DEV;
+
cdev->dev = &vol->dev;
ubi_msg(ubi, "registering %s as /dev/%s", vol->name, cdev->name);
ret = devfs_create(cdev);
diff --git a/drivers/mtd/ubi/upd.c b/drivers/mtd/ubi/upd.c
index 33d4dbf..e3deb3e 100644
--- a/drivers/mtd/ubi/upd.c
+++ b/drivers/mtd/ubi/upd.c
@@ -368,18 +368,6 @@ int ubi_more_update_data(struct ubi_device *ubi, struct ubi_volume *vol,
}
ubi_assert(vol->upd_received <= vol->upd_bytes);
- if (vol->upd_received == vol->upd_bytes) {
- err = ubi_wl_flush(ubi, UBI_ALL, UBI_ALL);
- if (err)
- return err;
- /* The update is finished, clear the update marker */
- err = clear_update_marker(ubi, vol, vol->upd_bytes);
- if (err)
- return err;
- vol->updating = 0;
- err = to_write;
- vfree(vol->upd_buf);
- }
return err;
}
--
1.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/4] commands: ubi: Add ubiupdatevol command
2016-06-22 9:02 [PATCH 1/4] commands: ubimkvol: Add option for static volumes Teresa Remmet
2016-06-22 9:02 ` [PATCH 2/4] mtd: UBI: Add support for updating " Teresa Remmet
@ 2016-06-22 9:02 ` Teresa Remmet
2016-06-23 6:43 ` Sascha Hauer
2016-06-22 9:02 ` [PATCH 4/4] ARM: am335x_defconfig: Enable ubi fastmap and ubifs Teresa Remmet
2 siblings, 1 reply; 8+ messages in thread
From: Teresa Remmet @ 2016-06-22 9:02 UTC (permalink / raw)
To: barebox
Add ubiupdatevol command. This is to update static
and dynamic volumes.
Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
---
commands/ubi.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/commands/ubi.c b/commands/ubi.c
index f4ff5e7..e727776 100644
--- a/commands/ubi.c
+++ b/commands/ubi.c
@@ -5,12 +5,64 @@
#include <ioctl.h>
#include <errno.h>
#include <getopt.h>
+#include <libfile.h>
#include <linux/mtd/mtd.h>
#include <linux/kernel.h>
+#include <linux/stat.h>
#include <linux/mtd/mtd-abi.h>
#include <mtd/ubi-user.h>
#include <mtd/ubi-media.h>
+static int do_ubiupdatevol(int argc, char *argv[])
+{
+ int fd_vol, ret;
+ uint64_t size = 0;
+ void *buf;
+
+ if (argc - optind < 2)
+ return COMMAND_ERROR_USAGE;
+
+ buf = read_file(argv[optind+1], (size_t *) &size);
+ if (!buf) {
+ perror("read");
+ return 1;
+ }
+
+ fd_vol = open(argv[optind], O_WRONLY);
+ if (fd_vol < 0) {
+ perror("open");
+ return 1;
+ }
+
+ ret = ioctl(fd_vol, UBI_IOCVOLUP, &size);
+ if (ret) {
+ printf("failed to start update: %s\n", strerror(-ret));
+ goto error;
+ }
+
+ ret = write(fd_vol, buf, size);
+ if (ret < 0)
+ perror("write");
+
+error:
+ close(fd_vol);
+ return ret ? 1 : 0;
+}
+
+
+BAREBOX_CMD_HELP_START(ubiupdatevol)
+BAREBOX_CMD_HELP_TEXT("Update UBI volume with an image.")
+BAREBOX_CMD_HELP_END
+
+BAREBOX_CMD_START(ubiupdatevol)
+ .cmd = do_ubiupdatevol,
+ BAREBOX_CMD_DESC("Update an UBI volume")
+ BAREBOX_CMD_OPTS("UBIVOL IMAGE")
+ BAREBOX_CMD_GROUP(CMD_GRP_PART)
+ BAREBOX_CMD_HELP(cmd_ubiupdatevol_help)
+BAREBOX_CMD_END
+
+
static int do_ubimkvol(int argc, char *argv[])
{
int opt;
--
1.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 4/4] ARM: am335x_defconfig: Enable ubi fastmap and ubifs
2016-06-22 9:02 [PATCH 1/4] commands: ubimkvol: Add option for static volumes Teresa Remmet
2016-06-22 9:02 ` [PATCH 2/4] mtd: UBI: Add support for updating " Teresa Remmet
2016-06-22 9:02 ` [PATCH 3/4] commands: ubi: Add ubiupdatevol command Teresa Remmet
@ 2016-06-22 9:02 ` Teresa Remmet
2 siblings, 0 replies; 8+ messages in thread
From: Teresa Remmet @ 2016-06-22 9:02 UTC (permalink / raw)
To: barebox
Enable support for ubifs and ubi fastmap.
Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
---
arch/arm/configs/am335x_defconfig | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/arch/arm/configs/am335x_defconfig b/arch/arm/configs/am335x_defconfig
index 96c6699..382133b 100644
--- a/arch/arm/configs/am335x_defconfig
+++ b/arch/arm/configs/am335x_defconfig
@@ -22,6 +22,10 @@ CONFIG_CMDLINE_EDITING=y
CONFIG_AUTO_COMPLETE=y
CONFIG_MENU=y
# CONFIG_TIMESTAMP is not set
+CONFIG_BOOTM_SHOW_TYPE=y
+CONFIG_BOOTM_VERBOSE=y
+CONFIG_BOOTM_INITRD=y
+CONFIG_BOOTM_OFTREE=y
CONFIG_BLSPEC=y
CONFIG_CONSOLE_ACTIVATE_NONE=y
CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
@@ -31,10 +35,6 @@ CONFIG_LONGHELP=y
CONFIG_CMD_IOMEM=y
CONFIG_CMD_MEMINFO=y
CONFIG_CMD_ARM_MMUINFO=y
-CONFIG_BOOTM_SHOW_TYPE=y
-CONFIG_BOOTM_VERBOSE=y
-CONFIG_BOOTM_INITRD=y
-CONFIG_BOOTM_OFTREE=y
# CONFIG_CMD_BOOTU is not set
CONFIG_CMD_BOOTZ=y
CONFIG_CMD_GO=y
@@ -108,6 +108,7 @@ CONFIG_MTD_M25P80=y
CONFIG_NAND=y
CONFIG_NAND_OMAP_GPMC=y
CONFIG_MTD_UBI=y
+CONFIG_MTD_UBI_FASTMAP=y
CONFIG_USB_HOST=y
CONFIG_USB_STORAGE=y
CONFIG_USB_GADGET=y
@@ -137,3 +138,6 @@ CONFIG_FS_NFS=y
CONFIG_FS_FAT=y
CONFIG_FS_FAT_WRITE=y
CONFIG_FS_FAT_LFN=y
+CONFIG_FS_UBIFS=y
+CONFIG_FS_UBIFS_COMPRESSION_LZO=y
+CONFIG_FS_UBIFS_COMPRESSION_ZLIB=y
--
1.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/4] mtd: UBI: Add support for updating static volumes
2016-06-22 9:02 ` [PATCH 2/4] mtd: UBI: Add support for updating " Teresa Remmet
@ 2016-06-23 6:36 ` Sascha Hauer
2016-06-23 12:11 ` Teresa Remmet
0 siblings, 1 reply; 8+ messages in thread
From: Sascha Hauer @ 2016-06-23 6:36 UTC (permalink / raw)
To: Teresa Remmet; +Cc: barebox
Hi Teresa,
On Wed, Jun 22, 2016 at 11:02:39AM +0200, Teresa Remmet wrote:
> Added support to update UBI static volumes in barebox.
> This is mainly realized with adding the ioctl UBI_IOCVOLUP.
>
> Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
> ---
> drivers/mtd/ubi/barebox.c | 56 +++++++++++++++++++++++++++++++++++++++++++++--
> drivers/mtd/ubi/upd.c | 12 ----------
> 2 files changed, 54 insertions(+), 14 deletions(-)
>
>
> int ubi_volume_cdev_add(struct ubi_device *ubi, struct ubi_volume *vol)
> @@ -179,6 +227,10 @@ int ubi_volume_cdev_add(struct ubi_device *ubi, struct ubi_volume *vol)
> cdev->name = basprintf("%s.%s", ubi->cdev.name, vol->name);
> cdev->priv = priv;
> cdev->size = vol->used_bytes;
> +
> + if (vol->vol_type == UBI_STATIC_VOLUME)
> + cdev->flags = DEVFS_IS_CHARACTER_DEV;
> +
> cdev->dev = &vol->dev;
> ubi_msg(ubi, "registering %s as /dev/%s", vol->name, cdev->name);
> ret = devfs_create(cdev);
> diff --git a/drivers/mtd/ubi/upd.c b/drivers/mtd/ubi/upd.c
> index 33d4dbf..e3deb3e 100644
> --- a/drivers/mtd/ubi/upd.c
> +++ b/drivers/mtd/ubi/upd.c
> @@ -368,18 +368,6 @@ int ubi_more_update_data(struct ubi_device *ubi, struct ubi_volume *vol,
> }
>
> ubi_assert(vol->upd_received <= vol->upd_bytes);
> - if (vol->upd_received == vol->upd_bytes) {
> - err = ubi_wl_flush(ubi, UBI_ALL, UBI_ALL);
> - if (err)
> - return err;
> - /* The update is finished, clear the update marker */
> - err = clear_update_marker(ubi, vol, vol->upd_bytes);
> - if (err)
> - return err;
> - vol->updating = 0;
> - err = to_write;
> - vfree(vol->upd_buf);
> - }
Why is this removed? Does it still work to just write to the UBI volume
without this?
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/4] commands: ubi: Add ubiupdatevol command
2016-06-22 9:02 ` [PATCH 3/4] commands: ubi: Add ubiupdatevol command Teresa Remmet
@ 2016-06-23 6:43 ` Sascha Hauer
2016-06-23 14:00 ` Teresa Remmet
0 siblings, 1 reply; 8+ messages in thread
From: Sascha Hauer @ 2016-06-23 6:43 UTC (permalink / raw)
To: Teresa Remmet; +Cc: barebox
On Wed, Jun 22, 2016 at 11:02:40AM +0200, Teresa Remmet wrote:
> Add ubiupdatevol command. This is to update static
> and dynamic volumes.
>
> Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
> ---
> commands/ubi.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 52 insertions(+)
>
> diff --git a/commands/ubi.c b/commands/ubi.c
> index f4ff5e7..e727776 100644
> --- a/commands/ubi.c
> +++ b/commands/ubi.c
> @@ -5,12 +5,64 @@
> #include <ioctl.h>
> #include <errno.h>
> #include <getopt.h>
> +#include <libfile.h>
> #include <linux/mtd/mtd.h>
> #include <linux/kernel.h>
> +#include <linux/stat.h>
> #include <linux/mtd/mtd-abi.h>
> #include <mtd/ubi-user.h>
> #include <mtd/ubi-media.h>
>
> +static int do_ubiupdatevol(int argc, char *argv[])
> +{
> + int fd_vol, ret;
> + uint64_t size = 0;
> + void *buf;
> +
> + if (argc - optind < 2)
> + return COMMAND_ERROR_USAGE;
> +
> + buf = read_file(argv[optind+1], (size_t *) &size);
> + if (!buf) {
> + perror("read");
> + return 1;
> + }
This limits us to files that fit into memory. Is it worth it to
read/write in a loop?
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/4] mtd: UBI: Add support for updating static volumes
2016-06-23 6:36 ` Sascha Hauer
@ 2016-06-23 12:11 ` Teresa Remmet
0 siblings, 0 replies; 8+ messages in thread
From: Teresa Remmet @ 2016-06-23 12:11 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
Hello Sascha,
Am Donnerstag, den 23.06.2016, 08:36 +0200 schrieb Sascha Hauer:
> Hi Teresa,
>
> On Wed, Jun 22, 2016 at 11:02:39AM +0200, Teresa Remmet wrote:
> > Added support to update UBI static volumes in barebox.
> > This is mainly realized with adding the ioctl UBI_IOCVOLUP.
> >
> > Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
> > ---
> > drivers/mtd/ubi/barebox.c | 56 +++++++++++++++++++++++++++++++++++++++++++++--
> > drivers/mtd/ubi/upd.c | 12 ----------
> > 2 files changed, 54 insertions(+), 14 deletions(-)
> >
>
> >
> > int ubi_volume_cdev_add(struct ubi_device *ubi, struct ubi_volume *vol)
> > @@ -179,6 +227,10 @@ int ubi_volume_cdev_add(struct ubi_device *ubi, struct ubi_volume *vol)
> > cdev->name = basprintf("%s.%s", ubi->cdev.name, vol->name);
> > cdev->priv = priv;
> > cdev->size = vol->used_bytes;
> > +
> > + if (vol->vol_type == UBI_STATIC_VOLUME)
> > + cdev->flags = DEVFS_IS_CHARACTER_DEV;
> > +
> > cdev->dev = &vol->dev;
> > ubi_msg(ubi, "registering %s as /dev/%s", vol->name, cdev->name);
> > ret = devfs_create(cdev);
> > diff --git a/drivers/mtd/ubi/upd.c b/drivers/mtd/ubi/upd.c
> > index 33d4dbf..e3deb3e 100644
> > --- a/drivers/mtd/ubi/upd.c
> > +++ b/drivers/mtd/ubi/upd.c
> > @@ -368,18 +368,6 @@ int ubi_more_update_data(struct ubi_device *ubi, struct ubi_volume *vol,
> > }
> >
> > ubi_assert(vol->upd_received <= vol->upd_bytes);
> > - if (vol->upd_received == vol->upd_bytes) {
> > - err = ubi_wl_flush(ubi, UBI_ALL, UBI_ALL);
> > - if (err)
> > - return err;
> > - /* The update is finished, clear the update marker */
> > - err = clear_update_marker(ubi, vol, vol->upd_bytes);
> > - if (err)
> > - return err;
> > - vol->updating = 0;
> > - err = to_write;
> > - vfree(vol->upd_buf);
> > - }
>
> Why is this removed? Does it still work to just write to the UBI volume
> without this?
writing directly to a dynamic volume never seem to hits this condition.
So this is not causing any problems. clearing updater marker and so on
is done later in ubi_volume_cdev_close(struct cdev *cdev).
Keeping this causes a assertion for static volumes as the update marker
is cleared twice.
Teresa
>
> Sascha
>
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/4] commands: ubi: Add ubiupdatevol command
2016-06-23 6:43 ` Sascha Hauer
@ 2016-06-23 14:00 ` Teresa Remmet
0 siblings, 0 replies; 8+ messages in thread
From: Teresa Remmet @ 2016-06-23 14:00 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
Hello Sascha,
Am Donnerstag, den 23.06.2016, 08:43 +0200 schrieb Sascha Hauer:
> On Wed, Jun 22, 2016 at 11:02:40AM +0200, Teresa Remmet wrote:
> > Add ubiupdatevol command. This is to update static
> > and dynamic volumes.
> >
> > Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
> > ---
> > commands/ubi.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 52 insertions(+)
> >
> > diff --git a/commands/ubi.c b/commands/ubi.c
> > index f4ff5e7..e727776 100644
> > --- a/commands/ubi.c
> > +++ b/commands/ubi.c
> > @@ -5,12 +5,64 @@
> > #include <ioctl.h>
> > #include <errno.h>
> > #include <getopt.h>
> > +#include <libfile.h>
> > #include <linux/mtd/mtd.h>
> > #include <linux/kernel.h>
> > +#include <linux/stat.h>
> > #include <linux/mtd/mtd-abi.h>
> > #include <mtd/ubi-user.h>
> > #include <mtd/ubi-media.h>
> >
> > +static int do_ubiupdatevol(int argc, char *argv[])
> > +{
> > + int fd_vol, ret;
> > + uint64_t size = 0;
> > + void *buf;
> > +
> > + if (argc - optind < 2)
> > + return COMMAND_ERROR_USAGE;
> > +
> > + buf = read_file(argv[optind+1], (size_t *) &size);
> > + if (!buf) {
> > + perror("read");
> > + return 1;
> > + }
>
> This limits us to files that fit into memory. Is it worth it to
> read/write in a loop?
I'll change it to a loop.
Teresa
>
> Sascha
>
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-06-23 14:01 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-22 9:02 [PATCH 1/4] commands: ubimkvol: Add option for static volumes Teresa Remmet
2016-06-22 9:02 ` [PATCH 2/4] mtd: UBI: Add support for updating " Teresa Remmet
2016-06-23 6:36 ` Sascha Hauer
2016-06-23 12:11 ` Teresa Remmet
2016-06-22 9:02 ` [PATCH 3/4] commands: ubi: Add ubiupdatevol command Teresa Remmet
2016-06-23 6:43 ` Sascha Hauer
2016-06-23 14:00 ` Teresa Remmet
2016-06-22 9:02 ` [PATCH 4/4] ARM: am335x_defconfig: Enable ubi fastmap and ubifs Teresa Remmet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox