<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mtd-utils.git/ubi-utils/ubiformat.c, branch v2.3.1</title>
<subtitle>A mirror of http://git.infradead.org/mtd-utils.git</subtitle>
<id>https://git.infraroot.at/mtd-utils.git/atom?h=v2.3.1</id>
<link rel='self' href='https://git.infraroot.at/mtd-utils.git/atom?h=v2.3.1'/>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/'/>
<updated>2020-01-30T10:23:02+00:00</updated>
<entry>
<title>libubi: remove private kernel header from includes</title>
<updated>2020-01-30T10:23:02+00:00</updated>
<author>
<name>Bastian Germann</name>
<email>bastiangermann@fishpost.de</email>
</author>
<published>2020-01-29T18:50:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=42e051acd32c28c2f93c946d0c4bf6f9eada2aa4'/>
<id>urn:sha1:42e051acd32c28c2f93c946d0c4bf6f9eada2aa4</id>
<content type='text'>
libubi.h includes ubi-media.h which was made private in the kernel a
long time ago. There are users of libubi.h, e.g. swupdate, which have to
have ubi-media.h available at build time with this inclusion.

However, libubi.h uses only one symbol from ubi-media.h. Define that symbol
in the header to enable using libubi.h without installing ubi-media.h.

Make up for the transitive symbol use in ubiformat.c by including ubi-media.h.

Signed-off-by: Bastian Germann &lt;bastiangermann@fishpost.de&gt;
Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>mtd-utils: Fix return value of ubiformat</title>
<updated>2020-01-13T09:37:37+00:00</updated>
<author>
<name>Barry Grussling</name>
<email>barry@grussling.com</email>
</author>
<published>2020-01-12T20:33:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=95633c4dfe943a701d4fcd809e6cabf4bf8710b8'/>
<id>urn:sha1:95633c4dfe943a701d4fcd809e6cabf4bf8710b8</id>
<content type='text'>
This changeset fixes a feature regression in ubiformat.  Older versions of
ubiformat, when invoked with a flash-image, would return 0 in the case no error
was encountered.  Upon upgrading to latest, it was discovered that ubiformat
returned 255 even without encountering an error condition.

This changeset corrects the above issue and causes ubiformat, when given an
image file, to return 0 when no errors are detected.

Tested by running through my loading scripts and verifying ubiformat returned
0.

Signed-off-by: Barry Grussling &lt;barry@grussling.com&gt;
Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>ubiformat: don't leak file descriptors</title>
<updated>2019-11-10T14:30:04+00:00</updated>
<author>
<name>David Oberhollenzer</name>
<email>david.oberhollenzer@sigma-star.at</email>
</author>
<published>2019-11-10T13:52:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=af06f37bdee2097d23832da99a3e7725de2f695e'/>
<id>urn:sha1:af06f37bdee2097d23832da99a3e7725de2f695e</id>
<content type='text'>
The original code had a 'goto out_close' directly after a return error
code, which is obviously not what was intended.

Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>ubiformat: Dont ignore sequence number CLI option</title>
<updated>2019-05-13T06:27:22+00:00</updated>
<author>
<name>Amol Vengurlekar</name>
<email>amolsven@gmail.com</email>
</author>
<published>2019-05-13T00:59:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=51d8c731a20a6fbb1f746a166a85a07a7063d0e8'/>
<id>urn:sha1:51d8c731a20a6fbb1f746a166a85a07a7063d0e8</id>
<content type='text'>
Image sequence number for the UBI header can be specified for the
ubiformat tool according to the documentation and the help message for
ubiformat. The CLI option --image-seq for image sequence number is not
supported. -Q option for image sequence number is silently ignored.
This patch adds the CLI support for image sequence number.

Signed-off-by: Amol Vengurlekar &lt;amol.sven@gmail.com&gt;
Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>mtd-utils: avoid to create two UBI_LAYOUT_VOLUME_ID volume</title>
<updated>2019-01-25T11:50:13+00:00</updated>
<author>
<name>Yufen Yu</name>
<email>yuyufen@huawei.com</email>
</author>
<published>2019-01-25T07:01:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=4a5a10a3dfe13d3f546ee4acbe2a96054ae423f7'/>
<id>urn:sha1:4a5a10a3dfe13d3f546ee4acbe2a96054ae423f7</id>
<content type='text'>
When we create a ubi image by ubinize, a UBI_LAYOUT_VOLUME_ID
volume will be created by ubigen_write_layout_vol().
However, after the commit 4c00cf2c5816 (ubiformat: remove
no-volume-table option), ubiformat remove novtbl args in format().
As a result, it will also create a layout volume.

When we attempt to do ubiattach, it will fail for ubi_compare_lebs error:
ubi0 error: ubi_compare_lebs: unsupported on-flash UBI format
ubi0 error: ubi_attach_mtd_dev: failed to attach mtd1, error -22

