<feed xmlns='http://www.w3.org/2005/Atom'>
<title>u-boot.git/tools/env, branch v2026.01</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/'/>
<entry>
<title>envtools: make them build again</title>
<updated>2024-10-22T02:51:23+00:00</updated>
<author>
<name>Rasmus Villemoes</name>
<email>ravi@prevas.dk</email>
</author>
<published>2024-10-16T15:10:35+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=6606a6adfaf8517cff7e5fe0fb206beed80087d5'/>
<id>6606a6adfaf8517cff7e5fe0fb206beed80087d5</id>
<content type='text'>
In v2024.10, "make envtools" is broken for at least these defconfigs:

   am335x_evm_defconfig
   rpi_3_defconfig
   rpi_4_defconfig
   mx7dsabresd_defconfig
   wandboard_defconfig
   imx8mp_evk_defconfig

The only defconfig we use for which it is not broken is
stm32mp13_defconfig. They all work just fine in v2024.07.

The symptoms are slightly different, but all related to the fact that
some transitively included header uses IS_ENABLED or CONFIG_IS_ENABLED
without linux/kconfig.h having already been included.

A simple git bisect doesn't produce anything sensible, it ends up at
3a9f642ca94 (crypto: nuvoton: npcm_sha: Support SHA 384/512) which
clearly has nothing to do with this. But digging deeper, one
eventually finds 0f92fa45603 ("env: Remove &lt;common.h&gt; and add needed
includes").

So at first I tried adding "#include &lt;linux/kconfig.h&gt;" in
include/env_default.h and include/env_flags.h. That fixes it for some,
but not all, of the above. For example rpi_3_defconfig still fails,
then in log.h complaining about BIT() and u8 not being defined. At
least BIT() is should have gotten from bitops.h, except that that's
behind ifdef __KERNEL__, so not set for the envtools build.

It turns out that the envtools source code in fw_env_private.h already
has some hackery to deal with all this, in the form of the __ASSEMBLY__
games it plays before including config.h. It seems that if we just
make sure to do that include early enough, so that config.h is indeed
parsed with that __ASSEMBLY__ hackery in place, everything builds
fine.

Fixes: 0f92fa45603 ("env: Remove &lt;common.h&gt; and add needed includes")
Signed-off-by: Rasmus Villemoes &lt;ravi@prevas.dk&gt;
Reviewed-by: Tom Rini &lt;trini@konsulko.com&gt;
Reviewed-by: Fabio Estevam &lt;festevam@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In v2024.10, "make envtools" is broken for at least these defconfigs:

   am335x_evm_defconfig
   rpi_3_defconfig
   rpi_4_defconfig
   mx7dsabresd_defconfig
   wandboard_defconfig
   imx8mp_evk_defconfig

The only defconfig we use for which it is not broken is
stm32mp13_defconfig. They all work just fine in v2024.07.

The symptoms are slightly different, but all related to the fact that
some transitively included header uses IS_ENABLED or CONFIG_IS_ENABLED
without linux/kconfig.h having already been included.

A simple git bisect doesn't produce anything sensible, it ends up at
3a9f642ca94 (crypto: nuvoton: npcm_sha: Support SHA 384/512) which
clearly has nothing to do with this. But digging deeper, one
eventually finds 0f92fa45603 ("env: Remove &lt;common.h&gt; and add needed
includes").

So at first I tried adding "#include &lt;linux/kconfig.h&gt;" in
include/env_default.h and include/env_flags.h. That fixes it for some,
but not all, of the above. For example rpi_3_defconfig still fails,
then in log.h complaining about BIT() and u8 not being defined. At
least BIT() is should have gotten from bitops.h, except that that's
behind ifdef __KERNEL__, so not set for the envtools build.

It turns out that the envtools source code in fw_env_private.h already
has some hackery to deal with all this, in the form of the __ASSEMBLY__
games it plays before including config.h. It seems that if we just
make sure to do that include early enough, so that config.h is indeed
parsed with that __ASSEMBLY__ hackery in place, everything builds
fine.

Fixes: 0f92fa45603 ("env: Remove &lt;common.h&gt; and add needed includes")
Signed-off-by: Rasmus Villemoes &lt;ravi@prevas.dk&gt;
Reviewed-by: Tom Rini &lt;trini@konsulko.com&gt;
Reviewed-by: Fabio Estevam &lt;festevam@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tools: Remove duplicate newlines</title>
<updated>2024-07-15T18:12:18+00:00</updated>
<author>
<name>Marek Vasut</name>
<email>marek.vasut+renesas@mailbox.org</email>
</author>
<published>2024-07-13T13:19:34+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=b51be8ebcb4ac5605c03f409d5999601bc6244f5'/>
<id>b51be8ebcb4ac5605c03f409d5999601bc6244f5</id>
<content type='text'>
Drop all duplicate newlines. No functional change.

Signed-off-by: Marek Vasut &lt;marek.vasut+renesas@mailbox.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Drop all duplicate newlines. No functional change.

Signed-off-by: Marek Vasut &lt;marek.vasut+renesas@mailbox.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fw_env: autodetect NAND erase size and env sectors</title>
<updated>2024-01-05T20:41:47+00:00</updated>
<author>
<name>Anthony Loiseau</name>
<email>anthony.loiseau@allcircuits.com</email>
</author>
<published>2023-12-21T22:44:38+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=d73a6641868029b5cae53ed00c5766921c9d8b1f'/>
<id>d73a6641868029b5cae53ed00c5766921c9d8b1f</id>
<content type='text'>
As already done for NOR chips, if device ESIZE and ENVSECTORS static
configurations are both zero, then autodetect them at runtime.

Cc: Joe Hershberger &lt;joe.hershberger@ni.com&gt;
cc: Stefan Agner &lt;stefan@agner.ch&gt;
cc: Rasmus Villemoes &lt;rasmus.villemoes@prevas.dk&gt;
Signed-off-by: Anthony Loiseau &lt;anthony.loiseau@allcircuits.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As already done for NOR chips, if device ESIZE and ENVSECTORS static
configurations are both zero, then autodetect them at runtime.

Cc: Joe Hershberger &lt;joe.hershberger@ni.com&gt;
cc: Stefan Agner &lt;stefan@agner.ch&gt;
cc: Rasmus Villemoes &lt;rasmus.villemoes@prevas.dk&gt;
Signed-off-by: Anthony Loiseau &lt;anthony.loiseau@allcircuits.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fw_env: keep calling read() until whole flash block is read</title>
<updated>2024-01-05T20:41:47+00:00</updated>
<author>
<name>Rafał Miłecki</name>
<email>rafal@milecki.pl</email>
</author>
<published>2023-12-13T12:13:54+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=9e3003f79d168eac7ee65cd457e3904e2fb4eea8'/>
<id>9e3003f79d168eac7ee65cd457e3904e2fb4eea8</id>
<content type='text'>
It's totally valid for read() to provide less bytes than requested
maximum. It may happen if there is no more data available yet or source
pushes data in small chunks.

This actually happens when trying to read env data from NVMEM device.
Kernel may provide NVMEM content in page size parts (like 4096 B).

This fixes warnings like:
Warning on /sys/bus/nvmem/devices/u-boot-env0/nvmem: Attempted to read 16384 bytes but got 4096
Warning on /sys/bus/nvmem/devices/u-boot-env0/nvmem: Attempted to read 12288 bytes but got 4096
Warning on /sys/bus/nvmem/devices/u-boot-env0/nvmem: Attempted to read 8192 bytes but got 4096

Since the main loop in flash_read_buf() is used to read blocks this
patch adds a new nested one.

Signed-off-by: Rafał Miłecki &lt;rafal@milecki.pl&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It's totally valid for read() to provide less bytes than requested
maximum. It may happen if there is no more data available yet or source
pushes data in small chunks.

This actually happens when trying to read env data from NVMEM device.
Kernel may provide NVMEM content in page size parts (like 4096 B).

This fixes warnings like:
Warning on /sys/bus/nvmem/devices/u-boot-env0/nvmem: Attempted to read 16384 bytes but got 4096
Warning on /sys/bus/nvmem/devices/u-boot-env0/nvmem: Attempted to read 12288 bytes but got 4096
Warning on /sys/bus/nvmem/devices/u-boot-env0/nvmem: Attempted to read 8192 bytes but got 4096

Since the main loop in flash_read_buf() is used to read blocks this
patch adds a new nested one.

Signed-off-by: Rafał Miłecki &lt;rafal@milecki.pl&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fw_env: rename variables holding env data content</title>
<updated>2024-01-05T20:41:47+00:00</updated>
<author>
<name>Rafał Miłecki</name>
<email>rafal@milecki.pl</email>
</author>
<published>2023-12-13T09:23:44+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=73b30800f56883a26a24f87acb30d21cd4dd25d4'/>
<id>73b30800f56883a26a24f87acb30d21cd4dd25d4</id>
<content type='text'>
Rename "addr0" and "addr1" to "buf0" and "buf1" accordingly. Name "addr"
suggests that variable contains a numeric value being some kind of
address. Name "buf" is de facto a standard name for pointer to allocated
memory for reading data to.

While at it drop redundant checks for NULL before calling free().

Signed-off-by: Rafał Miłecki &lt;rafal@milecki.pl&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Rename "addr0" and "addr1" to "buf0" and "buf1" accordingly. Name "addr"
suggests that variable contains a numeric value being some kind of
address. Name "buf" is de facto a standard name for pointer to allocated
memory for reading data to.

While at it drop redundant checks for NULL before calling free().

Signed-off-by: Rafał Miłecki &lt;rafal@milecki.pl&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fw_env: fix reading NVMEM device's "compatible" value</title>
<updated>2024-01-05T20:41:47+00:00</updated>
<author>
<name>Rafał Miłecki</name>
<email>rafal@milecki.pl</email>
</author>
<published>2023-12-12T17:33:27+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=f29c5ca33df4c77b9af2cbfb7ed90bf336613522'/>
<id>f29c5ca33df4c77b9af2cbfb7ed90bf336613522</id>
<content type='text'>
Call to fread() was changed to check for return value. The problem is it
can't be checked for returning 1 (as it is) to determine success.

We call fread() with buffer size as "size" argument. Reading any
"compatible" value shorter than buffer size will result in returning 0
even on success.

Modify code to use fstat() to determine expected read length.

This fixes regression that broke using fw_env with NVMEM devices.

Fixes: c059a22b7776 ("tools: env: fw_env: Fix unused-result warning")
Cc: Jaehoon Chung &lt;jh80.chung@samsung.com&gt;
Signed-off-by: Rafał Miłecki &lt;rafal@milecki.pl&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Call to fread() was changed to check for return value. The problem is it
can't be checked for returning 1 (as it is) to determine success.

We call fread() with buffer size as "size" argument. Reading any
"compatible" value shorter than buffer size will result in returning 0
even on success.

Modify code to use fstat() to determine expected read length.

This fixes regression that broke using fw_env with NVMEM devices.

Fixes: c059a22b7776 ("tools: env: fw_env: Fix unused-result warning")
Cc: Jaehoon Chung &lt;jh80.chung@samsung.com&gt;
Signed-off-by: Rafał Miłecki &lt;rafal@milecki.pl&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Adjust gitignore for tools/generated/</title>
<updated>2023-07-07T20:25:56+00:00</updated>
<author>
<name>Tobias Deiminger</name>
<email>tdmg@linutronix.de</email>
</author>
<published>2023-06-19T22:41:03+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=c623642d29be5c8036104351d27cea6b55adf769'/>
<id>c623642d29be5c8036104351d27cea6b55adf769</id>
<content type='text'>
Tell git that auto-generated C sources are now exclusively expected
under tools/generated/.

Signed-off-by: Tobias Deiminger &lt;tdmg@linutronix.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Tell git that auto-generated C sources are now exclusively expected
under tools/generated/.

Signed-off-by: Tobias Deiminger &lt;tdmg@linutronix.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tools: env: update lock path in README</title>
<updated>2023-04-25T19:31:28+00:00</updated>
<author>
<name>John Keeping</name>
<email>john@metanate.com</email>
</author>
<published>2023-04-12T11:24:26+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=51e0cacca7b8039a6c37cbd6b5f77ac2e91045f2'/>
<id>51e0cacca7b8039a6c37cbd6b5f77ac2e91045f2</id>
<content type='text'>
Commit aeb40f1166e0 ("tools: env: use /run to store lockfile") updated the
path to the lockfile but did not update the documentation to match.

Use the new path in the documentation.

Fixes: aeb40f1166 ("tools: env: use /run to store lockfile")
Signed-off-by: John Keeping &lt;john@metanate.com&gt;
Reviewed-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Commit aeb40f1166e0 ("tools: env: use /run to store lockfile") updated the
path to the lockfile but did not update the documentation to match.

Use the new path in the documentation.

Fixes: aeb40f1166 ("tools: env: use /run to store lockfile")
Signed-off-by: John Keeping &lt;john@metanate.com&gt;
Reviewed-by: Simon Glass &lt;sjg@chromium.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tools: env: use /run to store lockfile</title>
<updated>2023-04-06T23:10:05+00:00</updated>
<author>
<name>Tim Lee</name>
<email>timlee660101@gmail.com</email>
</author>
<published>2023-02-10T09:05:39+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=aeb40f1166e072856f865d26d42a4bea1ec3a514'/>
<id>aeb40f1166e072856f865d26d42a4bea1ec3a514</id>
<content type='text'>
According this issue https://github.com/ppp-project/ppp/issues/339.
Eventually, the dt-utils changed lock directory to fix missing /var/lock
directory error then make dt-utils can run normally.

We also have a similar issue with these two utilities fw_printenv and
fw_setenv will failed when the directory /var/lock is non-existent.

We have a custom linux distribution built with yocto (OpenBMC) that
use systemd and it deprecated the /var/lock directory.
More discussion in systemd/systemd#15668.

Thus, we sync with community's solution for uboot/tools/env utilities:
The current location /var/lock is considered legacy (at least by systemd).
Just use /run to store the lockfile and append the usual .lock suffix.

Tested:
Verified /run/lock is now present and fw_printenv can work in OpenBMC.

Signed-off-by: Tim Lee &lt;timlee660101@gmail.com&gt;
Reviewed-by: Tom Rini &lt;trini@konsulko.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
According this issue https://github.com/ppp-project/ppp/issues/339.
Eventually, the dt-utils changed lock directory to fix missing /var/lock
directory error then make dt-utils can run normally.

We also have a similar issue with these two utilities fw_printenv and
fw_setenv will failed when the directory /var/lock is non-existent.

We have a custom linux distribution built with yocto (OpenBMC) that
use systemd and it deprecated the /var/lock directory.
More discussion in systemd/systemd#15668.

Thus, we sync with community's solution for uboot/tools/env utilities:
The current location /var/lock is considered legacy (at least by systemd).
Just use /run to store the lockfile and append the usual .lock suffix.

Tested:
Verified /run/lock is now present and fw_printenv can work in OpenBMC.

Signed-off-by: Tim Lee &lt;timlee660101@gmail.com&gt;
Reviewed-by: Tom Rini &lt;trini@konsulko.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tools: env: fw_env: Fix unused-result warning</title>
<updated>2022-12-08T14:25:44+00:00</updated>
<author>
<name>Jaehoon Chung</name>
<email>jh80.chung@samsung.com</email>
</author>
<published>2022-10-13T08:41:21+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=c059a22b7776dc4306acb73cbeb78e841cf60b84'/>
<id>c059a22b7776dc4306acb73cbeb78e841cf60b84</id>
<content type='text'>
Fix unused-result warning about fread.

tools/env/fw_env.c: In function ‘find_nvmem_device’:
tools/env/fw_env.c:1751:3: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
 1751 |   fread(buf, sizeof(buf), 1, fp);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Jaehoon Chung &lt;jh80.chung@samsung.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix unused-result warning about fread.

tools/env/fw_env.c: In function ‘find_nvmem_device’:
tools/env/fw_env.c:1751:3: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
 1751 |   fread(buf, sizeof(buf), 1, fp);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Jaehoon Chung &lt;jh80.chung@samsung.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