Signed-off-by: Yufen Yu &lt;yuyufen@huawei.com&gt;
Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>ubiformat: remove no-volume-table option</title>
<updated>2018-05-12T20:17:16+00:00</updated>
<author>
<name>David Oberhollenzer</name>
<email>david.oberhollenzer@sigma-star.at</email>
</author>
<published>2018-05-12T20:17:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=4c00cf2c5816b69754bf7304edcd0e3eb604e3b3'/>
<id>urn:sha1:4c00cf2c5816b69754bf7304edcd0e3eb604e3b3</id>
<content type='text'>
Using the -n or --no-volume-table flags, ubiformat can format an mtd device
to a broken UBI that does not attach on recent kernel. Only very old UBIs
had no volume table.

This patch removes the option entirely from ubiformat.

Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>ubiformat: process command line arguments first</title>
<updated>2018-05-12T19:59:19+00:00</updated>
<author>
<name>David Oberhollenzer</name>
<email>david.oberhollenzer@sigma-star.at</email>
</author>
<published>2018-05-12T19:51:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=b7c71d8541bf5830afe36e3fa5a925c4b78df04a'/>
<id>urn:sha1:b7c71d8541bf5830afe36e3fa5a925c4b78df04a</id>
<content type='text'>
If libmtd_open fails, the program always exists with failure status
and prints "MTD subsystem is not present".

Even `ubiformat --help` produces the same result, which is definitely
undesired.

This patch moves command line option processing first to get the desired
behavior.

Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>ubi-utils: ubiformat.c: convert to integer arithmetic</title>
<updated>2018-01-30T08:24:22+00:00</updated>
<author>
<name>Andrea Adami</name>
<email>andrea.adami@gmail.com</email>
</author>
<published>2018-01-29T22:07:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=c75d1044ea8a04e6808e20814a92beb8657c8f95'/>
<id>urn:sha1:c75d1044ea8a04e6808e20814a92beb8657c8f95</id>
<content type='text'>
Do not cast percent to double, it is just used as upper limit.
Avoid floating point to fix compilation for aarch64 against klibc:

error: '-mgeneral-regs-only' is incompatible with floating-point code
|    int percent = ((double)si-&gt;ok_cnt)/si-&gt;good_cnt * 100;
|        ^~~~~~~

Notes:
* The checks in the code above this line ensure that si-&gt;good_cnt is not 0.

* The code assumes  si-&gt;good_cnt * 100  will not overflow, then we can use
  (si-&gt;ok_cnt * 100) safely because the former is bigger.

* The truncated result does not affect the logic:
  i.e. a value of 49.9 is truncated to 49 and is still &lt;50.

Signed-off-by: Andrea Adami &lt;andrea.adami@gmail.com&gt;
Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>ubi-utils: Return error code if command line option is unknown</title>
<updated>2017-06-14T09:00:30+00:00</updated>
<author>
<name>Daniel Wagner</name>
<email>daniel.wagner@siemens.com</email>
</author>
<published>2017-06-12T10:50:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=76e27a79eddb6279bbbc0ec840d66b753a9ba0f3'/>
<id>urn:sha1:76e27a79eddb6279bbbc0ec840d66b753a9ba0f3</id>
<content type='text'>
The tools in question will quit with an exit code 0 if the command
line option was not recognized. By returning an error code a calling
script has the possibility to distinguish between a real success and
an invalid invocation.

We need to return -1 instead of EXIT_FAILURE to be consistent with the
other exit code places.

Signed-off-by: Daniel Wagner &lt;daniel.wagner@siemens.com&gt;
Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>Fix libmtd behaviour if MTD is not present on the system</title>
<updated>2017-03-15T11:10:34+00:00</updated>
<author>
<name>David Oberhollenzer</name>
<email>david.oberhollenzer@sigma-star.at</email>
</author>
<published>2017-03-15T10:26:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=a2eeedb0a7af1d8ebe8593cb9a9bb994d2854e63'/>
<id>urn:sha1:a2eeedb0a7af1d8ebe8593cb9a9bb994d2854e63</id>
<content type='text'>
The documentation of libmtd_open says, if it returns NULL and errno is
zero, MTD is not present. However, the current version always returns
a libmtd_t object. The function internally checks, if it can access the
MTD sysfs files and, if not, sets a flag to use the procfs fallback.

This patch adds an additional check to libmtd_open, to test if the
MTD procfs file can be read and fails with errno cleared if it does
not exist.

Furhtermore, mtd_get_info is documented to fail with errno set to ENODEV
if MTD is not present. First of all, this was broken in the original
version. It was implemented to specification for the sysfs code path,
but if MTD is not present, that won't be executed, because of the flag
set by libmtd_open. This makes the check not only redundant, but masks
an actual error (the sysfs paths suddenly not being readable anymore).
The legacy path that was used if the sysfs files are not avaible fails
with ENOENT if it cannot read the procfs file. With the above changes
in addition, we don't have a libmtd_t object if neither sysfs nor
procfs is readable, so this error status no longer makes sense.

This patch removes the documentation on the ENODEV errno, and
makes sure that mtd_get_info always returns with apropriate errno
on failure.

Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
</feed>
